Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/ode/ode-0.9/ode/src/collision_std.h @ 216

Last change on this file since 216 was 216, checked in by mathiask, 16 years ago

[Physik] add ode-0.9

File size: 6.5 KB
Line 
1/*************************************************************************
2 *                                                                       *
3 * Open Dynamics Engine, Copyright (C) 2001,2002 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/*
24
25the standard ODE geometry primitives.
26
27*/
28
29#ifndef _ODE_COLLISION_STD_H_
30#define _ODE_COLLISION_STD_H_
31
32#include <set>
33#include <ode/common.h>
34#include "collision_kernel.h"
35
36
37// primitive collision functions - these have the dColliderFn interface, i.e.
38// the same interface as dCollide(). the first and second geom arguments must
39// have the specified types.
40
41int dCollideSphereSphere (dxGeom *o1, dxGeom *o2, int flags,
42                          dContactGeom *contact, int skip);
43int dCollideSphereBox (dxGeom *o1, dxGeom *o2, int flags,
44                       dContactGeom *contact, int skip);
45int dCollideSpherePlane (dxGeom *o1, dxGeom *o2, int flags,
46                         dContactGeom *contact, int skip);
47int dCollideBoxBox (dxGeom *o1, dxGeom *o2, int flags,
48                    dContactGeom *contact, int skip);
49int dCollideBoxPlane (dxGeom *o1, dxGeom *o2,
50                      int flags, dContactGeom *contact, int skip);
51int dCollideCapsuleSphere (dxGeom *o1, dxGeom *o2, int flags,
52                             dContactGeom *contact, int skip);
53int dCollideCapsuleBox (dxGeom *o1, dxGeom *o2, int flags,
54                          dContactGeom *contact, int skip);
55int dCollideCapsuleCapsule (dxGeom *o1, dxGeom *o2,
56                                int flags, dContactGeom *contact, int skip);
57int dCollideCapsulePlane (dxGeom *o1, dxGeom *o2, int flags,
58                            dContactGeom *contact, int skip);
59int dCollideRaySphere (dxGeom *o1, dxGeom *o2, int flags,
60                       dContactGeom *contact, int skip);
61int dCollideRayBox (dxGeom *o1, dxGeom *o2, int flags,
62                    dContactGeom *contact, int skip);
63int dCollideRayCapsule (dxGeom *o1, dxGeom *o2,
64                          int flags, dContactGeom *contact, int skip);
65int dCollideRayPlane (dxGeom *o1, dxGeom *o2, int flags,
66                      dContactGeom *contact, int skip);
67int dCollideRayCylinder (dxGeom *o1, dxGeom *o2, int flags,
68                      dContactGeom *contact, int skip);
69
70// Cylinder - Box/Sphere by (C) CroTeam
71// Ported by Nguyen Binh
72int dCollideCylinderBox(dxGeom *o1, dxGeom *o2, 
73                        int flags, dContactGeom *contact, int skip);
74int dCollideCylinderSphere(dxGeom *gCylinder, dxGeom *gSphere, 
75                           int flags, dContactGeom *contact, int skip); 
76int dCollideCylinderPlane(dxGeom *gCylinder, dxGeom *gPlane, 
77                           int flags, dContactGeom *contact, int skip); 
78
79//--> Convex Collision
80int dCollideConvexPlane (dxGeom *o1, dxGeom *o2, int flags,
81                         dContactGeom *contact, int skip);
82int dCollideSphereConvex (dxGeom *o1, dxGeom *o2, int flags,
83                          dContactGeom *contact, int skip);
84int dCollideConvexBox (dxGeom *o1, dxGeom *o2, int flags,
85                       dContactGeom *contact, int skip);
86int dCollideConvexCapsule (dxGeom *o1, dxGeom *o2,
87                           int flags, dContactGeom *contact, int skip);
88int dCollideConvexConvex (dxGeom *o1, dxGeom *o2, int flags, 
89                          dContactGeom *contact, int skip);
90int dCollideRayConvex (dxGeom *o1, dxGeom *o2, int flags, 
91                       dContactGeom *contact, int skip);
92//<-- Convex Collision
93
94// dHeightfield
95int dCollideHeightfield( dxGeom *o1, dxGeom *o2, 
96                                                 int flags, dContactGeom *contact, int skip );
97
98//****************************************************************************
99// the basic geometry objects
100
101struct dxSphere : public dxGeom {
102  dReal radius;         // sphere radius
103  dxSphere (dSpaceID space, dReal _radius);
104  void computeAABB();
105};
106
107
108struct dxBox : public dxGeom {
109  dVector3 side;        // side lengths (x,y,z)
110  dxBox (dSpaceID space, dReal lx, dReal ly, dReal lz);
111  void computeAABB();
112};
113
114
115struct dxCapsule : public dxGeom {
116  dReal radius,lz;      // radius, length along z axis
117  dxCapsule (dSpaceID space, dReal _radius, dReal _length);
118  void computeAABB();
119};
120
121
122struct dxCylinder : public dxGeom {
123        dReal radius,lz;        // radius, length along z axis
124        dxCylinder (dSpaceID space, dReal _radius, dReal _length);
125        void computeAABB();
126};
127
128
129struct dxPlane : public dxGeom {
130  dReal p[4];
131  dxPlane (dSpaceID space, dReal a, dReal b, dReal c, dReal d);
132  void computeAABB();
133};
134
135
136struct dxRay : public dxGeom {
137  dReal length;
138  dxRay (dSpaceID space, dReal _length);
139  void computeAABB();
140};
141
142typedef std::pair<unsigned int,unsigned int> edge; /*!< Used to descrive a convex hull edge, an edge is a pair or indices into the hull's points */
143struct dxConvex : public dxGeom
144{
145 
146  dReal *planes; /*!< An array of planes in the form:
147                   normal X, normal Y, normal Z,Distance
148                 */
149  dReal *points; /*!< An array of points X,Y,Z */ 
150  unsigned int *polygons; /*! An array of indices to the points of each polygon, it should be the number of vertices followed by that amount of indices to "points" in counter clockwise order*/
151  unsigned int planecount; /*!< Amount of planes in planes */
152  unsigned int pointcount;/*!< Amount of points in points */
153  dReal saabb[6];/*!< Static AABB */
154  std::set<edge> edges;
155  dxConvex(dSpaceID space,
156           dReal *planes,
157           unsigned int planecount,
158           dReal *points,
159           unsigned int pointcount,
160           unsigned int *polygons);
161  ~dxConvex()
162  {
163    //fprintf(stdout,"dxConvex Destroy\n");
164  }
165  void computeAABB();
166  private:
167  // For Internal Use Only
168  void FillEdges();
169};
170
171
172#endif
Note: See TracBrowser for help on using the repository browser.