Class Quaternion

java.lang.Object
javax.vecmath.Tuple4d
javax.vecmath.Quat4d
cz.fidentis.analyst.math.Quaternion
All Implemented Interfaces:
Serializable, Cloneable

public final class Quaternion extends javax.vecmath.Quat4d
This class represents ICP rotation in the form of a quaternion. Primary, it fixes the error (?) in the Quat4d constructor, which normalizes the given coordinates for some reason. Moreover, this extension introduces useful methods that accelerate the ICP calculation a bit.
See Also:
  • Field Summary

    Fields inherited from class javax.vecmath.Tuple4d

    w, x, y, z
  • Constructor Summary

    Constructors
    Constructor
    Description
    Quaternion(double x, double y, double z, double w)
    Builds a quaternion from its components.
    Builds a quaternion from eigenvalue decomposition.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the conjugate quaternion of the instance.
    static Quaternion
    Returns the Hamilton product of two quaternions.
    javax.vecmath.Matrix4d
    Convert a Quaternion to a rotation matrix.

    Methods inherited from class javax.vecmath.Quat4d

    conjugate, conjugate, interpolate, interpolate, inverse, inverse, mul, mul, mulInverse, mulInverse, normalize, normalize, set, set, set, set, set, set

    Methods inherited from class javax.vecmath.Tuple4d

    absolute, absolute, add, add, clamp, clamp, clamp, clamp, clampMax, clampMax, clampMax, clampMax, clampMin, clampMin, clampMin, clampMin, clone, epsilonEquals, equals, equals, get, get, hashCode, interpolate, interpolate, interpolate, interpolate, negate, negate, scale, scale, scaleAdd, scaleAdd, scaleAdd, set, set, set, set, sub, sub, toString

    Methods inherited from class java.lang.Object

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

    • Quaternion

      public Quaternion(double x, double y, double z, double w)
      Builds a quaternion from its components.
      Parameters:
      x - First vector component.
      y - Second vector component.
      z - Third vector component.
      w - Scalar component.
    • Quaternion

      public Quaternion(EigenvalueDecomposition ev)
      Builds a quaternion from eigenvalue decomposition.
      Parameters:
      ev - eigenvalue decomposition.
  • Method Details

    • getConjugate

      public Quaternion getConjugate()
      Returns the conjugate quaternion of the instance. It method is equivalent to calling the Quat4d.conjugate(javax.vecmath.Quat4d) method, but it is more effective and readable when the origin quaternion has to be preserved.
      Returns:
      the conjugate quaternion
    • multiply

      public static Quaternion multiply(Quaternion q1, Quaternion q2)
      Returns the Hamilton product of two quaternions. It is equivalent to q1.mul(q2) of Quat4d. But calling this method it is faster and more readable if the first quaternion has to be preserved (and then cloned first).
      Parameters:
      q1 - First quaternion.
      q2 - Second quaternion.
      Returns:
      the Hamilton product of two quaternions
    • toMatrix

      public javax.vecmath.Matrix4d toMatrix()
      Convert a Quaternion to a rotation matrix. It is equivalent to but a bit faster than calling new Matrix4d(quaternion, new Vector3d(0,0,0), 1);
      Returns:
      a rotation matrix (4x4)