|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.cult3d.math.Vector3
A 3 element Vector with x, y and z coordinates.
Constructor Summary | |
Vector3()
Constructs and initializes a new vector. |
|
Vector3(float[] array)
Constructs a new vector and initializes it from the array parameter. |
|
Vector3(float x,
float y,
float z)
Constructs a new vector and initializes it to the specified values. |
|
Vector3(Vector3 v)
Constructs a new vector and initializes it from the vector parameter. |
Method Summary | |
void |
add(Vector3 v)
Sets this vector to the sum of itself and the vector parameter. |
void |
add(Vector3 v1,
Vector3 v2)
Sets this vector to the sum of the two vector parameters. |
float |
angle(Vector3 v)
Returns the angle in radians between this vector and the parameter. |
void |
cross(Vector3 v)
Sets this vector to the cross product of itself and the parameter. |
void |
cross(Vector3 v1,
Vector3 v2)
Sets this vector to the cross product of vectors v1 and v2. |
void |
div(float f)
Divides this vector with the parameter. |
void |
div(Vector3 v,
float f)
Sets this vector to the v parameter divided with the f parameter |
float |
dot(Vector3 v)
Computes the dot product of itself and the parameter. |
float |
dot(Vector3 v1,
Vector3 v2)
Computes the dot product of vectors v1 and v2. |
boolean |
equals(java.lang.Object obj)
Returns true if the Object obj is of type Vector3 and all of the coordinates of obj are equal to the corresponding coordinates in this Vector3. |
java.lang.String |
getInfo()
This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations and versions of Cult3D. |
float |
getX()
Gets this vectors x coordinate. |
float |
getY()
Gets this vectors y coordinate. |
float |
getZ()
Gets this vectors z coordinate. |
float |
length()
Returns the length of this vector. |
void |
mult(float f)
Multiplies this vector with the parameter. |
void |
mult(Vector3 v,
float f)
Sets this vector to the v parameter multiplied with the f parameter |
void |
normalize()
Sets this vector to its normal. |
void |
normalize(Vector3 v)
Sets this vector to the parameters normal. |
void |
setVector(float[] array)
Sets this vector to the values in the array parameter. |
void |
setVector(float x,
float y,
float z)
Sets this vector to the parameter values. |
void |
setVector(Vector3 v)
Sets this vector to the same values as the parameter. |
void |
setX(float x)
Sets this vector's x coordinate. |
void |
setY(float y)
Sets this vectors y coordinate. |
void |
setZ(float z)
Sets this vectors z coordinate. |
void |
sub(Vector3 v)
Sets this vector to the difference of itself and the vector parameter. |
void |
sub(Vector3 v1,
Vector3 v2)
Sets this vector to the difference of the two vector parameters. |
java.lang.String |
toString()
Returns a string representation of the values of this object. |
Methods inherited from class java.lang.Object |
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public Vector3()
public Vector3(float x, float y, float z)
x
- the x coordinatey
- the y coordinatez
- the z coordinatepublic Vector3(float[] array)
array
- array of length 3public Vector3(Vector3 v)
v
- the source vectorMethod Detail |
public void setVector(float x, float y, float z)
x
- the x coordinatey
- the y coordinatez
- the z coordinatepublic void setVector(float[] array)
array
- array of length 3public void setVector(Vector3 v)
v
- the source vectorpublic void setX(float x)
x
- the x coordinatepublic void setY(float y)
y
- the y coordinatepublic void setZ(float z)
z
- the z coordinatepublic float getX()
public float getY()
public float getZ()
public void add(Vector3 v)
v
- the vector to addpublic void add(Vector3 v1, Vector3 v2)
v1
- the first vector to addv2
- the second vector to addpublic void sub(Vector3 v)
v
- the vector to subtractpublic void sub(Vector3 v1, Vector3 v2)
v1
- the first vectorv2
- the second vectorpublic void div(float f)
f
- value to divide with.public void div(Vector3 v, float f)
v
- the vector to dividef
- value to divide with.public void mult(float f)
f
- value to multiplie with.public void mult(Vector3 v, float f)
v
- the vector to multiplief
- value to multiplie with.public void cross(Vector3 v)
v
- the vectorpublic void cross(Vector3 v1, Vector3 v2)
v1
- the first vectorv2
- the second vectorpublic float dot(Vector3 v)
v
- the vectorpublic float dot(Vector3 v1, Vector3 v2)
v1
- the first vectorv2
- the second vectorpublic final float length()
public final void normalize()
public final void normalize(Vector3 v)
v
- the vector to normalize.public final float angle(Vector3 v)
v
- the other vector.public boolean equals(java.lang.Object obj)
public java.lang.String getInfo()
This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations and versions of Cult3D.
public java.lang.String toString()
Returns a string representation of the values of this object.
The string contains the name of this class and the current x,y,z values of this vector.
This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations and versions of Cult3D.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |