public class Quaternion extends Object
| Constructor and Description | 
|---|
| Quaternion()Creates a new instance of Quaternion | 
| Quaternion(double phi,
          double theta,
          double psi)Creates a new instance of Quaternion based on a set of Euler angles
 This quaternion is equivalent to the product of quaternions for individual
 Euler angle rotations. | 
| Quaternion(double w,
          double x,
          double y,
          double z)Creates a new Quaternion with user specified values | 
| Quaternion(double scalar,
          Vector3D vector)Creates a new Quaternion with user specified values | 
| Quaternion(Hmatrix hMatrix)Creates a new Quaternion based on the rotations specified in a homogeneous
 transformation matrix | 
| Quaternion(Quaternion q2)Creates a new instance of Quaternion that is a copy of an existing quaternion | 
| Quaternion(Vector3D v)Creates a new Quaternion with user specified vector values and a scalar of 0 | 
| Quaternion(Vector3D axis,
          double angle)Creates a new Quaternion based on an axis and angle of rotation | 
| Modifier and Type | Method and Description | 
|---|---|
| Quaternion | add(Quaternion q2)Adds two quaternions together and returns the result | 
| Quaternion | conjugate()Computes the conjugate of the quaternion | 
| void | divideEquals(double divisor)Divides the quaternion by a scalar value and resets the values of this quaternion | 
| double | dotProduct(Quaternion q2)Computes the dot product of this quaternion and another. | 
| void | eulerStep(double p,
         double q,
         double r,
         double timeStep)Rotates the quaternion based on angular velocities (p, q, r) over a specified 
 time step using Euler integration
 NOTE:  Changes the value of this Quaternion rather than returning a new Quaternion | 
| Quaternion | exponential()Computes the exponential of the quaternion (notionally, e to the q power)
 Reference: An Introduction to Representing Rotations in Quaternion Arithmetic
 available at http://www.sjbrown.co.uk/quaternions.html | 
| Vector3D | getVector()Returns the vector portion of the quaternion | 
| double | getW()Returns the w value of the quaternion | 
| double | getX()Returns the x value of the quaternion | 
| double | getY()Returns the y value of the quaternion | 
| double | getZ()Returns the z value of the quaternion | 
| Hmatrix | hMatrix()Computes the homogeneous transformation matrix corresponding to this matrix | 
| Hmatrix | hMatrix(double x,
       double y,
       double z)Computes a homogeneous transformation matrix associated with this quaternion
 and includes a specified translation | 
| Hmatrix | hMatrix(Vector3D translation)Computes a homogeneous transformation matrix associated with this quaternion
 and includes a specified translation | 
| Quaternion | inverse()Computes the inverse of a quaternion | 
| double | length()Computes the Euclidian length of the quaternion | 
| void | minusEquals(Quaternion q2)Subtracts value of a second quaternion to this one (over writes the values of this quaternion) | 
| void | normalize()Normalizes the quaternion to a unit vector | 
| void | plusEquals(Quaternion q2)Adds the value of a second quaternion to this one (over writes the values of this quaternion) | 
| void | postMultEquals(Quaternion q2)Postmultiplies the value of this quaternion by another (over-writes the value of this quaternion) | 
| void | postMultEquals(Vector3D v)Postmultiplies the value of this quaternion by the quaternion value of a 3D vector (0, x, y, z)  (over-writes the value of this quaternion) | 
| Quaternion | postMultiply(Quaternion q2)Multiplies two quaternions together and returns the result | 
| Quaternion | postMultiply(Vector3D v)Postmultiplies the value of this quaternion by the quaternion value of a 3D vector (0, x, y, z) and returns the result | 
| Quaternion | preMultiply(Quaternion q2)Multiplies two quaternions together and returns the result | 
| Quaternion | preMultiply(Vector3D v)Premultiplies the value of this quaternion by the quaternion value of a 3D vector (0, x, y, z) and returns the result | 
| void | preMultTimesEquals(Quaternion q2)Premultiplies the value of this quaternion by another (over-writes the value of this quaternion) | 
| void | preMultTimesEquals(Vector3D v)Premultiplies the value of this quaternion by the quaternion value of a 3D vector (0, x, y, z)  (over-writes the value of this quaternion) | 
| Quaternion | rotate(Quaternion q)Use this quaternion to rotate another | 
| Quaternion | rotate(Vector3D v)Use this quaternion to rotate a 3D vector | 
| double | rotationAngle()Returns the angle of rotation represented by this quaternion | 
| Vector3D | rotationAxis()Returns the axis of rotation (unit vector) of the rotation represented by this quaternion | 
| Quaternion | scalarDivide(double divisor)Divides the quaternion by a scalar value | 
| Quaternion | scalarMultiply(double multiplier)Multiplies the quaternion by a scalar value | 
| void | setValue(double newW,
        double newX,
        double newY,
        double newZ)Resets the value of this Quaternion to new w, x, y, and z values | 
| void | setValue(double newW,
        Vector3D newVector)Resets the value of this Quaternion based on a specified scalar and vector | 
| void | setValue(Quaternion q2)Resets the value of this Quaternion to those of another | 
| void | setVector(Vector3D newVector)Sets the vector portion of the quaternion | 
| void | setW(double newW)Sets the w value of the quaternion | 
| void | setX(double newX)Sets the x value of the quaternion | 
| void | setY(double newY)Sets the y value of the quaternion | 
| void | setZ(double newZ)Sets the z value of the quaternion | 
| Quaternion | slerp(Quaternion qEnd,
     double u)Computes an interpolated quaternion between this one and a specified quaternion using
 spherical-linear interpolation (SLERP) | 
| Quaternion | subtract(Quaternion q2)Subtracts one quaternion from this one and returns the result | 
| void | timesEquals(double multiplier)Multiplies the quaternion by a scalar value and resets the values of this quaternion | 
public Quaternion()
public Quaternion(Quaternion q2)
q2 - quaternion to be copiedpublic Quaternion(double phi,
          double theta,
          double psi)
phi - theta - psi - public Quaternion(double scalar,
          Vector3D vector)
scalar - portion of the quaternion (w)vector - 3D vector portion of the quaternion (x, y, z)public Quaternion(double w,
          double x,
          double y,
          double z)
w - scalar element quaternionx - first element of the 3D vector portion of the quaterniony - second element of the 3D vector portion of the quaternionz - third element of the 3D vector portion of the quaternionpublic Quaternion(Vector3D v)
v - vector value for new quaternionpublic Quaternion(Vector3D axis, double angle)
axis - vector representation of the axis of rotationangle - of rotation specified in radianspublic Quaternion(Hmatrix hMatrix)
hMatrix - homogeneous transformation matrixpublic void setValue(Quaternion q2)
q2 - new Quaternion valuespublic void setValue(double newW,
            double newX,
            double newY,
            double newZ)
newW - newX - newY - newZ - public void setValue(double newW,
            Vector3D newVector)
newW - newVector - public double length()
public Quaternion conjugate()
public Quaternion inverse()
public void normalize()
public Quaternion postMultiply(Quaternion q2)
q2 - quaternion to be multiplied by this one.  The multiplication
           will occur in the order this x q2public void postMultEquals(Quaternion q2)
q2 - quaternion to be multiplied by this one.  The multiplication
           will occur in the order this x q2public Quaternion postMultiply(Vector3D v)
v - vector to be multiplied by this quaternion.  The multiplication
           will occur in the order this x vpublic void postMultEquals(Vector3D v)
v - vector to be multiplied by this one.  The multiplication
           will occur in the order this x vpublic Quaternion preMultiply(Quaternion q2)
q2 - quaternion to be multiplied by this one.  The multiplication
           will occur in the order q2 x thispublic void preMultTimesEquals(Quaternion q2)
q2 - quaternion to be mmultiplied by this onepublic Quaternion preMultiply(Vector3D v)
v - vector to be multiplied by this quaternion.  The multiplication
          will occur in the order v x thispublic void preMultTimesEquals(Vector3D v)
v - vector to be mmultiplied by this one
        multiplication will occur in the order v x thispublic double dotProduct(Quaternion q2)
q2 - quaternion to be multiplied times this onepublic Quaternion add(Quaternion q2)
q2 - quaternion to be addedpublic void plusEquals(Quaternion q2)
q2 - quaternion to be added to this onepublic Quaternion subtract(Quaternion q2)
q2 - quaternion to be addedpublic void minusEquals(Quaternion q2)
q2 - quaternion to be added to this onepublic Quaternion scalarMultiply(double multiplier)
multiplier - scalar multiplepublic void timesEquals(double multiplier)
multiplier - scalar multiplepublic Quaternion scalarDivide(double divisor)
divisor - scalar divisorpublic void divideEquals(double divisor)
divisor - scalar multiplepublic void eulerStep(double p,
             double q,
             double r,
             double timeStep)
p - rotation rate (radians / second) about the body x axisq - rotation rate (radians / second) about the body y axisr - rotation rate (radians / second) about the body z axistimeStep - amount of time for incremental rotationpublic Quaternion rotate(Quaternion q)
q - quaternion to be rotated (most likely in pure vector form, i.e. w = 0)public Quaternion rotate(Vector3D v)
v - vector to be rotatedpublic Vector3D rotationAxis()
public double rotationAngle()
public Quaternion exponential()
public Quaternion slerp(Quaternion qEnd, double u)
qEnd - quaternion at the end of the interpolationu - fraction of the distance between this quaternion and the ending quaternion (0 <= t <= 1)
          If t is outside of the range [0,1], the method should return a value corresponding to
          the quaternion of a rotation beyond qEnd (or before this) along the same trajectorypublic Hmatrix hMatrix()
public Hmatrix hMatrix(Vector3D translation)
translation - public Hmatrix hMatrix(double x, double y, double z)
x - position of the translationy - position of the translationz - position of the translationpublic Vector3D getVector()
public double getX()
public double getY()
public double getZ()
public double getW()
public void setVector(Vector3D newVector)
newVector - public void setX(double newX)
newX - public void setY(double newY)
newY - public void setZ(double newZ)
newZ - public void setW(double newW)
newW -