chai3d::cGenericTool Class Reference

This class implements a base class for modeling haptic tools. More...

#include <CGenericTool.h>

Inheritance diagram for chai3d::cGenericTool:

Public Member Functions

 cGenericTool (cWorld *a_parentWorld)
 Constructor of cGenericTool. More...
 
virtual ~cGenericTool ()
 Destructor of cGenericTool. More...
 
void setHapticDevice (cGenericHapticDevicePtr a_hapticDevice)
 This method define a haptic device that will control this tool. More...
 
cGenericHapticDevicePtr getHapticDevice ()
 This method returns a pointer to the haptic device that is controlling this tool. More...
 
virtual bool start ()
 This method starts communication with the haptic device and initializes the tool. More...
 
virtual bool stop ()
 This method stops communication with the haptic device. More...
 
virtual void initialize ()
 This method resets the contact force models and sets the tool at the position of the haptic device. More...
 
virtual void updateFromDevice ()
 This method updates the position, orientation, velocity and other degree of freedoms of the tool by reading sensor data from the haptic device. More...
 
virtual void computeInteractionForces ()
 This method computes all interaction forces between the tool's haptic points and the virtual environment. More...
 
virtual bool applyToDevice ()
 This method sends the latest computed interaction force, torque, and gripper force to the haptic device. More...
 
virtual bool setForcesON ()
 This method enables forces to the haptic device. More...
 
virtual bool setForcesOFF ()
 This method disables forces to the haptic device. More...
 
void setWaitForSmallForce (const bool a_value)
 This method enables the tool to wait for the simulation to compute a small force before sending it to the haptic device. This feature typically avoids having the device "jump" at the initialization of an application. More...
 
bool getWaitForSmallForce ()
 This method returns the status about waiting for small small forces to appear before sending them to the haptic device. More...
 
void setSmallForceThresh (const double a_smallForceThresh)
 This method sets the force threshold required to engage forces when setWaitForSmallForce() is enabled. More...
 
double getSmallForceThresh ()
 This method returns the force threshold required to engage forces when setWaitForSmallForce() is enabled. More...
 
void setUseForceRise (const bool a_value)
 This method enables or disables the tool to gradually rise forces at startup. More...
 
bool getUseForceRise ()
 This method returns the status about force rising mode. More...
 
void setRiseTime (const double a_riseTime)
 This method sets the time required to rise the forces from 0% to 100%. More...
 
double getRiseTime ()
 This method returns the force rise time. More...
 
virtual bool getUserSwitch (const unsigned int a_switchIndex) const
 This method returns the status of a user switch from the device. More...
 
virtual void setUserSwitch (const unsigned int a_switchIndex, const bool a_value)
 This method overrides the status of a selected user switch. More...
 
virtual unsigned int getUserSwitches () const
 This method returns the status of all user switches on the device. More...
 
virtual void setUserSwitches (const unsigned int a_userSwitches)
 This method overrides the status of all user switches on the device. More...
 
virtual double getGripperAngleRad () const
 This method returns the angle in radians of the gripper. More...
 
virtual void setGripperAngleRad (const double &a_gripperAngleRad)
 This method overrides the angle in radians of the gripper. More...
 
virtual double getGripperAngleDeg () const
 This method returns the angle in degrees of the gripper. More...
 
virtual void setGripperAngleDeg (const double &a_gripperAngleDeg)
 This method overrides the angle in degrees of the gripper. More...
 
virtual double getGripperAngVel () const
 This method returns the angular velocity in radians per second of the gripper. More...
 
virtual void setGripperAngVel (const double &a_gripperAngVel)
 This method overrides the angular velocity of the gripper in radians per second. More...
 
virtual cVector3d getDeviceLocalPos () const
 This method returns the position of the haptic device expressed in device local coordinates. More...
 
virtual void setDeviceLocalPos (const cVector3d &a_localPos)
 This method overrides the position of the haptic device expressed in device local coordinates. More...
 
void setDeviceLocalPos (const double &a_x, const double &a_y, const double &a_z)
 This method overrides the position of the haptic device expressed in device local coordinates. More...
 
virtual cVector3d getDeviceGlobalPos () const
 This method returns the position of the haptic device expressed in world global coordinates. More...
 
virtual void setDeviceGlobalPos (const cVector3d &a_globalPos)
 This method overrides the position of the haptic device expressed in world global coordinates. More...
 
void setDeviceGlobalPos (const double &a_x, const double &a_y, const double &a_z)
 This method overrides the position of the haptic device expressed in world global coordinates. More...
 
virtual cVector3d getDeviceLocalLinVel () const
 This method returns the linear velocity of the device expressed in device local coordinates. More...
 
virtual void setDeviceLocalLinVel (const cVector3d &a_localLinVel)
 This method overrides the linear velocity of the device expressed in device local coordinates. More...
 
void setDeviceLocalLinVel (const double &a_x, const double &a_y, const double &a_z)
 This method overrides the linear velocity of the device expressed in device local coordinates. More...
 
virtual cVector3d getDeviceGlobalLinVel () const
 This method returns the linear velocity of the device expressed in world global coordinates. More...
 
virtual void setDeviceGlobalLinVel (const cVector3d &a_globalLinVel)
 This method overrides the linear velocity of the device expressed in world global coordinates. More...
 
void setDeviceGlobalLinVel (const double &a_x, const double &a_y, const double &a_z)
 This method overrides the linear velocity of the device expressed in world global coordinates. More...
 
virtual cMatrix3d getDeviceLocalRot () const
 This method returns the orientation of the haptic device expressed in device local coordinates. More...
 
virtual void setDeviceLocalRot (const cMatrix3d &a_localRot)
 This method overrides the orientation of the haptic device expressed in device local coordinates. More...
 
virtual void setDeviceGlobalRot (const cMatrix3d &a_globalRot)
 This method overrides the orientation of the haptic device expressed in world global coordinates. More...
 
virtual cMatrix3d getDeviceGlobalRot () const
 This method returns the orientation of the haptic device expressed in world global coordinates. More...
 
virtual cVector3d getDeviceLocalAngVel () const
 This method returns the angular velocity of the device expressed in device local coordinates. More...
 
virtual void setDeviceLocalAngVel (const cVector3d &a_localAngVel)
 This method overrides the angular velocity of the device expressed in device local coordinates. More...
 
void setDeviceLocalAngVel (const double &a_x, const double &a_y, const double &a_z)
 This method overrides the angular velocity of the device expressed in device local coordinates. More...
 
virtual cVector3d getDeviceGlobalAngVel () const
 This method returns the angular velocity of the device expressed in world global coordinates. More...
 
virtual void setDeviceGlobalAngVel (const cVector3d &a_globalAngVel)
 This method overrides the angular velocity of the device expressed in world global coordinates. More...
 
void setDeviceGlobalAngVel (const double &a_x, const double &a_y, const double &a_z)
 This method overrides the angular velocity of the device expressed in world global coordinates. More...
 
virtual cTransform getDeviceLocalTransform () const
 This method returns a transformation matrix which expresses the position and orientation of the haptic device in the local tool frame. More...
 
virtual void setDeviceLocalTransform (const cTransform &a_localTransform)
 This method overrides the transformation matrix which expresses the position and orientation of the haptic device in the local tool frame. More...
 
virtual cTransform getDeviceGlobalTransform () const
 This method returns a transformation matrix which expresses the position and orientation of the haptic device in world coordinates. More...
 
virtual void setDeviceGlobalTransform (const cTransform &a_globalTransform)
 This method overrides the transformation matrix which expresses the position and orientation of the haptic device in world coordinates. More...
 
virtual double getGripperForce () const
 This method returns the currently computed gripper force. More...
 
virtual void setGripperForce (const double &a_gripperForce)
 This method overrides the current gripper force. More...
 
virtual void addGripperForce (const double &a_gripperForce)
 This method adds a force to the currently computed gripper force. More...
 
virtual cVector3d getDeviceLocalForce () const
 This method returns the currently computed force expressed in device or tool local coordinates. More...
 
virtual void setDeviceLocalForce (const cVector3d &a_localForce)
 This method overrides the current force expressed in device or tool local coordinates. More...
 
void setDeviceLocalForce (const double &a_x, const double &a_y, const double &a_z)
 This method overrides the current force expressed in device or tool local coordinates. More...
 
virtual void addDeviceLocalForce (const cVector3d &a_localForce)
 This method adds a force to the currently computed force expressed in device or tool local coordinates. More...
 
void addDeviceLocalForce (const double &a_x, const double &a_y, const double &a_z)
 This method adds a force to the currently computed force expressed in device or tool local coordinates. More...
 
virtual cVector3d getDeviceGlobalForce () const
 This method returns the currently computed force expressed in world coordinates. More...
 
virtual void setDeviceGlobalForce (const cVector3d &a_globalForce)
 This method overrides the current force expressed in world coordinates. More...
 
void setDeviceGlobalForce (const double &a_x, const double &a_y, const double &a_z)
 This method overrides the current force expressed in world coordinates. More...
 
virtual void addDeviceGlobalForce (const cVector3d &a_globalForce)
 This method adds a force to the currently computed force expressed in world coordinates. More...
 
void addDeviceGlobalForce (const double &a_x, const double &a_y, const double &a_z)
 This method adds a force to the currently computed force expressed in world coordinates. More...
 
virtual cVector3d getDeviceLocalTorque () const
 This method returns the currently computed torque expressed in device or tool local coordinates. More...
 
virtual void setDeviceLocalTorque (const cVector3d &a_localTorque)
 This method overrides the current torque expressed in device local coordinates. More...
 
void setDeviceLocalTorque (const double &a_x, const double &a_y, const double &a_z)
 This method overrides the current torque expressed in device local coordinates. More...
 
virtual void addDeviceLocalTorque (const cVector3d &a_localTorque)
 This method adds a torque to the currently computed torque expressed in device local coordinates. More...
 
void addDeviceLocalTorque (const double &a_x, const double &a_y, const double &a_z)
 This method adds a torque to the currently computed torque expressed in device local coordinates. More...
 
virtual cVector3d getDeviceGlobalTorque () const
 This method returns the currently computed torque expressed in world coordinates. More...
 
virtual void setDeviceGlobalTorque (const cVector3d &a_globalTorque)
 This method overrides the current torque expressed in world coordinates. More...
 
void setDeviceGlobalTorque (const double &a_x, const double &a_y, const double &a_z)
 This method overrides the current torque expressed in world coordinates. More...
 
virtual void addDeviceGlobalTorque (const cVector3d &a_globalTorque)
 This method adds a torque to the currently computed torque expressed in world coordinates. More...
 
void addDeviceGlobalTorque (const double &a_x, const double &a_y, const double &a_z)
 This method adds a torque to the curently computed torque expressed in world coordinates. More...
 
bool setWorkspaceRadius (const double &a_workspaceRadius)
 This method set the translational virtual workspace dimensions in which tool will be working. More...
 
double getWorkspaceRadius ()
 This method returns the radius of the workspace of the tool. More...
 
bool setWorkspaceScaleFactor (const double &a_workspaceScaleFactor)
 This method sets the scale factor between the workspaces of the haptic device and the virtual tool. More...
 
double getWorkspaceScaleFactor ()
 This method returns the current workspace scale factor between the haptic device and the tool. More...
 
virtual bool isInContact (cGenericObject *a_object)
 This method checks if the tool is touching a particular object. More...
 
int getNumHapticPoints ()
 This method returns the number of haptic points that describe this tool. More...
 
cHapticPointgetHapticPoint (int a_index)
 This method returns a pointer to a haptic point by passing its index number. More...
 
virtual void setRadius (double a_radius)
 This method sets the radius size of all haptic points. More...
 
virtual void setRadius (double a_radiusDisplay, double a_radiusContact)
 This method sets the radius size of all haptic points. More...
 
virtual void setRadiusContact (double a_radiusContact)
 This method sets the radius size of the of the physical proxy used in all haptic points. More...
 
virtual void setRadiusDisplay (double a_radiusDisplay)
 This method sets the radius size of the spheres used to display the proxies and goals positions. More...
 
virtual void setShowContactPoints (bool a_showProxy=true, bool a_showGoal=false, cColorf a_colorLine=cColorf(0.5, 0.5, 0.5))
 This method sets the display properties of all haptic points. More...
 
cWorldgetParentWorld ()
 This method returns the parent world of this tool. More...
 
virtual void enableDynamicObjects (bool a_enabled)
 This method enables or disables the dynamic proxy algorithm to support environments where mesh objects move. More...
 
bool createAudioSource (cAudioDevice *a_audioDevice)
 This method creates an audio source for each haptic point of this tool. More...
 
virtual void render (cRenderOptions &a_options)
 This method renders the tool graphically using OpenGL. More...
 
virtual void setShaderProgram (cShaderProgramPtr a_shaderProgram, const bool a_affectChildren=false)
 This method assigns a shader program to this object, optionally propagating the operation to its children.. More...
 
- Public Member Functions inherited from chai3d::cGenericObject
 cGenericObject ()
 Constructor of cGenericObject. More...
 
virtual ~cGenericObject ()
 Destructor of cGenericObject. More...
 
virtual void setEnabled (bool a_enabled, const bool a_affectChildren=false)
 This method enables or disable this object. When an object is disabled, both haptic and graphic rendering no longer occur. More...
 
bool getEnabled () const
 This method returns true if the object is enabled, false otherwise. More...
 
virtual cGenericObjectcopy (const bool a_duplicateMaterialData=false, const bool a_duplicateTextureData=false, const bool a_duplicateMeshData=false, const bool a_buildCollisionDetector=true)
 This method creates a copy of itself. More...
 
virtual void setLocalPos (const cVector3d &a_localPos)
 This method sets the local position of this object. More...
 
void setLocalPos (const double a_x=0.0, const double a_y=0.0, const double a_z=0.0)
 This method sets the local position of this object. More...
 
cVector3d getLocalPos () const
 This method returns the local position of this object. More...
 
cVector3d getGlobalPos () const
 This method returns the global position of this object. More...
 
virtual void setLocalRot (const cMatrix3d &a_localRot)
 This method sets the local rotation matrix for this object. More...
 
cMatrix3d getLocalRot () const
 This method returns the local rotation matrix of this object. More...
 
cMatrix3d getGlobalRot () const
 This method returns the global rotation matrix of this object. More...
 
void setLocalTransform (const cTransform &a_transform)
 This method returns the local position and rotation matrix by passing a transformation matrix. More...
 
cTransform getLocalTransform ()
 This method returns the local position and rotation matrix in a transformation matrix. More...
 
cTransform getGlobalTransform ()
 This method returns the global position and rotation matrix in a transformation matrix. More...
 
void translate (const cVector3d &a_translation)
 This method translates this object by a specified offset. More...
 
void translate (const double a_x, const double a_y, const double a_z=0.0)
 This method translates this object by a specified offset. More...
 
void rotateAboutLocalAxisRad (const cVector3d &a_axis, const double a_angleRad)
 This method rotates this object around a local axis. Angle magnitude is defined in radians. More...
 
void rotateAboutLocalAxisDeg (const cVector3d &a_axis, const double a_angleDeg)
 This method rotates this object around a local axis. Angle magnitude is defined in degrees. More...
 
void rotateAboutLocalAxisRad (const double a_axisX, const double a_axisY, const double a_axisZ, const double a_angleRad)
 This method rotates this object around a local axis. Angle magnitude is defined in radians. More...
 
void rotateAboutLocalAxisDeg (const double a_axisX, const double a_axisY, const double a_axisZ, const double a_angleDeg)
 This method rotates this object around a local axis. Angle magnitude is defined in degrees. More...
 
void rotateAboutGlobalAxisRad (const cVector3d &a_axis, const double a_angleRad)
 This method rotates this object around a global axis. Angle magnitude is defined in radians. More...
 
void rotateAboutGlobalAxisDeg (const cVector3d &a_axis, const double a_angleDeg)
 This method rotates this object around a global axis. Angle magnitude is defined in degrees. More...
 
void rotateAboutGlobalAxisRad (const double a_axisX, const double a_axisY, const double a_axisZ, const double a_angleRad)
 This method rotate this object around a local axis. Angle magnitude is defined in radians. More...
 
void rotateAboutGlobalAxisDeg (const double a_axisX, const double a_axisY, const double a_axisZ, const double a_angleDeg)
 This method rotates this object around a local axis. Angle magnitude is defined in degrees. More...
 
void rotateExtrinsicEulerAnglesRad (const double &a_angleRad1, const double &a_angleRad2, const double &a_angleRad3, const cEulerOrder a_eulerOrder)
 This method rotates this object using fixed Euler representation. Angles are defined in radians. More...
 
void rotateExtrinsicEulerAnglesDeg (const double &a_angleDeg1, const double &a_angleDeg2, const double &a_angleDeg3, const cEulerOrder a_eulerOrder)
 This method rotates this object using fixed Euler representation. Angles are defined in radians. More...
 
void rotateIntrinsicEulerAnglesRad (const double &a_angleRad1, const double &a_angleRad2, const double &a_angleRad3, const cEulerOrder a_eulerOrder)
 This method rotates this object using co-moving Euler representation. Angles are defined in radians. More...
 
void rotateIntrinsicEulerAnglesDeg (const double &a_angleDeg1, const double &a_angleDeg2, const double &a_angleDeg3, const cEulerOrder a_eulerOrder)
 This method rotates this object using co-moving Euler representation. Angles are defined in radians. More...
 
virtual void computeGlobalPositions (const bool a_frameOnly=true, const cVector3d &a_globalPos=cVector3d(0.0, 0.0, 0.0), const cMatrix3d &a_globalRot=cIdentity3d())
 This method computes the global position and rotation of this object and its children. More...
 
void computeGlobalPositionsFromRoot (const bool a_frameOnly=true)
 This method computes the global position and rotation of current object only. More...
 
bool addEffect (cGenericEffect *a_effect)
 This method adds a haptic effect to this object. More...
 
bool removeEffect (cGenericEffect *a_effect)
 This method removes a haptic effect from this object. More...
 
void deleteAllEffects ()
 This method removes all haptic effects. More...
 
bool createEffectMagnetic ()
 This method creates a magnetic haptic effect. More...
 
bool deleteEffectMagnetic ()
 This method deletes any current magnetic haptic effect. More...
 
bool createEffectStickSlip ()
 This method creates a stick-and-slip haptic effect. More...
 
bool deleteEffectStickSlip ()
 This method delete any current stick-and-slip haptic effect. More...
 
bool createEffectSurface ()
 This method creates a surface haptic effect. More...
 
bool deleteEffectSurface ()
 This method deletes any current surface haptic effect. More...
 
bool createEffectVibration ()
 This method creates a vibration haptic effect. More...
 
bool deleteEffectVibration ()
 This method deletes any current vibration haptic effect. More...
 
bool createEffectViscosity ()
 This method creates a viscous haptic effect. More...
 
bool deleteEffectViscosity ()
 This method deletes any current viscous haptic effect. More...
 
virtual void setHapticEnabled (const bool a_hapticEnabled, const bool a_affectChildren=true)
 This method enables or disables haptic perception of this object, optionally propagating the change to children. More...
 
bool getHapticEnabled () const
 This method returns the haptic status of object (true means it can be felt when visible). More...
 
virtual void setStiffness (const double a_stiffness, const bool a_affectChildren=true)
 This method sets the haptic stiffness of the object, optionally recursively affecting children. More...
 
virtual void setFriction (double a_staticFriction, double a_dynamicFriction, const bool a_affectChildren=true)
 This method sets the static and dynamic friction properties (polygonal models only), optionally recursively affecting children. More...
 
virtual void setShowEnabled (const bool a_show, const bool a_affectChildren=true)
 This method enables or disables the graphic display of this object, optionally propagating the change to children. More...
 
bool getShowEnabled () const
 This method returns the display status of object (true means it's visible). More...
 
virtual void setWireMode (const bool a_showWireMode, const bool a_affectChildren=false)
 This method enables or disables wireframe rendering, optionally propagating the operation to my children. More...
 
bool getWireMode () const
 This method returns whether wireframe rendering is enabled. More...
 
virtual void setUseCulling (const bool a_useCulling, const bool a_affectChildren=false)
 This method enables or disables face-culling, optionally propagating the operation to my children. More...
 
bool getUseCulling () const
 This method returns true if face-culling is enabled, false otherwise. More...
 
virtual void setUseTransparency (const bool a_useTransparency, const bool a_affectChildren=false)
 This method enables or disables transparency. More...
 
bool getUseTransparency () const
 This method returns true if transparency is enabled, false otherwise. More...
 
virtual void setTransparencyLevel (const float a_level, const bool a_applyToVertices=false, const bool a_applyToTextures=false, const bool a_affectChildren=false)
 This method sets the transparency level of the object. More...
 
virtual void setUseDisplayList (const bool a_useDisplayList, const bool a_affectChildren=false)
 This method enabled or disables the use of a display list for rendering, optionally propagating the operation to its children. More...
 
bool getUseDisplayList () const
 This method returns true if a display list is activated, false otherwise. More...
 
virtual void markForUpdate (const bool a_affectChildren=false)
 This method invalidates any existing display lists, optionally propagating the operation to its children. More...
 
virtual void setUseVertexColors (const bool a_useColors, const bool a_affectChildren=false)
 This method enables or disables the use of per-vertex colors, optionally propagating the operation to its children. More...
 
bool getUseVertexColors () const
 This method returns true is per-vertex color properties are enabled, false otherwise. More...
 
virtual void setUseMaterial (const bool a_useMaterial, const bool a_affectChildren=false)
 This method enables or disables the use of material properties, optionally propagating the operation to its children. More...
 
bool getUseMaterial () const
 This method returns true is material properties are enabled, false otherwise. More...
 
virtual void setMaterial (cMaterialPtr a_material, const bool a_affectChildren=false)
 This method sets the material properties of this object, optionally propagating the operation to its children. More...
 
virtual void setMaterial (cMaterial &a_material, const bool a_affectChildren=false)
 This method setd the material properties of this object, optionally propagating the operation to its children. More...
 
virtual void backupMaterialColors (const bool a_affectChildren=false)
 This method creates a backup of the material colors of this object, optionally propagating the operation to its children. More...
 
virtual void restoreMaterialColors (const bool a_affectChildren=false)
 This method restores the material color properties of this object from a previous backup, optionally propagating the operation to its children. More...
 
virtual void setUseTexture (const bool a_useTexture, const bool a_affectChildren=false)
 This method enables or disables the use of texture-mapping, optionally propagating the operation to its children. More...
 
bool getUseTexture () const
 This method returns true if texture-mapping is enabled, false otherwise. More...
 
virtual void setTexture (cTexture1dPtr a_texture, const bool a_affectChildren=false)
 This method sets a texture to this object, optionally propagating the operation to its children. More...
 
virtual cShaderProgramPtr getShaderProgram ()
 This method returns a pointer to the current shader program. More...
 
virtual void setShowBoundaryBox (const bool a_showBoundaryBox, const bool a_affectChildren=false)
 This method enables or disabled the graphic display of the boundary box for this object, optionally propagating the change to its children. More...
 
bool getShowBoundaryBox () const
 This method returns true if the boundary box is being displayed, false otherwise. More...
 
cVector3d getBoundaryMin () const
 This method returns the minimum point of this object's boundary box. More...
 
cVector3d getBoundaryMax () const
 This method returns the maximum point of this object's boundary box. More...
 
cVector3d getBoundaryCenter () const
 This method computes and returns the center of this object's boundary box. More...
 
bool getBoundaryBoxEmpty ()
 This method returns true, if the boundary box is empty, otherwise false. More...
 
virtual void computeBoundaryBox (const bool a_includeChildren=true)
 This method computes this object's boundary box, optionally forcing it to bound child objects. More...
 
virtual void setShowFrame (const bool a_showFrame, const bool a_affectChildren=false)
 This method enables or disables the graphic display of the reference frame arrows for this object, optionally propagating the change to its children. More...
 
bool getShowFrame (void) const
 This method returns true if the display of the reference frame is enabled, false otherwise. More...
 
virtual void setFrameSize (const double a_size=1.0, const bool a_affectChildren=false)
 This method sets the size of the rendered reference frame, optionally propagating the change to its children. More...
 
double getFrameSize () const
 This method returns the size of the graphical reference frame. More...
 
void setCollisionDetector (cGenericCollision *a_collisionDetector)
 This method sets a collision detector to this current object. More...
 
cGenericCollisiongetCollisionDetector () const
 This method returns a pointer to this object's current collision detector. More...
 
virtual void deleteCollisionDetector (const bool a_affectChildren=false)
 This method deletes any existing collision detector. More...
 
virtual bool computeCollisionDetection (const cVector3d &a_segmentPointA, const cVector3d &a_segmentPointB, cCollisionRecorder &a_recorder, cCollisionSettings &a_settings)
 This method computes any collision between a segment and this object. More...
 
virtual void setShowCollisionDetector (const bool a_showCollisionDetector, const bool a_affectChildren=false)
 This method enables or disables the display of the collision detector, optionally propagating the change to its children. More...
 
bool getShowCollisionDetector ()
 This method returns true if the collision detector is being displayed graphically, false otherwise. More...
 
virtual void setCollisionDetectorProperties (unsigned int a_displayDepth, cColorf &a_color, const bool a_affectChildren=false)
 This method sets the collision detector graphic display properties. More...
 
void setParent (cGenericObject *a_parent)
 This method sets the parent of this object. More...
 
cGenericObjectgetParent () const
 This method returns the parent of this object. More...
 
void setOwner (cGenericObject *a_owner)
 This method sets a link to an object that owns this object. This could be a super parent for instance. More...
 
cGenericObjectgetOwner ()
 This method returns the owner of this object. More...
 
cGenericObjectgetChild (const unsigned int a_index) const
 This method returns a selected child from the list of children. More...
 
bool addChild (cGenericObject *a_object)
 This method add an object to the list of children. More...
 
bool removeChild (cGenericObject *a_object)
 This method removes an object from the list of children, without deleting it. More...
 
bool removeFromGraph ()
 This method removes this object from its parent's list of children. More...
 
bool deleteChild (cGenericObject *a_object)
 This method removes an object from its list of children and deletes it. More...
 
void clearAllChildren ()
 This method clears all objects from its list of children, without deleting them. More...
 
void deleteAllChildren ()
 This method clears and delete all objects from its list of children. More...
 
unsigned int getNumChildren ()
 This method returns the number of children from its list of children. More...
 
unsigned int getNumDescendants (bool a_includeCurrentObject=false)
 This method returns the total number of descendants, optionally including this object. More...
 
void setGhostEnabled (bool a_ghostEnabled)
 This method enables or disables this object to be a ghost node. More...
 
bool getGhostEnabled ()
 This method returns truee if this object is a ghost node. More...
 
virtual void scale (const double &a_scaleFactor, const bool a_affectChildren=true)
 This method scales the size of this object. More...
 
virtual void renderSceneGraph (cRenderOptions &a_options)
 This method renders the entire scene graph, starting from this object. More...
 
virtual void adjustCollisionSegment (cVector3d &a_segmentPointA, cVector3d &a_segmentPointAadjusted)
 This method adjusts the collision segment to handle objects in motion. More...
 
virtual cVector3d computeInteractions (const cVector3d &a_toolPos, const cVector3d &a_toolVel, const unsigned int a_IDN, cInteractionRecorder &a_interactions)
 This method computes all haptic interaction between a tool and this object using the haptic effects. More...
 
- Public Member Functions inherited from chai3d::cGenericType
 cGenericType ()
 Constructor of cGenericType. More...
 
virtual ~cGenericType ()
 Destructor of cGenericType. More...
 

Public Attributes

cGenericObjectm_image
 Generic image model that can be used to display any a representation of the tool. More...
 
- Public Attributes inherited from chai3d::cGenericObject
std::string m_name
 Name of current object (filename). More...
 
cMaterialPtr m_material
 Material property. More...
 
cTexture1dPtr m_texture
 Texture property. More...
 
cNormalMapPtr m_normalMap
 Normal map property. More...
 
int m_userTag
 An arbitrary tag, not used by CHAI3D. More...
 
void * m_userData
 An arbitrary data pointer, not used by CHAI3D. More...
 
std::string m_userName
 Name of current object, not used by CHAI3D. More...
 
cGenericObjectm_userExternalObject
 A link to an external cGenericObject object, not used by CHAI3D. More...
 
cVector3d m_interactionPoint
 Projection of the most recent haptic point (tool) onto the surface of the virtual object. More...
 
cVector3d m_interactionNormal
 Surface normal at the current interaction point. More...
 
bool m_interactionInside
 Was the last tool (haptic point) located inside the object? More...
 

Protected Member Functions

virtual void updateToolImagePosition ()
 This method updates the position and orientation of the tool image. More...
 
virtual void updateGlobalPositions (const bool a_frameOnly)
 This method updates the global position of this tool in the world. More...
 
- Protected Member Functions inherited from chai3d::cGenericObject
virtual void updateBoundaryBox ()
 This method updates the boundary box of this object. More...
 
virtual void scaleObject (const double &a_scaleFactor)
 This method scales the size of this object with given scale factor. More...
 
virtual void computeLocalInteraction (const cVector3d &a_toolPos, const cVector3d &a_toolVel, const unsigned int a_IDN)
 This method updates the geometric relationship between the tool and the current object. More...
 
virtual cVector3d computeOtherInteractions (const cVector3d &a_toolPos, const cVector3d &a_toolVel, const unsigned int a_IDN, cInteractionRecorder &a_interactions)
 This method computes any additional interactions between the object and the tools. More...
 
virtual bool computeOtherCollisionDetection (cVector3d &a_segmentPointA, cVector3d &a_segmentPointB, cCollisionRecorder &a_recorder, cCollisionSettings &a_settings)
 This method computes any additional collisions other than the ones computed by the default collision detector. More...
 
void copyGenericObjectProperties (cGenericObject *a_objDest, const bool a_duplicateMaterialData, const bool a_duplicateTextureData, const bool a_duplicateMeshData, const bool a_buildCollisionDetector)
 This method copies all properties of the current generic object to another. More...
 

Protected Attributes

std::vector< cHapticPoint * > m_hapticPoints
 Haptic points that describe the tool. More...
 
cGenericHapticDevicePtr m_hapticDevice
 Handle to the haptic device. More...
 
unsigned int m_userSwitches
 Status of the user switches of the device attached to the tool. More...
 
bool m_enabled
 If true then the tool has been started and is enabled. false otherwise. More...
 
cVector3d m_deviceLocalForce
 Currently computed interaction force [N] in device or tool local coordinates. More...
 
cVector3d m_deviceGlobalForce
 Currently computed interaction force [N] in world global coordinates. More...
 
cVector3d m_deviceLocalTorque
 Currently computed interaction torque [N*m] in device or tool local coordinates. More...
 
cVector3d m_deviceGlobalTorque
 Currently computed interaction torque [N*m] in world global coordinates. More...
 
double m_gripperForce
 Currently computed interaction gripper force [N]. More...
 
double m_workspaceRadius
 Radius of the workspace which can be accessed by the tool. More...
 
double m_workspaceScaleFactor
 Scale factor applied between the workspaces of the haptic device and the tool. More...
 
cVector3d m_deviceLocalPos
 Position of the haptic device in device local coordinates. More...
 
cVector3d m_deviceGlobalPos
 Position of the haptic device in world global coordinates. More...
 
cMatrix3d m_deviceLocalRot
 Orientation of the haptic device in device local coordinates. More...
 
cMatrix3d m_deviceGlobalRot
 Orientation of the haptic device in world global coordinates. More...
 
cVector3d m_deviceLocalLinVel
 Linear velocity of the haptic device in device local coordinates. More...
 
cVector3d m_deviceGlobalLinVel
 Linear velocity of the haptic device in world global coordinates. More...
 
cVector3d m_deviceLocalAngVel
 Angular velocity of the haptic device in device local coordinates. More...
 
cVector3d m_deviceGlobalAngVel
 Angular velocity of the haptic device in world global coordinates. More...
 
double m_gripperAngle
 Gripper angle in radians. More...
 
double m_gripperAngVel
 Gripper angular velocity in radians per second. More...
 
cWorldm_parentWorld
 Parent world of tool. More...
 
bool m_forceOn
 This flag indicates whether the forces are enabled or disabled on the hapitc device. More...
 
bool m_forceEngaged
 This flag is used to avoid initial bumps in force (has the user sent a small force yet?). More...
 
bool m_useWaitForSmallForce
 The flag indicates if the device should wait for a small commanded force before engaging forces. More...
 
int m_smallForceCounter
 Counter which waits for up to several cycles of "small forces" before enabling force. More...
 
double m_smallForceThresh
 Force threshold that determines when forces are engaged if m_useWaitForSmallForce is enabled. More...
 
bool m_useForceRise
 The flag indicates if the force rising mode is enabled or disabled. More...
 
double m_forceRiseTime
 Force rising time in seconds. More...
 
cPrecisionClock m_forceRiseClock
 Clock to measure force rise. More...
 
bool m_flagForceRiseFirstTime
 Flag that indicates when force ramping is called for the first time. More...
 
bool m_flagForceRiseActivated
 Flag that indicates if forces are currently rising. More...
 
cFrequencyCounter m_freqRead
 Frequency counter to measure how often data is read from haptic device. More...
 
cFrequencyCounter m_freqWrite
 Frequency counter to measure how often data is writing to haptic device. More...
 
- Protected Attributes inherited from chai3d::cGenericObject
cGenericObjectm_parent
 Parent object. More...
 
cGenericObjectm_owner
 
std::vector< cGenericObject * > m_children
 List of children. More...
 
cVector3d m_localPos
 The position of this object in my parent's reference frame. More...
 
cVector3d m_globalPos
 The position of this object in the world's reference frame. More...
 
cMatrix3d m_localRot
 The rotation matrix that rotates my reference frame into my parent's reference frame. More...
 
cMatrix3d m_globalRot
 The rotation matrix that rotates my reference frame into the world's reference frame. More...
 
cVector3d m_prevGlobalPos
 Previous position since last haptic computation. More...
 
cMatrix3d m_prevGlobalRot
 Previous rotation since last haptic computation. More...
 
cVector3d m_boundaryBoxMin
 Minimum position of boundary box. More...
 
cVector3d m_boundaryBoxMax
 Maximum position of boundary box. More...
 
bool m_boundaryBoxEmpty
 If true, then the boundary box does not include any object. More...
 
double m_frameSize
 Size of graphical representation of frame (X-Y-Z). More...
 
double m_frameThicknessScale
 Pen thickness of graphical representation of frame (X-Y-Z). More...
 
bool m_enabled
 If true, the object may be rendered graphically and haptically. More...
 
bool m_showEnabled
 If true, this object is rendered. More...
 
bool m_hapticEnabled
 If true, this object can be felt. More...
 
bool m_ghostEnabled
 If true, object is enabled as ghost. More...
 
bool m_showFrame
 If true, this object's reference frame is rendered as a set of arrows. More...
 
bool m_showBoundaryBox
 If true, this object's boundary box is displayed as a set of lines. More...
 
bool m_showCollisionDetector
 If true, the collision detector is displayed (if available) at this node. More...
 
bool m_useTextureMapping
 Should texture mapping be used? More...
 
bool m_useMaterialProperty
 Should material properties be used? More...
 
bool m_useVertexColors
 Should per-vertex colors be used? More...
 
bool m_useDisplayList
 Should we use a display list to render this mesh? More...
 
cDisplayList m_displayList
 Basic display list for current object. More...
 
int m_triangleMode
 The polygon rendering mode (GL_FILL or GL_LINE). More...
 
bool m_useTransparency
 
bool m_cullingEnabled
 
cShaderProgramPtr m_shaderProgram
 Shader program. More...
 
cTransform m_frameGL
 OpenGL matrix describing my position and orientation transformation. More...
 
cGenericCollisionm_collisionDetector
 The collision detector used to test for contact with this object. More...
 
std::vector< cGenericEffect * > m_effects
 List of haptic effects programmed for this object. More...
 

Additional Inherited Members

- Static Public Attributes inherited from chai3d::cGenericObject
static cColorf s_boundaryBoxColor
 Color of the boundary box. More...
 
- Static Protected Attributes inherited from chai3d::cGenericObject
static cMaterialPtr s_defaultMaterial = nullptr
 Default material property. More...
 

Detailed Description

cGenericTool implements a base class for modeling virtual haptic tools inside a virtual environment (cWorld) that are connected to haptic devices.

Constructor & Destructor Documentation

chai3d::cGenericTool::cGenericTool ( cWorld a_parentWorld)

Constructor of cGenericTool.

Parameters
a_parentWorldParent world in which the tool belongs.
chai3d::cGenericTool::~cGenericTool ( )
virtual

Destructor of cGenericTool.

Member Function Documentation

void chai3d::cGenericTool::setHapticDevice ( cGenericHapticDevicePtr  a_hapticDevice)
inline
cGenericHapticDevicePtr chai3d::cGenericTool::getHapticDevice ( )
inline
bool chai3d::cGenericTool::start ( )
virtual

This method starts the haptic tool. A connection is opened to the haptic device and the position of the tool initialized by reading the current position of the haptic device.

Returns
true if the operation succeeds, false otherwise.
bool chai3d::cGenericTool::stop ( )
virtual

This method stops the haptic tool. The connection to the haptic device is closed

Returns
true if the operation succeeds, false otherwise.
void chai3d::cGenericTool::initialize ( )
virtual

This method resets all force models according to the current position of the haptic device.

void chai3d::cGenericTool::updateFromDevice ( )
virtual

This method updates the position and orientation of the tool by reading values from the haptic device.

void chai3d::cGenericTool::computeInteractionForces ( )
virtual

This method computes the interaction forces between the tool and the objects inside the virtual world.

Reimplemented in chai3d::cToolGripper, and chai3d::cToolCursor.

bool chai3d::cGenericTool::applyToDevice ( )
virtual

This method applies the latest computed force to the haptic device.

Returns
true if the operation succeeds, false otherwise.
bool chai3d::cGenericTool::setForcesON ( )
virtual

This method enables forces to be displayed on the haptic device.

Returns
true if operation succeeds, false otherwise.
bool chai3d::cGenericTool::setForcesOFF ( )
virtual

This method disables forces to be displayed on the haptic device.

Returns
true if operation succeeds, false otherwise.
void chai3d::cGenericTool::setWaitForSmallForce ( const bool  a_value)
inline
bool chai3d::cGenericTool::getWaitForSmallForce ( )
inline
void chai3d::cGenericTool::setSmallForceThresh ( const double  a_smallForceThresh)
inline
double chai3d::cGenericTool::getSmallForceThresh ( )
inline
void chai3d::cGenericTool::setUseForceRise ( const bool  a_value)
inline
bool chai3d::cGenericTool::getUseForceRise ( )
inline
void chai3d::cGenericTool::setRiseTime ( const double  a_riseTime)
inline
double chai3d::cGenericTool::getRiseTime ( )
inline
virtual bool chai3d::cGenericTool::getUserSwitch ( const unsigned int  a_switchIndex) const
inlinevirtual
void chai3d::cGenericTool::setUserSwitch ( const unsigned int  a_switchIndex,
const bool  a_value 
)
virtual

This method overrides the value of a specified user switch of the device.

Parameters
a_switchIndexSwitch index number.
a_valueSwitch value.
virtual unsigned int chai3d::cGenericTool::getUserSwitches ( ) const
inlinevirtual
void chai3d::cGenericTool::setUserSwitches ( const unsigned int  a_userSwitches)
virtual

This method overrides the value of all user switches of the device.

Parameters
a_userSwitchesUser switch value.
virtual double chai3d::cGenericTool::getGripperAngleRad ( ) const
inlinevirtual
void chai3d::cGenericTool::setGripperAngleRad ( const double &  a_gripperAngleRad)
virtual

This method overrides the gripper angle in radians.

Parameters
a_gripperAngleRadGripper angle in radians.
virtual double chai3d::cGenericTool::getGripperAngleDeg ( ) const
inlinevirtual
void chai3d::cGenericTool::setGripperAngleDeg ( const double &  a_gripperAngleDeg)
virtual

This method overrides the gripper angle in degrees.

Parameters
a_gripperAngleDegGripper angle in degrees.
virtual double chai3d::cGenericTool::getGripperAngVel ( ) const
inlinevirtual
void chai3d::cGenericTool::setGripperAngVel ( const double &  a_gripperAngVel)
virtual

This method overrides the angular velocity of the gripper in radians per second.

Parameters
a_gripperAngVelGripper angular velocity in radians per second.
virtual cVector3d chai3d::cGenericTool::getDeviceLocalPos ( ) const
inlinevirtual
void chai3d::cGenericTool::setDeviceLocalPos ( const cVector3d a_localPos)
virtual

This method overrides the position of the haptic device in local coordinates.

Parameters
a_localPosPosition of device.
void chai3d::cGenericTool::setDeviceLocalPos ( const double &  a_x,
const double &  a_y,
const double &  a_z 
)
inline
virtual cVector3d chai3d::cGenericTool::getDeviceGlobalPos ( ) const
inlinevirtual
void chai3d::cGenericTool::setDeviceGlobalPos ( const cVector3d a_globalPos)
virtual

This method overrides the position of the haptic device in global coordinates.

Parameters
a_globalPosPosition of device.
void chai3d::cGenericTool::setDeviceGlobalPos ( const double &  a_x,
const double &  a_y,
const double &  a_z 
)
inline
virtual cVector3d chai3d::cGenericTool::getDeviceLocalLinVel ( ) const
inlinevirtual
void chai3d::cGenericTool::setDeviceLocalLinVel ( const cVector3d a_localLinVel)
virtual

This method overrides the linear velocity of the device in local coordinates.

Parameters
a_localLinVelLinear velocity of device.
void chai3d::cGenericTool::setDeviceLocalLinVel ( const double &  a_x,
const double &  a_y,
const double &  a_z 
)
inline
virtual cVector3d chai3d::cGenericTool::getDeviceGlobalLinVel ( ) const
inlinevirtual
void chai3d::cGenericTool::setDeviceGlobalLinVel ( const cVector3d a_globalLinVel)
virtual

This method overrides the linear velocity of the device in global coordinates.

Parameters
a_globalLinVelLinear velocity of device.
void chai3d::cGenericTool::setDeviceGlobalLinVel ( const double &  a_x,
const double &  a_y,
const double &  a_z 
)
inline
virtual cMatrix3d chai3d::cGenericTool::getDeviceLocalRot ( ) const
inlinevirtual
void chai3d::cGenericTool::setDeviceLocalRot ( const cMatrix3d a_localRot)
virtual

This method overrides the orientation of the haptic device in local coordinates.

Parameters
a_localRotOrientation of device.
void chai3d::cGenericTool::setDeviceGlobalRot ( const cMatrix3d a_globalRot)
virtual

This method overrides the orientation of the haptic device in global coordinates.

Parameters
a_globalRotOrientation of device.
virtual cMatrix3d chai3d::cGenericTool::getDeviceGlobalRot ( ) const
inlinevirtual
virtual cVector3d chai3d::cGenericTool::getDeviceLocalAngVel ( ) const
inlinevirtual
void chai3d::cGenericTool::setDeviceLocalAngVel ( const cVector3d a_localAngVel)
virtual

This method overrides the angular velocity of the device in local coordinates.

Parameters
a_localAngVelAngular velocity of device.
void chai3d::cGenericTool::setDeviceLocalAngVel ( const double &  a_x,
const double &  a_y,
const double &  a_z 
)
inline
virtual cVector3d chai3d::cGenericTool::getDeviceGlobalAngVel ( ) const
inlinevirtual
void chai3d::cGenericTool::setDeviceGlobalAngVel ( const cVector3d a_globalAngVel)
virtual

This method overrides the angular velocity of the device in global coordinates.

Parameters
a_globalAngVelAngular velocity of device.
void chai3d::cGenericTool::setDeviceGlobalAngVel ( const double &  a_x,
const double &  a_y,
const double &  a_z 
)
inline
virtual cTransform chai3d::cGenericTool::getDeviceLocalTransform ( ) const
inlinevirtual
void chai3d::cGenericTool::setDeviceLocalTransform ( const cTransform a_localTransform)
virtual

This method overrides the position and orientation of device in local coordinates.

Parameters
a_localTransformPosition and orientation of device.
virtual cTransform chai3d::cGenericTool::getDeviceGlobalTransform ( ) const
inlinevirtual
void chai3d::cGenericTool::setDeviceGlobalTransform ( const cTransform a_globalTransform)
virtual

This method overrides the position and orientation of device in global coordinates.

Parameters
a_globalTransformPosition and orientation of device.
virtual double chai3d::cGenericTool::getGripperForce ( ) const
inlinevirtual
void chai3d::cGenericTool::setGripperForce ( const double &  a_gripperForce)
virtual

This method overrides the gripper force.

Parameters
a_gripperForceGripper force in Newtons.
void chai3d::cGenericTool::addGripperForce ( const double &  a_gripperForce)
virtual

This method adds a force to the current gripper force.

Parameters
a_gripperForceGripper force in Newtons.
virtual cVector3d chai3d::cGenericTool::getDeviceLocalForce ( ) const
inlinevirtual
void chai3d::cGenericTool::setDeviceLocalForce ( const cVector3d a_localForce)
virtual

This method overrides the force in local tool or device coordinates.

Parameters
a_localForceForce in local coordinates.
void chai3d::cGenericTool::setDeviceLocalForce ( const double &  a_x,
const double &  a_y,
const double &  a_z 
)
inline
void chai3d::cGenericTool::addDeviceLocalForce ( const cVector3d a_localForce)
virtual

This method adds a force to the current force. The force is expressed in local device or tool coordinates.

Parameters
a_localForceForce in local coordinates.
void chai3d::cGenericTool::addDeviceLocalForce ( const double &  a_x,
const double &  a_y,
const double &  a_z 
)
inline
virtual cVector3d chai3d::cGenericTool::getDeviceGlobalForce ( ) const
inlinevirtual
void chai3d::cGenericTool::setDeviceGlobalForce ( const cVector3d a_globalForce)
virtual

This method overrides a force in world coordinates.

Parameters
a_globalForceForce expressed in world coordinates.
void chai3d::cGenericTool::setDeviceGlobalForce ( const double &  a_x,
const double &  a_y,
const double &  a_z 
)
inline
void chai3d::cGenericTool::addDeviceGlobalForce ( const cVector3d a_globalForce)
virtual

This method adds a new force to the current force. The force is expressed in world coordinates.

Parameters
a_globalForceForce expressed in world coordinates.
void chai3d::cGenericTool::addDeviceGlobalForce ( const double &  a_x,
const double &  a_y,
const double &  a_z 
)
inline
virtual cVector3d chai3d::cGenericTool::getDeviceLocalTorque ( ) const
inlinevirtual
void chai3d::cGenericTool::setDeviceLocalTorque ( const cVector3d a_localTorque)
virtual

This method overrides a torque in local tool or device coordinates.

Parameters
a_localTorqueTorque in local coordinates.
void chai3d::cGenericTool::setDeviceLocalTorque ( const double &  a_x,
const double &  a_y,
const double &  a_z 
)
inline
void chai3d::cGenericTool::addDeviceLocalTorque ( const cVector3d a_localTorque)
virtual

This method adds a torque to current torque. The torque is expressed in local device or tool coordinates.

Parameters
a_localTorqueTorque in local coordinates.
void chai3d::cGenericTool::addDeviceLocalTorque ( const double &  a_x,
const double &  a_y,
const double &  a_z 
)
inline
virtual cVector3d chai3d::cGenericTool::getDeviceGlobalTorque ( ) const
inlinevirtual
void chai3d::cGenericTool::setDeviceGlobalTorque ( const cVector3d a_globalTorque)
virtual

This method overrides a torque in world coordinates.

Parameters
a_globalTorqueTorque expressed in world coordinates.
void chai3d::cGenericTool::setDeviceGlobalTorque ( const double &  a_x,
const double &  a_y,
const double &  a_z 
)
inline
void chai3d::cGenericTool::addDeviceGlobalTorque ( const cVector3d a_globalTorque)
virtual

This method adds a torque to the current torque. The torque is expressed in world coordinates.

Parameters
a_globalTorqueTorque expressed in world coordinates.
void chai3d::cGenericTool::addDeviceGlobalTorque ( const double &  a_x,
const double &  a_y,
const double &  a_z 
)
inline
bool chai3d::cGenericTool::setWorkspaceRadius ( const double &  a_workspaceRadius)

This method defines the size of the virtual workspace covered by the haptic device.

Parameters
a_workspaceRadiusRadius of the workspace.
double chai3d::cGenericTool::getWorkspaceRadius ( )
inline
bool chai3d::cGenericTool::setWorkspaceScaleFactor ( const double &  a_workspaceScaleFactor)

This method defines a scale factor between the physical workspace of the haptic device and the workspace covered by the virtual tool.

Parameters
a_workspaceScaleFactorWorkspace scale factor.
Returns
true if operation succeeds, false otherwise.
double chai3d::cGenericTool::getWorkspaceScaleFactor ( )
inline
bool chai3d::cGenericTool::isInContact ( cGenericObject a_object)
virtual

This method checks if the tool is currently interacting with a given object passed as argument.

Returns
true if the tool is interacting with the object, false otherwise.
int chai3d::cGenericTool::getNumHapticPoints ( )
inline
cHapticPoint* chai3d::cGenericTool::getHapticPoint ( int  a_index)
inline
void chai3d::cGenericTool::setRadius ( double  a_radius)
virtual

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

Parameters
a_radiusNew radius for graphic display and haptic computation.
void chai3d::cGenericTool::setRadius ( double  a_radiusDisplay,
double  a_radiusContact 
)
virtual

This method assign new values to the radius of the displayed spheres (goal and proxy) and the radius of the contact sphere (proxy) that is used to compute the contact forces.

For creating more realistic conditions, settings both parameters to the same value is recommended. However, setting a_radiusContact to zero will generally accelerate the force rendering algorithm as the contacts will simply be computed between the center of the sphere and the polygons.

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

This method sets the radius of the physical proxy. The change affects all haptic points that compose the tool.

Parameters
a_radiusContactNew radius for contact computation (proxy).
void chai3d::cGenericTool::setRadiusDisplay ( double  a_radiusDisplay)
virtual

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

Parameters
a_radiusDisplayNew radius of display spheres (proxy and goal).
void chai3d::cGenericTool::setShowContactPoints ( bool  a_showProxy = true,
bool  a_showGoal = false,
cColorf  a_colorLine = cColorf(0.5, 0.5, 0.5) 
)
virtual

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.
cWorld* chai3d::cGenericTool::getParentWorld ( )
inline
void chai3d::cGenericTool::enableDynamicObjects ( bool  a_enabled)
virtual

This method enables or disables the dynamic proxy algorithm to support dynamic objects.

This option must be enabled if you have cMesh objects which move inside the world and collide with your tool. However, if your world contains only static cMesh objects or shapes that rely on haptic effects, then this option can be disabled. Not enabling the dynamic proxy model for moving objects will create a "pop through" situation where the tool traverses the mesh without detecting any collision.

Parameters
a_enabledIf true then support for mesh objects in motion is enabled.
bool chai3d::cGenericTool::createAudioSource ( cAudioDevice a_audioDevice)

This method creates an audio source for this tool.

Parameters
a_audioDeviceAudio device.
virtual void chai3d::cGenericTool::render ( cRenderOptions a_options)
inlinevirtual

Reimplemented from chai3d::cGenericObject.

Reimplemented in chai3d::cToolGripper, and chai3d::cToolCursor.

void chai3d::cGenericTool::setShaderProgram ( cShaderProgramPtr  a_shaderProgram,
const bool  a_affectChildren = false 
)
virtual

This method assigns a shader program to this tool and all the haptic points associated with the tool.
If a_affectChildren is set to true then all children are assigned with the shader program.

Parameters
a_shaderProgramShader program to be assigned to object.
a_affectChildrenIf true then children are updated too.

Reimplemented from chai3d::cGenericObject.

void chai3d::cGenericTool::updateToolImagePosition ( )
protectedvirtual

This method updates the position and orientation of the tool image according to the latest data queried from the haptic device.

Reimplemented in chai3d::cToolCursor.

void chai3d::cGenericTool::updateGlobalPositions ( const bool  a_frameOnly)
protectedvirtual

This method computes the global position of the tool in the world.

Parameters
a_frameOnlyIf false, then global the position of any vertices is computed.

Reimplemented from chai3d::cGenericObject.

Member Data Documentation

cGenericObject* chai3d::cGenericTool::m_image
std::vector<cHapticPoint*> chai3d::cGenericTool::m_hapticPoints
protected
cGenericHapticDevicePtr chai3d::cGenericTool::m_hapticDevice
protected
unsigned int chai3d::cGenericTool::m_userSwitches
protected
bool chai3d::cGenericTool::m_enabled
protected
cVector3d chai3d::cGenericTool::m_deviceLocalForce
protected
cVector3d chai3d::cGenericTool::m_deviceGlobalForce
protected
cVector3d chai3d::cGenericTool::m_deviceLocalTorque
protected
cVector3d chai3d::cGenericTool::m_deviceGlobalTorque
protected
double chai3d::cGenericTool::m_gripperForce
protected
double chai3d::cGenericTool::m_workspaceRadius
protected
double chai3d::cGenericTool::m_workspaceScaleFactor
protected
cVector3d chai3d::cGenericTool::m_deviceLocalPos
protected
cVector3d chai3d::cGenericTool::m_deviceGlobalPos
protected
cMatrix3d chai3d::cGenericTool::m_deviceLocalRot
protected
cMatrix3d chai3d::cGenericTool::m_deviceGlobalRot
protected
cVector3d chai3d::cGenericTool::m_deviceLocalLinVel
protected
cVector3d chai3d::cGenericTool::m_deviceGlobalLinVel
protected
cVector3d chai3d::cGenericTool::m_deviceLocalAngVel
protected
cVector3d chai3d::cGenericTool::m_deviceGlobalAngVel
protected
double chai3d::cGenericTool::m_gripperAngle
protected
double chai3d::cGenericTool::m_gripperAngVel
protected
cWorld* chai3d::cGenericTool::m_parentWorld
protected
bool chai3d::cGenericTool::m_forceOn
protected
bool chai3d::cGenericTool::m_forceEngaged
protected
bool chai3d::cGenericTool::m_useWaitForSmallForce
protected
int chai3d::cGenericTool::m_smallForceCounter
protected
double chai3d::cGenericTool::m_smallForceThresh
protected
bool chai3d::cGenericTool::m_useForceRise
protected
double chai3d::cGenericTool::m_forceRiseTime
protected
cPrecisionClock chai3d::cGenericTool::m_forceRiseClock
protected
bool chai3d::cGenericTool::m_flagForceRiseFirstTime
protected
bool chai3d::cGenericTool::m_flagForceRiseActivated
protected
cFrequencyCounter chai3d::cGenericTool::m_freqRead
protected
cFrequencyCounter chai3d::cGenericTool::m_freqWrite
protected

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