cynosurex.math
Class Quaternion

java.lang.Object
  extended by cynosurex.math.Quaternion
All Implemented Interfaces:
cynosurex.internal.AuthorCommon, cynosurex.internal.CommonInterface, cynosurex.internal.CompanyCommon

public class Quaternion
extends java.lang.Object
implements cynosurex.internal.CommonInterface


Field Summary
protected  double w
           
protected  double x
           
protected  double y
           
protected  double z
           
 
Fields inherited from interface cynosurex.internal.CommonInterface
copyright, copyrightYears, notice, program, version
 
Fields inherited from interface cynosurex.internal.AuthorCommon
author, copyrightSymbol, noticeMsg, rights
 
Fields inherited from interface cynosurex.internal.CompanyCommon
company, email, website
 
Constructor Summary
Quaternion(double s, double[] v)
          Constructor to create a Quaternion from a vector array.
Quaternion(double w, double x, double y, double z)
          Constructor to create a Quaternion.
Quaternion(double s, Vector v)
          Constructor to create a Quaternion from a Vector.
 
Method Summary
static Quaternion addition(Quaternion q1, Quaternion q2)
          Static method to add two Quaternions together.
 void conjugate()
          Conjugates the current Quaternion.
 Angle getAngle()
          Returns the angle this Quaternion represents.
 Quaternion getConjugate()
          Returns the conjugate of the Quaternion.
 double getMagnitude()
          Returns the magnitude of the Quaternion.
 double getS()
          Returns the scalar component (same as w) of the Quaternion.
 Vector getVector()
          Returns the Vector component of the Quaternion.
 double getW()
          Returns the w component of the Quaternion.
 double getX()
          Returns the x component of the Quaternion.
 double getY()
          Returns the y component of the Quaternion.
 double getZ()
          Returns the z component of the Quaternion.
static Quaternion product(Quaternion q1, Quaternion q2)
          Static method to calculate the product of two Quaternions.
 java.lang.String toString()
          Overrides the super class method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

w

protected double w

x

protected double x

y

protected double y

z

protected double z
Constructor Detail

Quaternion

public Quaternion(double w,
                  double x,
                  double y,
                  double z)
Constructor to create a Quaternion. q = w + xi + yj + zk


Quaternion

public Quaternion(double s,
                  Vector v)
Constructor to create a Quaternion from a Vector. q = (s, v)

Parameters:
s - scalar value (same as w)
v - vector with three dimensions

Quaternion

public Quaternion(double s,
                  double[] v)
Constructor to create a Quaternion from a vector array.

Parameters:
s - scalar value (same as w)
v - array with three elements
Method Detail

addition

public static Quaternion addition(Quaternion q1,
                                  Quaternion q2)
Static method to add two Quaternions together.

Parameters:
q1 - Quaternion 1
q2 - Quaternion 2

product

public static Quaternion product(Quaternion q1,
                                 Quaternion q2)
Static method to calculate the product of two Quaternions.

Parameters:
q1 - Quaternion 1
q2 - Quaternion 2

getAngle

public Angle getAngle()
Returns the angle this Quaternion represents.


getW

public double getW()
Returns the w component of the Quaternion.


getS

public double getS()
Returns the scalar component (same as w) of the Quaternion.


getX

public double getX()
Returns the x component of the Quaternion.


getY

public double getY()
Returns the y component of the Quaternion.


getZ

public double getZ()
Returns the z component of the Quaternion.


getVector

public Vector getVector()
Returns the Vector component of the Quaternion.


getMagnitude

public double getMagnitude()
Returns the magnitude of the Quaternion.


getConjugate

public Quaternion getConjugate()
Returns the conjugate of the Quaternion.


conjugate

public void conjugate()
Conjugates the current Quaternion.


toString

public java.lang.String toString()
Overrides the super class method.

Overrides:
toString in class java.lang.Object