Class iicm.utils3d.Quaternion
All Packages  Class Hierarchy  This Package  Previous  Next  Index
  Class iicm.utils3d.Quaternion
java.lang.Object
   |
   +----iicm.utils3d.Quaternion
  -  public class Quaternion
  -  extends Object
Quaternion - quaternion used to describe rotations/orientations
Copyright (c) 1996,97 IICM
   
  -   Quaternion() Quaternion()
-  default: "identity" quaternion (angle 0, any axis)
  
-   Quaternion(float[], float) Quaternion(float[], float)
-  create a quaternion with a normalized axis and angle
  
-   Quaternion(int, float[]) Quaternion(int, float[])
-  create a quaternion.
  
-   Quaternion(Quaternion) Quaternion(Quaternion)
-  copy constructor
   
  -   getAxisAngle() getAxisAngle()
-  convert quaternion to normalized axis and angle
  
-   levelize() levelize()
-  make the quaternion represent a rotation around (0, +/-1, 0);
i.e.
  
-   multiply(Quaternion) multiply(Quaternion)
-  multiply this quaternion (q0) with another (q1) from the right side.
  
-   multiplyLeft(Quaternion) multiplyLeft(Quaternion)
-  multiply this quaternion (q0) with another (q1) from the left side.
  
-   product(Quaternion, Quaternion) product(Quaternion, Quaternion)
-  calculate the product of two quaternions (both q0, q1 unchanged).
  
-   renormalize() renormalize()
-  ensure the quaternion stays normalized.
  
-   reset() reset()
-  back to the "identity" quaternion
  
-   rotatePointCenter(float[], float[]) rotatePointCenter(float[], float[])
-  rotate a point p about an arbitrary center c by the quaternion,
i.e.
  
-   rotateVector(float[]) rotateVector(float[])
-  rotate a vector by the quaternion;
the result will be normalized if the input vector was;
the input vector will not be changed
  
-   rotationAxisToVector(int, float[]) rotationAxisToVector(int, float[])
-  get the rotation (normalized axis and angle) that rotates a
coordinate axis (given by number) to another (normalized) vector.
  
-   rotationBetweenVectors(float[], float[]) rotationBetweenVectors(float[], float[])
-  get the rotation (normalized axis and angle) that rotates vector a
to vector b.
  
-   slerp(Quaternion, Quaternion, float) slerp(Quaternion, Quaternion, float)
-  spherical linear interpolation.
  
-   transformAxis(int) transformAxis(int)
-  transform (rotate) an axis by the quaternion
  
-   untilt() untilt()
-  make the quaternion represent tilt-free rotation (no z part)
   
 Quaternion
Quaternion
  public Quaternion()
  -  default: "identity" quaternion (angle 0, any axis)
 Quaternion
Quaternion
  public Quaternion(float axis[],
                    float angle)
  -  create a quaternion with a normalized axis and angle
 Quaternion
Quaternion
  public Quaternion(int offset,
                    float arr[])
  -  create a quaternion. take normalized axis and angle
out of an array, starting at offset position.
 Quaternion
Quaternion
  public Quaternion(Quaternion q)
  -  copy constructor
   
 rotationBetweenVectors
rotationBetweenVectors
  public static float[] rotationBetweenVectors(float a[],
                                               float b[])
  -  get the rotation (normalized axis and angle) that rotates vector a
to vector b. a and b should be normalized
  
    -  See Also:
    
-  rotationAxisToVector
  
 
 rotationAxisToVector
rotationAxisToVector
  public static float[] rotationAxisToVector(int num,
                                             float v[])
  -  get the rotation (normalized axis and angle) that rotates a
coordinate axis (given by number) to another (normalized) vector.
e.g. rotationAxisToVector (2, negativenormalizedlookatvector) gives
you the orientation axis/angle values of a VRML viewpoint.
  
    -  See Also:
    
-  rotationBetweenVectors
  
 
 reset
reset
  public final void reset()
  -  back to the "identity" quaternion
 levelize
levelize
  public void levelize()
  -  make the quaternion represent a rotation around (0, +/-1, 0);
i.e. on the same "level"
 untilt
untilt
  public void untilt()
  -  make the quaternion represent tilt-free rotation (no z part)
 renormalize
renormalize
  public final void renormalize()
  -  ensure the quaternion stays normalized.
Useful e.g. after several mulitplications
 getAxisAngle
getAxisAngle
  public final float[] getAxisAngle()
  -  convert quaternion to normalized axis and angle
 product
product
  public final static Quaternion product(Quaternion q0,
                                         Quaternion q1)
  -  calculate the product of two quaternions (both q0, q1 unchanged).
when q0 and q1 represent rotations, the result is q0 done after q1.
  
    -  Returns:
    
-  q0 * q1 (multiplication non commutative)
  
 
 multiply
multiply
  public final void multiply(Quaternion q1)
  -  multiply this quaternion (q0) with another (q1) from the right side.
q0 = q0 * q1 (multiplication non commutative), having the effect of
preconcatening the rotation q1 to this one
 multiplyLeft
multiplyLeft
  public final void multiplyLeft(Quaternion q1)
  -  multiply this quaternion (q0) with another (q1) from the left side.
q0 = q1 * q0 (multiplication non commutative), having the effect of
postconcatening the rotation q1 to this one
 slerp
slerp
  public static Quaternion slerp(Quaternion q1,
                                 Quaternion q2,
                                 float t)
  -  spherical linear interpolation. return a quaternion that lies "at
t between q1 and q2", i.e. q1 for t == 0, q2 for t == 1 and an
interpolation of q1 and q2 for values between 0 and 1.
remind that q and -q describe the same rotation, thus interpolate
to -q2 if path to it is shorter than to q2.
 transformAxis
transformAxis
  public float[] transformAxis(int num)
  -  transform (rotate) an axis by the quaternion
  
    -  Parameters:
    
-  i - no. of the axis (0 for x, 1 for y, 2 for z)
    
-  Returns:
    
-  the transformed axis (unit length)
  
 
 rotateVector
rotateVector
  public float[] rotateVector(float v[])
  -  rotate a vector by the quaternion;
the result will be normalized if the input vector was;
the input vector will not be changed
 rotatePointCenter
rotatePointCenter
  public float[] rotatePointCenter(float v[],
                                   float c[])
  -  rotate a point p about an arbitrary center c by the quaternion,
i.e. add (the rotated vector from c to p) to c.
  
    -  See Also:
    
-  rotateVector
  
 
All Packages  Class Hierarchy  This Package  Previous  Next  Index