Quaternion
jsci.maths

Class Quaternion

    • Constructor Detail

      • Quaternion

        public Quaternion(double real,          Double3Vector imag)
        Constructs a quaternion.
      • Quaternion

        public Quaternion(double q0,          double q1,          double q2,          double q3)
        Constructs the quaternion q0+iq1+jq2+kq3.
    • Method Detail

      • rotation

        public static Quaternion rotation(AbstractDoubleSquareMatrix m)
        Constructs a quaternion representing a rotation matrix. Note: if the matrix is not orthogonal then the quaternion will not have unit norm. Note: unit quaternions are a double cover of SO(3).
        Parameters:
        m - a rotation matrix
      • toRotationMatrix

        public AbstractDoubleSquareMatrix toRotationMatrix()
        Returns a 3D rotation matrix representing this quaternion. Note: if this quaternion does not have unit norm then the matrix will not be orthogonal.
      • equals

        public boolean equals(Object obj)
        Compares two quaternions for equality.
        Overrides:
        equals in class Object
        Parameters:
        obj - a quaternion
      • toString

        public String toString()
        Returns a string representing the value of this quaternion.
        Overrides:
        toString in class Object
      • hashCode

        public int hashCode()
        Returns a hashcode for this quaternion.
        Overrides:
        hashCode in class Object
      • isNaN

        public boolean isNaN()
        Returns true if either the real or imaginary part is NaN.
      • isInfinite

        public boolean isInfinite()
        Returns true if either the real or imaginary part is infinite.
      • real

        public double real()
        Returns the real part of this quaternion.
      • imag

        public Double3Vector imag()
        Returns the imaginary part of this quaternion.
      • norm

        public double norm()
        Returns the l2-norm (magnitude), which is also the C* norm.
        Specified by:
        norm in interface BanachSpace.Member
      • sumSquares

        public double sumSquares()
        Returns the sum of the squares of the components.
      • conjugate

        public Quaternion conjugate()
        Returns the conjugate of this quaternion.
      • add

        public Quaternion add(Quaternion q)
        Returns the addition of this quaternion and another.
        Parameters:
        q - a quaternion
      • addReal

        public Quaternion addReal(double real)
        Returns the addition of this quaternion with a real part.
        Parameters:
        real - a real part
      • addImag

        public Quaternion addImag(Double3Vector imag)
        Returns the addition of this quaternion with an imaginary part.
        Parameters:
        imag - an imaginary part
      • subtract

        public Quaternion subtract(Quaternion q)
        Returns the subtraction of this quaternion by another.
        Parameters:
        q - a quaternion
      • subtractReal

        public Quaternion subtractReal(double real)
        Returns the subtraction of this quaternion by a real part.
        Parameters:
        real - a real part
      • subtractImag

        public Quaternion subtractImag(Double3Vector imag)
        Returns the subtraction of this quaternion by an imaginary part.
        Parameters:
        imag - an imaginary part
      • multiply

        public Quaternion multiply(Quaternion q)
        Returns the multiplication of this quaternion and another.
        Parameters:
        q - a quaternion
      • multiply

        public Quaternion multiply(double x)
        Returns the multiplication of this quaternion by a scalar.
        Parameters:
        x - a real number
      • divide

        public Quaternion divide(double x)
        Returns the division of this quaternion by a scalar.
        Parameters:
        x - a real number
        Throws:
        ArithmeticException - If divide by zero.

SCaVis 2.1 © jWork.ORG