Class to detect intersections. More...
#include <Inventor/collision/SoIntersectionDetectionAction.h>
Public Types | |
enum | Resp { NEXT_PRIMITIVE, NEXT_SHAPE, ABORT } |
enum | Axis { X_AXIS = 1, Y_AXIS = 2, Z_AXIS = 4 } |
enum | Position { BEGIN, END } |
typedef Resp | SoIntersectionCB (void *userData, const SoIntersectingPrimitive *, const SoIntersectingPrimitive *) |
Public Member Functions | |
virtual SoType | getTypeId () const |
SoIntersectionDetectionAction () | |
~SoIntersectionDetectionAction () | |
void | apply (SoNode *node) |
void | apply (SoPath *path) |
void | apply (const SoPathList &pathList, SbBool obeysRules=FALSE) |
void | setFilterCallback (SoIntersectionFilterCB *newFilterCB, void *data=NULL) |
void | addIntersectionCallback (SoIntersectionCB *f, void *userData=NULL) |
void | removeIntersectionCallback (SoIntersectionCB *f, void *userData=NULL) |
Static Public Member Functions | |
static SoType | getClassTypeId () |
static void | setIntersectEpsilon (float epsilon) |
static float | getIntersectEpsilon () |
Friends | |
class | SoCollisionManager |
This action allows the programmer to analyze a scene graph to know which pairs of objects within the scene intersect.
The action first detects intersections between pairs of bounding boxes. If such an intersection occurs, the programmer can abort the action or allow it to determine if the primitives of the objects actually collide.
The algorithm can call programmer-supplied callbacks when there is an intersection between two objects.
SoCollisionManager, SoWinCollisionViewer
typedef Resp SoIntersectionDetectionAction::SoIntersectionCB(void *userData, const SoIntersectingPrimitive *, const SoIntersectingPrimitive *) |
SoIntersectionDetectionAction::SoIntersectionDetectionAction | ( | ) |
Constructor.
SoIntersectionDetectionAction::~SoIntersectionDetectionAction | ( | ) |
Destructor.
void SoIntersectionDetectionAction::addIntersectionCallback | ( | SoIntersectionCB * | f, | |
void * | userData = NULL | |||
) |
Adds a callback to be called when there is an intersection.
void SoIntersectionDetectionAction::apply | ( | const SoPathList & | pathList, | |
SbBool | obeysRules = FALSE | |||
) | [virtual] |
Initiates an action on the graph defined by a list of paths.
TRUE can be passed for the obeysRules flag if the given path list has the following 4 properties:
These rules will be obeyed by path lists returned by picking and by searches for non-group nodes.
Reimplemented from SoAction.
void SoIntersectionDetectionAction::apply | ( | SoPath * | path | ) | [virtual] |
Initiates an action on the graph defined by a path.
Warning: Most actions call ref() on the path before traversing the scene graph, then call unref() after traversal. If the path's reference count was zero (the default), the call to apply() will cause it to be destroyed.
Reimplemented from SoAction.
void SoIntersectionDetectionAction::apply | ( | SoNode * | node | ) | [virtual] |
Initiates an action on the graph defined by a node.
Warning: Most actions call ref() on the node before traversing the scene graph, then call unref() after traversal. If the node's reference count was zero (the default), the call to apply() will cause it to be destroyed.
Reimplemented from SoAction.
static SoType SoIntersectionDetectionAction::getClassTypeId | ( | ) | [static] |
Returns the type identifier for this class.
Reimplemented from SoAction.
static float SoIntersectionDetectionAction::getIntersectEpsilon | ( | ) | [static] |
Queries epsilon (small value) to be used in the collision computation.
virtual SoType SoIntersectionDetectionAction::getTypeId | ( | ) | const [virtual] |
Returns the type identifier for this specific instance.
Implements SoTypedObject.
void SoIntersectionDetectionAction::removeIntersectionCallback | ( | SoIntersectionCB * | f, | |
void * | userData = NULL | |||
) |
Removes a callback to be called when there is an intersection.
void SoIntersectionDetectionAction::setFilterCallback | ( | SoIntersectionFilterCB * | newFilterCB, | |
void * | data = NULL | |||
) |
Sets a filter which allow the user to continue or not the intersection finding for a pair of shapes.
If the callback returns TRUE, the action search for real intersections, else it goes to the next shape pair.
static void SoIntersectionDetectionAction::setIntersectEpsilon | ( | float | epsilon | ) | [static] |
Sets epsilon (small value) to be used in the collision computation.
If the distance between two objects is less than epsilon, the objects are considered to have collided.
friend class SoCollisionManager [friend] |