This class implements a base class for haptic effects. More...
#include <CGenericEffect.h>
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 | |
cGenericObject * | m_parent |
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... | |
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.
chai3d::cGenericEffect::cGenericEffect | ( | cGenericObject * | a_parent | ) |
Constructor of cGenericEffect.
a_parent | Parent object. |
|
inlinevirtual |
|
inlinevirtual |
Reimplemented in chai3d::cEffectStickSlip, chai3d::cEffectVibration, chai3d::cEffectMagnet, chai3d::cEffectSurface, and chai3d::cEffectViscosity.
|
inline |
|
inline |
|
inlineprotectedvirtual |
cGenericObject* chai3d::cGenericEffect::m_parent |
|
protected |