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... | |
cGenericTool * | getParentTool () |
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 () |
cCollisionEvent * | getCollisionEvent (const int a_index) |
int | getNumInteractionEvents () |
cInteractionEvent * | getInteractionEvent (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 | |
cAlgorithmFingerProxy * | m_algorithmFingerProxy |
Finger-proxy algorithm used for modeling contacts with cMesh objects. More... | |
cAlgorithmPotentialField * | m_algorithmPotentialField |
Potential field algorithm used for modeling interaction forces with objects that have haptic effects programmed. More... | |
cShapeSphere * | m_sphereProxy |
Sphere object used for rendering the proxy position. More... | |
cShapeSphere * | m_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 | |
cGenericTool * | m_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... | |
cGenericObject * | m_meshProxyContacts [3] |
Pointer to mesh objects for which the proxy is in contact with. More... | |
cAudioSource * | m_audioSourceImpact [3] |
Optional audio source for rendering sound impacts with environment. More... | |
cAudioSource * | m_audioSourceFriction [3] |
Optional audio source for rendering sound friction. More... | |
bool | m_useAudioSources |
If true then audio sources are enabled. More... | |
cGenericObject * | m_audioProxyContacts [3] |
Pointers to mesh objects for which the proxy was last in contact with. More... | |
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.
chai3d::cHapticPoint::cHapticPoint | ( | cGenericTool * | a_parentTool | ) |
Constructor of cHapticPoint.
|
virtual |
Destructor of cHapticPoint.
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.
a_globalPos | New desired position of the haptic point. |
|
inline |
cVector3d chai3d::cHapticPoint::getGlobalPosGoal | ( | ) |
This method returns the current desired goal position of the contact point in world global coordinates.
cVector3d chai3d::cHapticPoint::getGlobalPosProxy | ( | ) |
This method returns the current proxy position of the haptic point in world global coordinates.
cVector3d chai3d::cHapticPoint::getLocalPosGoal | ( | ) |
This method returns the current desired goal position of the haptic point in local tool coordinates.
cVector3d chai3d::cHapticPoint::getLocalPosProxy | ( | ) |
This method returns the current proxy position of the haptic point in local tool coordinates.
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.
a_radius | New 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
a_radiusDisplay | New radius for display of spheres (proxy and goal). |
a_radiusContact | New radius for contact computation (proxy). |
void chai3d::cHapticPoint::setRadiusContact | ( | double | a_radiusContact | ) |
This method sets the radius size of the physical proxy.
a_radiusContact | New radius for contact computation (proxy). |
|
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.
a_radiusDisplay | New radius for display of spheres (proxy and goal). |
|
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.
a_showProxy | If true, then the proxy sphere is displayed. |
a_showGoal | If true, then the goal sphere is displayed. |
a_colorLine | Color of line connecting proxy to goal spheres. |
bool chai3d::cHapticPoint::createAudioSource | ( | cAudioDevice * | a_audioDevice | ) |
This method creates an audio source for this haptic point.
a_audioDevice | Audio device. |
|
inline |
|
inline |
|
inline |
|
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.
a_globalPos | New desired goal position. |
a_globalRot | New desired goal rotation. |
a_globalLinVel | Linear velocity of tool. |
a_globalAngVel | Angular velocity of tool. |
|
inline |
bool chai3d::cHapticPoint::isInContact | ( | cGenericObject * | a_object | ) |
This method checks if the tool is touching a particular object passed as argument.
a_object | Object to checked for possible contact. |
void chai3d::cHapticPoint::render | ( | cRenderOptions & | a_options | ) |
This method renders the tool graphically using OpenGL.
a_options | Rendering options. |
|
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.
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 |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |