cd.h
Go to the documentation of this file.
1 #ifndef CDH
2 #define CDH
3 
4 #include "htransform.h"
5 #include "mechanism.h"
6 #include "environment.h"
7 
17 #ifdef _HAVE_SOLID
18  #include <SOLID/SOLID.h>
19 #endif
20 
21 #ifdef _HAVE_VCOLLIDE
22  #include "cd_vcollide.h"
23 #endif
24 
25 #ifdef _HAVE_PQP
26  #include "cd_pqp.h"
27 #endif
28 
29 #ifdef _HAVE_FCL
30  #include "cd_fcl.h"
31 #endif
32 
33 #ifdef _HAVE_BULLET
34  #include "cd_bullet.h"
35 #endif
36 
37 #ifdef _HAVE_RIGIDCLL
38  #include "cd_rigidCLL.h"
39 #endif
40 
60 typedef struct {
61  boolean isLink1;
62  unsigned int id1;
64  boolean isLink2;
65  unsigned int id2;
67  double point[3];
68  double normal[3];
72 
73 #ifdef _HAVE_SOLID
74 
78  typedef struct {
79  unsigned int id;
80  unsigned int linkID;
81  unsigned int bodyID;
84  DT_ShapeHandle shape;
85  DT_ObjectHandle handler;
86  DT_ResponseClass respClass;
93  boolean correction;
94  } TsolidObj;
95 
103  typedef struct {
104  DT_SceneHandle scene;
105  DT_RespTableHandle respTable;
106  unsigned int np;
108  boolean simple;
111  unsigned int nc;
112  unsigned int mc;
114  } TsolidCD;
115 #endif
116 
117 
118 #ifdef _HAVE_VCOLLIDE
119 
126  typedef struct {
128  unsigned int np;
129  unsigned int *linkID;
130  unsigned int *bodyID;
131  unsigned int *vcID;
132  } TvcollideCD;
133 #endif
134 
135 
136 #ifdef _HAVE_PQP
137 
144  typedef struct {
145  unsigned int np;
146  unsigned int *linkID;
147  unsigned int *bodyID;
149  unsigned int nPairs;
150  unsigned int *p1;
151  unsigned int *p2;
152  } TpqpCD;
153 #endif
154 
155 #if _HAVE_FCL
156 
161  typedef struct {
162  unsigned int linkID;
163  unsigned int bodyID;
164  unsigned int type;
165  void *model;
166  THTransform t;
167  THTransform tc;
170  } TFCLObject;
171 
179  typedef struct {
180  unsigned int np;
181  TFCLObject *object;
182  unsigned int nPairs;
183  unsigned int *p1;
184  unsigned int *p2;
186  unsigned int nc;
187  unsigned int mc;
188  TCollisionInfo *collision;
189  } TfclCD;
190 #endif
191 
192 
193 #if _HAVE_BULLET
194 
199  typedef struct {
200  void *bulletWorld;
201  unsigned int linkID;
202  unsigned int bodyID;
203  unsigned int type;
204  void *model;
205  THTransform t;
206  THTransform tc;
209  } TBulletObject;
210 
218  typedef struct {
219  unsigned int np;
220  void * bulletWorld;
221  TBulletObject *object;
222  unsigned int nPairs;
223  unsigned int *p1;
224  unsigned int *p2;
226  unsigned int nc;
227  unsigned int mc;
228  TCollisionInfo *collision;
229  } TBulletCD;
230 #endif
231 
232 #ifdef _HAVE_RIGIDCLL
233 
240  typedef struct {
241  TrigidCLL *r;
242  unsigned int nl;
243  unsigned int *objID;
244  THTransform *t;
245  } TrigidCLLCD;
246 #endif
247 
248 
258 typedef struct {
259 
260  unsigned int engine;
262  #ifdef _HAVE_SOLID
264  #else
265  void *solid;
266  #endif
267 
268  #ifdef _HAVE_VCOLLIDE
270  #else
271  void *vcollide;
272  #endif
273 
274  #ifdef _HAVE_PQP
276  #else
277  void *pqp;
278  #endif
279 
280  #ifdef _HAVE_FCL
281  TfclCD *fcl;
282  #else
283  void *fcl;
284  #endif
285 
286  #ifdef _HAVE_BULLET
287  TBulletCD *bullet;
288  #else
289  void *bullet;
290  #endif
291 
292  #ifdef _HAVE_RIGIDCLL
293  TrigidCLLCD *rigidCLL;
294  #else
295  void *rigidCLL;
296  #endif
297 
298 } TworldCD;
299 
300 
301 
316 void InitCD(unsigned int engine,boolean parallel,
317  Tmechanism *m,Tenvironment *e,
318  boolean **checkCollisionsLL,boolean **checkCollisionsLO,
319  TworldCD *cd);
320 
334 boolean LinkCanCollide(unsigned int l,unsigned int nl,unsigned int no,
335  boolean **checkCollisionsLL,boolean **checkCollisionsLO);
336 
348 boolean ObstacleCanCollide(unsigned int o,unsigned int nl,boolean **checkCollisionsLO);
349 
359 unsigned int GetCDEngine(TworldCD *cd);
360 
385 boolean CheckCollision(boolean all,
386  THTransform *tl,TLinkConf *def,
387  THTransform *tlPrev,TLinkConf *defPrev,
388  TworldCD *cd);
389 
418 void StoreCollisionInfo(FILE *f,char *fname,unsigned int objectID,Tmechanism *m,TworldCD *cd);
419 
436 
444 void DeleteCD(TworldCD *cd);
445 
446 #endif
TsolidCD * solid
Definition: cd.h:263
unsigned int id2
Definition: cd.h:65
unsigned int linkID
Definition: cd.h:80
void * bullet
Definition: cd.h:289
Information on the detected collisions.
Definition: cd.h:60
boolean isLink2
Definition: cd.h:64
void * fcl
Definition: cd.h:283
unsigned int * bodyID
Definition: cd.h:130
TCollisionInfo * collision
Definition: cd.h:113
DT_RespTableHandle respTable
Definition: cd.h:105
boolean LinkCanCollide(unsigned int l, unsigned int nl, unsigned int no, boolean **checkCollisionsLL, boolean **checkCollisionsLO)
Identifies links than can collide.
Definition: cd.c:2218
Auxiliary data for the collision detection.
Definition: cd.h:258
Information associated with the PQP collision detection engine.
Definition: cd.h:144
A homgeneous transform in R^3.
Headers of the C interface for the pqp collision detection engine.
Information associated with the solid collision detection engine.
Definition: cd.h:103
void Tvcollide
The Vcollide object.
Definition: cd_vcollide.h:33
boolean correction
Definition: cd.h:93
Headers of the C interface for the rigidCLL collision detection engine.
TvcollideCD * vcollide
Definition: cd.h:269
unsigned int * linkID
Definition: cd.h:146
unsigned int * vcID
Definition: cd.h:131
A mechanism description.
Definition: mechanism.h:51
TpqpCD * pqp
Definition: cd.h:275
boolean simple
Definition: cd.h:108
unsigned int * bodyID
Definition: cd.h:147
boolean CheckCollision(boolean all, THTransform *tl, TLinkConf *def, THTransform *tlPrev, TLinkConf *defPrev, TworldCD *cd)
Determines if there is a collision.
Definition: cd.c:2260
Headers of the C interface for the Bullet collision detection library.
Tpqp ** model
Definition: cd.h:148
Headers of the C interface for the vcollide collision detection engine.
unsigned int np
Definition: cd.h:106
Information of each object.
Definition: cd.h:78
THTransform t1
Definition: cd.h:69
void PrintCollisionInfo(THTransform *tl, Tmechanism *m, Tenvironment *e, TworldCD *cd)
Prints some information collected during last collision check.
Definition: cd.c:2374
void * rigidCLL
Definition: cd.h:295
unsigned int id1
Definition: cd.h:62
A collection of obstacles (convex polyhedrons) with their names.
Definition: environment.h:39
DT_ObjectHandle handler
Definition: cd.h:85
unsigned int nc
Definition: cd.h:111
unsigned int * p2
Definition: cd.h:151
Definition of the Tmechanism type and the associated functions.
unsigned int id
Definition: cd.h:79
Definition of the THTransform type and the associated functions.
DT_ResponseClass respClass
Definition: cd.h:86
void InitCD(unsigned int engine, boolean parallel, Tmechanism *m, Tenvironment *e, boolean **checkCollisionsLL, boolean **checkCollisionsLO, TworldCD *cd)
Initializes the collision detector.
Definition: cd.c:2135
Tvcollide * vc
Definition: cd.h:127
boolean isLink1
Definition: cd.h:61
unsigned int * p1
Definition: cd.h:150
void DeleteCD(TworldCD *cd)
Collision information destructor.
Definition: cd.c:2403
void StoreCollisionInfo(FILE *f, char *fname, unsigned int objectID, Tmechanism *m, TworldCD *cd)
Stores the information collected during last collision check into a file.
Definition: cd.c:2346
boolean ObstacleCanCollide(unsigned int o, unsigned int nl, boolean **checkCollisionsLO)
Identifies obstacles than can collide.
Definition: cd.c:2240
DT_ShapeHandle shape
Definition: cd.h:84
Headers of the C interface for the FCL collision detection library.
Information associated with the Vcollide collision detection engine.
Definition: cd.h:126
unsigned int mc
Definition: cd.h:112
Definition of the Tenvironment type and the associated functions.
unsigned int engine
Definition: cd.h:260
DT_SceneHandle scene
Definition: cd.h:104
unsigned int * linkID
Definition: cd.h:129
unsigned int bodyID
Definition: cd.h:81
unsigned int np
Definition: cd.h:128
unsigned int GetCDEngine(TworldCD *cd)
Determines the collision engine.
Definition: cd.c:2255
TsolidObj * object
Definition: cd.h:107
void Tpqp
The PQP object.
Definition: cd_pqp.h:33
THTransform t2
Definition: cd.h:70
unsigned int np
Definition: cd.h:145
unsigned int nPairs
Definition: cd.h:149
THTransform t
Definition: cd.h:87
Link configuration.
Definition: link.h:276
THTransform tc
Definition: cd.h:90