public class Quaternion
extends java.lang.Object
Constructor and Description |
---|
Quaternion()
Defaults to the identity quaternion
|
Quaternion(float x,
float y,
float z,
float w) |
Quaternion(Quaternion other) |
Modifier and Type | Method and Description |
---|---|
static Quaternion |
fromAxisAngle(Vector3 axis,
float angle)
Create a quaternion from an axis-angle rotation
|
static Quaternion |
getIdentity() |
Quaternion |
inverse()
Get the inverse of this quaternion
|
void |
invert()
Invert this quaternion
|
float |
length()
Get the "length" of this quaternion
|
Quaternion |
multiply(Quaternion other)
Multiply this quaternion with another
|
Vector3 |
multiply(Vector3 vector) |
void |
multiplyNoTmp(Quaternion other)
Multiply this quaternion with another
|
void |
multiplyNoTmp(Vector3 vector) |
void |
normalize()
Normalize this quaternion
|
Quaternion |
normalized()
Get a normalized version of this quaternion
|
Quaternion |
rotate(Vector3 axis,
float angle) |
static Quaternion |
slerp(Quaternion start,
Quaternion end,
float alpha)
Perform a spherical linear interpolation between the two quaternion q1 and q2
|
float[] |
toMatrix()
Converts this quaternion to a 4x4 matrix
|
void |
toMatrix(float[] matrix) |
public Quaternion()
public Quaternion(float x, float y, float z, float w)
public Quaternion(Quaternion other)
public Quaternion normalized()
public float length()
public void normalize()
public Quaternion inverse()
public void invert()
public Quaternion multiply(Quaternion other)
other
- public void multiplyNoTmp(Quaternion other)
other
- public Quaternion rotate(Vector3 axis, float angle)
public float[] toMatrix()
public void toMatrix(float[] matrix)
public static Quaternion getIdentity()
public static Quaternion fromAxisAngle(Vector3 axis, float angle)
public static Quaternion slerp(Quaternion start, Quaternion end, float alpha)
start
- The start rotationend
- The end rotationalpha
- The blending factor (0 <= alpha <= 1) with
0: start rotation and
1: end rotationpublic void multiplyNoTmp(Vector3 vector)