00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef _ODE_ODECPP_H_
00027 #define _ODE_ODECPP_H_
00028 #ifdef __cplusplus
00029
00030
00031
00032
00033
00034
00035 class dWorld {
00036 dWorldID _id;
00037
00038
00039 dWorld (const dWorld &);
00040 void operator= (const dWorld &);
00041
00042 public:
00043 dWorld()
00044 { _id = dWorldCreate(); }
00045 ~dWorld()
00046 { dWorldDestroy (_id); }
00047
00048 dWorldID id() const
00049 { return _id; }
00050 operator dWorldID() const
00051 { return _id; }
00052
00053 void setGravity (dReal x, dReal y, dReal z)
00054 { dWorldSetGravity (_id,x,y,z); }
00055 void setGravity (const dVector3 g)
00056 { setGravity (g[0], g[1], g[2]); }
00057 void getGravity (dVector3 g) const
00058 { dWorldGetGravity (_id,g); }
00059
00060 void setERP (dReal erp)
00061 { dWorldSetERP(_id, erp); }
00062 dReal getERP() const
00063 { return dWorldGetERP(_id); }
00064
00065 void setCFM (dReal cfm)
00066 { dWorldSetCFM(_id, cfm); }
00067 dReal getCFM() const
00068 { return dWorldGetCFM(_id); }
00069
00070 void step (dReal stepsize)
00071 { dWorldStep (_id,stepsize); }
00072
00073 void stepFast1 (dReal stepsize, int maxiterations)
00074 { dWorldStepFast1 (_id,stepsize,maxiterations); }
00075 void setAutoEnableDepthSF1(int depth)
00076 { dWorldSetAutoEnableDepthSF1 (_id, depth); }
00077 int getAutoEnableDepthSF1() const
00078 { return dWorldGetAutoEnableDepthSF1 (_id); }
00079
00080 void quickStep(dReal stepsize)
00081 { dWorldQuickStep (_id, stepsize); }
00082 void setQuickStepNumIterations(int num)
00083 { dWorldSetQuickStepNumIterations (_id, num); }
00084 int getQuickStepNumIterations() const
00085 { return dWorldGetQuickStepNumIterations (_id); }
00086 void setQuickStepW(dReal over_relaxation)
00087 { dWorldSetQuickStepW (_id, over_relaxation); }
00088 dReal getQuickStepW() const
00089 { return dWorldGetQuickStepW (_id); }
00090
00091 void setAutoDisableLinearThreshold (dReal threshold)
00092 { dWorldSetAutoDisableLinearThreshold (_id,threshold); }
00093 dReal getAutoDisableLinearThreshold() const
00094 { return dWorldGetAutoDisableLinearThreshold (_id); }
00095 void setAutoDisableAngularThreshold (dReal threshold)
00096 { dWorldSetAutoDisableAngularThreshold (_id,threshold); }
00097 dReal getAutoDisableAngularThreshold() const
00098 { return dWorldGetAutoDisableAngularThreshold (_id); }
00099 void setAutoDisableSteps (int steps)
00100 { dWorldSetAutoDisableSteps (_id,steps); }
00101 int getAutoDisableSteps() const
00102 { return dWorldGetAutoDisableSteps (_id); }
00103 void setAutoDisableTime (dReal time)
00104 { dWorldSetAutoDisableTime (_id,time); }
00105 dReal getAutoDisableTime() const
00106 { return dWorldGetAutoDisableTime (_id); }
00107 void setAutoDisableFlag (int do_auto_disable)
00108 { dWorldSetAutoDisableFlag (_id,do_auto_disable); }
00109 int getAutoDisableFlag() const
00110 { return dWorldGetAutoDisableFlag (_id); }
00111
00112 dReal getLinearDampingThreshold() const
00113 { return dWorldGetLinearDampingThreshold(_id); }
00114 void setLinearDampingThreshold(dReal threshold)
00115 { dWorldSetLinearDampingThreshold(_id, threshold); }
00116 dReal getAngularDampingThreshold() const
00117 { return dWorldGetAngularDampingThreshold(_id); }
00118 void setAngularDampingThreshold(dReal threshold)
00119 { dWorldSetAngularDampingThreshold(_id, threshold); }
00120 dReal getLinearDamping() const
00121 { return dWorldGetLinearDamping(_id); }
00122 void setLinearDamping(dReal scale)
00123 { dWorldSetLinearDamping(_id, scale); }
00124 dReal getAngularDamping() const
00125 { return dWorldGetAngularDamping(_id); }
00126 void setAngularDamping(dReal scale)
00127 { dWorldSetAngularDamping(_id, scale); }
00128 void setDamping(dReal linear_scale, dReal angular_scale)
00129 { dWorldSetDamping(_id, linear_scale, angular_scale); }
00130
00131 dReal getMaxAngularSpeed() const
00132 { return dWorldGetMaxAngularSpeed(_id); }
00133 void setMaxAngularSpeed(dReal max_speed)
00134 { dWorldSetMaxAngularSpeed(_id, max_speed); }
00135
00136 void setContactSurfaceLayer(dReal depth)
00137 { dWorldSetContactSurfaceLayer (_id, depth); }
00138 dReal getContactSurfaceLayer() const
00139 { return dWorldGetContactSurfaceLayer (_id); }
00140
00141 void impulseToForce (dReal stepsize, dReal ix, dReal iy, dReal iz,
00142 dVector3 force)
00143 { dWorldImpulseToForce (_id,stepsize,ix,iy,iz,force); }
00144 };
00145
00146
00147 class dBody {
00148 dBodyID _id;
00149
00150 dBody (const dBody &);
00151 void operator= (const dBody &);
00152
00153 public:
00154 dBody()
00155 { _id = 0; }
00156 dBody (dWorldID world)
00157 { _id = dBodyCreate (world); }
00158 dBody (dWorld& world)
00159 { _id = dBodyCreate (world.id()); }
00160 ~dBody()
00161 { if (_id) dBodyDestroy (_id); }
00162
00163 void create (dWorldID world) {
00164 if (_id) dBodyDestroy (_id);
00165 _id = dBodyCreate (world);
00166 }
00167 void create (dWorld& world) {
00168 create(world.id());
00169 }
00170
00171 dBodyID id() const
00172 { return _id; }
00173 operator dBodyID() const
00174 { return _id; }
00175
00176 void setData (void *data)
00177 { dBodySetData (_id,data); }
00178 void *getData() const
00179 { return dBodyGetData (_id); }
00180
00181 void setPosition (dReal x, dReal y, dReal z)
00182 { dBodySetPosition (_id,x,y,z); }
00183 void setPosition (const dVector3 p)
00184 { setPosition(p[0], p[1], p[2]); }
00185
00186 void setRotation (const dMatrix3 R)
00187 { dBodySetRotation (_id,R); }
00188 void setQuaternion (const dQuaternion q)
00189 { dBodySetQuaternion (_id,q); }
00190 void setLinearVel (dReal x, dReal y, dReal z)
00191 { dBodySetLinearVel (_id,x,y,z); }
00192 void setLinearVel (const dVector3 v)
00193 { setLinearVel(v[0], v[1], v[2]); }
00194 void setAngularVel (dReal x, dReal y, dReal z)
00195 { dBodySetAngularVel (_id,x,y,z); }
00196 void setAngularVel (const dVector3 v)
00197 { setAngularVel (v[0], v[1], v[2]); }
00198
00199 const dReal * getPosition() const
00200 { return dBodyGetPosition (_id); }
00201 const dReal * getRotation() const
00202 { return dBodyGetRotation (_id); }
00203 const dReal * getQuaternion() const
00204 { return dBodyGetQuaternion (_id); }
00205 const dReal * getLinearVel() const
00206 { return dBodyGetLinearVel (_id); }
00207 const dReal * getAngularVel() const
00208 { return dBodyGetAngularVel (_id); }
00209
00210 void setMass (const dMass *mass)
00211 { dBodySetMass (_id,mass); }
00212 void setMass (const dMass &mass)
00213 { setMass (&mass); }
00214 dMass getMass () const
00215 { dMass mass; dBodyGetMass (_id,&mass); return mass; }
00216
00217 void addForce (dReal fx, dReal fy, dReal fz)
00218 { dBodyAddForce (_id, fx, fy, fz); }
00219 void addForce (const dVector3 f)
00220 { addForce (f[0], f[1], f[2]); }
00221 void addTorque (dReal fx, dReal fy, dReal fz)
00222 { dBodyAddTorque (_id, fx, fy, fz); }
00223 void addTorque (const dVector3 t)
00224 { addTorque(t[0], t[1], t[2]); }
00225
00226 void addRelForce (dReal fx, dReal fy, dReal fz)
00227 { dBodyAddRelForce (_id, fx, fy, fz); }
00228 void addRelForce (const dVector3 f)
00229 { addRelForce (f[0], f[1], f[2]); }
00230 void addRelTorque (dReal fx, dReal fy, dReal fz)
00231 { dBodyAddRelTorque (_id, fx, fy, fz); }
00232 void addRelTorque (const dVector3 t)
00233 { addRelTorque (t[0], t[1], t[2]); }
00234
00235 void addForceAtPos (dReal fx, dReal fy, dReal fz,
00236 dReal px, dReal py, dReal pz)
00237 { dBodyAddForceAtPos (_id, fx, fy, fz, px, py, pz); }
00238 void addForceAtPos (const dVector3 f, const dVector3 p)
00239 { addForceAtPos (f[0], f[1], f[2], p[0], p[1], p[2]); }
00240
00241 void addForceAtRelPos (dReal fx, dReal fy, dReal fz,
00242 dReal px, dReal py, dReal pz)
00243 { dBodyAddForceAtRelPos (_id, fx, fy, fz, px, py, pz); }
00244 void addForceAtRelPos (const dVector3 f, const dVector3 p)
00245 { addForceAtRelPos (f[0], f[1], f[2], p[0], p[1], p[2]); }
00246
00247 void addRelForceAtPos (dReal fx, dReal fy, dReal fz,
00248 dReal px, dReal py, dReal pz)
00249 { dBodyAddRelForceAtPos (_id, fx, fy, fz, px, py, pz); }
00250 void addRelForceAtPos (const dVector3 f, const dVector3 p)
00251 { addRelForceAtPos (f[0], f[1], f[2], p[0], p[1], p[2]); }
00252
00253 void addRelForceAtRelPos (dReal fx, dReal fy, dReal fz,
00254 dReal px, dReal py, dReal pz)
00255 { dBodyAddRelForceAtRelPos (_id, fx, fy, fz, px, py, pz); }
00256 void addRelForceAtRelPos (const dVector3 f, const dVector3 p)
00257 { addRelForceAtRelPos (f[0], f[1], f[2], p[0], p[1], p[2]); }
00258
00259 const dReal * getForce() const
00260 { return dBodyGetForce(_id); }
00261 const dReal * getTorque() const
00262 { return dBodyGetTorque(_id); }
00263 void setForce (dReal x, dReal y, dReal z)
00264 { dBodySetForce (_id,x,y,z); }
00265 void setForce (const dVector3 f)
00266 { setForce (f[0], f[1], f[2]); }
00267 void setTorque (dReal x, dReal y, dReal z)
00268 { dBodySetTorque (_id,x,y,z); }
00269 void setTorque (const dVector3 t)
00270 { setTorque (t[0], t[1], t[2]); }
00271
00272 void setDynamic()
00273 { dBodySetDynamic (_id); }
00274 void setKinematic()
00275 { dBodySetKinematic (_id); }
00276 bool isKinematic() const
00277 { return dBodyIsKinematic (_id) != 0; }
00278
00279 void enable()
00280 { dBodyEnable (_id); }
00281 void disable()
00282 { dBodyDisable (_id); }
00283 bool isEnabled() const
00284 { return dBodyIsEnabled (_id) != 0; }
00285
00286 void getRelPointPos (dReal px, dReal py, dReal pz, dVector3 result) const
00287 { dBodyGetRelPointPos (_id, px, py, pz, result); }
00288 void getRelPointPos (const dVector3 p, dVector3 result) const
00289 { getRelPointPos (p[0], p[1], p[2], result); }
00290
00291 void getRelPointVel (dReal px, dReal py, dReal pz, dVector3 result) const
00292 { dBodyGetRelPointVel (_id, px, py, pz, result); }
00293 void getRelPointVel (const dVector3 p, dVector3 result) const
00294 { getRelPointVel (p[0], p[1], p[2], result); }
00295
00296 void getPointVel (dReal px, dReal py, dReal pz, dVector3 result) const
00297 { dBodyGetPointVel (_id, px, py, pz, result); }
00298 void getPointVel (const dVector3 p, dVector3 result) const
00299 { getPointVel (p[0], p[1], p[2], result); }
00300
00301 void getPosRelPoint (dReal px, dReal py, dReal pz, dVector3 result) const
00302 { dBodyGetPosRelPoint (_id, px, py, pz, result); }
00303 void getPosRelPoint (const dVector3 p, dVector3 result) const
00304 { getPosRelPoint (p[0], p[1], p[2], result); }
00305
00306 void vectorToWorld (dReal px, dReal py, dReal pz, dVector3 result) const
00307 { dBodyVectorToWorld (_id, px, py, pz, result); }
00308 void vectorToWorld (const dVector3 p, dVector3 result) const
00309 { vectorToWorld (p[0], p[1], p[2], result); }
00310
00311 void vectorFromWorld (dReal px, dReal py, dReal pz, dVector3 result) const
00312 { dBodyVectorFromWorld (_id,px,py,pz,result); }
00313 void vectorFromWorld (const dVector3 p, dVector3 result) const
00314 { vectorFromWorld (p[0], p[1], p[2], result); }
00315
00316 void setFiniteRotationMode (bool mode)
00317 { dBodySetFiniteRotationMode (_id, mode); }
00318
00319 void setFiniteRotationAxis (dReal x, dReal y, dReal z)
00320 { dBodySetFiniteRotationAxis (_id, x, y, z); }
00321 void setFiniteRotationAxis (const dVector3 a)
00322 { setFiniteRotationAxis (a[0], a[1], a[2]); }
00323
00324 bool getFiniteRotationMode() const
00325 { return dBodyGetFiniteRotationMode (_id) != 0; }
00326 void getFiniteRotationAxis (dVector3 result) const
00327 { dBodyGetFiniteRotationAxis (_id, result); }
00328
00329 int getNumJoints() const
00330 { return dBodyGetNumJoints (_id); }
00331 dJointID getJoint (int index) const
00332 { return dBodyGetJoint (_id, index); }
00333
00334 void setGravityMode (bool mode)
00335 { dBodySetGravityMode (_id,mode); }
00336 bool getGravityMode() const
00337 { return dBodyGetGravityMode (_id) != 0; }
00338
00339 bool isConnectedTo (dBodyID body) const
00340 { return dAreConnected (_id, body) != 0; }
00341
00342 void setAutoDisableLinearThreshold (dReal threshold)
00343 { dBodySetAutoDisableLinearThreshold (_id,threshold); }
00344 dReal getAutoDisableLinearThreshold() const
00345 { return dBodyGetAutoDisableLinearThreshold (_id); }
00346 void setAutoDisableAngularThreshold (dReal threshold)
00347 { dBodySetAutoDisableAngularThreshold (_id,threshold); }
00348 dReal getAutoDisableAngularThreshold() const
00349 { return dBodyGetAutoDisableAngularThreshold (_id); }
00350 void setAutoDisableSteps (int steps)
00351 { dBodySetAutoDisableSteps (_id,steps); }
00352 int getAutoDisableSteps() const
00353 { return dBodyGetAutoDisableSteps (_id); }
00354 void setAutoDisableTime (dReal time)
00355 { dBodySetAutoDisableTime (_id,time); }
00356 dReal getAutoDisableTime() const
00357 { return dBodyGetAutoDisableTime (_id); }
00358 void setAutoDisableFlag (bool do_auto_disable)
00359 { dBodySetAutoDisableFlag (_id,do_auto_disable); }
00360 bool getAutoDisableFlag() const
00361 { return dBodyGetAutoDisableFlag (_id) != 0; }
00362
00363 dReal getLinearDamping() const
00364 { return dBodyGetLinearDamping(_id); }
00365 void setLinearDamping(dReal scale)
00366 { dBodySetLinearDamping(_id, scale); }
00367 dReal getAngularDamping() const
00368 { return dBodyGetAngularDamping(_id); }
00369 void setAngularDamping(dReal scale)
00370 { dBodySetAngularDamping(_id, scale); }
00371 void setDamping(dReal linear_scale, dReal angular_scale)
00372 { dBodySetDamping(_id, linear_scale, angular_scale); }
00373 dReal getLinearDampingThreshold() const
00374 { return dBodyGetLinearDampingThreshold(_id); }
00375 void setLinearDampingThreshold(dReal threshold) const
00376 { dBodySetLinearDampingThreshold(_id, threshold); }
00377 dReal getAngularDampingThreshold() const
00378 { return dBodyGetAngularDampingThreshold(_id); }
00379 void setAngularDampingThreshold(dReal threshold)
00380 { dBodySetAngularDampingThreshold(_id, threshold); }
00381 void setDampingDefaults()
00382 { dBodySetDampingDefaults(_id); }
00383
00384 dReal getMaxAngularSpeed() const
00385 { return dBodyGetMaxAngularSpeed(_id); }
00386 void setMaxAngularSpeed(dReal max_speed)
00387 { dBodySetMaxAngularSpeed(_id, max_speed); }
00388
00389 bool getGyroscopicMode() const
00390 { return dBodyGetGyroscopicMode(_id) != 0; }
00391 void setGyroscopicMode(bool mode)
00392 { dBodySetGyroscopicMode(_id, mode); }
00393
00394 };
00395
00396
00397 class dJointGroup {
00398 dJointGroupID _id;
00399
00400
00401 dJointGroup (const dJointGroup &);
00402 void operator= (const dJointGroup &);
00403
00404 public:
00405 dJointGroup ()
00406 { _id = dJointGroupCreate (0); }
00407 ~dJointGroup()
00408 { dJointGroupDestroy (_id); }
00409 void create () {
00410 if (_id) dJointGroupDestroy (_id);
00411 _id = dJointGroupCreate (0);
00412 }
00413
00414 dJointGroupID id() const
00415 { return _id; }
00416 operator dJointGroupID() const
00417 { return _id; }
00418
00419 void empty()
00420 { dJointGroupEmpty (_id); }
00421 void clear()
00422 { empty(); }
00423 };
00424
00425
00426 class dJoint {
00427 private:
00428
00429 dJoint (const dJoint &) ;
00430 void operator= (const dJoint &);
00431
00432 protected:
00433 dJointID _id;
00434
00435 dJoint()
00436 { _id = 0; }
00437
00438 public:
00439 virtual ~dJoint()
00440 { if (_id) dJointDestroy (_id); }
00441
00442 dJointID id() const
00443 { return _id; }
00444 operator dJointID() const
00445 { return _id; }
00446
00447 int getNumBodies() const
00448 { return dJointGetNumBodies(_id); }
00449
00450 void attach (dBodyID body1, dBodyID body2)
00451 { dJointAttach (_id, body1, body2); }
00452 void attach (dBody& body1, dBody& body2)
00453 { attach(body1.id(), body2.id()); }
00454
00455 void enable()
00456 { dJointEnable (_id); }
00457 void disable()
00458 { dJointDisable (_id); }
00459 bool isEnabled() const
00460 { return dJointIsEnabled (_id) != 0; }
00461
00462 void setData (void *data)
00463 { dJointSetData (_id, data); }
00464 void *getData() const
00465 { return dJointGetData (_id); }
00466
00467 dJointType getType() const
00468 { return dJointGetType (_id); }
00469
00470 dBodyID getBody (int index) const
00471 { return dJointGetBody (_id, index); }
00472
00473 void setFeedback(dJointFeedback *fb)
00474 { dJointSetFeedback(_id, fb); }
00475 dJointFeedback *getFeedback() const
00476 { return dJointGetFeedback(_id); }
00477
00478
00479 virtual void setParam (int, dReal) {};
00480 virtual dReal getParam (int) const { return 0; }
00481 };
00482
00483
00484 class dBallJoint : public dJoint {
00485 private:
00486
00487 dBallJoint (const dBallJoint &);
00488 void operator= (const dBallJoint &);
00489
00490 public:
00491 dBallJoint() { }
00492 dBallJoint (dWorldID world, dJointGroupID group=0)
00493 { _id = dJointCreateBall (world, group); }
00494 dBallJoint (dWorld& world, dJointGroupID group=0)
00495 { _id = dJointCreateBall (world.id(), group); }
00496
00497 void create (dWorldID world, dJointGroupID group=0) {
00498 if (_id) dJointDestroy (_id);
00499 _id = dJointCreateBall (world, group);
00500 }
00501 void create (dWorld& world, dJointGroupID group=0)
00502 { create(world.id(), group); }
00503
00504 void setAnchor (dReal x, dReal y, dReal z)
00505 { dJointSetBallAnchor (_id, x, y, z); }
00506 void setAnchor (const dVector3 a)
00507 { setAnchor (a[0], a[1], a[2]); }
00508 void getAnchor (dVector3 result) const
00509 { dJointGetBallAnchor (_id, result); }
00510 void getAnchor2 (dVector3 result) const
00511 { dJointGetBallAnchor2 (_id, result); }
00512 virtual void setParam (int parameter, dReal value)
00513 { dJointSetBallParam (_id, parameter, value); }
00514 virtual dReal getParam (int parameter) const
00515 { return dJointGetBallParam (_id, parameter); }
00516
00517 } ;
00518
00519
00520 class dHingeJoint : public dJoint {
00521
00522 dHingeJoint (const dHingeJoint &);
00523 void operator = (const dHingeJoint &);
00524
00525 public:
00526 dHingeJoint() { }
00527 dHingeJoint (dWorldID world, dJointGroupID group=0)
00528 { _id = dJointCreateHinge (world, group); }
00529 dHingeJoint (dWorld& world, dJointGroupID group=0)
00530 { _id = dJointCreateHinge (world.id(), group); }
00531
00532 void create (dWorldID world, dJointGroupID group=0) {
00533 if (_id) dJointDestroy (_id);
00534 _id = dJointCreateHinge (world, group);
00535 }
00536 void create (dWorld& world, dJointGroupID group=0)
00537 { create(world.id(), group); }
00538
00539 void setAnchor (dReal x, dReal y, dReal z)
00540 { dJointSetHingeAnchor (_id, x, y, z); }
00541 void setAnchor (const dVector3 a)
00542 { setAnchor (a[0], a[1], a[2]); }
00543 void getAnchor (dVector3 result) const
00544 { dJointGetHingeAnchor (_id, result); }
00545 void getAnchor2 (dVector3 result) const
00546 { dJointGetHingeAnchor2 (_id, result); }
00547
00548 void setAxis (dReal x, dReal y, dReal z)
00549 { dJointSetHingeAxis (_id, x, y, z); }
00550 void setAxis (const dVector3 a)
00551 { setAxis(a[0], a[1], a[2]); }
00552 void getAxis (dVector3 result) const
00553 { dJointGetHingeAxis (_id, result); }
00554
00555 dReal getAngle() const
00556 { return dJointGetHingeAngle (_id); }
00557 dReal getAngleRate() const
00558 { return dJointGetHingeAngleRate (_id); }
00559
00560 virtual void setParam (int parameter, dReal value)
00561 { dJointSetHingeParam (_id, parameter, value); }
00562 virtual dReal getParam (int parameter) const
00563 { return dJointGetHingeParam (_id, parameter); }
00564
00565
00566 void addTorque (dReal torque)
00567 { dJointAddHingeTorque(_id, torque); }
00568 };
00569
00570
00571 class dSliderJoint : public dJoint {
00572
00573 dSliderJoint (const dSliderJoint &);
00574 void operator = (const dSliderJoint &);
00575
00576 public:
00577 dSliderJoint() { }
00578 dSliderJoint (dWorldID world, dJointGroupID group=0)
00579 { _id = dJointCreateSlider (world, group); }
00580 dSliderJoint (dWorld& world, dJointGroupID group=0)
00581 { _id = dJointCreateSlider (world.id(), group); }
00582
00583 void create (dWorldID world, dJointGroupID group=0) {
00584 if (_id) dJointDestroy (_id);
00585 _id = dJointCreateSlider (world, group);
00586 }
00587 void create (dWorld& world, dJointGroupID group=0)
00588 { create(world.id(), group); }
00589
00590 void setAxis (dReal x, dReal y, dReal z)
00591 { dJointSetSliderAxis (_id, x, y, z); }
00592 void setAxis (const dVector3 a)
00593 { setAxis (a[0], a[1], a[2]); }
00594 void getAxis (dVector3 result) const
00595 { dJointGetSliderAxis (_id, result); }
00596
00597 dReal getPosition() const
00598 { return dJointGetSliderPosition (_id); }
00599 dReal getPositionRate() const
00600 { return dJointGetSliderPositionRate (_id); }
00601
00602 virtual void setParam (int parameter, dReal value)
00603 { dJointSetSliderParam (_id, parameter, value); }
00604 virtual dReal getParam (int parameter) const
00605 { return dJointGetSliderParam (_id, parameter); }
00606
00607
00608 void addForce (dReal force)
00609 { dJointAddSliderForce(_id, force); }
00610 };
00611
00612
00613 class dUniversalJoint : public dJoint {
00614
00615 dUniversalJoint (const dUniversalJoint &);
00616 void operator = (const dUniversalJoint &);
00617
00618 public:
00619 dUniversalJoint() { }
00620 dUniversalJoint (dWorldID world, dJointGroupID group=0)
00621 { _id = dJointCreateUniversal (world, group); }
00622 dUniversalJoint (dWorld& world, dJointGroupID group=0)
00623 { _id = dJointCreateUniversal (world.id(), group); }
00624
00625 void create (dWorldID world, dJointGroupID group=0) {
00626 if (_id) dJointDestroy (_id);
00627 _id = dJointCreateUniversal (world, group);
00628 }
00629 void create (dWorld& world, dJointGroupID group=0)
00630 { create(world.id(), group); }
00631
00632 void setAnchor (dReal x, dReal y, dReal z)
00633 { dJointSetUniversalAnchor (_id, x, y, z); }
00634 void setAnchor (const dVector3 a)
00635 { setAnchor(a[0], a[1], a[2]); }
00636 void setAxis1 (dReal x, dReal y, dReal z)
00637 { dJointSetUniversalAxis1 (_id, x, y, z); }
00638 void setAxis1 (const dVector3 a)
00639 { setAxis1 (a[0], a[1], a[2]); }
00640 void setAxis2 (dReal x, dReal y, dReal z)
00641 { dJointSetUniversalAxis2 (_id, x, y, z); }
00642 void setAxis2 (const dVector3 a)
00643 { setAxis2 (a[0], a[1], a[2]); }
00644
00645 void getAnchor (dVector3 result) const
00646 { dJointGetUniversalAnchor (_id, result); }
00647 void getAnchor2 (dVector3 result) const
00648 { dJointGetUniversalAnchor2 (_id, result); }
00649 void getAxis1 (dVector3 result) const
00650 { dJointGetUniversalAxis1 (_id, result); }
00651 void getAxis2 (dVector3 result) const
00652 { dJointGetUniversalAxis2 (_id, result); }
00653
00654 virtual void setParam (int parameter, dReal value)
00655 { dJointSetUniversalParam (_id, parameter, value); }
00656 virtual dReal getParam (int parameter) const
00657 { return dJointGetUniversalParam (_id, parameter); }
00658
00659
00660 void getAngles(dReal *angle1, dReal *angle2) const
00661 { dJointGetUniversalAngles (_id, angle1, angle2); }
00662
00663 dReal getAngle1() const
00664 { return dJointGetUniversalAngle1 (_id); }
00665 dReal getAngle1Rate() const
00666 { return dJointGetUniversalAngle1Rate (_id); }
00667 dReal getAngle2() const
00668 { return dJointGetUniversalAngle2 (_id); }
00669 dReal getAngle2Rate() const
00670 { return dJointGetUniversalAngle2Rate (_id); }
00671
00672 void addTorques (dReal torque1, dReal torque2)
00673 { dJointAddUniversalTorques(_id, torque1, torque2); }
00674 };
00675
00676
00677 class dHinge2Joint : public dJoint {
00678
00679 dHinge2Joint (const dHinge2Joint &);
00680 void operator = (const dHinge2Joint &);
00681
00682 public:
00683 dHinge2Joint() { }
00684 dHinge2Joint (dWorldID world, dJointGroupID group=0)
00685 { _id = dJointCreateHinge2 (world, group); }
00686 dHinge2Joint (dWorld& world, dJointGroupID group=0)
00687 { _id = dJointCreateHinge2 (world.id(), group); }
00688
00689 void create (dWorldID world, dJointGroupID group=0) {
00690 if (_id) dJointDestroy (_id);
00691 _id = dJointCreateHinge2 (world, group);
00692 }
00693 void create (dWorld& world, dJointGroupID group=0)
00694 { create(world.id(), group); }
00695
00696 void setAnchor (dReal x, dReal y, dReal z)
00697 { dJointSetHinge2Anchor (_id, x, y, z); }
00698 void setAnchor (const dVector3 a)
00699 { setAnchor(a[0], a[1], a[2]); }
00700 void setAxis1 (dReal x, dReal y, dReal z)
00701 { dJointSetHinge2Axis1 (_id, x, y, z); }
00702 void setAxis1 (const dVector3 a)
00703 { setAxis1 (a[0], a[1], a[2]); }
00704 void setAxis2 (dReal x, dReal y, dReal z)
00705 { dJointSetHinge2Axis2 (_id, x, y, z); }
00706 void setAxis2 (const dVector3 a)
00707 { setAxis2 (a[0], a[1], a[2]); }
00708
00709 void getAnchor (dVector3 result) const
00710 { dJointGetHinge2Anchor (_id, result); }
00711 void getAnchor2 (dVector3 result) const
00712 { dJointGetHinge2Anchor2 (_id, result); }
00713 void getAxis1 (dVector3 result) const
00714 { dJointGetHinge2Axis1 (_id, result); }
00715 void getAxis2 (dVector3 result) const
00716 { dJointGetHinge2Axis2 (_id, result); }
00717
00718 dReal getAngle1() const
00719 { return dJointGetHinge2Angle1 (_id); }
00720 dReal getAngle1Rate() const
00721 { return dJointGetHinge2Angle1Rate (_id); }
00722 dReal getAngle2Rate() const
00723 { return dJointGetHinge2Angle2Rate (_id); }
00724
00725 virtual void setParam (int parameter, dReal value)
00726 { dJointSetHinge2Param (_id, parameter, value); }
00727 virtual dReal getParam (int parameter) const
00728 { return dJointGetHinge2Param (_id, parameter); }
00729
00730
00731 void addTorques(dReal torque1, dReal torque2)
00732 { dJointAddHinge2Torques(_id, torque1, torque2); }
00733 };
00734
00735
00736 class dPRJoint : public dJoint {
00737 dPRJoint (const dPRJoint &);
00738 void operator = (const dPRJoint &);
00739
00740 public:
00741 dPRJoint() { }
00742 dPRJoint (dWorldID world, dJointGroupID group=0)
00743 { _id = dJointCreatePR (world, group); }
00744 dPRJoint (dWorld& world, dJointGroupID group=0)
00745 { _id = dJointCreatePR (world.id(), group); }
00746
00747 void create (dWorldID world, dJointGroupID group=0) {
00748 if (_id) dJointDestroy (_id);
00749 _id = dJointCreatePR (world, group);
00750 }
00751 void create (dWorld& world, dJointGroupID group=0)
00752 { create(world.id(), group); }
00753
00754 void setAnchor (dReal x, dReal y, dReal z)
00755 { dJointSetPRAnchor (_id, x, y, z); }
00756 void setAnchor (const dVector3 a)
00757 { setAnchor (a[0], a[1], a[2]); }
00758 void setAxis1 (dReal x, dReal y, dReal z)
00759 { dJointSetPRAxis1 (_id, x, y, z); }
00760 void setAxis1 (const dVector3 a)
00761 { setAxis1(a[0], a[1], a[2]); }
00762 void setAxis2 (dReal x, dReal y, dReal z)
00763 { dJointSetPRAxis2 (_id, x, y, z); }
00764 void setAxis2 (const dVector3 a)
00765 { setAxis2(a[0], a[1], a[2]); }
00766
00767 void getAnchor (dVector3 result) const
00768 { dJointGetPRAnchor (_id, result); }
00769 void getAxis1 (dVector3 result) const
00770 { dJointGetPRAxis1 (_id, result); }
00771 void getAxis2 (dVector3 result) const
00772 { dJointGetPRAxis2 (_id, result); }
00773
00774 dReal getPosition() const
00775 { return dJointGetPRPosition (_id); }
00776 dReal getPositionRate() const
00777 { return dJointGetPRPositionRate (_id); }
00778
00779 dReal getAngle() const
00780 { return dJointGetPRAngle (_id); }
00781 dReal getAngleRate() const
00782 { return dJointGetPRAngleRate (_id); }
00783
00784 virtual void setParam (int parameter, dReal value)
00785 { dJointSetPRParam (_id, parameter, value); }
00786 virtual dReal getParam (int parameter) const
00787 { return dJointGetPRParam (_id, parameter); }
00788 };
00789
00790
00791
00792 class dPUJoint : public dJoint
00793 {
00794 dPUJoint (const dPUJoint &);
00795 void operator = (const dPUJoint &);
00796
00797 public:
00798 dPUJoint() { }
00799 dPUJoint (dWorldID world, dJointGroupID group=0)
00800 { _id = dJointCreatePU (world, group); }
00801 dPUJoint (dWorld& world, dJointGroupID group=0)
00802 { _id = dJointCreatePU (world.id(), group); }
00803
00804 void create (dWorldID world, dJointGroupID group=0)
00805 {
00806 if (_id) dJointDestroy (_id);
00807 _id = dJointCreatePU (world, group);
00808 }
00809 void create (dWorld& world, dJointGroupID group=0)
00810 { create(world.id(), group); }
00811
00812 void setAnchor (dReal x, dReal y, dReal z)
00813 { dJointSetPUAnchor (_id, x, y, z); }
00814 void setAnchor (const dVector3 a)
00815 { setAnchor (a[0], a[1], a[2]); }
00816 void setAxis1 (dReal x, dReal y, dReal z)
00817 { dJointSetPUAxis1 (_id, x, y, z); }
00818 void setAxis1 (const dVector3 a)
00819 { setAxis1(a[0], a[1], a[2]); }
00820 void setAxis2 (dReal x, dReal y, dReal z)
00821 { dJointSetPUAxis2 (_id, x, y, z); }
00822 void setAxis3 (dReal x, dReal y, dReal z)
00823 { dJointSetPUAxis3 (_id, x, y, z); }
00824 void setAxis3 (const dVector3 a)
00825 { setAxis3(a[0], a[1], a[2]); }
00826 void setAxisP (dReal x, dReal y, dReal z)
00827 { dJointSetPUAxis3 (_id, x, y, z); }
00828 void setAxisP (const dVector3 a)
00829 { setAxisP(a[0], a[1], a[2]); }
00830
00831 virtual void getAnchor (dVector3 result) const
00832 { dJointGetPUAnchor (_id, result); }
00833 void getAxis1 (dVector3 result) const
00834 { dJointGetPUAxis1 (_id, result); }
00835 void getAxis2 (dVector3 result) const
00836 { dJointGetPUAxis2 (_id, result); }
00837 void getAxis3 (dVector3 result) const
00838 { dJointGetPUAxis3 (_id, result); }
00839 void getAxisP (dVector3 result) const
00840 { dJointGetPUAxis3 (_id, result); }
00841
00842 dReal getAngle1() const
00843 { return dJointGetPUAngle1 (_id); }
00844 dReal getAngle1Rate() const
00845 { return dJointGetPUAngle1Rate (_id); }
00846 dReal getAngle2() const
00847 { return dJointGetPUAngle2 (_id); }
00848 dReal getAngle2Rate() const
00849 { return dJointGetPUAngle2Rate (_id); }
00850
00851 dReal getPosition() const
00852 { return dJointGetPUPosition (_id); }
00853 dReal getPositionRate() const
00854 { return dJointGetPUPositionRate (_id); }
00855
00856 virtual void setParam (int parameter, dReal value)
00857 { dJointSetPUParam (_id, parameter, value); }
00858 virtual dReal getParam (int parameter) const
00859 { return dJointGetPUParam (_id, parameter); }
00860
00861 };
00862
00863
00864
00865
00866
00867 class dPistonJoint : public dJoint
00868 {
00869
00870 dPistonJoint (const dPistonJoint &);
00871 void operator = (const dPistonJoint &);
00872
00873 public:
00874 dPistonJoint() { }
00875 dPistonJoint (dWorldID world, dJointGroupID group=0)
00876 { _id = dJointCreatePiston (world, group); }
00877 dPistonJoint (dWorld& world, dJointGroupID group=0)
00878 { _id = dJointCreatePiston (world, group); }
00879
00880 void create (dWorldID world, dJointGroupID group=0)
00881 {
00882 if (_id) dJointDestroy (_id);
00883 _id = dJointCreatePiston (world, group);
00884 }
00885 void create (dWorld& world, dJointGroupID group=0)
00886 { create(world.id(), group); }
00887
00888 void setAnchor (dReal x, dReal y, dReal z)
00889 { dJointSetPistonAnchor (_id, x, y, z); }
00890 void setAnchor (const dVector3 a)
00891 { setAnchor (a[0], a[1], a[2]); }
00892 void getAnchor (dVector3 result) const
00893 { dJointGetPistonAnchor (_id, result); }
00894 void getAnchor2 (dVector3 result) const
00895 { dJointGetPistonAnchor2 (_id, result); }
00896
00897 void setAxis (dReal x, dReal y, dReal z)
00898 { dJointSetPistonAxis (_id, x, y, z); }
00899 void setAxis (const dVector3 a)
00900 { setAxis(a[0], a[1], a[2]); }
00901 void getAxis (dVector3 result) const
00902 { dJointGetPistonAxis (_id, result); }
00903
00904 dReal getPosition() const
00905 { return dJointGetPistonPosition (_id); }
00906 dReal getPositionRate() const
00907 { return dJointGetPistonPositionRate (_id); }
00908
00909 virtual void setParam (int parameter, dReal value)
00910 { dJointSetPistonParam (_id, parameter, value); }
00911 virtual dReal getParam (int parameter) const
00912 { return dJointGetPistonParam (_id, parameter); }
00913
00914
00915 void addForce (dReal force)
00916 { dJointAddPistonForce (_id, force); }
00917 };
00918
00919
00920
00921 class dFixedJoint : public dJoint
00922 {
00923
00924 dFixedJoint (const dFixedJoint &);
00925 void operator = (const dFixedJoint &);
00926
00927 public:
00928 dFixedJoint() { }
00929 dFixedJoint (dWorldID world, dJointGroupID group=0)
00930 { _id = dJointCreateFixed (world, group); }
00931 dFixedJoint (dWorld& world, dJointGroupID group=0)
00932 { _id = dJointCreateFixed (world, group); }
00933
00934 void create (dWorldID world, dJointGroupID group=0) {
00935 if (_id) dJointDestroy (_id);
00936 _id = dJointCreateFixed (world, group);
00937 }
00938 void create (dWorld& world, dJointGroupID group=0)
00939 { create(world.id(), group); }
00940
00941 void set()
00942 { dJointSetFixed (_id); }
00943
00944 virtual void setParam (int parameter, dReal value)
00945 { dJointSetFixedParam (_id, parameter, value); }
00946
00947 virtual dReal getParam (int parameter) const
00948 { return dJointGetFixedParam (_id, parameter); }
00949
00950 };
00951
00952
00953 class dContactJoint : public dJoint {
00954
00955 dContactJoint (const dContactJoint &);
00956 void operator = (const dContactJoint &);
00957
00958 public:
00959 dContactJoint() { }
00960 dContactJoint (dWorldID world, dJointGroupID group, dContact *contact)
00961 { _id = dJointCreateContact (world, group, contact); }
00962 dContactJoint (dWorld& world, dJointGroupID group, dContact *contact)
00963 { _id = dJointCreateContact (world.id(), group, contact); }
00964
00965 void create (dWorldID world, dJointGroupID group, dContact *contact) {
00966 if (_id) dJointDestroy (_id);
00967 _id = dJointCreateContact (world, group, contact);
00968 }
00969
00970 void create (dWorld& world, dJointGroupID group, dContact *contact)
00971 { create(world.id(), group, contact); }
00972 };
00973
00974
00975 class dNullJoint : public dJoint {
00976
00977 dNullJoint (const dNullJoint &);
00978 void operator = (const dNullJoint &);
00979
00980 public:
00981 dNullJoint() { }
00982 dNullJoint (dWorldID world, dJointGroupID group=0)
00983 { _id = dJointCreateNull (world, group); }
00984 dNullJoint (dWorld& world, dJointGroupID group=0)
00985 { _id = dJointCreateNull (world.id(), group); }
00986
00987 void create (dWorldID world, dJointGroupID group=0) {
00988 if (_id) dJointDestroy (_id);
00989 _id = dJointCreateNull (world, group);
00990 }
00991 void create (dWorld& world, dJointGroupID group=0)
00992 { create(world.id(), group); }
00993 };
00994
00995
00996 class dAMotorJoint : public dJoint {
00997
00998 dAMotorJoint (const dAMotorJoint &);
00999 void operator = (const dAMotorJoint &);
01000
01001 public:
01002 dAMotorJoint() { }
01003 dAMotorJoint (dWorldID world, dJointGroupID group=0)
01004 { _id = dJointCreateAMotor (world, group); }
01005 dAMotorJoint (dWorld& world, dJointGroupID group=0)
01006 { _id = dJointCreateAMotor (world.id(), group); }
01007
01008 void create (dWorldID world, dJointGroupID group=0) {
01009 if (_id) dJointDestroy (_id);
01010 _id = dJointCreateAMotor (world, group);
01011 }
01012 void create (dWorld& world, dJointGroupID group=0)
01013 { create(world.id(), group); }
01014
01015 void setMode (int mode)
01016 { dJointSetAMotorMode (_id, mode); }
01017 int getMode() const
01018 { return dJointGetAMotorMode (_id); }
01019
01020 void setNumAxes (int num)
01021 { dJointSetAMotorNumAxes (_id, num); }
01022 int getNumAxes() const
01023 { return dJointGetAMotorNumAxes (_id); }
01024
01025 void setAxis (int anum, int rel, dReal x, dReal y, dReal z)
01026 { dJointSetAMotorAxis (_id, anum, rel, x, y, z); }
01027 void setAxis (int anum, int rel, const dVector3 a)
01028 { setAxis(anum, rel, a[0], a[1], a[2]); }
01029 void getAxis (int anum, dVector3 result) const
01030 { dJointGetAMotorAxis (_id, anum, result); }
01031 int getAxisRel (int anum) const
01032 { return dJointGetAMotorAxisRel (_id, anum); }
01033
01034 void setAngle (int anum, dReal angle)
01035 { dJointSetAMotorAngle (_id, anum, angle); }
01036 dReal getAngle (int anum) const
01037 { return dJointGetAMotorAngle (_id, anum); }
01038 dReal getAngleRate (int anum)
01039 { return dJointGetAMotorAngleRate (_id,anum); }
01040
01041 void setParam (int parameter, dReal value)
01042 { dJointSetAMotorParam (_id, parameter, value); }
01043 dReal getParam (int parameter) const
01044 { return dJointGetAMotorParam (_id, parameter); }
01045
01046
01047 void addTorques(dReal torque1, dReal torque2, dReal torque3)
01048 { dJointAddAMotorTorques(_id, torque1, torque2, torque3); }
01049 };
01050
01051
01052 class dLMotorJoint : public dJoint {
01053
01054 dLMotorJoint (const dLMotorJoint &);
01055 void operator = (const dLMotorJoint &);
01056
01057 public:
01058 dLMotorJoint() { }
01059 dLMotorJoint (dWorldID world, dJointGroupID group=0)
01060 { _id = dJointCreateLMotor (world, group); }
01061 dLMotorJoint (dWorld& world, dJointGroupID group=0)
01062 { _id = dJointCreateLMotor (world.id(), group); }
01063
01064 void create (dWorldID world, dJointGroupID group=0) {
01065 if (_id) dJointDestroy (_id);
01066 _id = dJointCreateLMotor (world, group);
01067 }
01068 void create (dWorld& world, dJointGroupID group=0)
01069 { create(world.id(), group); }
01070
01071 void setNumAxes (int num)
01072 { dJointSetLMotorNumAxes (_id, num); }
01073 int getNumAxes() const
01074 { return dJointGetLMotorNumAxes (_id); }
01075
01076 void setAxis (int anum, int rel, dReal x, dReal y, dReal z)
01077 { dJointSetLMotorAxis (_id, anum, rel, x, y, z); }
01078 void setAxis (int anum, int rel, const dVector3 a)
01079 { setAxis(anum, rel, a[0], a[1], a[2]); }
01080 void getAxis (int anum, dVector3 result) const
01081 { dJointGetLMotorAxis (_id, anum, result); }
01082
01083 void setParam (int parameter, dReal value)
01084 { dJointSetLMotorParam (_id, parameter, value); }
01085 dReal getParam (int parameter) const
01086 { return dJointGetLMotorParam (_id, parameter); }
01087
01088 };
01089
01090
01091
01092 #endif
01093 #endif
01094
01095
01096
01097
01098