com.jbergin.util
Class QuaternionCalculator

java.lang.Object
  extended by com.jbergin.util.QuaternionCalculator

public class QuaternionCalculator
extends java.lang.Object

Add and multiply open quaternions (the built in quaternion class doesn't have available coefficients.

Author:
Joseph Bergin

Constructor Summary
QuaternionCalculator()
           
 
Method Summary
static OpenQuaternion add(OpenQuaternion left, OpenQuaternion right)
          Add two open quaternions.
static OpenQuaternion multiply(OpenQuaternion left, OpenQuaternion right)
          Multiply two open quaternions
static OpenQuaternion rotationAboutX(double angleDegrees)
          Compute an open quaternion for a given rotation (in degrees) around the X axis
static OpenQuaternion rotationAboutY(double angleDegrees)
          Compute an open quaternion for a given rotation (in degrees) around the Y axis
static OpenQuaternion rotationAboutZ(double angleDegrees)
          Compute an open quaternion for a given rotation (in degrees) around the Z axis
static Quaternion toQuaternion(OpenQuaternion from)
          Obtain an ordinary Quaternion from an open one.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QuaternionCalculator

public QuaternionCalculator()
Method Detail

rotationAboutX

public static OpenQuaternion rotationAboutX(double angleDegrees)
Compute an open quaternion for a given rotation (in degrees) around the X axis

Parameters:
angleDegrees -
Returns:
the quaternion representing this rotation.

rotationAboutY

public static OpenQuaternion rotationAboutY(double angleDegrees)
Compute an open quaternion for a given rotation (in degrees) around the Y axis

Parameters:
angleDegrees -
Returns:
the quaternion representing this rotation.

rotationAboutZ

public static OpenQuaternion rotationAboutZ(double angleDegrees)
Compute an open quaternion for a given rotation (in degrees) around the Z axis

Parameters:
angleDegrees -
Returns:
the quaternion representing this rotation.

multiply

public static OpenQuaternion multiply(OpenQuaternion left,
                                      OpenQuaternion right)
Multiply two open quaternions

Parameters:
left - the left factor
right - the right factor
Returns:
the result of the multiplication.

add

public static OpenQuaternion add(OpenQuaternion left,
                                 OpenQuaternion right)
Add two open quaternions.

Parameters:
left - the left term
right - the right term
Returns:
the sum

toQuaternion

public static Quaternion toQuaternion(OpenQuaternion from)
Obtain an ordinary Quaternion from an open one.

Parameters:
from - the open quaternion
Returns:
the ordinary quaternion with the same coefficents.