Documentation


animal::MorphingEngine< Morphings, Real > Class Template Reference

#include <morphingEngine.h>

Inheritance diagram for animal::MorphingEngine< Morphings, Real >:

animal::Engine X3DTK::X3D::AnimalEngineNode< AMorphingEngine > X3DTK::X3D::MorphingNode List of all members.

Detailed Description

template<class Morphings, class Real = float>
class animal::MorphingEngine< Morphings, Real >

This class computes an interpolation from given values which are defined at several keys.

These datas are defined with the template type named Morphings.

Morphings::Values correspond to all types of vectors whose entries can be accessed using operator[] and whose size can be computed. These conditions are due to the use of linear.h and container_traits.hpp. If these conditions are not respected, you can define in a new file your own functions, v_eq(Y,X) (Y=X), v_eq_ab(Y, a, X) (Y=aX, a is a real), v_peq_ab(Y, a, X) (Y+=aX, a is a real).

Morphings::Keys correspond to real or to an integer.

Definition at line 28 of file morphingEngine.h.

Public Member Functions

 MorphingEngine ()
 Constructor.

virtual ~MorphingEngine ()
 Destructor.

void setCurrentKey (Key k)
 Set the current key.

void setVelocity (Real v)
 Set the velocity.

void toggleCatmullRomMethod (bool b)
 Set the _interpolationID to 1, i.e. the Catmull Rom method.

void toggleLinearMethod (bool b)
 Set the _interpolationID to 0, i.e. the Linear method.

void setMorphings (Morphings *k)
 Set the _morphings.

void setInitialKey (Key k)
 Set the _initialKey.

intgetInterpolationID ()
 Get the _interpolationID.

Real * getVelocity ()
 Get the velocity.

Morphings * getMorphings ()
 Get the _morphings.

KeygetInitialKey ()
 Get the _initialKey.

Virtual methods from animal::Engine
virtual void reset ()
 Initialize the positions.

virtual void move (double dt)
 Move the engine.

virtual void draw ()
 Draw the engine, i.e. the generated trajectory.


Protected Types

typedef Morphings::Key Key
 Types for the datas.

typedef Morphings::Values Values

Protected Member Functions

bool computeInterpolatedValues (Key key)
 Compute the interpolated values at the given key.

bool searchRange (const Key key, Key &key0, Key &key1)
 Search the range [key0, key1[ of the key.


Protected Attributes

Values_positions
 The animated positions.

Morphings * _morphings
 Data structure composed of pairs of (key, values) to define all the frames Keys are time or frame numbers) and values can be vectors for the interpolated values (for example a list of 2D points).

int _interpolationID
 The interpolation method identificator:.

Key _currentKey
 The current frame.

Key _initialKey
 The initial frame.

Real _velocity
 The velocity.


Private Member Functions

void printMorphings ()
 Print all the key frames.

bool begin (Key &key)
 Give the first key of the interpolated path.

bool searchKeys (const Key key, Key &key0, Key &key1, Key &key2, Key &key3)
 Search the keys such as key0 < key1 <= key < key2 < key3.

bool computeLinearInterpolation (const Key key)
 Compute a linear interpolation of the values.

bool computeCatmullRomInterpolation (const Key key)
 Compute a Catmull-Rom interpolation of the values.


Member Typedef Documentation

template<class Morphings, class Real = float>
typedef Morphings::Key animal::MorphingEngine< Morphings, Real >::Key [protected]
 

Types for the datas.

Definition at line 32 of file morphingEngine.h.

Referenced by animal::MorphingEngine< Morphings, Real >::begin(), animal::MorphingEngine< Morphings, Real >::computeCatmullRomInterpolation(), animal::MorphingEngine< Morphings, Real >::computeInterpolatedValues(), animal::MorphingEngine< Morphings, Real >::computeLinearInterpolation(), animal::MorphingEngine< Morphings, Real >::searchKeys(), animal::MorphingEngine< Morphings, Real >::searchRange(), and animal::MorphingEngine< Morphings, Real >::setCurrentKey().

template<class Morphings, class Real = float>
typedef Morphings::Values animal::MorphingEngine< Morphings, Real >::Values [protected]
 

Definition at line 33 of file morphingEngine.h.


Constructor & Destructor Documentation

template<class Morphings, class Real>
animal::MorphingEngine< Morphings, Real >::MorphingEngine  ) 
 

Constructor.

Definition at line 18 of file morphingEngine.inl.

template<class Morphings, class Real>
animal::MorphingEngine< Morphings, Real >::~MorphingEngine  )  [virtual]
 

Destructor.

Definition at line 30 of file morphingEngine.inl.


Member Function Documentation

template<class Morphings, class Real>
bool animal::MorphingEngine< Morphings, Real >::begin Key key  )  [private]
 

Give the first key of the interpolated path.

Parameters:
key the first key of the interpolated path
Returns:
true if this first key exists.

Definition at line 115 of file morphingEngine.inl.

References animal::MorphingEngine< Morphings, Real >::_interpolationID, animal::MorphingEngine< Morphings, Real >::_morphings, and animal::MorphingEngine< Morphings, Real >::Key.

template<class Morphings, class Real>
bool animal::MorphingEngine< Morphings, Real >::computeCatmullRomInterpolation const Key  key  )  [private]
 

Compute a Catmull-Rom interpolation of the values.

Parameters:
key the key where the values are interpolated
Returns:
true if the interpolation is successful, i.e. the key is not too big or too small

Definition at line 300 of file morphingEngine.inl.

References animal::MorphingEngine< Morphings, Real >::_morphings, animal::MorphingEngine< Morphings, Real >::_positions, animal::MorphingEngine< Morphings, Real >::Key, animal::MorphingEngine< Morphings, Real >::searchKeys(), animal::v_eq(), animal::v_eq_ab(), and animal::v_peq_ab().

Referenced by animal::MorphingEngine< Morphings, Real >::computeInterpolatedValues().

template<class Morphings, class Real>
bool animal::MorphingEngine< Morphings, Real >::computeInterpolatedValues Key  key  )  [protected]
 

Compute the interpolated values at the given key.

Parameters:
key the key where the values are interpolated
Returns:
true if the interpolation is successful, i.e. the key is not too big or too small

Definition at line 139 of file morphingEngine.inl.

References animal::MorphingEngine< Morphings, Real >::_interpolationID, animal::MorphingEngine< Morphings, Real >::computeCatmullRomInterpolation(), animal::MorphingEngine< Morphings, Real >::computeLinearInterpolation(), and animal::MorphingEngine< Morphings, Real >::Key.

Referenced by animal::MorphingEngine< Morphings, Real >::move(), and animal::MorphingEngine< Morphings, Real >::reset().

template<class Morphings, class Real>
bool animal::MorphingEngine< Morphings, Real >::computeLinearInterpolation const Key  key  )  [private]
 

Compute a linear interpolation of the values.

Parameters:
key the key where the values are interpolated
Returns:
true if the interpolation is successful, i.e. the key is not too big or too small

Definition at line 261 of file morphingEngine.inl.

References animal::MorphingEngine< Morphings, Real >::_morphings, animal::MorphingEngine< Morphings, Real >::_positions, animal::MorphingEngine< Morphings, Real >::Key, animal::MorphingEngine< Morphings, Real >::searchRange(), animal::v_eq(), animal::v_eq_ab(), and animal::v_peq_ab().

Referenced by animal::MorphingEngine< Morphings, Real >::computeInterpolatedValues().

template<class Morphings, class Real = float>
virtual void animal::MorphingEngine< Morphings, Real >::draw  )  [inline, virtual]
 

Draw the engine, i.e. the generated trajectory.

Reimplemented from animal::Engine.

Reimplemented in X3DTK::X3D::AnimalEngineNode< AMorphingEngine >.

Definition at line 53 of file morphingEngine.h.

template<class Morphings, class Real = float>
Key* animal::MorphingEngine< Morphings, Real >::getInitialKey  )  [inline]
 

Get the _initialKey.

Definition at line 86 of file morphingEngine.h.

template<class Morphings, class Real = float>
int* animal::MorphingEngine< Morphings, Real >::getInterpolationID  )  [inline]
 

Get the _interpolationID.

Definition at line 77 of file morphingEngine.h.

Referenced by X3DTK::Qt::createMorphingNodeQWidget(), and X3DTK::Qt::MorphingEngineQt::MorphingEngineQt().

template<class Morphings, class Real = float>
Morphings* animal::MorphingEngine< Morphings, Real >::getMorphings  )  [inline]
 

Get the _morphings.

Definition at line 83 of file morphingEngine.h.

template<class Morphings, class Real = float>
Real* animal::MorphingEngine< Morphings, Real >::getVelocity  )  [inline]
 

Get the velocity.

Definition at line 80 of file morphingEngine.h.

Referenced by X3DTK::Qt::MorphingEngineQt::MorphingEngineQt().

template<class Morphings, class Real>
void animal::MorphingEngine< Morphings, Real >::move double  dt  )  [virtual]
 

Move the engine.

Reimplemented from animal::Engine.

Definition at line 53 of file morphingEngine.inl.

References animal::MorphingEngine< Morphings, Real >::_currentKey, animal::MorphingEngine< Morphings, Real >::_morphings, animal::MorphingEngine< Morphings, Real >::_positions, animal::MorphingEngine< Morphings, Real >::_velocity, and animal::MorphingEngine< Morphings, Real >::computeInterpolatedValues().

template<class Morphings, class Real>
void animal::MorphingEngine< Morphings, Real >::printMorphings  )  [private]
 

Print all the key frames.

Definition at line 100 of file morphingEngine.inl.

References animal::MorphingEngine< Morphings, Real >::_morphings.

template<class Morphings, class Real>
void animal::MorphingEngine< Morphings, Real >::reset  )  [virtual]
 

Initialize the positions.

Reimplemented from animal::Engine.

Reimplemented in X3DTK::X3D::AnimalEngineNode< AMorphingEngine >.

Definition at line 42 of file morphingEngine.inl.

References animal::MorphingEngine< Morphings, Real >::_currentKey, animal::MorphingEngine< Morphings, Real >::_initialKey, animal::MorphingEngine< Morphings, Real >::_morphings, animal::MorphingEngine< Morphings, Real >::_positions, and animal::MorphingEngine< Morphings, Real >::computeInterpolatedValues().

template<class Morphings, class Real>
bool animal::MorphingEngine< Morphings, Real >::searchKeys const Key  key,
Key key0,
Key key1,
Key key2,
Key key3
[private]
 

Search the keys such as key0 < key1 <= key < key2 < key3.

Parameters:
key the given key
key0 the biggest key in _keyValues lesser than key1
key1 the biggest key in _keyValues lesser than key
key2 the lowest key in _keyValues bigger than key
key3 the lowest key in _keyValues bigger than key2
Returns:
true if all the keys exit

Definition at line 216 of file morphingEngine.inl.

References animal::MorphingEngine< Morphings, Real >::_morphings, animal::MorphingEngine< Morphings, Real >::Key, and animal::MorphingEngine< Morphings, Real >::searchRange().

Referenced by animal::MorphingEngine< Morphings, Real >::computeCatmullRomInterpolation().

template<class Morphings, class Real>
bool animal::MorphingEngine< Morphings, Real >::searchRange const Key  key,
Key key0,
Key key1
[protected]
 

Search the range [key0, key1[ of the key.

Parameters:
key the given key
key0 the lower bound of the range
key1 the upper bound of the range
Returns:
true if the range exits, i.e. if key0 != key1

Definition at line 173 of file morphingEngine.inl.

References animal::MorphingEngine< Morphings, Real >::_morphings, and animal::MorphingEngine< Morphings, Real >::Key.

Referenced by animal::MorphingEngine< Morphings, Real >::computeLinearInterpolation(), and animal::MorphingEngine< Morphings, Real >::searchKeys().

template<class Morphings, class Real>
void animal::MorphingEngine< Morphings, Real >::setCurrentKey Key  k  ) 
 

Set the current key.

Definition at line 65 of file morphingEngine.inl.

References animal::MorphingEngine< Morphings, Real >::_currentKey, and animal::MorphingEngine< Morphings, Real >::Key.

template<class Morphings, class Real = float>
void animal::MorphingEngine< Morphings, Real >::setInitialKey Key  k  )  [inline]
 

Set the _initialKey.

Definition at line 73 of file morphingEngine.h.

template<class Morphings, class Real = float>
void animal::MorphingEngine< Morphings, Real >::setMorphings Morphings *  k  )  [inline]
 

Set the _morphings.

Definition at line 70 of file morphingEngine.h.

template<class Morphings, class Real = float>
void animal::MorphingEngine< Morphings, Real >::setVelocity Real  v  )  [inline]
 

Set the velocity.

Definition at line 62 of file morphingEngine.h.

Referenced by X3DTK::Qt::MorphingEngineQt::changeVelocity().

template<class Morphings, class Real>
void animal::MorphingEngine< Morphings, Real >::toggleCatmullRomMethod bool  b  ) 
 

Set the _interpolationID to 1, i.e. the Catmull Rom method.

Definition at line 74 of file morphingEngine.inl.

References animal::MorphingEngine< Morphings, Real >::_interpolationID.

Referenced by X3DTK::Qt::MorphingEngineQt::toggleCatmullRomMethod().

template<class Morphings, class Real>
void animal::MorphingEngine< Morphings, Real >::toggleLinearMethod bool  b  ) 
 

Set the _interpolationID to 0, i.e. the Linear method.

Definition at line 85 of file morphingEngine.inl.

References animal::MorphingEngine< Morphings, Real >::_interpolationID.

Referenced by X3DTK::Qt::MorphingEngineQt::toggleLinearMethod().


Member Data Documentation

template<class Morphings, class Real = float>
Key animal::MorphingEngine< Morphings, Real >::_currentKey [protected]
 

The current frame.

Definition at line 153 of file morphingEngine.h.

Referenced by animal::MorphingEngine< Morphings, Real >::move(), animal::MorphingEngine< Morphings, Real >::reset(), and animal::MorphingEngine< Morphings, Real >::setCurrentKey().

template<class Morphings, class Real = float>
Key animal::MorphingEngine< Morphings, Real >::_initialKey [protected]
 

The initial frame.

Definition at line 156 of file morphingEngine.h.

Referenced by animal::MorphingEngine< Morphings, Real >::reset().

template<class Morphings, class Real = float>
int animal::MorphingEngine< Morphings, Real >::_interpolationID [protected]
 

The interpolation method identificator:.

  • 0: Linear interpolation
  • 1: Catmull-Rom interpolation

Definition at line 150 of file morphingEngine.h.

Referenced by animal::MorphingEngine< Morphings, Real >::begin(), animal::MorphingEngine< Morphings, Real >::computeInterpolatedValues(), animal::MorphingEngine< Morphings, Real >::toggleCatmullRomMethod(), and animal::MorphingEngine< Morphings, Real >::toggleLinearMethod().

template<class Morphings, class Real = float>
Morphings* animal::MorphingEngine< Morphings, Real >::_morphings [protected]
 

Data structure composed of pairs of (key, values) to define all the frames Keys are time or frame numbers) and values can be vectors for the interpolated values (for example a list of 2D points).

Definition at line 143 of file morphingEngine.h.

Referenced by animal::MorphingEngine< Morphings, Real >::begin(), animal::MorphingEngine< Morphings, Real >::computeCatmullRomInterpolation(), animal::MorphingEngine< Morphings, Real >::computeLinearInterpolation(), animal::MorphingEngine< Morphings, Real >::move(), animal::MorphingEngine< Morphings, Real >::printMorphings(), animal::MorphingEngine< Morphings, Real >::reset(), animal::MorphingEngine< Morphings, Real >::searchKeys(), and animal::MorphingEngine< Morphings, Real >::searchRange().

template<class Morphings, class Real = float>
Values* animal::MorphingEngine< Morphings, Real >::_positions [protected]
 

The animated positions.

Definition at line 137 of file morphingEngine.h.

Referenced by animal::MorphingEngine< Morphings, Real >::computeCatmullRomInterpolation(), animal::MorphingEngine< Morphings, Real >::computeLinearInterpolation(), animal::MorphingEngine< Morphings, Real >::move(), and animal::MorphingEngine< Morphings, Real >::reset().

template<class Morphings, class Real = float>
Real animal::MorphingEngine< Morphings, Real >::_velocity [protected]
 

The velocity.

Definition at line 159 of file morphingEngine.h.

Referenced by animal::MorphingEngine< Morphings, Real >::move().


The documentation for this class was generated from the following files:
Generated on Thu Dec 23 13:52:31 2004 by doxygen 1.3.6