MaxstARSDK
|
Public Member Functions | |
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) |
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) |
float | dotProduct (Vector4f input) |
void | lerp (Vector4f input, Vector4f output, float t) |
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 () |
void | x (float x) |
float | y () |
void | y (float y) |
float | z () |
void | z (float z) |
float | w () |
void | w (float w) |
void | setXYZW (float x, float y, float z, float w) |
boolean | compareTo (Vector4f rhs) |
void | copyFromV3f (Vector3f input, float w) |
Protected Attributes | |
float | points [] = { 0, 0, 0, 0 } |
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.
com.maxst.ar.Quaternion.Quaternion | ( | ) |
Creates a new Quaternion object and initialises it with the identity Quaternion
|
inherited |
|
inherited |
Adds the.
vector | the vector |
void com.maxst.ar.Quaternion.addQuat | ( | Quaternion | input | ) |
Add a quaternion to this quaternion
input | The quaternion that you want to add to this one |
void com.maxst.ar.Quaternion.addQuat | ( | Quaternion | input, |
Quaternion | output | ||
) |
Add this quaternion and another quaternion together and store the result in the output quaternion
input | The quaternion you want added to this quaternion |
output | The quaternion you want to store the output in. |
|
inherited |
To array.
|
inherited |
Compare this vector4f to the supplied one
rhs | True if they match, false other wise. |
|
inherited |
Copies the data from the supplied vec3 into this vec4 plus the supplied w.
input | The x y z values to copy in. |
w | The extra w element to copy in |
void com.maxst.ar.Quaternion.copyFromVec3 | ( | Vector3f | vec, |
float | w | ||
) |
|
inherited |
|
inherited |
MatrixF4x4 com.maxst.ar.Quaternion.getMatrix4x4 | ( | ) |
|
inherited |
Gets the w.
|
inherited |
Gets the x.
|
inherited |
Gets the y.
|
inherited |
Gets the z.
Linear interpolation between two vectors storing the result in the output variable.
input | |
output | |
t |
void com.maxst.ar.Quaternion.loadIdentityQuat | ( | ) |
Sets the quaternion to an identity quaternion of 0,0,0,1.
void com.maxst.ar.Quaternion.multiplyByQuat | ( | Quaternion | input | ) |
Multiply this quaternion by the input quaternion and store the result in the out quaternion
input | |
output |
void com.maxst.ar.Quaternion.multiplyByQuat | ( | Quaternion | input, |
Quaternion | output | ||
) |
Multiply this quaternion by the input quaternion and store the result in the out quaternion
input | |
output |
void com.maxst.ar.Quaternion.multiplyByScalar | ( | float | scalar | ) |
Multiplies this Quaternion with a scalar
scalar | the value that the vector should be multiplied with |
Reimplemented from com.maxst.ar.Vector4f.
void com.maxst.ar.Quaternion.normalise | ( | ) |
void com.maxst.ar.Quaternion.normalize | ( | ) |
void com.maxst.ar.Quaternion.set | ( | Quaternion | quat | ) |
Copies the values from the given quaternion to this one
quat | The quaternion to copy from |
void com.maxst.ar.Quaternion.setAxisAngle | ( | Vector3f | vec, |
float | rot | ||
) |
Rotation is in degrees. Set this quaternion from the supplied axis angle.
vec | The vector of rotation |
rot | The angle of rotation around that vector in degrees. |
void com.maxst.ar.Quaternion.setAxisAngleRad | ( | Vector3f | vec, |
double | rot | ||
) |
void com.maxst.ar.Quaternion.setColumnMajor | ( | float[] | matrix | ) |
You can set the values for this quaternion based off a rotation matrix. If the matrix you supply is not a rotation matrix this will fail. You MUST provide a 4x4 matrix.
matrix | A column major rotation matrix |
void com.maxst.ar.Quaternion.setEulerAngle | ( | float | azimuth, |
float | pitch, | ||
float | roll | ||
) |
Set this quaternion from axis angle values. All rotations are in degrees.
azimuth | The rotation around the z axis |
pitch | The rotation around the y axis |
roll | The rotation around the x axis |
void com.maxst.ar.Quaternion.setRowMajor | ( | float[] | matrix | ) |
You can set the values for this quaternion based off a rotation matrix. If the matrix you supply is not a rotation matrix this will fail.
matrix | A column major rotation matrix |
|
inherited |
Sets the w.
w | the new w |
|
inherited |
Sets the x.
x | the new x |
|
inherited |
|
inherited |
Sets the y.
y | the new y |
|
inherited |
Sets the z.
z | the new z |
void com.maxst.ar.Quaternion.slerp | ( | Quaternion | input, |
Quaternion | output, | ||
float | t | ||
) |
Get a linear interpolation between this quaternion and the input quaternion, storing the result in the output quaternion.
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); }
|
inherited |
void com.maxst.ar.Quaternion.subQuat | ( | Quaternion | input | ) |
Subtract a quaternion to this quaternion
input | The quaternion that you want to subtracted from this one |
void com.maxst.ar.Quaternion.subQuat | ( | Quaternion | input, |
Quaternion | output | ||
) |
Subtract another quaternion from this quaternion and store the result in the output quaternion
input | The quaternion you want subtracted from this quaternion |
output | The quaternion you want to store the output in. |
|
inherited |
void com.maxst.ar.Quaternion.toAxisAngle | ( | Vector4f | output | ) |
Get an axis angle representation of this quaternion.
output | Vector4f axis angle. |
double [] com.maxst.ar.Quaternion.toEulerAngles | ( | ) |
Returns the heading, attitude and bank of this quaternion as euler angles in the double array respectively
String com.maxst.ar.Quaternion.toString | ( | ) |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
protectedinherited |
The points.