chai3d::cHapticPoint Class Reference

This class implements a haptic point on a tool. More...

#include <CHapticPoint.h>

Public Member Functions

 cHapticPoint (cGenericTool *a_parentTool)
 Constructor of cHapticPoint. More...
 
virtual ~cHapticPoint ()
 Destructor of cHapticPoint. More...
 
void initialize ()
 This method resets the haptic point to the current position of the haptic device. More...
 
void initialize (cVector3d a_globalPos)
 This method initializes the haptic point to a desired position. More...
 
cGenericToolgetParentTool ()
 This method returns a pointer to the parent tool. More...
 
cVector3d getGlobalPosGoal ()
 This method returns the current desired goal position of the haptic point in world coordinates. More...
 
cVector3d getGlobalPosProxy ()
 This method returns the the current proxy position of the haptic point in world coordinates. More...
 
cVector3d getLocalPosGoal ()
 This method returns the current desired goal position of the haptic point in local tool coordinates. More...
 
cVector3d getLocalPosProxy ()
 This method returns the current proxy position of the haptic point in local tool coordinates. More...
 
void setRadius (double a_radius)
 This method sets the radius size of the haptic point. More...
 
void setRadius (double a_radiusDisplay, double a_radiusContact)
 This method sets the radius size of the haptic point. More...
 
void setRadiusContact (double a_radiusContact)
 This method sets the radius size of the physical proxy. More...
 
double getRadiusContact ()
 This method returns the radius size of the physical proxy. More...
 
void setRadiusDisplay (double a_radiusDisplay)
 This method sets the radius size of the sphere used to display the proxy and goal position. More...
 
double getRadiusDisplay ()
 This method returns the display radius size of the proxy and goal spheres. More...
 
void setShow (bool a_showProxy=true, bool a_showGoal=false, cColorf a_colorLine=cColorf(0.5, 0.5, 0.5))
 This method sets the display options of the goal and proxy spheres. More...
 
bool createAudioSource (cAudioDevice *a_audioDevice)
 This method Create an audio source for this haptic point. More...
 
int getNumCollisionEvents ()
 
cCollisionEventgetCollisionEvent (const int a_index)
 
int getNumInteractionEvents ()
 
cInteractionEventgetInteractionEvent (const int a_index)
 
cVector3d computeInteractionForces (cVector3d &a_globalPos, cMatrix3d &a_globalRot, cVector3d &a_globalLinVel, cVector3d &a_globalAngVel)
 This method computes all interaction forces between the haptic point and the virtual environment. More...
 
cVector3d getLastComputedForce ()
 This method returns the last computed force in global world coordinates. More...
 
bool isInContact (cGenericObject *a_object)
 This method checks if the tool is touching a particular object. More...
 
void render (cRenderOptions &a_options)
 This method renders the haptic point graphically using OpenGL. More...
 

Public Attributes

cAlgorithmFingerProxym_algorithmFingerProxy
 Finger-proxy algorithm used for modeling contacts with cMesh objects. More...
 
cAlgorithmPotentialFieldm_algorithmPotentialField
 Potential field algorithm used for modeling interaction forces with objects that have haptic effects programmed. More...
 
cShapeSpherem_sphereProxy
 Sphere object used for rendering the proxy position. More...
 
cShapeSpherem_sphereGoal
 Sphere object used for rendering the goal position. More...
 
cColorf m_colorLine
 Color of the display line that connects both spheres (proxy and goal). More...
 

Protected Member Functions

void updateSpherePositions ()
 This method updates the position of the spheres (proxy and goal) in local tool coordinates. More...
 

Protected Attributes

cGenericToolm_parentTool
 Parent tool. More...
 
cVector3d m_lastComputedGlobalForce
 Last computed interaction force [N] in world global coordinates. More...
 
double m_radiusDisplay
 Radius used for rendering the proxy and goal spheres. More...
 
double m_radiusContact
 Radius used to model the physical radius of the proxy. More...
 
cGenericObjectm_meshProxyContacts [3]
 Pointer to mesh objects for which the proxy is in contact with. More...
 
cAudioSourcem_audioSourceImpact [3]
 Optional audio source for rendering sound impacts with environment. More...
 
cAudioSourcem_audioSourceFriction [3]
 Optional audio source for rendering sound friction. More...
 
bool m_useAudioSources
 If true then audio sources are enabled. More...
 
cGenericObjectm_audioProxyContacts [3]
 Pointers to mesh objects for which the proxy was last in contact with. More...
 

Detailed Description

cHapticPoint describes a haptic interaction point associated with a tool. A tool may combine one or more haptic points depending of its type. For instance a cursor type tool will typically contain a single haptic point, whereas a gripper type tool will contain at least two haptic points (one for the finger and a second for the thumb).

An haptic point stores a desired goal position and a current proxy position. The goal point represents the current position of the haptic device and the proxy point follows the desired goal while respecting the constraints (triangles) of the environment.

Force rendering algorithms are assigned to each haptic point to compute the interaction force between the haptic point and the objects that compose the environment.

Constructor & Destructor Documentation

chai3d::cHapticPoint::cHapticPoint ( cGenericTool a_parentTool)

Constructor of cHapticPoint.

chai3d::cHapticPoint::~cHapticPoint ( )
virtual

Destructor of cHapticPoint.

Member Function Documentation

void chai3d::cHapticPoint::initialize ( )

This method resets the position of the proxy to be at the current desired goal position.

void chai3d::cHapticPoint::initialize ( cVector3d  a_globalPos)

This method initializes the position of the haptic point to a new desired position. The proxy and the device are set to the same value despite any constraints.

Parameters
a_globalPosNew desired position of the haptic point.
cGenericTool* chai3d::cHapticPoint::getParentTool ( )
inline
cVector3d chai3d::cHapticPoint::getGlobalPosGoal ( )

This method returns the current desired goal position of the contact point in world global coordinates.

Returns
Goal position of haptic point.
cVector3d chai3d::cHapticPoint::getGlobalPosProxy ( )

This method returns the current proxy position of the haptic point in world global coordinates.

Returns
Proxy position of haptic point.
cVector3d chai3d::cHapticPoint::getLocalPosGoal ( )

This method returns the current desired goal position of the haptic point in local tool coordinates.

Returns
Goal position of haptic point.
cVector3d chai3d::cHapticPoint::getLocalPosProxy ( )

This method returns the current proxy position of the haptic point in local tool coordinates.

Returns
Proxy position of haptic point.
void chai3d::cHapticPoint::setRadius ( double  a_radius)

This method sets the radius size of the haptic point. The radius affects the physical radius of the proxy and the radius of the spheres that are used to render the goal and proxy positions.

Parameters
a_radiusNew radius for display rendering and contact computation.
void chai3d::cHapticPoint::setRadius ( double  a_radiusDisplay,
double  a_radiusContact 
)

This method sets the radius size of the display spheres (goal and proxy) and physical contact sphere (proxy) used to compute the contact forces. Setting the a_radiusContact parameter to zero will generally accelerate the force rendering algorithm. For more realistic effects, settings both values to be identical is recommended

Parameters
a_radiusDisplayNew radius for display of spheres (proxy and goal).
a_radiusContactNew radius for contact computation (proxy).
void chai3d::cHapticPoint::setRadiusContact ( double  a_radiusContact)

This method sets the radius size of the physical proxy.

Parameters
a_radiusContactNew radius for contact computation (proxy).
double chai3d::cHapticPoint::getRadiusContact ( )
inline
void chai3d::cHapticPoint::setRadiusDisplay ( double  a_radiusDisplay)

This method sets the radius size of the sphere used to display the proxy and goal position.

Parameters
a_radiusDisplayNew radius for display of spheres (proxy and goal).
double chai3d::cHapticPoint::getRadiusDisplay ( )
inline
void chai3d::cHapticPoint::setShow ( bool  a_showProxy = true,
bool  a_showGoal = false,
cColorf  a_colorLine = cColorf(0.5, 0.5, 0.5) 
)

This method sets the display options of the goal and proxy spheres. If both spheres are enabled, a small line is drawn between both spheres.

Parameters
a_showProxyIf true, then the proxy sphere is displayed.
a_showGoalIf true, then the goal sphere is displayed.
a_colorLineColor of line connecting proxy to goal spheres.
bool chai3d::cHapticPoint::createAudioSource ( cAudioDevice a_audioDevice)

This method creates an audio source for this haptic point.

Parameters
a_audioDeviceAudio device.
int chai3d::cHapticPoint::getNumCollisionEvents ( )
inline
cCollisionEvent* chai3d::cHapticPoint::getCollisionEvent ( const int  a_index)
inline
int chai3d::cHapticPoint::getNumInteractionEvents ( )
inline
cInteractionEvent* chai3d::cHapticPoint::getInteractionEvent ( const int  a_index)
inline
cVector3d chai3d::cHapticPoint::computeInteractionForces ( cVector3d a_globalPos,
cMatrix3d a_globalRot,
cVector3d a_globalLinVel,
cVector3d a_globalAngVel 
)

This method computes all interaction forces between the tool haptic points and the virtual environment.

Parameters
a_globalPosNew desired goal position.
a_globalRotNew desired goal rotation.
a_globalLinVelLinear velocity of tool.
a_globalAngVelAngular velocity of tool.
Returns
Computed interaction force in world coordinates.
cVector3d chai3d::cHapticPoint::getLastComputedForce ( )
inline
bool chai3d::cHapticPoint::isInContact ( cGenericObject a_object)

This method checks if the tool is touching a particular object passed as argument.

Parameters
a_objectObject to checked for possible contact.
Returns
true if the object is in contact with tool, false otherwise.
void chai3d::cHapticPoint::render ( cRenderOptions a_options)

This method renders the tool graphically using OpenGL.

Parameters
a_optionsRendering options.
void chai3d::cHapticPoint::updateSpherePositions ( )
protected

This method updates the position of the spheres in tool coordinates. The position of the actual proxy and goal spheres need to be expressed in the tool's local coordinate system. This comes from the fact that the contact points are rendered at the same time as the tool, respectively when the OpenGL model view matrix corresponds to the one of the parent tool.

Member Data Documentation

cAlgorithmFingerProxy* chai3d::cHapticPoint::m_algorithmFingerProxy
cAlgorithmPotentialField* chai3d::cHapticPoint::m_algorithmPotentialField
cShapeSphere* chai3d::cHapticPoint::m_sphereProxy
cShapeSphere* chai3d::cHapticPoint::m_sphereGoal
cColorf chai3d::cHapticPoint::m_colorLine
cGenericTool* chai3d::cHapticPoint::m_parentTool
protected
cVector3d chai3d::cHapticPoint::m_lastComputedGlobalForce
protected
double chai3d::cHapticPoint::m_radiusDisplay
protected
double chai3d::cHapticPoint::m_radiusContact
protected
cGenericObject* chai3d::cHapticPoint::m_meshProxyContacts[3]
protected
cAudioSource* chai3d::cHapticPoint::m_audioSourceImpact[3]
protected
cAudioSource* chai3d::cHapticPoint::m_audioSourceFriction[3]
protected
bool chai3d::cHapticPoint::m_useAudioSources
protected
cGenericObject* chai3d::cHapticPoint::m_audioProxyContacts[3]
protected

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