Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
SoDualSceneCollider.h
Go to the documentation of this file.
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2019 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : JM Godinaud (Jan 2006)
22**=======================================================================*/
23
24#ifndef _SO_DUAL_SCENE_COLLIDER_
25#define _SO_DUAL_SCENE_COLLIDER_
26
27#include <Inventor/SbBasic.h>
28#include <Inventor/SbLinear.h>
30
31class SoNode;
32class SoGroup;
33class SoPath;
34class SoTransform;
35
36class SoCmStaticScene;
37class SoCmMovingScene;
38
113
114 public:
115
121
130 void setMovingScene(SoPath* object, int max_triangles_per_leaf=0);
131
140 void setStaticScene(SoPath* scene, int max_triangles_per_leaf=0);
141
148 void activate(SoTransform* transform);
149
156 virtual SbBool checkCollision() const;
157
162 virtual SbBool searchNextIntersection() const { return FALSE; }
163
164
173 void setMinEdgeLength(double minEdgeLength);
174
180 double getMinEdgeLength() const;
181
197
203 { return m_isMultiThread; }
204
205 private: protected:
206
213
220
227
234
240 void getCommonPoints(SbVec3f &p0, SbVec3f &p1) const;
241
248 virtual SbBool isSensitiveStaticObject(const SoPath *object_path) const;
249
256 virtual SbBool isSensitiveMovingObject(const SoPath *object_path) const;
257
267 virtual void staticTriangleListBuilt(int num_triangles) const;
268
277 virtual void staticLeafBuilt(int num_triangles) const;
278
288 virtual void movingTriangleListBuilt(int num_triangles) const;
289
298 virtual void movingLeafBuilt(int num_triangles) const;
299
300 private:
301 //private usage
302 void updateMovingScene();
303 void triangleListBuilt(int num_triangles) const;
304 void leafBuilt(int num_triangles) const; // a new leaf is built : it contains num_triangles
305 SbBool isSensitiveObject(const SoPath *object_path) const;
306
307 // return true if checkcollision should stop for searching new intersection
308 bool isStopIntersectionSearchRequested() const
309 { return m_stopSearchingforIntersection; }
310 // reset flag the searching flag
311 void setStopIntersectionSearchRequested(bool value)
312 { m_stopSearchingforIntersection = value; }
313
314 // return the octree depth where parallelism should be used
315 int getMaxParallelDepth() const
316 { return m_maxparallelDepth; }
317
318 private:
319
320 SoPath *m_staticPath;
321 SoCmStaticScene *m_staticScene;
322 SoCmMovingScene *m_movingScene;
323 SoPath *m_movingPath;
324
325 private:
326 SoNodeSensor m_sensor;
327 SoTransform *m_transform;
328 int m_trianglePerStaticLeaf;
329 int m_trianglePerMovingLeaf;
330 SbBool m_staticSceneBeingBuilt;
331 double m_minEdgeLength;
332 bool m_stopSearchingforIntersection;
333 bool m_isMultiThread;
334 int m_maxparallelDepth;
335};
336
337inline SbBool
340
341inline SbBool
344
345inline void
348
349inline void
352
353inline void
356
357inline void
360
361
362
363#endif // SO_DUAL_SCENE_COLLIDER_
364
365
#define TRUE
Possible value of SbBool.
Definition SbBase.h:77
#define FALSE
Possible value of SbBool.
Definition SbBase.h:75
virtual void enable(QWidget *w, XtEventHandler f, XtPointer data, void *unused=NULL)
3D vector class.
Definition SbVec.h:932
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Class to check f...
virtual SbBool isSensitiveStaticObject(const SoPath *object_path) const
Tells if an object of the static scene is sensitive to collision detection or not.
void setMovingScene(SoPath *object, int max_triangles_per_leaf=0)
Specifies the scene that will be moved or transformed.
virtual SbBool checkCollision() const
Checks if the current moving scene collides with the static scene.
bool isMultiThreadEnabled() const
Returns true if multithreaded computation is enabled.
virtual void movingTriangleListBuilt(int num_triangles) const
Method called by setMovingScene() when the list of triangles in the moving scene is built.
void setMinEdgeLength(double minEdgeLength)
Specifies the minimum length of a triangle edge.
virtual void movingLeafBuilt(int num_triangles) const
Method called by setMovingScene() when a new leaf is stored in the moving tree.
virtual SbBool searchNextIntersection() const
Method called by checkCollision() for each pair of intersecting triangles found.
void getCommonPoints(SbVec3f &p0, SbVec3f &p1) const
Returns the coordinates of the two common points of the current pair of intersecting triangles.
double getMinEdgeLength() const
Returns the minimum length of a triangle edge.
SoDualSceneCollider()
Default constructor.
virtual ~SoDualSceneCollider()
virtual void staticLeafBuilt(int num_triangles) const
Method called by setStaticScene() when a new leaf is stored in the static tree.
virtual SbBool isSensitiveMovingObject(const SoPath *object_path) const
Tells if an object of the moving scene is sensitive to collision detection or not.
virtual void staticTriangleListBuilt(int num_triangles) const
Method called by setStaticScene() when the list of triangles in the static scene is built.
void activate(SoTransform *transform)
Specifies the transformation that will be watched.
const SoPath * getCollidingMovingPath() const
Returns the path in the moving scene of the current colliding shape.
void getCollidingStaticTriangle(SbVec3f &v0, SbVec3f &v1, SbVec3f &v2) const
Returns the coordinates of the current colliding triangle in the static scene.
const SoPath * getCollidingStaticPath() const
Returns the path in the static scene of the current colliding shape.
void enableMultiThread(bool enable)
Use multiple threads to compute intersections.
void setStaticScene(SoPath *scene, int max_triangles_per_leaf=0)
Specifies the scene the moving scene is interacting with.
void getCollidingMovingTriangle(SbVec3f &v0, SbVec3f &v1, SbVec3f &v2) const
Returns the coordinates of the current colliding triangle in the moving scene.
Base class for all group nodes.
Definition SoGroup.h:122
Abstract base class for all database nodes.
Definition SoNode.h:145
Sensor class that can be attached to Open Inventor nodes.
Path that points to a list of hierarchical nodes.
Definition SoPath.h:187
General 3D geometric transformation node.
int SbBool
Boolean type.
Definition SbBase.h:87