A Vector with 3 floats.
Fields
public float | x | |
public float | y | |
public float | z |
Public Constructors
Vector3()
Construct a Vector3 and assign zero to all values
|
|
Vector3(float x, float y, float z)
Construct a Vector3 and assign each value
|
|
Public Methods
static Vector3 | |
static float |
angleBetweenVectors(Vector3 a, Vector3 b)
Returns the shortest angle in degrees between two vectors.
|
static Vector3 |
back()
Gets a Vector3 set to (0, 0, 1)
|
static Vector3 | |
static float | |
static Vector3 |
down()
Gets a Vector3 set to (0, -1, 0)
|
static boolean | |
boolean | |
static Vector3 |
forward()
Gets a Vector3 set to (0, 0, -1)
|
static Vector3 |
left()
Gets a Vector3 set to (-1, 0, 0)
|
float |
length()
|
float | |
static Vector3 | |
static Vector3 | |
static Vector3 | |
Vector3 |
negated()
Negates a Vector3
|
Vector3 |
normalized()
Scales the Vector3 to the unit length
|
static Vector3 |
one()
Gets a Vector3 with all values set to one
|
static Vector3 |
right()
Gets a Vector3 set to (1, 0, 0)
|
Vector3 |
scaled(float a)
Uniformly scales a Vector3
|
void | |
void |
set(float vx, float vy, float vz)
Set each value
|
static Vector3 | |
String |
toString()
|
static Vector3 |
up()
Gets a Vector3 set to (0, 1, 0)
|
static Vector3 |
zero()
Gets a Vector3 with all values set to zero
|
Inherited Methods
Fields
public float x
public float y
public float z
Public Constructors
public Vector3 ()
Construct a Vector3 and assign zero to all values
public Vector3 (float x, float y, float z)
Construct a Vector3 and assign each value
Parameters
x | |
---|---|
y | |
z |
Public Methods
public static Vector3 add (Vector3 lhs, Vector3 rhs)
Adds two Vector3's
Parameters
lhs | |
---|---|
rhs |
Returns
- The combined Vector3
public static float angleBetweenVectors (Vector3 a, Vector3 b)
Returns the shortest angle in degrees between two vectors. The result is never greater than 180 degrees.
Parameters
a | |
---|---|
b |
public static Vector3 cross (Vector3 lhs, Vector3 rhs)
Get cross product of two Vector3's
Parameters
lhs | |
---|---|
rhs |
Returns
- A Vector3 perpendicular to Vector3's
public static float dot (Vector3 lhs, Vector3 rhs)
Get dot product of two Vector3's
Parameters
lhs | |
---|---|
rhs |
Returns
- The scalar product of the Vector3's
public static boolean equals (Vector3 lhs, Vector3 rhs)
Compares two Vector3's are equal if each component is equal within a tolerance.
Parameters
lhs | |
---|---|
rhs |
public boolean equals (Object other)
Returns true if the other object is a Vector3 and each component is equal within a tolerance.
Parameters
other |
---|
public float length ()
public float lengthSquared ()
public static Vector3 lerp (Vector3 a, Vector3 b, float t)
Linearly interpolates between a and b.
Parameters
a | the beginning value |
---|---|
b | the ending value |
t | ratio between the two floats. |
Returns
- interpolated value between the two floats
public static Vector3 max (Vector3 lhs, Vector3 rhs)
Get a Vector3 with each value set to the element wise maximum of two Vector3's values
Parameters
lhs | |
---|---|
rhs |
public static Vector3 min (Vector3 lhs, Vector3 rhs)
Get a Vector3 with each value set to the element wise minimum of two Vector3's values
Parameters
lhs | |
---|---|
rhs |
public Vector3 scaled (float a)
Uniformly scales a Vector3
Parameters
a |
---|
Returns
- a Vector3 multiplied by a scalar amount
public void set (float vx, float vy, float vz)
Set each value
Parameters
vx | |
---|---|
vy | |
vz |
public static Vector3 subtract (Vector3 lhs, Vector3 rhs)
Subtract two Vector3
Parameters
lhs | |
---|---|
rhs |
Returns
- The combined Vector3