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.