|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.badlogic.gdx.math.Vector3
public class Vector3
Encapsulates a 3D vector. Allows chaining operations by returning a reference to it self in all modification methods.
Field Summary | |
---|---|
float |
x
the x-component of this vector |
static Vector3 |
X
|
float |
y
the x-component of this vector |
static Vector3 |
Y
|
float |
z
the x-component of this vector |
static Vector3 |
Z
|
Constructor Summary | |
---|---|
Vector3()
Constructs a vector at (0,0,0) |
|
Vector3(float[] values)
Creates a vector from the given array. |
|
Vector3(float x,
float y,
float z)
Creates a vector with the given components |
|
Vector3(Vector3 vector)
Creates a vector from the given vector |
Method Summary | |
---|---|
Vector3 |
add(float values)
Adds the given value to all three components of the vector. |
Vector3 |
add(float x,
float y,
float z)
Adds the given vector to this component |
Vector3 |
add(Vector3 vector)
Adds the given vector to this vector |
Vector3 |
cpy()
|
Vector3 |
crs(float x,
float y,
float z)
Sets this vector to the cross product between it and the other vector. |
Vector3 |
crs(Vector3 vector)
Sets this vector to the cross product between it and the other vector. |
Vector3 |
div(float value)
Divides all components of this vector by the given value |
float |
dot(float x,
float y,
float z)
Returns the dot product between this and the given vector. |
float |
dot(Vector3 vector)
|
float |
dst(float x,
float y,
float z)
|
float |
dst(Vector3 vector)
|
float |
dst2(float x,
float y,
float z)
Returns the squared distance between this point and the given point |
float |
dst2(Vector3 point)
Returns the squared distance between this point and the given point |
boolean |
equals(java.lang.Object obj)
|
int |
hashCode()
|
boolean |
idt(Vector3 vector)
|
boolean |
isUnit()
|
boolean |
isZero()
|
float |
len()
|
float |
len2()
|
Vector3 |
lerp(Vector3 target,
float alpha)
Linearly interpolates between this vector and the target vector by alpha which is in the range [0,1]. |
Vector3 |
mul(float value)
Multiplies all components of this vector by the given value |
Vector3 |
mul(Matrix4 matrix)
Multiplies the vector by the given matrix. |
Vector3 |
nor()
Normalizes this vector to unit length |
Vector3 |
prj(Matrix4 matrix)
Multiplies this vector by the given matrix dividing by w. |
Vector3 |
rot(Matrix4 matrix)
Multiplies this vector by the first three columns of the matrix, essentially only applying rotation and scaling. |
Vector3 |
scale(float scalarX,
float scalarY,
float scalarZ)
Scales the vector components by the given scalars. |
Vector3 |
set(float[] values)
Sets the components from the array. |
Vector3 |
set(float x,
float y,
float z)
Sets the vector to the given components |
Vector3 |
set(Vector3 vector)
Sets the components of the given vector |
Vector3 |
slerp(Vector3 target,
float alpha)
Spherically interpolates between this vector and the target vector by alpha which is in the range [0,1]. |
Vector3 |
sub(float value)
Subtracts the given value from all components of this vector |
Vector3 |
sub(float x,
float y,
float z)
Subtracts the other vector from this vector. |
Vector3 |
sub(Vector3 a_vec)
Subtracts the given vector from this vector |
Vector3 |
tmp()
NEVER EVER SAVE THIS REFERENCE! |
Vector3 |
tmp2()
NEVER EVER SAVE THIS REFERENCE! |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public float x
public float y
public float z
public static Vector3 X
public static Vector3 Y
public static Vector3 Z
Constructor Detail |
---|
public Vector3()
public Vector3(float x, float y, float z)
x
- The x-componenty
- The y-componentz
- The z-componentpublic Vector3(Vector3 vector)
vector
- The vectorpublic Vector3(float[] values)
values
- The arrayMethod Detail |
---|
public Vector3 set(float x, float y, float z)
x
- The x-componenty
- The y-componentz
- The z-component
public Vector3 set(Vector3 vector)
vector
- The vector
public Vector3 set(float[] values)
values
- The array
public Vector3 cpy()
public Vector3 tmp()
public Vector3 tmp2()
public Vector3 add(Vector3 vector)
vector
- The other vector
public Vector3 add(float x, float y, float z)
x
- The x-component of the other vectory
- The y-component of the other vectorz
- The z-component of the other vector
public Vector3 add(float values)
values
- The value
public Vector3 sub(Vector3 a_vec)
a_vec
- The other vector
public Vector3 sub(float x, float y, float z)
x
- The x-component of the other vectory
- The y-component of the other vectorz
- The z-component of the other vector
public Vector3 sub(float value)
value
- The value
public Vector3 mul(float value)
value
- The value
public Vector3 div(float value)
value
- The value
public float len()
public float len2()
public boolean idt(Vector3 vector)
vector
- The other vector
public float dst(Vector3 vector)
vector
- The other vector
public Vector3 nor()
public float dot(Vector3 vector)
vector
- The other vector
public Vector3 crs(Vector3 vector)
vector
- The other vector
public Vector3 crs(float x, float y, float z)
x
- The x-component of the other vectory
- The y-component of the other vectorz
- The z-component of the other vector
public Vector3 mul(Matrix4 matrix)
matrix
- The matrix
public Vector3 prj(Matrix4 matrix)
matrix
- The matrix.
public Vector3 rot(Matrix4 matrix)
matrix
- The matrix
public boolean isUnit()
public boolean isZero()
public Vector3 lerp(Vector3 target, float alpha)
target
- The target vectoralpha
- The interpolation coefficient
public Vector3 slerp(Vector3 target, float alpha)
target
- The target vectoralpha
- The interpolation coefficient
public java.lang.String toString()
toString
in class java.lang.Object
public float dot(float x, float y, float z)
x
- The x-component of the other vectory
- The y-component of the other vectorz
- The z-component of the other vector
public float dst2(Vector3 point)
point
- The other point
public float dst2(float x, float y, float z)
x
- The x-component of the other pointy
- The y-component of the other pointz
- The z-component of the other point
public float dst(float x, float y, float z)
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public Vector3 scale(float scalarX, float scalarY, float scalarZ)
scalarX
- scalarY
- scalarZ
-
|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |