chai3d::cGenericEffect Class Reference

This class implements a base class for haptic effects. More...

#include <CGenericEffect.h>

Inheritance diagram for chai3d::cGenericEffect:

Public Member Functions

 cGenericEffect (cGenericObject *a_parent)
 Constructor of CGenericEffect. More...
virtual ~cGenericEffect ()
 Destructor of CGenericEffect. More...
virtual bool computeForce (const cVector3d &a_toolPos, const cVector3d &a_toolVel, const unsigned int &a_toolID, cVector3d &a_reactionForce)
 This method computes the resulting force. More...
void setEnabled (bool a_enabled)
 This method enables or disables this effect. More...
bool getEnabled () const
 This method returns true if this effect is enables, false otherwise. More...

Public Attributes

 Object to which the force effects applies. More...

Protected Member Functions

virtual void initialize ()
 This method initializes the haptic effect model. More...

Protected Attributes

bool m_enabled
 Is this effect currently enabled? More...

Detailed Description

Haptic interaction forces between a virtual tool and this object are defined by the programmed haptic effects (cGenericEffect) associated with it. Haptic effects may include viscosity (cEffectViscosity), vibrations (cEffectVibration), or stick-and-slip (cEffectStickSlip) for instance.

At every haptic iteration and for each given tool (cGenericTool), the computeInteraction() is called throughtout the entire scenegraph. For each object in the world, the position of the tool is compared to the position and topology of the object; this task is handled by the virtual method computeLocalInteraction() which decides if the tool is locate inside or outside the object. The result is stored in the boolean variable m_interactionInside by setting it to true if the tool is located inside the object or false otherwise. The method also computes the nearest point towards the surface of the object and stores the result in variable m_interactionProjectedPoint.

The computeInteraction() then calls method computeForce() for each haptic effect programmed for this object. Haptic effects are stored in the list m_effects. If the tool is located inside the object (m_interactionInside == true), then interaction forces are computed and added to the virtual tool.

Finally, after traversing each object in the scenegraph, the resulting force (sum of all interaction forces) is sent to the haptic device.

Constructor & Destructor Documentation

chai3d::cGenericEffect::cGenericEffect ( cGenericObject a_parent)

Constructor of cGenericEffect.

a_parentParent object.
virtual chai3d::cGenericEffect::~cGenericEffect ( )

Member Function Documentation

virtual bool chai3d::cGenericEffect::computeForce ( const cVector3d a_toolPos,
const cVector3d a_toolVel,
const unsigned int &  a_toolID,
cVector3d a_reactionForce 
void chai3d::cGenericEffect::setEnabled ( bool  a_enabled)
bool chai3d::cGenericEffect::getEnabled ( ) const
virtual void chai3d::cGenericEffect::initialize ( )

Member Data Documentation

cGenericObject* chai3d::cGenericEffect::m_parent
bool chai3d::cGenericEffect::m_enabled

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