public class Vector3
extends java.lang.Object
Constructor and Description |
---|
Vector3() |
Vector3(float x,
float y,
float z) |
Vector3(Vector3 other) |
Modifier and Type | Method and Description |
---|---|
Vector3 |
add(Vector3 other)
Adds this vector to another.
|
Vector3 |
cross(Vector3 other)
Calculates the cross product between this vector
and another
|
float |
dot(Vector3 other)
Calculates the dot product between two vectors.
|
float |
length() |
static Vector3 |
lerp(Vector3 start,
Vector3 end,
float alpha)
Perform a linear interpolation between two vectors.
|
Vector3 |
multiply(float m)
Multiplies all components by a constant.
|
Vector3 |
multiply(Vector3 other) |
float |
normalize()
Sets the length of this vector to 1.
|
float |
squaredLength() |
Vector3 |
sub(Vector3 other)
Let another vector subtract from this one.
|
Vector3 |
vectorTo(Vector3 other)
Creates a vector pointing from this to the passed vector.
|
public Vector3(float x, float y, float z)
public Vector3(Vector3 other)
public Vector3()
public Vector3 vectorTo(Vector3 other)
The
- reference point.public float length()
public float squaredLength()
public float normalize()
public Vector3 multiply(float m)
m
- The constant by which the components will be multiplied.public Vector3 add(Vector3 other)
other
- The other vector which will be addedpublic Vector3 sub(Vector3 other)
other
- The other vector which will be subtracted from this.public float dot(Vector3 other)
other
- The other vector.public Vector3 cross(Vector3 other)
other
- The other vector