Class Rotation


  • public class Rotation
    extends java.lang.Object
    This class represent a Rotation. The data are stored as an unitary quaternion [a; b; c; d]. A rotation of an angle alpha along the vector [x; y; z] is stored thus : a = cos (alpha / 2) b = sin (alpha / 2) * nx c = sin (alpha / 2) * ny d = sin (alpha / 2) * nz Where [nx; ny; nz] is [x; y; z] / norm([x; y; z]).
    Author:
    Pierre Lando
    • Constructor Detail

      • Rotation

        public Rotation()
        Default constructor. The created object represent identity rotation.
      • Rotation

        public Rotation​(Rotation r)
        Copy constructor. The created object is a copy of the given rotation r.
        Parameters:
        r - the given rotation.
      • Rotation

        public Rotation​(double alpha,
                        Vector3d v)
        The created object represent a rotation of an angle of 'alpha' radians along the vector 'v'.
        Parameters:
        alpha - the rotation angle in radians.
        v - the vector carrying the rotation.
      • Rotation

        public Rotation​(double alpha,
                        Vector3f v)
        The created object represent a rotation of an angle of 'alpha' radians along the vector 'v'.
        Parameters:
        alpha - the rotation angle in radians.
        v - the vector carrying the rotation.
      • Rotation

        public Rotation​(float[] v)
      • Rotation

        public Rotation​(double[] v)
    • Method Detail

      • getDegreeRotation

        public static Rotation getDegreeRotation​(double alpha,
                                                 Vector3d v)
        Get a rotation from an angle alpha given in degree and an axis v
        Parameters:
        alpha - angle of rotation in degree
        v - the axis of the rotation
        Returns:
        a Rotation object For information, the function has been written to fix bug 11399. For angle (in radians) close to Pi the Rotation has a 'a' close to 0 and that conflicts with small axes where length is closed to a: rounding errors led to a "bad" transformation matrix (AxesDrawer::computeBoxTransformation).
      • getInverse

        public Rotation getInverse()
        Return the inverse rotation.
        Returns:
        the inverse rotation.
      • isIdentity

        public boolean isIdentity()
        Return true if this object represents an identity transformation.
        Returns:
        true if this object represents an identity transformation.
      • getRotationMatrix

        public double[] getRotationMatrix()
      • getUnRotateMatrix

        public double[] getUnRotateMatrix()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getVectorY

        public Vector3d getVectorY()
      • power

        public Rotation power​(double p)
      • getData

        public double[] getData()
      • getDataAsFloatArray

        public float[] getDataAsFloatArray()
      • hashCode

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

        public boolean equals​(Rotation r2)