Jeospace API

org.jeospace.navigation
Class QuaternionInterpolator

java.lang.Object
  extended byorg.jeospace.navigation.QuaternionInterpolator
All Implemented Interfaces:
Orientation, OrientationInterpolator

public class QuaternionInterpolator
extends java.lang.Object
implements OrientationInterpolator

An orientation interpolator that takes quaternions as arguments. The interpolation follows the shortest path from initial orientation to final orientation along a "great circle" path. The algorithm implemented is known as: SLERP or "Spherical linear interpolation of unit quaternions".

Version:
$Revision: 1.2 $
Author:
Rex Melton

Constructor Summary
QuaternionInterpolator(Quaternion begin, Quaternion end)
          Construct a QuaternionInterpolator
 
Method Summary
 void addInterpolationListener(InterpolationListener il)
          Add a listener to this interpolator
 void enableOrientation(boolean enabled)
          Set the state of the interpolator to update it's Alpha in response to update( ) calls.
protected  void fireInterpolationEvent(int id)
          Deliver events to the listeners
 void get(Attitude attitude)
          Return the orientation data in the argument object.
 void get(Quaternion quat)
          Return the orientation value as a Quaternion
 Alpha getAlpha()
          Return the Alpha object
 void removeInterpolationListener(InterpolationListener il)
          Remove a listener from this interpolator
 void setAlpha(Alpha alpha)
          Set the Alpha object to drive the interpolator
 void updateOrientation(double timeValue)
          Process any position changes for the next simulation frame.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QuaternionInterpolator

public QuaternionInterpolator(Quaternion begin,
                              Quaternion end)
Construct a QuaternionInterpolator

Parameters:
begin - the initial orientation
end - the final orientation
Method Detail

setAlpha

public void setAlpha(Alpha alpha)
Set the Alpha object to drive the interpolator

Specified by:
setAlpha in interface OrientationInterpolator
Parameters:
alpha - the Alpha object to install

getAlpha

public Alpha getAlpha()
Return the Alpha object

Specified by:
getAlpha in interface OrientationInterpolator
Returns:
the Alpha object

updateOrientation

public void updateOrientation(double timeValue)
Process any position changes for the next simulation frame. This method updates the Alpha of this interpolator by a single increment.

Specified by:
updateOrientation in interface Orientation
Parameters:
timeValue - the time value is ignored

enableOrientation

public void enableOrientation(boolean enabled)
Set the state of the interpolator to update it's Alpha in response to update( ) calls.

Specified by:
enableOrientation in interface Orientation
Parameters:
enabled - true if the object should update it's Alpha in response to update( ) calls, false if the object should NOT update it's Alpha in response to update( ) calls.

get

public void get(Quaternion quat)
Return the orientation value as a Quaternion

Specified by:
get in interface Orientation
Parameters:
quat - the Quaternion object to initialize with the orientation value calculated at the fraction value of the Alpha

get

public void get(Attitude attitude)
Return the orientation data in the argument object.

Specified by:
get in interface Orientation
Parameters:
attitude - the Attitude coordinate object to initialize with the current orientation data.

addInterpolationListener

public void addInterpolationListener(InterpolationListener il)
Add a listener to this interpolator

Specified by:
addInterpolationListener in interface OrientationInterpolator
Parameters:
il - the InterpolationListener

removeInterpolationListener

public void removeInterpolationListener(InterpolationListener il)
Remove a listener from this interpolator

Specified by:
removeInterpolationListener in interface OrientationInterpolator
Parameters:
il - the InterpolationListener

fireInterpolationEvent

protected void fireInterpolationEvent(int id)
Deliver events to the listeners

Parameters:
id - the InterpolationEvent id

Jeospace API

Copyright © 2006 - jeospace.org