public class Quaterniond extends Object implements Externalizable, Quaterniondc
| Modifier and Type | Field and Description |
|---|---|
double |
w
The real/scalar part of the quaternion.
|
double |
x
The first component of the vector part.
|
double |
y
The second component of the vector part.
|
double |
z
The third component of the vector part.
|
| Constructor and Description |
|---|
Quaterniond()
Create a new
Quaterniond and initialize it with (x=0, y=0, z=0, w=1),
where (x, y, z) is the vector part of the quaternion and w is the real/scalar part. |
Quaterniond(AxisAngle4d axisAngle)
Create a new
Quaterniond and initialize it to represent the same rotation as the given AxisAngle4d. |
Quaterniond(AxisAngle4f axisAngle)
Create a new
Quaterniond and initialize it to represent the same rotation as the given AxisAngle4f. |
Quaterniond(double x,
double y,
double z,
double w)
Create a new
Quaterniond and initialize its components to the given values. |
Quaterniond(Quaterniondc source)
Create a new
Quaterniond and initialize its components to the same values as the given Quaterniond. |
Quaterniond(Quaternionfc source)
Create a new
Quaterniond and initialize its components to the same values as the given Quaternionfc. |
| Modifier and Type | Method and Description |
|---|---|
Quaterniond |
add(double x,
double y,
double z,
double w)
Add the quaternion
(x, y, z, w) to this quaternion. |
Quaterniond |
add(double x,
double y,
double z,
double w,
Quaterniond dest)
Add the quaternion
(x, y, z, w) to this quaternion and store the result in dest. |
Quaterniond |
add(Quaterniondc q2)
Add
q2 to this quaternion. |
Quaterniond |
add(Quaterniondc q2,
Quaterniond dest)
Add
q2 to this quaternion and store the result in dest. |
double |
angle()
Return the angle in radians represented by this quaternion rotation.
|
Quaterniond |
conjugate()
Conjugate this quaternion.
|
Quaterniond |
conjugate(Quaterniond dest)
Conjugate this quaternion and store the result in
dest. |
Quaterniond |
difference(Quaterniondc other)
Compute the difference between
this and the other quaternion
and store the result in this. |
Quaterniond |
difference(Quaterniondc other,
Quaterniond dest)
Compute the difference between
this and the other quaternion
and store the result in dest. |
Quaterniond |
div(Quaterniondc b)
Divide
this quaternion by b. |
Quaterniond |
div(Quaterniondc b,
Quaterniond dest)
Divide
this quaternion by b and store the result in dest. |
double |
dot(Quaterniondc otherQuat)
Return the dot product of this
Quaterniond and otherQuat. |
boolean |
equals(Object obj) |
Quaterniond |
fromAxisAngleDeg(double axisX,
double axisY,
double axisZ,
double angle)
Set this quaternion to be a representation of the supplied axis and
angle (in degrees).
|
Quaterniond |
fromAxisAngleDeg(Vector3dc axis,
double angle)
Set this quaternion to be a representation of the supplied axis and
angle (in degrees).
|
Quaterniond |
fromAxisAngleRad(double axisX,
double axisY,
double axisZ,
double angle)
Set this quaternion to be a representation of the supplied axis and
angle (in radians).
|
Quaterniond |
fromAxisAngleRad(Vector3dc axis,
double angle)
Set this quaternion to be a representation of the supplied axis and
angle (in radians).
|
Matrix3d |
get(Matrix3d dest)
Set the given destination matrix to the rotation represented by
this. |
Matrix3f |
get(Matrix3f dest)
Set the given destination matrix to the rotation represented by
this. |
Matrix4d |
get(Matrix4d dest)
Set the given destination matrix to the rotation represented by
this. |
Matrix4f |
get(Matrix4f dest)
Set the given destination matrix to the rotation represented by
this. |
Quaterniond |
get(Quaterniond dest)
Set the given
Quaterniond to the values of this. |
Vector3d |
getEulerAnglesXYZ(Vector3d eulerAngles)
Get the euler angles in radians in rotation sequence
XYZ of this quaternion and store them in the
provided parameter eulerAngles. |
int |
hashCode() |
Quaterniond |
identity()
Set this quaternion to the identity.
|
Quaterniond |
integrate(double dt,
double vx,
double vy,
double vz)
Integrate the rotation given by the angular velocity
(vx, vy, vz) around the x, y and z axis, respectively,
with respect to the given elapsed time delta dt and add the differentiate rotation to the rotation represented by this quaternion. |
Quaterniond |
integrate(double dt,
double vx,
double vy,
double vz,
Quaterniond dest)
Integrate the rotation given by the angular velocity
(vx, vy, vz) around the x, y and z axis, respectively,
with respect to the given elapsed time delta dt and add the differentiate rotation to the rotation represented by this quaternion
and store the result into dest. |
Quaterniond |
invert()
Invert this quaternion and
normalize it. |
Quaterniond |
invert(Quaterniond dest)
Invert this quaternion and store the
normalized result in dest. |
double |
lengthSquared()
Return the square of the length of this quaternion.
|
Quaterniond |
lookAlong(double dirX,
double dirY,
double dirZ,
double upX,
double upY,
double upZ)
Apply a rotation to this quaternion that maps the given direction to the positive Z axis.
|
Quaterniond |
lookAlong(double dirX,
double dirY,
double dirZ,
double upX,
double upY,
double upZ,
Quaterniond dest)
Apply a rotation to this quaternion that maps the given direction to the positive Z axis, and store the result in
dest. |
Quaterniond |
lookAlong(Vector3dc dir,
Vector3dc up)
Apply a rotation to this quaternion that maps the given direction to the positive Z axis.
|
Quaterniond |
lookAlong(Vector3dc dir,
Vector3dc up,
Quaterniond dest)
Apply a rotation to this quaternion that maps the given direction to the positive Z axis, and store the result in
dest. |
Quaterniond |
mul(double qx,
double qy,
double qz,
double qw)
Multiply this quaternion by the quaternion represented via
(qx, qy, qz, qw). |
Quaterniond |
mul(double qx,
double qy,
double qz,
double qw,
Quaterniond dest)
Multiply this quaternion by the quaternion represented via
(qx, qy, qz, qw) and store the result in dest. |
Quaterniond |
mul(Quaterniondc q)
Multiply this quaternion by
q. |
Quaterniond |
mul(Quaterniondc q,
Quaterniond dest)
Multiply this quaternion by
q and store the result in dest. |
static Quaterniondc |
nlerp(Quaterniond[] qs,
double[] weights,
Quaterniond dest)
Interpolate between all of the quaternions given in
qs via non-spherical linear interpolation using the
specified interpolation factors weights, and store the result in dest. |
Quaterniond |
nlerp(Quaterniondc q,
double factor)
Compute a linear (non-spherical) interpolation of
this and the given quaternion q
and store the result in this. |
Quaterniond |
nlerp(Quaterniondc q,
double factor,
Quaterniond dest)
Compute a linear (non-spherical) interpolation of
this and the given quaternion q
and store the result in dest. |
static Quaterniond |
nlerpIterative(Quaterniondc[] qs,
double[] weights,
double dotThreshold,
Quaterniond dest)
Interpolate between all of the quaternions given in
qs via iterative non-spherical linear interpolation using the
specified interpolation factors weights, and store the result in dest. |
Quaterniond |
nlerpIterative(Quaterniondc q,
double alpha,
double dotThreshold)
Compute linear (non-spherical) interpolations of
this and the given quaternion q
iteratively and store the result in this. |
Quaterniond |
nlerpIterative(Quaterniondc q,
double alpha,
double dotThreshold,
Quaterniond dest)
Compute linear (non-spherical) interpolations of
this and the given quaternion q
iteratively and store the result in dest. |
Quaterniond |
normalize()
Normalize this quaternion.
|
Quaterniond |
normalize(Quaterniond dest)
Normalize this quaternion and store the result in
dest. |
Vector3d |
normalizedPositiveX(Vector3d dir)
Obtain the direction of
+X before the rotation transformation represented by this normalized quaternion is applied. |
Vector3d |
normalizedPositiveY(Vector3d dir)
Obtain the direction of
+Y before the rotation transformation represented by this normalized quaternion is applied. |
Vector3d |
normalizedPositiveZ(Vector3d dir)
Obtain the direction of
+Z before the rotation transformation represented by this normalized quaternion is applied. |
Vector3d |
positiveX(Vector3d dir)
Obtain the direction of
+X before the rotation transformation represented by this quaternion is applied. |
Vector3d |
positiveY(Vector3d dir)
Obtain the direction of
+Y before the rotation transformation represented by this quaternion is applied. |
Vector3d |
positiveZ(Vector3d dir)
Obtain the direction of
+Z before the rotation transformation represented by this quaternion is applied. |
Quaterniond |
premul(double qx,
double qy,
double qz,
double qw)
Pre-multiply this quaternion by the quaternion represented via
(qx, qy, qz, qw). |
Quaterniond |
premul(double qx,
double qy,
double qz,
double qw,
Quaterniond dest)
Pre-multiply this quaternion by the quaternion represented via
(qx, qy, qz, qw) and store the result in dest. |
Quaterniond |
premul(Quaterniondc q)
Pre-multiply this quaternion by
q. |
Quaterniond |
premul(Quaterniondc q,
Quaterniond dest)
Pre-multiply this quaternion by
q and store the result in dest. |
void |
readExternal(ObjectInput in) |
Quaterniond |
rotateAxis(double angle,
double axisX,
double axisY,
double axisZ)
Apply a rotation to
this quaternion rotating the given radians about the specified axis. |
Quaterniond |
rotateAxis(double angle,
double axisX,
double axisY,
double axisZ,
Quaterniond dest)
Apply a rotation to
this quaternion rotating the given radians about the specified axis
and store the result in dest. |
Quaterniond |
rotateAxis(double angle,
Vector3dc axis)
Apply a rotation to
this quaternion rotating the given radians about the specified axis. |
Quaterniond |
rotateAxis(double angle,
Vector3dc axis,
Quaterniond dest)
Apply a rotation to
this quaternion rotating the given radians about the specified axis
and store the result in dest. |
Quaterniond |
rotateLocalX(double angle)
Apply a rotation to
this quaternion rotating the given radians about the local x axis. |
Quaterniond |
rotateLocalX(double angle,
Quaterniond dest)
Apply a rotation to
this quaternion rotating the given radians about the local x axis
and store the result in dest. |
Quaterniond |
rotateLocalY(double angle)
Apply a rotation to
this quaternion rotating the given radians about the local y axis. |
Quaterniond |
rotateLocalY(double angle,
Quaterniond dest)
Apply a rotation to
this quaternion rotating the given radians about the local y axis
and store the result in dest. |
Quaterniond |
rotateLocalZ(double angle)
Apply a rotation to
this quaternion rotating the given radians about the local z axis. |
Quaterniond |
rotateLocalZ(double angle,
Quaterniond dest)
Apply a rotation to
this quaternion rotating the given radians about the local z axis
and store the result in dest. |
Quaterniond |
rotateTo(double fromDirX,
double fromDirY,
double fromDirZ,
double toDirX,
double toDirY,
double toDirZ)
Apply a rotation to
this that rotates the fromDir vector to point along toDir. |
Quaterniond |
rotateTo(double fromDirX,
double fromDirY,
double fromDirZ,
double toDirX,
double toDirY,
double toDirZ,
Quaterniond dest)
Apply a rotation to
this that rotates the fromDir vector to point along toDir and
store the result in dest. |
Quaterniond |
rotateTo(Vector3dc fromDir,
Vector3dc toDir)
Apply a rotation to
this that rotates the fromDir vector to point along toDir. |
Quaterniond |
rotateTo(Vector3dc fromDir,
Vector3dc toDir,
Quaterniond dest)
Apply a rotation to
this that rotates the fromDir vector to point along toDir and
store the result in dest. |
Quaterniond |
rotateX(double angle)
Apply a rotation to
this quaternion rotating the given radians about the x axis. |
Quaterniond |
rotateX(double angle,
Quaterniond dest)
Apply a rotation to
this quaternion rotating the given radians about the x axis
and store the result in dest. |
Quaterniond |
rotateXYZ(double angleX,
double angleY,
double angleZ)
Apply a rotation to
this quaternion rotating the given radians about the cartesian base unit axes,
called the euler angles using rotation sequence XYZ. |
Quaterniond |
rotateXYZ(double angleX,
double angleY,
double angleZ,
Quaterniond dest)
Apply a rotation to
this quaternion rotating the given radians about the cartesian base unit axes,
called the euler angles using rotation sequence XYZ and store the result in dest. |
Quaterniond |
rotateY(double angle)
Apply a rotation to
this quaternion rotating the given radians about the y axis. |
Quaterniond |
rotateY(double angle,
Quaterniond dest)
Apply a rotation to
this quaternion rotating the given radians about the y axis
and store the result in dest. |
Quaterniond |
rotateYXZ(double angleZ,
double angleY,
double angleX)
Apply a rotation to
this quaternion rotating the given radians about the cartesian base unit axes,
called the euler angles, using the rotation sequence YXZ. |
Quaterniond |
rotateYXZ(double angleY,
double angleX,
double angleZ,
Quaterniond dest)
Apply a rotation to
this quaternion rotating the given radians about the cartesian base unit axes,
called the euler angles, using the rotation sequence YXZ and store the result in dest. |
Quaterniond |
rotateZ(double angle)
Apply a rotation to
this quaternion rotating the given radians about the z axis. |
Quaterniond |
rotateZ(double angle,
Quaterniond dest)
Apply a rotation to
this quaternion rotating the given radians about the z axis
and store the result in dest. |
Quaterniond |
rotateZYX(double angleZ,
double angleY,
double angleX)
Apply a rotation to
this quaternion rotating the given radians about the cartesian base unit axes,
called the euler angles, using the rotation sequence ZYX. |
Quaterniond |
rotateZYX(double angleZ,
double angleY,
double angleX,
Quaterniond dest)
Apply a rotation to
this quaternion rotating the given radians about the cartesian base unit axes,
called the euler angles, using the rotation sequence ZYX and store the result in dest. |
Quaterniond |
rotationAxis(AxisAngle4f axisAngle)
Set this
Quaterniond to a rotation of the given angle in radians about the supplied
axis, all of which are specified via the AxisAngle4f. |
Quaterniond |
rotationAxis(double angle,
double axisX,
double axisY,
double axisZ)
Set this quaternion to a rotation of the given angle in radians about the supplied axis.
|
Quaterniond |
rotationTo(double fromDirX,
double fromDirY,
double fromDirZ,
double toDirX,
double toDirY,
double toDirZ)
Set
this quaternion to a rotation that rotates the fromDir vector to point along toDir. |
Quaterniond |
rotationTo(Vector3dc fromDir,
Vector3dc toDir)
Set
this quaternion to a rotation that rotates the fromDir vector to point along toDir. |
Quaterniond |
rotationX(double angle)
Set this quaternion to represent a rotation of the given radians about the x axis.
|
Quaterniond |
rotationXYZ(double angleX,
double angleY,
double angleZ)
Set this quaternion from the supplied euler angles (in radians) with rotation order XYZ.
|
Quaterniond |
rotationY(double angle)
Set this quaternion to represent a rotation of the given radians about the y axis.
|
Quaterniond |
rotationYXZ(double angleY,
double angleX,
double angleZ)
Set this quaternion from the supplied euler angles (in radians) with rotation order YXZ.
|
Quaterniond |
rotationZ(double angle)
Set this quaternion to represent a rotation of the given radians about the z axis.
|
Quaterniond |
rotationZYX(double angleZ,
double angleY,
double angleX)
Set this quaternion from the supplied euler angles (in radians) with rotation order ZYX.
|
Quaterniond |
scale(double factor)
Apply scaling to this quaternion, which results in any vector transformed by this quaternion to change
its length by the given
factor. |
Quaterniond |
scale(double factor,
Quaterniond dest)
Apply scaling to this quaternion, which results in any vector transformed by the quaternion to change
its length by the given
factor, and store the result in dest. |
Quaterniond |
scaling(double factor)
Set this quaternion to represent scaling, which results in a transformed vector to change
its length by the given
factor. |
Quaterniond |
set(AxisAngle4d axisAngle)
Set this
Quaterniond to be equivalent to the given
AxisAngle4d. |
Quaterniond |
set(AxisAngle4f axisAngle)
Set this
Quaterniond to be equivalent to the given
AxisAngle4f. |
Quaterniond |
set(double x,
double y,
double z,
double w)
Set this quaternion to the new values.
|
Quaterniond |
set(Quaterniondc q)
Set this quaternion to be a copy of q.
|
Quaterniond |
set(Quaternionfc q)
Set this quaternion to be a copy of q.
|
Quaterniond |
setAngleAxis(double angle,
double x,
double y,
double z)
Set this quaternion to a rotation equivalent to the supplied axis and
angle (in radians).
|
Quaterniond |
setAngleAxis(double angle,
Vector3dc axis)
Set this quaternion to be a representation of the supplied axis and
angle (in radians).
|
Quaterniond |
setFromNormalized(Matrix3dc mat)
Set this quaternion to be a representation of the rotational component of the given matrix.
|
Quaterniond |
setFromNormalized(Matrix3fc mat)
Set this quaternion to be a representation of the rotational component of the given matrix.
|
Quaterniond |
setFromNormalized(Matrix4dc mat)
Set this quaternion to be a representation of the rotational component of the given matrix.
|
Quaterniond |
setFromNormalized(Matrix4fc mat)
Set this quaternion to be a representation of the rotational component of the given matrix.
|
Quaterniond |
setFromNormalized(Matrix4x3dc mat)
Set this quaternion to be a representation of the rotational component of the given matrix.
|
Quaterniond |
setFromNormalized(Matrix4x3fc mat)
Set this quaternion to be a representation of the rotational component of the given matrix.
|
Quaterniond |
setFromUnnormalized(Matrix3dc mat)
Set this quaternion to be a representation of the rotational component of the given matrix.
|
Quaterniond |
setFromUnnormalized(Matrix3fc mat)
Set this quaternion to be a representation of the rotational component of the given matrix.
|
Quaterniond |
setFromUnnormalized(Matrix4dc mat)
Set this quaternion to be a representation of the rotational component of the given matrix.
|
Quaterniond |
setFromUnnormalized(Matrix4fc mat)
Set this quaternion to be a representation of the rotational component of the given matrix.
|
Quaterniond |
setFromUnnormalized(Matrix4x3dc mat)
Set this quaternion to be a representation of the rotational component of the given matrix.
|
Quaterniond |
setFromUnnormalized(Matrix4x3fc mat)
Set this quaternion to be a representation of the rotational component of the given matrix.
|
static Quaterniondc |
slerp(Quaterniond[] qs,
double[] weights,
Quaterniond dest)
Interpolate between all of the quaternions given in
qs via spherical linear interpolation using the specified interpolation factors weights,
and store the result in dest. |
Quaterniond |
slerp(Quaterniondc target,
double alpha)
|
Quaterniond |
slerp(Quaterniondc target,
double alpha,
Quaterniond dest)
|
String |
toString()
Return a string representation of this quaternion.
|
String |
toString(NumberFormat formatter)
Return a string representation of this quaternion by formatting the components with the given
NumberFormat. |
Vector3d |
transform(double x,
double y,
double z,
Vector3d dest)
Transform the given vector
(x, y, z) by this quaternion and store the result in dest. |
Vector4d |
transform(double x,
double y,
double z,
Vector4d dest)
Transform the given vector
(x, y, z) by this quaternion and store the result in dest. |
Vector3d |
transform(Vector3d vec)
Transform the given vector by this quaternion.
|
Vector3d |
transform(Vector3dc vec,
Vector3d dest)
Transform the given vector by this quaternion and store the result in
dest. |
Vector4d |
transform(Vector4d vec)
Transform the given vector by this quaternion.
|
Vector4d |
transform(Vector4dc vec,
Vector4d dest)
Transform the given vector by this quaternion and store the result in
dest. |
Vector3d |
transformPositiveX(Vector3d dest)
Transform the vector
(1, 0, 0) by this quaternion. |
Vector4d |
transformPositiveX(Vector4d dest)
Transform the vector
(1, 0, 0) by this quaternion. |
Vector3d |
transformPositiveY(Vector3d dest)
Transform the vector
(0, 1, 0) by this quaternion. |
Vector4d |
transformPositiveY(Vector4d dest)
Transform the vector
(0, 1, 0) by this quaternion. |
Vector3d |
transformPositiveZ(Vector3d dest)
Transform the vector
(0, 0, 1) by this quaternion. |
Vector4d |
transformPositiveZ(Vector4d dest)
Transform the vector
(0, 0, 1) by this quaternion. |
Vector3d |
transformUnitPositiveX(Vector3d dest)
Transform the vector
(1, 0, 0) by this unit quaternion. |
Vector4d |
transformUnitPositiveX(Vector4d dest)
Transform the vector
(1, 0, 0) by this unit quaternion. |
Vector3d |
transformUnitPositiveY(Vector3d dest)
Transform the vector
(0, 1, 0) by this unit quaternion. |
Vector4d |
transformUnitPositiveY(Vector4d dest)
Transform the vector
(0, 1, 0) by this unit quaternion. |
Vector3d |
transformUnitPositiveZ(Vector3d dest)
Transform the vector
(0, 0, 1) by this unit quaternion. |
Vector4d |
transformUnitPositiveZ(Vector4d dest)
Transform the vector
(0, 0, 1) by this unit quaternion. |
double |
w() |
void |
writeExternal(ObjectOutput out) |
double |
x() |
double |
y() |
double |
z() |
public double x
public double y
public double z
public double w
public Quaterniond()
Quaterniond and initialize it with (x=0, y=0, z=0, w=1),
where (x, y, z) is the vector part of the quaternion and w is the real/scalar part.public Quaterniond(double x,
double y,
double z,
double w)
Quaterniond and initialize its components to the given values.x - the first component of the imaginary party - the second component of the imaginary partz - the third component of the imaginary partw - the real partpublic Quaterniond(Quaterniondc source)
Quaterniond and initialize its components to the same values as the given Quaterniond.source - the Quaterniond to take the component values frompublic Quaterniond(Quaternionfc source)
Quaterniond and initialize its components to the same values as the given Quaternionfc.source - the Quaternionfc to take the component values frompublic Quaterniond(AxisAngle4f axisAngle)
Quaterniond and initialize it to represent the same rotation as the given AxisAngle4f.axisAngle - the axis-angle to initialize this quaternion withpublic Quaterniond(AxisAngle4d axisAngle)
Quaterniond and initialize it to represent the same rotation as the given AxisAngle4d.axisAngle - the axis-angle to initialize this quaternion withpublic double x()
x in interface Quaterniondcpublic double y()
y in interface Quaterniondcpublic double z()
z in interface Quaterniondcpublic double w()
w in interface Quaterniondcpublic Quaterniond normalize()
public Quaterniond normalize(Quaterniond dest)
Quaterniondcdest.normalize in interface Quaterniondcdest - will hold the resultpublic Quaterniond add(double x, double y, double z, double w)
(x, y, z, w) to this quaternion.x - the x component of the vector party - the y component of the vector partz - the z component of the vector partw - the real/scalar componentpublic Quaterniond add(double x, double y, double z, double w, Quaterniond dest)
Quaterniondc(x, y, z, w) to this quaternion and store the result in dest.add in interface Quaterniondcx - the x component of the vector party - the y component of the vector partz - the z component of the vector partw - the real/scalar componentdest - will hold the resultpublic Quaterniond add(Quaterniondc q2)
q2 to this quaternion.q2 - the quaternion to add to thispublic Quaterniond add(Quaterniondc q2, Quaterniond dest)
Quaterniondcq2 to this quaternion and store the result in dest.add in interface Quaterniondcq2 - the quaternion to add to thisdest - will hold the resultpublic double dot(Quaterniondc otherQuat)
QuaterniondcQuaterniond and otherQuat.dot in interface QuaterniondcotherQuat - the other quaternionpublic double angle()
Quaterniondcangle in interface Quaterniondcpublic Matrix3d get(Matrix3d dest)
Quaterniondcthis.get in interface Quaterniondcdest - the matrix to write the rotation intoMatrix3d.set(Quaterniondc)public Matrix3f get(Matrix3f dest)
Quaterniondcthis.get in interface Quaterniondcdest - the matrix to write the rotation intoMatrix3f.set(Quaterniondc)public Matrix4d get(Matrix4d dest)
Quaterniondcthis.get in interface Quaterniondcdest - the matrix to write the rotation intoMatrix4d.set(Quaterniondc)public Matrix4f get(Matrix4f dest)
Quaterniondcthis.get in interface Quaterniondcdest - the matrix to write the rotation intoMatrix4f.set(Quaterniondc)public Quaterniond get(Quaterniond dest)
Quaterniond to the values of this.get in interface Quaterniondcdest - the Quaterniond to setset(Quaterniondc)public Quaterniond set(double x, double y, double z, double w)
x - the new value of xy - the new value of yz - the new value of zw - the new value of wpublic Quaterniond set(Quaterniondc q)
q - the Quaterniondc to copypublic Quaterniond set(Quaternionfc q)
q - the Quaternionfc to copypublic Quaterniond set(AxisAngle4f axisAngle)
Quaterniond to be equivalent to the given
AxisAngle4f.axisAngle - the AxisAngle4fpublic Quaterniond set(AxisAngle4d axisAngle)
Quaterniond to be equivalent to the given
AxisAngle4d.axisAngle - the AxisAngle4dpublic Quaterniond setAngleAxis(double angle, double x, double y, double z)
This method assumes that the given rotation axis (x, y, z) is already normalized
angle - the angle in radiansx - the x-component of the normalized rotation axisy - the y-component of the normalized rotation axisz - the z-component of the normalized rotation axispublic Quaterniond setAngleAxis(double angle, Vector3dc axis)
angle - the angle in radiansaxis - the rotation axispublic Quaterniond setFromUnnormalized(Matrix4fc mat)
This method assumes that the first three columns of the upper left 3x3 submatrix are no unit vectors.
mat - the matrix whose rotational component is used to set this quaternionpublic Quaterniond setFromUnnormalized(Matrix4x3fc mat)
This method assumes that the first three columns of the upper left 3x3 submatrix are no unit vectors.
mat - the matrix whose rotational component is used to set this quaternionpublic Quaterniond setFromUnnormalized(Matrix4x3dc mat)
This method assumes that the first three columns of the upper left 3x3 submatrix are no unit vectors.
mat - the matrix whose rotational component is used to set this quaternionpublic Quaterniond setFromNormalized(Matrix4fc mat)
This method assumes that the first three columns of the upper left 3x3 submatrix are unit vectors.
mat - the matrix whose rotational component is used to set this quaternionpublic Quaterniond setFromNormalized(Matrix4x3fc mat)
This method assumes that the first three columns of the upper left 3x3 submatrix are unit vectors.
mat - the matrix whose rotational component is used to set this quaternionpublic Quaterniond setFromNormalized(Matrix4x3dc mat)
This method assumes that the first three columns of the upper left 3x3 submatrix are unit vectors.
mat - the matrix whose rotational component is used to set this quaternionpublic Quaterniond setFromUnnormalized(Matrix4dc mat)
This method assumes that the first three columns of the upper left 3x3 submatrix are no unit vectors.
mat - the matrix whose rotational component is used to set this quaternionpublic Quaterniond setFromNormalized(Matrix4dc mat)
This method assumes that the first three columns of the upper left 3x3 submatrix are unit vectors.
mat - the matrix whose rotational component is used to set this quaternionpublic Quaterniond setFromUnnormalized(Matrix3fc mat)
This method assumes that the first three columns of the upper left 3x3 submatrix are no unit vectors.
mat - the matrix whose rotational component is used to set this quaternionpublic Quaterniond setFromNormalized(Matrix3fc mat)
This method assumes that the first three columns of the upper left 3x3 submatrix are unit vectors.
mat - the matrix whose rotational component is used to set this quaternionpublic Quaterniond setFromUnnormalized(Matrix3dc mat)
This method assumes that the first three columns of the upper left 3x3 submatrix are no unit vectors.
mat - the matrix whose rotational component is used to set this quaternionpublic Quaterniond setFromNormalized(Matrix3dc mat)
mat - the matrix whose rotational component is used to set this quaternionpublic Quaterniond fromAxisAngleRad(Vector3dc axis, double angle)
axis - the rotation axisangle - the angle in radianspublic Quaterniond fromAxisAngleRad(double axisX, double axisY, double axisZ, double angle)
axisX - the x component of the rotation axisaxisY - the y component of the rotation axisaxisZ - the z component of the rotation axisangle - the angle in radianspublic Quaterniond fromAxisAngleDeg(Vector3dc axis, double angle)
axis - the rotation axisangle - the angle in degreespublic Quaterniond fromAxisAngleDeg(double axisX, double axisY, double axisZ, double angle)
axisX - the x component of the rotation axisaxisY - the y component of the rotation axisaxisZ - the z component of the rotation axisangle - the angle in radianspublic Quaterniond mul(Quaterniondc q)
q.
If T is this and Q is the given
quaternion, then the resulting quaternion R is:
R = T * Q
So, this method uses post-multiplication like the matrix classes, resulting in a
vector to be transformed by Q first, and then by T.
q - the quaternion to multiply this bypublic Quaterniond mul(Quaterniondc q, Quaterniond dest)
Quaterniondcq and store the result in dest.
If T is this and Q is the given
quaternion, then the resulting quaternion R is:
R = T * Q
So, this method uses post-multiplication like the matrix classes, resulting in a
vector to be transformed by Q first, and then by T.
mul in interface Quaterniondcq - the quaternion to multiply this bydest - will hold the resultpublic Quaterniond mul(double qx, double qy, double qz, double qw)
(qx, qy, qz, qw).
If T is this and Q is the given
quaternion, then the resulting quaternion R is:
R = T * Q
So, this method uses post-multiplication like the matrix classes, resulting in a
vector to be transformed by Q first, and then by T.
qx - the x component of the quaternion to multiply this byqy - the y component of the quaternion to multiply this byqz - the z component of the quaternion to multiply this byqw - the w component of the quaternion to multiply this bypublic Quaterniond mul(double qx, double qy, double qz, double qw, Quaterniond dest)
Quaterniondc(qx, qy, qz, qw) and store the result in dest.
If T is this and Q is the given
quaternion, then the resulting quaternion R is:
R = T * Q
So, this method uses post-multiplication like the matrix classes, resulting in a
vector to be transformed by Q first, and then by T.
mul in interface Quaterniondcqx - the x component of the quaternion to multiply this byqy - the y component of the quaternion to multiply this byqz - the z component of the quaternion to multiply this byqw - the w component of the quaternion to multiply this bydest - will hold the resultpublic Quaterniond premul(Quaterniondc q)
q.
If T is this and Q is the given quaternion, then the resulting quaternion R is:
R = Q * T
So, this method uses pre-multiplication, resulting in a vector to be transformed by T first, and then by Q.
q - the quaternion to pre-multiply this bypublic Quaterniond premul(Quaterniondc q, Quaterniond dest)
Quaterniondcq and store the result in dest.
If T is this and Q is the given quaternion, then the resulting quaternion R is:
R = Q * T
So, this method uses pre-multiplication, resulting in a vector to be transformed by T first, and then by Q.
premul in interface Quaterniondcq - the quaternion to pre-multiply this bydest - will hold the resultpublic Quaterniond premul(double qx, double qy, double qz, double qw)
(qx, qy, qz, qw).
If T is this and Q is the given quaternion, then the resulting quaternion R is:
R = Q * T
So, this method uses pre-multiplication, resulting in a vector to be transformed by T first, and then by Q.
qx - the x component of the quaternion to multiply this byqy - the y component of the quaternion to multiply this byqz - the z component of the quaternion to multiply this byqw - the w component of the quaternion to multiply this bypublic Quaterniond premul(double qx, double qy, double qz, double qw, Quaterniond dest)
Quaterniondc(qx, qy, qz, qw) and store the result in dest.
If T is this and Q is the given quaternion, then the resulting quaternion R is:
R = Q * T
So, this method uses pre-multiplication, resulting in a vector to be transformed by T first, and then by Q.
premul in interface Quaterniondcqx - the x component of the quaternion to multiply this byqy - the y component of the quaternion to multiply this byqz - the z component of the quaternion to multiply this byqw - the w component of the quaternion to multiply this bydest - will hold the resultpublic Vector3d transform(Vector3d vec)
Quaterniondctransform in interface Quaterniondcvec - the vector to transformpublic Vector3d transformPositiveX(Vector3d dest)
Quaterniondc(1, 0, 0) by this quaternion.transformPositiveX in interface Quaterniondcdest - will hold the resultpublic Vector4d transformPositiveX(Vector4d dest)
Quaterniondc(1, 0, 0) by this quaternion.
Only the first three components of the given 4D vector are modified.
transformPositiveX in interface Quaterniondcdest - will hold the resultpublic Vector3d transformUnitPositiveX(Vector3d dest)
Quaterniondc(1, 0, 0) by this unit quaternion.
This method is only applicable when this is a unit quaternion.
Reference: https://de.mathworks.com/
transformUnitPositiveX in interface Quaterniondcdest - will hold the resultpublic Vector4d transformUnitPositiveX(Vector4d dest)
Quaterniondc(1, 0, 0) by this unit quaternion.
Only the first three components of the given 4D vector are modified.
This method is only applicable when this is a unit quaternion.
Reference: https://de.mathworks.com/
transformUnitPositiveX in interface Quaterniondcdest - will hold the resultpublic Vector3d transformPositiveY(Vector3d dest)
Quaterniondc(0, 1, 0) by this quaternion.transformPositiveY in interface Quaterniondcdest - will hold the resultpublic Vector4d transformPositiveY(Vector4d dest)
Quaterniondc(0, 1, 0) by this quaternion.
Only the first three components of the given 4D vector are modified.
transformPositiveY in interface Quaterniondcdest - will hold the resultpublic Vector4d transformUnitPositiveY(Vector4d dest)
Quaterniondc(0, 1, 0) by this unit quaternion.
Only the first three components of the given 4D vector are modified.
This method is only applicable when this is a unit quaternion.
Reference: https://de.mathworks.com/
transformUnitPositiveY in interface Quaterniondcdest - will hold the resultpublic Vector3d transformUnitPositiveY(Vector3d dest)
Quaterniondc(0, 1, 0) by this unit quaternion.
This method is only applicable when this is a unit quaternion.
Reference: https://de.mathworks.com/
transformUnitPositiveY in interface Quaterniondcdest - will hold the resultpublic Vector3d transformPositiveZ(Vector3d dest)
Quaterniondc(0, 0, 1) by this quaternion.transformPositiveZ in interface Quaterniondcdest - will hold the resultpublic Vector4d transformPositiveZ(Vector4d dest)
Quaterniondc(0, 0, 1) by this quaternion.
Only the first three components of the given 4D vector are modified.
transformPositiveZ in interface Quaterniondcdest - will hold the resultpublic Vector4d transformUnitPositiveZ(Vector4d dest)
Quaterniondc(0, 0, 1) by this unit quaternion.
Only the first three components of the given 4D vector are modified.
This method is only applicable when this is a unit quaternion.
Reference: https://de.mathworks.com/
transformUnitPositiveZ in interface Quaterniondcdest - will hold the resultpublic Vector3d transformUnitPositiveZ(Vector3d dest)
Quaterniondc(0, 0, 1) by this unit quaternion.
This method is only applicable when this is a unit quaternion.
Reference: https://de.mathworks.com/
transformUnitPositiveZ in interface Quaterniondcdest - will hold the resultpublic Vector4d transform(Vector4d vec)
QuaterniondcOnly the first three components of the given 4D vector are being used and modified.
transform in interface Quaterniondcvec - the vector to transformpublic Vector3d transform(Vector3dc vec, Vector3d dest)
Quaterniondcdest.
This will apply the rotation described by this quaternion to the given vector.transform in interface Quaterniondcvec - the vector to transformdest - will hold the resultpublic Vector3d transform(double x, double y, double z, Vector3d dest)
Quaterniondc(x, y, z) by this quaternion and store the result in dest.
This will apply the rotation described by this quaternion to the given vector.transform in interface Quaterniondcx - the x coordinate of the vector to transformy - the y coordinate of the vector to transformz - the z coordinate of the vector to transformdest - will hold the resultpublic Vector4d transform(Vector4dc vec, Vector4d dest)
Quaterniondcdest.
This will apply the rotation described by this quaternion to the given vector.
Only the first three components of the given 4D vector are being used and set on the destination.
transform in interface Quaterniondcvec - the vector to transformdest - will hold the resultpublic Vector4d transform(double x, double y, double z, Vector4d dest)
Quaterniondc(x, y, z) by this quaternion and store the result in dest.
This will apply the rotation described by this quaternion to the given vector.transform in interface Quaterniondcx - the x coordinate of the vector to transformy - the y coordinate of the vector to transformz - the z coordinate of the vector to transformdest - will hold the resultpublic Quaterniond invert(Quaterniond dest)
Quaterniondcnormalized result in dest.
If this quaternion is already normalized, then Quaterniondc.conjugate(Quaterniond) should be used instead.
invert in interface Quaterniondcdest - will hold the resultQuaterniondc.conjugate(Quaterniond)public Quaterniond invert()
normalize it.
If this quaternion is already normalized, then conjugate() should be used instead.
conjugate()public Quaterniond div(Quaterniondc b, Quaterniond dest)
Quaterniondcthis quaternion by b and store the result in dest.
The division expressed using the inverse is performed in the following way:
dest = this * b^-1, where b^-1 is the inverse of b.
div in interface Quaterniondcb - the Quaterniondc to divide this bydest - will hold the resultpublic Quaterniond div(Quaterniondc b)
this quaternion by b.
The division expressed using the inverse is performed in the following way:
this = this * b^-1, where b^-1 is the inverse of b.
b - the Quaterniondc to divide this bypublic Quaterniond conjugate()
public Quaterniond conjugate(Quaterniond dest)
Quaterniondcdest.conjugate in interface Quaterniondcdest - will hold the resultpublic Quaterniond identity()
public double lengthSquared()
QuaterniondclengthSquared in interface Quaterniondcpublic Quaterniond rotationXYZ(double angleX, double angleY, double angleZ)
This method is equivalent to calling: rotationX(angleX).rotateY(angleY).rotateZ(angleZ)
Reference: this stackexchange answer
angleX - the angle in radians to rotate about xangleY - the angle in radians to rotate about yangleZ - the angle in radians to rotate about zpublic Quaterniond rotationZYX(double angleZ, double angleY, double angleX)
This method is equivalent to calling: rotationZ(angleZ).rotateY(angleY).rotateX(angleX)
Reference: this stackexchange answer
angleX - the angle in radians to rotate about xangleY - the angle in radians to rotate about yangleZ - the angle in radians to rotate about zpublic Quaterniond rotationYXZ(double angleY, double angleX, double angleZ)
This method is equivalent to calling: rotationY(angleY).rotateX(angleX).rotateZ(angleZ)
Reference: https://en.wikipedia.org
angleY - the angle in radians to rotate about yangleX - the angle in radians to rotate about xangleZ - the angle in radians to rotate about zpublic Quaterniond slerp(Quaterniondc target, double alpha)
this unit quaternion and the specified
target unit quaternion using spherical linear interpolation using the specified interpolation factor alpha.
This method resorts to non-spherical linear interpolation when the absolute dot product between this and target is
below 1E-6.
target - the target of the interpolation, which should be reached with alpha = 1.0alpha - the interpolation factor, within [0..1]public Quaterniond slerp(Quaterniondc target, double alpha, Quaterniond dest)
Quaterniondcthis unit quaternion and the specified
target unit quaternion using spherical linear interpolation using the specified interpolation factor alpha,
and store the result in dest.
This method resorts to non-spherical linear interpolation when the absolute dot product between this and target is
below 1E-6.
Reference: http://fabiensanglard.net
slerp in interface Quaterniondctarget - the target of the interpolation, which should be reached with alpha = 1.0alpha - the interpolation factor, within [0..1]dest - will hold the resultpublic static Quaterniondc slerp(Quaterniond[] qs, double[] weights, Quaterniond dest)
qs via spherical linear interpolation using the specified interpolation factors weights,
and store the result in dest.
This method will interpolate between each two successive quaternions via slerp(Quaterniondc, double) using their relative interpolation weights.
This method resorts to non-spherical linear interpolation when the absolute dot product of any two interpolated quaternions is below 1E-6f.
Reference: http://gamedev.stackexchange.com/
qs - the quaternions to interpolate overweights - the weights of each individual quaternion in qsdest - will hold the resultpublic Quaterniond scale(double factor)
factor.factor - the scaling factorpublic Quaterniond scale(double factor, Quaterniond dest)
Quaterniondcfactor, and store the result in dest.scale in interface Quaterniondcfactor - the scaling factordest - will hold the resultpublic Quaterniond scaling(double factor)
factor.factor - the scaling factorpublic Quaterniond integrate(double dt, double vx, double vy, double vz)
(vx, vy, vz) around the x, y and z axis, respectively,
with respect to the given elapsed time delta dt and add the differentiate rotation to the rotation represented by this quaternion.
This method pre-multiplies the rotation given by dt and (vx, vy, vz) by this, so
the angular velocities are always relative to the local coordinate system of the rotation represented by this quaternion.
This method is equivalent to calling: rotateLocal(dt * vx, dt * vy, dt * vz)
Reference: http://physicsforgames.blogspot.de/
dt - the delta timevx - the angular velocity around the x axisvy - the angular velocity around the y axisvz - the angular velocity around the z axispublic Quaterniond integrate(double dt, double vx, double vy, double vz, Quaterniond dest)
Quaterniondc(vx, vy, vz) around the x, y and z axis, respectively,
with respect to the given elapsed time delta dt and add the differentiate rotation to the rotation represented by this quaternion
and store the result into dest.
This method pre-multiplies the rotation given by dt and (vx, vy, vz) by this, so
the angular velocities are always relative to the local coordinate system of the rotation represented by this quaternion.
This method is equivalent to calling: rotateLocal(dt * vx, dt * vy, dt * vz, dest)
Reference: http://physicsforgames.blogspot.de/
integrate in interface Quaterniondcdt - the delta timevx - the angular velocity around the x axisvy - the angular velocity around the y axisvz - the angular velocity around the z axisdest - will hold the resultpublic Quaterniond nlerp(Quaterniondc q, double factor)
this and the given quaternion q
and store the result in this.q - the other quaternionfactor - the interpolation factor. It is between 0.0 and 1.0public Quaterniond nlerp(Quaterniondc q, double factor, Quaterniond dest)
Quaterniondcthis and the given quaternion q
and store the result in dest.
Reference: http://fabiensanglard.net
nlerp in interface Quaterniondcq - the other quaternionfactor - the interpolation factor. It is between 0.0 and 1.0dest - will hold the resultpublic static Quaterniondc nlerp(Quaterniond[] qs, double[] weights, Quaterniond dest)
qs via non-spherical linear interpolation using the
specified interpolation factors weights, and store the result in dest.
This method will interpolate between each two successive quaternions via nlerp(Quaterniondc, double)
using their relative interpolation weights.
Reference: http://gamedev.stackexchange.com/
qs - the quaternions to interpolate overweights - the weights of each individual quaternion in qsdest - will hold the resultpublic Quaterniond nlerpIterative(Quaterniondc q, double alpha, double dotThreshold, Quaterniond dest)
Quaterniondcthis and the given quaternion q
iteratively and store the result in dest.
This method performs a series of small-step nlerp interpolations to avoid doing a costly spherical linear interpolation, like
slerp,
by subdividing the rotation arc between this and q via non-spherical linear interpolations as long as
the absolute dot product of this and q is greater than the given dotThreshold parameter.
Thanks to @theagentd at http://www.java-gaming.org/ for providing the code.
nlerpIterative in interface Quaterniondcq - the other quaternionalpha - the interpolation factor, between 0.0 and 1.0dotThreshold - the threshold for the dot product of this and q above which this method performs another iteration
of a small-step linear interpolationdest - will hold the resultpublic Quaterniond nlerpIterative(Quaterniondc q, double alpha, double dotThreshold)
this and the given quaternion q
iteratively and store the result in this.
This method performs a series of small-step nlerp interpolations to avoid doing a costly spherical linear interpolation, like
slerp,
by subdividing the rotation arc between this and q via non-spherical linear interpolations as long as
the absolute dot product of this and q is greater than the given dotThreshold parameter.
Thanks to @theagentd at http://www.java-gaming.org/ for providing the code.
q - the other quaternionalpha - the interpolation factor, between 0.0 and 1.0dotThreshold - the threshold for the dot product of this and q above which this method performs another iteration
of a small-step linear interpolationpublic static Quaterniond nlerpIterative(Quaterniondc[] qs, double[] weights, double dotThreshold, Quaterniond dest)
qs via iterative non-spherical linear interpolation using the
specified interpolation factors weights, and store the result in dest.
This method will interpolate between each two successive quaternions via nlerpIterative(Quaterniondc, double, double)
using their relative interpolation weights.
Reference: http://gamedev.stackexchange.com/
qs - the quaternions to interpolate overweights - the weights of each individual quaternion in qsdotThreshold - the threshold for the dot product of each two interpolated quaternions above which nlerpIterative(Quaterniondc, double, double) performs another iteration
of a small-step linear interpolationdest - will hold the resultpublic Quaterniond lookAlong(Vector3dc dir, Vector3dc up)
Because there are multiple possibilities for such a rotation, this method will choose the one that ensures the given up direction to remain
parallel to the plane spanned by the up and dir vectors.
If Q is this quaternion and R the quaternion representing the
specified rotation, then the new quaternion will be Q * R. So when transforming a
vector v with the new quaternion by using Q * R * v, the
rotation added by this method will be applied first!
Reference: http://answers.unity3d.com
dir - the direction to map to the positive Z axisup - the vector which will be mapped to a vector parallel to the plane
spanned by the given dir and uplookAlong(double, double, double, double, double, double, Quaterniond)public Quaterniond lookAlong(Vector3dc dir, Vector3dc up, Quaterniond dest)
Quaterniondcdest.
Because there are multiple possibilities for such a rotation, this method will choose the one that ensures the given up direction to remain
parallel to the plane spanned by the up and dir vectors.
If Q is this quaternion and R the quaternion representing the
specified rotation, then the new quaternion will be Q * R. So when transforming a
vector v with the new quaternion by using Q * R * v, the
rotation added by this method will be applied first!
Reference: http://answers.unity3d.com
lookAlong in interface Quaterniondcdir - the direction to map to the positive Z axisup - the vector which will be mapped to a vector parallel to the plane
spanned by the given dir and updest - will hold the resultQuaterniondc.lookAlong(double, double, double, double, double, double, Quaterniond)public Quaterniond lookAlong(double dirX, double dirY, double dirZ, double upX, double upY, double upZ)
Because there are multiple possibilities for such a rotation, this method will choose the one that ensures the given up direction to remain
parallel to the plane spanned by the up and dir vectors.
If Q is this quaternion and R the quaternion representing the
specified rotation, then the new quaternion will be Q * R. So when transforming a
vector v with the new quaternion by using Q * R * v, the
rotation added by this method will be applied first!
Reference: http://answers.unity3d.com
dirX - the x-coordinate of the direction to look alongdirY - the y-coordinate of the direction to look alongdirZ - the z-coordinate of the direction to look alongupX - the x-coordinate of the up vectorupY - the y-coordinate of the up vectorupZ - the z-coordinate of the up vectorlookAlong(double, double, double, double, double, double, Quaterniond)public Quaterniond lookAlong(double dirX, double dirY, double dirZ, double upX, double upY, double upZ, Quaterniond dest)
Quaterniondcdest.
Because there are multiple possibilities for such a rotation, this method will choose the one that ensures the given up direction to remain
parallel to the plane spanned by the up and dir vectors.
If Q is this quaternion and R the quaternion representing the
specified rotation, then the new quaternion will be Q * R. So when transforming a
vector v with the new quaternion by using Q * R * v, the
rotation added by this method will be applied first!
Reference: http://answers.unity3d.com
lookAlong in interface QuaterniondcdirX - the x-coordinate of the direction to look alongdirY - the y-coordinate of the direction to look alongdirZ - the z-coordinate of the direction to look alongupX - the x-coordinate of the up vectorupY - the y-coordinate of the up vectorupZ - the z-coordinate of the up vectordest - will hold the resultpublic String toString()
This method creates a new DecimalFormat on every invocation with the format string "0.000E0;-".
public String toString(NumberFormat formatter)
NumberFormat.formatter - the NumberFormat used to format the quaternion components withpublic void writeExternal(ObjectOutput out) throws IOException
writeExternal in interface ExternalizableIOExceptionpublic void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal in interface ExternalizableIOExceptionClassNotFoundExceptionpublic Quaterniond difference(Quaterniondc other)
this and the other quaternion
and store the result in this.
The difference is the rotation that has to be applied to get from
this rotation to other. If T is this, Q
is other and D is the computed difference, then the following equation holds:
T * D = Q
It is defined as: D = T^-1 * Q, where T^-1 denotes the inverse of T.
other - the other quaternionpublic Quaterniond difference(Quaterniondc other, Quaterniond dest)
Quaterniondcthis and the other quaternion
and store the result in dest.
The difference is the rotation that has to be applied to get from
this rotation to other. If T is this, Q
is other and D is the computed difference, then the following equation holds:
T * D = Q
It is defined as: D = T^-1 * Q, where T^-1 denotes the inverse of T.
difference in interface Quaterniondcother - the other quaterniondest - will hold the resultpublic Quaterniond rotationTo(double fromDirX, double fromDirY, double fromDirZ, double toDirX, double toDirY, double toDirZ)
this quaternion to a rotation that rotates the fromDir vector to point along toDir.
Since there can be multiple possible rotations, this method chooses the one with the shortest arc.
Reference: stackoverflow.com
fromDirX - the x-coordinate of the direction to rotate into the destination directionfromDirY - the y-coordinate of the direction to rotate into the destination directionfromDirZ - the z-coordinate of the direction to rotate into the destination directiontoDirX - the x-coordinate of the direction to rotate totoDirY - the y-coordinate of the direction to rotate totoDirZ - the z-coordinate of the direction to rotate topublic Quaterniond rotationTo(Vector3dc fromDir, Vector3dc toDir)
this quaternion to a rotation that rotates the fromDir vector to point along toDir.
Because there can be multiple possible rotations, this method chooses the one with the shortest arc.
fromDir - the starting directiontoDir - the destination directionrotationTo(double, double, double, double, double, double)public Quaterniond rotateTo(double fromDirX, double fromDirY, double fromDirZ, double toDirX, double toDirY, double toDirZ, Quaterniond dest)
Quaterniondcthis that rotates the fromDir vector to point along toDir and
store the result in dest.
Since there can be multiple possible rotations, this method chooses the one with the shortest arc.
If Q is this quaternion and R the quaternion representing the
specified rotation, then the new quaternion will be Q * R. So when transforming a
vector v with the new quaternion by using Q * R * v, the
rotation added by this method will be applied first!
Reference: stackoverflow.com
rotateTo in interface QuaterniondcfromDirX - the x-coordinate of the direction to rotate into the destination directionfromDirY - the y-coordinate of the direction to rotate into the destination directionfromDirZ - the z-coordinate of the direction to rotate into the destination directiontoDirX - the x-coordinate of the direction to rotate totoDirY - the y-coordinate of the direction to rotate totoDirZ - the z-coordinate of the direction to rotate todest - will hold the resultpublic Quaterniond rotationAxis(AxisAngle4f axisAngle)
Quaterniond to a rotation of the given angle in radians about the supplied
axis, all of which are specified via the AxisAngle4f.axisAngle - the AxisAngle4f giving the rotation angle in radians and the axis to rotate aboutrotationAxis(double, double, double, double)public Quaterniond rotationAxis(double angle, double axisX, double axisY, double axisZ)
angle - the rotation angle in radiansaxisX - the x-coordinate of the rotation axisaxisY - the y-coordinate of the rotation axisaxisZ - the z-coordinate of the rotation axispublic Quaterniond rotationX(double angle)
angle - the angle in radians to rotate about the x axispublic Quaterniond rotationY(double angle)
angle - the angle in radians to rotate about the y axispublic Quaterniond rotationZ(double angle)
angle - the angle in radians to rotate about the z axispublic Quaterniond rotateTo(double fromDirX, double fromDirY, double fromDirZ, double toDirX, double toDirY, double toDirZ)
this that rotates the fromDir vector to point along toDir.
Since there can be multiple possible rotations, this method chooses the one with the shortest arc.
If Q is this quaternion and R the quaternion representing the
specified rotation, then the new quaternion will be Q * R. So when transforming a
vector v with the new quaternion by using Q * R * v, the
rotation added by this method will be applied first!
fromDirX - the x-coordinate of the direction to rotate into the destination directionfromDirY - the y-coordinate of the direction to rotate into the destination directionfromDirZ - the z-coordinate of the direction to rotate into the destination directiontoDirX - the x-coordinate of the direction to rotate totoDirY - the y-coordinate of the direction to rotate totoDirZ - the z-coordinate of the direction to rotate torotateTo(double, double, double, double, double, double, Quaterniond)public Quaterniond rotateTo(Vector3dc fromDir, Vector3dc toDir, Quaterniond dest)
Quaterniondcthis that rotates the fromDir vector to point along toDir and
store the result in dest.
Because there can be multiple possible rotations, this method chooses the one with the shortest arc.
If Q is this quaternion and R the quaternion representing the
specified rotation, then the new quaternion will be Q * R. So when transforming a
vector v with the new quaternion by using Q * R * v, the
rotation added by this method will be applied first!
rotateTo in interface QuaterniondcfromDir - the starting directiontoDir - the destination directiondest - will hold the resultQuaterniondc.rotateTo(double, double, double, double, double, double, Quaterniond)public Quaterniond rotateTo(Vector3dc fromDir, Vector3dc toDir)
this that rotates the fromDir vector to point along toDir.
Because there can be multiple possible rotations, this method chooses the one with the shortest arc.
If Q is this quaternion and R the quaternion representing the
specified rotation, then the new quaternion will be Q * R. So when transforming a
vector v with the new quaternion by using Q * R * v, the
rotation added by this method will be applied first!
fromDir - the starting directiontoDir - the destination directionrotateTo(double, double, double, double, double, double, Quaterniond)public Quaterniond rotateX(double angle)
this quaternion rotating the given radians about the x axis.
If Q is this quaternion and R the quaternion representing the
specified rotation, then the new quaternion will be Q * R. So when transforming a
vector v with the new quaternion by using Q * R * v, the
rotation added by this method will be applied first!
angle - the angle in radians to rotate about the x axispublic Quaterniond rotateX(double angle, Quaterniond dest)
Quaterniondcthis quaternion rotating the given radians about the x axis
and store the result in dest.
If Q is this quaternion and R the quaternion representing the
specified rotation, then the new quaternion will be Q * R. So when transforming a
vector v with the new quaternion by using Q * R * v, the
rotation added by this method will be applied first!
rotateX in interface Quaterniondcangle - the angle in radians to rotate about the x axisdest - will hold the resultpublic Quaterniond rotateY(double angle)
this quaternion rotating the given radians about the y axis.
If Q is this quaternion and R the quaternion representing the
specified rotation, then the new quaternion will be Q * R. So when transforming a
vector v with the new quaternion by using Q * R * v, the
rotation added by this method will be applied first!
angle - the angle in radians to rotate about the y axispublic Quaterniond rotateY(double angle, Quaterniond dest)
Quaterniondcthis quaternion rotating the given radians about the y axis
and store the result in dest.
If Q is this quaternion and R the quaternion representing the
specified rotation, then the new quaternion will be Q * R. So when transforming a
vector v with the new quaternion by using Q * R * v, the
rotation added by this method will be applied first!
rotateY in interface Quaterniondcangle - the angle in radians to rotate about the y axisdest - will hold the resultpublic Quaterniond rotateZ(double angle)
this quaternion rotating the given radians about the z axis.
If Q is this quaternion and R the quaternion representing the
specified rotation, then the new quaternion will be Q * R. So when transforming a
vector v with the new quaternion by using Q * R * v, the
rotation added by this method will be applied first!
angle - the angle in radians to rotate about the z axispublic Quaterniond rotateZ(double angle, Quaterniond dest)
Quaterniondcthis quaternion rotating the given radians about the z axis
and store the result in dest.
If Q is this quaternion and R the quaternion representing the
specified rotation, then the new quaternion will be Q * R. So when transforming a
vector v with the new quaternion by using Q * R * v, the
rotation added by this method will be applied first!
rotateZ in interface Quaterniondcangle - the angle in radians to rotate about the z axisdest - will hold the resultpublic Quaterniond rotateLocalX(double angle)
this quaternion rotating the given radians about the local x axis.
If Q is this quaternion and R the quaternion representing the
specified rotation, then the new quaternion will be R * Q. So when transforming a
vector v with the new quaternion by using R * Q * v, the
rotation represented by this will be applied first!
angle - the angle in radians to rotate about the local x axispublic Quaterniond rotateLocalX(double angle, Quaterniond dest)
Quaterniondcthis quaternion rotating the given radians about the local x axis
and store the result in dest.
If Q is this quaternion and R the quaternion representing the
specified rotation, then the new quaternion will be R * Q. So when transforming a
vector v with the new quaternion by using R * Q * v, the
rotation represented by this will be applied first!
rotateLocalX in interface Quaterniondcangle - the angle in radians to rotate about the local x axisdest - will hold the resultpublic Quaterniond rotateLocalY(double angle)
this quaternion rotating the given radians about the local y axis.
If Q is this quaternion and R the quaternion representing the
specified rotation, then the new quaternion will be R * Q. So when transforming a
vector v with the new quaternion by using R * Q * v, the
rotation represented by this will be applied first!
angle - the angle in radians to rotate about the local y axispublic Quaterniond rotateLocalY(double angle, Quaterniond dest)
Quaterniondcthis quaternion rotating the given radians about the local y axis
and store the result in dest.
If Q is this quaternion and R the quaternion representing the
specified rotation, then the new quaternion will be R * Q. So when transforming a
vector v with the new quaternion by using R * Q * v, the
rotation represented by this will be applied first!
rotateLocalY in interface Quaterniondcangle - the angle in radians to rotate about the local y axisdest - will hold the resultpublic Quaterniond rotateLocalZ(double angle)
this quaternion rotating the given radians about the local z axis.
If Q is this quaternion and R the quaternion representing the
specified rotation, then the new quaternion will be R * Q. So when transforming a
vector v with the new quaternion by using R * Q * v, the
rotation represented by this will be applied first!
angle - the angle in radians to rotate about the local z axispublic Quaterniond rotateLocalZ(double angle, Quaterniond dest)
Quaterniondcthis quaternion rotating the given radians about the local z axis
and store the result in dest.
If Q is this quaternion and R the quaternion representing the
specified rotation, then the new quaternion will be R * Q. So when transforming a
vector v with the new quaternion by using R * Q * v, the
rotation represented by this will be applied first!
rotateLocalZ in interface Quaterniondcangle - the angle in radians to rotate about the local z axisdest - will hold the resultpublic Quaterniond rotateXYZ(double angleX, double angleY, double angleZ)
this quaternion rotating the given radians about the cartesian base unit axes,
called the euler angles using rotation sequence XYZ.
This method is equivalent to calling: rotateX(angleX).rotateY(angleY).rotateZ(angleZ)
If Q is this quaternion and R the quaternion representing the
specified rotation, then the new quaternion will be Q * R. So when transforming a
vector v with the new quaternion by using Q * R * v, the
rotation added by this method will be applied first!
angleX - the angle in radians to rotate about the x axisangleY - the angle in radians to rotate about the y axisangleZ - the angle in radians to rotate about the z axispublic Quaterniond rotateXYZ(double angleX, double angleY, double angleZ, Quaterniond dest)
Quaterniondcthis quaternion rotating the given radians about the cartesian base unit axes,
called the euler angles using rotation sequence XYZ and store the result in dest.
This method is equivalent to calling: rotateX(angleX, dest).rotateY(angleY).rotateZ(angleZ)
If Q is this quaternion and R the quaternion representing the
specified rotation, then the new quaternion will be Q * R. So when transforming a
vector v with the new quaternion by using Q * R * v, the
rotation added by this method will be applied first!
rotateXYZ in interface QuaterniondcangleX - the angle in radians to rotate about the x axisangleY - the angle in radians to rotate about the y axisangleZ - the angle in radians to rotate about the z axisdest - will hold the resultpublic Quaterniond rotateZYX(double angleZ, double angleY, double angleX)
this quaternion rotating the given radians about the cartesian base unit axes,
called the euler angles, using the rotation sequence ZYX.
This method is equivalent to calling: rotateZ(angleZ).rotateY(angleY).rotateX(angleX)
If Q is this quaternion and R the quaternion representing the
specified rotation, then the new quaternion will be Q * R. So when transforming a
vector v with the new quaternion by using Q * R * v, the
rotation added by this method will be applied first!
angleZ - the angle in radians to rotate about the z axisangleY - the angle in radians to rotate about the y axisangleX - the angle in radians to rotate about the x axispublic Quaterniond rotateZYX(double angleZ, double angleY, double angleX, Quaterniond dest)
Quaterniondcthis quaternion rotating the given radians about the cartesian base unit axes,
called the euler angles, using the rotation sequence ZYX and store the result in dest.
This method is equivalent to calling: rotateZ(angleZ, dest).rotateY(angleY).rotateX(angleX)
If Q is this quaternion and R the quaternion representing the
specified rotation, then the new quaternion will be Q * R. So when transforming a
vector v with the new quaternion by using Q * R * v, the
rotation added by this method will be applied first!
rotateZYX in interface QuaterniondcangleZ - the angle in radians to rotate about the z axisangleY - the angle in radians to rotate about the y axisangleX - the angle in radians to rotate about the x axisdest - will hold the resultpublic Quaterniond rotateYXZ(double angleZ, double angleY, double angleX)
this quaternion rotating the given radians about the cartesian base unit axes,
called the euler angles, using the rotation sequence YXZ.
This method is equivalent to calling: rotateY(angleY).rotateX(angleX).rotateZ(angleZ)
If Q is this quaternion and R the quaternion representing the
specified rotation, then the new quaternion will be Q * R. So when transforming a
vector v with the new quaternion by using Q * R * v, the
rotation added by this method will be applied first!
angleY - the angle in radians to rotate about the y axisangleX - the angle in radians to rotate about the x axisangleZ - the angle in radians to rotate about the z axispublic Quaterniond rotateYXZ(double angleY, double angleX, double angleZ, Quaterniond dest)
Quaterniondcthis quaternion rotating the given radians about the cartesian base unit axes,
called the euler angles, using the rotation sequence YXZ and store the result in dest.
This method is equivalent to calling: rotateY(angleY, dest).rotateX(angleX).rotateZ(angleZ)
If Q is this quaternion and R the quaternion representing the
specified rotation, then the new quaternion will be Q * R. So when transforming a
vector v with the new quaternion by using Q * R * v, the
rotation added by this method will be applied first!
rotateYXZ in interface QuaterniondcangleY - the angle in radians to rotate about the y axisangleX - the angle in radians to rotate about the x axisangleZ - the angle in radians to rotate about the z axisdest - will hold the resultpublic Vector3d getEulerAnglesXYZ(Vector3d eulerAngles)
QuaterniondcXYZ of this quaternion and store them in the
provided parameter eulerAngles.getEulerAnglesXYZ in interface QuaterniondceulerAngles - will hold the euler angles in radianspublic Quaterniond rotateAxis(double angle, double axisX, double axisY, double axisZ, Quaterniond dest)
Quaterniondcthis quaternion rotating the given radians about the specified axis
and store the result in dest.
If Q is this quaternion and R the quaternion representing the
specified rotation, then the new quaternion will be Q * R. So when transforming a
vector v with the new quaternion by using Q * R * v, the
rotation added by this method will be applied first!
rotateAxis in interface Quaterniondcangle - the angle in radians to rotate about the specified axisaxisX - the x coordinate of the rotation axisaxisY - the y coordinate of the rotation axisaxisZ - the z coordinate of the rotation axisdest - will hold the resultpublic Quaterniond rotateAxis(double angle, Vector3dc axis, Quaterniond dest)
Quaterniondcthis quaternion rotating the given radians about the specified axis
and store the result in dest.
If Q is this quaternion and R the quaternion representing the
specified rotation, then the new quaternion will be Q * R. So when transforming a
vector v with the new quaternion by using Q * R * v, the
rotation added by this method will be applied first!
rotateAxis in interface Quaterniondcangle - the angle in radians to rotate about the specified axisaxis - the rotation axisdest - will hold the resultQuaterniondc.rotateAxis(double, double, double, double, Quaterniond)public Quaterniond rotateAxis(double angle, Vector3dc axis)
this quaternion rotating the given radians about the specified axis.
If Q is this quaternion and R the quaternion representing the
specified rotation, then the new quaternion will be Q * R. So when transforming a
vector v with the new quaternion by using Q * R * v, the
rotation added by this method will be applied first!
angle - the angle in radians to rotate about the specified axisaxis - the rotation axisrotateAxis(double, double, double, double, Quaterniond)public Quaterniond rotateAxis(double angle, double axisX, double axisY, double axisZ)
this quaternion rotating the given radians about the specified axis.
If Q is this quaternion and R the quaternion representing the
specified rotation, then the new quaternion will be Q * R. So when transforming a
vector v with the new quaternion by using Q * R * v, the
rotation added by this method will be applied first!
angle - the angle in radians to rotate about the specified axisaxisX - the x coordinate of the rotation axisaxisY - the y coordinate of the rotation axisaxisZ - the z coordinate of the rotation axisrotateAxis(double, double, double, double, Quaterniond)public Vector3d positiveX(Vector3d dir)
Quaterniondc+X before the rotation transformation represented by this quaternion is applied.
This method is equivalent to the following code:
Quaterniond inv = new Quaterniond(this).invert(); inv.transform(dir.set(1, 0, 0));
positiveX in interface Quaterniondcdir - will hold the direction of +Xpublic Vector3d normalizedPositiveX(Vector3d dir)
Quaterniondc+X before the rotation transformation represented by this normalized quaternion is applied.
The quaternion must be normalized for this method to work.
This method is equivalent to the following code:
Quaterniond inv = new Quaterniond(this).conjugate(); inv.transform(dir.set(1, 0, 0));
normalizedPositiveX in interface Quaterniondcdir - will hold the direction of +Xpublic Vector3d positiveY(Vector3d dir)
Quaterniondc+Y before the rotation transformation represented by this quaternion is applied.
This method is equivalent to the following code:
Quaterniond inv = new Quaterniond(this).invert(); inv.transform(dir.set(0, 1, 0));
positiveY in interface Quaterniondcdir - will hold the direction of +Ypublic Vector3d normalizedPositiveY(Vector3d dir)
Quaterniondc+Y before the rotation transformation represented by this normalized quaternion is applied.
The quaternion must be normalized for this method to work.
This method is equivalent to the following code:
Quaterniond inv = new Quaterniond(this).conjugate(); inv.transform(dir.set(0, 1, 0));
normalizedPositiveY in interface Quaterniondcdir - will hold the direction of +Ypublic Vector3d positiveZ(Vector3d dir)
Quaterniondc+Z before the rotation transformation represented by this quaternion is applied.
This method is equivalent to the following code:
Quaterniond inv = new Quaterniond(this).invert(); inv.transform(dir.set(0, 0, 1));
positiveZ in interface Quaterniondcdir - will hold the direction of +Zpublic Vector3d normalizedPositiveZ(Vector3d dir)
Quaterniondc+Z before the rotation transformation represented by this normalized quaternion is applied.
The quaternion must be normalized for this method to work.
This method is equivalent to the following code:
Quaterniond inv = new Quaterniond(this).conjugate(); inv.transform(dir.set(0, 0, 1));
normalizedPositiveZ in interface Quaterniondcdir - will hold the direction of +ZCopyright © 2015–2019 JOML. All rights reserved.