cProxyPointForceAlgo Class Reference
[Force Rendering Algorithms]

Implements the finger-proxy algorithm for computing interaction forces between a point force device and meshes. More...

#include <CProxyPointForceAlgo.h>

Inheritance diagram for cProxyPointForceAlgo:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 cProxyPointForceAlgo ()
 Constructor of cProxyPointForceAlgo.
virtual ~cProxyPointForceAlgo ()
 Destructor of cProxyPointForceAlgo.
void initialize (cWorld *a_world, const cVector3d &a_initialGlobalPosition)
 Initialize the algorithm.
void reset ()
 Reset the algorithm. Set proxy position to device position.
virtual cVector3d computeForces (const cVector3d &a_toolPos, const cVector3d &a_toolVel)
 Calculate interaction forces between device and meshes.
void setProxyRadius (const double &a_radius)
 Set radius of proxy.
double getProxyRadius () const
 Read radius of proxy.
cVector3d getProxyGlobalPosition () const
 Get last computed position of proxy in world coordinates.
void setProxyGlobalPosition (const cVector3d &a_position)
 Set position of proxy in world coordinates.
cVector3d getDeviceGlobalPosition () const
 Get last specified position of device in world coordinates.
cVector3d getForce ()
 Get last computed force vector in world coordinates.
cVector3d getNormalForce ()
 Return most recently calculated normal force.
cVector3d getTangentialForce ()
 Return most recently calculated tangential force.
int getNumContacts ()
 Return the number of contacts (0, 1, 2 or 3):.
void setEpsilonBaseValue (double a_value)
 Set epsilon base value.
double getEpsilonBaseValue ()
 Read current epsilon value.

Public Attributes

cCollisionEventm_contactPoint0
 Information about collision point 0. Call getNumContacts() to see if valid.
cCollisionEventm_contactPoint1
 Information about collision point 1. Call getNumContacts() to see if valid.
cCollisionEventm_contactPoint2
 Information about collision point 2. Call getNumContacts() to see if valid.
bool m_useFriction
 Use any friction algorithm?
bool m_useDynamicProxy
 Use the dynamic proxy algorithm to deal with mobile objects?
bool m_useForceShading
 Use force shading.
double m_frictionDynHysteresisMultiplier
double m_forceShadingAngleThreshold
 Maximum force shading angle (radians) threshold between normals of triangle.
cCollisionSettings m_collisionSettings
 Collision cettings.

Protected Member Functions

virtual bool goalAchieved (const cVector3d &a_proxy, const cVector3d &a_goal) const
 Test whether the proxy has reached the goal point.
virtual void computeNextBestProxyPosition (const cVector3d &a_goal)
 Compute the next goal position of the proxy.
virtual void testFrictionAndMoveProxy (const cVector3d &a_goal, const cVector3d &a_proxy, cVector3d &a_normal, cGenericObject *a_parent)
 Attempt to move the proxy, subject to friction constraints.
virtual void updateForce ()
 Compute force to apply to device.
bool computeNextProxyPositionWithContraints0 (const cVector3d &a_goalGlobalPos)
 Implementation of the proxy algorithm - constraint 0.
bool computeNextProxyPositionWithContraints1 (const cVector3d &a_goalGlobalPos)
 Implementation of the proxy algorithm - constraint 1.
bool computeNextProxyPositionWithContraints2 (const cVector3d &a_goalGlobalPos)
 Implementation of the proxy algorithm - constraint 2.

Protected Attributes

cVector3d m_proxyGlobalPos
 Global position of the proxy.
cVector3d m_deviceGlobalPos
 Global position of device.
cVector3d m_lastGlobalForce
 Last computed force (in global coordinate frame).
cVector3d m_nextBestProxyGlobalPos
 Next best position for the proxy (in global coordinate frame).
bool m_slipping
 Are we currently in a "slip friction" state?
cVector3d m_normalForce
 Normal force.
cVector3d m_tangentialForce
 Tangential force.
unsigned int m_numContacts
 Number of contacts between proxy and triangles (0, 1, 2 or 3).
double m_radius
 Radius of the proxy.
cCollisionRecorder m_collisionRecorderConstraint0
 Collision detection recorder for searching first constraint.
cCollisionRecorder m_collisionRecorderConstraint1
 Collision detection recorder for searching second constraint.
cCollisionRecorder m_collisionRecorderConstraint2
 Collision detection recorder for searching third constraint.
double m_epsilonInitialValue
 epsilon value - used for handling numerical limits.
double m_epsilon
 epsilon value - used for handling numerical limits.
double m_epsilonCollisionDetection
 epsilon value - used for handling numerical limits.
double m_epsilonBaseValue
 epsilon value - used for handling numerical limits.
double m_epsilonMinimalValue
 epsilon value - used for handling numerical limits.
unsigned int m_algoCounter
 Value of state machine.


Detailed Description

Implements the finger-proxy algorithm for computing interaction forces between a point force device and meshes.

Member Function Documentation

cVector3d cProxyPointForceAlgo::computeForces ( const cVector3d a_toolPos,
const cVector3d a_toolVel 
) [virtual]

Calculate interaction forces between device and meshes.

This method computes the force to add to the device due to any collisions with meshes by calling computeNextBestProxyPosition() to update the proxy location and then computeForce() to calculate a force vector based on the proxy location.

Parameters:
a_toolPos New position of tool
a_toolVel New velocity of tool
Returns:
Return the force to add to the device due to any collisions with meshes.

Reimplemented from cGenericPointForceAlgo.

void cProxyPointForceAlgo::computeNextBestProxyPosition ( const cVector3d a_goal  )  [protected, virtual]

Compute the next goal position of the proxy.

Given the new position of the device and considering the current position of the proxy, this function attempts to move the proxy towards the device position (the goal). If its path is blocked by an obstacle (e.g., a triangle in a mesh), the proxy is moved to this intersection point and a new goal is calculated as the closest point to the original goal in the half-plane above the intersection triangle. The process is repeated if necessary, bringing the proxy to its final location.

Parameters:
a_goal The goal towards which to move the proxy, subject to constraints

bool cProxyPointForceAlgo::goalAchieved ( const cVector3d a_proxy,
const cVector3d a_goal 
) const [protected, virtual]

Test whether the proxy has reached the goal point.

Test whether the proxy has reached the goal point, allowing for subclass- specific approximations.

Parameters:
a_goal The location to which we'd like to move the proxy
a_proxy The current position of the proxy
Returns:
true is the proxy has effectively reached the goal

void cProxyPointForceAlgo::initialize ( cWorld a_world,
const cVector3d a_initialGlobalPosition 
) [virtual]

Initialize the algorithm.

Initialize the algorithm, including setting the pointer to the world in which the algorithm is to operate, and setting the initial position of the device.

Parameters:
a_world Pointer to world in which force algorithm is operating.
a_initialGlobalPosition Initial position of the device.

Reimplemented from cGenericPointForceAlgo.

void cProxyPointForceAlgo::reset ( void   ) 

Reset the algorithm. Set proxy position to device position.

Reset the algorithm. Set the proxy position to the device position.

void cProxyPointForceAlgo::setEpsilonBaseValue ( double  a_value  ) 

Set epsilon base value.

Set the epsilon value which is used during geometry computation of the proxy model.

void cProxyPointForceAlgo::testFrictionAndMoveProxy ( const cVector3d a_goal,
const cVector3d a_proxy,
cVector3d a_normal,
cGenericObject a_parent 
) [protected, virtual]

Attempt to move the proxy, subject to friction constraints.

Attempt to move the proxy, subject to friction constraints. This is called from computeNextBestProxyPosition when the proxy is ready to move along a known surface.

Parameters:
a_goal The location to which we'd like to move the proxy
a_proxy The current position of the proxy
a_normal The surface normal at the obstructing surface
a_parent The surface along which we're moving

void cProxyPointForceAlgo::updateForce (  )  [protected, virtual]

Compute force to apply to device.

This method uses the information computed earlier in computeNextProxyPosition() to determine the force to apply to the device. The function computes a force proportional to the distance between the positions of the proxy and the device and scaled by the average stiffness of each contact triangle.


Member Data Documentation

epsilon value - used for handling numerical limits.

To address numerical errors during geometric computation, several epsilon values are computed and used.

Dynamic friction hysteresis multiplier In CHAI's proxy, the angle computed from the coefficient is multiplied by this constant to avoid rapidly oscillating between slipping and sticking without having to turn the dynamic friction level way down.


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


CHAI3D 2.0.0 documentation
Please address any questions to support@chai3d.org
(C) 2003-2009 - CHAI 3D
All Rights Reserved.