public interface QuaternionBasics extends QuaternionReadOnly, Orientation3DBasics, Tuple4DBasics
 When describing a 4D tuple, its 4 components are often gathered in two groups: the scalar part
 s and the vector part (x, y, z).
 
Note on the difference between applying a 3D transform on a quaternion and a 4D vector:
s
 remains unchanged. The vector part (x, y, z) is scaled and rotated, and
 translated by s times the translation part of the transform. Note that for s = 0,
 a 4D vector behaves as a 3D vector, and for s = 1 it behaves as a 3D point.
 | Modifier and Type | Field and Description | 
|---|---|
static double | 
EPS_POW
Tolerance used in  
pow(double) to determine if this quaternion is equal to the neurtral
 quaternion. | 
EPS_UNITARY, GEOMETRICALLY_EQUALS_THRESHOLDORIENTATION_2D_EPSILON| Modifier and Type | Method and Description | 
|---|---|
default void | 
absolute()
Sets each component of this tuple to its absolute value. 
 | 
default void | 
append(Orientation3DReadOnly orientation)
Appends the given orientation to this orientation. 
 | 
default void | 
appendInvertOther(Orientation3DReadOnly orientation)
Appends the inverse of the given orientation to this orientation. 
 | 
default void | 
appendPitchRotation(double pitch)
Append a rotation about the y-axis to this quaternion. 
 | 
default void | 
appendRollRotation(double roll)
Append a rotation about the x-axis to this quaternion. 
 | 
default void | 
appendYawRotation(double yaw)
Append a rotation about the z-axis to this quaternion. 
 | 
default void | 
applyInverseTransform(Transform transform)
Transforms this quaternion using the inverse of the given  
transform. | 
default void | 
applyTransform(Transform transform)
Transforms this quaternion using the given  
transform. | 
default void | 
conjugate()
Sets this quaternion to its conjugate. 
 | 
default void | 
difference(QuaternionReadOnly q1,
          QuaternionReadOnly q2)
Sets this quaternion to the difference of  
q1 and q2. | 
default void | 
interpolate(QuaternionReadOnly qf,
           double alpha)
Performs a linear interpolation in SO(3) from  
this to qf given the percentage
 alpha. | 
default void | 
interpolate(QuaternionReadOnly q0,
           QuaternionReadOnly qf,
           double alpha)
Performs a linear interpolation in SO(3) from  
q0 to qf given the percentage
 alpha. | 
default void | 
inverse()
Sets this quaternion to its inverse. 
 | 
default void | 
invert()
Inverses this orientation. 
 | 
default void | 
multiply(QuaternionReadOnly other)
Multiplies this quaternion by  
other. | 
default void | 
multiply(QuaternionReadOnly q1,
        QuaternionReadOnly q2)
Sets this quaternion to the multiplication of  
q1 and q2. | 
default void | 
multiplyConjugateBoth(QuaternionReadOnly other)
Sets this quaternion to the multiplication of the conjugate of  
this and other. | 
default void | 
multiplyConjugateOther(QuaternionReadOnly other)
Multiplies this quaternion by the conjugate of  
other. | 
default void | 
multiplyConjugateThis(QuaternionReadOnly other)
Sets this quaternion to the multiplication of the conjugate of  
this and other. | 
default void | 
negate()
Changes the sign of each component of this tuple. 
 | 
default void | 
normalize()
Recomputes this quaternion's components to ensure its norm is equal to 1. 
 | 
default void | 
normalizeAndLimitToPi()
Normalizes this quaternion and then limits the angle of the rotation it represents to be ∈
 [-pi;pi]. 
 | 
default void | 
pow(double alpha)
Raises this quaternion to the power  
alpha. | 
default void | 
preMultiply(QuaternionReadOnly other)
Pre-multiplies this quaternion by  
other. | 
default void | 
preMultiplyConjugateBoth(QuaternionReadOnly other)
Sets this quaternion to the multiplication of the conjugate of  
other and the conjugate of
 this. | 
default void | 
preMultiplyConjugateOther(QuaternionReadOnly other)
Sets this quaternion to the multiplication of the conjugate of  
other and this. | 
default void | 
preMultiplyConjugateThis(QuaternionReadOnly other)
Sets this quaternion to the multiplication of  
other and the conjugate of this. | 
default void | 
prepend(Orientation3DReadOnly orientation)
Prepends the given orientation to this orientation. 
 | 
default void | 
prependInvertOther(Orientation3DReadOnly orientation)
Prepends the inverse of the given orientation to this orientation. 
 | 
default void | 
prependPitchRotation(double pitch)
Prepend a rotation about the y-axis to this quaternion. 
 | 
default void | 
prependRollRotation(double roll)
Prepend a rotation about the x-axis to this quaternion. 
 | 
default void | 
prependYawRotation(double yaw)
Prepend a rotation about the z-axis to this quaternion. 
 | 
default void | 
set(double x,
   double y,
   double z,
   double s)
Sets this tuple's components to  
x, y, z, and s. | 
default void | 
set(Orientation3DReadOnly orientation3DReadOnly)
Converts, if necessary, and sets this orientation to represents the same orientation as
  
orientation3DReadOnly. | 
default void | 
set(QuaternionReadOnly other)
Sets this quaternion to  
other. | 
default void | 
setAndConjugate(QuaternionReadOnly other)
Sets this quaternion to the conjugate of  
other. | 
default void | 
setAndInverse(QuaternionReadOnly other)
Deprecated. 
 
 | 
default void | 
setAndNegate(QuaternionReadOnly other)
Sets this quaternion to  
other and then calls negate(). | 
default void | 
setAndNormalize(QuaternionReadOnly other)
Sets this tuple to  
other and then calls normalize(). | 
default void | 
setAndNormalize(Tuple4DReadOnly other)
Sets this tuple to  
other and then calls Tuple4DBasics.normalize(). | 
default void | 
setAxisAngle(double x,
            double y,
            double z,
            double angle)
Sets this orientation to represents the same orientation as an axis-angle given its 4
 components. 
 | 
default void | 
setQuaternion(double x,
             double y,
             double z,
             double s)
Sets this orientation to represents the same orientation as a quaternion given its 4
 components. 
 | 
default void | 
setRotationMatrix(double m00,
                 double m01,
                 double m02,
                 double m10,
                 double m11,
                 double m12,
                 double m20,
                 double m21,
                 double m22)
Sets this orientation to represents the same orientation as a rotation matrix given its 9
 components. 
 | 
default void | 
setRotationVector(double x,
                 double y,
                 double z)
Sets this orientation to represents the same orientation as a rotation vector given its 3
 components. 
 | 
default void | 
setToPitchQuaternion(double pitch)
Sets this quaternion to represent a counter clockwise rotation around the y-axis of an angle
  
pitch. | 
default void | 
setToRollQuaternion(double roll)
Sets this quaternion to represent a counter clockwise rotation around the x-axis of an angle
  
roll. | 
default void | 
setToYawQuaternion(double yaw)
Sets this quaternion to represent a counter clockwise rotation around the z-axis of an angle
  
yaw. | 
default void | 
setToZero()
Sets this quaternion to the neutral quaternion representing a 'zero' rotation. 
 | 
void | 
setUnsafe(double qx,
         double qy,
         double qz,
         double qs)
Sets the four components of this quaternion without normalizing. 
 | 
default void | 
setYawPitchRoll(double yaw,
               double pitch,
               double roll)
Sets this orientation to represents the same orientation as a yaw-pitch-roll representation. 
 | 
addTransform, checkIfIsZOnly, checkIfUnitary, checkIfUnitary, distance, distancePrecise, geometricallyEquals, get, get, get, getAngle, getEuler, getPitch, getRoll, getRotationVector, getYaw, getYawPitchRoll, inverseTransform, inverseTransform, inverseTransform, inverseTransform, isOrientation2D, isUnitary, isZOnly, norm, transform, transform, transform, transformappendInvertBoth, appendInvertThis, prependInvertBoth, prependInvertThis, setAndInvert, setAndNormalize, setEuler, setEuler, setRotationVector, setYawPitchRolladdTransform, checkIfOrientation2D, checkIfOrientation2D, inverseTransform, inverseTransform, inverseTransform, inverseTransform, inverseTransform, inverseTransform, inverseTransform, inverseTransform, inverseTransform, inverseTransform, inverseTransform, inverseTransform, isOrientation2D, toStringAsYawPitchRoll, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transformcontainsNaN, set, set, set, set, set, set, set, set, setAndAbsolute, setAndNegate, setToNaNdot, epsilonEquals, equals, get, get, get, get, get, get, get, getElement, getElement32, getS, getS32, getX, getX32, getY, getY32, getZ, getZ32, normSquaredstatic final double EPS_POW
pow(double) to determine if this quaternion is equal to the neurtral
 quaternion.void setUnsafe(double qx,
               double qy,
               double qz,
               double qs)
 This method is meant for internal usage. Prefer using
 set(double, double, double, double).
 
qx - the x-component of this quaternion.qy - the y-component of this quaternion.qz - the z-component of this quaternion.qs - the s-component of this quaternion.default void setToZero()
default void absolute()
absolute in interface Tuple4DBasicsdefault void negate()
negate in interface Tuple4DBasicsdefault void conjugate()
      / -qx \
 q* = | -qy |
      | -qz |
      \  qs /
 default void invert()
If this orientation describes the orientation of a coordinate system A with respect to a coordinate system B, after this method, the orientation will describe the orientation of B with respect to A.
Note that appending or prepending an orientation with its inverse will result into a "zero" orientation.
invert in interface Orientation3DBasicsdefault void inverse()
 Essentially calling conjugate() and then normalize().
 
default void normalize()
Edge cases:
Double.NaN, this method is ineffective.
 normalize in interface Orientation3DBasicsnormalize in interface Tuple4DBasicsdefault void normalizeAndLimitToPi()
default void pow(double alpha)
alpha.
 
 This is equivalent to converting this quaternion into an axis-angle, scaling the angle by
 alpha, and finally converting back to a quaternion.
 
Edge cases:
Double.NaN, this method is ineffective.
 EPS_POW, the method setToZero()
 is called.
 alpha - the real value of the power.default void set(double x,
                 double y,
                 double z,
                 double s)
x, y, z, and s.set in interface Tuple4DBasicsx - the new value for the x-component of this tuple.y - the new value for the y-component of this tuple.z - the new value for the z-component of this tuple.s - the new value for the s-component of this tuple.default void set(Orientation3DReadOnly orientation3DReadOnly)
orientation3DReadOnly.set in interface Orientation3DBasicsorientation3DReadOnly - the new orientation. Not modified.default void set(QuaternionReadOnly other)
other.other - the other quaternion to copy the values from. Not modified.default void setAndNormalize(Tuple4DReadOnly other)
other and then calls Tuple4DBasics.normalize().setAndNormalize in interface Tuple4DBasicsother - the other tuple to copy the values from. Not modified.default void setAndNormalize(QuaternionReadOnly other)
other and then calls normalize().other - the other quaternion to copy the values from. Not modified.default void setAndConjugate(QuaternionReadOnly other)
other.
 
      / -qx \
 q* = | -qy |
      | -qz |
      \  qs /
 other - the other quaternion to copy the values from. Not modified.default void setAndNegate(QuaternionReadOnly other)
other and then calls negate().other - the other quaternion to copy the values from. Not modified.default void setAndInverse(QuaternionReadOnly other)
Orientation3DBasics.setAndInvert(Orientation3DReadOnly) insteadother.other - the other quaternion to copy the values from. Not modified.default void setAxisAngle(double x,
                          double y,
                          double z,
                          double angle)
setAxisAngle in interface Orientation3DBasicsx - x-component of the axis part of the axis-angle.y - y-component of the axis part of the axis-angle.z - z-component of the axis part of the axis-angle.angle - the angle part of the axis-angle.default void setQuaternion(double x,
                           double y,
                           double z,
                           double s)
setQuaternion in interface Orientation3DBasicsx - the x-component of the quaternion.y - the y-component of the quaternion.z - the z-component of the quaternion.s - the s-component of the quaternion.default void setRotationVector(double x,
                               double y,
                               double z)
WARNING: a rotation vector is different from a yaw-pitch-roll or Euler angles representation. A rotation vector is equivalent to the axis of an axis-angle that is multiplied by the angle of the same axis-angle.
setRotationVector in interface Orientation3DBasicsx - the x-component of the rotation vector.y - the y-component of the rotation vector.z - the z-component of the rotation vector.default void setYawPitchRoll(double yaw,
                             double pitch,
                             double roll)
WARNING: the Euler angles or yaw-pitch-roll representation is sensitive to gimbal lock and is sometimes undefined.
The yaw-pitch-roll representation describes a 3D orientation as a succession of three rotations around three axes:
As an example, a rotation matrix can be computed from a yaw-pitch-roll representation as follows:
     / cos(yaw) -sin(yaw) 0 \   /  cos(pitch) 0 sin(pitch) \   / 1     0          0     \
 R = | sin(yaw)  cos(yaw) 0 | * |      0      1     0      | * | 0 cos(roll) -sin(roll) |
     \    0         0     1 /   \ -sin(pitch) 0 cos(pitch) /   \ 0 sin(roll)  cos(roll) /
 
 setYawPitchRoll in interface Orientation3DBasicsyaw - the angle to rotate about the z-axis.pitch - the angle to rotate about the y-axis.roll - the angle to rotate about the x-axis.default void setRotationMatrix(double m00,
                               double m01,
                               double m02,
                               double m10,
                               double m11,
                               double m12,
                               double m20,
                               double m21,
                               double m22)
setRotationMatrix in interface Orientation3DBasicsm00 - the new 1st row 1st column coefficient of the rotation matrix.m01 - the new 1st row 2nd column coefficient of the rotation matrix.m02 - the new 1st row 3rd column coefficient of the rotation matrix.m10 - the new 2nd row 1st column coefficient of the rotation matrix.m11 - the new 2nd row 2nd column coefficient of the rotation matrix.m12 - the new 2nd row 3rd column coefficient of the rotation matrix.m20 - the new 3rd row 1st column coefficient of the rotation matrix.m21 - the new 3rd row 2nd column coefficient of the rotation matrix.m22 - the new 3rd row 3rd column coefficient of the rotation matrix.default void setToYawQuaternion(double yaw)
yaw.yaw - the angle to rotate about the z-axis.default void setToPitchQuaternion(double pitch)
pitch.pitch - the angle to rotate about the y-axis.default void setToRollQuaternion(double roll)
roll.roll - the angle to rotate about the x-axis.default void difference(QuaternionReadOnly q1, QuaternionReadOnly q2)
q1 and q2.
 this = q1-1 * q2
q1 - the first quaternion in the difference. Not modified.q2 - the second quaternion in the difference. Not modified.default void multiply(QuaternionReadOnly other)
other.
 this = this * other
other - the other quaternion to multiply this. Not modified.default void multiply(QuaternionReadOnly q1, QuaternionReadOnly q2)
q1 and q2.
 this = q1 * q2
q1 - the first quaternion in the multiplication. Not modified.q2 - the second quaternion in the multiplication. Not modified.default void append(Orientation3DReadOnly orientation)
Let's consider the following:
this represents the orientation of B relative to A.
 orientation represents the orientation of C relative to B.
 this, represents the orientation of
 C relative to A.
 
 
 Appending orientations is in some way similar to summing translations. However, while the
 addition for translation is commutative, the "append" operation on orientation is NOT
 commutative. Such that: this.append(orientation) ≠
 orientation.append(this).
 
append in interface Orientation3DBasicsorientation - the orientation to append to this orientation. Not modified.default void multiplyConjugateOther(QuaternionReadOnly other)
other.
 this = this * other*
other - the other quaternion to multiply this with. Not modified.default void appendInvertOther(Orientation3DReadOnly orientation)
Let's consider the following:
this represents the orientation of B relative to A.
 orientation represents the orientation of B relative to C.
 this, represents the orientation of
 C relative to A.
 
 
 This operation is in some way similar to subtracting translations, as in this operation can be
 seen as subtracting orientation to this.
 
appendInvertOther in interface Orientation3DBasicsorientation - the orientation which the inverse is to be appended to this orientation.
           Not modified.default void multiplyConjugateThis(QuaternionReadOnly other)
this and other.
 this = this* * other
other - the other quaternion to multiply this with. Not modified.default void multiplyConjugateBoth(QuaternionReadOnly other)
this and other.
 this = this* * other
other - the other quaternion to multiply this with. Not modified.default void appendYawRotation(double yaw)
               / qx =     0      \
 this = this * | qy =     0      |
               | qz = sin(yaw/2) |
               \ qs = cos(yaw/2) /
 appendYawRotation in interface Orientation3DBasicsyaw - the angle to rotate about the z-axis.default void appendPitchRotation(double pitch)
               / qx =      0       \
 this = this * | qy = sin(pitch/2) |
               | qz =      0       |
               \ qs = cos(pitch/2) /
 appendPitchRotation in interface Orientation3DBasicspitch - the angle to rotate about the y-axis.default void appendRollRotation(double roll)
               / qx = sin(roll/2) \
 this = this * | qy =      0      |
               | qz =      0      |
               \ qs = cos(roll/2) /
 appendRollRotation in interface Orientation3DBasicsroll - the angle to rotate about the x-axis.default void preMultiply(QuaternionReadOnly other)
other.
 this = other * this
other - the other quaternion to multiply this with. Not modified.default void prepend(Orientation3DReadOnly orientation)
Let's consider the following:
this represents the orientation of C relative to B.
 orientation represents the orientation of B relative to A.
 this, represents the orientation of
 C relative to A.
 
 
 Prepending orientations is in some way similar to summing translations. However, while the
 addition for translation is commutative, the "prepend" operation on orientation is NOT
 commutative. Such that: this.prepend(orientation) ≠
 orientation.prepend(this).
 
prepend in interface Orientation3DBasicsorientation - the orientation to prepend to this orientation. Not modified.default void preMultiplyConjugateOther(QuaternionReadOnly other)
other and this.
 this = other* * this
other - the other quaternion to multiply this with. Not modified.default void prependInvertOther(Orientation3DReadOnly orientation)
Let's consider the following:
this represents the orientation of B relative to C.
 orientation represents the orientation of B relative to A.
 this, represents the orientation of
 C relative to A.
 
 
 This operation is in some way similar to subtracting translations, as in this operation can be
 seen as subtracting orientation to this.
 
prependInvertOther in interface Orientation3DBasicsorientation - the orientation which the inverse is to be appended to this orientation.
           Not modified.default void preMultiplyConjugateThis(QuaternionReadOnly other)
other and the conjugate of this.
 this = other * this*
other - the other quaternion to multiply this with. Not modified.default void preMultiplyConjugateBoth(QuaternionReadOnly other)
other and the conjugate of
 this.
 this = other* * this*
other - the other quaternion to multiply this with. Not modified.default void prependYawRotation(double yaw)
        / qx =     0      \
 this = | qy =     0      | * this
        | qz = sin(yaw/2) |
        \ qs = cos(yaw/2) /
 prependYawRotation in interface Orientation3DBasicsyaw - the angle to rotate about the z-axis.default void prependPitchRotation(double pitch)
        / qx =      0       \
 this = | qy = sin(pitch/2) | * this
        | qz =      0       |
        \ qs = cos(pitch/2) /
 prependPitchRotation in interface Orientation3DBasicspitch - the angle to rotate about the y-axis.default void prependRollRotation(double roll)
        / qx = sin(roll/2) \
 this = | qy =      0      | * this
        | qz =      0      |
        \ qs = cos(roll/2) /
 prependRollRotation in interface Orientation3DBasicsroll - the angle to rotate about the x-axis.default void interpolate(QuaternionReadOnly qf, double alpha)
this to qf given the percentage
 alpha.
 The interpolation method used here is often called a Spherical Linear Interpolation or SLERP.
qf - the other quaternion used for the interpolation. Not modified.alpha - the percentage used for the interpolation. A value of 0 will result in not modifying
           this quaternion, while a value of 1 is equivalent to setting this quaternion to
           qf.default void interpolate(QuaternionReadOnly q0, QuaternionReadOnly qf, double alpha)
q0 to qf given the percentage
 alpha.
 The interpolation method used here is often called a Spherical Linear Interpolation or SLERP.
q0 - the first quaternion used in the interpolation. Not modified.qf - the second quaternion used in the interpolation. Not modified.alpha - the percentage to use for the interpolation. A value of 0 will result in setting
           this quaternion to q0, while a value of 1 is equivalent to setting this
           quaternion to qf.default void applyTransform(Transform transform)
transform.
 
 RigidBodyTransform, QuaternionBasedTransform, and AffineTransform prepend
 their rotation part the given quaternion. No scale or translation is applied to the quaternion
 such that the output of this method is still a unit-quaternion.
 
applyTransform in interface Transformabletransform - the geometric transform to apply on this vector. Not modified.default void applyInverseTransform(Transform transform)
transform.
 
 RigidBodyTransform, QuaternionBasedTransform, and AffineTransform prepend
 their rotation part the given quaternion. No scale or translation is applied to the quaternion
 such that the output of this method is still a unit-quaternion.
 
applyInverseTransform in interface Transformabletransform - the geometric transform to apply on this vector. Not modified.