Interface Quaterniondc

 All Known Implementing Classes:
Quaterniond
public interface Quaterniondc
Interface to a readonly view of a quaternion of doubleprecision floats. Author:
 Kai Burjack


Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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 indest
.Quaterniond
add(Quaterniondc q2, Quaterniond dest)
Addq2
to this quaternion and store the result indest
.double
angle()
Return the angle in radians represented by this quaternion rotation.Quaterniond
conjugate(Quaterniond dest)
Conjugate this quaternion and store the result indest
.Quaterniond
difference(Quaterniondc other, Quaterniond dest)
Compute the difference betweenthis
and theother
quaternion and store the result indest
.Quaterniond
div(Quaterniondc b, Quaterniond dest)
Dividethis
quaternion byb
and store the result indest
.double
dot(Quaterniondc otherQuat)
Return the dot product of thisQuaterniond
andotherQuat
.Matrix3d
get(Matrix3d dest)
Set the given destination matrix to the rotation represented bythis
.Matrix3f
get(Matrix3f dest)
Set the given destination matrix to the rotation represented bythis
.Matrix4d
get(Matrix4d dest)
Set the given destination matrix to the rotation represented bythis
.Matrix4f
get(Matrix4f dest)
Set the given destination matrix to the rotation represented bythis
.Quaterniond
get(Quaterniond dest)
Set the givenQuaterniond
to the values ofthis
.Vector3d
getEulerAnglesXYZ(Vector3d eulerAngles)
Get the euler angles in radians in rotation sequenceXYZ
of this quaternion and store them in the provided parametereulerAngles
.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 deltadt
and add the differentiate rotation to the rotation represented by this quaternion and store the result intodest
.Quaterniond
invert(Quaterniond dest)
Invert this quaternion and store thenormalized
result indest
.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, Quaterniond dest)
Apply a rotation to this quaternion that maps the given direction to the positive Z axis, and store the result indest
.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 indest
.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 indest
.Quaterniond
mul(Quaterniondc q, Quaterniond dest)
Multiply this quaternion byq
and store the result indest
.Quaterniond
nlerp(Quaterniondc q, double factor, Quaterniond dest)
Compute a linear (nonspherical) interpolation ofthis
and the given quaternionq
and store the result indest
.Quaterniond
nlerpIterative(Quaterniondc q, double alpha, double dotThreshold, Quaterniond dest)
Compute linear (nonspherical) interpolations ofthis
and the given quaternionq
iteratively and store the result indest
.Quaterniond
normalize(Quaterniond dest)
Normalize this quaternion and store the result indest
.Vector3d
normalizedPositiveX(Vector3d dir)
Obtain the direction of+X
before the rotation transformation represented bythis
normalized quaternion is applied.Vector3d
normalizedPositiveY(Vector3d dir)
Obtain the direction of+Y
before the rotation transformation represented bythis
normalized quaternion is applied.Vector3d
normalizedPositiveZ(Vector3d dir)
Obtain the direction of+Z
before the rotation transformation represented bythis
normalized quaternion is applied.Vector3d
positiveX(Vector3d dir)
Obtain the direction of+X
before the rotation transformation represented bythis
quaternion is applied.Vector3d
positiveY(Vector3d dir)
Obtain the direction of+Y
before the rotation transformation represented bythis
quaternion is applied.Vector3d
positiveZ(Vector3d dir)
Obtain the direction of+Z
before the rotation transformation represented bythis
quaternion is applied.Quaterniond
premul(double qx, double qy, double qz, double qw, Quaterniond dest)
Premultiply this quaternion by the quaternion represented via(qx, qy, qz, qw)
and store the result indest
.Quaterniond
premul(Quaterniondc q, Quaterniond dest)
Premultiply this quaternion byq
and store the result indest
.Quaterniond
rotateAxis(double angle, double axisX, double axisY, double axisZ, Quaterniond dest)
Apply a rotation tothis
quaternion rotating the given radians about the specified axis and store the result indest
.Quaterniond
rotateAxis(double angle, Vector3dc axis, Quaterniond dest)
Apply a rotation tothis
quaternion rotating the given radians about the specified axis and store the result indest
.Quaterniond
rotateLocalX(double angle, Quaterniond dest)
Apply a rotation tothis
quaternion rotating the given radians about the local x axis and store the result indest
.Quaterniond
rotateLocalY(double angle, Quaterniond dest)
Apply a rotation tothis
quaternion rotating the given radians about the local y axis and store the result indest
.Quaterniond
rotateLocalZ(double angle, Quaterniond dest)
Apply a rotation tothis
quaternion rotating the given radians about the local z axis and store the result indest
.Quaterniond
rotateTo(double fromDirX, double fromDirY, double fromDirZ, double toDirX, double toDirY, double toDirZ, Quaterniond dest)
Apply a rotation tothis
that rotates thefromDir
vector to point alongtoDir
and store the result indest
.Quaterniond
rotateTo(Vector3dc fromDir, Vector3dc toDir, Quaterniond dest)
Apply a rotation tothis
that rotates thefromDir
vector to point alongtoDir
and store the result indest
.Quaterniond
rotateX(double angle, Quaterniond dest)
Apply a rotation tothis
quaternion rotating the given radians about the x axis and store the result indest
.Quaterniond
rotateXYZ(double angleX, double angleY, double angleZ, Quaterniond dest)
Apply a rotation tothis
quaternion rotating the given radians about the cartesian base unit axes, called the euler angles using rotation sequenceXYZ
and store the result indest
.Quaterniond
rotateY(double angle, Quaterniond dest)
Apply a rotation tothis
quaternion rotating the given radians about the y axis and store the result indest
.Quaterniond
rotateYXZ(double angleY, double angleX, double angleZ, Quaterniond dest)
Apply a rotation tothis
quaternion rotating the given radians about the cartesian base unit axes, called the euler angles, using the rotation sequenceYXZ
and store the result indest
.Quaterniond
rotateZ(double angle, Quaterniond dest)
Apply a rotation tothis
quaternion rotating the given radians about the z axis and store the result indest
.Quaterniond
rotateZYX(double angleZ, double angleY, double angleX, Quaterniond dest)
Apply a rotation tothis
quaternion rotating the given radians about the cartesian base unit axes, called the euler angles, using the rotation sequenceZYX
and store the result indest
.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 givenfactor
, and store the result indest
.Quaterniond
slerp(Quaterniondc target, double alpha, Quaterniond dest)
Vector3d
transform(double x, double y, double z, Vector3d dest)
Transform the given vector(x, y, z)
by this quaternion and store the result indest
.Vector4d
transform(double x, double y, double z, Vector4d dest)
Transform the given vector(x, y, z)
by this quaternion and store the result indest
.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 indest
.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 indest
.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()
double
x()
double
y()
double
z()



Method Detail

x
double x()
 Returns:
 the first component of the vector part

y
double y()
 Returns:
 the second component of the vector part

z
double z()
 Returns:
 the third component of the vector part

w
double w()
 Returns:
 the real/scalar part of the quaternion

normalize
Quaterniond normalize(Quaterniond dest)
Normalize this quaternion and store the result indest
. Parameters:
dest
 will hold the result Returns:
 dest

add
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 indest
. Parameters:
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 componentdest
 will hold the result Returns:
 dest

add
Quaterniond add(Quaterniondc q2, Quaterniond dest)
Addq2
to this quaternion and store the result indest
. Parameters:
q2
 the quaternion to add to thisdest
 will hold the result Returns:
 dest

dot
double dot(Quaterniondc otherQuat)
Return the dot product of thisQuaterniond
andotherQuat
. Parameters:
otherQuat
 the other quaternion Returns:
 the dot product

angle
double angle()
Return the angle in radians represented by this quaternion rotation. Returns:
 the angle in radians

get
Matrix3d get(Matrix3d dest)
Set the given destination matrix to the rotation represented bythis
. Parameters:
dest
 the matrix to write the rotation into Returns:
 the passed in destination
 See Also:
Matrix3d.set(Quaterniondc)

get
Matrix3f get(Matrix3f dest)
Set the given destination matrix to the rotation represented bythis
. Parameters:
dest
 the matrix to write the rotation into Returns:
 the passed in destination
 See Also:
Matrix3f.set(Quaterniondc)

get
Matrix4d get(Matrix4d dest)
Set the given destination matrix to the rotation represented bythis
. Parameters:
dest
 the matrix to write the rotation into Returns:
 the passed in destination
 See Also:
Matrix4d.set(Quaterniondc)

get
Matrix4f get(Matrix4f dest)
Set the given destination matrix to the rotation represented bythis
. Parameters:
dest
 the matrix to write the rotation into Returns:
 the passed in destination
 See Also:
Matrix4f.set(Quaterniondc)

get
Quaterniond get(Quaterniond dest)
Set the givenQuaterniond
to the values ofthis
. Parameters:
dest
 theQuaterniond
to set Returns:
 the passed in destination

mul
Quaterniond mul(Quaterniondc q, Quaterniond dest)
Multiply this quaternion byq
and store the result indest
.If
T
isthis
andQ
is the given quaternion, then the resulting quaternionR
is:R = T * Q
So, this method uses postmultiplication like the matrix classes, resulting in a vector to be transformed by
Q
first, and then byT
. Parameters:
q
 the quaternion to multiplythis
bydest
 will hold the result Returns:
 dest

mul
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 indest
.If
T
isthis
andQ
is the given quaternion, then the resulting quaternionR
is:R = T * Q
So, this method uses postmultiplication like the matrix classes, resulting in a vector to be transformed by
Q
first, and then byT
. Parameters:
qx
 the x component of the quaternion to multiplythis
byqy
 the y component of the quaternion to multiplythis
byqz
 the z component of the quaternion to multiplythis
byqw
 the w component of the quaternion to multiplythis
bydest
 will hold the result Returns:
 dest

premul
Quaterniond premul(Quaterniondc q, Quaterniond dest)
Premultiply this quaternion byq
and store the result indest
.If
T
isthis
andQ
is the given quaternion, then the resulting quaternionR
is:R = Q * T
So, this method uses premultiplication, resulting in a vector to be transformed by
T
first, and then byQ
. Parameters:
q
 the quaternion to premultiplythis
bydest
 will hold the result Returns:
 dest

premul
Quaterniond premul(double qx, double qy, double qz, double qw, Quaterniond dest)
Premultiply this quaternion by the quaternion represented via(qx, qy, qz, qw)
and store the result indest
.If
T
isthis
andQ
is the given quaternion, then the resulting quaternionR
is:R = Q * T
So, this method uses premultiplication, resulting in a vector to be transformed by
T
first, and then byQ
. Parameters:
qx
 the x component of the quaternion to multiplythis
byqy
 the y component of the quaternion to multiplythis
byqz
 the z component of the quaternion to multiplythis
byqw
 the w component of the quaternion to multiplythis
bydest
 will hold the result Returns:
 dest

transform
Vector3d transform(Vector3d vec)
Transform the given vector by this quaternion. This will apply the rotation described by this quaternion to the given vector. Parameters:
vec
 the vector to transform Returns:
 vec

transformPositiveX
Vector3d transformPositiveX(Vector3d dest)
Transform the vector(1, 0, 0)
by this quaternion. Parameters:
dest
 will hold the result Returns:
 dest

transformPositiveX
Vector4d transformPositiveX(Vector4d dest)
Transform the vector(1, 0, 0)
by this quaternion.Only the first three components of the given 4D vector are modified.
 Parameters:
dest
 will hold the result Returns:
 dest

transformUnitPositiveX
Vector3d transformUnitPositiveX(Vector3d dest)
Transform the vector(1, 0, 0)
by this unit quaternion.This method is only applicable when
this
is a unit quaternion.Reference: https://de.mathworks.com/
 Parameters:
dest
 will hold the result Returns:
 dest

transformUnitPositiveX
Vector4d transformUnitPositiveX(Vector4d dest)
Transform the vector(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/
 Parameters:
dest
 will hold the result Returns:
 dest

transformPositiveY
Vector3d transformPositiveY(Vector3d dest)
Transform the vector(0, 1, 0)
by this quaternion. Parameters:
dest
 will hold the result Returns:
 dest

transformPositiveY
Vector4d transformPositiveY(Vector4d dest)
Transform the vector(0, 1, 0)
by this quaternion.Only the first three components of the given 4D vector are modified.
 Parameters:
dest
 will hold the result Returns:
 dest

transformUnitPositiveY
Vector3d transformUnitPositiveY(Vector3d dest)
Transform the vector(0, 1, 0)
by this unit quaternion.This method is only applicable when
this
is a unit quaternion.Reference: https://de.mathworks.com/
 Parameters:
dest
 will hold the result Returns:
 dest

transformUnitPositiveY
Vector4d transformUnitPositiveY(Vector4d dest)
Transform the vector(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/
 Parameters:
dest
 will hold the result Returns:
 dest

transformPositiveZ
Vector3d transformPositiveZ(Vector3d dest)
Transform the vector(0, 0, 1)
by this quaternion. Parameters:
dest
 will hold the result Returns:
 dest

transformPositiveZ
Vector4d transformPositiveZ(Vector4d dest)
Transform the vector(0, 0, 1)
by this quaternion.Only the first three components of the given 4D vector are modified.
 Parameters:
dest
 will hold the result Returns:
 dest

transformUnitPositiveZ
Vector3d transformUnitPositiveZ(Vector3d dest)
Transform the vector(0, 0, 1)
by this unit quaternion.This method is only applicable when
this
is a unit quaternion.Reference: https://de.mathworks.com/
 Parameters:
dest
 will hold the result Returns:
 dest

transformUnitPositiveZ
Vector4d transformUnitPositiveZ(Vector4d dest)
Transform the vector(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/
 Parameters:
dest
 will hold the result Returns:
 dest

transform
Vector4d transform(Vector4d vec)
Transform the given vector by this quaternion. 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 modified.
 Parameters:
vec
 the vector to transform Returns:
 vec

transform
Vector3d transform(Vector3dc vec, Vector3d dest)
Transform the given vector by this quaternion and store the result indest
. This will apply the rotation described by this quaternion to the given vector. Parameters:
vec
 the vector to transformdest
 will hold the result Returns:
 dest

transform
Vector3d transform(double x, double y, double z, Vector3d dest)
Transform the given vector(x, y, z)
by this quaternion and store the result indest
. This will apply the rotation described by this quaternion to the given vector. Parameters:
x
 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 result Returns:
 dest

transform
Vector4d transform(Vector4dc vec, Vector4d dest)
Transform the given vector by this quaternion and store the result indest
. 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.
 Parameters:
vec
 the vector to transformdest
 will hold the result Returns:
 dest

transform
Vector4d transform(double x, double y, double z, Vector4d dest)
Transform the given vector(x, y, z)
by this quaternion and store the result indest
. This will apply the rotation described by this quaternion to the given vector. Parameters:
x
 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 result Returns:
 dest

invert
Quaterniond invert(Quaterniond dest)
Invert this quaternion and store thenormalized
result indest
.If this quaternion is already normalized, then
conjugate(Quaterniond)
should be used instead. Parameters:
dest
 will hold the result Returns:
 dest
 See Also:
conjugate(Quaterniond)

div
Quaterniond div(Quaterniondc b, Quaterniond dest)
Dividethis
quaternion byb
and store the result indest
.The division expressed using the inverse is performed in the following way:
dest = this * b^1
, whereb^1
is the inverse ofb
. Parameters:
b
 theQuaterniondc
to divide this bydest
 will hold the result Returns:
 dest

conjugate
Quaterniond conjugate(Quaterniond dest)
Conjugate this quaternion and store the result indest
. Parameters:
dest
 will hold the result Returns:
 dest

lengthSquared
double lengthSquared()
Return the square of the length of this quaternion. Returns:
 the length

slerp
Quaterniond slerp(Quaterniondc target, double alpha, Quaterniond dest)
Interpolate betweenthis
unit
quaternion and the specifiedtarget
unit
quaternion using spherical linear interpolation using the specified interpolation factoralpha
, and store the result indest
.This method resorts to nonspherical linear interpolation when the absolute dot product between
this
andtarget
is below1E6
.Reference: http://fabiensanglard.net
 Parameters:
target
 the target of the interpolation, which should be reached withalpha = 1.0
alpha
 the interpolation factor, within[0..1]
dest
 will hold the result Returns:
 dest

scale
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 givenfactor
, and store the result indest
. Parameters:
factor
 the scaling factordest
 will hold the result Returns:
 dest

integrate
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 deltadt
and add the differentiate rotation to the rotation represented by this quaternion and store the result intodest
.This method premultiplies the rotation given by
dt
and(vx, vy, vz)
bythis
, so the angular velocities are always relative to the local coordinate system of the rotation represented bythis
quaternion.This method is equivalent to calling:
rotateLocal(dt * vx, dt * vy, dt * vz, dest)
Reference: http://physicsforgames.blogspot.de/
 Parameters:
dt
 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 result Returns:
 dest

nlerp
Quaterniond nlerp(Quaterniondc q, double factor, Quaterniond dest)
Compute a linear (nonspherical) interpolation ofthis
and the given quaternionq
and store the result indest
.Reference: http://fabiensanglard.net
 Parameters:
q
 the other quaternionfactor
 the interpolation factor. It is between 0.0 and 1.0dest
 will hold the result Returns:
 dest

nlerpIterative
Quaterniond nlerpIterative(Quaterniondc q, double alpha, double dotThreshold, Quaterniond dest)
Compute linear (nonspherical) interpolations ofthis
and the given quaternionq
iteratively and store the result indest
.This method performs a series of smallstep nlerp interpolations to avoid doing a costly spherical linear interpolation, like
slerp
, by subdividing the rotation arc betweenthis
andq
via nonspherical linear interpolations as long as the absolute dot product ofthis
andq
is greater than the givendotThreshold
parameter.Thanks to
@theagentd
at http://www.javagaming.org/ for providing the code. Parameters:
q
 the other quaternionalpha
 the interpolation factor, between 0.0 and 1.0dotThreshold
 the threshold for the dot product ofthis
andq
above which this method performs another iteration of a smallstep linear interpolationdest
 will hold the result Returns:
 dest

lookAlong
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 indest
.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
anddir
vectors.If
Q
isthis
quaternion andR
the quaternion representing the specified rotation, then the new quaternion will beQ * R
. So when transforming a vectorv
with the new quaternion by usingQ * R * v
, the rotation added by this method will be applied first!Reference: http://answers.unity3d.com
 Parameters:
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 givendir
andup
dest
 will hold the result Returns:
 dest
 See Also:
lookAlong(double, double, double, double, double, double, Quaterniond)

lookAlong
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 indest
.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
anddir
vectors.If
Q
isthis
quaternion andR
the quaternion representing the specified rotation, then the new quaternion will beQ * R
. So when transforming a vectorv
with the new quaternion by usingQ * R * v
, the rotation added by this method will be applied first!Reference: http://answers.unity3d.com
 Parameters:
dirX
 the xcoordinate of the direction to look alongdirY
 the ycoordinate of the direction to look alongdirZ
 the zcoordinate of the direction to look alongupX
 the xcoordinate of the up vectorupY
 the ycoordinate of the up vectorupZ
 the zcoordinate of the up vectordest
 will hold the result Returns:
 dest

difference
Quaterniond difference(Quaterniondc other, Quaterniond dest)
Compute the difference betweenthis
and theother
quaternion and store the result indest
.The difference is the rotation that has to be applied to get from
this
rotation toother
. IfT
isthis
,Q
isother
andD
is the computed difference, then the following equation holds:T * D = Q
It is defined as:
D = T^1 * Q
, whereT^1
denotes theinverse
ofT
. Parameters:
other
 the other quaterniondest
 will hold the result Returns:
 dest

rotateTo
Quaterniond rotateTo(double fromDirX, double fromDirY, double fromDirZ, double toDirX, double toDirY, double toDirZ, Quaterniond dest)
Apply a rotation tothis
that rotates thefromDir
vector to point alongtoDir
and store the result indest
.Since there can be multiple possible rotations, this method chooses the one with the shortest arc.
If
Q
isthis
quaternion andR
the quaternion representing the specified rotation, then the new quaternion will beQ * R
. So when transforming a vectorv
with the new quaternion by usingQ * R * v
, the rotation added by this method will be applied first!Reference: stackoverflow.com
 Parameters:
fromDirX
 the xcoordinate of the direction to rotate into the destination directionfromDirY
 the ycoordinate of the direction to rotate into the destination directionfromDirZ
 the zcoordinate of the direction to rotate into the destination directiontoDirX
 the xcoordinate of the direction to rotate totoDirY
 the ycoordinate of the direction to rotate totoDirZ
 the zcoordinate of the direction to rotate todest
 will hold the result Returns:
 dest

rotateTo
Quaterniond rotateTo(Vector3dc fromDir, Vector3dc toDir, Quaterniond dest)
Apply a rotation tothis
that rotates thefromDir
vector to point alongtoDir
and store the result indest
.Because there can be multiple possible rotations, this method chooses the one with the shortest arc.
If
Q
isthis
quaternion andR
the quaternion representing the specified rotation, then the new quaternion will beQ * R
. So when transforming a vectorv
with the new quaternion by usingQ * R * v
, the rotation added by this method will be applied first! Parameters:
fromDir
 the starting directiontoDir
 the destination directiondest
 will hold the result Returns:
 dest
 See Also:
rotateTo(double, double, double, double, double, double, Quaterniond)

rotateX
Quaterniond rotateX(double angle, Quaterniond dest)
Apply a rotation tothis
quaternion rotating the given radians about the x axis and store the result indest
.If
Q
isthis
quaternion andR
the quaternion representing the specified rotation, then the new quaternion will beQ * R
. So when transforming a vectorv
with the new quaternion by usingQ * R * v
, the rotation added by this method will be applied first! Parameters:
angle
 the angle in radians to rotate about the x axisdest
 will hold the result Returns:
 dest

rotateY
Quaterniond rotateY(double angle, Quaterniond dest)
Apply a rotation tothis
quaternion rotating the given radians about the y axis and store the result indest
.If
Q
isthis
quaternion andR
the quaternion representing the specified rotation, then the new quaternion will beQ * R
. So when transforming a vectorv
with the new quaternion by usingQ * R * v
, the rotation added by this method will be applied first! Parameters:
angle
 the angle in radians to rotate about the y axisdest
 will hold the result Returns:
 dest

rotateZ
Quaterniond rotateZ(double angle, Quaterniond dest)
Apply a rotation tothis
quaternion rotating the given radians about the z axis and store the result indest
.If
Q
isthis
quaternion andR
the quaternion representing the specified rotation, then the new quaternion will beQ * R
. So when transforming a vectorv
with the new quaternion by usingQ * R * v
, the rotation added by this method will be applied first! Parameters:
angle
 the angle in radians to rotate about the z axisdest
 will hold the result Returns:
 dest

rotateLocalX
Quaterniond rotateLocalX(double angle, Quaterniond dest)
Apply a rotation tothis
quaternion rotating the given radians about the local x axis and store the result indest
.If
Q
isthis
quaternion andR
the quaternion representing the specified rotation, then the new quaternion will beR * Q
. So when transforming a vectorv
with the new quaternion by usingR * Q * v
, the rotation represented bythis
will be applied first! Parameters:
angle
 the angle in radians to rotate about the local x axisdest
 will hold the result Returns:
 dest

rotateLocalY
Quaterniond rotateLocalY(double angle, Quaterniond dest)
Apply a rotation tothis
quaternion rotating the given radians about the local y axis and store the result indest
.If
Q
isthis
quaternion andR
the quaternion representing the specified rotation, then the new quaternion will beR * Q
. So when transforming a vectorv
with the new quaternion by usingR * Q * v
, the rotation represented bythis
will be applied first! Parameters:
angle
 the angle in radians to rotate about the local y axisdest
 will hold the result Returns:
 dest

rotateLocalZ
Quaterniond rotateLocalZ(double angle, Quaterniond dest)
Apply a rotation tothis
quaternion rotating the given radians about the local z axis and store the result indest
.If
Q
isthis
quaternion andR
the quaternion representing the specified rotation, then the new quaternion will beR * Q
. So when transforming a vectorv
with the new quaternion by usingR * Q * v
, the rotation represented bythis
will be applied first! Parameters:
angle
 the angle in radians to rotate about the local z axisdest
 will hold the result Returns:
 dest

rotateXYZ
Quaterniond rotateXYZ(double angleX, double angleY, double angleZ, Quaterniond dest)
Apply a rotation tothis
quaternion rotating the given radians about the cartesian base unit axes, called the euler angles using rotation sequenceXYZ
and store the result indest
.This method is equivalent to calling:
rotateX(angleX, dest).rotateY(angleY).rotateZ(angleZ)
If
Q
isthis
quaternion andR
the quaternion representing the specified rotation, then the new quaternion will beQ * R
. So when transforming a vectorv
with the new quaternion by usingQ * R * v
, the rotation added by this method will be applied first! Parameters:
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 axisdest
 will hold the result Returns:
 dest

rotateZYX
Quaterniond rotateZYX(double angleZ, double angleY, double angleX, Quaterniond dest)
Apply a rotation tothis
quaternion rotating the given radians about the cartesian base unit axes, called the euler angles, using the rotation sequenceZYX
and store the result indest
.This method is equivalent to calling:
rotateZ(angleZ, dest).rotateY(angleY).rotateX(angleX)
If
Q
isthis
quaternion andR
the quaternion representing the specified rotation, then the new quaternion will beQ * R
. So when transforming a vectorv
with the new quaternion by usingQ * R * v
, the rotation added by this method will be applied first! Parameters:
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 axisdest
 will hold the result Returns:
 dest

rotateYXZ
Quaterniond rotateYXZ(double angleY, double angleX, double angleZ, Quaterniond dest)
Apply a rotation tothis
quaternion rotating the given radians about the cartesian base unit axes, called the euler angles, using the rotation sequenceYXZ
and store the result indest
.This method is equivalent to calling:
rotateY(angleY, dest).rotateX(angleX).rotateZ(angleZ)
If
Q
isthis
quaternion andR
the quaternion representing the specified rotation, then the new quaternion will beQ * R
. So when transforming a vectorv
with the new quaternion by usingQ * R * v
, the rotation added by this method will be applied first! Parameters:
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 axisdest
 will hold the result Returns:
 dest

getEulerAnglesXYZ
Vector3d getEulerAnglesXYZ(Vector3d eulerAngles)
Get the euler angles in radians in rotation sequenceXYZ
of this quaternion and store them in the provided parametereulerAngles
. Parameters:
eulerAngles
 will hold the euler angles in radians Returns:
 the passed in vector

rotateAxis
Quaterniond rotateAxis(double angle, double axisX, double axisY, double axisZ, Quaterniond dest)
Apply a rotation tothis
quaternion rotating the given radians about the specified axis and store the result indest
.If
Q
isthis
quaternion andR
the quaternion representing the specified rotation, then the new quaternion will beQ * R
. So when transforming a vectorv
with the new quaternion by usingQ * R * v
, the rotation added by this method will be applied first! Parameters:
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 axisdest
 will hold the result Returns:
 dest

rotateAxis
Quaterniond rotateAxis(double angle, Vector3dc axis, Quaterniond dest)
Apply a rotation tothis
quaternion rotating the given radians about the specified axis and store the result indest
.If
Q
isthis
quaternion andR
the quaternion representing the specified rotation, then the new quaternion will beQ * R
. So when transforming a vectorv
with the new quaternion by usingQ * R * v
, the rotation added by this method will be applied first! Parameters:
angle
 the angle in radians to rotate about the specified axisaxis
 the rotation axisdest
 will hold the result Returns:
 dest
 See Also:
rotateAxis(double, double, double, double, Quaterniond)

positiveX
Vector3d positiveX(Vector3d dir)
Obtain the direction of+X
before the rotation transformation represented bythis
quaternion is applied.This method is equivalent to the following code:
Quaterniond inv = new Quaterniond(this).invert(); inv.transform(dir.set(1, 0, 0));
 Parameters:
dir
 will hold the direction of+X
 Returns:
 dir

normalizedPositiveX
Vector3d normalizedPositiveX(Vector3d dir)
Obtain the direction of+X
before the rotation transformation represented bythis
normalized quaternion is applied. The quaternion must benormalized
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));
 Parameters:
dir
 will hold the direction of+X
 Returns:
 dir

positiveY
Vector3d positiveY(Vector3d dir)
Obtain the direction of+Y
before the rotation transformation represented bythis
quaternion is applied.This method is equivalent to the following code:
Quaterniond inv = new Quaterniond(this).invert(); inv.transform(dir.set(0, 1, 0));
 Parameters:
dir
 will hold the direction of+Y
 Returns:
 dir

normalizedPositiveY
Vector3d normalizedPositiveY(Vector3d dir)
Obtain the direction of+Y
before the rotation transformation represented bythis
normalized quaternion is applied. The quaternion must benormalized
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));
 Parameters:
dir
 will hold the direction of+Y
 Returns:
 dir

positiveZ
Vector3d positiveZ(Vector3d dir)
Obtain the direction of+Z
before the rotation transformation represented bythis
quaternion is applied.This method is equivalent to the following code:
Quaterniond inv = new Quaterniond(this).invert(); inv.transform(dir.set(0, 0, 1));
 Parameters:
dir
 will hold the direction of+Z
 Returns:
 dir

normalizedPositiveZ
Vector3d normalizedPositiveZ(Vector3d dir)
Obtain the direction of+Z
before the rotation transformation represented bythis
normalized quaternion is applied. The quaternion must benormalized
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));
 Parameters:
dir
 will hold the direction of+Z
 Returns:
 dir

