~jtaylor/ubuntu/oneiric/soya/fix-780305

« back to all changes in this revision

Viewing changes to ode-0.5/include/ode/collision.h

  • Committer: Bazaar Package Importer
  • Author(s): Marc Dequènes (Duck)
  • Date: 2005-01-30 09:55:06 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 hoary)
  • Revision ID: james.westby@ubuntu.com-20050130095506-f21p6v6cgaobhn5j
Tags: 0.9.2-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*************************************************************************
 
2
 *                                                                       *
 
3
 * Open Dynamics Engine, Copyright (C) 2001-2003 Russell L. Smith.       *
 
4
 * All rights reserved.  Email: russ@q12.org   Web: www.q12.org          *
 
5
 *                                                                       *
 
6
 * This library is free software; you can redistribute it and/or         *
 
7
 * modify it under the terms of EITHER:                                  *
 
8
 *   (1) The GNU Lesser General Public License as published by the Free  *
 
9
 *       Software Foundation; either version 2.1 of the License, or (at  *
 
10
 *       your option) any later version. The text of the GNU Lesser      *
 
11
 *       General Public License is included with this library in the     *
 
12
 *       file LICENSE.TXT.                                               *
 
13
 *   (2) The BSD-style license that is included with this library in     *
 
14
 *       the file LICENSE-BSD.TXT.                                       *
 
15
 *                                                                       *
 
16
 * This library is distributed in the hope that it will be useful,       *
 
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files    *
 
19
 * LICENSE.TXT and LICENSE-BSD.TXT for more details.                     *
 
20
 *                                                                       *
 
21
 *************************************************************************/
 
22
 
 
23
#ifndef _ODE_COLLISION_H_
 
24
#define _ODE_COLLISION_H_
 
25
 
 
26
#include <ode/common.h>
 
27
#include <ode/collision_space.h>
 
28
#include <ode/contact.h>
 
29
 
 
30
#ifdef __cplusplus
 
31
extern "C" {
 
32
#endif
 
33
 
 
34
/* ************************************************************************ */
 
35
/* general functions */
 
36
 
 
37
void dGeomDestroy (dGeomID);
 
38
void dGeomSetData (dGeomID, void *);
 
39
void *dGeomGetData (dGeomID);
 
40
void dGeomSetBody (dGeomID, dBodyID);
 
41
dBodyID dGeomGetBody (dGeomID);
 
42
void dGeomSetPosition (dGeomID, dReal x, dReal y, dReal z);
 
43
void dGeomSetRotation (dGeomID, const dMatrix3 R);
 
44
void dGeomSetQuaternion (dGeomID, const dQuaternion);
 
45
const dReal * dGeomGetPosition (dGeomID);
 
46
const dReal * dGeomGetRotation (dGeomID);
 
47
void dGeomGetQuaternion (dGeomID, dQuaternion result);
 
48
void dGeomGetAABB (dGeomID, dReal aabb[6]);
 
49
int dGeomIsSpace (dGeomID);
 
50
dSpaceID dGeomGetSpace (dGeomID);
 
51
int dGeomGetClass (dGeomID);
 
52
void dGeomSetCategoryBits (dGeomID, unsigned long bits);
 
53
void dGeomSetCollideBits (dGeomID, unsigned long bits);
 
54
unsigned long dGeomGetCategoryBits (dGeomID);
 
55
unsigned long dGeomGetCollideBits (dGeomID);
 
56
void dGeomEnable (dGeomID);
 
57
void dGeomDisable (dGeomID);
 
58
int dGeomIsEnabled (dGeomID);
 
59
 
 
60
/* ************************************************************************ */
 
61
/* collision detection */
 
62
 
 
63
int dCollide (dGeomID o1, dGeomID o2, int flags, dContactGeom *contact,
 
64
              int skip);
 
65
void dSpaceCollide (dSpaceID space, void *data, dNearCallback *callback);
 
66
void dSpaceCollide2 (dGeomID o1, dGeomID o2, void *data,
 
67
                     dNearCallback *callback);
 
68
 
 
69
/* ************************************************************************ */
 
70
/* standard classes */
 
71
 
 
72
/* the maximum number of user classes that are supported */
 
73
enum {
 
74
  dMaxUserClasses = 4
 
75
};
 
76
 
 
77
/* class numbers - each geometry object needs a unique number */
 
78
enum {
 
79
  dSphereClass = 0,
 
80
  dBoxClass,
 
81
  dCCylinderClass,
 
82
  dCylinderClass,
 
83
  dPlaneClass,
 
84
  dRayClass,
 
85
  dGeomTransformClass,
 
86
  dTriMeshClass,
 
87
 
 
88
  dFirstSpaceClass,
 
89
  dSimpleSpaceClass = dFirstSpaceClass,
 
90
  dHashSpaceClass,
 
91
  dQuadTreeSpaceClass,
 
92
  dLastSpaceClass = dQuadTreeSpaceClass,
 
93
 
 
94
  dFirstUserClass,
 
95
  dLastUserClass = dFirstUserClass + dMaxUserClasses - 1,
 
96
  dGeomNumClasses
 
97
};
 
98
 
 
99
 
 
100
dGeomID dCreateSphere (dSpaceID space, dReal radius);
 
101
void dGeomSphereSetRadius (dGeomID sphere, dReal radius);
 
102
dReal dGeomSphereGetRadius (dGeomID sphere);
 
103
dReal dGeomSpherePointDepth (dGeomID sphere, dReal x, dReal y, dReal z);
 
104
 
 
105
dGeomID dCreateBox (dSpaceID space, dReal lx, dReal ly, dReal lz);
 
106
void dGeomBoxSetLengths (dGeomID box, dReal lx, dReal ly, dReal lz);
 
107
void dGeomBoxGetLengths (dGeomID box, dVector3 result);
 
108
dReal dGeomBoxPointDepth (dGeomID box, dReal x, dReal y, dReal z);
 
109
 
 
110
dGeomID dCreatePlane (dSpaceID space, dReal a, dReal b, dReal c, dReal d);
 
111
void dGeomPlaneSetParams (dGeomID plane, dReal a, dReal b, dReal c, dReal d);
 
112
void dGeomPlaneGetParams (dGeomID plane, dVector4 result);
 
113
dReal dGeomPlanePointDepth (dGeomID plane, dReal x, dReal y, dReal z);
 
114
 
 
115
dGeomID dCreateCCylinder (dSpaceID space, dReal radius, dReal length);
 
116
void dGeomCCylinderSetParams (dGeomID ccylinder, dReal radius, dReal length);
 
117
void dGeomCCylinderGetParams (dGeomID ccylinder, dReal *radius, dReal *length);
 
118
dReal dGeomCCylinderPointDepth (dGeomID ccylinder, dReal x, dReal y, dReal z);
 
119
 
 
120
dGeomID dCreateRay (dSpaceID space, dReal length);
 
121
void dGeomRaySetLength (dGeomID ray, dReal length);
 
122
dReal dGeomRayGetLength (dGeomID ray);
 
123
void dGeomRaySet (dGeomID ray, dReal px, dReal py, dReal pz,
 
124
                  dReal dx, dReal dy, dReal dz);
 
125
void dGeomRayGet (dGeomID ray, dVector3 start, dVector3 dir);
 
126
 
 
127
/*
 
128
 * Set/get ray flags that influence ray collision detection.
 
129
 * These flags are currently only noticed by the trimesh collider, because
 
130
 * they can make a major differences there.
 
131
 */
 
132
void dGeomRaySetParams (dGeomID g, int FirstContact, int BackfaceCull);
 
133
void dGeomRayGetParams (dGeomID g, int *FirstContact, int *BackfaceCull);
 
134
void dGeomRaySetClosestHit (dGeomID g, int closestHit);
 
135
int dGeomRayGetClosestHit (dGeomID g);
 
136
 
 
137
#include "collision_trimesh.h"
 
138
 
 
139
dGeomID dCreateGeomTransform (dSpaceID space);
 
140
void dGeomTransformSetGeom (dGeomID g, dGeomID obj);
 
141
dGeomID dGeomTransformGetGeom (dGeomID g);
 
142
void dGeomTransformSetCleanup (dGeomID g, int mode);
 
143
int dGeomTransformGetCleanup (dGeomID g);
 
144
void dGeomTransformSetInfo (dGeomID g, int mode);
 
145
int dGeomTransformGetInfo (dGeomID g);
 
146
 
 
147
/* ************************************************************************ */
 
148
/* utility functions */
 
149
 
 
150
void dClosestLineSegmentPoints (const dVector3 a1, const dVector3 a2,
 
151
                                const dVector3 b1, const dVector3 b2,
 
152
                                dVector3 cp1, dVector3 cp2);
 
153
 
 
154
int dBoxTouchesBox (const dVector3 _p1, const dMatrix3 R1,
 
155
                    const dVector3 side1, const dVector3 _p2,
 
156
                    const dMatrix3 R2, const dVector3 side2);
 
157
 
 
158
void dInfiniteAABB (dGeomID geom, dReal aabb[6]);
 
159
void dCloseODE();
 
160
 
 
161
/* ************************************************************************ */
 
162
/* custom classes */
 
163
 
 
164
typedef void dGetAABBFn (dGeomID, dReal aabb[6]);
 
165
typedef int dColliderFn (dGeomID o1, dGeomID o2,
 
166
                         int flags, dContactGeom *contact, int skip);
 
167
typedef dColliderFn * dGetColliderFnFn (int num);
 
168
typedef void dGeomDtorFn (dGeomID o);
 
169
typedef int dAABBTestFn (dGeomID o1, dGeomID o2, dReal aabb[6]);
 
170
 
 
171
typedef struct dGeomClass {
 
172
  int bytes;
 
173
  dGetColliderFnFn *collider;
 
174
  dGetAABBFn *aabb;
 
175
  dAABBTestFn *aabb_test;
 
176
  dGeomDtorFn *dtor;
 
177
} dGeomClass;
 
178
 
 
179
int dCreateGeomClass (const dGeomClass *classptr);
 
180
void * dGeomGetClassData (dGeomID);
 
181
dGeomID dCreateGeom (int classnum);
 
182
 
 
183
/* ************************************************************************ */
 
184
 
 
185
#ifdef __cplusplus
 
186
}
 
187
#endif
 
188
 
 
189
#endif