public final class Quat extends java.lang.Object implements IData<Quat>
| Modifier and Type | Field and Description |
|---|---|
static Quat |
IDENTITY |
protected float |
w |
protected float |
x |
protected float |
y |
protected float |
z |
| Constructor and Description |
|---|
Quat() |
Quat(float x,
float y,
float z,
float w) |
| Modifier and Type | Method and Description |
|---|---|
Quat |
clone() |
Quat |
conjugate()
Conjugate (negate) this quaternion.
|
float |
distance(Quat q) |
Quat |
divide(Quat q1,
Quat q2)
Divide q1 by q2, and store the result in this quaternion.
|
boolean |
equals(java.lang.Object obj) |
float |
getAngleProjected(Vec3 refAxis) |
Vec3 |
getAnglesXYZ(Vec3 dst)
Convert this quaternion into angles ordered: x, y, z
Reference: http://jeux.developpez.com/faq/matquat/? |
Vec3 |
getAnglesYX(Vec3 dst)
Convert this quaternion into angles ordered: y, x
|
Vec3 |
getAnglesZYX(Vec3 dst)
Convert this quaternion into angles ordered: z, y, x
Reference: http://jeux.developpez.com/faq/matquat/? |
float |
getAxisAngle(Vec3 dstAxis) |
Vec3 |
getAxisX(Vec3 dst)
Get the axis x or the left vector defining by this quaternion
|
Vec3 |
getAxisY(Vec3 dst)
Get the axis y or the up vector defining by this quaternion
|
Vec3 |
getAxisZ(Vec3 dst)
Forward vector
|
protected Vec3 |
getLookAtForward(Vec3 dst) |
protected Vec3 |
getLookAtLeft(Vec3 dst) |
protected void |
getLookAtMatrix(Mat4x4 matrix) |
protected Vec3 |
getLookAtUp(Vec3 dst) |
Mat4x4 |
getMatrix(Mat4x4 matrix)
Create a 4x4 rotation matrix
|
void |
getMatrix3x3(Mat4x4 matrix) |
void |
getTwistDecomposition(Quat rot,
Quat twist,
Vec3 axis)
Decompose the quaternion in a rotation quaternion
rot (perpendicular to the axis)
and a twist rotation twist (along the axis) such as:this == new Quat().multiply(rot, twist) |
float |
getW() |
float |
getX() |
float |
getY() |
float |
getZ() |
int |
hashCode() |
Quat |
interpolate(Quat current,
Quat next,
float t)
Equivalent to slerp
|
Quat |
invert()
Invert this quaternion.
|
boolean |
isIdentity() |
float |
length() |
float |
lengthSqr() |
protected static void |
multiply(Mat4x4 dst,
Mat4x4 src,
Quat q) |
Quat |
multiply(Quat q1,
Quat q2)
Multiply q1 by q2, and store the result in this quaternion.
|
float |
normalize()
Normalize this quaternion
|
Vec3 |
rotate(Vec3 dst,
Vec3 src)
This is equivalent to transform a vector by the equivalent matrix.
|
Vec3 |
rotateTransposed(Vec3 dst,
Vec3 src)
This is equivalent to rotateTransposed a vector by the equivalent matrix.
|
Quat |
scale(float scale)
Scale this quaternion.
|
Quat |
set(float x,
float y,
float z,
float w) |
Quat |
set(Quat src) |
Quat |
setAnglesXYZ(float angleXInRadians,
float angleYInRadians,
float angleZInRadians)
Create a quaternion from angles, as defined by the order: x, y, z
This method is strictly equivalent than: final Quaternion4f q_ = new Quaternion4f(); this.setAxisAngle(Vector3f.axisX, angleXInRadians); this.multiply(q_.setAxisAngle(Vector3f.axisY, angleYInRadians)); this.multiply(q_.setAxisAngle(Vector3f.axisZ, angleZInRadians)); This code has been inlined and optimized. |
Quat |
setAnglesZYX(float angleXInRadians,
float angleYInRadians,
float angleZInRadians)
Create a quaternion from angles, as defined by the order: z, y, x
This method is strictly equivalent than: final Quaternion4f q_ = new Quaternion4f(); this.setAxisAngle(Vector3f.axisZ, angleZInRadians); this.multiply(q_.setAxisAngle(Vector3f.axisY, angleYInRadians)); this.multiply(q_.setAxisAngle(Vector3f.axisX, angleYInRadians)); This code has been inlined and optimized. |
Quat |
setAxis(Vec3 axisX,
Vec3 axisY,
Vec3 axisZ)
Deprecated.
|
Quat |
setAxisAngle(Vec3 axis,
float angleInRadians)
Create a quaternion from an axis angle rotation representation.
|
Quat |
setIdentity()
Set this quaternion as the identity quaternion (0, 0, 0, 1).
|
protected Quat |
setLookAtMatrix(Mat4x4 m) |
Quat |
setRotationMatrix(Mat4x4 m)
Warning: This is only valid for normalized matrix, right handed with no scaling.
|
Quat |
setVectorRotation(Vec3 vec1,
Vec3 vec2)
Shortest arc rotation between the two specified vectors
|
Quat |
slerp(Quat current,
Quat next,
float t)
Spherical linear interpolation
|
java.lang.String |
toString() |
public static final Quat IDENTITY
protected float x
protected float y
protected float z
protected float w
public final Quat clone()
public final int hashCode()
hashCode in class java.lang.Objectpublic final boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic final java.lang.String toString()
toString in class java.lang.Objectpublic final Quat set(Quat src)
set in interface IValueCopy<Quat>src - source quaternion to copy to thispublic final Quat set(float x, float y, float z, float w)
x - y - z - w - public final Quat setIdentity()
public final boolean isIdentity()
public final float distance(Quat q)
public final Quat setAnglesXYZ(float angleXInRadians, float angleYInRadians, float angleZInRadians)
final Quaternion4f q_ = new Quaternion4f(); this.setAxisAngle(Vector3f.axisX, angleXInRadians); this.multiply(q_.setAxisAngle(Vector3f.axisY, angleYInRadians)); this.multiply(q_.setAxisAngle(Vector3f.axisZ, angleZInRadians));This code has been inlined and optimized.
angleXInRadians - rotation around x, in radiansangleYInRadians - rotation around y, in radiansangleZInRadians - rotation around z, in radianspublic final Quat setAnglesZYX(float angleXInRadians, float angleYInRadians, float angleZInRadians)
final Quaternion4f q_ = new Quaternion4f(); this.setAxisAngle(Vector3f.axisZ, angleZInRadians); this.multiply(q_.setAxisAngle(Vector3f.axisY, angleYInRadians)); this.multiply(q_.setAxisAngle(Vector3f.axisX, angleYInRadians));This code has been inlined and optimized.
angleXInRadians - rotation around x, in radiansangleYInRadians - rotation around y, in radiansangleZInRadians - rotation around z, in radianspublic final Quat setAxisAngle(Vec3 axis, float angleInRadians)
axis - rotation axisangleInRadians - rotation angle in radianspublic final Quat setVectorRotation(Vec3 vec1, Vec3 vec2)
vec1 - vec2 - public final Quat setRotationMatrix(Mat4x4 m)
Matrix16f#getRotationAndScale(Quaternion4f, Vector3f) and Transform#setMatrix(Matrix16f).m - a rotation matrix that comply to application conditionsMat4x4.getRotationAndScale(Quat, Vec3),
Transformpublic final void getMatrix3x3(Mat4x4 matrix)
protected final void getLookAtMatrix(Mat4x4 matrix)
public final Vec3 getAnglesXYZ(Vec3 dst)
dst - destination vector to store the angles in radians (angleX, angleY, angleZ)public final Vec3 getAnglesZYX(Vec3 dst)
dst - destination vector to store the angles in radians (angleX, angleY, angleZ)public final Vec3 getAnglesYX(Vec3 dst)
dst - destination vector to store the angles in radians (angleX, angleY, 0)public final float getAxisAngle(Vec3 dstAxis)
dstAxis - destination vector to store the Axis (x,y,z)public final float getAngleProjected(Vec3 refAxis)
public final void getTwistDecomposition(Quat rot, Quat twist, Vec3 axis)
rot (perpendicular to the axis)
and a twist rotation twist (along the axis) such as:this == new Quat().multiply(rot, twist)
public final Quat interpolate(Quat current, Quat next, float t)
interpolate in interface IInterpolable<Quat>interpolate in interface IData<Quat>current - current valuenext - next valuet - interpolation percent in range [0;1]slerp(Quat, Quat, float)public final Quat slerp(Quat current, Quat next, float t)
current - first quaternionnext - second quaterniont - percentage in range [0f;1f]public final Quat multiply(Quat q1, Quat q2)
q1 - first quaternionq2 - second quaternionpublic final Quat divide(Quat q1, Quat q2)
q1 - first quaternionq2 - second quaternionpublic final Vec3 rotate(Vec3 dst, Vec3 src)
dst - the destination vector to store the rotated vectorsrc - source vector to rotatepublic final Vec3 rotateTransposed(Vec3 dst, Vec3 src)
dst - the destination vector to store the rotated vectorsrc - source vector to rotatepublic final float length()
public final float lengthSqr()
public final Quat invert()
public final float normalize()
public final Quat conjugate()
public final Quat scale(float scale)
public final Vec3 getAxisX(Vec3 dst)
dst - destination vector to store the axis xpublic final Vec3 getAxisY(Vec3 dst)
dst - destination vector to store the axis xprotected final Vec3 getLookAtLeft(Vec3 dst)
dst - destination vector to store the left vector of the look at matrixgetLookAtMatrix(Mat4x4)protected final Vec3 getLookAtUp(Vec3 dst)
dst - destination vector to store the up vector of the look at matrixgetLookAtMatrix(Mat4x4)protected final Vec3 getLookAtForward(Vec3 dst)
dst - destination vector to store the forward vector of the look at matrixgetLookAtMatrix(Mat4x4)public final float getX()
public final float getY()
public final float getZ()
public final float getW()
Bonzai Engine 1.4.1-20200831 - A Java OpenGL engine and tools for Windows/Mac/Linux/Android
Copyright © 2007-2019 Jérôme Jouvie bonzaiengine.com contact@bonzaiengine.com