| Modifier and Type | Field and Description |
|---|---|
| private static final long | |
| private static Quaternion | |
| private static Quaternion | |
| public float | |
| public float | |
| public float | |
| public float |
| Access | Constructor and Description |
|---|---|
| public | Quaternion(float
The x-component x, float The y-component y, float The z-component z, float The w-component w)Constructor, sets the four components of the quaternion. |
| public | |
| public | Quaternion(Quaternion
The quaternion to copy. quaternion)Constructor, sets the quaternion components from the given quaternion. |
| public | Quaternion(Vector3
The axis axis, float The angle in degrees. angle)Constructor, sets the quaternion from the given axis vector and the angle around that axis in degrees. |
| Modifier and Type | Method and Description |
|---|---|
| public Quaternion | add(Quaternion quaternion)
Add the x,y,z,w components of the passed in quaternion to the ones of this quaternion |
| public Quaternion | add(float qx, float qy, float qz, float qw)
Add the x,y,z,w components of the passed in quaternion to the ones of this quaternion |
| public Quaternion | |
| public Quaternion | |
| public static final float | Returns: the dot product between the first and second quaternion.the x component of the first quaternion x1, final float the y component of the first quaternion y1, final float the z component of the first quaternion z1, final float the w component of the first quaternion w1, final float the x component of the second quaternion x2, final float the y component of the second quaternion y2, final float the z component of the second quaternion z2, final float the w component of the second quaternion w2)Get the dot product between the two quaternions (commutative). |
| public float | Returns: the dot product of this and the other quaternion.the other quaternion. other)Get the dot product between this and the other quaternion (commutative). |
| public float | Returns: the dot product of this and the other quaternion.the x component of the other quaternion x, final float the y component of the other quaternion y, final float the z component of the other quaternion z, final float the w component of the other quaternion w)Get the dot product between this and the other quaternion (commutative). |
| public boolean | equals(Object obj)
Overrides java. Indicates whether some other object is "equal to" this one. |
| public Quaternion | Returns: This quaternion for chainingExponent alpha)Calculates (this quaternion)^alpha where alpha is a real number and stores the result in this quaternion. |
| public float | Returns: the angle in degrees of the rotationGet the angle in degrees of the rotation this quaternion represents. |
| public float | Returns: the angle in degrees of the rotation around the specified axisthe x component of the normalized axis for which to get the angle axisX, final float the y component of the normalized axis for which to get the angle axisY, final float the z component of the normalized axis for which to get the angle axisZ)Get the angle in degrees of the rotation around the specified axis. |
| public float | Returns: the angle in degrees of the rotation around the specified axisthe normalized axis for which to get the angle axis)Get the angle in degrees of the rotation around the specified axis. |
| public float | Returns: the angle in radians of the rotation around the specified axisthe x component of the normalized axis for which to get the angle axisX, final float the y component of the normalized axis for which to get the angle axisY, final float the z component of the normalized axis for which to get the angle axisZ)Get the angle in radians of the rotation around the specified axis. |
| public float | Returns: the angle in radians of the rotation around the specified axisthe normalized axis for which to get the angle axis)Get the angle in radians of the rotation around the specified axis. |
| public float | Returns: the angle in radians of the rotationGet the angle in radians of the rotation this quaternion represents. |
| public float | Returns: the angle in degreesvector which will receive the axis axis)Get the axis angle representation of the rotation in degrees. |
| public float | Returns: the angle in radiansvector which will receive the axis axis)Get the axis-angle representation of the rotation in radians. |
| public int | Returns: positive (+1) for north pole, negative (-1) for south pole, zero (0) when no gimbal lockGet the pole of the gimbal lock, if any. |
| public float | Returns: the rotation around the x axis in degrees (between -90 and +90)Get the pitch euler angle in degrees, which is the rotation around the x axis. |
| public float | Returns: the rotation around the x axis in radians (between -(PI/2) and +(PI/2))Get the pitch euler angle in radians, which is the rotation around the x axis. |
| public float | Returns: the rotation around the z axis in degrees (between -180 and +180)Get the roll euler angle in degrees, which is the rotation around the z axis. |
| public float | Returns: the rotation around the z axis in radians (between -PI and +PI)Get the roll euler angle in radians, which is the rotation around the z axis. |
| public void | getSwingTwist(final float
the X component of the normalized axis for which to get the swing and twist rotation axisX, final float the Y component of the normalized axis for which to get the swing and twist rotation axisY, final float the Z component of the normalized axis for which to get the swing and twist rotation axisZ, final Quaternion will receive the swing rotation: the rotation around an axis perpendicular to the specified axis swing, final Quaternion will receive the twist rotation: the rotation around the specified axis twist)Get the swing rotation and twist rotation for the specified axis. |
| public void | getSwingTwist(final Vector3
the normalized axis for which to get the swing and twist rotation axis, final Quaternion will receive the swing rotation: the rotation around an axis perpendicular to the specified axis swing, final Quaternion will receive the twist rotation: the rotation around the specified axis twist)Get the swing rotation and twist rotation for the specified axis. |
| public float | Returns: the rotation around the y axis in degrees (between -180 and +180)Get the yaw euler angle in degrees, which is the rotation around the y axis. |
| public float | Returns: the rotation around the y axis in radians (between -PI and +PI)Get the yaw euler angle in radians, which is the rotation around the y axis. |
| public int | |
| public Quaternion | |
| public boolean | |
| public boolean | |
| public static final float | len(final float x, final float y, final float z, final float w)
Returns: the euclidean length of the specified quaternion |
| public float | |
| public static final float | |
| public float | |
| public Quaternion | Returns: This quaternion for chainingQuaternion to multiply with other)Multiplies this quaternion with another one in the form of this = this * other |
| public Quaternion | Returns: This quaternion for chainingthe x component of the other quaternion to multiply with x, final float the y component of the other quaternion to multiply with y, final float the z component of the other quaternion to multiply with z, final float the w component of the other quaternion to multiply with w)Multiplies this quaternion with another one in the form of this = this * other |
| public Quaternion | Returns: this quaternion for chaining.the scalar. scalar)Multiplies the components of this quaternion with the given scalar. |
| public Quaternion | Returns: This quaternion for chainingQuaternion to multiply with other)Multiplies this quaternion with another one in the form of this = other * this |
| public Quaternion | Returns: This quaternion for chainingthe x component of the other quaternion to multiply with x, final float the y component of the other quaternion to multiply with y, final float the z component of the other quaternion to multiply with z, final float the w component of the other quaternion to multiply with w)Multiplies this quaternion with another one in the form of this = other * this |
| public Quaternion | |
| public Quaternion | Returns: This quaternion for chainingThe x-component x, float The y-component y, float The z-component z, float The w-component w)Sets the components of the quaternion |
| public Quaternion | Returns: This quaternion for chaining.The quaternion. quaternion)Sets the quaternion components from the given quaternion. |
| public Quaternion | |
| public Quaternion | Returns: this quaternionthe rotation around the y axis in degrees yaw, float the rotation around the x axis in degrees pitch, float the rotation around the z axis degrees roll)Sets the quaternion to the given euler angles in degrees. |
| public Quaternion | Returns: this quaternionthe rotation around the y axis in radians yaw, float the rotation around the x axis in radians pitch, float the rotation around the z axis in radians roll)Sets the quaternion to the given euler angles in radians. |
| public Quaternion | setFromAxes(float
x-axis x-coordinate xx, float x-axis y-coordinate xy, float x-axis z-coordinate xz, float y-axis x-coordinate yx, float y-axis y-coordinate yy, float y-axis z-coordinate yz, float z-axis x-coordinate zx, float z-axis y-coordinate zy, float z-axis z-coordinate zz)Sets the Quaternion from the given x-, y- and z-axis which have to be orthonormal. |
| public Quaternion | setFromAxes(boolean
whether to normalize the axes (necessary when they contain scaling) normalizeAxes, float x-axis x-coordinate xx, float x-axis y-coordinate xy, float x-axis z-coordinate xz, float y-axis x-coordinate yx, float y-axis y-coordinate yy, float y-axis z-coordinate yz, float z-axis x-coordinate zx, float z-axis y-coordinate zy, float z-axis z-coordinate zz)Sets the Quaternion from the given x-, y- and z-axis. |
| public Quaternion | Returns: This quaternion for chaining.The axis axis, final float The angle in degrees degrees)Sets the quaternion components from the given axis and angle around that axis. |
| public Quaternion | Returns: This quaternion for chaining.X direction of the axis x, final float Y direction of the axis y, final float Z direction of the axis z, final float The angle in degrees degrees)Sets the quaternion components from the given axis and angle around that axis. |
| public Quaternion | Returns: This quaternion for chaining.The axis axis, final float The angle in radians radians)Sets the quaternion components from the given axis and angle around that axis. |
| public Quaternion | Returns: This quaternion for chaining.X direction of the axis x, final float Y direction of the axis y, final float Z direction of the axis z, final float The angle in radians radians)Sets the quaternion components from the given axis and angle around that axis. |
| public Quaternion | Returns: This quaternion for chainingThe base vector, which should be normalized. v1, final Vector3 The target vector, which should be normalized. v2)Set this quaternion to the rotation between two vectors. |
| public Quaternion | Returns: This quaternion for chainingThe base vectors x value, which should be normalized. x1, final float The base vectors y value, which should be normalized. y1, final float The base vectors z value, which should be normalized. z1, final float The target vector x value, which should be normalized. x2, final float The target vector y value, which should be normalized. y2, final float The target vector z value, which should be normalized. z2)Set this quaternion to the rotation between two vectors. |
| public Quaternion | setFromMatrix(boolean normalizeAxes, Matrix4 matrix)
Sets the Quaternion from the given matrix, optionally removing any scaling. |
| public Quaternion | setFromMatrix(Matrix4 matrix)
Sets the Quaternion from the given rotation matrix, which must not contain scaling. |
| public Quaternion | setFromMatrix(boolean normalizeAxes, Matrix3 matrix)
Sets the Quaternion from the given matrix, optionally removing any scaling. |
| public Quaternion | setFromMatrix(Matrix3 matrix)
Sets the Quaternion from the given rotation matrix, which must not contain scaling. |
| public Quaternion | Returns: this quaternion for chainingthe end quaternion end, float alpha in the range [0,1] alpha)Spherical linear interpolation between this quaternion and the other quaternion, based on the alpha value in the range [0,1]. |
| public Quaternion | Returns: This quaternion for chainingList of quaternions q)Spherical linearly interpolates multiple quaternions and stores the result in this Quaternion. |
| public Quaternion | Returns: This quaternion for chainingList of quaternions q, float[] List of weights w)Spherical linearly interpolates multiple quaternions by the given weights and stores the result in this Quaternion. |
| public void | toMatrix(final float[]
Matrix to fill matrix)Fills a 4x4 matrix with the rotation matrix represented by this quaternion. |
| public String | |
| public Vector3 |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| tmp1 | back to summary |
|---|---|
| private static Quaternion tmp1 | |
| tmp2 | back to summary |
|---|---|
| private static Quaternion tmp2 | |
| w | back to summary |
|---|---|
| public float w | |
| x | back to summary |
|---|---|
| public float x | |
| y | back to summary |
|---|---|
| public float y | |
| z | back to summary |
|---|---|
| public float z | |
| Quaternion | back to summary |
|---|---|
| public Quaternion(float x, float y, float z, float w) Constructor, sets the four components of the quaternion.
| |
| Quaternion | back to summary |
|---|---|
| public Quaternion() | |
| Quaternion | back to summary |
|---|---|
| public Quaternion(Quaternion quaternion) Constructor, sets the quaternion components from the given quaternion.
| |
| Quaternion | back to summary |
|---|---|
| public Quaternion(Vector3 axis, float angle) Constructor, sets the quaternion from the given axis vector and the angle around that axis in degrees.
| |
| add | back to summary |
|---|---|
| public Quaternion add(Quaternion quaternion) Add the x,y,z,w components of the passed in quaternion to the ones of this quaternion | |
| add | back to summary |
|---|---|
| public Quaternion add(float qx, float qy, float qz, float qw) Add the x,y,z,w components of the passed in quaternion to the ones of this quaternion | |
| conjugate | back to summary |
|---|---|
| public Quaternion conjugate() Conjugate the quaternion.
| |
| cpy | back to summary |
|---|---|
public Quaternion cpy()
| |
| dot | back to summary |
|---|---|
| public static final float dot(final float x1, final float y1, final float z1, final float w1, final float x2, final float y2, final float z2, final float w2) Get the dot product between the two quaternions (commutative).
| |
| dot | back to summary |
|---|---|
| public float dot(final Quaternion other) Get the dot product between this and the other quaternion (commutative).
| |
| dot | back to summary |
|---|---|
| public float dot(final float x, final float y, final float z, final float w) Get the dot product between this and the other quaternion (commutative).
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.
| |
| exp | back to summary |
|---|---|
| public Quaternion exp(float alpha) Calculates (this quaternion)^alpha where alpha is a real number and stores the result in this quaternion. See http://en.wikipedia.org/wiki/Quaternion#Exponential.2C_logarithm.2C_and_power
| |
| getAngle | back to summary |
|---|---|
| public float getAngle() Get the angle in degrees of the rotation this quaternion represents. Use
| |
| getAngleAround | back to summary |
|---|---|
| public float getAngleAround(final float axisX, final float axisY, final float axisZ) Get the angle in degrees of the rotation around the specified axis. The axis must be normalized.
| |
| getAngleAround | back to summary |
|---|---|
| public float getAngleAround(final Vector3 axis) Get the angle in degrees of the rotation around the specified axis. The axis must be normalized.
| |
| getAngleAroundRad | back to summary |
|---|---|
| public float getAngleAroundRad(final float axisX, final float axisY, final float axisZ) Get the angle in radians of the rotation around the specified axis. The axis must be normalized.
| |
| getAngleAroundRad | back to summary |
|---|---|
| public float getAngleAroundRad(final Vector3 axis) Get the angle in radians of the rotation around the specified axis. The axis must be normalized.
| |
| getAngleRad | back to summary |
|---|---|
| public float getAngleRad() Get the angle in radians of the rotation this quaternion represents. Does not normalize the quaternion. Use
| |
| getAxisAngle | back to summary |
|---|---|
| public float getAxisAngle(Vector3 axis) Get the axis angle representation of the rotation in degrees. The supplied vector will receive the axis (x, y and z values) of the rotation and the value returned is the angle in degrees around that axis. Note that this method will alter the supplied vector, the existing value of the vector is ignored. This will normalize this quaternion if needed. The received axis is a unit vector. However, if this is an identity quaternion (no rotation), then the length of the axis may be zero.
| |
| getAxisAngleRad | back to summary |
|---|---|
| public float getAxisAngleRad(Vector3 axis) Get the axis-angle representation of the rotation in radians. The supplied vector will receive the axis (x, y and z values) of the rotation and the value returned is the angle in radians around that axis. Note that this method will alter the supplied vector, the existing value of the vector is ignored. This will normalize this quaternion if needed. The received axis is a unit vector. However, if this is an identity quaternion (no rotation), then the length of the axis may be zero.
| |
| getGimbalPole | back to summary |
|---|---|
| public int getGimbalPole() Get the pole of the gimbal lock, if any.
| |
| getPitch | back to summary |
|---|---|
| public float getPitch() Get the pitch euler angle in degrees, which is the rotation around the x axis. Requires that this quaternion is normalized.
| |
| getPitchRad | back to summary |
|---|---|
| public float getPitchRad() Get the pitch euler angle in radians, which is the rotation around the x axis. Requires that this quaternion is normalized.
| |
| getRoll | back to summary |
|---|---|
| public float getRoll() Get the roll euler angle in degrees, which is the rotation around the z axis. Requires that this quaternion is normalized.
| |
| getRollRad | back to summary |
|---|---|
| public float getRollRad() Get the roll euler angle in radians, which is the rotation around the z axis. Requires that this quaternion is normalized.
| |
| getSwingTwist | back to summary |
|---|---|
| public void getSwingTwist(final float axisX, final float axisY, final float axisZ, final Quaternion swing, final Quaternion twist) Get the swing rotation and twist rotation for the specified axis. The twist rotation represents the rotation around the specified axis. The swing rotation represents the rotation of the specified axis itself, which is the rotation around an axis perpendicular to the specified axis. The swing and twist rotation can be used to reconstruct the original quaternion: this = swing * twist
| |
| getSwingTwist | back to summary |
|---|---|
| public void getSwingTwist(final Vector3 axis, final Quaternion swing, final Quaternion twist) Get the swing rotation and twist rotation for the specified axis. The twist rotation represents the rotation around the specified axis. The swing rotation represents the rotation of the specified axis itself, which is the rotation around an axis perpendicular to the specified axis. The swing and twist rotation can be used to reconstruct the original quaternion: this = swing * twist
| |
| getYaw | back to summary |
|---|---|
| public float getYaw() Get the yaw euler angle in degrees, which is the rotation around the y axis. Requires that this quaternion is normalized.
| |
| getYawRad | back to summary |
|---|---|
| public float getYawRad() Get the yaw euler angle in radians, which is the rotation around the y axis. Requires that this quaternion is normalized.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| idt | back to summary |
|---|---|
| public Quaternion idt() Sets the quaternion to an identity Quaternion
| |
| isIdentity | back to summary |
|---|---|
public boolean isIdentity()
| |
| isIdentity | back to summary |
|---|---|
public boolean isIdentity(final float tolerance)
| |
| len | back to summary |
|---|---|
public static final float len(final float x, final float y, final float z, final float w)
| |
| len | back to summary |
|---|---|
public float len()
| |
| len2 | back to summary |
|---|---|
| public static final float len2(final float x, final float y, final float z, final float w) | |
| len2 | back to summary |
|---|---|
public float len2()
| |
| mul | back to summary |
|---|---|
| public Quaternion mul(final Quaternion other) Multiplies this quaternion with another one in the form of this = this * other
| |
| mul | back to summary |
|---|---|
| public Quaternion mul(final float x, final float y, final float z, final float w) Multiplies this quaternion with another one in the form of this = this * other
| |
| mul | back to summary |
|---|---|
| public Quaternion mul(float scalar) Multiplies the components of this quaternion with the given scalar.
| |
| mulLeft | back to summary |
|---|---|
| public Quaternion mulLeft(Quaternion other) Multiplies this quaternion with another one in the form of this = other * this
| |
| mulLeft | back to summary |
|---|---|
| public Quaternion mulLeft(final float x, final float y, final float z, final float w) Multiplies this quaternion with another one in the form of this = other * this
| |
| nor | back to summary |
|---|---|
| public Quaternion nor() Normalizes this quaternion to unit length
| |
| set | back to summary |
|---|---|
| public Quaternion set(float x, float y, float z, float w) Sets the components of the quaternion
| |
| set | back to summary |
|---|---|
| public Quaternion set(Quaternion quaternion) Sets the quaternion components from the given quaternion.
| |
| set | back to summary |
|---|---|
| public Quaternion set(Vector3 axis, float angle) Sets the quaternion components from the given axis and angle around that axis.
| |
| setEulerAngles | back to summary |
|---|---|
| public Quaternion setEulerAngles(float yaw, float pitch, float roll) Sets the quaternion to the given euler angles in degrees.
| |
| setEulerAnglesRad | back to summary |
|---|---|
| public Quaternion setEulerAnglesRad(float yaw, float pitch, float roll) Sets the quaternion to the given euler angles in radians.
| |
| setFromAxes | back to summary |
|---|---|
| public Quaternion setFromAxes(float xx, float xy, float xz, float yx, float yy, float yz, float zx, float zy, float zz) Sets the Quaternion from the given x-, y- and z-axis which have to be orthonormal. Taken from Bones framework for JPCT, see http://www.aptalkarga.com/bones/ which in turn took it from Graphics Gem code at ftp://ftp.cis.upenn.edu/pub/graphics/shoemake/quatut.ps.Z.
| |
| setFromAxes | back to summary |
|---|---|
| public Quaternion setFromAxes(boolean normalizeAxes, float xx, float xy, float xz, float yx, float yy, float yz, float zx, float zy, float zz) Sets the Quaternion from the given x-, y- and z-axis. Taken from Bones framework for JPCT, see http://www.aptalkarga.com/bones/ which in turn took it from Graphics Gem code at ftp://ftp.cis.upenn.edu/pub/graphics/shoemake/quatut.ps.Z.
| |
| setFromAxis | back to summary |
|---|---|
| public Quaternion setFromAxis(final Vector3 axis, final float degrees) Sets the quaternion components from the given axis and angle around that axis.
| |
| setFromAxis | back to summary |
|---|---|
| public Quaternion setFromAxis(final float x, final float y, final float z, final float degrees) Sets the quaternion components from the given axis and angle around that axis.
| |
| setFromAxisRad | back to summary |
|---|---|
| public Quaternion setFromAxisRad(final Vector3 axis, final float radians) Sets the quaternion components from the given axis and angle around that axis.
| |
| setFromAxisRad | back to summary |
|---|---|
| public Quaternion setFromAxisRad(final float x, final float y, final float z, final float radians) Sets the quaternion components from the given axis and angle around that axis.
| |
| setFromCross | back to summary |
|---|---|
| public Quaternion setFromCross(final Vector3 v1, final Vector3 v2) Set this quaternion to the rotation between two vectors.
| |
| setFromCross | back to summary |
|---|---|
| public Quaternion setFromCross(final float x1, final float y1, final float z1, final float x2, final float y2, final float z2) Set this quaternion to the rotation between two vectors.
| |
| setFromMatrix | back to summary |
|---|---|
| public Quaternion setFromMatrix(boolean normalizeAxes, Matrix4 matrix) Sets the Quaternion from the given matrix, optionally removing any scaling. | |
| setFromMatrix | back to summary |
|---|---|
| public Quaternion setFromMatrix(Matrix4 matrix) Sets the Quaternion from the given rotation matrix, which must not contain scaling. | |
| setFromMatrix | back to summary |
|---|---|
| public Quaternion setFromMatrix(boolean normalizeAxes, Matrix3 matrix) Sets the Quaternion from the given matrix, optionally removing any scaling. | |
| setFromMatrix | back to summary |
|---|---|
| public Quaternion setFromMatrix(Matrix3 matrix) Sets the Quaternion from the given rotation matrix, which must not contain scaling. | |
| slerp | back to summary |
|---|---|
| public Quaternion slerp(Quaternion end, float alpha) Spherical linear interpolation between this quaternion and the other quaternion, based on the alpha value in the range [0,1]. Taken from Bones framework for JPCT, see http://www.aptalkarga.com/bones/
| |
| slerp | back to summary |
|---|---|
| public Quaternion slerp(Quaternion[] q) Spherical linearly interpolates multiple quaternions and stores the result in this Quaternion. Will not destroy the data previously inside the elements of q. result = (q_1^w_1)*(q_2^w_2)* ... *(q_n^w_n) where w_i=1/n.
| |
| slerp | back to summary |
|---|---|
| public Quaternion slerp(Quaternion[] q, float[] w) Spherical linearly interpolates multiple quaternions by the given weights and stores the result in this Quaternion. Will not destroy the data previously inside the elements of q or w. result = (q_1^w_1)*(q_2^w_2)* ... *(q_n^w_n) where the sum of w_i is 1. Lists must be equal in length.
| |
| toMatrix | back to summary |
|---|---|
| public void toMatrix(final float[] matrix) Fills a 4x4 matrix with the rotation matrix represented by this quaternion.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non-
| |
| transform | back to summary |
|---|---|
| public Vector3 transform(Vector3 v) Transforms the given vector using this quaternion
| |