Class Quaterniond
- java.lang.Object
-
- org.joml.Quaterniond
-
- All Implemented Interfaces:
java.io.Externalizable,java.io.Serializable,java.lang.Cloneable,Quaterniondc
public class Quaterniond extends java.lang.Object implements java.io.Externalizable, java.lang.Cloneable, Quaterniondc
Quaternion of 4 double-precision floats which can represent rotation and uniform scaling.- Author:
- Richard Greenlees, Kai Burjack
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Quaterniond()Create a newQuaterniondand initialize it with(x=0, y=0, z=0, w=1), where(x, y, z)is the vector part of the quaternion andwis the real/scalar part.Quaterniond(double x, double y, double z, double w)Create a newQuaterniondand initialize its components to the given values.Quaterniond(AxisAngle4d axisAngle)Create a newQuaterniondand initialize it to represent the same rotation as the givenAxisAngle4d.Quaterniond(AxisAngle4f axisAngle)Create a newQuaterniondand initialize it to represent the same rotation as the givenAxisAngle4f.Quaterniond(Quaterniondc source)Create a newQuaterniondand initialize its components to the same values as the givenQuaterniondc.Quaterniond(Quaternionfc source)Create a newQuaterniondand initialize its components to the same values as the givenQuaternionfc.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Quaterniondadd(double x, double y, double z, double w)Add the quaternion(x, y, z, w)to this quaternion.Quaterniondadd(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.Quaterniondadd(Quaterniondc q2)Addq2to this quaternion.Quaterniondadd(Quaterniondc q2, Quaterniond dest)Addq2to this quaternion and store the result indest.doubleangle()Return the angle in radians represented by this normalized quaternion rotation.java.lang.Objectclone()Quaterniondconjugate()Conjugate this quaternion.Quaterniondconjugate(Quaterniond dest)Conjugate this quaternion and store the result indest.QuaterniondconjugateBy(Quaterniondc q)Conjugatethisby the given quaternionqby computingq * this * q^-1.QuaterniondconjugateBy(Quaterniondc q, Quaterniond dest)Conjugatethisby the given quaternionqby computingq * this * q^-1and store the result intodest.Quaternionddifference(Quaterniondc other)Compute the difference betweenthisand theotherquaternion and store the result inthis.Quaternionddifference(Quaterniondc other, Quaterniond dest)Compute the difference betweenthisand theotherquaternion and store the result indest.Quaternionddiv(Quaterniondc b)Dividethisquaternion byb.Quaternionddiv(Quaterniondc b, Quaterniond dest)Dividethisquaternion byband store the result indest.doubledot(Quaterniondc otherQuat)Return the dot product of thisQuaterniondandotherQuat.booleanequals(double x, double y, double z, double w)booleanequals(java.lang.Object obj)booleanequals(Quaterniondc q, double delta)Compare the quaternion components ofthisquaternion with the given quaternion using the givendeltaand return whether all of them are equal within a maximum difference ofdelta.QuaterniondfromAxisAngleDeg(double axisX, double axisY, double axisZ, double angle)Set this quaternion to be a representation of the supplied axis and angle (in degrees).QuaterniondfromAxisAngleDeg(Vector3dc axis, double angle)Set this quaternion to be a representation of the supplied axis and angle (in degrees).QuaterniondfromAxisAngleRad(double axisX, double axisY, double axisZ, double angle)Set this quaternion to be a representation of the supplied axis and angle (in radians).QuaterniondfromAxisAngleRad(Vector3dc axis, double angle)Set this quaternion to be a representation of the supplied axis and angle (in radians).AxisAngle4dget(AxisAngle4d dest)Set the givenAxisAngle4dto represent the rotation ofthisquaternion.AxisAngle4fget(AxisAngle4f dest)Set the givenAxisAngle4fto represent the rotation ofthisquaternion.Matrix3dget(Matrix3d dest)Set the given destination matrix to the rotation represented bythis.Matrix3fget(Matrix3f dest)Set the given destination matrix to the rotation represented bythis.Matrix4dget(Matrix4d dest)Set the given destination matrix to the rotation represented bythis.Matrix4fget(Matrix4f dest)Set the given destination matrix to the rotation represented bythis.Quaterniondget(Quaterniond dest)Set the givenQuaterniondto the values ofthis.Quaternionfget(Quaternionf dest)Set the givenQuaternionfto the values ofthis.Vector3dgetEulerAnglesXYZ(Vector3d eulerAngles)Get the euler angles in radians in rotation sequenceXYZof this quaternion and store them in the provided parametereulerAngles.Vector3dgetEulerAnglesYXZ(Vector3d eulerAngles)Get the euler angles in radians in rotation sequenceYXZof this quaternion and store them in the provided parametereulerAngles.Vector3dgetEulerAnglesZXY(Vector3d eulerAngles)Get the euler angles in radians in rotation sequenceZXYof this quaternion and store them in the provided parametereulerAngles.Vector3dgetEulerAnglesZYX(Vector3d eulerAngles)Get the euler angles in radians in rotation sequenceZYXof this quaternion and store them in the provided parametereulerAngles.inthashCode()Quaterniondidentity()Set this quaternion to the identity.Quaterniondintegrate(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 deltadtand add the differentiate rotation to the rotation represented by this quaternion.Quaterniondintegrate(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 deltadtand add the differentiate rotation to the rotation represented by this quaternion and store the result intodest.Quaterniondinvert()Invert this quaternion andnormalizeit.Quaterniondinvert(Quaterniond dest)Invert this quaternion and store thenormalizedresult indest.booleanisFinite()Determine whether all components are finite floating-point values, that is, they are notNaNand notinfinity.doublelengthSquared()Return the square of the length of this quaternion.QuaterniondlookAlong(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.QuaterniondlookAlong(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.QuaterniondlookAlong(Vector3dc dir, Vector3dc up)Apply a rotation to this quaternion that maps the given direction to the positive Z axis.QuaterniondlookAlong(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.Quaterniondmul(double f)Multiply this quaternion by the given scalar.Quaterniondmul(double qx, double qy, double qz, double qw)Multiply this quaternion by the quaternion represented via(qx, qy, qz, qw).Quaterniondmul(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.Quaterniondmul(double f, Quaterniond dest)Multiply this quaternion by the given scalar and store the result indest.Quaterniondmul(Quaterniondc q)Multiply this quaternion byq.Quaterniondmul(Quaterniondc q, Quaterniond dest)Multiply this quaternion byqand store the result indest.static Quaterniondcnlerp(Quaterniond[] qs, double[] weights, Quaterniond dest)Interpolate between all of the quaternions given inqsvia non-spherical linear interpolation using the specified interpolation factorsweights, and store the result indest.Quaterniondnlerp(Quaterniondc q, double factor)Compute a linear (non-spherical) interpolation ofthisand the given quaternionqand store the result inthis.Quaterniondnlerp(Quaterniondc q, double factor, Quaterniond dest)Compute a linear (non-spherical) interpolation ofthisand the given quaternionqand store the result indest.static QuaterniondnlerpIterative(Quaterniondc[] qs, double[] weights, double dotThreshold, Quaterniond dest)Interpolate between all of the quaternions given inqsvia iterative non-spherical linear interpolation using the specified interpolation factorsweights, and store the result indest.QuaterniondnlerpIterative(Quaterniondc q, double alpha, double dotThreshold)Compute linear (non-spherical) interpolations ofthisand the given quaternionqiteratively and store the result inthis.QuaterniondnlerpIterative(Quaterniondc q, double alpha, double dotThreshold, Quaterniond dest)Compute linear (non-spherical) interpolations ofthisand the given quaternionqiteratively and store the result indest.Quaterniondnormalize()Normalize this quaternion.Quaterniondnormalize(Quaterniond dest)Normalize this quaternion and store the result indest.Vector3dnormalizedPositiveX(Vector3d dir)Obtain the direction of+Xbefore the rotation transformation represented bythisnormalized quaternion is applied.Vector3dnormalizedPositiveY(Vector3d dir)Obtain the direction of+Ybefore the rotation transformation represented bythisnormalized quaternion is applied.Vector3dnormalizedPositiveZ(Vector3d dir)Obtain the direction of+Zbefore the rotation transformation represented bythisnormalized quaternion is applied.Vector3dpositiveX(Vector3d dir)Obtain the direction of+Xbefore the rotation transformation represented bythisquaternion is applied.Vector3dpositiveY(Vector3d dir)Obtain the direction of+Ybefore the rotation transformation represented bythisquaternion is applied.Vector3dpositiveZ(Vector3d dir)Obtain the direction of+Zbefore the rotation transformation represented bythisquaternion is applied.Quaterniondpremul(double qx, double qy, double qz, double qw)Pre-multiply this quaternion by the quaternion represented via(qx, qy, qz, qw).Quaterniondpremul(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 indest.Quaterniondpremul(Quaterniondc q)Pre-multiply this quaternion byq.Quaterniondpremul(Quaterniondc q, Quaterniond dest)Pre-multiply this quaternion byqand store the result indest.voidreadExternal(java.io.ObjectInput in)QuaterniondrotateAxis(double angle, double axisX, double axisY, double axisZ)Apply a rotation tothisquaternion rotating the given radians about the specified axis.QuaterniondrotateAxis(double angle, double axisX, double axisY, double axisZ, Quaterniond dest)Apply a rotation tothisquaternion rotating the given radians about the specified axis and store the result indest.QuaterniondrotateAxis(double angle, Vector3dc axis)Apply a rotation tothisquaternion rotating the given radians about the specified axis.QuaterniondrotateAxis(double angle, Vector3dc axis, Quaterniond dest)Apply a rotation tothisquaternion rotating the given radians about the specified axis and store the result indest.QuaterniondrotateLocalX(double angle)Apply a rotation tothisquaternion rotating the given radians about the local x axis.QuaterniondrotateLocalX(double angle, Quaterniond dest)Apply a rotation tothisquaternion rotating the given radians about the local x axis and store the result indest.QuaterniondrotateLocalY(double angle)Apply a rotation tothisquaternion rotating the given radians about the local y axis.QuaterniondrotateLocalY(double angle, Quaterniond dest)Apply a rotation tothisquaternion rotating the given radians about the local y axis and store the result indest.QuaterniondrotateLocalZ(double angle)Apply a rotation tothisquaternion rotating the given radians about the local z axis.QuaterniondrotateLocalZ(double angle, Quaterniond dest)Apply a rotation tothisquaternion rotating the given radians about the local z axis and store the result indest.QuaterniondrotateTo(double fromDirX, double fromDirY, double fromDirZ, double toDirX, double toDirY, double toDirZ)Apply a rotation tothisthat rotates thefromDirvector to point alongtoDir.QuaterniondrotateTo(double fromDirX, double fromDirY, double fromDirZ, double toDirX, double toDirY, double toDirZ, Quaterniond dest)Apply a rotation tothisthat rotates thefromDirvector to point alongtoDirand store the result indest.QuaterniondrotateTo(Vector3dc fromDir, Vector3dc toDir)Apply a rotation tothisthat rotates thefromDirvector to point alongtoDir.QuaterniondrotateTo(Vector3dc fromDir, Vector3dc toDir, Quaterniond dest)Apply a rotation tothisthat rotates thefromDirvector to point alongtoDirand store the result indest.QuaterniondrotateX(double angle)Apply a rotation tothisquaternion rotating the given radians about the x axis.QuaterniondrotateX(double angle, Quaterniond dest)Apply a rotation tothisquaternion rotating the given radians about the x axis and store the result indest.QuaterniondrotateXYZ(double angleX, double angleY, double angleZ)Apply a rotation tothisquaternion rotating the given radians about the cartesian base unit axes, called the euler angles using rotation sequenceXYZ.QuaterniondrotateXYZ(double angleX, double angleY, double angleZ, Quaterniond dest)Apply a rotation tothisquaternion rotating the given radians about the cartesian base unit axes, called the euler angles using rotation sequenceXYZand store the result indest.QuaterniondrotateY(double angle)Apply a rotation tothisquaternion rotating the given radians about the y axis.QuaterniondrotateY(double angle, Quaterniond dest)Apply a rotation tothisquaternion rotating the given radians about the y axis and store the result indest.QuaterniondrotateYXZ(double angleY, double angleX, double angleZ)Apply a rotation tothisquaternion rotating the given radians about the cartesian base unit axes, called the euler angles, using the rotation sequenceYXZ.QuaterniondrotateYXZ(double angleY, double angleX, double angleZ, Quaterniond dest)Apply a rotation tothisquaternion rotating the given radians about the cartesian base unit axes, called the euler angles, using the rotation sequenceYXZand store the result indest.QuaterniondrotateZ(double angle)Apply a rotation tothisquaternion rotating the given radians about the z axis.QuaterniondrotateZ(double angle, Quaterniond dest)Apply a rotation tothisquaternion rotating the given radians about the z axis and store the result indest.QuaterniondrotateZYX(double angleZ, double angleY, double angleX)Apply a rotation tothisquaternion rotating the given radians about the cartesian base unit axes, called the euler angles, using the rotation sequenceZYX.QuaterniondrotateZYX(double angleZ, double angleY, double angleX, Quaterniond dest)Apply a rotation tothisquaternion rotating the given radians about the cartesian base unit axes, called the euler angles, using the rotation sequenceZYXand store the result indest.QuaterniondrotationAxis(double angle, double axisX, double axisY, double axisZ)Set this quaternion to a rotation of the given angle in radians about the supplied axis.QuaterniondrotationAxis(AxisAngle4f axisAngle)Set thisQuaterniondto a rotation of the given angle in radians about the supplied axis, all of which are specified via theAxisAngle4f.QuaterniondrotationTo(double fromDirX, double fromDirY, double fromDirZ, double toDirX, double toDirY, double toDirZ)Setthisquaternion to a rotation that rotates thefromDirvector to point alongtoDir.QuaterniondrotationTo(Vector3dc fromDir, Vector3dc toDir)Setthisquaternion to a rotation that rotates thefromDirvector to point alongtoDir.QuaterniondrotationX(double angle)Set this quaternion to represent a rotation of the given radians about the x axis.QuaterniondrotationXYZ(double angleX, double angleY, double angleZ)Set this quaternion from the supplied euler angles (in radians) with rotation order XYZ.QuaterniondrotationY(double angle)Set this quaternion to represent a rotation of the given radians about the y axis.QuaterniondrotationYXZ(double angleY, double angleX, double angleZ)Set this quaternion from the supplied euler angles (in radians) with rotation order YXZ.QuaterniondrotationZ(double angle)Set this quaternion to represent a rotation of the given radians about the z axis.QuaterniondrotationZYX(double angleZ, double angleY, double angleX)Set this quaternion from the supplied euler angles (in radians) with rotation order ZYX.Quaterniondscale(double factor)Apply scaling to this quaternion, which results in any vector transformed by this quaternion to change its length by the givenfactor.Quaterniondscale(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.Quaterniondscaling(double factor)Set this quaternion to represent scaling, which results in a transformed vector to change its length by the givenfactor.Quaterniondset(double x, double y, double z, double w)Set this quaternion to the new values.Quaterniondset(AxisAngle4d axisAngle)Set thisQuaterniondto be equivalent to the givenAxisAngle4d.Quaterniondset(AxisAngle4f axisAngle)Set thisQuaterniondto be equivalent to the givenAxisAngle4f.Quaterniondset(Quaterniondc q)Set this quaternion to be a copy of q.Quaterniondset(Quaternionfc q)Set this quaternion to be a copy of q.QuaterniondsetAngleAxis(double angle, double x, double y, double z)Set this quaternion to a rotation equivalent to the supplied axis and angle (in radians).QuaterniondsetAngleAxis(double angle, Vector3dc axis)Set this quaternion to be a representation of the supplied axis and angle (in radians).QuaterniondsetFromNormalized(Matrix3dc mat)Set this quaternion to be a representation of the rotational component of the given matrix.QuaterniondsetFromNormalized(Matrix3fc mat)Set this quaternion to be a representation of the rotational component of the given matrix.QuaterniondsetFromNormalized(Matrix4dc mat)Set this quaternion to be a representation of the rotational component of the given matrix.QuaterniondsetFromNormalized(Matrix4fc mat)Set this quaternion to be a representation of the rotational component of the given matrix.QuaterniondsetFromNormalized(Matrix4x3dc mat)Set this quaternion to be a representation of the rotational component of the given matrix.QuaterniondsetFromNormalized(Matrix4x3fc mat)Set this quaternion to be a representation of the rotational component of the given matrix.QuaterniondsetFromUnnormalized(Matrix3dc mat)Set this quaternion to be a representation of the rotational component of the given matrix.QuaterniondsetFromUnnormalized(Matrix3fc mat)Set this quaternion to be a representation of the rotational component of the given matrix.QuaterniondsetFromUnnormalized(Matrix4dc mat)Set this quaternion to be a representation of the rotational component of the given matrix.QuaterniondsetFromUnnormalized(Matrix4fc mat)Set this quaternion to be a representation of the rotational component of the given matrix.QuaterniondsetFromUnnormalized(Matrix4x3dc mat)Set this quaternion to be a representation of the rotational component of the given matrix.QuaterniondsetFromUnnormalized(Matrix4x3fc mat)Set this quaternion to be a representation of the rotational component of the given matrix.static Quaterniondcslerp(Quaterniond[] qs, double[] weights, Quaterniond dest)Interpolate between all of the quaternions given inqsvia spherical linear interpolation using the specified interpolation factorsweights, and store the result indest.Quaterniondslerp(Quaterniondc target, double alpha)Quaterniondslerp(Quaterniondc target, double alpha, Quaterniond dest)java.lang.StringtoString()Return a string representation of this quaternion.java.lang.StringtoString(java.text.NumberFormat formatter)Return a string representation of this quaternion by formatting the components with the givenNumberFormat.Vector3dtransform(double x, double y, double z, Vector3d dest)Transform the given vector(x, y, z)by this quaternion and store the result indest.Vector3ftransform(double x, double y, double z, Vector3f dest)Transform the given vector(x, y, z)by this quaternion and store the result indest.Vector4dtransform(double x, double y, double z, Vector4d dest)Transform the given vector(x, y, z)by this quaternion and store the result indest.Vector4ftransform(double x, double y, double z, Vector4f dest)Transform the given vector(x, y, z)by this quaternion and store the result indest.Vector3dtransform(Vector3d vec)Transform the given vector by this quaternion.Vector3dtransform(Vector3dc vec, Vector3d dest)Transform the given vector by this quaternion and store the result indest.Vector3ftransform(Vector3f vec)Transform the given vector by this quaternion.Vector3ftransform(Vector3fc vec, Vector3f dest)Transform the given vector by this quaternion and store the result indest.Vector4dtransform(Vector4d vec)Transform the given vector by this quaternion.Vector4dtransform(Vector4dc vec, Vector4d dest)Transform the given vector by this quaternion and store the result indest.Vector4ftransform(Vector4f vec)Transform the given vector by this quaternion.Vector4ftransform(Vector4fc vec, Vector4f dest)Transform the given vector by this quaternion and store the result indest.Vector3dtransformInverse(double x, double y, double z, Vector3d dest)Transform the given vector(x, y, z)by the inverse of this quaternion and store the result indest.Vector3ftransformInverse(double x, double y, double z, Vector3f dest)Transform the given vector(x, y, z)by the inverse of this quaternion and store the result indest.Vector4dtransformInverse(double x, double y, double z, Vector4d dest)Transform the given vector(x, y, z)by the inverse of this quaternion and store the result indest.Vector4ftransformInverse(double x, double y, double z, Vector4f dest)Transform the given vector(x, y, z)by the inverse of this quaternion and store the result indest.Vector3dtransformInverse(Vector3d vec)Transform the given vector by the inverse of this quaternion.Vector3dtransformInverse(Vector3dc vec, Vector3d dest)Transform the given vector by the inverse of this quaternion and store the result indest.Vector3ftransformInverse(Vector3f vec)Transform the given vector by the inverse of this quaternion.Vector3ftransformInverse(Vector3fc vec, Vector3f dest)Transform the given vector by the inverse of this quaternion and store the result indest.Vector4dtransformInverse(Vector4d vec)Transform the given vector by the inverse of this quaternion.Vector4dtransformInverse(Vector4dc vec, Vector4d dest)Transform the given vector by the inverse of this quaternion and store the result indest.Vector4ftransformInverse(Vector4f vec)Transform the given vector by the inverse of this quaternion.Vector4ftransformInverse(Vector4fc vec, Vector4f dest)Transform the given vector by the inverse of this quaternion and store the result indest.Vector3dtransformInverseUnit(double x, double y, double z, Vector3d dest)Transform the given vector(x, y, z)by the inverse of this unit quaternion and store the result indest.Vector3ftransformInverseUnit(double x, double y, double z, Vector3f dest)Transform the given vector(x, y, z)by the inverse of this unit quaternion and store the result indest.Vector4dtransformInverseUnit(double x, double y, double z, Vector4d dest)Transform the given vector(x, y, z)by the inverse of this unit quaternion and store the result indest.Vector4ftransformInverseUnit(double x, double y, double z, Vector4f dest)Transform the given vector(x, y, z)by the inverse of this unit quaternion and store the result indest.Vector3dtransformInverseUnit(Vector3d vec)Transform the given vector by the inverse of this unit quaternion.Vector3dtransformInverseUnit(Vector3dc vec, Vector3d dest)Transform the given vector by the inverse of this unit quaternion and store the result indest.Vector3ftransformInverseUnit(Vector3f vec)Transform the given vector by the inverse of this unit quaternion.Vector3ftransformInverseUnit(Vector3fc vec, Vector3f dest)Transform the given vector by the inverse of this unit quaternion and store the result indest.Vector4dtransformInverseUnit(Vector4d vec)Transform the given vector by the inverse of this unit quaternion.Vector4dtransformInverseUnit(Vector4dc vec, Vector4d dest)Transform the given vector by the inverse of this unit quaternion and store the result indest.Vector4ftransformInverseUnit(Vector4f vec)Transform the given vector by the inverse of this unit quaternion.Vector4ftransformInverseUnit(Vector4fc vec, Vector4f dest)Transform the given vector by the inverse of this unit quaternion and store the result indest.Vector3dtransformPositiveX(Vector3d dest)Transform the vector(1, 0, 0)by this quaternion.Vector3ftransformPositiveX(Vector3f dest)Transform the vector(1, 0, 0)by this quaternion.Vector4dtransformPositiveX(Vector4d dest)Transform the vector(1, 0, 0)by this quaternion.Vector4ftransformPositiveX(Vector4f dest)Transform the vector(1, 0, 0)by this quaternion.Vector3dtransformPositiveY(Vector3d dest)Transform the vector(0, 1, 0)by this quaternion.Vector3ftransformPositiveY(Vector3f dest)Transform the vector(0, 1, 0)by this quaternion.Vector4dtransformPositiveY(Vector4d dest)Transform the vector(0, 1, 0)by this quaternion.Vector4ftransformPositiveY(Vector4f dest)Transform the vector(0, 1, 0)by this quaternion.Vector3dtransformPositiveZ(Vector3d dest)Transform the vector(0, 0, 1)by this quaternion.Vector3ftransformPositiveZ(Vector3f dest)Transform the vector(0, 0, 1)by this quaternion.Vector4dtransformPositiveZ(Vector4d dest)Transform the vector(0, 0, 1)by this quaternion.Vector4ftransformPositiveZ(Vector4f dest)Transform the vector(0, 0, 1)by this quaternion.Vector3dtransformUnit(double x, double y, double z, Vector3d dest)Transform the given vector(x, y, z)by this unit quaternion and store the result indest.Vector3ftransformUnit(double x, double y, double z, Vector3f dest)Transform the given vector(x, y, z)by this unit quaternion and store the result indest.Vector4dtransformUnit(double x, double y, double z, Vector4d dest)Transform the given vector(x, y, z)by this unit quaternion and store the result indest.Vector4ftransformUnit(double x, double y, double z, Vector4f dest)Transform the given vector(x, y, z)by this unit quaternion and store the result indest.Vector3dtransformUnit(Vector3d vec)Transform the given vector by this unit quaternion.Vector3dtransformUnit(Vector3dc vec, Vector3d dest)Transform the given vector by this unit quaternion and store the result indest.Vector3ftransformUnit(Vector3f vec)Transform the given vector by this unit quaternion.Vector3ftransformUnit(Vector3fc vec, Vector3f dest)Transform the given vector by this unit quaternion and store the result indest.Vector4dtransformUnit(Vector4d vec)Transform the given vector by this unit quaternion.Vector4dtransformUnit(Vector4dc vec, Vector4d dest)Transform the given vector by this unit quaternion and store the result indest.Vector4ftransformUnit(Vector4f vec)Transform the given vector by this unit quaternion.Vector4ftransformUnit(Vector4fc vec, Vector4f dest)Transform the given vector by this unit quaternion and store the result indest.Vector3dtransformUnitPositiveX(Vector3d dest)Transform the vector(1, 0, 0)by this unit quaternion.Vector3ftransformUnitPositiveX(Vector3f dest)Transform the vector(1, 0, 0)by this unit quaternion.Vector4dtransformUnitPositiveX(Vector4d dest)Transform the vector(1, 0, 0)by this unit quaternion.Vector4ftransformUnitPositiveX(Vector4f dest)Transform the vector(1, 0, 0)by this unit quaternion.Vector3dtransformUnitPositiveY(Vector3d dest)Transform the vector(0, 1, 0)by this unit quaternion.Vector3ftransformUnitPositiveY(Vector3f dest)Transform the vector(0, 1, 0)by this unit quaternion.Vector4dtransformUnitPositiveY(Vector4d dest)Transform the vector(0, 1, 0)by this unit quaternion.Vector4ftransformUnitPositiveY(Vector4f dest)Transform the vector(0, 1, 0)by this unit quaternion.Vector3dtransformUnitPositiveZ(Vector3d dest)Transform the vector(0, 0, 1)by this unit quaternion.Vector3ftransformUnitPositiveZ(Vector3f dest)Transform the vector(0, 0, 1)by this unit quaternion.Vector4dtransformUnitPositiveZ(Vector4d dest)Transform the vector(0, 0, 1)by this unit quaternion.Vector4ftransformUnitPositiveZ(Vector4f dest)Transform the vector(0, 0, 1)by this unit quaternion.doublew()voidwriteExternal(java.io.ObjectOutput out)doublex()doubley()doublez()
-
-
-
Constructor Detail
-
Quaterniond
public Quaterniond()
Create a newQuaterniondand initialize it with(x=0, y=0, z=0, w=1), where(x, y, z)is the vector part of the quaternion andwis the real/scalar part.
-
Quaterniond
public Quaterniond(double x, double y, double z, double w)Create a newQuaterniondand initialize its components to the given values.- Parameters:
x- the first component of the imaginary party- the second component of the imaginary partz- the third component of the imaginary partw- the real part
-
Quaterniond
public Quaterniond(Quaterniondc source)
Create a newQuaterniondand initialize its components to the same values as the givenQuaterniondc.- Parameters:
source- theQuaterniondcto take the component values from
-
Quaterniond
public Quaterniond(Quaternionfc source)
Create a newQuaterniondand initialize its components to the same values as the givenQuaternionfc.- Parameters:
source- theQuaternionfcto take the component values from
-
Quaterniond
public Quaterniond(AxisAngle4f axisAngle)
Create a newQuaterniondand initialize it to represent the same rotation as the givenAxisAngle4f.- Parameters:
axisAngle- the axis-angle to initialize this quaternion with
-
Quaterniond
public Quaterniond(AxisAngle4d axisAngle)
Create a newQuaterniondand initialize it to represent the same rotation as the givenAxisAngle4d.- Parameters:
axisAngle- the axis-angle to initialize this quaternion with
-
-
Method Detail
-
x
public double x()
- Specified by:
xin interfaceQuaterniondc- Returns:
- the first component of the vector part
-
y
public double y()
- Specified by:
yin interfaceQuaterniondc- Returns:
- the second component of the vector part
-
z
public double z()
- Specified by:
zin interfaceQuaterniondc- Returns:
- the third component of the vector part
-
w
public double w()
- Specified by:
win interfaceQuaterniondc- Returns:
- the real/scalar part of the quaternion
-
normalize
public Quaterniond normalize()
Normalize this quaternion.- Returns:
- this
-
normalize
public Quaterniond normalize(Quaterniond dest)
Description copied from interface:QuaterniondcNormalize this quaternion and store the result indest.- Specified by:
normalizein interfaceQuaterniondc- Parameters:
dest- will hold the result- Returns:
- dest
-
add
public Quaterniond add(double x, double y, double z, double w)
Add the quaternion(x, y, z, w)to this quaternion.- 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 component- Returns:
- this
-
add
public Quaterniond add(double x, double y, double z, double w, Quaterniond dest)
Description copied from interface:QuaterniondcAdd the quaternion(x, y, z, w)to this quaternion and store the result indest.- Specified by:
addin interfaceQuaterniondc- 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
public Quaterniond add(Quaterniondc q2)
Addq2to this quaternion.- Parameters:
q2- the quaternion to add to this- Returns:
- this
-
add
public Quaterniond add(Quaterniondc q2, Quaterniond dest)
Description copied from interface:QuaterniondcAddq2to this quaternion and store the result indest.- Specified by:
addin interfaceQuaterniondc- Parameters:
q2- the quaternion to add to thisdest- will hold the result- Returns:
- dest
-
dot
public double dot(Quaterniondc otherQuat)
Description copied from interface:QuaterniondcReturn the dot product of thisQuaterniondandotherQuat.- Specified by:
dotin interfaceQuaterniondc- Parameters:
otherQuat- the other quaternion- Returns:
- the dot product
-
angle
public double angle()
Description copied from interface:QuaterniondcReturn the angle in radians represented by this normalized quaternion rotation.This quaternion must be
normalized.- Specified by:
anglein interfaceQuaterniondc- Returns:
- the angle in radians
-
get
public Matrix3d get(Matrix3d dest)
Description copied from interface:QuaterniondcSet the given destination matrix to the rotation represented bythis.- Specified by:
getin interfaceQuaterniondc- Parameters:
dest- the matrix to write the rotation into- Returns:
- the passed in destination
- See Also:
Matrix3d.set(Quaterniondc)
-
get
public Matrix3f get(Matrix3f dest)
Description copied from interface:QuaterniondcSet the given destination matrix to the rotation represented bythis.- Specified by:
getin interfaceQuaterniondc- Parameters:
dest- the matrix to write the rotation into- Returns:
- the passed in destination
- See Also:
Matrix3f.set(Quaterniondc)
-
get
public Matrix4d get(Matrix4d dest)
Description copied from interface:QuaterniondcSet the given destination matrix to the rotation represented bythis.- Specified by:
getin interfaceQuaterniondc- Parameters:
dest- the matrix to write the rotation into- Returns:
- the passed in destination
- See Also:
Matrix4d.set(Quaterniondc)
-
get
public Matrix4f get(Matrix4f dest)
Description copied from interface:QuaterniondcSet the given destination matrix to the rotation represented bythis.- Specified by:
getin interfaceQuaterniondc- Parameters:
dest- the matrix to write the rotation into- Returns:
- the passed in destination
- See Also:
Matrix4f.set(Quaterniondc)
-
get
public AxisAngle4f get(AxisAngle4f dest)
Description copied from interface:QuaterniondcSet the givenAxisAngle4fto represent the rotation ofthisquaternion.- Specified by:
getin interfaceQuaterniondc- Parameters:
dest- theAxisAngle4fto set- Returns:
- the passed in destination
-
get
public AxisAngle4d get(AxisAngle4d dest)
Description copied from interface:QuaterniondcSet the givenAxisAngle4dto represent the rotation ofthisquaternion.- Specified by:
getin interfaceQuaterniondc- Parameters:
dest- theAxisAngle4dto set- Returns:
- the passed in destination
-
get
public Quaterniond get(Quaterniond dest)
Set the givenQuaterniondto the values ofthis.- Specified by:
getin interfaceQuaterniondc- Parameters:
dest- theQuaterniondto set- Returns:
- the passed in destination
- See Also:
set(Quaterniondc)
-
get
public Quaternionf get(Quaternionf dest)
Set the givenQuaternionfto the values ofthis.- Specified by:
getin interfaceQuaterniondc- Parameters:
dest- theQuaternionfto set- Returns:
- the passed in destination
- See Also:
set(Quaterniondc)
-
set
public Quaterniond set(double x, double y, double z, double w)
Set this quaternion to the new values.- Parameters:
x- the new value of xy- the new value of yz- the new value of zw- the new value of w- Returns:
- this
-
set
public Quaterniond set(Quaterniondc q)
Set this quaternion to be a copy of q.- Parameters:
q- theQuaterniondcto copy- Returns:
- this
-
set
public Quaterniond set(Quaternionfc q)
Set this quaternion to be a copy of q.- Parameters:
q- theQuaternionfcto copy- Returns:
- this
-
set
public Quaterniond set(AxisAngle4f axisAngle)
Set thisQuaterniondto be equivalent to the givenAxisAngle4f.- Parameters:
axisAngle- theAxisAngle4f- Returns:
- this
-
set
public Quaterniond set(AxisAngle4d axisAngle)
Set thisQuaterniondto be equivalent to the givenAxisAngle4d.- Parameters:
axisAngle- theAxisAngle4d- Returns:
- this
-
setAngleAxis
public 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).This method assumes that the given rotation axis
(x, y, z)is already normalized- Parameters:
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 axis- Returns:
- this
-
setAngleAxis
public Quaterniond setAngleAxis(double angle, Vector3dc axis)
Set this quaternion to be a representation of the supplied axis and angle (in radians).- Parameters:
angle- the angle in radiansaxis- the rotation axis- Returns:
- this
-
setFromUnnormalized
public Quaterniond setFromUnnormalized(Matrix4fc mat)
Set this quaternion to be a representation of the rotational component of the given matrix.This method assumes that the first three columns of the upper left 3x3 submatrix are no unit vectors.
- Parameters:
mat- the matrix whose rotational component is used to set this quaternion- Returns:
- this
-
setFromUnnormalized
public Quaterniond setFromUnnormalized(Matrix4x3fc mat)
Set this quaternion to be a representation of the rotational component of the given matrix.This method assumes that the first three columns of the upper left 3x3 submatrix are no unit vectors.
- Parameters:
mat- the matrix whose rotational component is used to set this quaternion- Returns:
- this
-
setFromUnnormalized
public Quaterniond setFromUnnormalized(Matrix4x3dc mat)
Set this quaternion to be a representation of the rotational component of the given matrix.This method assumes that the first three columns of the upper left 3x3 submatrix are no unit vectors.
- Parameters:
mat- the matrix whose rotational component is used to set this quaternion- Returns:
- this
-
setFromNormalized
public Quaterniond setFromNormalized(Matrix4fc mat)
Set this quaternion to be a representation of the rotational component of the given matrix.This method assumes that the first three columns of the upper left 3x3 submatrix are unit vectors.
- Parameters:
mat- the matrix whose rotational component is used to set this quaternion- Returns:
- this
-
setFromNormalized
public Quaterniond setFromNormalized(Matrix4x3fc mat)
Set this quaternion to be a representation of the rotational component of the given matrix.This method assumes that the first three columns of the upper left 3x3 submatrix are unit vectors.
- Parameters:
mat- the matrix whose rotational component is used to set this quaternion- Returns:
- this
-
setFromNormalized
public Quaterniond setFromNormalized(Matrix4x3dc mat)
Set this quaternion to be a representation of the rotational component of the given matrix.This method assumes that the first three columns of the upper left 3x3 submatrix are unit vectors.
- Parameters:
mat- the matrix whose rotational component is used to set this quaternion- Returns:
- this
-
setFromUnnormalized
public Quaterniond setFromUnnormalized(Matrix4dc mat)
Set this quaternion to be a representation of the rotational component of the given matrix.This method assumes that the first three columns of the upper left 3x3 submatrix are no unit vectors.
- Parameters:
mat- the matrix whose rotational component is used to set this quaternion- Returns:
- this
-
setFromNormalized
public Quaterniond setFromNormalized(Matrix4dc mat)
Set this quaternion to be a representation of the rotational component of the given matrix.This method assumes that the first three columns of the upper left 3x3 submatrix are unit vectors.
- Parameters:
mat- the matrix whose rotational component is used to set this quaternion- Returns:
- this
-
setFromUnnormalized
public Quaterniond setFromUnnormalized(Matrix3fc mat)
Set this quaternion to be a representation of the rotational component of the given matrix.This method assumes that the first three columns of the upper left 3x3 submatrix are no unit vectors.
- Parameters:
mat- the matrix whose rotational component is used to set this quaternion- Returns:
- this
-
setFromNormalized
public Quaterniond setFromNormalized(Matrix3fc mat)
Set this quaternion to be a representation of the rotational component of the given matrix.This method assumes that the first three columns of the upper left 3x3 submatrix are unit vectors.
- Parameters:
mat- the matrix whose rotational component is used to set this quaternion- Returns:
- this
-
setFromUnnormalized
public Quaterniond setFromUnnormalized(Matrix3dc mat)
Set this quaternion to be a representation of the rotational component of the given matrix.This method assumes that the first three columns of the upper left 3x3 submatrix are no unit vectors.
- Parameters:
mat- the matrix whose rotational component is used to set this quaternion- Returns:
- this
-
setFromNormalized
public Quaterniond setFromNormalized(Matrix3dc mat)
Set this quaternion to be a representation of the rotational component of the given matrix.- Parameters:
mat- the matrix whose rotational component is used to set this quaternion- Returns:
- this
-
fromAxisAngleRad
public Quaterniond fromAxisAngleRad(Vector3dc axis, double angle)
Set this quaternion to be a representation of the supplied axis and angle (in radians).- Parameters:
axis- the rotation axisangle- the angle in radians- Returns:
- this
-
fromAxisAngleRad
public 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).- Parameters:
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 radians- Returns:
- this
-
fromAxisAngleDeg
public Quaterniond fromAxisAngleDeg(Vector3dc axis, double angle)
Set this quaternion to be a representation of the supplied axis and angle (in degrees).- Parameters:
axis- the rotation axisangle- the angle in degrees- Returns:
- this
-
fromAxisAngleDeg
public 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).- Parameters:
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 radians- Returns:
- this
-
mul
public Quaterniond mul(Quaterniondc q)
Multiply this quaternion byq.If
TisthisandQis the given quaternion, then the resulting quaternionRis:R = T * QSo, this method uses post-multiplication like the matrix classes, resulting in a vector to be transformed by
Qfirst, and then byT.- Parameters:
q- the quaternion to multiplythisby- Returns:
- this
-
mul
public Quaterniond mul(Quaterniondc q, Quaterniond dest)
Description copied from interface:QuaterniondcMultiply this quaternion byqand store the result indest.If
TisthisandQis the given quaternion, then the resulting quaternionRis:R = T * QSo, this method uses post-multiplication like the matrix classes, resulting in a vector to be transformed by
Qfirst, and then byT.- Specified by:
mulin interfaceQuaterniondc- Parameters:
q- the quaternion to multiplythisbydest- will hold the result- Returns:
- dest
-
mul
public Quaterniond mul(double qx, double qy, double qz, double qw)
Multiply this quaternion by the quaternion represented via(qx, qy, qz, qw).If
TisthisandQis the given quaternion, then the resulting quaternionRis:R = T * QSo, this method uses post-multiplication like the matrix classes, resulting in a vector to be transformed by
Qfirst, and then byT.- Parameters:
qx- the x component of the quaternion to multiplythisbyqy- the y component of the quaternion to multiplythisbyqz- the z component of the quaternion to multiplythisbyqw- the w component of the quaternion to multiplythisby- Returns:
- this
-
mul
public Quaterniond mul(double qx, double qy, double qz, double qw, Quaterniond dest)
Description copied from interface:QuaterniondcMultiply this quaternion by the quaternion represented via(qx, qy, qz, qw)and store the result indest.If
TisthisandQis the given quaternion, then the resulting quaternionRis:R = T * QSo, this method uses post-multiplication like the matrix classes, resulting in a vector to be transformed by
Qfirst, and then byT.- Specified by:
mulin interfaceQuaterniondc- Parameters:
qx- the x component of the quaternion to multiplythisbyqy- the y component of the quaternion to multiplythisbyqz- the z component of the quaternion to multiplythisbyqw- the w component of the quaternion to multiplythisbydest- will hold the result- Returns:
- dest
-
mul
public Quaterniond mul(double f)
Multiply this quaternion by the given scalar.This method multiplies all of the four components by the specified scalar.
- Parameters:
f- the factor to multiply all components by- Returns:
- this
-
mul
public Quaterniond mul(double f, Quaterniond dest)
Description copied from interface:QuaterniondcMultiply this quaternion by the given scalar and store the result indest.This method multiplies all of the four components by the specified scalar.
- Specified by:
mulin interfaceQuaterniondc- Parameters:
f- the factor to multiply all components bydest- will hold the result- Returns:
- dest
-
premul
public Quaterniond premul(Quaterniondc q)
Pre-multiply this quaternion byq.If
TisthisandQis the given quaternion, then the resulting quaternionRis:R = Q * TSo, this method uses pre-multiplication, resulting in a vector to be transformed by
Tfirst, and then byQ.- Parameters:
q- the quaternion to pre-multiplythisby- Returns:
- this
-
premul
public Quaterniond premul(Quaterniondc q, Quaterniond dest)
Description copied from interface:QuaterniondcPre-multiply this quaternion byqand store the result indest.If
TisthisandQis the given quaternion, then the resulting quaternionRis:R = Q * TSo, this method uses pre-multiplication, resulting in a vector to be transformed by
Tfirst, and then byQ.- Specified by:
premulin interfaceQuaterniondc- Parameters:
q- the quaternion to pre-multiplythisbydest- will hold the result- Returns:
- dest
-
premul
public Quaterniond premul(double qx, double qy, double qz, double qw)
Pre-multiply this quaternion by the quaternion represented via(qx, qy, qz, qw).If
TisthisandQis the given quaternion, then the resulting quaternionRis:R = Q * TSo, this method uses pre-multiplication, resulting in a vector to be transformed by
Tfirst, and then byQ.- Parameters:
qx- the x component of the quaternion to multiplythisbyqy- the y component of the quaternion to multiplythisbyqz- the z component of the quaternion to multiplythisbyqw- the w component of the quaternion to multiplythisby- Returns:
- this
-
premul
public Quaterniond premul(double qx, double qy, double qz, double qw, Quaterniond dest)
Description copied from interface:QuaterniondcPre-multiply this quaternion by the quaternion represented via(qx, qy, qz, qw)and store the result indest.If
TisthisandQis the given quaternion, then the resulting quaternionRis:R = Q * TSo, this method uses pre-multiplication, resulting in a vector to be transformed by
Tfirst, and then byQ.- Specified by:
premulin interfaceQuaterniondc- Parameters:
qx- the x component of the quaternion to multiplythisbyqy- the y component of the quaternion to multiplythisbyqz- the z component of the quaternion to multiplythisbyqw- the w component of the quaternion to multiplythisbydest- will hold the result- Returns:
- dest
-
transform
public Vector3d transform(Vector3d vec)
Description copied from interface:QuaterniondcTransform the given vector by this quaternion.This will apply the rotation described by this quaternion to the given vector.
- Specified by:
transformin interfaceQuaterniondc- Parameters:
vec- the vector to transform- Returns:
- vec
-
transformInverse
public Vector3d transformInverse(Vector3d vec)
Description copied from interface:QuaterniondcTransform the given vector by the inverse of this quaternion.This will apply the rotation described by this quaternion to the given vector.
- Specified by:
transformInversein interfaceQuaterniondc- Parameters:
vec- the vector to transform- Returns:
- vec
-
transformUnit
public Vector3d transformUnit(Vector3d vec)
Description copied from interface:QuaterniondcTransform the given vector by this unit quaternion.This will apply the rotation described by this quaternion to the given vector.
This method is only applicable when
thisis a unit quaternion.- Specified by:
transformUnitin interfaceQuaterniondc- Parameters:
vec- the vector to transform- Returns:
- vec
-
transformInverseUnit
public Vector3d transformInverseUnit(Vector3d vec)
Description copied from interface:QuaterniondcTransform the given vector by the inverse of this unit quaternion.This will apply the rotation described by this quaternion to the given vector.
This method is only applicable when
thisis a unit quaternion.- Specified by:
transformInverseUnitin interfaceQuaterniondc- Parameters:
vec- the vector to transform- Returns:
- vec
-
transformPositiveX
public Vector3d transformPositiveX(Vector3d dest)
Description copied from interface:QuaterniondcTransform the vector(1, 0, 0)by this quaternion.- Specified by:
transformPositiveXin interfaceQuaterniondc- Parameters:
dest- will hold the result- Returns:
- dest
-
transformPositiveX
public Vector4d transformPositiveX(Vector4d dest)
Description copied from interface:QuaterniondcTransform the vector(1, 0, 0)by this quaternion.Only the first three components of the given 4D vector are modified.
- Specified by:
transformPositiveXin interfaceQuaterniondc- Parameters:
dest- will hold the result- Returns:
- dest
-
transformUnitPositiveX
public Vector3d transformUnitPositiveX(Vector3d dest)
Description copied from interface:QuaterniondcTransform the vector(1, 0, 0)by this unit quaternion.This method is only applicable when
thisis a unit quaternion.Reference: https://de.mathworks.com/
- Specified by:
transformUnitPositiveXin interfaceQuaterniondc- Parameters:
dest- will hold the result- Returns:
- dest
-
transformUnitPositiveX
public Vector4d transformUnitPositiveX(Vector4d dest)
Description copied from interface:QuaterniondcTransform 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
thisis a unit quaternion.Reference: https://de.mathworks.com/
- Specified by:
transformUnitPositiveXin interfaceQuaterniondc- Parameters:
dest- will hold the result- Returns:
- dest
-
transformPositiveY
public Vector3d transformPositiveY(Vector3d dest)
Description copied from interface:QuaterniondcTransform the vector(0, 1, 0)by this quaternion.- Specified by:
transformPositiveYin interfaceQuaterniondc- Parameters:
dest- will hold the result- Returns:
- dest
-
transformPositiveY
public Vector4d transformPositiveY(Vector4d dest)
Description copied from interface:QuaterniondcTransform the vector(0, 1, 0)by this quaternion.Only the first three components of the given 4D vector are modified.
- Specified by:
transformPositiveYin interfaceQuaterniondc- Parameters:
dest- will hold the result- Returns:
- dest
-
transformUnitPositiveY
public Vector4d transformUnitPositiveY(Vector4d dest)
Description copied from interface:QuaterniondcTransform 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
thisis a unit quaternion.Reference: https://de.mathworks.com/
- Specified by:
transformUnitPositiveYin interfaceQuaterniondc- Parameters:
dest- will hold the result- Returns:
- dest
-
transformUnitPositiveY
public Vector3d transformUnitPositiveY(Vector3d dest)
Description copied from interface:QuaterniondcTransform the vector(0, 1, 0)by this unit quaternion.This method is only applicable when
thisis a unit quaternion.Reference: https://de.mathworks.com/
- Specified by:
transformUnitPositiveYin interfaceQuaterniondc- Parameters:
dest- will hold the result- Returns:
- dest
-
transformPositiveZ
public Vector3d transformPositiveZ(Vector3d dest)
Description copied from interface:QuaterniondcTransform the vector(0, 0, 1)by this quaternion.- Specified by:
transformPositiveZin interfaceQuaterniondc- Parameters:
dest- will hold the result- Returns:
- dest
-
transformPositiveZ
public Vector4d transformPositiveZ(Vector4d dest)
Description copied from interface:QuaterniondcTransform the vector(0, 0, 1)by this quaternion.Only the first three components of the given 4D vector are modified.
- Specified by:
transformPositiveZin interfaceQuaterniondc- Parameters:
dest- will hold the result- Returns:
- dest
-
transformUnitPositiveZ
public Vector4d transformUnitPositiveZ(Vector4d dest)
Description copied from interface:QuaterniondcTransform 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
thisis a unit quaternion.Reference: https://de.mathworks.com/
- Specified by:
transformUnitPositiveZin interfaceQuaterniondc- Parameters:
dest- will hold the result- Returns:
- dest
-
transformUnitPositiveZ
public Vector3d transformUnitPositiveZ(Vector3d dest)
Description copied from interface:QuaterniondcTransform the vector(0, 0, 1)by this unit quaternion.This method is only applicable when
thisis a unit quaternion.Reference: https://de.mathworks.com/
- Specified by:
transformUnitPositiveZin interfaceQuaterniondc- Parameters:
dest- will hold the result- Returns:
- dest
-
transform
public Vector4d transform(Vector4d vec)
Description copied from interface:QuaterniondcTransform 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.
- Specified by:
transformin interfaceQuaterniondc- Parameters:
vec- the vector to transform- Returns:
- vec
-
transformInverse
public Vector4d transformInverse(Vector4d vec)
Description copied from interface:QuaterniondcTransform the given vector by the inverse of 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.
- Specified by:
transformInversein interfaceQuaterniondc- Parameters:
vec- the vector to transform- Returns:
- vec
-
transform
public Vector3d transform(Vector3dc vec, Vector3d dest)
Description copied from interface:QuaterniondcTransform the given vector by this quaternion and store the result indest.This will apply the rotation described by this quaternion to the given vector.
- Specified by:
transformin interfaceQuaterniondc- Parameters:
vec- the vector to transformdest- will hold the result- Returns:
- dest
-
transformInverse
public Vector3d transformInverse(Vector3dc vec, Vector3d dest)
Description copied from interface:QuaterniondcTransform the given vector by the inverse of this quaternion and store the result indest.This will apply the rotation described by this quaternion to the given vector.
- Specified by:
transformInversein interfaceQuaterniondc- Parameters:
vec- the vector to transformdest- will hold the result- Returns:
- dest
-
transform
public Vector3d transform(double x, double y, double z, Vector3d dest)
Description copied from interface:QuaterniondcTransform 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.
- Specified by:
transformin interfaceQuaterniondc- 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
-
transformInverse
public Vector3d transformInverse(double x, double y, double z, Vector3d dest)
Description copied from interface:QuaterniondcTransform the given vector(x, y, z)by the inverse of this quaternion and store the result indest.This will apply the rotation described by this quaternion to the given vector.
- Specified by:
transformInversein interfaceQuaterniondc- 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
public Vector4d transform(Vector4dc vec, Vector4d dest)
Description copied from interface:QuaterniondcTransform 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.
- Specified by:
transformin interfaceQuaterniondc- Parameters:
vec- the vector to transformdest- will hold the result- Returns:
- dest
-
transformInverse
public Vector4d transformInverse(Vector4dc vec, Vector4d dest)
Description copied from interface:QuaterniondcTransform the given vector by the inverse of 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.
- Specified by:
transformInversein interfaceQuaterniondc- Parameters:
vec- the vector to transformdest- will hold the result- Returns:
- dest
-
transform
public Vector4d transform(double x, double y, double z, Vector4d dest)
Description copied from interface:QuaterniondcTransform 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.
- Specified by:
transformin interfaceQuaterniondc- 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
-
transformInverse
public Vector4d transformInverse(double x, double y, double z, Vector4d dest)
Description copied from interface:QuaterniondcTransform the given vector(x, y, z)by the inverse of this quaternion and store the result indest.This will apply the rotation described by this quaternion to the given vector.
- Specified by:
transformInversein interfaceQuaterniondc- 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
public Vector3f transform(Vector3f vec)
Description copied from interface:QuaterniondcTransform the given vector by this quaternion.This will apply the rotation described by this quaternion to the given vector.
- Specified by:
transformin interfaceQuaterniondc- Parameters:
vec- the vector to transform- Returns:
- vec
-
transformInverse
public Vector3f transformInverse(Vector3f vec)
Description copied from interface:QuaterniondcTransform the given vector by the inverse of this quaternion.This will apply the rotation described by this quaternion to the given vector.
- Specified by:
transformInversein interfaceQuaterniondc- Parameters:
vec- the vector to transform- Returns:
- vec
-
transformUnit
public Vector4d transformUnit(Vector4d vec)
Description copied from interface:QuaterniondcTransform the given vector by this unit 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.
This method is only applicable when
thisis a unit quaternion.- Specified by:
transformUnitin interfaceQuaterniondc- Parameters:
vec- the vector to transform- Returns:
- vec
-
transformInverseUnit
public Vector4d transformInverseUnit(Vector4d vec)
Description copied from interface:QuaterniondcTransform the given vector by the inverse of this unit 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.
This method is only applicable when
thisis a unit quaternion.- Specified by:
transformInverseUnitin interfaceQuaterniondc- Parameters:
vec- the vector to transform- Returns:
- vec
-
transformUnit
public Vector3d transformUnit(Vector3dc vec, Vector3d dest)
Description copied from interface:QuaterniondcTransform the given vector by this unit quaternion and store the result indest.This will apply the rotation described by this quaternion to the given vector.
This method is only applicable when
thisis a unit quaternion.- Specified by:
transformUnitin interfaceQuaterniondc- Parameters:
vec- the vector to transformdest- will hold the result- Returns:
- dest
-
transformInverseUnit
public Vector3d transformInverseUnit(Vector3dc vec, Vector3d dest)
Description copied from interface:QuaterniondcTransform the given vector by the inverse of this unit quaternion and store the result indest.This will apply the rotation described by this quaternion to the given vector.
This method is only applicable when
thisis a unit quaternion.- Specified by:
transformInverseUnitin interfaceQuaterniondc- Parameters:
vec- the vector to transformdest- will hold the result- Returns:
- dest
-
transformUnit
public Vector3d transformUnit(double x, double y, double z, Vector3d dest)
Description copied from interface:QuaterniondcTransform the given vector(x, y, z)by this unit quaternion and store the result indest.This will apply the rotation described by this quaternion to the given vector.
This method is only applicable when
thisis a unit quaternion.- Specified by:
transformUnitin interfaceQuaterniondc- 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
-
transformInverseUnit
public Vector3d transformInverseUnit(double x, double y, double z, Vector3d dest)
Description copied from interface:QuaterniondcTransform the given vector(x, y, z)by the inverse of this unit quaternion and store the result indest.This will apply the rotation described by this quaternion to the given vector.
This method is only applicable when
thisis a unit quaternion.- Specified by:
transformInverseUnitin interfaceQuaterniondc- 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
-
transformUnit
public Vector4d transformUnit(Vector4dc vec, Vector4d dest)
Description copied from interface:QuaterniondcTransform the given vector by this unit 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.
This method is only applicable when
thisis a unit quaternion.- Specified by:
transformUnitin interfaceQuaterniondc- Parameters:
vec- the vector to transformdest- will hold the result- Returns:
- dest
-
transformInverseUnit
public Vector4d transformInverseUnit(Vector4dc vec, Vector4d dest)
Description copied from interface:QuaterniondcTransform the given vector by the inverse of this unit 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.
This method is only applicable when
thisis a unit quaternion.- Specified by:
transformInverseUnitin interfaceQuaterniondc- Parameters:
vec- the vector to transformdest- will hold the result- Returns:
- dest
-
transformUnit
public Vector4d transformUnit(double x, double y, double z, Vector4d dest)
Description copied from interface:QuaterniondcTransform the given vector(x, y, z)by this unit quaternion and store the result indest.This will apply the rotation described by this quaternion to the given vector.
This method is only applicable when
thisis a unit quaternion.- Specified by:
transformUnitin interfaceQuaterniondc- 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
-
transformInverseUnit
public Vector4d transformInverseUnit(double x, double y, double z, Vector4d dest)
Description copied from interface:QuaterniondcTransform the given vector(x, y, z)by the inverse of this unit quaternion and store the result indest.This will apply the rotation described by this quaternion to the given vector.
This method is only applicable when
thisis a unit quaternion.- Specified by:
transformInverseUnitin interfaceQuaterniondc- 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
-
transformUnit
public Vector3f transformUnit(Vector3f vec)
Description copied from interface:QuaterniondcTransform the given vector by this unit quaternion.This will apply the rotation described by this quaternion to the given vector.
This method is only applicable when
thisis a unit quaternion.- Specified by:
transformUnitin interfaceQuaterniondc- Parameters:
vec- the vector to transform- Returns:
- vec
-
transformInverseUnit
public Vector3f transformInverseUnit(Vector3f vec)
Description copied from interface:QuaterniondcTransform the given vector by the inverse of this unit quaternion.This will apply the rotation described by this quaternion to the given vector.
This method is only applicable when
thisis a unit quaternion.- Specified by:
transformInverseUnitin interfaceQuaterniondc- Parameters:
vec- the vector to transform- Returns:
- vec
-
transformPositiveX
public Vector3f transformPositiveX(Vector3f dest)
Description copied from interface:QuaterniondcTransform the vector(1, 0, 0)by this quaternion.- Specified by:
transformPositiveXin interfaceQuaterniondc- Parameters:
dest- will hold the result- Returns:
- dest
-
transformPositiveX
public Vector4f transformPositiveX(Vector4f dest)
Description copied from interface:QuaterniondcTransform the vector(1, 0, 0)by this quaternion.Only the first three components of the given 4D vector are modified.
- Specified by:
transformPositiveXin interfaceQuaterniondc- Parameters:
dest- will hold the result- Returns:
- dest
-
transformUnitPositiveX
public Vector3f transformUnitPositiveX(Vector3f dest)
Description copied from interface:QuaterniondcTransform the vector(1, 0, 0)by this unit quaternion.This method is only applicable when
thisis a unit quaternion.Reference: https://de.mathworks.com/
- Specified by:
transformUnitPositiveXin interfaceQuaterniondc- Parameters:
dest- will hold the result- Returns:
- dest
-
transformUnitPositiveX
public Vector4f transformUnitPositiveX(Vector4f dest)
Description copied from interface:QuaterniondcTransform 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
thisis a unit quaternion.Reference: https://de.mathworks.com/
- Specified by:
transformUnitPositiveXin interfaceQuaterniondc- Parameters:
dest- will hold the result- Returns:
- dest
-
transformPositiveY
public Vector3f transformPositiveY(Vector3f dest)
Description copied from interface:QuaterniondcTransform the vector(0, 1, 0)by this quaternion.- Specified by:
transformPositiveYin interfaceQuaterniondc- Parameters:
dest- will hold the result- Returns:
- dest
-
transformPositiveY
public Vector4f transformPositiveY(Vector4f dest)
Description copied from interface:QuaterniondcTransform the vector(0, 1, 0)by this quaternion.Only the first three components of the given 4D vector are modified.
- Specified by:
transformPositiveYin interfaceQuaterniondc- Parameters:
dest- will hold the result- Returns:
- dest
-
transformUnitPositiveY
public Vector4f transformUnitPositiveY(Vector4f dest)
Description copied from interface:QuaterniondcTransform 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
thisis a unit quaternion.Reference: https://de.mathworks.com/
- Specified by:
transformUnitPositiveYin interfaceQuaterniondc- Parameters:
dest- will hold the result- Returns:
- dest
-
transformUnitPositiveY
public Vector3f transformUnitPositiveY(Vector3f dest)
Description copied from interface:QuaterniondcTransform the vector(0, 1, 0)by this unit quaternion.This method is only applicable when
thisis a unit quaternion.Reference: https://de.mathworks.com/
- Specified by:
transformUnitPositiveYin interfaceQuaterniondc- Parameters:
dest- will hold the result- Returns:
- dest
-
transformPositiveZ
public Vector3f transformPositiveZ(Vector3f dest)
Description copied from interface:QuaterniondcTransform the vector(0, 0, 1)by this quaternion.- Specified by:
transformPositiveZin interfaceQuaterniondc- Parameters:
dest- will hold the result- Returns:
- dest
-
transformPositiveZ
public Vector4f transformPositiveZ(Vector4f dest)
Description copied from interface:QuaterniondcTransform the vector(0, 0, 1)by this quaternion.Only the first three components of the given 4D vector are modified.
- Specified by:
transformPositiveZin interfaceQuaterniondc- Parameters:
dest- will hold the result- Returns:
- dest
-
transformUnitPositiveZ
public Vector4f transformUnitPositiveZ(Vector4f dest)
Description copied from interface:QuaterniondcTransform 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
thisis a unit quaternion.Reference: https://de.mathworks.com/
- Specified by:
transformUnitPositiveZin interfaceQuaterniondc- Parameters:
dest- will hold the result- Returns:
- dest
-
transformUnitPositiveZ
public Vector3f transformUnitPositiveZ(Vector3f dest)
Description copied from interface:QuaterniondcTransform the vector(0, 0, 1)by this unit quaternion.This method is only applicable when
thisis a unit quaternion.Reference: https://de.mathworks.com/
- Specified by:
transformUnitPositiveZin interfaceQuaterniondc- Parameters:
dest- will hold the result- Returns:
- dest
-
transform
public Vector4f transform(Vector4f vec)
Description copied from interface:QuaterniondcTransform 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.
- Specified by:
transformin interfaceQuaterniondc- Parameters:
vec- the vector to transform- Returns:
- vec
-
transformInverse
public Vector4f transformInverse(Vector4f vec)
Description copied from interface:QuaterniondcTransform the given vector by the inverse of 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.
- Specified by:
transformInversein interfaceQuaterniondc- Parameters:
vec- the vector to transform- Returns:
- vec
-
transform
public Vector3f transform(Vector3fc vec, Vector3f dest)
Description copied from interface:QuaterniondcTransform the given vector by this quaternion and store the result indest.This will apply the rotation described by this quaternion to the given vector.
- Specified by:
transformin interfaceQuaterniondc- Parameters:
vec- the vector to transformdest- will hold the result- Returns:
- dest
-
transformInverse
public Vector3f transformInverse(Vector3fc vec, Vector3f dest)
Description copied from interface:QuaterniondcTransform the given vector by the inverse of this quaternion and store the result indest.This will apply the rotation described by this quaternion to the given vector.
- Specified by:
transformInversein interfaceQuaterniondc- Parameters:
vec- the vector to transformdest- will hold the result- Returns:
- dest
-
transform
public Vector3f transform(double x, double y, double z, Vector3f dest)
Description copied from interface:QuaterniondcTransform 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.
- Specified by:
transformin interfaceQuaterniondc- 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
-
transformInverse
public Vector3f transformInverse(double x, double y, double z, Vector3f dest)
Description copied from interface:QuaterniondcTransform the given vector(x, y, z)by the inverse of this quaternion and store the result indest.This will apply the rotation described by this quaternion to the given vector.
- Specified by:
transformInversein interfaceQuaterniondc- 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
public Vector4f transform(Vector4fc vec, Vector4f dest)
Description copied from interface:QuaterniondcTransform 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.
- Specified by:
transformin interfaceQuaterniondc- Parameters:
vec- the vector to transformdest- will hold the result- Returns:
- dest
-
transformInverse
public Vector4f transformInverse(Vector4fc vec, Vector4f dest)
Description copied from interface:QuaterniondcTransform the given vector by the inverse of 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.
- Specified by:
transformInversein interfaceQuaterniondc- Parameters:
vec- the vector to transformdest- will hold the result- Returns:
- dest
-
transform
public Vector4f transform(double x, double y, double z, Vector4f dest)
Description copied from interface:QuaterniondcTransform 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.
- Specified by:
transformin interfaceQuaterniondc- 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
-
transformInverse
public Vector4f transformInverse(double x, double y, double z, Vector4f dest)
Description copied from interface:QuaterniondcTransform the given vector(x, y, z)by the inverse of this quaternion and store the result indest.This will apply the rotation described by this quaternion to the given vector.
- Specified by:
transformInversein interfaceQuaterniondc- 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
-
transformUnit
public Vector4f transformUnit(Vector4f vec)
Description copied from interface:QuaterniondcTransform the given vector by this unit 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.
This method is only applicable when
thisis a unit quaternion.- Specified by:
transformUnitin interfaceQuaterniondc- Parameters:
vec- the vector to transform- Returns:
- vec
-
transformInverseUnit
public Vector4f transformInverseUnit(Vector4f vec)
Description copied from interface:QuaterniondcTransform the given vector by the inverse of this unit 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.
This method is only applicable when
thisis a unit quaternion.- Specified by:
transformInverseUnitin interfaceQuaterniondc- Parameters:
vec- the vector to transform- Returns:
- vec
-
transformUnit
public Vector3f transformUnit(Vector3fc vec, Vector3f dest)
Description copied from interface:QuaterniondcTransform the given vector by this unit quaternion and store the result indest.This will apply the rotation described by this quaternion to the given vector.
This method is only applicable when
thisis a unit quaternion.- Specified by:
transformUnitin interfaceQuaterniondc- Parameters:
vec- the vector to transformdest- will hold the result- Returns:
- dest
-
transformInverseUnit
public Vector3f transformInverseUnit(Vector3fc vec, Vector3f dest)
Description copied from interface:QuaterniondcTransform the given vector by the inverse of this unit quaternion and store the result indest.This will apply the rotation described by this quaternion to the given vector.
This method is only applicable when
thisis a unit quaternion.- Specified by:
transformInverseUnitin interfaceQuaterniondc- Parameters:
vec- the vector to transformdest- will hold the result- Returns:
- dest
-
transformUnit
public Vector3f transformUnit(double x, double y, double z, Vector3f dest)
Description copied from interface:QuaterniondcTransform the given vector(x, y, z)by this unit quaternion and store the result indest.This will apply the rotation described by this quaternion to the given vector.
This method is only applicable when
thisis a unit quaternion.- Specified by:
transformUnitin interfaceQuaterniondc- 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
-
transformInverseUnit
public Vector3f transformInverseUnit(double x, double y, double z, Vector3f dest)
Description copied from interface:QuaterniondcTransform the given vector(x, y, z)by the inverse of this unit quaternion and store the result indest.This will apply the rotation described by this quaternion to the given vector.
This method is only applicable when
thisis a unit quaternion.- Specified by:
transformInverseUnitin interfaceQuaterniondc- 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
-
transformUnit
public Vector4f transformUnit(Vector4fc vec, Vector4f dest)
Description copied from interface:QuaterniondcTransform the given vector by this unit 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.
This method is only applicable when
thisis a unit quaternion.- Specified by:
transformUnitin interfaceQuaterniondc- Parameters:
vec- the vector to transformdest- will hold the result- Returns:
- dest
-
transformInverseUnit
public Vector4f transformInverseUnit(Vector4fc vec, Vector4f dest)
Description copied from interface:QuaterniondcTransform the given vector by the inverse of this unit 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.
This method is only applicable when
thisis a unit quaternion.- Specified by:
transformInverseUnitin interfaceQuaterniondc- Parameters:
vec- the vector to transformdest- will hold the result- Returns:
- dest
-
transformUnit
public Vector4f transformUnit(double x, double y, double z, Vector4f dest)
Description copied from interface:QuaterniondcTransform the given vector(x, y, z)by this unit quaternion and store the result indest.This will apply the rotation described by this quaternion to the given vector.
This method is only applicable when
thisis a unit quaternion.- Specified by:
transformUnitin interfaceQuaterniondc- 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
-
transformInverseUnit
public Vector4f transformInverseUnit(double x, double y, double z, Vector4f dest)
Description copied from interface:QuaterniondcTransform the given vector(x, y, z)by the inverse of this unit quaternion and store the result indest.This will apply the rotation described by this quaternion to the given vector.
This method is only applicable when
thisis a unit quaternion.- Specified by:
transformInverseUnitin interfaceQuaterniondc- 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
public Quaterniond invert(Quaterniond dest)
Description copied from interface:QuaterniondcInvert this quaternion and store thenormalizedresult indest.If this quaternion is already normalized, then
Quaterniondc.conjugate(Quaterniond)should be used instead.- Specified by:
invertin interfaceQuaterniondc- Parameters:
dest- will hold the result- Returns:
- dest
- See Also:
Quaterniondc.conjugate(Quaterniond)
-
invert
public Quaterniond invert()
Invert this quaternion andnormalizeit.If this quaternion is already normalized, then
conjugate()should be used instead.- Returns:
- this
- See Also:
conjugate()
-
div
public Quaterniond div(Quaterniondc b, Quaterniond dest)
Description copied from interface:QuaterniondcDividethisquaternion byband store the result indest.The division expressed using the inverse is performed in the following way:
dest = this * b^-1, whereb^-1is the inverse ofb.- Specified by:
divin interfaceQuaterniondc- Parameters:
b- theQuaterniondcto divide this bydest- will hold the result- Returns:
- dest
-
div
public Quaterniond div(Quaterniondc b)
Dividethisquaternion byb.The division expressed using the inverse is performed in the following way:
this = this * b^-1, whereb^-1is the inverse ofb.- Parameters:
b- theQuaterniondcto divide this by- Returns:
- this
-
conjugate
public Quaterniond conjugate()
Conjugate this quaternion.- Returns:
- this
-
conjugate
public Quaterniond conjugate(Quaterniond dest)
Description copied from interface:QuaterniondcConjugate this quaternion and store the result indest.- Specified by:
conjugatein interfaceQuaterniondc- Parameters:
dest- will hold the result- Returns:
- dest
-
identity
public Quaterniond identity()
Set this quaternion to the identity.- Returns:
- this
-
lengthSquared
public double lengthSquared()
Description copied from interface:QuaterniondcReturn the square of the length of this quaternion.- Specified by:
lengthSquaredin interfaceQuaterniondc- Returns:
- the length
-
rotationXYZ
public Quaterniond rotationXYZ(double angleX, double angleY, double angleZ)
Set this quaternion from the supplied euler angles (in radians) with rotation order XYZ.This method is equivalent to calling:
rotationX(angleX).rotateY(angleY).rotateZ(angleZ)Reference: this stackexchange answer
- Parameters:
angleX- the angle in radians to rotate about xangleY- the angle in radians to rotate about yangleZ- the angle in radians to rotate about z- Returns:
- this
-
rotationZYX
public Quaterniond rotationZYX(double angleZ, double angleY, double angleX)
Set this quaternion from the supplied euler angles (in radians) with rotation order ZYX.This method is equivalent to calling:
rotationZ(angleZ).rotateY(angleY).rotateX(angleX)Reference: this stackexchange answer
- Parameters:
angleX- the angle in radians to rotate about xangleY- the angle in radians to rotate about yangleZ- the angle in radians to rotate about z- Returns:
- this
-
rotationYXZ
public Quaterniond rotationYXZ(double angleY, double angleX, double angleZ)
Set this quaternion from the supplied euler angles (in radians) with rotation order YXZ.This method is equivalent to calling:
rotationY(angleY).rotateX(angleX).rotateZ(angleZ)Reference: https://en.wikipedia.org
- Parameters:
angleY- the angle in radians to rotate about yangleX- the angle in radians to rotate about xangleZ- the angle in radians to rotate about z- Returns:
- this
-
slerp
public Quaterniond slerp(Quaterniondc target, double alpha)
Interpolate betweenthisunitquaternion and the specifiedtargetunitquaternion using spherical linear interpolation using the specified interpolation factoralpha.This method resorts to non-spherical linear interpolation when the absolute dot product between
thisandtargetis below1E-6.- Parameters:
target- the target of the interpolation, which should be reached withalpha = 1.0alpha- the interpolation factor, within[0..1]- Returns:
- this
-
slerp
public Quaterniond slerp(Quaterniondc target, double alpha, Quaterniond dest)
Description copied from interface:QuaterniondcInterpolate betweenthisunitquaternion and the specifiedtargetunitquaternion using spherical linear interpolation using the specified interpolation factoralpha, and store the result indest.This method resorts to non-spherical linear interpolation when the absolute dot product between
thisandtargetis below1E-6.Reference: http://fabiensanglard.net
- Specified by:
slerpin interfaceQuaterniondc- Parameters:
target- the target of the interpolation, which should be reached withalpha = 1.0alpha- the interpolation factor, within[0..1]dest- will hold the result- Returns:
- dest
-
slerp
public static Quaterniondc slerp(Quaterniond[] qs, double[] weights, Quaterniond dest)
Interpolate between all of the quaternions given inqsvia spherical linear interpolation using the specified interpolation factorsweights, and store the result indest.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/
- Parameters:
qs- the quaternions to interpolate overweights- the weights of each individual quaternion inqsdest- will hold the result- Returns:
- dest
-
scale
public Quaterniond scale(double factor)
Apply scaling to this quaternion, which results in any vector transformed by this quaternion to change its length by the givenfactor.- Parameters:
factor- the scaling factor- Returns:
- this
-
scale
public Quaterniond scale(double factor, Quaterniond dest)
Description copied from interface:QuaterniondcApply 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.- Specified by:
scalein interfaceQuaterniondc- Parameters:
factor- the scaling factordest- will hold the result- Returns:
- dest
-
scaling
public Quaterniond scaling(double factor)
Set this quaternion to represent scaling, which results in a transformed vector to change its length by the givenfactor.- Parameters:
factor- the scaling factor- Returns:
- this
-
integrate
public 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 deltadtand add the differentiate rotation to the rotation represented by this quaternion.This method pre-multiplies the rotation given by
dtand(vx, vy, vz)bythis, so the angular velocities are always relative to the local coordinate system of the rotation represented bythisquaternion.This method is equivalent to calling:
rotateLocal(dt * vx, dt * vy, dt * vz)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 axis- Returns:
- this
-
integrate
public Quaterniond integrate(double dt, double vx, double vy, double vz, Quaterniond dest)
Description copied from interface:QuaterniondcIntegrate 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 deltadtand add the differentiate rotation to the rotation represented by this quaternion and store the result intodest.This method pre-multiplies the rotation given by
dtand(vx, vy, vz)bythis, so the angular velocities are always relative to the local coordinate system of the rotation represented bythisquaternion.This method is equivalent to calling:
rotateLocal(dt * vx, dt * vy, dt * vz, dest)Reference: http://physicsforgames.blogspot.de/
- Specified by:
integratein interfaceQuaterniondc- 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
public Quaterniond nlerp(Quaterniondc q, double factor)
Compute a linear (non-spherical) interpolation ofthisand the given quaternionqand store the result inthis.- Parameters:
q- the other quaternionfactor- the interpolation factor. It is between 0.0 and 1.0- Returns:
- this
-
nlerp
public Quaterniond nlerp(Quaterniondc q, double factor, Quaterniond dest)
Description copied from interface:QuaterniondcCompute a linear (non-spherical) interpolation ofthisand the given quaternionqand store the result indest.Reference: http://fabiensanglard.net
- Specified by:
nlerpin interfaceQuaterniondc- Parameters:
q- the other quaternionfactor- the interpolation factor. It is between 0.0 and 1.0dest- will hold the result- Returns:
- dest
-
nlerp
public static Quaterniondc nlerp(Quaterniond[] qs, double[] weights, Quaterniond dest)
Interpolate between all of the quaternions given inqsvia non-spherical linear interpolation using the specified interpolation factorsweights, and store the result indest.This method will interpolate between each two successive quaternions via
nlerp(Quaterniondc, double)using their relative interpolation weights.Reference: http://gamedev.stackexchange.com/
- Parameters:
qs- the quaternions to interpolate overweights- the weights of each individual quaternion inqsdest- will hold the result- Returns:
- dest
-
nlerpIterative
public Quaterniond nlerpIterative(Quaterniondc q, double alpha, double dotThreshold, Quaterniond dest)
Description copied from interface:QuaterniondcCompute linear (non-spherical) interpolations ofthisand the given quaternionqiteratively and store the result indest.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 betweenthisandqvia non-spherical linear interpolations as long as the absolute dot product ofthisandqis greater than the givendotThresholdparameter.Thanks to
@theagentdat http://www.java-gaming.org/ for providing the code.- Specified by:
nlerpIterativein interfaceQuaterniondc- Parameters:
q- the other quaternionalpha- the interpolation factor, between 0.0 and 1.0dotThreshold- the threshold for the dot product ofthisandqabove which this method performs another iteration of a small-step linear interpolationdest- will hold the result- Returns:
- dest
-
nlerpIterative
public Quaterniond nlerpIterative(Quaterniondc q, double alpha, double dotThreshold)
Compute linear (non-spherical) interpolations ofthisand the given quaternionqiteratively and store the result inthis.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 betweenthisandqvia non-spherical linear interpolations as long as the absolute dot product ofthisandqis greater than the givendotThresholdparameter.Thanks to
@theagentdat http://www.java-gaming.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 ofthisandqabove which this method performs another iteration of a small-step linear interpolation- Returns:
- this
-
nlerpIterative
public static Quaterniond nlerpIterative(Quaterniondc[] qs, double[] weights, double dotThreshold, Quaterniond dest)
Interpolate between all of the quaternions given inqsvia iterative non-spherical linear interpolation using the specified interpolation factorsweights, and store the result indest.This method will interpolate between each two successive quaternions via
nlerpIterative(Quaterniondc, double, double)using their relative interpolation weights.Reference: http://gamedev.stackexchange.com/
- Parameters:
qs- the quaternions to interpolate overweights- the weights of each individual quaternion inqsdotThreshold- the threshold for the dot product of each two interpolated quaternions above whichnlerpIterative(Quaterniondc, double, double)performs another iteration of a small-step linear interpolationdest- will hold the result- Returns:
- dest
-
lookAlong
public Quaterniond lookAlong(Vector3dc dir, Vector3dc up)
Apply a rotation to this quaternion that maps the given direction to the positive Z axis.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
upanddirvectors.If
Qisthisquaternion andRthe quaternion representing the specified rotation, then the new quaternion will beQ * R. So when transforming a vectorvwith 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 givendirandup- Returns:
- this
- See Also:
lookAlong(double, double, double, double, double, double, Quaterniond)
-
lookAlong
public Quaterniond lookAlong(Vector3dc dir, Vector3dc up, Quaterniond dest)
Description copied from interface:QuaterniondcApply 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
upanddirvectors.If
Qisthisquaternion andRthe quaternion representing the specified rotation, then the new quaternion will beQ * R. So when transforming a vectorvwith the new quaternion by usingQ * R * v, the rotation added by this method will be applied first!Reference: http://answers.unity3d.com
- Specified by:
lookAlongin interfaceQuaterniondc- 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 givendirandupdest- will hold the result- Returns:
- dest
- See Also:
Quaterniondc.lookAlong(double, double, double, double, double, double, Quaterniond)
-
lookAlong
public 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.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
upanddirvectors.If
Qisthisquaternion andRthe quaternion representing the specified rotation, then the new quaternion will beQ * R. So when transforming a vectorvwith 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 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 vector- Returns:
- this
- See Also:
lookAlong(double, double, double, double, double, double, Quaterniond)
-
lookAlong
public Quaterniond lookAlong(double dirX, double dirY, double dirZ, double upX, double upY, double upZ, Quaterniond dest)
Description copied from interface:QuaterniondcApply 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
upanddirvectors.If
Qisthisquaternion andRthe quaternion representing the specified rotation, then the new quaternion will beQ * R. So when transforming a vectorvwith the new quaternion by usingQ * R * v, the rotation added by this method will be applied first!Reference: http://answers.unity3d.com
- Specified by:
lookAlongin interfaceQuaterniondc- Parameters:
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 vectordest- will hold the result- Returns:
- dest
-
toString
public java.lang.String toString()
Return a string representation of this quaternion.This method creates a new
DecimalFormaton every invocation with the format string "0.000E0;-".- Overrides:
toStringin classjava.lang.Object- Returns:
- the string representation
-
toString
public java.lang.String toString(java.text.NumberFormat formatter)
Return a string representation of this quaternion by formatting the components with the givenNumberFormat.- Parameters:
formatter- theNumberFormatused to format the quaternion components with- Returns:
- the string representation
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException- Specified by:
writeExternalin interfacejava.io.Externalizable- Throws:
java.io.IOException
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException- Specified by:
readExternalin interfacejava.io.Externalizable- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
difference
public Quaterniond difference(Quaterniondc other)
Compute the difference betweenthisand theotherquaternion and store the result inthis.The difference is the rotation that has to be applied to get from
thisrotation toother. IfTisthis,QisotherandDis the computed difference, then the following equation holds:T * D = QIt is defined as:
D = T^-1 * Q, whereT^-1denotes theinverseofT.- Parameters:
other- the other quaternion- Returns:
- this
-
difference
public Quaterniond difference(Quaterniondc other, Quaterniond dest)
Description copied from interface:QuaterniondcCompute the difference betweenthisand theotherquaternion and store the result indest.The difference is the rotation that has to be applied to get from
thisrotation toother. IfTisthis,QisotherandDis the computed difference, then the following equation holds:T * D = QIt is defined as:
D = T^-1 * Q, whereT^-1denotes theinverseofT.- Specified by:
differencein interfaceQuaterniondc- Parameters:
other- the other quaterniondest- will hold the result- Returns:
- dest
-
rotationTo
public Quaterniond rotationTo(double fromDirX, double fromDirY, double fromDirZ, double toDirX, double toDirY, double toDirZ)
Setthisquaternion to a rotation that rotates thefromDirvector to point alongtoDir.Since there can be multiple possible rotations, this method chooses the one with the shortest arc.
Reference: stackoverflow.com
- Parameters:
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 to- Returns:
- this
-
rotationTo
public Quaterniond rotationTo(Vector3dc fromDir, Vector3dc toDir)
Setthisquaternion to a rotation that rotates thefromDirvector to point alongtoDir.Because there can be multiple possible rotations, this method chooses the one with the shortest arc.
- Parameters:
fromDir- the starting directiontoDir- the destination direction- Returns:
- this
- See Also:
rotationTo(double, double, double, double, double, double)
-
rotateTo
public Quaterniond rotateTo(double fromDirX, double fromDirY, double fromDirZ, double toDirX, double toDirY, double toDirZ, Quaterniond dest)
Description copied from interface:QuaterniondcApply a rotation tothisthat rotates thefromDirvector to point alongtoDirand store the result indest.Since there can be multiple possible rotations, this method chooses the one with the shortest arc.
If
Qisthisquaternion andRthe quaternion representing the specified rotation, then the new quaternion will beQ * R. So when transforming a vectorvwith the new quaternion by usingQ * R * v, the rotation added by this method will be applied first!Reference: stackoverflow.com
- Specified by:
rotateToin interfaceQuaterniondc- Parameters:
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 todest- will hold the result- Returns:
- dest
-
rotationAxis
public Quaterniond rotationAxis(AxisAngle4f axisAngle)
Set thisQuaterniondto a rotation of the given angle in radians about the supplied axis, all of which are specified via theAxisAngle4f.- Parameters:
axisAngle- theAxisAngle4fgiving the rotation angle in radians and the axis to rotate about- Returns:
- this
- See Also:
rotationAxis(double, double, double, double)
-
rotationAxis
public 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.- Parameters:
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 axis- Returns:
- this
-
rotationX
public Quaterniond rotationX(double angle)
Set this quaternion to represent a rotation of the given radians about the x axis.- Parameters:
angle- the angle in radians to rotate about the x axis- Returns:
- this
-
rotationY
public Quaterniond rotationY(double angle)
Set this quaternion to represent a rotation of the given radians about the y axis.- Parameters:
angle- the angle in radians to rotate about the y axis- Returns:
- this
-
rotationZ
public Quaterniond rotationZ(double angle)
Set this quaternion to represent a rotation of the given radians about the z axis.- Parameters:
angle- the angle in radians to rotate about the z axis- Returns:
- this
-
rotateTo
public Quaterniond rotateTo(double fromDirX, double fromDirY, double fromDirZ, double toDirX, double toDirY, double toDirZ)
Apply a rotation tothisthat rotates thefromDirvector to point alongtoDir.Since there can be multiple possible rotations, this method chooses the one with the shortest arc.
If
Qisthisquaternion andRthe quaternion representing the specified rotation, then the new quaternion will beQ * R. So when transforming a vectorvwith the new quaternion by usingQ * R * v, the rotation added by this method will be applied first!- Parameters:
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 to- Returns:
- this
- See Also:
rotateTo(double, double, double, double, double, double, Quaterniond)
-
rotateTo
public Quaterniond rotateTo(Vector3dc fromDir, Vector3dc toDir, Quaterniond dest)
Description copied from interface:QuaterniondcApply a rotation tothisthat rotates thefromDirvector to point alongtoDirand store the result indest.Because there can be multiple possible rotations, this method chooses the one with the shortest arc.
If
Qisthisquaternion andRthe quaternion representing the specified rotation, then the new quaternion will beQ * R. So when transforming a vectorvwith the new quaternion by usingQ * R * v, the rotation added by this method will be applied first!- Specified by:
rotateToin interfaceQuaterniondc- Parameters:
fromDir- the starting directiontoDir- the destination directiondest- will hold the result- Returns:
- dest
- See Also:
Quaterniondc.rotateTo(double, double, double, double, double, double, Quaterniond)
-
rotateTo
public Quaterniond rotateTo(Vector3dc fromDir, Vector3dc toDir)
Apply a rotation tothisthat rotates thefromDirvector to point alongtoDir.Because there can be multiple possible rotations, this method chooses the one with the shortest arc.
If
Qisthisquaternion andRthe quaternion representing the specified rotation, then the new quaternion will beQ * R. So when transforming a vectorvwith the new quaternion by usingQ * R * v, the rotation added by this method will be applied first!- Parameters:
fromDir- the starting directiontoDir- the destination direction- Returns:
- this
- See Also:
rotateTo(double, double, double, double, double, double, Quaterniond)
-
rotateX
public Quaterniond rotateX(double angle)
Apply a rotation tothisquaternion rotating the given radians about the x axis.If
Qisthisquaternion andRthe quaternion representing the specified rotation, then the new quaternion will beQ * R. So when transforming a vectorvwith 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 axis- Returns:
- this
-
rotateX
public Quaterniond rotateX(double angle, Quaterniond dest)
Description copied from interface:QuaterniondcApply a rotation tothisquaternion rotating the given radians about the x axis and store the result indest.If
Qisthisquaternion andRthe quaternion representing the specified rotation, then the new quaternion will beQ * R. So when transforming a vectorvwith the new quaternion by usingQ * R * v, the rotation added by this method will be applied first!- Specified by:
rotateXin interfaceQuaterniondc- Parameters:
angle- the angle in radians to rotate about the x axisdest- will hold the result- Returns:
- dest
-
rotateY
public Quaterniond rotateY(double angle)
Apply a rotation tothisquaternion rotating the given radians about the y axis.If
Qisthisquaternion andRthe quaternion representing the specified rotation, then the new quaternion will beQ * R. So when transforming a vectorvwith 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 axis- Returns:
- this
-
rotateY
public Quaterniond rotateY(double angle, Quaterniond dest)
Description copied from interface:QuaterniondcApply a rotation tothisquaternion rotating the given radians about the y axis and store the result indest.If
Qisthisquaternion andRthe quaternion representing the specified rotation, then the new quaternion will beQ * R. So when transforming a vectorvwith the new quaternion by usingQ * R * v, the rotation added by this method will be applied first!- Specified by:
rotateYin interfaceQuaterniondc- Parameters:
angle- the angle in radians to rotate about the y axisdest- will hold the result- Returns:
- dest
-
rotateZ
public Quaterniond rotateZ(double angle)
Apply a rotation tothisquaternion rotating the given radians about the z axis.If
Qisthisquaternion andRthe quaternion representing the specified rotation, then the new quaternion will beQ * R. So when transforming a vectorvwith 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 axis- Returns:
- this
-
rotateZ
public Quaterniond rotateZ(double angle, Quaterniond dest)
Description copied from interface:QuaterniondcApply a rotation tothisquaternion rotating the given radians about the z axis and store the result indest.If
Qisthisquaternion andRthe quaternion representing the specified rotation, then the new quaternion will beQ * R. So when transforming a vectorvwith the new quaternion by usingQ * R * v, the rotation added by this method will be applied first!- Specified by:
rotateZin interfaceQuaterniondc- Parameters:
angle- the angle in radians to rotate about the z axisdest- will hold the result- Returns:
- dest
-
rotateLocalX
public Quaterniond rotateLocalX(double angle)
Apply a rotation tothisquaternion rotating the given radians about the local x axis.If
Qisthisquaternion andRthe quaternion representing the specified rotation, then the new quaternion will beR * Q. So when transforming a vectorvwith the new quaternion by usingR * Q * v, the rotation represented bythiswill be applied first!- Parameters:
angle- the angle in radians to rotate about the local x axis- Returns:
- this
-
rotateLocalX
public Quaterniond rotateLocalX(double angle, Quaterniond dest)
Description copied from interface:QuaterniondcApply a rotation tothisquaternion rotating the given radians about the local x axis and store the result indest.If
Qisthisquaternion andRthe quaternion representing the specified rotation, then the new quaternion will beR * Q. So when transforming a vectorvwith the new quaternion by usingR * Q * v, the rotation represented bythiswill be applied first!- Specified by:
rotateLocalXin interfaceQuaterniondc- Parameters:
angle- the angle in radians to rotate about the local x axisdest- will hold the result- Returns:
- dest
-
rotateLocalY
public Quaterniond rotateLocalY(double angle)
Apply a rotation tothisquaternion rotating the given radians about the local y axis.If
Qisthisquaternion andRthe quaternion representing the specified rotation, then the new quaternion will beR * Q. So when transforming a vectorvwith the new quaternion by usingR * Q * v, the rotation represented bythiswill be applied first!- Parameters:
angle- the angle in radians to rotate about the local y axis- Returns:
- this
-
rotateLocalY
public Quaterniond rotateLocalY(double angle, Quaterniond dest)
Description copied from interface:QuaterniondcApply a rotation tothisquaternion rotating the given radians about the local y axis and store the result indest.If
Qisthisquaternion andRthe quaternion representing the specified rotation, then the new quaternion will beR * Q. So when transforming a vectorvwith the new quaternion by usingR * Q * v, the rotation represented bythiswill be applied first!- Specified by:
rotateLocalYin interfaceQuaterniondc- Parameters:
angle- the angle in radians to rotate about the local y axisdest- will hold the result- Returns:
- dest
-
rotateLocalZ
public Quaterniond rotateLocalZ(double angle)
Apply a rotation tothisquaternion rotating the given radians about the local z axis.If
Qisthisquaternion andRthe quaternion representing the specified rotation, then the new quaternion will beR * Q. So when transforming a vectorvwith the new quaternion by usingR * Q * v, the rotation represented bythiswill be applied first!- Parameters:
angle- the angle in radians to rotate about the local z axis- Returns:
- this
-
rotateLocalZ
public Quaterniond rotateLocalZ(double angle, Quaterniond dest)
Description copied from interface:QuaterniondcApply a rotation tothisquaternion rotating the given radians about the local z axis and store the result indest.If
Qisthisquaternion andRthe quaternion representing the specified rotation, then the new quaternion will beR * Q. So when transforming a vectorvwith the new quaternion by usingR * Q * v, the rotation represented bythiswill be applied first!- Specified by:
rotateLocalZin interfaceQuaterniondc- Parameters:
angle- the angle in radians to rotate about the local z axisdest- will hold the result- Returns:
- dest
-
rotateXYZ
public Quaterniond rotateXYZ(double angleX, double angleY, double angleZ)
Apply a rotation tothisquaternion rotating the given radians about the cartesian base unit axes, called the euler angles using rotation sequenceXYZ.This method is equivalent to calling:
rotateX(angleX).rotateY(angleY).rotateZ(angleZ)If
Qisthisquaternion andRthe quaternion representing the specified rotation, then the new quaternion will beQ * R. So when transforming a vectorvwith 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 axis- Returns:
- this
-
rotateXYZ
public Quaterniond rotateXYZ(double angleX, double angleY, double angleZ, Quaterniond dest)
Description copied from interface:QuaterniondcApply a rotation tothisquaternion rotating the given radians about the cartesian base unit axes, called the euler angles using rotation sequenceXYZand store the result indest.This method is equivalent to calling:
rotateX(angleX, dest).rotateY(angleY).rotateZ(angleZ)If
Qisthisquaternion andRthe quaternion representing the specified rotation, then the new quaternion will beQ * R. So when transforming a vectorvwith the new quaternion by usingQ * R * v, the rotation added by this method will be applied first!- Specified by:
rotateXYZin interfaceQuaterniondc- 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
public Quaterniond rotateZYX(double angleZ, double angleY, double angleX)
Apply a rotation tothisquaternion rotating the given radians about the cartesian base unit axes, called the euler angles, using the rotation sequenceZYX.This method is equivalent to calling:
rotateZ(angleZ).rotateY(angleY).rotateX(angleX)If
Qisthisquaternion andRthe quaternion representing the specified rotation, then the new quaternion will beQ * R. So when transforming a vectorvwith 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 axis- Returns:
- this
-
rotateZYX
public Quaterniond rotateZYX(double angleZ, double angleY, double angleX, Quaterniond dest)
Description copied from interface:QuaterniondcApply a rotation tothisquaternion rotating the given radians about the cartesian base unit axes, called the euler angles, using the rotation sequenceZYXand store the result indest.This method is equivalent to calling:
rotateZ(angleZ, dest).rotateY(angleY).rotateX(angleX)If
Qisthisquaternion andRthe quaternion representing the specified rotation, then the new quaternion will beQ * R. So when transforming a vectorvwith the new quaternion by usingQ * R * v, the rotation added by this method will be applied first!- Specified by:
rotateZYXin interfaceQuaterniondc- 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
public Quaterniond rotateYXZ(double angleY, double angleX, double angleZ)
Apply a rotation tothisquaternion rotating the given radians about the cartesian base unit axes, called the euler angles, using the rotation sequenceYXZ.This method is equivalent to calling:
rotateY(angleY).rotateX(angleX).rotateZ(angleZ)If
Qisthisquaternion andRthe quaternion representing the specified rotation, then the new quaternion will beQ * R. So when transforming a vectorvwith 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 axis- Returns:
- this
-
rotateYXZ
public Quaterniond rotateYXZ(double angleY, double angleX, double angleZ, Quaterniond dest)
Description copied from interface:QuaterniondcApply a rotation tothisquaternion rotating the given radians about the cartesian base unit axes, called the euler angles, using the rotation sequenceYXZand store the result indest.This method is equivalent to calling:
rotateY(angleY, dest).rotateX(angleX).rotateZ(angleZ)If
Qisthisquaternion andRthe quaternion representing the specified rotation, then the new quaternion will beQ * R. So when transforming a vectorvwith the new quaternion by usingQ * R * v, the rotation added by this method will be applied first!- Specified by:
rotateYXZin interfaceQuaterniondc- 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
public Vector3d getEulerAnglesXYZ(Vector3d eulerAngles)
Description copied from interface:QuaterniondcGet the euler angles in radians in rotation sequenceXYZof this quaternion and store them in the provided parametereulerAngles.The Euler angles are always returned as the angle around X in the
Vector3d.xfield, the angle around Y in theVector3d.yfield and the angle around Z in theVector3d.zfield of the suppliedVector3dinstance.- Specified by:
getEulerAnglesXYZin interfaceQuaterniondc- Parameters:
eulerAngles- will hold the euler angles in radians- Returns:
- the passed in vector
-
getEulerAnglesZYX
public Vector3d getEulerAnglesZYX(Vector3d eulerAngles)
Description copied from interface:QuaterniondcGet the euler angles in radians in rotation sequenceZYXof this quaternion and store them in the provided parametereulerAngles.The Euler angles are always returned as the angle around X in the
Vector3d.xfield, the angle around Y in theVector3d.yfield and the angle around Z in theVector3d.zfield of the suppliedVector3dinstance.- Specified by:
getEulerAnglesZYXin interfaceQuaterniondc- Parameters:
eulerAngles- will hold the euler angles in radians- Returns:
- the passed in vector
-
getEulerAnglesZXY
public Vector3d getEulerAnglesZXY(Vector3d eulerAngles)
Description copied from interface:QuaterniondcGet the euler angles in radians in rotation sequenceZXYof this quaternion and store them in the provided parametereulerAngles.The Euler angles are always returned as the angle around X in the
Vector3d.xfield, the angle around Y in theVector3d.yfield and the angle around Z in theVector3d.zfield of the suppliedVector3dinstance.- Specified by:
getEulerAnglesZXYin interfaceQuaterniondc- Parameters:
eulerAngles- will hold the euler angles in radians- Returns:
- the passed in vector
-
getEulerAnglesYXZ
public Vector3d getEulerAnglesYXZ(Vector3d eulerAngles)
Description copied from interface:QuaterniondcGet the euler angles in radians in rotation sequenceYXZof this quaternion and store them in the provided parametereulerAngles.The Euler angles are always returned as the angle around X in the
Vector3d.xfield, the angle around Y in theVector3d.yfield and the angle around Z in theVector3d.zfield of the suppliedVector3dinstance.- Specified by:
getEulerAnglesYXZin interfaceQuaterniondc- Parameters:
eulerAngles- will hold the euler angles in radians- Returns:
- the passed in vector
-
rotateAxis
public Quaterniond rotateAxis(double angle, double axisX, double axisY, double axisZ, Quaterniond dest)
Description copied from interface:QuaterniondcApply a rotation tothisquaternion rotating the given radians about the specified axis and store the result indest.If
Qisthisquaternion andRthe quaternion representing the specified rotation, then the new quaternion will beQ * R. So when transforming a vectorvwith the new quaternion by usingQ * R * v, the rotation added by this method will be applied first!- Specified by:
rotateAxisin interfaceQuaterniondc- 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
public Quaterniond rotateAxis(double angle, Vector3dc axis, Quaterniond dest)
Description copied from interface:QuaterniondcApply a rotation tothisquaternion rotating the given radians about the specified axis and store the result indest.If
Qisthisquaternion andRthe quaternion representing the specified rotation, then the new quaternion will beQ * R. So when transforming a vectorvwith the new quaternion by usingQ * R * v, the rotation added by this method will be applied first!- Specified by:
rotateAxisin interfaceQuaterniondc- Parameters:
angle- the angle in radians to rotate about the specified axisaxis- the rotation axisdest- will hold the result- Returns:
- dest
- See Also:
Quaterniondc.rotateAxis(double, double, double, double, Quaterniond)
-
rotateAxis
public Quaterniond rotateAxis(double angle, Vector3dc axis)
Apply a rotation tothisquaternion rotating the given radians about the specified axis.If
Qisthisquaternion andRthe quaternion representing the specified rotation, then the new quaternion will beQ * R. So when transforming a vectorvwith 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 axis- Returns:
- this
- See Also:
rotateAxis(double, double, double, double, Quaterniond)
-
rotateAxis
public Quaterniond rotateAxis(double angle, double axisX, double axisY, double axisZ)
Apply a rotation tothisquaternion rotating the given radians about the specified axis.If
Qisthisquaternion andRthe quaternion representing the specified rotation, then the new quaternion will beQ * R. So when transforming a vectorvwith 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 axis- Returns:
- this
- See Also:
rotateAxis(double, double, double, double, Quaterniond)
-
positiveX
public Vector3d positiveX(Vector3d dir)
Description copied from interface:QuaterniondcObtain the direction of+Xbefore the rotation transformation represented bythisquaternion is applied.This method is equivalent to the following code:
Quaterniond inv = new Quaterniond(this).invert(); inv.transform(dir.set(1, 0, 0));
- Specified by:
positiveXin interfaceQuaterniondc- Parameters:
dir- will hold the direction of+X- Returns:
- dir
-
normalizedPositiveX
public Vector3d normalizedPositiveX(Vector3d dir)
Description copied from interface:QuaterniondcObtain the direction of+Xbefore the rotation transformation represented bythisnormalized quaternion is applied. The quaternion must benormalizedfor 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));
- Specified by:
normalizedPositiveXin interfaceQuaterniondc- Parameters:
dir- will hold the direction of+X- Returns:
- dir
-
positiveY
public Vector3d positiveY(Vector3d dir)
Description copied from interface:QuaterniondcObtain the direction of+Ybefore the rotation transformation represented bythisquaternion is applied.This method is equivalent to the following code:
Quaterniond inv = new Quaterniond(this).invert(); inv.transform(dir.set(0, 1, 0));
- Specified by:
positiveYin interfaceQuaterniondc- Parameters:
dir- will hold the direction of+Y- Returns:
- dir
-
normalizedPositiveY
public Vector3d normalizedPositiveY(Vector3d dir)
Description copied from interface:QuaterniondcObtain the direction of+Ybefore the rotation transformation represented bythisnormalized quaternion is applied. The quaternion must benormalizedfor 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));
- Specified by:
normalizedPositiveYin interfaceQuaterniondc- Parameters:
dir- will hold the direction of+Y- Returns:
- dir
-
positiveZ
public Vector3d positiveZ(Vector3d dir)
Description copied from interface:QuaterniondcObtain the direction of+Zbefore the rotation transformation represented bythisquaternion is applied.This method is equivalent to the following code:
Quaterniond inv = new Quaterniond(this).invert(); inv.transform(dir.set(0, 0, 1));
- Specified by:
positiveZin interfaceQuaterniondc- Parameters:
dir- will hold the direction of+Z- Returns:
- dir
-
normalizedPositiveZ
public Vector3d normalizedPositiveZ(Vector3d dir)
Description copied from interface:QuaterniondcObtain the direction of+Zbefore the rotation transformation represented bythisnormalized quaternion is applied. The quaternion must benormalizedfor 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));
- Specified by:
normalizedPositiveZin interfaceQuaterniondc- Parameters:
dir- will hold the direction of+Z- Returns:
- dir
-
conjugateBy
public Quaterniond conjugateBy(Quaterniondc q)
Conjugatethisby the given quaternionqby computingq * this * q^-1.- Parameters:
q- theQuaterniondcto conjugatethisby- Returns:
- this
-
conjugateBy
public Quaterniond conjugateBy(Quaterniondc q, Quaterniond dest)
Conjugatethisby the given quaternionqby computingq * this * q^-1and store the result intodest.- Specified by:
conjugateByin interfaceQuaterniondc- Parameters:
q- theQuaterniondcto conjugatethisbydest- will hold the result- Returns:
- dest
-
isFinite
public boolean isFinite()
Description copied from interface:QuaterniondcDetermine whether all components are finite floating-point values, that is, they are notNaNand notinfinity.- Specified by:
isFinitein interfaceQuaterniondc- Returns:
trueif all components are finite floating-point values;falseotherwise
-
equals
public boolean equals(Quaterniondc q, double delta)
Description copied from interface:QuaterniondcCompare the quaternion components ofthisquaternion with the given quaternion using the givendeltaand return whether all of them are equal within a maximum difference ofdelta.Please note that this method is not used by any data structure such as
ArrayListHashSetorHashMapand their operations, such asArrayList.contains(Object)orHashSet.remove(Object), since those data structures only use theObject.equals(Object)andObject.hashCode()methods.- Specified by:
equalsin interfaceQuaterniondc- Parameters:
q- the other quaterniondelta- the allowed maximum difference- Returns:
truewhether all of the quaternion components are equal;falseotherwise
-
equals
public boolean equals(double x, double y, double z, double w)- Specified by:
equalsin interfaceQuaterniondc- Parameters:
x- the x component to compare toy- the y component to compare toz- the z component to compare tow- the w component to compare to- Returns:
trueif all the quaternion components are equal
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException- Overrides:
clonein classjava.lang.Object- Throws:
java.lang.CloneNotSupportedException
-
-