Package org.joml

Class AxisAngle4d

  • All Implemented Interfaces:
    java.io.Externalizable, java.io.Serializable, java.lang.Cloneable

    public class AxisAngle4d
    extends java.lang.Object
    implements java.io.Externalizable, java.lang.Cloneable
    Represents a 3D rotation of a given radians about an axis represented as an unit 3D vector.

    This class uses double-precision components.

    Author:
    Kai Burjack
    See Also:
    Serialized Form
    • Field Detail

      • angle

        public double angle
        The angle in radians.
      • x

        public double x
        The x-component of the rotation axis.
      • y

        public double y
        The y-component of the rotation axis.
      • z

        public double z
        The z-component of the rotation axis.
    • Constructor Detail

      • AxisAngle4d

        public AxisAngle4d()
        Create a new AxisAngle4d with zero rotation about (0, 0, 1).
      • AxisAngle4d

        public AxisAngle4d​(AxisAngle4d a)
        Create a new AxisAngle4d with the same values of a.
        Parameters:
        a - the AngleAxis4d to copy the values from
      • AxisAngle4d

        public AxisAngle4d​(AxisAngle4f a)
        Create a new AxisAngle4d with the same values of a.
        Parameters:
        a - the AngleAxis4f to copy the values from
      • AxisAngle4d

        public AxisAngle4d​(double angle,
                           double x,
                           double y,
                           double z)
        Create a new AxisAngle4d with the given values.
        Parameters:
        angle - the angle in radians
        x - the x-coordinate of the rotation axis
        y - the y-coordinate of the rotation axis
        z - the z-coordinate of the rotation axis
      • AxisAngle4d

        public AxisAngle4d​(double angle,
                           Vector3dc v)
        Create a new AxisAngle4d with the given values.
        Parameters:
        angle - the angle in radians
        v - the rotation axis as a Vector3dc
      • AxisAngle4d

        public AxisAngle4d​(double angle,
                           Vector3f v)
        Create a new AxisAngle4d with the given values.
        Parameters:
        angle - the angle in radians
        v - the rotation axis as a Vector3f
    • Method Detail

      • set

        public AxisAngle4d set​(double angle,
                               double x,
                               double y,
                               double z)
        Set this AxisAngle4d to the given values.
        Parameters:
        angle - the angle in radians
        x - the x-coordinate of the rotation axis
        y - the y-coordinate of the rotation axis
        z - the z-coordinate of the rotation axis
        Returns:
        this
      • set

        public AxisAngle4d set​(double angle,
                               Vector3f v)
        Set this AxisAngle4d to the given values.
        Parameters:
        angle - the angle in radians
        v - the rotation axis as a Vector3f
        Returns:
        this
      • writeExternal

        public void writeExternal​(java.io.ObjectOutput out)
                           throws java.io.IOException
        Specified by:
        writeExternal in interface java.io.Externalizable
        Throws:
        java.io.IOException
      • readExternal

        public void readExternal​(java.io.ObjectInput in)
                          throws java.io.IOException,
                                 java.lang.ClassNotFoundException
        Specified by:
        readExternal in interface java.io.Externalizable
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException
      • normalize

        public AxisAngle4d normalize()
        Normalize the axis vector.
        Returns:
        this
      • rotate

        public AxisAngle4d rotate​(double ang)
        Increase the rotation angle by the given amount.

        This method also takes care of wrapping around.

        Parameters:
        ang - the angle increase
        Returns:
        this
      • transform

        public Vector3d transform​(Vector3d v)
        Transform the given vector by the rotation transformation described by this AxisAngle4d.
        Parameters:
        v - the vector to transform
        Returns:
        v
      • transform

        public Vector3d transform​(Vector3dc v,
                                  Vector3d dest)
        Transform the given vector by the rotation transformation described by this AxisAngle4d and store the result in dest.
        Parameters:
        v - the vector to transform
        dest - will hold the result
        Returns:
        dest
      • transform

        public Vector3f transform​(Vector3f v)
        Transform the given vector by the rotation transformation described by this AxisAngle4d.
        Parameters:
        v - the vector to transform
        Returns:
        v
      • transform

        public Vector3f transform​(Vector3fc v,
                                  Vector3f dest)
        Transform the given vector by the rotation transformation described by this AxisAngle4d and store the result in dest.
        Parameters:
        v - the vector to transform
        dest - will hold the result
        Returns:
        dest
      • transform

        public Vector4d transform​(Vector4d v)
        Transform the given vector by the rotation transformation described by this AxisAngle4d.
        Parameters:
        v - the vector to transform
        Returns:
        v
      • transform

        public Vector4d transform​(Vector4dc v,
                                  Vector4d dest)
        Transform the given vector by the rotation transformation described by this AxisAngle4d and store the result in dest.
        Parameters:
        v - the vector to transform
        dest - will hold the result
        Returns:
        dest
      • toString

        public java.lang.String toString()
        Return a string representation of this AxisAngle4d.

        This method creates a new DecimalFormat on every invocation with the format string " 0.000E0;-".

        Overrides:
        toString in class java.lang.Object
        Returns:
        the string representation
      • toString

        public java.lang.String toString​(java.text.NumberFormat formatter)
        Return a string representation of this AxisAngle4d by formatting the components with the given NumberFormat.
        Parameters:
        formatter - the NumberFormat used to format the vector components with
        Returns:
        the string representation
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • clone

        public java.lang.Object clone()
                               throws java.lang.CloneNotSupportedException
        Overrides:
        clone in class java.lang.Object
        Throws:
        java.lang.CloneNotSupportedException