|
| | Quaternion () |
| |
| void | normalise () |
| |
|
void | normalize () |
| |
| void | set (Quaternion quat) |
| |
| void | multiplyByQuat (Quaternion input, Quaternion output) |
| |
| void | multiplyByQuat (Quaternion input) |
| |
| void | multiplyByScalar (float scalar) |
| |
| void | addQuat (Quaternion input) |
| |
| void | addQuat (Quaternion input, Quaternion output) |
| |
| void | subQuat (Quaternion input) |
| |
| void | subQuat (Quaternion input, Quaternion output) |
| |
| void | toAxisAngle (Vector4f output) |
| |
| double [] | toEulerAngles () |
| |
| void | loadIdentityQuat () |
| |
|
String | toString () |
| |
| void | setColumnMajor (float[] matrix) |
| |
| void | setRowMajor (float[] matrix) |
| |
| void | setEulerAngle (float azimuth, float pitch, float roll) |
| |
| void | setAxisAngle (Vector3f vec, float rot) |
| |
|
void | setAxisAngleRad (Vector3f vec, double rot) |
| |
| MatrixF4x4 | getMatrix4x4 () |
| |
|
void | copyFromVec3 (Vector3f vec, float w) |
| |
| void | slerp (Quaternion input, Quaternion output, float t) |
| |
| | Vector4f (float x, float y, float z, float w) |
| |
| | Vector4f () |
| |
|
| Vector4f (Vector3f vector3f, float w) |
| |
| float [] | array () |
| |
|
void | copyVec4 (Vector4f vec) |
| |
| void | add (Vector4f vector) |
| |
|
void | add (Vector3f vector, float w) |
| |
|
void | subtract (Vector4f vector) |
| |
|
void | subtract (Vector4f vector, Vector4f output) |
| |
|
void | subdivide (Vector4f vector) |
| |
| void | multiplyByScalar (float scalar) |
| |
|
float | dotProduct (Vector4f input) |
| |
| void | lerp (Vector4f input, Vector4f output, float t) |
| |
| void | normalize () |
| |
| float | getX () |
| |
| float | getY () |
| |
| float | getZ () |
| |
| float | getW () |
| |
| void | setX (float x) |
| |
| void | setY (float y) |
| |
| void | setZ (float z) |
| |
| void | setW (float w) |
| |
|
float | x () |
| |
|
float | y () |
| |
|
float | z () |
| |
|
float | w () |
| |
|
void | x (float x) |
| |
|
void | y (float y) |
| |
|
void | z (float z) |
| |
|
void | w (float w) |
| |
|
void | setXYZW (float x, float y, float z, float w) |
| |
| boolean | compareTo (Vector4f rhs) |
| |
| void | copyFromV3f (Vector3f input, float w) |
| |
|
String | toString () |
| |
The Quaternion class. A Quaternion is a four-dimensional vector that is used to represent rotations of a rigid body in the 3D space. It is very similar to a rotation vector; it contains an angle, encoded into the w component and three components to describe the rotation-axis (encoded into x, y, z).
Quaternions allow for elegant descriptions of 3D rotations, interpolations as well as extrapolations and compared to Euler angles, they don't suffer from gimbal lock. Interpolations between two Quaternions are called SLERP (Spherical Linear Interpolation).
This class also contains the representation of the same rotation as a Quaternion and 4x4-Rotation-Matrix.
- Author
- Leigh Beattie, Alexander Pacha
Get a linear interpolation between this quaternion and the input quaternion, storing the result in the output quaternion.
- Parameters
-
| input | The quaternion to be slerped with this quaternion. |
| output | The quaternion to store the result in. |
| t | The ratio between the two quaternions where 0 <= t <= 1.0 . Increase value of t will bring rotation closer to the input quaternion. |
if(dot < 0.95f){ double angle = Math.acos(dot); double ratioA = Math.sin((1 - t) * angle); double ratioB = Math.sin(t * angle); double divisor = Math.sin(angle);
//Calculate Quaternion output.setW((float)((this.getW() * ratioA + input.getW() * ratioB)/divisor)); output.setX((float)((this.getX() * ratioA + input.getX() * ratioB)/divisor)); output.setY((float)((this.getY() * ratioA + input.getY() * ratioB)/divisor)); output.setZ((float)((this.getZ() * ratioA + input.getZ() * ratioB)/divisor)); } else{ lerp(input, output, t); }