# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

NL3D::CIsotropicForceT Class Template Reference

a helper class to create isotropic force : they are independant of the basis, and have no position (fluid friction for example) To use this class you should provide to it a functor class that define the () operator with 3 parameters param1 = a const reference to the position of the particle param2 = a reference to the position, that must be updated param3 = a float giving the inverse of the mass param4 = the ellapsed time, in second (has the TAnimationTime type). More...

#include <ps_force.h>

Inheritance diagram for NL3D::CIsotropicForceT:

NL3D::CPSForce NL3D::CPSTargetLocatedBindable NL3D::CPSLocatedBindable NLMISC::IStreamable NLMISC::IClassable List of all members.

Public Methods

virtual void performDynamic (TAnimationTime ellapsedTime)
 Compute the force on the targets. More...

virtual void serial (NLMISC::IStream &f) throw (NLMISC::EStream)
 serialization. More...

void show (TAnimationTime ellapsedTime)
 Show the force (edition mode). More...

virtual void setupFunctor (uint32 index)
 setup the functor object. The default does nothing. More...


Protected Methods

virtual void newElement (CPSLocated *emitterLocated, uint32 emitterIndex)
 Generate a new element for this bindable. More...

virtual void deleteElement (uint32 index)
 Delete an element given its index Attributes of the located that hold this bindable are still accessible for of the index given index out of range -> nl_assert. More...

virtual void resize (uint32 size)
 Resize the bindable attributes containers DERIVERS SHOULD CALL THEIR PARENT VERSION should not be called directly. More...


Protected Attributes

_F
 the functor object. More...


Detailed Description

template<class T>
class NL3D::CIsotropicForceT< T >

a helper class to create isotropic force : they are independant of the basis, and have no position (fluid friction for example) To use this class you should provide to it a functor class that define the () operator with 3 parameters param1 = a const reference to the position of the particle param2 = a reference to the position, that must be updated param3 = a float giving the inverse of the mass param4 = the ellapsed time, in second (has the TAnimationTime type).

Example of use : class MyForceFunctor { public: /// it is strongly recommended to have your operator inlined void operator() (const NLMISC::CVector &pos, NLMISC::CVector &speed, float invMass , CanimationTime ellapsedTime) { // perform the speed update there }

// you can provide a serialization method. Note that that if the functor parameters are set before each use, // it useless to serial something ... void serial(NLMISC::IStream &f) throw(NLMISC::EStream)

protected: ... };

because of the serialization process, you must proceed like the following. (but you don't need to redefine serial, which will serilize the functor object you passed for you

class MyForce : public CHomogenousForceT<MyForceFunctor> { public: MyForce(); NLMISC_DECLARE_CLASS(Myforce);

protected: ...

};

not that each functor may have its own parameter. the setupFunctor method will be called each time

Definition at line 278 of file ps_force.h.


Member Function Documentation

template<class T>
virtual void NL3D::CIsotropicForceT< T >::deleteElement uint32    index [inline, protected, virtual]
 

Delete an element given its index Attributes of the located that hold this bindable are still accessible for of the index given index out of range -> nl_assert.

Implements NL3D::CPSForce.

Reimplemented in NL3D::CPSFluidFriction.

Definition at line 314 of file ps_force.h.

template<class T>
virtual void NL3D::CIsotropicForceT< T >::newElement CPSLocated   emitterLocated,
uint32    emitterIndex
[inline, protected, virtual]
 

Generate a new element for this bindable.

They are generated according to the propertie of the class

Implements NL3D::CPSForce.

Reimplemented in NL3D::CPSFluidFriction.

Definition at line 313 of file ps_force.h.

template<class T>
void NL3D::CIsotropicForceT< T >::performDynamic TAnimationTime    ellapsedTime [virtual]
 

Compute the force on the targets.

Implements NL3D::CPSForce.

Definition at line 325 of file ps_force.h.

References _F, NL3D::CPSLocatedBindable::_Owner, NL3D::CPSTargetLocatedBindable::_Targets, setupFunctor, and NL3D::TAnimationTime.

template<class T>
virtual void NL3D::CIsotropicForceT< T >::resize uint32    size [inline, protected, virtual]
 

Resize the bindable attributes containers DERIVERS SHOULD CALL THEIR PARENT VERSION should not be called directly.

Call CPSLOcated::resize instead

Implements NL3D::CPSForce.

Reimplemented in NL3D::CPSFluidFriction.

Definition at line 315 of file ps_force.h.

template<class T>
virtual void NL3D::CIsotropicForceT< T >::serial NLMISC::IStream   f throw (NLMISC::EStream) [inline, virtual]
 

serialization.

Reimplemented from NL3D::CPSForce.

Reimplemented in NL3D::CPSFluidFriction.

Definition at line 287 of file ps_force.h.

template<class T>
virtual void NL3D::CIsotropicForceT< T >::setupFunctor uint32    index [inline, virtual]
 

setup the functor object. The default does nothing.

Reimplemented in NL3D::CPSFluidFriction.

Definition at line 304 of file ps_force.h.

Referenced by performDynamic.

template<class T>
void NL3D::CIsotropicForceT< T >::show TAnimationTime    ellapsedTime [inline, virtual]
 

Show the force (edition mode).

The default does nothing TODO later

Implements NL3D::CPSForce.

Definition at line 299 of file ps_force.h.


Member Data Documentation

template<class T>
T NL3D::CIsotropicForceT::_F [protected]
 

the functor object.

Definition at line 309 of file ps_force.h.

Referenced by performDynamic, and NL3D::CIsotropicForceT< CPSFluidFrictionFunctor >::serial.


The documentation for this class was generated from the following file: