Package javax.vecmath

Class Quat4f

All Implemented Interfaces:
Serializable, Cloneable

public class Quat4f extends Tuple4f implements Serializable
A 4 element unit quaternion represented by single precision floating point x,y,z,w coordinates. The quaternion is always normalized.
See Also:
  • Field Summary

    Fields inherited from class javax.vecmath.Tuple4f

    w, x, y, z
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs and initializes a Quat4f to (0.0,0.0,0.0,0.0).
    Quat4f(float[] q)
    Constructs and initializes a Quat4f from the array of length 4.
    Quat4f(float x, float y, float z, float w)
    Constructs and initializes a Quat4f from the specified xyzw coordinates.
    Constructs and initializes a Quat4f from the specified Quat4d.
    Constructs and initializes a Quat4f from the specified Quat4f.
    Constructs and initializes a Quat4f from the specified Tuple4d.
    Constructs and initializes a Quat4f from the specified Tuple4f.
  • Method Summary

    Modifier and Type
    Method
    Description
    final void
    Sets the value of this quaternion to the conjugate of itself.
    final void
    Sets the value of this quaternion to the conjugate of quaternion q1.
    final void
    interpolate(Quat4f q1, float alpha)
    Performs a great circle interpolation between this quaternion and the quaternion parameter and places the result into this quaternion.
    final void
    interpolate(Quat4f q1, Quat4f q2, float alpha)
    Performs a great circle interpolation between quaternion q1 and quaternion q2 and places the result into this quaternion.
    final void
    Sets the value of this quaternion to the quaternion inverse of itself.
    final void
    Sets the value of this quaternion to quaternion inverse of quaternion q1.
    final void
    mul(Quat4f q1)
    Sets the value of this quaternion to the quaternion product of itself and q1 (this = this * q1).
    final void
    mul(Quat4f q1, Quat4f q2)
    Sets the value of this quaternion to the quaternion product of quaternions q1 and q2 (this = q1 * q2).
    final void
    Multiplies this quaternion by the inverse of quaternion q1 and places the value into this quaternion.
    final void
    Multiplies quaternion q1 by the inverse of quaternion q2 and places the value into this quaternion.
    final void
    Normalizes the value of this quaternion in place.
    final void
    Sets the value of this quaternion to the normalized value of quaternion q1.
    final void
    Sets the value of this quaternion to the equivalent rotation of the AxisAngle argument.
    final void
    Sets the value of this quaternion to the equivalent rotation of the AxisAngle argument.
    final void
    Sets the value of this quaternion to the rotational component of the passed matrix.
    final void
    Sets the value of this quaternion to the rotational component of the passed matrix.
    final void
    Sets the value of this quaternion to the rotational component of the passed matrix.
    final void
    Sets the value of this quaternion to the rotational component of the passed matrix.

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Quat4f

      public Quat4f(float x, float y, float z, float w)
      Constructs and initializes a Quat4f from the specified xyzw coordinates.
      Parameters:
      x - the x coordinate
      y - the y coordinate
      z - the z coordinate
      w - the w scalar component
    • Quat4f

      public Quat4f(float[] q)
      Constructs and initializes a Quat4f from the array of length 4.
      Parameters:
      q - the array of length 4 containing xyzw in order
    • Quat4f

      public Quat4f(Quat4f q1)
      Constructs and initializes a Quat4f from the specified Quat4f.
      Parameters:
      q1 - the Quat4f containing the initialization x y z w data
    • Quat4f

      public Quat4f(Quat4d q1)
      Constructs and initializes a Quat4f from the specified Quat4d.
      Parameters:
      q1 - the Quat4d containing the initialization x y z w data
    • Quat4f

      public Quat4f(Tuple4f t1)
      Constructs and initializes a Quat4f from the specified Tuple4f.
      Parameters:
      t1 - the Tuple4f containing the initialization x y z w data
    • Quat4f

      public Quat4f(Tuple4d t1)
      Constructs and initializes a Quat4f from the specified Tuple4d.
      Parameters:
      t1 - the Tuple4d containing the initialization x y z w data
    • Quat4f

      public Quat4f()
      Constructs and initializes a Quat4f to (0.0,0.0,0.0,0.0).
  • Method Details

    • conjugate

      public final void conjugate(Quat4f q1)
      Sets the value of this quaternion to the conjugate of quaternion q1.
      Parameters:
      q1 - the source vector
    • conjugate

      public final void conjugate()
      Sets the value of this quaternion to the conjugate of itself.
    • mul

      public final void mul(Quat4f q1, Quat4f q2)
      Sets the value of this quaternion to the quaternion product of quaternions q1 and q2 (this = q1 * q2). Note that this is safe for aliasing (e.g. this can be q1 or q2).
      Parameters:
      q1 - the first quaternion
      q2 - the second quaternion
    • mul

      public final void mul(Quat4f q1)
      Sets the value of this quaternion to the quaternion product of itself and q1 (this = this * q1).
      Parameters:
      q1 - the other quaternion
    • mulInverse

      public final void mulInverse(Quat4f q1, Quat4f q2)
      Multiplies quaternion q1 by the inverse of quaternion q2 and places the value into this quaternion. The value of both argument quaternions is preservered (this = q1 * q2^-1).
      Parameters:
      q1 - the first quaternion
      q2 - the second quaternion
    • mulInverse

      public final void mulInverse(Quat4f q1)
      Multiplies this quaternion by the inverse of quaternion q1 and places the value into this quaternion. The value of the argument quaternion is preserved (this = this * q^-1).
      Parameters:
      q1 - the other quaternion
    • inverse

      public final void inverse(Quat4f q1)
      Sets the value of this quaternion to quaternion inverse of quaternion q1.
      Parameters:
      q1 - the quaternion to be inverted
    • inverse

      public final void inverse()
      Sets the value of this quaternion to the quaternion inverse of itself.
    • normalize

      public final void normalize(Quat4f q1)
      Sets the value of this quaternion to the normalized value of quaternion q1.
      Parameters:
      q1 - the quaternion to be normalized.
    • normalize

      public final void normalize()
      Normalizes the value of this quaternion in place.
    • set

      public final void set(Matrix4f m1)
      Sets the value of this quaternion to the rotational component of the passed matrix.
      Parameters:
      m1 - the Matrix4f
    • set

      public final void set(Matrix4d m1)
      Sets the value of this quaternion to the rotational component of the passed matrix.
      Parameters:
      m1 - the Matrix4d
    • set

      public final void set(Matrix3f m1)
      Sets the value of this quaternion to the rotational component of the passed matrix.
      Parameters:
      m1 - the Matrix3f
    • set

      public final void set(Matrix3d m1)
      Sets the value of this quaternion to the rotational component of the passed matrix.
      Parameters:
      m1 - the Matrix3d
    • set

      public final void set(AxisAngle4f a)
      Sets the value of this quaternion to the equivalent rotation of the AxisAngle argument.
      Parameters:
      a - the AxisAngle to be emulated
    • set

      public final void set(AxisAngle4d a)
      Sets the value of this quaternion to the equivalent rotation of the AxisAngle argument.
      Parameters:
      a - the AxisAngle to be emulated
    • interpolate

      public final void interpolate(Quat4f q1, float alpha)
      Performs a great circle interpolation between this quaternion and the quaternion parameter and places the result into this quaternion.
      Parameters:
      q1 - the other quaternion
      alpha - the alpha interpolation parameter
    • interpolate

      public final void interpolate(Quat4f q1, Quat4f q2, float alpha)
      Performs a great circle interpolation between quaternion q1 and quaternion q2 and places the result into this quaternion.
      Parameters:
      q1 - the first quaternion
      q2 - the second quaternion
      alpha - the alpha interpolation parameter