Skip to content

Commit 9864943

Browse files
committed
ODE: renamed CappedCylinder to Capsule (as in ODE 0.6)
1 parent 205fab5 commit 9864943

File tree

11 files changed

+98
-89
lines changed

11 files changed

+98
-89
lines changed

Externals/ode/config/msvcdefs.def

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ dClosestLineSegmentPoints
7070
dCollide
7171
dCollideRaySphere
7272
dCollideRayBox
73-
dCollideRayCCylinder
73+
dCollideRayCapsule
7474
dCreateBox
75-
dCreateCCylinder
75+
dCreateCapsule
7676
dCreateGeom
7777
dCreateGeomClass
7878
dCreateGeomTransform
@@ -85,9 +85,9 @@ dFactorLDLT
8585
dGeomBoxGetLengths
8686
dGeomBoxPointDepth
8787
dGeomBoxSetLengths
88-
dGeomCCylinderGetParams
89-
dGeomCCylinderPointDepth
90-
dGeomCCylinderSetParams
88+
dGeomCapsuleGetParams
89+
dGeomCapsulePointDepth
90+
dGeomCapsuleSetParams
9191
dGeomDestroy
9292
dGeomDisable
9393
dGeomEnable
@@ -227,8 +227,8 @@ dMassAdjust
227227
dMassRotate
228228
dMassSetBox
229229
dMassSetBoxTotal
230-
dMassSetCappedCylinder
231-
dMassSetCappedCylinderTotal
230+
dMassSetCapsule
231+
dMassSetCapsuleTotal
232232
dMassSetCylinder
233233
dMassSetCylinderTotal
234234
dMassSetParameters

Externals/ode/include/ode/collision.h

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ enum {
401401
enum {
402402
dSphereClass = 0,
403403
dBoxClass,
404-
dCCylinderClass, // XXX: Cylinder was renamed to Capsule
404+
dCapsuleClass,
405405
dCylinderClass,
406406
dPlaneClass,
407407
dRayClass,
@@ -435,12 +435,17 @@ ODE_API void dGeomPlaneSetParams (dGeomID plane, dReal a, dReal b, dReal c, dRea
435435
ODE_API void dGeomPlaneGetParams (dGeomID plane, dVector4 result);
436436
ODE_API dReal dGeomPlanePointDepth (dGeomID plane, dReal x, dReal y, dReal z);
437437

438-
// XXX: Cylinder was renamed to Capsule
439-
dGeomID dCreateCCylinder (dSpaceID space, dReal radius, dReal length);
440-
void dGeomCCylinderSetParams (dGeomID ccylinder, dReal radius, dReal length);
441-
void dGeomCCylinderGetParams (dGeomID ccylinder, dReal *radius, dReal *length);
442-
443-
dReal dGeomCCylinderPointDepth (dGeomID ccylinder, dReal x, dReal y, dReal z);
438+
ODE_API dGeomID dCreateCapsule (dSpaceID space, dReal radius, dReal length);
439+
ODE_API void dGeomCapsuleSetParams (dGeomID ccylinder, dReal radius, dReal length);
440+
ODE_API void dGeomCapsuleGetParams (dGeomID ccylinder, dReal *radius, dReal *length);
441+
ODE_API dReal dGeomCapsulePointDepth (dGeomID ccylinder, dReal x, dReal y, dReal z);
442+
443+
// For now we want to have a backwards compatible C-API, note: C++ API is not.
444+
#define dCreateCCylinder dCreateCapsule
445+
#define dGeomCCylinderSetParams dGeomCapsuleSetParams
446+
#define dGeomCCylinderGetParams dGeomCapsuleGetParams
447+
#define dGeomCCylinderPointDepth dGeomCapsulePointDepth
448+
#define dCCylinderClass dCapsuleClass
444449

445450
ODE_API dGeomID dCreateRay (dSpaceID space, dReal length);
446451
ODE_API void dGeomRaySetLength (dGeomID ray, dReal length);

Externals/ode/include/ode/geom.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void dCloseODE();
6464
/* class numbers */
6565
extern GLOBAL_SHAREDLIB_SPEC int dSphereClass;
6666
extern GLOBAL_SHAREDLIB_SPEC int dBoxClass;
67-
extern GLOBAL_SHAREDLIB_SPEC int dCCylinderClass;
67+
extern GLOBAL_SHAREDLIB_SPEC int dCapsuleClass;
6868
extern GLOBAL_SHAREDLIB_SPEC int dPlaneClass;
6969
extern GLOBAL_SHAREDLIB_SPEC int dGeomGroupClass;
7070
extern GLOBAL_SHAREDLIB_SPEC int dGeomTransformClass;
@@ -73,21 +73,21 @@ extern GLOBAL_SHAREDLIB_SPEC int dGeomTransformClass;
7373
dGeomID dCreateSphere (dSpaceID space, dReal radius);
7474
dGeomID dCreateBox (dSpaceID space, dReal lx, dReal ly, dReal lz);
7575
dGeomID dCreatePlane (dSpaceID space, dReal a, dReal b, dReal c, dReal d);
76-
dGeomID dCreateCCylinder (dSpaceID space, dReal radius, dReal length);
76+
dGeomID dCreateCapsule (dSpaceID space, dReal radius, dReal length);
7777
dGeomID dCreateGeomGroup (dSpaceID space);
7878

7979
/* set geometry parameters */
8080
void dGeomSphereSetRadius (dGeomID sphere, dReal radius);
8181
void dGeomBoxSetLengths (dGeomID box, dReal lx, dReal ly, dReal lz);
8282
void dGeomPlaneSetParams (dGeomID plane, dReal a, dReal b, dReal c, dReal d);
83-
void dGeomCCylinderSetParams (dGeomID ccylinder, dReal radius, dReal length);
83+
void dGeomCapsuleSetParams (dGeomID ccylinder, dReal radius, dReal length);
8484

8585
/* get geometry parameters */
8686
int dGeomGetClass (dGeomID);
8787
dReal dGeomSphereGetRadius (dGeomID sphere);
8888
void dGeomBoxGetLengths (dGeomID box, dVector3 result);
8989
void dGeomPlaneGetParams (dGeomID plane, dVector4 result);
90-
void dGeomCCylinderGetParams (dGeomID ccylinder,
90+
void dGeomCapsuleGetParams (dGeomID ccylinder,
9191
dReal *radius, dReal *length);
9292

9393
/* general functions */

Externals/ode/include/ode/mass.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,10 @@ ODE_API void dMassSetParameters (dMass *, dReal themass,
4343
ODE_API void dMassSetSphere (dMass *, dReal density, dReal radius);
4444
ODE_API void dMassSetSphereTotal (dMass *, dReal total_mass, dReal radius);
4545

46-
// XXX: Cylinder was renamed to Capsule
47-
ODE_API void dMassSetCappedCylinder (dMass *, dReal density, int direction,
48-
dReal radius, dReal length);
49-
ODE_API void dMassSetCappedCylinderTotal (dMass *, dReal total_mass, int direction,
50-
dReal radius, dReal length);
46+
ODE_API void dMassSetCapsule (dMass *, dReal density, int direction,
47+
dReal radius, dReal length);
48+
ODE_API void dMassSetCapsuleTotal (dMass *, dReal total_mass, int direction,
49+
dReal radius, dReal length);
5150

5251
ODE_API void dMassSetCylinder (dMass *, dReal density, int direction,
5352
dReal radius, dReal length);
@@ -67,6 +66,9 @@ ODE_API void dMassRotate (dMass *, const dMatrix3 R);
6766

6867
ODE_API void dMassAdd (dMass *a, const dMass *b);
6968

69+
// Backwards compatible API
70+
#define dMassSetCappedCylinder dMassSetCapsule
71+
#define dMassSetCappedCylinderTotal dMassSetCapsuleTotal
7072

7173

7274
struct dMass {
@@ -85,8 +87,10 @@ struct dMass {
8587
{ dMassSetParameters (this,themass,cgx,cgy,cgz,I11,I22,I33,I12,I13,I23); }
8688
void setSphere (dReal density, dReal radius)
8789
{ dMassSetSphere (this,density,radius); }
88-
void setCappedCylinder (dReal density, int direction, dReal a, dReal b)
90+
void setCapsule (dReal density, int direction, dReal a, dReal b)
8991
{ dMassSetCappedCylinder (this,density,direction,a,b); }
92+
void setCappedCylinder (dReal density, int direction, dReal a, dReal b)
93+
{ setCapsule(density, direction, a, b); }
9094
void setBox (dReal density, dReal lx, dReal ly, dReal lz)
9195
{ dMassSetBox (this,density,lx,ly,lz); }
9296
void adjust (dReal newmass)

Externals/ode/include/ode/odecpp_collision.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -251,26 +251,26 @@ class dPlane : public dGeom {
251251
{ dGeomPlaneGetParams (_id,result); }
252252
};
253253

254-
// XXX: Cylinder was renamed to Capsule
255-
class dCCylinder : public dGeom {
254+
255+
class dCapsule : public dGeom {
256256
// intentionally undefined, don't use these
257-
dCCylinder (dCCylinder &);
258-
void operator= (dCCylinder &);
257+
dCapsule (dCapsule &);
258+
void operator= (dCapsule &);
259259

260260
public:
261-
dCCylinder() { }
262-
dCCylinder (dSpaceID space, dReal radius, dReal length)
263-
{ _id = dCreateCCylinder (space,radius,length); }
261+
dCapsule() { }
262+
dCapsule (dSpaceID space, dReal radius, dReal length)
263+
{ _id = dCreateCapsule (space,radius,length); }
264264

265265
void create (dSpaceID space, dReal radius, dReal length) {
266266
if (_id) dGeomDestroy (_id);
267-
_id = dCreateCCylinder (space,radius,length);
267+
_id = dCreateCapsule (space,radius,length);
268268
}
269269

270270
void setParams (dReal radius, dReal length)
271-
{ dGeomCCylinderSetParams (_id, radius, length); }
271+
{ dGeomCapsuleSetParams (_id, radius, length); }
272272
void getParams (dReal *radius, dReal *length) const
273-
{ dGeomCCylinderGetParams (_id,radius,length); }
273+
{ dGeomCapsuleGetParams (_id,radius,length); }
274274
};
275275

276276

Externals/ode/ode/src/collision_kernel.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,20 +142,20 @@ static void initColliders()
142142
setCollider (dSphereClass,dPlaneClass,&dCollideSpherePlane);
143143
setCollider (dBoxClass,dBoxClass,&dCollideBoxBox);
144144
setCollider (dBoxClass,dPlaneClass,&dCollideBoxPlane);
145-
setCollider (dCCylinderClass,dSphereClass,&dCollideCCylinderSphere);
146-
setCollider (dCCylinderClass,dBoxClass,&dCollideCCylinderBox);
147-
setCollider (dCCylinderClass,dCCylinderClass,&dCollideCCylinderCCylinder);
148-
setCollider (dCCylinderClass,dPlaneClass,&dCollideCCylinderPlane);
145+
setCollider (dCapsuleClass,dSphereClass,&dCollideCapsuleSphere);
146+
setCollider (dCapsuleClass,dBoxClass,&dCollideCapsuleBox);
147+
setCollider (dCapsuleClass,dCapsuleClass,&dCollideCapsuleCapsule);
148+
setCollider (dCapsuleClass,dPlaneClass,&dCollideCapsulePlane);
149149
setCollider (dRayClass,dSphereClass,&dCollideRaySphere);
150150
setCollider (dRayClass,dBoxClass,&dCollideRayBox);
151-
setCollider (dRayClass,dCCylinderClass,&dCollideRayCCylinder);
151+
setCollider (dRayClass,dCapsuleClass,&dCollideRayCapsule);
152152
setCollider (dRayClass,dPlaneClass,&dCollideRayPlane);
153153
#ifdef dTRIMESH_ENABLED
154154
setCollider (dTriMeshClass,dSphereClass,&dCollideSTL);
155155
setCollider (dTriMeshClass,dBoxClass,&dCollideBTL);
156156
setCollider (dTriMeshClass,dRayClass,&dCollideRTL);
157157
setCollider (dTriMeshClass,dTriMeshClass,&dCollideTTL);
158-
setCollider (dTriMeshClass,dCCylinderClass,&dCollideCCTL);
158+
setCollider (dTriMeshClass,dCapsuleClass,&dCollideCCTL);
159159
#endif
160160
setAllColliders (dGeomTransformClass,&dCollideTransform);
161161
}

Externals/ode/ode/src/collision_std.cpp

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ struct dxBox : public dxGeom {
5959
};
6060

6161

62-
struct dxCCylinder : public dxGeom {
62+
struct dxCapsule : public dxGeom {
6363
dReal radius,lz; // radius, length along z axis
64-
dxCCylinder (dSpaceID space, dReal _radius, dReal _length);
64+
dxCapsule (dSpaceID space, dReal _radius, dReal _length);
6565
void computeAABB();
6666
};
6767

@@ -215,17 +215,17 @@ dReal dGeomBoxPointDepth (dGeomID g, dReal x, dReal y, dReal z)
215215
//****************************************************************************
216216
// capped cylinder public API
217217

218-
dxCCylinder::dxCCylinder (dSpaceID space, dReal _radius, dReal _length) :
218+
dxCapsule::dxCapsule (dSpaceID space, dReal _radius, dReal _length) :
219219
dxGeom (space,1)
220220
{
221221
dAASSERT (_radius > 0 && _length > 0);
222-
type = dCCylinderClass;
222+
type = dCapsuleClass;
223223
radius = _radius;
224224
lz = _length;
225225
}
226226

227227

228-
void dxCCylinder::computeAABB()
228+
void dxCapsule::computeAABB()
229229
{
230230
dReal xrange = dFabs(R[2] * lz) * REAL(0.5) + radius;
231231
dReal yrange = dFabs(R[6] * lz) * REAL(0.5) + radius;
@@ -239,36 +239,36 @@ void dxCCylinder::computeAABB()
239239
}
240240

241241

242-
dGeomID dCreateCCylinder (dSpaceID space, dReal radius, dReal length)
242+
dGeomID dCreateCapsule (dSpaceID space, dReal radius, dReal length)
243243
{
244-
return new dxCCylinder (space,radius,length);
244+
return new dxCapsule (space,radius,length);
245245
}
246246

247247

248-
void dGeomCCylinderSetParams (dGeomID g, dReal radius, dReal length)
248+
void dGeomCapsuleSetParams (dGeomID g, dReal radius, dReal length)
249249
{
250-
dUASSERT (g && g->type == dCCylinderClass,"argument not a ccylinder");
250+
dUASSERT (g && g->type == dCapsuleClass,"argument not a ccylinder");
251251
dAASSERT (radius > 0 && length > 0);
252-
dxCCylinder *c = (dxCCylinder*) g;
252+
dxCapsule *c = (dxCapsule*) g;
253253
c->radius = radius;
254254
c->lz = length;
255255
dGeomMoved (g);
256256
}
257257

258258

259-
void dGeomCCylinderGetParams (dGeomID g, dReal *radius, dReal *length)
259+
void dGeomCapsuleGetParams (dGeomID g, dReal *radius, dReal *length)
260260
{
261-
dUASSERT (g && g->type == dCCylinderClass,"argument not a ccylinder");
262-
dxCCylinder *c = (dxCCylinder*) g;
261+
dUASSERT (g && g->type == dCapsuleClass,"argument not a ccylinder");
262+
dxCapsule *c = (dxCapsule*) g;
263263
*radius = c->radius;
264264
*length = c->lz;
265265
}
266266

267267

268-
dReal dGeomCCylinderPointDepth (dGeomID g, dReal x, dReal y, dReal z)
268+
dReal dGeomCapsulePointDepth (dGeomID g, dReal x, dReal y, dReal z)
269269
{
270-
dUASSERT (g && g->type == dCCylinderClass,"argument not a ccylinder");
271-
dxCCylinder *c = (dxCCylinder*) g;
270+
dUASSERT (g && g->type == dCapsuleClass,"argument not a ccylinder");
271+
dxCapsule *c = (dxCapsule*) g;
272272
dVector3 a;
273273
a[0] = x - c->pos[0];
274274
a[1] = y - c->pos[1];
@@ -1519,13 +1519,13 @@ int dCollideBoxPlane (dxGeom *o1, dxGeom *o2,
15191519
}
15201520

15211521

1522-
int dCollideCCylinderSphere (dxGeom *o1, dxGeom *o2, int flags,
1522+
int dCollideCapsuleSphere (dxGeom *o1, dxGeom *o2, int flags,
15231523
dContactGeom *contact, int skip)
15241524
{
15251525
dIASSERT (skip >= (int)sizeof(dContactGeom));
1526-
dIASSERT (o1->type == dCCylinderClass);
1526+
dIASSERT (o1->type == dCapsuleClass);
15271527
dIASSERT (o2->type == dSphereClass);
1528-
dxCCylinder *ccyl = (dxCCylinder*) o1;
1528+
dxCapsule *ccyl = (dxCapsule*) o1;
15291529
dxSphere *sphere = (dxSphere*) o2;
15301530

15311531
contact->g1 = o1;
@@ -1549,13 +1549,13 @@ int dCollideCCylinderSphere (dxGeom *o1, dxGeom *o2, int flags,
15491549
}
15501550

15511551

1552-
int dCollideCCylinderBox (dxGeom *o1, dxGeom *o2, int flags,
1552+
int dCollideCapsuleBox (dxGeom *o1, dxGeom *o2, int flags,
15531553
dContactGeom *contact, int skip)
15541554
{
15551555
dIASSERT (skip >= (int)sizeof(dContactGeom));
1556-
dIASSERT (o1->type == dCCylinderClass);
1556+
dIASSERT (o1->type == dCapsuleClass);
15571557
dIASSERT (o2->type == dBoxClass);
1558-
dxCCylinder *cyl = (dxCCylinder*) o1;
1558+
dxCapsule *cyl = (dxCapsule*) o1;
15591559
dxBox *box = (dxBox*) o2;
15601560

15611561
contact->g1 = o1;
@@ -1586,17 +1586,17 @@ int dCollideCCylinderBox (dxGeom *o1, dxGeom *o2, int flags,
15861586
}
15871587

15881588

1589-
int dCollideCCylinderCCylinder (dxGeom *o1, dxGeom *o2,
1589+
int dCollideCapsuleCapsule (dxGeom *o1, dxGeom *o2,
15901590
int flags, dContactGeom *contact, int skip)
15911591
{
15921592
int i;
15931593
const dReal tolerance = REAL(1e-5);
15941594

15951595
dIASSERT (skip >= (int)sizeof(dContactGeom));
1596-
dIASSERT (o1->type == dCCylinderClass);
1597-
dIASSERT (o2->type == dCCylinderClass);
1598-
dxCCylinder *cyl1 = (dxCCylinder*) o1;
1599-
dxCCylinder *cyl2 = (dxCCylinder*) o2;
1596+
dIASSERT (o1->type == dCapsuleClass);
1597+
dIASSERT (o2->type == dCapsuleClass);
1598+
dxCapsule *cyl1 = (dxCapsule*) o1;
1599+
dxCapsule *cyl2 = (dxCapsule*) o2;
16001600

16011601
contact->g1 = o1;
16021602
contact->g2 = o2;
@@ -1698,13 +1698,13 @@ int dCollideCCylinderCCylinder (dxGeom *o1, dxGeom *o2,
16981698
}
16991699

17001700

1701-
int dCollideCCylinderPlane (dxGeom *o1, dxGeom *o2, int flags,
1701+
int dCollideCapsulePlane (dxGeom *o1, dxGeom *o2, int flags,
17021702
dContactGeom *contact, int skip)
17031703
{
17041704
dIASSERT (skip >= (int)sizeof(dContactGeom));
1705-
dIASSERT (o1->type == dCCylinderClass);
1705+
dIASSERT (o1->type == dCapsuleClass);
17061706
dIASSERT (o2->type == dPlaneClass);
1707-
dxCCylinder *ccyl = (dxCCylinder*) o1;
1707+
dxCapsule *ccyl = (dxCapsule*) o1;
17081708
dxPlane *plane = (dxPlane*) o2;
17091709

17101710
// collide the deepest capping sphere with the plane
@@ -1905,14 +1905,14 @@ int dCollideRayBox (dxGeom *o1, dxGeom *o2, int flags,
19051905
}
19061906

19071907

1908-
int dCollideRayCCylinder (dxGeom *o1, dxGeom *o2,
1908+
int dCollideRayCapsule (dxGeom *o1, dxGeom *o2,
19091909
int flags, dContactGeom *contact, int skip)
19101910
{
19111911
dIASSERT (skip >= (int)sizeof(dContactGeom));
19121912
dIASSERT (o1->type == dRayClass);
1913-
// dIASSERT (o2->type == dCCylinderClass);
1913+
// dIASSERT (o2->type == dCapsuleClass);
19141914
dxRay *ray = (dxRay*) o1;
1915-
dxCCylinder *ccyl = (dxCCylinder*) o2;
1915+
dxCapsule *ccyl = (dxCapsule*) o2;
19161916

19171917
contact->g1 = ray;
19181918
contact->g2 = ccyl;

0 commit comments

Comments
 (0)