Package org.joml

Interface Quaterniondc

All Known Implementing Classes:
Quaterniond

public interface Quaterniondc
Interface to a read-only view of a quaternion of double-precision floats.
Author:
Kai Burjack
  • Method Details

    • x

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

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

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

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

      Quaterniond normalize(Quaterniond dest)
      Normalize this quaternion and store the result in dest.
      Parameters:
      dest - will hold the result
      Returns:
      dest
    • add

      Quaterniond add(double x, double y, double z, double w, Quaterniond dest)
      Add the quaternion (x, y, z, w) to this quaternion and store the result in dest.
      Parameters:
      x - the x component of the vector part
      y - the y component of the vector part
      z - the z component of the vector part
      w - the real/scalar component
      dest - will hold the result
      Returns:
      dest
    • add

      Add q2 to this quaternion and store the result in dest.
      Parameters:
      q2 - the quaternion to add to this
      dest - will hold the result
      Returns:
      dest
    • dot

      double dot(Quaterniondc otherQuat)
      Return the dot product of this Quaterniond and otherQuat.
      Parameters:
      otherQuat - the other quaternion
      Returns:
      the dot product
    • angle

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

      This quaternion must be normalized.

      Returns:
      the angle in radians
    • get

      Matrix3d get(Matrix3d dest)
      Set the given destination matrix to the rotation represented by this.
      Parameters:
      dest - the matrix to write the rotation into
      Returns:
      the passed in destination
      See Also:
    • get

      Matrix3f get(Matrix3f dest)
      Set the given destination matrix to the rotation represented by this.
      Parameters:
      dest - the matrix to write the rotation into
      Returns:
      the passed in destination
      See Also:
    • get

      Matrix4d get(Matrix4d dest)
      Set the given destination matrix to the rotation represented by this.
      Parameters:
      dest - the matrix to write the rotation into
      Returns:
      the passed in destination
      See Also:
    • get

      Matrix4f get(Matrix4f dest)
      Set the given destination matrix to the rotation represented by this.
      Parameters:
      dest - the matrix to write the rotation into
      Returns:
      the passed in destination
      See Also:
    • get

      Set the given AxisAngle4f to represent the rotation of this quaternion.
      Parameters:
      dest - the AxisAngle4f to set
      Returns:
      the passed in destination
    • get

      Set the given AxisAngle4d to represent the rotation of this quaternion.
      Parameters:
      dest - the AxisAngle4d to set
      Returns:
      the passed in destination
    • get

      Set the given Quaterniond to the values of this.
      Parameters:
      dest - the Quaterniond to set
      Returns:
      the passed in destination
    • get

      Set the given Quaternionf to the values of this.
      Parameters:
      dest - the Quaternionf to set
      Returns:
      the passed in destination
    • mul

      Multiply this quaternion by q and store the result in dest.

      If T is this and Q is the given quaternion, then the resulting quaternion R is:

      R = T * Q

      So, this method uses post-multiplication like the matrix classes, resulting in a vector to be transformed by Q first, and then by T.

      Parameters:
      q - the quaternion to multiply this by
      dest - will hold the result
      Returns:
      dest
    • mul

      Quaterniond mul(double qx, double qy, double qz, double qw, Quaterniond dest)
      Multiply this quaternion by the quaternion represented via (qx, qy, qz, qw) and store the result in dest.

      If T is this and Q is the given quaternion, then the resulting quaternion R is:

      R = T * Q

      So, this method uses post-multiplication like the matrix classes, resulting in a vector to be transformed by Q first, and then by T.

      Parameters:
      qx - the x component of the quaternion to multiply this by
      qy - the y component of the quaternion to multiply this by
      qz - the z component of the quaternion to multiply this by
      qw - the w component of the quaternion to multiply this by
      dest - will hold the result
      Returns:
      dest
    • mul

      Quaterniond mul(double f, Quaterniond dest)
      Multiply this quaternion by the given scalar and store the result in dest.

      This method multiplies all of the four components by the specified scalar.

      Parameters:
      f - the factor to multiply all components by
      dest - will hold the result
      Returns:
      dest
    • premul

      Pre-multiply this quaternion by q and store the result in dest.

      If T is this and Q is the given quaternion, then the resulting quaternion R is:

      R = Q * T

      So, this method uses pre-multiplication, resulting in a vector to be transformed by T first, and then by Q.

      Parameters:
      q - the quaternion to pre-multiply this by
      dest - will hold the result
      Returns:
      dest
    • premul

      Quaterniond premul(double qx, double qy, double qz, double qw, Quaterniond dest)
      Pre-multiply this quaternion by the quaternion represented via (qx, qy, qz, qw) and store the result in dest.

      If T is this and Q is the given quaternion, then the resulting quaternion R is:

      R = Q * T

      So, this method uses pre-multiplication, resulting in a vector to be transformed by T first, and then by Q.

      Parameters:
      qx - the x component of the quaternion to multiply this by
      qy - the y component of the quaternion to multiply this by
      qz - the z component of the quaternion to multiply this by
      qw - the w component of the quaternion to multiply this by
      dest - will hold the result
      Returns:
      dest
    • transform

      Vector3d transform(Vector3d vec)
      Transform the given vector by this quaternion.

      This will apply the rotation described by this quaternion to the given vector.

      Parameters:
      vec - the vector to transform
      Returns:
      vec
    • transformInverse

      Vector3d transformInverse(Vector3d vec)
      Transform the given vector by the inverse of this quaternion.

      This will apply the rotation described by this quaternion to the given vector.

      Parameters:
      vec - the vector to transform
      Returns:
      vec
    • transformUnit

      Vector3d transformUnit(Vector3d vec)
      Transform 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 this is a unit quaternion.

      Parameters:
      vec - the vector to transform
      Returns:
      vec
    • transformInverseUnit

      Vector3d transformInverseUnit(Vector3d vec)
      Transform 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 this is a unit quaternion.

      Parameters:
      vec - the vector to transform
      Returns:
      vec
    • transformPositiveX

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

      Vector4d transformPositiveX(Vector4d dest)
      Transform the vector (1, 0, 0) by this quaternion.

      Only the first three components of the given 4D vector are modified.

      Parameters:
      dest - will hold the result
      Returns:
      dest
    • transformUnitPositiveX

      Vector3d transformUnitPositiveX(Vector3d dest)
      Transform the vector (1, 0, 0) by this unit quaternion.

      This method is only applicable when this is a unit quaternion.

      Reference: https://de.mathworks.com/

      Parameters:
      dest - will hold the result
      Returns:
      dest
    • transformUnitPositiveX

      Vector4d transformUnitPositiveX(Vector4d dest)
      Transform the vector (1, 0, 0) by this unit quaternion.

      Only the first three components of the given 4D vector are modified.

      This method is only applicable when this is a unit quaternion.

      Reference: https://de.mathworks.com/

      Parameters:
      dest - will hold the result
      Returns:
      dest
    • transformPositiveY

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

      Vector4d transformPositiveY(Vector4d dest)
      Transform the vector (0, 1, 0) by this quaternion.

      Only the first three components of the given 4D vector are modified.

      Parameters:
      dest - will hold the result
      Returns:
      dest
    • transformUnitPositiveY

      Vector3d transformUnitPositiveY(Vector3d dest)
      Transform the vector (0, 1, 0) by this unit quaternion.

      This method is only applicable when this is a unit quaternion.

      Reference: https://de.mathworks.com/

      Parameters:
      dest - will hold the result
      Returns:
      dest
    • transformUnitPositiveY

      Vector4d transformUnitPositiveY(Vector4d dest)
      Transform the vector (0, 1, 0) by this unit quaternion.

      Only the first three components of the given 4D vector are modified.

      This method is only applicable when this is a unit quaternion.

      Reference: https://de.mathworks.com/

      Parameters:
      dest - will hold the result
      Returns:
      dest
    • transformPositiveZ

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

      Vector4d transformPositiveZ(Vector4d dest)
      Transform the vector (0, 0, 1) by this quaternion.

      Only the first three components of the given 4D vector are modified.

      Parameters:
      dest - will hold the result
      Returns:
      dest
    • transformUnitPositiveZ

      Vector3d transformUnitPositiveZ(Vector3d dest)
      Transform the vector (0, 0, 1) by this unit quaternion.

      This method is only applicable when this is a unit quaternion.

      Reference: https://de.mathworks.com/

      Parameters:
      dest - will hold the result
      Returns:
      dest
    • transformUnitPositiveZ

      Vector4d transformUnitPositiveZ(Vector4d dest)
      Transform the vector (0, 0, 1) by this unit quaternion.

      Only the first three components of the given 4D vector are modified.

      This method is only applicable when this is a unit quaternion.

      Reference: https://de.mathworks.com/

      Parameters:
      dest - will hold the result
      Returns:
      dest
    • transform

      Vector4d transform(Vector4d vec)
      Transform the given vector by this quaternion.

      This will apply the rotation described by this quaternion to the given vector.

      Only the first three components of the given 4D vector are being used and modified.

      Parameters:
      vec - the vector to transform
      Returns:
      vec
    • transformInverse

      Vector4d transformInverse(Vector4d vec)
      Transform 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.

      Parameters:
      vec - the vector to transform
      Returns:
      vec
    • transform

      Vector3d transform(Vector3dc vec, Vector3d dest)
      Transform the given vector by this quaternion and store the result in dest.

      This will apply the rotation described by this quaternion to the given vector.

      Parameters:
      vec - the vector to transform
      dest - will hold the result
      Returns:
      dest
    • transformInverse

      Vector3d transformInverse(Vector3dc vec, Vector3d dest)
      Transform the given vector by the inverse of this quaternion and store the result in dest.

      This will apply the rotation described by this quaternion to the given vector.

      Parameters:
      vec - the vector to transform
      dest - will hold the result
      Returns:
      dest
    • transform

      Vector3d transform(double x, double y, double z, Vector3d dest)
      Transform the given vector (x, y, z) by this quaternion and store the result in dest.

      This will apply the rotation described by this quaternion to the given vector.

      Parameters:
      x - the x coordinate of the vector to transform
      y - the y coordinate of the vector to transform
      z - the z coordinate of the vector to transform
      dest - will hold the result
      Returns:
      dest
    • transformInverse

      Vector3d transformInverse(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 in dest.

      This will apply the rotation described by this quaternion to the given vector.

      Parameters:
      x - the x coordinate of the vector to transform
      y - the y coordinate of the vector to transform
      z - the z coordinate of the vector to transform
      dest - will hold the result
      Returns:
      dest
    • transform

      Vector4d transform(Vector4dc vec, Vector4d dest)
      Transform the given vector by this quaternion and store the result in dest.

      This will apply the rotation described by this quaternion to the given vector.

      Only the first three components of the given 4D vector are being used and set on the destination.

      Parameters:
      vec - the vector to transform
      dest - will hold the result
      Returns:
      dest
    • transformInverse

      Vector4d transformInverse(Vector4dc vec, Vector4d dest)
      Transform the given vector by the inverse of this quaternion and store the result in dest.

      This will apply the rotation described by this quaternion to the given vector.

      Only the first three components of the given 4D vector are being used and set on the destination.

      Parameters:
      vec - the vector to transform
      dest - will hold the result
      Returns:
      dest
    • transform

      Vector4d transform(double x, double y, double z, Vector4d dest)
      Transform the given vector (x, y, z) by this quaternion and store the result in dest.

      This will apply the rotation described by this quaternion to the given vector.

      Parameters:
      x - the x coordinate of the vector to transform
      y - the y coordinate of the vector to transform
      z - the z coordinate of the vector to transform
      dest - will hold the result
      Returns:
      dest
    • transformInverse

      Vector4d transformInverse(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 in dest.

      This will apply the rotation described by this quaternion to the given vector.

      Parameters:
      x - the x coordinate of the vector to transform
      y - the y coordinate of the vector to transform
      z - the z coordinate of the vector to transform
      dest - will hold the result
      Returns:
      dest
    • transform

      Vector3f transform(Vector3f vec)
      Transform the given vector by this quaternion.

      This will apply the rotation described by this quaternion to the given vector.

      Parameters:
      vec - the vector to transform
      Returns:
      vec
    • transformInverse

      Vector3f transformInverse(Vector3f vec)
      Transform the given vector by the inverse of this quaternion.

      This will apply the rotation described by this quaternion to the given vector.

      Parameters:
      vec - the vector to transform
      Returns:
      vec
    • transformUnit

      Vector4d transformUnit(Vector4d vec)
      Transform 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 this is a unit quaternion.

      Parameters:
      vec - the vector to transform
      Returns:
      vec
    • transformInverseUnit

      Vector4d transformInverseUnit(Vector4d vec)
      Transform 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 this is a unit quaternion.

      Parameters:
      vec - the vector to transform
      Returns:
      vec
    • transformUnit

      Vector3d transformUnit(Vector3dc vec, Vector3d dest)
      Transform the given vector by this unit quaternion and store the result in dest.

      This will apply the rotation described by this quaternion to the given vector.

      This method is only applicable when this is a unit quaternion.

      Parameters:
      vec - the vector to transform
      dest - will hold the result
      Returns:
      dest
    • transformInverseUnit

      Vector3d transformInverseUnit(Vector3dc vec, Vector3d dest)
      Transform the given vector by the inverse of this unit quaternion and store the result in dest.

      This will apply the rotation described by this quaternion to the given vector.

      This method is only applicable when this is a unit quaternion.

      Parameters:
      vec - the vector to transform
      dest - will hold the result
      Returns:
      dest
    • transformUnit

      Vector3d transformUnit(double x, double y, double z, Vector3d dest)
      Transform the given vector (x, y, z) by this unit quaternion and store the result in dest.

      This will apply the rotation described by this quaternion to the given vector.

      This method is only applicable when this is a unit quaternion.

      Parameters:
      x - the x coordinate of the vector to transform
      y - the y coordinate of the vector to transform
      z - the z coordinate of the vector to transform
      dest - will hold the result
      Returns:
      dest
    • transformInverseUnit

      Vector3d transformInverseUnit(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 in dest.

      This will apply the rotation described by this quaternion to the given vector.

      This method is only applicable when this is a unit quaternion.

      Parameters:
      x - the x coordinate of the vector to transform
      y - the y coordinate of the vector to transform
      z - the z coordinate of the vector to transform
      dest - will hold the result
      Returns:
      dest
    • transformUnit

      Vector4d transformUnit(Vector4dc vec, Vector4d dest)
      Transform the given vector by this unit quaternion and store the result in dest.

      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 this is a unit quaternion.

      Parameters:
      vec - the vector to transform
      dest - will hold the result
      Returns:
      dest
    • transformInverseUnit

      Vector4d transformInverseUnit(Vector4dc vec, Vector4d dest)
      Transform the given vector by the inverse of this unit quaternion and store the result in dest.

      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 this is a unit quaternion.

      Parameters:
      vec - the vector to transform
      dest - will hold the result
      Returns:
      dest
    • transformUnit

      Vector4d transformUnit(double x, double y, double z, Vector4d dest)
      Transform the given vector (x, y, z) by this unit quaternion and store the result in dest.

      This will apply the rotation described by this quaternion to the given vector.

      This method is only applicable when this is a unit quaternion.

      Parameters:
      x - the x coordinate of the vector to transform
      y - the y coordinate of the vector to transform
      z - the z coordinate of the vector to transform
      dest - will hold the result
      Returns:
      dest
    • transformInverseUnit

      Vector4d transformInverseUnit(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 in dest.

      This will apply the rotation described by this quaternion to the given vector.

      This method is only applicable when this is a unit quaternion.

      Parameters:
      x - the x coordinate of the vector to transform
      y - the y coordinate of the vector to transform
      z - the z coordinate of the vector to transform
      dest - will hold the result
      Returns:
      dest
    • transformUnit

      Vector3f transformUnit(Vector3f vec)
      Transform 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 this is a unit quaternion.

      Parameters:
      vec - the vector to transform
      Returns:
      vec
    • transformInverseUnit

      Vector3f transformInverseUnit(Vector3f vec)
      Transform 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 this is a unit quaternion.

      Parameters:
      vec - the vector to transform
      Returns:
      vec
    • transformPositiveX

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

      Vector4f transformPositiveX(Vector4f dest)
      Transform the vector (1, 0, 0) by this quaternion.

      Only the first three components of the given 4D vector are modified.

      Parameters:
      dest - will hold the result
      Returns:
      dest
    • transformUnitPositiveX

      Vector3f transformUnitPositiveX(Vector3f dest)
      Transform the vector (1, 0, 0) by this unit quaternion.

      This method is only applicable when this is a unit quaternion.

      Reference: https://de.mathworks.com/

      Parameters:
      dest - will hold the result
      Returns:
      dest
    • transformUnitPositiveX

      Vector4f transformUnitPositiveX(Vector4f dest)
      Transform the vector (1, 0, 0) by this unit quaternion.

      Only the first three components of the given 4D vector are modified.

      This method is only applicable when this is a unit quaternion.

      Reference: https://de.mathworks.com/

      Parameters:
      dest - will hold the result
      Returns:
      dest
    • transformPositiveY

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

      Vector4f transformPositiveY(Vector4f dest)
      Transform the vector (0, 1, 0) by this quaternion.

      Only the first three components of the given 4D vector are modified.

      Parameters:
      dest - will hold the result
      Returns:
      dest
    • transformUnitPositiveY

      Vector3f transformUnitPositiveY(Vector3f dest)
      Transform the vector (0, 1, 0) by this unit quaternion.

      This method is only applicable when this is a unit quaternion.

      Reference: https://de.mathworks.com/

      Parameters:
      dest - will hold the result
      Returns:
      dest
    • transformUnitPositiveY

      Vector4f transformUnitPositiveY(Vector4f dest)
      Transform the vector (0, 1, 0) by this unit quaternion.

      Only the first three components of the given 4D vector are modified.

      This method is only applicable when this is a unit quaternion.

      Reference: https://de.mathworks.com/

      Parameters:
      dest - will hold the result
      Returns:
      dest
    • transformPositiveZ

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

      Vector4f transformPositiveZ(Vector4f dest)
      Transform the vector (0, 0, 1) by this quaternion.

      Only the first three components of the given 4D vector are modified.

      Parameters:
      dest - will hold the result
      Returns:
      dest
    • transformUnitPositiveZ

      Vector3f transformUnitPositiveZ(Vector3f dest)
      Transform the vector (0, 0, 1) by this unit quaternion.

      This method is only applicable when this is a unit quaternion.

      Reference: https://de.mathworks.com/

      Parameters:
      dest - will hold the result
      Returns:
      dest
    • transformUnitPositiveZ

      Vector4f transformUnitPositiveZ(Vector4f dest)
      Transform the vector (0, 0, 1) by this unit quaternion.

      Only the first three components of the given 4D vector are modified.

      This method is only applicable when this is a unit quaternion.

      Reference: https://de.mathworks.com/

      Parameters:
      dest - will hold the result
      Returns:
      dest
    • transform

      Vector4f transform(Vector4f vec)
      Transform the given vector by this quaternion.

      This will apply the rotation described by this quaternion to the given vector.

      Only the first three components of the given 4D vector are being used and modified.

      Parameters:
      vec - the vector to transform
      Returns:
      vec
    • transformInverse

      Vector4f transformInverse(Vector4f vec)
      Transform 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.

      Parameters:
      vec - the vector to transform
      Returns:
      vec
    • transform

      Vector3f transform(Vector3fc vec, Vector3f dest)
      Transform the given vector by this quaternion and store the result in dest.

      This will apply the rotation described by this quaternion to the given vector.

      Parameters:
      vec - the vector to transform
      dest - will hold the result
      Returns:
      dest
    • transformInverse

      Vector3f transformInverse(Vector3fc vec, Vector3f dest)
      Transform the given vector by the inverse of this quaternion and store the result in dest.

      This will apply the rotation described by this quaternion to the given vector.

      Parameters:
      vec - the vector to transform
      dest - will hold the result
      Returns:
      dest
    • transform

      Vector3f transform(double x, double y, double z, Vector3f dest)
      Transform the given vector (x, y, z) by this quaternion and store the result in dest.

      This will apply the rotation described by this quaternion to the given vector.

      Parameters:
      x - the x coordinate of the vector to transform
      y - the y coordinate of the vector to transform
      z - the z coordinate of the vector to transform
      dest - will hold the result
      Returns:
      dest
    • transformInverse

      Vector3f transformInverse(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 in dest.

      This will apply the rotation described by this quaternion to the given vector.

      Parameters:
      x - the x coordinate of the vector to transform
      y - the y coordinate of the vector to transform
      z - the z coordinate of the vector to transform
      dest - will hold the result
      Returns:
      dest
    • transform

      Vector4f transform(Vector4fc vec, Vector4f dest)
      Transform the given vector by this quaternion and store the result in dest.

      This will apply the rotation described by this quaternion to the given vector.

      Only the first three components of the given 4D vector are being used and set on the destination.

      Parameters:
      vec - the vector to transform
      dest - will hold the result
      Returns:
      dest
    • transformInverse

      Vector4f transformInverse(Vector4fc vec, Vector4f dest)
      Transform the given vector by the inverse of this quaternion and store the result in dest.

      This will apply the rotation described by this quaternion to the given vector.

      Only the first three components of the given 4D vector are being used and set on the destination.

      Parameters:
      vec - the vector to transform
      dest - will hold the result
      Returns:
      dest
    • transform

      Vector4f transform(double x, double y, double z, Vector4f dest)
      Transform the given vector (x, y, z) by this quaternion and store the result in dest.

      This will apply the rotation described by this quaternion to the given vector.

      Parameters:
      x - the x coordinate of the vector to transform
      y - the y coordinate of the vector to transform
      z - the z coordinate of the vector to transform
      dest - will hold the result
      Returns:
      dest
    • transformInverse

      Vector4f transformInverse(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 in dest.

      This will apply the rotation described by this quaternion to the given vector.

      Parameters:
      x - the x coordinate of the vector to transform
      y - the y coordinate of the vector to transform
      z - the z coordinate of the vector to transform
      dest - will hold the result
      Returns:
      dest
    • transformUnit

      Vector4f transformUnit(Vector4f vec)
      Transform 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 this is a unit quaternion.

      Parameters:
      vec - the vector to transform
      Returns:
      vec
    • transformInverseUnit

      Vector4f transformInverseUnit(Vector4f vec)
      Transform 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 this is a unit quaternion.

      Parameters:
      vec - the vector to transform
      Returns:
      vec
    • transformUnit

      Vector3f transformUnit(Vector3fc vec, Vector3f dest)
      Transform the given vector by this unit quaternion and store the result in dest.

      This will apply the rotation described by this quaternion to the given vector.

      This method is only applicable when this is a unit quaternion.

      Parameters:
      vec - the vector to transform
      dest - will hold the result
      Returns:
      dest
    • transformInverseUnit

      Vector3f transformInverseUnit(Vector3fc vec, Vector3f dest)
      Transform the given vector by the inverse of this unit quaternion and store the result in dest.

      This will apply the rotation described by this quaternion to the given vector.

      This method is only applicable when this is a unit quaternion.

      Parameters:
      vec - the vector to transform
      dest - will hold the result
      Returns:
      dest
    • transformUnit

      Vector3f transformUnit(double x, double y, double z, Vector3f dest)
      Transform the given vector (x, y, z) by this unit quaternion and store the result in dest.

      This will apply the rotation described by this quaternion to the given vector.

      This method is only applicable when this is a unit quaternion.

      Parameters:
      x - the x coordinate of the vector to transform
      y - the y coordinate of the vector to transform
      z - the z coordinate of the vector to transform
      dest - will hold the result
      Returns:
      dest
    • transformInverseUnit

      Vector3f transformInverseUnit(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 in dest.

      This will apply the rotation described by this quaternion to the given vector.

      This method is only applicable when this is a unit quaternion.

      Parameters:
      x - the x coordinate of the vector to transform
      y - the y coordinate of the vector to transform
      z - the z coordinate of the vector to transform
      dest - will hold the result
      Returns:
      dest
    • transformUnit

      Vector4f transformUnit(Vector4fc vec, Vector4f dest)
      Transform the given vector by this unit quaternion and store the result in dest.

      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 this is a unit quaternion.

      Parameters:
      vec - the vector to transform
      dest - will hold the result
      Returns:
      dest
    • transformInverseUnit

      Vector4f transformInverseUnit(Vector4fc vec, Vector4f dest)
      Transform the given vector by the inverse of this unit quaternion and store the result in dest.

      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 this is a unit quaternion.

      Parameters:
      vec - the vector to transform
      dest - will hold the result
      Returns:
      dest
    • transformUnit

      Vector4f transformUnit(double x, double y, double z, Vector4f dest)
      Transform the given vector (x, y, z) by this unit quaternion and store the result in dest.

      This will apply the rotation described by this quaternion to the given vector.

      This method is only applicable when this is a unit quaternion.

      Parameters:
      x - the x coordinate of the vector to transform
      y - the y coordinate of the vector to transform
      z - the z coordinate of the vector to transform
      dest - will hold the result
      Returns:
      dest
    • transformInverseUnit

      Vector4f transformInverseUnit(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 in dest.

      This will apply the rotation described by this quaternion to the given vector.

      This method is only applicable when this is a unit quaternion.

      Parameters:
      x - the x coordinate of the vector to transform
      y - the y coordinate of the vector to transform
      z - the z coordinate of the vector to transform
      dest - will hold the result
      Returns:
      dest
    • invert

      Quaterniond invert(Quaterniond dest)
      Invert this quaternion and store the normalized result in dest.

      If this quaternion is already normalized, then conjugate(Quaterniond) should be used instead.

      Parameters:
      dest - will hold the result
      Returns:
      dest
      See Also:
    • div

      Divide this quaternion by b and store the result in dest.

      The division expressed using the inverse is performed in the following way:

      dest = this * b^-1, where b^-1 is the inverse of b.

      Parameters:
      b - the Quaterniondc to divide this by
      dest - will hold the result
      Returns:
      dest
    • conjugate

      Quaterniond conjugate(Quaterniond dest)
      Conjugate this quaternion and store the result in dest.
      Parameters:
      dest - will hold the result
      Returns:
      dest
    • lengthSquared

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

      Quaterniond slerp(Quaterniondc target, double alpha, Quaterniond dest)
      Interpolate between this unit quaternion and the specified target unit quaternion using spherical linear interpolation using the specified interpolation factor alpha, and store the result in dest.

      This method resorts to non-spherical linear interpolation when the absolute dot product between this and target is below 1E-6.

      Reference: http://fabiensanglard.net

      Parameters:
      target - the target of the interpolation, which should be reached with alpha = 1.0
      alpha - the interpolation factor, within [0..1]
      dest - will hold the result
      Returns:
      dest
    • scale

      Quaterniond scale(double factor, Quaterniond dest)
      Apply scaling to this quaternion, which results in any vector transformed by the quaternion to change its length by the given factor, and store the result in dest.
      Parameters:
      factor - the scaling factor
      dest - will hold the result
      Returns:
      dest
    • integrate

      Quaterniond integrate(double dt, double vx, double vy, double vz, Quaterniond dest)
      Integrate the rotation given by the angular velocity (vx, vy, vz) around the x, y and z axis, respectively, with respect to the given elapsed time delta dt and add the differentiate rotation to the rotation represented by this quaternion and store the result into dest.

      This method pre-multiplies the rotation given by dt and (vx, vy, vz) by this, so the angular velocities are always relative to the local coordinate system of the rotation represented by this quaternion.

      This method is equivalent to calling: rotateLocal(dt * vx, dt * vy, dt * vz, dest)

      Reference: http://physicsforgames.blogspot.de/

      Parameters:
      dt - the delta time
      vx - the angular velocity around the x axis
      vy - the angular velocity around the y axis
      vz - the angular velocity around the z axis
      dest - will hold the result
      Returns:
      dest
    • nlerp

      Quaterniond nlerp(Quaterniondc q, double factor, Quaterniond dest)
      Compute a linear (non-spherical) interpolation of this and the given quaternion q and store the result in dest.

      Reference: http://fabiensanglard.net

      Parameters:
      q - the other quaternion
      factor - the interpolation factor. It is between 0.0 and 1.0
      dest - will hold the result
      Returns:
      dest
    • nlerpIterative

      Quaterniond nlerpIterative(Quaterniondc q, double alpha, double dotThreshold, Quaterniond dest)
      Compute linear (non-spherical) interpolations of this and the given quaternion q iteratively and store the result in dest.

      This method performs a series of small-step nlerp interpolations to avoid doing a costly spherical linear interpolation, like slerp, by subdividing the rotation arc between this and q via non-spherical linear interpolations as long as the absolute dot product of this and q is greater than the given dotThreshold parameter.

      Thanks to @theagentd at http://www.java-gaming.org/ for providing the code.

      Parameters:
      q - the other quaternion
      alpha - the interpolation factor, between 0.0 and 1.0
      dotThreshold - the threshold for the dot product of this and q above which this method performs another iteration of a small-step linear interpolation
      dest - will hold the result
      Returns:
      dest
    • lookAlong

      Quaterniond lookAlong(Vector3dc dir, Vector3dc up, Quaterniond dest)
      Apply a rotation to this quaternion that maps the given direction to the positive Z axis, and store the result in dest.

      Because there are multiple possibilities for such a rotation, this method will choose the one that ensures the given up direction to remain parallel to the plane spanned by the up and dir vectors.

      If Q is this quaternion and R the quaternion representing the specified rotation, then the new quaternion will be Q * R. So when transforming a vector v with the new quaternion by using Q * R * v, the rotation added by this method will be applied first!

      Reference: http://answers.unity3d.com

      Parameters:
      dir - the direction to map to the positive Z axis
      up - the vector which will be mapped to a vector parallel to the plane spanned by the given dir and up
      dest - will hold the result
      Returns:
      dest
      See Also:
    • lookAlong

      Quaterniond lookAlong(double dirX, double dirY, double dirZ, double upX, double upY, double upZ, Quaterniond dest)
      Apply a rotation to this quaternion that maps the given direction to the positive Z axis, and store the result in dest.

      Because there are multiple possibilities for such a rotation, this method will choose the one that ensures the given up direction to remain parallel to the plane spanned by the up and dir vectors.

      If Q is this quaternion and R the quaternion representing the specified rotation, then the new quaternion will be Q * R. So when transforming a vector v with the new quaternion by using Q * R * v, the rotation added by this method will be applied first!

      Reference: http://answers.unity3d.com

      Parameters:
      dirX - the x-coordinate of the direction to look along
      dirY - the y-coordinate of the direction to look along
      dirZ - the z-coordinate of the direction to look along
      upX - the x-coordinate of the up vector
      upY - the y-coordinate of the up vector
      upZ - the z-coordinate of the up vector
      dest - will hold the result
      Returns:
      dest
    • difference

      Quaterniond difference(Quaterniondc other, Quaterniond dest)
      Compute the difference between this and the other quaternion and store the result in dest.

      The difference is the rotation that has to be applied to get from this rotation to other. If T is this, Q is other and D is the computed difference, then the following equation holds:

      T * D = Q

      It is defined as: D = T^-1 * Q, where T^-1 denotes the inverse of T.

      Parameters:
      other - the other quaternion
      dest - will hold the result
      Returns:
      dest
    • rotateTo

      Quaterniond rotateTo(double fromDirX, double fromDirY, double fromDirZ, double toDirX, double toDirY, double toDirZ, Quaterniond dest)
      Apply a rotation to this that rotates the fromDir vector to point along toDir and store the result in dest.

      Since there can be multiple possible rotations, this method chooses the one with the shortest arc.

      If Q is this quaternion and R the quaternion representing the specified rotation, then the new quaternion will be Q * R. So when transforming a vector v with the new quaternion by using Q * R * v, the rotation added by this method will be applied first!

      Reference: stackoverflow.com

      Parameters:
      fromDirX - the x-coordinate of the direction to rotate into the destination direction
      fromDirY - the y-coordinate of the direction to rotate into the destination direction
      fromDirZ - the z-coordinate of the direction to rotate into the destination direction
      toDirX - the x-coordinate of the direction to rotate to
      toDirY - the y-coordinate of the direction to rotate to
      toDirZ - the z-coordinate of the direction to rotate to
      dest - will hold the result
      Returns:
      dest
    • rotateTo

      Quaterniond rotateTo(Vector3dc fromDir, Vector3dc toDir, Quaterniond dest)
      Apply a rotation to this that rotates the fromDir vector to point along toDir and store the result in dest.

      Because there can be multiple possible rotations, this method chooses the one with the shortest arc.

      If Q is this quaternion and R the quaternion representing the specified rotation, then the new quaternion will be Q * R. So when transforming a vector v with the new quaternion by using Q * R * v, the rotation added by this method will be applied first!

      Parameters:
      fromDir - the starting direction
      toDir - the destination direction
      dest - will hold the result
      Returns:
      dest
      See Also:
    • rotateX

      Quaterniond rotateX(double angle, Quaterniond dest)
      Apply a rotation to this quaternion rotating the given radians about the x axis and store the result in dest.

      If Q is this quaternion and R the quaternion representing the specified rotation, then the new quaternion will be Q * R. So when transforming a vector v with the new quaternion by using Q * R * v, the rotation added by this method will be applied first!

      Parameters:
      angle - the angle in radians to rotate about the x axis
      dest - will hold the result
      Returns:
      dest
    • rotateY

      Quaterniond rotateY(double angle, Quaterniond dest)
      Apply a rotation to this quaternion rotating the given radians about the y axis and store the result in dest.

      If Q is this quaternion and R the quaternion representing the specified rotation, then the new quaternion will be Q * R. So when transforming a vector v with the new quaternion by using Q * R * v, the rotation added by this method will be applied first!

      Parameters:
      angle - the angle in radians to rotate about the y axis
      dest - will hold the result
      Returns:
      dest
    • rotateZ

      Quaterniond rotateZ(double angle, Quaterniond dest)
      Apply a rotation to this quaternion rotating the given radians about the z axis and store the result in dest.

      If Q is this quaternion and R the quaternion representing the specified rotation, then the new quaternion will be Q * R. So when transforming a vector v with the new quaternion by using Q * R * v, the rotation added by this method will be applied first!

      Parameters:
      angle - the angle in radians to rotate about the z axis
      dest - will hold the result
      Returns:
      dest
    • rotateLocalX

      Quaterniond rotateLocalX(double angle, Quaterniond dest)
      Apply a rotation to this quaternion rotating the given radians about the local x axis and store the result in dest.

      If Q is this quaternion and R the quaternion representing the specified rotation, then the new quaternion will be R * Q. So when transforming a vector v with the new quaternion by using R * Q * v, the rotation represented by this will be applied first!

      Parameters:
      angle - the angle in radians to rotate about the local x axis
      dest - will hold the result
      Returns:
      dest
    • rotateLocalY

      Quaterniond rotateLocalY(double angle, Quaterniond dest)
      Apply a rotation to this quaternion rotating the given radians about the local y axis and store the result in dest.

      If Q is this quaternion and R the quaternion representing the specified rotation, then the new quaternion will be R * Q. So when transforming a vector v with the new quaternion by using R * Q * v, the rotation represented by this will be applied first!

      Parameters:
      angle - the angle in radians to rotate about the local y axis
      dest - will hold the result
      Returns:
      dest
    • rotateLocalZ

      Quaterniond rotateLocalZ(double angle, Quaterniond dest)
      Apply a rotation to this quaternion rotating the given radians about the local z axis and store the result in dest.

      If Q is this quaternion and R the quaternion representing the specified rotation, then the new quaternion will be R * Q. So when transforming a vector v with the new quaternion by using R * Q * v, the rotation represented by this will be applied first!

      Parameters:
      angle - the angle in radians to rotate about the local z axis
      dest - will hold the result
      Returns:
      dest
    • rotateXYZ

      Quaterniond rotateXYZ(double angleX, double angleY, double angleZ, Quaterniond dest)
      Apply a rotation to this quaternion rotating the given radians about the cartesian base unit axes, called the euler angles using rotation sequence XYZ and store the result in dest.

      This method is equivalent to calling: rotateX(angleX, dest).rotateY(angleY).rotateZ(angleZ)

      If Q is this quaternion and R the quaternion representing the specified rotation, then the new quaternion will be Q * R. So when transforming a vector v with the new quaternion by using Q * R * v, the rotation added by this method will be applied first!

      Parameters:
      angleX - the angle in radians to rotate about the x axis
      angleY - the angle in radians to rotate about the y axis
      angleZ - the angle in radians to rotate about the z axis
      dest - will hold the result
      Returns:
      dest
    • rotateZYX

      Quaterniond rotateZYX(double angleZ, double angleY, double angleX, Quaterniond dest)
      Apply a rotation to this quaternion rotating the given radians about the cartesian base unit axes, called the euler angles, using the rotation sequence ZYX and store the result in dest.

      This method is equivalent to calling: rotateZ(angleZ, dest).rotateY(angleY).rotateX(angleX)

      If Q is this quaternion and R the quaternion representing the specified rotation, then the new quaternion will be Q * R. So when transforming a vector v with the new quaternion by using Q * R * v, the rotation added by this method will be applied first!

      Parameters:
      angleZ - the angle in radians to rotate about the z axis
      angleY - the angle in radians to rotate about the y axis
      angleX - the angle in radians to rotate about the x axis
      dest - will hold the result
      Returns:
      dest
    • rotateYXZ

      Quaterniond rotateYXZ(double angleY, double angleX, double angleZ, Quaterniond dest)
      Apply a rotation to this quaternion rotating the given radians about the cartesian base unit axes, called the euler angles, using the rotation sequence YXZ and store the result in dest.

      This method is equivalent to calling: rotateY(angleY, dest).rotateX(angleX).rotateZ(angleZ)

      If Q is this quaternion and R the quaternion representing the specified rotation, then the new quaternion will be Q * R. So when transforming a vector v with the new quaternion by using Q * R * v, the rotation added by this method will be applied first!

      Parameters:
      angleY - the angle in radians to rotate about the y axis
      angleX - the angle in radians to rotate about the x axis
      angleZ - the angle in radians to rotate about the z axis
      dest - will hold the result
      Returns:
      dest
    • getEulerAnglesXYZ

      Vector3d getEulerAnglesXYZ(Vector3d eulerAngles)
      Get the euler angles in radians in rotation sequence XYZ of this quaternion and store them in the provided parameter eulerAngles.

      The Euler angles are always returned as the angle around X in the Vector3d.x field, the angle around Y in the Vector3d.y field and the angle around Z in the Vector3d.z field of the supplied Vector3d instance.

      Parameters:
      eulerAngles - will hold the euler angles in radians
      Returns:
      the passed in vector
    • getEulerAnglesZYX

      Vector3d getEulerAnglesZYX(Vector3d eulerAngles)
      Get the euler angles in radians in rotation sequence ZYX of this quaternion and store them in the provided parameter eulerAngles.

      The Euler angles are always returned as the angle around X in the Vector3d.x field, the angle around Y in the Vector3d.y field and the angle around Z in the Vector3d.z field of the supplied Vector3d instance.

      Parameters:
      eulerAngles - will hold the euler angles in radians
      Returns:
      the passed in vector
    • getEulerAnglesZXY

      Vector3d getEulerAnglesZXY(Vector3d eulerAngles)
      Get the euler angles in radians in rotation sequence ZXY of this quaternion and store them in the provided parameter eulerAngles.

      The Euler angles are always returned as the angle around X in the Vector3d.x field, the angle around Y in the Vector3d.y field and the angle around Z in the Vector3d.z field of the supplied Vector3d instance.

      Parameters:
      eulerAngles - will hold the euler angles in radians
      Returns:
      the passed in vector
    • getEulerAnglesYXZ

      Vector3d getEulerAnglesYXZ(Vector3d eulerAngles)
      Get the euler angles in radians in rotation sequence YXZ of this quaternion and store them in the provided parameter eulerAngles.

      The Euler angles are always returned as the angle around X in the Vector3d.x field, the angle around Y in the Vector3d.y field and the angle around Z in the Vector3d.z field of the supplied Vector3d instance.

      Parameters:
      eulerAngles - will hold the euler angles in radians
      Returns:
      the passed in vector
    • rotateAxis

      Quaterniond rotateAxis(double angle, double axisX, double axisY, double axisZ, Quaterniond dest)
      Apply a rotation to this quaternion rotating the given radians about the specified axis and store the result in dest.

      If Q is this quaternion and R the quaternion representing the specified rotation, then the new quaternion will be Q * R. So when transforming a vector v with the new quaternion by using Q * R * v, the rotation added by this method will be applied first!

      Parameters:
      angle - the angle in radians to rotate about the specified axis
      axisX - the x coordinate of the rotation axis
      axisY - the y coordinate of the rotation axis
      axisZ - the z coordinate of the rotation axis
      dest - will hold the result
      Returns:
      dest
    • rotateAxis

      Quaterniond rotateAxis(double angle, Vector3dc axis, Quaterniond dest)
      Apply a rotation to this quaternion rotating the given radians about the specified axis and store the result in dest.

      If Q is this quaternion and R the quaternion representing the specified rotation, then the new quaternion will be Q * R. So when transforming a vector v with the new quaternion by using Q * R * v, the rotation added by this method will be applied first!

      Parameters:
      angle - the angle in radians to rotate about the specified axis
      axis - the rotation axis
      dest - will hold the result
      Returns:
      dest
      See Also:
    • positiveX

      Vector3d positiveX(Vector3d dir)
      Obtain the direction of +X before the rotation transformation represented by this quaternion is applied.

      This method is equivalent to the following code:

       Quaterniond inv = new Quaterniond(this).invert();
       inv.transform(dir.set(1, 0, 0));
       
      Parameters:
      dir - will hold the direction of +X
      Returns:
      dir
    • normalizedPositiveX

      Vector3d normalizedPositiveX(Vector3d dir)
      Obtain the direction of +X before the rotation transformation represented by this normalized quaternion is applied. The quaternion must be normalized for this method to work.

      This method is equivalent to the following code:

       Quaterniond inv = new Quaterniond(this).conjugate();
       inv.transform(dir.set(1, 0, 0));
       
      Parameters:
      dir - will hold the direction of +X
      Returns:
      dir
    • positiveY

      Vector3d positiveY(Vector3d dir)
      Obtain the direction of +Y before the rotation transformation represented by this quaternion is applied.

      This method is equivalent to the following code:

       Quaterniond inv = new Quaterniond(this).invert();
       inv.transform(dir.set(0, 1, 0));
       
      Parameters:
      dir - will hold the direction of +Y
      Returns:
      dir
    • normalizedPositiveY

      Vector3d normalizedPositiveY(Vector3d dir)
      Obtain the direction of +Y before the rotation transformation represented by this normalized quaternion is applied. The quaternion must be normalized for this method to work.

      This method is equivalent to the following code:

       Quaterniond inv = new Quaterniond(this).conjugate();
       inv.transform(dir.set(0, 1, 0));
       
      Parameters:
      dir - will hold the direction of +Y
      Returns:
      dir
    • positiveZ

      Vector3d positiveZ(Vector3d dir)
      Obtain the direction of +Z before the rotation transformation represented by this quaternion is applied.

      This method is equivalent to the following code:

       Quaterniond inv = new Quaterniond(this).invert();
       inv.transform(dir.set(0, 0, 1));
       
      Parameters:
      dir - will hold the direction of +Z
      Returns:
      dir
    • normalizedPositiveZ

      Vector3d normalizedPositiveZ(Vector3d dir)
      Obtain the direction of +Z before the rotation transformation represented by this normalized quaternion is applied. The quaternion must be normalized for this method to work.

      This method is equivalent to the following code:

       Quaterniond inv = new Quaterniond(this).conjugate();
       inv.transform(dir.set(0, 0, 1));
       
      Parameters:
      dir - will hold the direction of +Z
      Returns:
      dir
    • conjugateBy

      Quaterniond conjugateBy(Quaterniondc q, Quaterniond dest)
      Conjugate this by the given quaternion q by computing q * this * q^-1 and store the result into dest.
      Parameters:
      q - the Quaterniondc to conjugate this by
      dest - will hold the result
      Returns:
      dest
    • isFinite

      boolean isFinite()
      Determine whether all components are finite floating-point values, that is, they are not NaN and not infinity.
      Returns:
      true if all components are finite floating-point values; false otherwise
    • equals

      boolean equals(Quaterniondc q, double delta)
      Compare the quaternion components of this quaternion with the given quaternion using the given delta and return whether all of them are equal within a maximum difference of delta.

      Please note that this method is not used by any data structure such as ArrayList HashSet or HashMap and their operations, such as ArrayList.contains(Object) or HashSet.remove(Object), since those data structures only use the Object.equals(Object) and Object.hashCode() methods.

      Parameters:
      q - the other quaternion
      delta - the allowed maximum difference
      Returns:
      true whether all of the quaternion components are equal; false otherwise
    • equals

      boolean equals(double x, double y, double z, double w)
      Parameters:
      x - the x component to compare to
      y - the y component to compare to
      z - the z component to compare to
      w - the w component to compare to
      Returns:
      true if all the quaternion components are equal