25#ifndef _SO_INTERSECTION_DETECTION_ACTION_
26#define _SO_INTERSECTION_DETECTION_ACTION_
32#include <Inventor/actions/SoAction.h>
33#include <Inventor/actions/SoSubAction.h>
34#include <Inventor/SoType.h>
35#include <Inventor/SbViewportRegion.h>
36#include <Inventor/SoPrimitiveVertex.h>
183#ifndef HIDDEN_FROM_DOC
184 struct ShapeInformationItem {
186 float xMin, yMin, zMin;
187 float xMax, yMax, zMax;
190 struct CoupleTableItem {
192 float xMin, yMin, zMin;
193 float xMax, yMax, zMax;
196 struct ActiveListItem {
199 enum Position position;
203 static float m_fIntersectEpsilon;
220 static void initClass();
221 static void exitClass();
234 void* userDataFilterCB;
236 void* userDataIntersectionCB;
237 void* m_callback_list;
245 int shapeInformationSize;
246 int shapeInformationReservedSize;
247 ShapeInformationItem* shapeInformation;
249 int coupleTableReservedSize;
250 CoupleTableItem* coupleTable;
252 int activeListReservedSize;
253 ActiveListItem* activeList;
254 int primitiveTableSize;
255 int primitiveTableReservedSize;
257 int currentShapeIndex1;
258 int currentShapeIndex2;
259 CoupleTableItem* currentCouple;
264 void shapeInformationDestroy();
265 void shapeInformationClear();
266 void shapeInformationAddItem(
SoPath *path);
268 void coupleTableDestroy();
269 void coupleTableClear();
270 CoupleTableItem * coupleTableGetItem(
int shapeIndex1,
int shapeIndex2);
271 void coupleTableSetOverlaping(
int shapeIndex1,
int shapeIndex2,
273 void coupleTableUpdate(
enum Axis axis);
275 void activeListDestroy();
276 void activeListClear();
277 void activeListAddItem(
int shapeIndex);
278 void activeListSort(
int (*compareFunction)(
void const *,
void const *));
279 static int activeListXCompare(
void const *pointer1,
void const *pointer2);
280 static int activeListYCompare(
void const *pointer1,
void const *pointer2);
281 static int activeListZCompare(
void const *pointer1,
void const *pointer2);
282 void activeListClean();
283 void primitiveTableBuild();
284 void primitiveTableDestroy();
285 void primitiveTableClear();
286 void primitiveTableReserveSpace();
294 void shapesCollisionTest(
int shapeIndex1,
int shapeIndex2);
316 static void primitiveTableAddTriangleCB (
void *userData,
322 primitiveTableAddTriangle (action, vertex1, vertex2, vertex3); }
323 static void primitiveTableAddLineSegmentCB (
void *userData,
328 primitiveTableAddLineSegment (action, vertex1, vertex2); }
329 static void triangleCollisionTestCB (
void *userData,
335 triangleCollisionTest (action, vertex1, vertex2, vertex3); }
336 static void lineSegmentCollisionTestCB (
void *userData,
341 lineSegmentCollisionTest (action, vertex1, vertex2); }
344 void quickSort(
void *array,
int nElm,
int elmSize,
345 int (*compare)(
void const *,
void const *),
347 void sort(
void *array,
int nElm,
int elmSize,
348 int (*compare)(
void const *,
void const *));
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Portable mutex c...
Class for representing a viewport.
Abstract base class for all actions.
Performs a generic traversal of a scene graph or path.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Class to manage ...
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Class to detect ...
void apply(const SoPathList &pathList, SbBool obeysRules=FALSE)
Initiates an action on the graph defined by a list of paths.
static float getIntersectEpsilon()
Queries epsilon (small value) to be used in the collision computation.
void removeIntersectionCallback(SoIntersectionCB *f, void *userData=NULL)
Removes a callback to be called when there is an intersection.
SbBool SoIntersectionFilterCB(void *userData, const SoPath *p1, const SoPath *p2)
SoIntersectionDetectionAction()
Constructor.
static void setIntersectEpsilon(float epsilon)
Sets epsilon (small value) to be used in the collision computation.
void apply(SoPath *path)
Initiates an action on the graph defined by a path.
@ NEXT_PRIMITIVE
Next primitive.
void apply(SoNode *node)
Initiates an action on the graph defined by a node.
~SoIntersectionDetectionAction()
Destructor.
void 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.
Resp SoIntersectionCB(void *userData, const SoIntersectingPrimitive *, const SoIntersectingPrimitive *)
void addIntersectionCallback(SoIntersectionCB *f, void *userData=NULL)
Adds a callback to be called when there is an intersection.
Abstract base class for all database nodes.
Path that points to a list of hierarchical nodes.
Maintains a list of pointers to paths.
Represents a vertex of a generated primitive.
Searches for nodes in a scene graph.
SbVec3f vertex[3]
Vertex of the primitive.
SbVec3f xf_vertex[3]
Transformed vertex of the primitive.
PrimitiveType type
Type of primitive.
PrimitiveType
Primitive type.
@ LINE_SEGMENT
Line segment.
SoPath * path
Path of the shape.