|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectartofillusion.math.Vec3
public class Vec3
A Vec3 represents a 3 component vector.
Field Summary | |
---|---|
double |
x
|
double |
y
|
double |
z
|
Constructor Summary | |
---|---|
Vec3()
Create a new Vec3 whose x, y, and z components are all equal to 0.0. |
|
Vec3(java.io.DataInputStream in)
Create a Vec3 by reading in information that was written by writeToFile(). |
|
Vec3(double xval,
double yval,
double zval)
Create a new Vec3 with the specified x, y, and z components. |
|
Vec3(Vec3 v)
Create a new Vec3 identical to another one. |
Method Summary | |
---|---|
void |
add(Vec3 v)
Add another Vec3 to this one. |
Vec3 |
cross(Vec3 v)
Calculate the cross product of this vector with another one. |
double |
distance(Vec3 v)
Calculate the Euclidean distance between this vector and another one. |
double |
distance2(Vec3 v)
Calculate the square of the Euclidean distance between this vector and another one. |
double |
dot(Vec3 v)
Calculate the dot product of this vector with another one. |
Vec2 |
dropAxis(int which)
Create a 2 component vector by removing one axis of this one. |
boolean |
equals(java.lang.Object o)
Determine whether two vectors are identical. |
int |
hashCode()
|
double |
length()
Calculate the length of this vector. |
double |
length2()
Calculate the square of the length of this vector. |
Vec3 |
minus(Vec3 v)
Calculate the difference between this vector and another one. |
void |
multiply(Vec3 v)
Multiply each component of this vector by the corresponding component of another vector. |
void |
normalize()
Scale each component of this vector so that it has a length of 1. |
Vec3 |
plus(Vec3 v)
Calculate the sum of this vector and another one. |
void |
scale(double d)
Multiply each component of this vector by a constant. |
void |
set(double xval,
double yval,
double zval)
Set the x, y, and z components of this Vec3. |
void |
set(Vec3 v)
Set this Vec3 to be identical to another one. |
void |
subtract(Vec3 v)
Subtract another Vec3 from this one. |
Vec3 |
times(double d)
Create a new Vec3 by multiplying each component of this one by a constant. |
java.lang.String |
toString()
|
static Vec3 |
vx()
Create a unit vector which points in the X direction. |
static Vec3 |
vy()
Create a unit vector which points in the Y direction. |
static Vec3 |
vz()
Create a unit vector which points in the Z direction. |
void |
writeToFile(java.io.DataOutputStream out)
Write out a serialized representation of this object. |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public double x
public double y
public double z
Constructor Detail |
---|
public Vec3()
public Vec3(double xval, double yval, double zval)
public Vec3(Vec3 v)
public Vec3(java.io.DataInputStream in) throws java.io.IOException
java.io.IOException
Method Detail |
---|
public final void set(double xval, double yval, double zval)
public final void set(Vec3 v)
public final double dot(Vec3 v)
public final Vec3 cross(Vec3 v)
public final Vec3 plus(Vec3 v)
public final Vec3 minus(Vec3 v)
public final Vec3 times(double d)
public final boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public final double length()
public final double length2()
public final void add(Vec3 v)
public final void subtract(Vec3 v)
public final void multiply(Vec3 v)
public final void scale(double d)
public final void normalize()
public final double distance(Vec3 v)
public final double distance2(Vec3 v)
public final Vec2 dropAxis(int which)
which
- the axis to drop (0=X, 1=Y, 2=Z)public java.lang.String toString()
toString
in class java.lang.Object
public static Vec3 vx()
public static Vec3 vy()
public static Vec3 vz()
public void writeToFile(java.io.DataOutputStream out) throws java.io.IOException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |