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;
92  boolean correction;
93  } TsolidObj;
94 
102  typedef struct {
103  DT_SceneHandle scene;
104  DT_RespTableHandle respTable;
105  unsigned int np;
107  boolean simple;
110  unsigned int nc;
111  unsigned int mc;
113  } TsolidCD;
114 #endif
115 
116 
117 #ifdef _HAVE_VCOLLIDE
118 
125  typedef struct {
127  unsigned int np;
128  unsigned int *linkID;
129  unsigned int *bodyID;
130  unsigned int *vcID;
131  } TvcollideCD;
132 #endif
133 
134 
135 #ifdef _HAVE_PQP
136 
143  typedef struct {
144  unsigned int np;
145  unsigned int *linkID;
146  unsigned int *bodyID;
148  unsigned int nPairs;
149  unsigned int *p1;
150  unsigned int *p2;
151  } TpqpCD;
152 #endif
153 
154 #if _HAVE_FCL
155 
160  typedef struct {
161  unsigned int linkID;
162  unsigned int bodyID;
163  unsigned int type;
164  void *model;
165  THTransform t;
166  THTransform tc;
169  } TFCLObject;
170 
178  typedef struct {
179  unsigned int np;
180  TFCLObject *object;
181  unsigned int nPairs;
182  unsigned int *p1;
183  unsigned int *p2;
185  unsigned int nc;
186  unsigned int mc;
187  TCollisionInfo *collision;
188  } TfclCD;
189 #endif
190 
191 
192 #if _HAVE_BULLET
193 
198  typedef struct {
199  void *bulletWorld;
200  unsigned int linkID;
201  unsigned int bodyID;
202  unsigned int type;
203  void *model;
204  THTransform t;
205  THTransform tc;
208  } TBulletObject;
209 
217  typedef struct {
218  unsigned int np;
219  void * bulletWorld;
220  TBulletObject *object;
221  unsigned int nPairs;
222  unsigned int *p1;
223  unsigned int *p2;
225  unsigned int nc;
226  unsigned int mc;
227  TCollisionInfo *collision;
228  } TBulletCD;
229 #endif
230 
231 #ifdef _HAVE_RIGIDCLL
232 
239  typedef struct {
240  TrigidCLL *r;
241  unsigned int nl;
242  unsigned int *objID;
243  THTransform *t;
244  } TrigidCLLCD;
245 #endif
246 
247 
257 typedef struct {
258 
259  unsigned int engine;
261  #ifdef _HAVE_SOLID
263  #else
264  void *solid;
265  #endif
266 
267  #ifdef _HAVE_VCOLLIDE
269  #else
270  void *vcollide;
271  #endif
272 
273  #ifdef _HAVE_PQP
275  #else
276  void *pqp;
277  #endif
278 
279  #ifdef _HAVE_FCL
280  TfclCD *fcl;
281  #else
282  void *fcl;
283  #endif
284 
285  #ifdef _HAVE_BULLET
286  TBulletCD *bullet;
287  #else
288  void *bullet;
289  #endif
290 
291  #ifdef _HAVE_RIGIDCLL
292  TrigidCLLCD *rigidCLL;
293  #else
294  void *rigidCLL;
295  #endif
296 
297 } TworldCD;
298 
299 
300 
315 void InitCD(unsigned int engine,boolean parallel,
316  Tmechanism *m,Tenvironment *e,
317  boolean **checkCollisionsLL,boolean **checkCollisionsLO,
318  TworldCD *cd);
319 
333 boolean LinkCanCollide(unsigned int l,unsigned int nl,unsigned int no,
334  boolean **checkCollisionsLL,boolean **checkCollisionsLO);
335 
347 boolean ObstacleCanCollide(unsigned int o,unsigned int nl,boolean **checkCollisionsLO);
348 
358 unsigned int GetCDEngine(TworldCD *cd);
359 
379 boolean CheckCollision(boolean all,THTransform *tl,THTransform *tlPrev,TworldCD *cd);
380 
409 void StoreCollisionInfo(FILE *f,char *fname,unsigned int objectID,Tmechanism *m,TworldCD *cd);
410 
426 
434 void DeleteCD(TworldCD *cd);
435 
436 #endif
TsolidCD * solid
Definition: cd.h:262
unsigned int id2
Definition: cd.h:65
unsigned int linkID
Definition: cd.h:80
void * bullet
Definition: cd.h:288
boolean CheckCollision(boolean all, THTransform *tl, THTransform *tlPrev, TworldCD *cd)
Determines if there is a collision.
Definition: cd.c:2251
Information on the detected collisions.
Definition: cd.h:60
boolean isLink2
Definition: cd.h:64
void * fcl
Definition: cd.h:282
void PrintCollisionInfo(THTransform *tl, Tmechanism *m, TworldCD *cd)
Prints some information collected during last collision check.
Definition: cd.c:2362
unsigned int * bodyID
Definition: cd.h:129
TCollisionInfo * collision
Definition: cd.h:112
DT_RespTableHandle respTable
Definition: cd.h:104
boolean LinkCanCollide(unsigned int l, unsigned int nl, unsigned int no, boolean **checkCollisionsLL, boolean **checkCollisionsLO)
Identifies links than can collide.
Definition: cd.c:2209
Auxiliary data for the collision detection.
Definition: cd.h:257
Information associated with the PQP collision detection engine.
Definition: cd.h:143
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:102
void Tvcollide
The Vcollide object.
Definition: cd_vcollide.h:33
boolean correction
Definition: cd.h:92
Headers of the C interface for the rigidCLL collision detection engine.
TvcollideCD * vcollide
Definition: cd.h:268
unsigned int * linkID
Definition: cd.h:145
unsigned int * vcID
Definition: cd.h:130
A mechanism description.
Definition: mechanism.h:51
TpqpCD * pqp
Definition: cd.h:274
boolean simple
Definition: cd.h:107
unsigned int * bodyID
Definition: cd.h:146
Headers of the C interface for the Bullet collision detection library.
Tpqp ** model
Definition: cd.h:147
Headers of the C interface for the vcollide collision detection engine.
unsigned int np
Definition: cd.h:105
Information of each object.
Definition: cd.h:78
THTransform t1
Definition: cd.h:69
void * rigidCLL
Definition: cd.h:294
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:110
unsigned int * p2
Definition: cd.h:150
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:2126
Tvcollide * vc
Definition: cd.h:126
boolean isLink1
Definition: cd.h:61
unsigned int * p1
Definition: cd.h:149
void DeleteCD(TworldCD *cd)
Collision information destructor.
Definition: cd.c:2391
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:2334
boolean ObstacleCanCollide(unsigned int o, unsigned int nl, boolean **checkCollisionsLO)
Identifies obstacles than can collide.
Definition: cd.c:2231
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:125
unsigned int mc
Definition: cd.h:111
Definition of the Tenvironment type and the associated functions.
unsigned int engine
Definition: cd.h:259
DT_SceneHandle scene
Definition: cd.h:103
unsigned int * linkID
Definition: cd.h:128
unsigned int bodyID
Definition: cd.h:81
unsigned int np
Definition: cd.h:127
unsigned int GetCDEngine(TworldCD *cd)
Determines the collision engine.
Definition: cd.c:2246
TsolidObj * object
Definition: cd.h:106
void Tpqp
The PQP object.
Definition: cd_pqp.h:33
THTransform t2
Definition: cd.h:70
unsigned int np
Definition: cd.h:144
unsigned int nPairs
Definition: cd.h:148
THTransform t
Definition: cd.h:87
THTransform tc
Definition: cd.h:89