Package org.joml

Class AxisAngle4f

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

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

    This class uses single-precision components.

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

      • angle

        public float angle
        The angle in radians.
      • x

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

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

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

      • AxisAngle4f

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

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

        public AxisAngle4f​(float angle,
                           float x,
                           float y,
                           float z)
        Create a new AxisAngle4f 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
      • AxisAngle4f

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

      • set

        public AxisAngle4f set​(float angle,
                               float x,
                               float y,
                               float z)
        Set this AxisAngle4f 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
      • 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 AxisAngle4f normalize()
        Normalize the axis vector.
        Returns:
        this
      • rotate

        public AxisAngle4f rotate​(float 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 Vector3f transform​(Vector3f v)
        Transform the given vector by the rotation transformation described by this AxisAngle4f.
        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 AxisAngle4f and store the result in dest.
        Parameters:
        v - the vector to transform
        dest - will hold the result
        Returns:
        dest
      • transform

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

        public Vector4f transform​(Vector4fc v,
                                  Vector4f dest)
        Transform the given vector by the rotation transformation described by this AxisAngle4f 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 AxisAngle4f.

        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 AxisAngle4f 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