OMK::Orbit Class Reference
[Simulated ojects]

This Simulated object defines a position which moves in the space. More...

#include <OMKOrbit.h>

Inheritance diagram for OMK::Orbit:

Inheritance graph
[legend]
Collaboration diagram for OMK::Orbit:

Collaboration graph
[legend]
List of all members.

Protected Member Functions

virtual void computeParameters ()
 This part of the compute methods computes the associated data.
virtual bool loadParameters (const ConfigurationParameterDescriptor *node)
 Configuration parameters loader of Orbit.

Protected Attributes

float _angle
 The position on the orbit.
float _planetAngle
Wm4::Vector3f _planetAxis
 Reference axis for orientation.
OMK::AttributeT< float > _speed
OMK::AttributeT< float > _radius
OMK::AttributeT< float > _period
 The period of the orbit.
OMK::AttributeT< float > _planetPeriod
 The period of the rotation.

Private Member Functions

 DECLARE_OBJECT_FACTORY (Orbit)

Detailed Description

This Simulated object defines a position which moves in the space.

Configuration parameters are :

All the parameters have default values.

Example:

object1
{
  Class Orbit
  Scheduling
  {
    ...
  }
  Extensions
  {
    ...
  }
  UserParams
  {
    Position [[0 0 0 ][1.57 1.57 0]]
  }
}

Definition at line 43 of file OMKOrbit.h.


Member Function Documentation

OMK::Orbit::DECLARE_OBJECT_FACTORY ( Orbit   )  [private]

void Orbit::computeParameters (  )  [protected, virtual]

This part of the compute methods computes the associated data.

The inputs and outputs should work with associated data, you should use these associated data.

Reimplemented from OMK::ExtensibleSimulatedObject.

Definition at line 47 of file OMKOrbit.cpp.

References _angle, _period, _planetAngle, _planetAxis, _planetPeriod, OMK::SimplePoint::_position, _radius, _speed, OMK::IAttributeT< PrmType, ModelType, AccessorType >::get(), OMK::Type::Transform::getRotate(), OMK::IAttributeT< PrmType, ModelType, AccessorType >::set(), OMK::Type::Transform::setRotate(), and OMK::Type::Transform::setTranslate().

00048 {
00049   // Get the increment
00050   if ( 1.0f <= _angle ) 
00051   { // step > 0
00052     _angle = 0.0 ;
00053   }
00054   else if( _period.get() != 0.0f )
00055   {
00056     _angle += 1.0f / _period.get() * _speed.get() ;
00057   }
00058   if ( 1.0f <= _planetAngle ) 
00059   { // step > 0
00060     _planetAngle = 0.0 ;
00061   }
00062   else if( _planetPeriod.get() != 0.0f )
00063   {
00064     _planetAngle += 1.0f / _planetPeriod.get() * _speed.get() ;
00065   }
00066   
00067   // Get the translate and the rotate
00068   OMK::Type::Transform position ;
00069   Wm4::Vector3f orientation ;
00070   position.setTranslate( Wm4::Vector3f( _radius.get() * Wm4::Math<float>::Cos( Wm4::Math<float>::TWO_PI * _angle ),
00071                                         _radius.get() * Wm4::Math<float>::Sin( Wm4::Math<float>::TWO_PI * _angle ), 
00072                                         0.0f ) ) ;
00073 
00074   // Calculate the orientation
00075   Wm4::Matrix3f rotationMatrix( _planetAxis, Wm4::Math<float>::TWO_PI * _planetAngle ) ;
00076   position.setRotate( position.getRotate() * rotationMatrix ) ;
00077 
00078   // Set the new position
00079   _position.set( position ) ;
00080 }

bool Orbit::loadParameters ( const ConfigurationParameterDescriptor node  )  [protected, virtual]

Configuration parameters loader of Orbit.

Parameters:
[in] node the root node of the configuration parameter.
Returns:
true if all needed parameters can be read.
Reads in the configuration node the values to set the attributs.

Reimplemented from OMK::ExtensibleSimulatedObject.

Definition at line 37 of file OMKOrbit.cpp.

References _planetAxis, OMK::SimplePoint::_position, OMK::IAttributeT< PrmType, ModelType, AccessorType >::get(), OMK::ExtensibleSimulatedObject::loadParameters(), and OMK::IAttributeT< PrmType, ModelType, AccessorType >::setValueToOutput().

00038 {
00039   SimplePoint::loadParameters( node ) ;
00040   _planetAxis = _position.get().getDirection() ;
00041   _position.setValueToOutput() ;
00042 
00043   return true ; 
00044 }


Member Data Documentation

float OMK::Orbit::_angle [protected]

The position on the orbit.

Its value is in the set [0, 1[

Definition at line 58 of file OMKOrbit.h.

Referenced by computeParameters().

float OMK::Orbit::_planetAngle [protected]

Definition at line 59 of file OMKOrbit.h.

Referenced by computeParameters().

Wm4::Vector3f OMK::Orbit::_planetAxis [protected]

Reference axis for orientation.

Definition at line 61 of file OMKOrbit.h.

Referenced by computeParameters(), and loadParameters().

OMK::AttributeT< float > OMK::Orbit::_speed [protected]

Definition at line 63 of file OMKOrbit.h.

Referenced by computeParameters().

OMK::AttributeT< float > OMK::Orbit::_radius [protected]

Definition at line 64 of file OMKOrbit.h.

Referenced by computeParameters().

OMK::AttributeT< float > OMK::Orbit::_period [protected]

The period of the orbit.

Definition at line 66 of file OMKOrbit.h.

Referenced by computeParameters().

OMK::AttributeT< float > OMK::Orbit::_planetPeriod [protected]

The period of the rotation.

Definition at line 68 of file OMKOrbit.h.

Referenced by computeParameters().


logo OpenMask

Documentation generated on Mon Jun 9 11:46:04 2008

Generated with doxygen by Dimitri van Heesch ,   1997-2007