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 #include <ode/error.h>
00031
00032
00033 class dWorld {
00034 dWorldID _id;
00035
00036
00037 dWorld (const dWorld &);
00038 void operator= (const dWorld &);
00039
00040 public:
00041 dWorld()
00042 { _id = dWorldCreate(); }
00043 ~dWorld()
00044 { dWorldDestroy (_id); }
00045
00046 dWorldID id() const
00047 { return _id; }
00048 operator dWorldID() const
00049 { return _id; }
00050
00051 void setGravity (dReal x, dReal y, dReal z)
00052 { dWorldSetGravity (_id,x,y,z); }
00053 void getGravity (dVector3 g) const
00054 { dWorldGetGravity (_id,g); }
00055
00056 void setERP (dReal erp)
00057 { dWorldSetERP(_id, erp); }
00058 dReal getERP() const
00059 { return dWorldGetERP(_id); }
00060
00061 void setCFM (dReal cfm)
00062 { dWorldSetCFM(_id, cfm); }
00063 dReal getCFM() const
00064 { return dWorldGetCFM(_id); }
00065
00066 void step (dReal stepsize)
00067 { dWorldStep (_id,stepsize); }
00068
00069 void stepFast1 (dReal stepsize, int maxiterations)
00070 { dWorldStepFast1 (_id,stepsize,maxiterations); }
00071 void setAutoEnableDepthSF1(dWorldID, int depth)
00072 { dWorldSetAutoEnableDepthSF1 (_id, depth); }
00073 int getAutoEnableDepthSF1(dWorldID)
00074 { return dWorldGetAutoEnableDepthSF1 (_id); }
00075
00076 void setAutoDisableLinearThreshold (dReal threshold)
00077 { dWorldSetAutoDisableLinearThreshold (_id,threshold); }
00078 dReal getAutoDisableLinearThreshold()
00079 { return dWorldGetAutoDisableLinearThreshold (_id); }
00080 void setAutoDisableAngularThreshold (dReal threshold)
00081 { dWorldSetAutoDisableAngularThreshold (_id,threshold); }
00082 dReal getAutoDisableAngularThreshold()
00083 { return dWorldGetAutoDisableAngularThreshold (_id); }
00084 void setAutoDisableSteps (int steps)
00085 { dWorldSetAutoDisableSteps (_id,steps); }
00086 int getAutoDisableSteps()
00087 { return dWorldGetAutoDisableSteps (_id); }
00088 void setAutoDisableTime (dReal time)
00089 { dWorldSetAutoDisableTime (_id,time); }
00090 dReal getAutoDisableTime()
00091 { return dWorldGetAutoDisableTime (_id); }
00092 void setAutoDisableFlag (int do_auto_disable)
00093 { dWorldSetAutoDisableFlag (_id,do_auto_disable); }
00094 int getAutoDisableFlag()
00095 { return dWorldGetAutoDisableFlag (_id); }
00096
00097 void impulseToForce (dReal stepsize, dReal ix, dReal iy, dReal iz,
00098 dVector3 force)
00099 { dWorldImpulseToForce (_id,stepsize,ix,iy,iz,force); }
00100 };
00101
00102
00103 class dBody {
00104 dBodyID _id;
00105
00106
00107 dBody (const dBody &);
00108 void operator= (const dBody &);
00109
00110 public:
00111 dBody()
00112 { _id = 0; }
00113 dBody (dWorldID world)
00114 { _id = dBodyCreate (world); }
00115 ~dBody()
00116 { if (_id) dBodyDestroy (_id); }
00117
00118 void create (dWorldID world) {
00119 if (_id) dBodyDestroy (_id);
00120 _id = dBodyCreate (world);
00121 }
00122
00123 dBodyID id() const
00124 { return _id; }
00125 operator dBodyID() const
00126 { return _id; }
00127
00128 void setData (void *data)
00129 { dBodySetData (_id,data); }
00130 void *getData() const
00131 { return dBodyGetData (_id); }
00132
00133 void setPosition (dReal x, dReal y, dReal z)
00134 { dBodySetPosition (_id,x,y,z); }
00135 void setRotation (const dMatrix3 R)
00136 { dBodySetRotation (_id,R); }
00137 void setQuaternion (const dQuaternion q)
00138 { dBodySetQuaternion (_id,q); }
00139 void setLinearVel (dReal x, dReal y, dReal z)
00140 { dBodySetLinearVel (_id,x,y,z); }
00141 void setAngularVel (dReal x, dReal y, dReal z)
00142 { dBodySetAngularVel (_id,x,y,z); }
00143
00144 const dReal * getPosition() const
00145 { return dBodyGetPosition (_id); }
00146 const dReal * getRotation() const
00147 { return dBodyGetRotation (_id); }
00148 const dReal * getQuaternion() const
00149 { return dBodyGetQuaternion (_id); }
00150 const dReal * getLinearVel() const
00151 { return dBodyGetLinearVel (_id); }
00152 const dReal * getAngularVel() const
00153 { return dBodyGetAngularVel (_id); }
00154
00155 void setMass (const dMass *mass)
00156 { dBodySetMass (_id,mass); }
00157 void getMass (dMass *mass) const
00158 { dBodyGetMass (_id,mass); }
00159
00160 void addForce (dReal fx, dReal fy, dReal fz)
00161 { dBodyAddForce (_id, fx, fy, fz); }
00162 void addTorque (dReal fx, dReal fy, dReal fz)
00163 { dBodyAddTorque (_id, fx, fy, fz); }
00164 void addRelForce (dReal fx, dReal fy, dReal fz)
00165 { dBodyAddRelForce (_id, fx, fy, fz); }
00166 void addRelTorque (dReal fx, dReal fy, dReal fz)
00167 { dBodyAddRelTorque (_id, fx, fy, fz); }
00168 void addForceAtPos (dReal fx, dReal fy, dReal fz,
00169 dReal px, dReal py, dReal pz)
00170 { dBodyAddForceAtPos (_id, fx, fy, fz, px, py, pz); }
00171 void addForceAtRelPos (dReal fx, dReal fy, dReal fz,
00172 dReal px, dReal py, dReal pz)
00173 { dBodyAddForceAtRelPos (_id, fx, fy, fz, px, py, pz); }
00174 void addRelForceAtPos (dReal fx, dReal fy, dReal fz,
00175 dReal px, dReal py, dReal pz)
00176 { dBodyAddRelForceAtPos (_id, fx, fy, fz, px, py, pz); }
00177 void addRelForceAtRelPos (dReal fx, dReal fy, dReal fz,
00178 dReal px, dReal py, dReal pz)
00179 { dBodyAddRelForceAtRelPos (_id, fx, fy, fz, px, py, pz); }
00180
00181 const dReal * getForce() const
00182 { return dBodyGetForce(_id); }
00183 const dReal * getTorque() const
00184 { return dBodyGetTorque(_id); }
00185 void setForce (dReal x, dReal y, dReal z)
00186 { dBodySetForce (_id,x,y,z); }
00187 void setTorque (dReal x, dReal y, dReal z)
00188 { dBodySetTorque (_id,x,y,z); }
00189
00190 void enable()
00191 { dBodyEnable (_id); }
00192 void disable()
00193 { dBodyDisable (_id); }
00194 int isEnabled() const
00195 { return dBodyIsEnabled (_id); }
00196
00197 void getRelPointPos (dReal px, dReal py, dReal pz, dVector3 result) const
00198 { dBodyGetRelPointPos (_id, px, py, pz, result); }
00199 void getRelPointVel (dReal px, dReal py, dReal pz, dVector3 result) const
00200 { dBodyGetRelPointVel (_id, px, py, pz, result); }
00201 void getPointVel (dReal px, dReal py, dReal pz, dVector3 result) const
00202 { dBodyGetPointVel (_id,px,py,pz,result); }
00203 void getPosRelPoint (dReal px, dReal py, dReal pz, dVector3 result) const
00204 { dBodyGetPosRelPoint (_id,px,py,pz,result); }
00205 void vectorToWorld (dReal px, dReal py, dReal pz, dVector3 result) const
00206 { dBodyVectorToWorld (_id,px,py,pz,result); }
00207 void vectorFromWorld (dReal px, dReal py, dReal pz, dVector3 result) const
00208 { dBodyVectorFromWorld (_id,px,py,pz,result); }
00209
00210 void setFiniteRotationMode (int mode)
00211 { dBodySetFiniteRotationMode (_id, mode); }
00212 void setFiniteRotationAxis (dReal x, dReal y, dReal z)
00213 { dBodySetFiniteRotationAxis (_id, x, y, z); }
00214
00215 int getFiniteRotationMode() const
00216 { return dBodyGetFiniteRotationMode (_id); }
00217 void getFiniteRotationAxis (dVector3 result) const
00218 { dBodyGetFiniteRotationAxis (_id, result); }
00219
00220 int getNumJoints() const
00221 { return dBodyGetNumJoints (_id); }
00222 dJointID getJoint (int index) const
00223 { return dBodyGetJoint (_id, index); }
00224
00225 void setGravityMode (int mode)
00226 { dBodySetGravityMode (_id,mode); }
00227 int getGravityMode() const
00228 { return dBodyGetGravityMode (_id); }
00229
00230 int isConnectedTo (dBodyID body) const
00231 { return dAreConnected (_id, body); }
00232
00233 void setAutoDisableLinearThreshold (dReal threshold)
00234 { dBodySetAutoDisableLinearThreshold (_id,threshold); }
00235 dReal getAutoDisableLinearThreshold()
00236 { return dBodyGetAutoDisableLinearThreshold (_id); }
00237 void setAutoDisableAngularThreshold (dReal threshold)
00238 { dBodySetAutoDisableAngularThreshold (_id,threshold); }
00239 dReal getAutoDisableAngularThreshold()
00240 { return dBodyGetAutoDisableAngularThreshold (_id); }
00241 void setAutoDisableSteps (int steps)
00242 { dBodySetAutoDisableSteps (_id,steps); }
00243 int getAutoDisableSteps()
00244 { return dBodyGetAutoDisableSteps (_id); }
00245 void setAutoDisableTime (dReal time)
00246 { dBodySetAutoDisableTime (_id,time); }
00247 dReal getAutoDisableTime()
00248 { return dBodyGetAutoDisableTime (_id); }
00249 void setAutoDisableFlag (int do_auto_disable)
00250 { dBodySetAutoDisableFlag (_id,do_auto_disable); }
00251 int getAutoDisableFlag()
00252 { return dBodyGetAutoDisableFlag (_id); }
00253 };
00254
00255
00256 class dJointGroup {
00257 dJointGroupID _id;
00258
00259
00260 dJointGroup (const dJointGroup &);
00261 void operator= (const dJointGroup &);
00262
00263 public:
00264 dJointGroup (int dummy_arg=0)
00265 { _id = dJointGroupCreate (0); }
00266 ~dJointGroup()
00267 { dJointGroupDestroy (_id); }
00268 void create (int dummy_arg=0) {
00269 if (_id) dJointGroupDestroy (_id);
00270 _id = dJointGroupCreate (0);
00271 }
00272
00273 dJointGroupID id() const
00274 { return _id; }
00275 operator dJointGroupID() const
00276 { return _id; }
00277
00278 void empty()
00279 { dJointGroupEmpty (_id); }
00280 };
00281
00282
00283 class dJoint {
00284 private:
00285
00286 dJoint (const dJoint &) ;
00287 void operator= (const dJoint &);
00288
00289 protected:
00290 dJointID _id;
00291
00292 public:
00293 dJoint()
00294 { _id = 0; }
00295 ~dJoint()
00296 { if (_id) dJointDestroy (_id); }
00297
00298 dJointID id() const
00299 { return _id; }
00300 operator dJointID() const
00301 { return _id; }
00302
00303 void attach (dBodyID body1, dBodyID body2)
00304 { dJointAttach (_id, body1, body2); }
00305
00306 void setData (void *data)
00307 { dJointSetData (_id, data); }
00308 void *getData() const
00309 { return dJointGetData (_id); }
00310
00311 int getType() const
00312 { return dJointGetType (_id); }
00313
00314 dBodyID getBody (int index) const
00315 { return dJointGetBody (_id, index); }
00316
00317 void setFeedback(dJointFeedback *fb)
00318 { dJointSetFeedback(_id, fb); }
00319 dJointFeedback *getFeedback() const
00320 { return dJointGetFeedback(_id); }
00321
00322
00323 virtual void setParam (int, dReal) {};
00324 virtual dReal getParam (int) const { return 0; }
00325 };
00326
00327
00328 class dBallJoint : public dJoint {
00329 private:
00330
00331 dBallJoint (const dBallJoint &);
00332 void operator= (const dBallJoint &);
00333
00334 public:
00335 dBallJoint() { }
00336 dBallJoint (dWorldID world, dJointGroupID group=0)
00337 { _id = dJointCreateBall (world, group); }
00338
00339 void create (dWorldID world, dJointGroupID group=0) {
00340 if (_id) dJointDestroy (_id);
00341 _id = dJointCreateBall (world, group);
00342 }
00343
00344 void setAnchor (dReal x, dReal y, dReal z)
00345 { dJointSetBallAnchor (_id, x, y, z); }
00346 void getAnchor (dVector3 result) const
00347 { dJointGetBallAnchor (_id, result); }
00348 void getAnchor2 (dVector3 result) const
00349 { dJointGetBallAnchor2 (_id, result); }
00350 virtual void setParam (int parameter, dReal value)
00351 { dJointSetBallParam (_id, parameter, value); }
00352 virtual dReal getParam (int parameter) const
00353 { return dJointGetBallParam (_id, parameter); }
00354 } ;
00355
00356
00357 class dHingeJoint : public dJoint {
00358
00359 dHingeJoint (const dHingeJoint &);
00360 void operator = (const dHingeJoint &);
00361
00362 public:
00363 dHingeJoint() { }
00364 dHingeJoint (dWorldID world, dJointGroupID group=0)
00365 { _id = dJointCreateHinge (world, group); }
00366
00367 void create (dWorldID world, dJointGroupID group=0) {
00368 if (_id) dJointDestroy (_id);
00369 _id = dJointCreateHinge (world, group);
00370 }
00371
00372 void setAnchor (dReal x, dReal y, dReal z)
00373 { dJointSetHingeAnchor (_id, x, y, z); }
00374 void getAnchor (dVector3 result) const
00375 { dJointGetHingeAnchor (_id, result); }
00376 void getAnchor2 (dVector3 result) const
00377 { dJointGetHingeAnchor2 (_id, result); }
00378
00379 void setAxis (dReal x, dReal y, dReal z)
00380 { dJointSetHingeAxis (_id, x, y, z); }
00381 void getAxis (dVector3 result) const
00382 { dJointGetHingeAxis (_id, result); }
00383
00384 dReal getAngle() const
00385 { return dJointGetHingeAngle (_id); }
00386 dReal getAngleRate() const
00387 { return dJointGetHingeAngleRate (_id); }
00388
00389 virtual void setParam (int parameter, dReal value)
00390 { dJointSetHingeParam (_id, parameter, value); }
00391 virtual dReal getParam (int parameter) const
00392 { return dJointGetHingeParam (_id, parameter); }
00393
00394 void addTorque (dReal torque)
00395 { dJointAddHingeTorque(_id, torque); }
00396 };
00397
00398
00399 class dSliderJoint : public dJoint {
00400
00401 dSliderJoint (const dSliderJoint &);
00402 void operator = (const dSliderJoint &);
00403
00404 public:
00405 dSliderJoint() { }
00406 dSliderJoint (dWorldID world, dJointGroupID group=0)
00407 { _id = dJointCreateSlider (world, group); }
00408
00409 void create (dWorldID world, dJointGroupID group=0) {
00410 if (_id) dJointDestroy (_id);
00411 _id = dJointCreateSlider (world, group);
00412 }
00413
00414 void setAxis (dReal x, dReal y, dReal z)
00415 { dJointSetSliderAxis (_id, x, y, z); }
00416 void getAxis (dVector3 result) const
00417 { dJointGetSliderAxis (_id, result); }
00418
00419 dReal getPosition() const
00420 { return dJointGetSliderPosition (_id); }
00421 dReal getPositionRate() const
00422 { return dJointGetSliderPositionRate (_id); }
00423
00424 virtual void setParam (int parameter, dReal value)
00425 { dJointSetSliderParam (_id, parameter, value); }
00426 virtual dReal getParam (int parameter) const
00427 { return dJointGetSliderParam (_id, parameter); }
00428
00429 void addForce (dReal force)
00430 { dJointAddSliderForce(_id, force); }
00431 };
00432
00433
00434 class dUniversalJoint : public dJoint {
00435
00436 dUniversalJoint (const dUniversalJoint &);
00437 void operator = (const dUniversalJoint &);
00438
00439 public:
00440 dUniversalJoint() { }
00441 dUniversalJoint (dWorldID world, dJointGroupID group=0)
00442 { _id = dJointCreateUniversal (world, group); }
00443
00444 void create (dWorldID world, dJointGroupID group=0) {
00445 if (_id) dJointDestroy (_id);
00446 _id = dJointCreateUniversal (world, group);
00447 }
00448
00449 void setAnchor (dReal x, dReal y, dReal z)
00450 { dJointSetUniversalAnchor (_id, x, y, z); }
00451 void setAxis1 (dReal x, dReal y, dReal z)
00452 { dJointSetUniversalAxis1 (_id, x, y, z); }
00453 void setAxis2 (dReal x, dReal y, dReal z)
00454 { dJointSetUniversalAxis2 (_id, x, y, z); }
00455 virtual void setParam (int parameter, dReal value)
00456 { dJointSetUniversalParam (_id, parameter, value); }
00457
00458 void getAnchor (dVector3 result) const
00459 { dJointGetUniversalAnchor (_id, result); }
00460 void getAnchor2 (dVector3 result) const
00461 { dJointGetUniversalAnchor2 (_id, result); }
00462 void getAxis1 (dVector3 result) const
00463 { dJointGetUniversalAxis1 (_id, result); }
00464 void getAxis2 (dVector3 result) const
00465 { dJointGetUniversalAxis2 (_id, result); }
00466 virtual dReal getParam (int parameter) const
00467 { return dJointGetUniversalParam (_id, parameter); }
00468 void getAngles(dReal *angle1, dReal *angle2) const
00469 { dJointGetUniversalAngles (_id, angle1, angle2); }
00470
00471 dReal getAngle1() const
00472 { return dJointGetUniversalAngle1 (_id); }
00473 dReal getAngle1Rate() const
00474 { return dJointGetUniversalAngle1Rate (_id); }
00475 dReal getAngle2() const
00476 { return dJointGetUniversalAngle2 (_id); }
00477 dReal getAngle2Rate() const
00478 { return dJointGetUniversalAngle2Rate (_id); }
00479
00480 void addTorques (dReal torque1, dReal torque2)
00481 { dJointAddUniversalTorques(_id, torque1, torque2); }
00482 };
00483
00484
00485 class dHinge2Joint : public dJoint {
00486
00487 dHinge2Joint (const dHinge2Joint &);
00488 void operator = (const dHinge2Joint &);
00489
00490 public:
00491 dHinge2Joint() { }
00492 dHinge2Joint (dWorldID world, dJointGroupID group=0)
00493 { _id = dJointCreateHinge2 (world, group); }
00494
00495 void create (dWorldID world, dJointGroupID group=0) {
00496 if (_id) dJointDestroy (_id);
00497 _id = dJointCreateHinge2 (world, group);
00498 }
00499
00500 void setAnchor (dReal x, dReal y, dReal z)
00501 { dJointSetHinge2Anchor (_id, x, y, z); }
00502 void setAxis1 (dReal x, dReal y, dReal z)
00503 { dJointSetHinge2Axis1 (_id, x, y, z); }
00504 void setAxis2 (dReal x, dReal y, dReal z)
00505 { dJointSetHinge2Axis2 (_id, x, y, z); }
00506
00507 void getAnchor (dVector3 result) const
00508 { dJointGetHinge2Anchor (_id, result); }
00509 void getAnchor2 (dVector3 result) const
00510 { dJointGetHinge2Anchor2 (_id, result); }
00511 void getAxis1 (dVector3 result) const
00512 { dJointGetHinge2Axis1 (_id, result); }
00513 void getAxis2 (dVector3 result) const
00514 { dJointGetHinge2Axis2 (_id, result); }
00515
00516 dReal getAngle1() const
00517 { return dJointGetHinge2Angle1 (_id); }
00518 dReal getAngle1Rate() const
00519 { return dJointGetHinge2Angle1Rate (_id); }
00520 dReal getAngle2Rate() const
00521 { return dJointGetHinge2Angle2Rate (_id); }
00522
00523 virtual void setParam (int parameter, dReal value)
00524 { dJointSetHinge2Param (_id, parameter, value); }
00525 virtual dReal getParam (int parameter) const
00526 { return dJointGetHinge2Param (_id, parameter); }
00527
00528 void addTorques(dReal torque1, dReal torque2)
00529 { dJointAddHinge2Torques(_id, torque1, torque2); }
00530 };
00531
00532
00533 class dPRJoint : public dJoint {
00534 dPRJoint (const dPRJoint &);
00535 void operator = (const dPRJoint &);
00536
00537 public:
00538 dPRJoint() { }
00539 dPRJoint (dWorldID world, dJointGroupID group=0)
00540 { _id = dJointCreatePR (world, group); }
00541
00542 void create (dWorldID world, dJointGroupID group=0) {
00543 if (_id) dJointDestroy (_id);
00544 _id = dJointCreatePR (world, group);
00545 }
00546
00547 void setAnchor (dReal x, dReal y, dReal z)
00548 { dJointSetPRAnchor (_id, x, y, z); }
00549 void setAxis1 (dReal x, dReal y, dReal z)
00550 { dJointSetPRAxis1 (_id, x, y, z); }
00551 void setAxis2 (dReal x, dReal y, dReal z)
00552 { dJointSetPRAxis2 (_id, x, y, z); }
00553
00554 void getAnchor (dVector3 result) const
00555 { dJointGetPRAnchor (_id, result); }
00556 void getAxis1 (dVector3 result) const
00557 { dJointGetPRAxis1 (_id, result); }
00558 void getAxis2 (dVector3 result) const
00559 { dJointGetPRAxis2 (_id, result); }
00560
00561 dReal getPosition() const
00562 { return dJointGetPRPosition (_id); }
00563 dReal getPositionRate() const
00564 { return dJointGetPRPositionRate (_id); }
00565
00566 virtual void setParam (int parameter, dReal value)
00567 { dJointSetPRParam (_id, parameter, value); }
00568 virtual dReal getParam (int parameter) const
00569 { return dJointGetPRParam (_id, parameter); }
00570 };
00571
00572
00573
00574
00575
00576
00577
00578 class dPistonJoint : public dJoint
00579 {
00580
00581 dPistonJoint (const dPistonJoint &);
00582 void operator = (const dPistonJoint &);
00583
00584 public:
00585 dPistonJoint() { }
00586 dPistonJoint (dWorldID world, dJointGroupID group=0)
00587 { _id = dJointCreatePiston (world, group); }
00588
00589 void create (dWorldID world, dJointGroupID group=0)
00590 {
00591 if (_id) dJointDestroy (_id);
00592 _id = dJointCreatePiston (world, group);
00593 }
00594
00595 void setAnchor (dReal x, dReal y, dReal z)
00596 { dJointSetPistonAnchor (_id, x, y, z); }
00597 void getAnchor (dVector3 result) const
00598 { dJointGetPistonAnchor (_id, result); }
00599 void getAnchor2 (dVector3 result) const
00600 { dJointGetPistonAnchor2 (_id, result); }
00601
00602 void setAxis (dReal x, dReal y, dReal z)
00603 { dJointSetPistonAxis (_id, x, y, z); }
00604 void getAxis (dVector3 result) const
00605 { dJointGetPistonAxis (_id, result); }
00606
00607 dReal getPosition() const
00608 { return dJointGetPistonPosition (_id); }
00609 dReal getPositionRate() const
00610 { return dJointGetPistonPositionRate (_id); }
00611
00612 virtual void setParam (int parameter, dReal value)
00613 { dJointSetPistonParam (_id, parameter, value); }
00614 virtual dReal getParam (int parameter) const
00615 { return dJointGetPistonParam (_id, parameter); }
00616
00617 void addForce (dReal force)
00618 { dJointAddPistonForce (_id, force); }
00619 };
00620
00621
00622
00623 class dFixedJoint : public dJoint
00624 {
00625
00626 dFixedJoint (const dFixedJoint &);
00627 void operator = (const dFixedJoint &);
00628
00629 public:
00630 dFixedJoint() { }
00631 dFixedJoint (dWorldID world, dJointGroupID group=0)
00632 { _id = dJointCreateFixed (world, group); }
00633
00634 void create (dWorldID world, dJointGroupID group=0) {
00635 if (_id) dJointDestroy (_id);
00636 _id = dJointCreateFixed (world, group);
00637 }
00638
00639 void set()
00640 { dJointSetFixed (_id); }
00641
00642 virtual void setParam (int parameter, dReal value)
00643 { dJointSetFixedParam (_id, parameter, value); }
00644
00645 virtual dReal getParam (int parameter) const
00646 { return dJointGetFixedParam (_id, parameter); }
00647 };
00648
00649
00650 class dContactJoint : public dJoint {
00651
00652 dContactJoint (const dContactJoint &);
00653 void operator = (const dContactJoint &);
00654
00655 public:
00656 dContactJoint() { }
00657 dContactJoint (dWorldID world, dJointGroupID group, dContact *contact)
00658 { _id = dJointCreateContact (world, group, contact); }
00659
00660 void create (dWorldID world, dJointGroupID group, dContact *contact) {
00661 if (_id) dJointDestroy (_id);
00662 _id = dJointCreateContact (world, group, contact);
00663 }
00664 };
00665
00666
00667 class dNullJoint : public dJoint {
00668
00669 dNullJoint (const dNullJoint &);
00670 void operator = (const dNullJoint &);
00671
00672 public:
00673 dNullJoint() { }
00674 dNullJoint (dWorldID world, dJointGroupID group=0)
00675 { _id = dJointCreateNull (world, group); }
00676
00677 void create (dWorldID world, dJointGroupID group=0) {
00678 if (_id) dJointDestroy (_id);
00679 _id = dJointCreateNull (world, group);
00680 }
00681 };
00682
00683
00684 class dAMotorJoint : public dJoint {
00685
00686 dAMotorJoint (const dAMotorJoint &);
00687 void operator = (const dAMotorJoint &);
00688
00689 public:
00690 dAMotorJoint() { }
00691 dAMotorJoint (dWorldID world, dJointGroupID group=0)
00692 { _id = dJointCreateAMotor (world, group); }
00693
00694 void create (dWorldID world, dJointGroupID group=0) {
00695 if (_id) dJointDestroy (_id);
00696 _id = dJointCreateAMotor (world, group);
00697 }
00698
00699 void setMode (int mode)
00700 { dJointSetAMotorMode (_id, mode); }
00701 int getMode() const
00702 { return dJointGetAMotorMode (_id); }
00703
00704 void setNumAxes (int num)
00705 { dJointSetAMotorNumAxes (_id, num); }
00706 int getNumAxes() const
00707 { return dJointGetAMotorNumAxes (_id); }
00708
00709 void setAxis (int anum, int rel, dReal x, dReal y, dReal z)
00710 { dJointSetAMotorAxis (_id, anum, rel, x, y, z); }
00711 void getAxis (int anum, dVector3 result) const
00712 { dJointGetAMotorAxis (_id, anum, result); }
00713 int getAxisRel (int anum) const
00714 { return dJointGetAMotorAxisRel (_id, anum); }
00715
00716 void setAngle (int anum, dReal angle)
00717 { dJointSetAMotorAngle (_id, anum, angle); }
00718 dReal getAngle (int anum) const
00719 { return dJointGetAMotorAngle (_id, anum); }
00720 dReal getAngleRate (int anum)
00721 { return dJointGetAMotorAngleRate (_id,anum); }
00722
00723 void setParam (int parameter, dReal value)
00724 { dJointSetAMotorParam (_id, parameter, value); }
00725 dReal getParam (int parameter) const
00726 { return dJointGetAMotorParam (_id, parameter); }
00727
00728 void addTorques(dReal torque1, dReal torque2, dReal torque3)
00729 { dJointAddAMotorTorques(_id, torque1, torque2, torque3); }
00730 };
00731
00732
00733 class dLMotorJoint : public dJoint {
00734
00735 dLMotorJoint (const dLMotorJoint &);
00736 void operator = (const dLMotorJoint &);
00737
00738 public:
00739 dLMotorJoint() { }
00740 dLMotorJoint (dWorldID world, dJointGroupID group=0)
00741 { _id = dJointCreateLMotor (world, group); }
00742
00743 void create (dWorldID world, dJointGroupID group=0) {
00744 if (_id) dJointDestroy (_id);
00745 _id = dJointCreateLMotor (world, group);
00746 }
00747
00748 void setNumAxes (int num)
00749 { dJointSetLMotorNumAxes (_id, num); }
00750 int getNumAxes() const
00751 { return dJointGetLMotorNumAxes (_id); }
00752
00753 void setAxis (int anum, int rel, dReal x, dReal y, dReal z)
00754 { dJointSetLMotorAxis (_id, anum, rel, x, y, z); }
00755 void getAxis (int anum, dVector3 result) const
00756 { dJointGetLMotorAxis (_id, anum, result); }
00757
00758 void setParam (int parameter, dReal value)
00759 { dJointSetLMotorParam (_id, parameter, value); }
00760 dReal getParam (int parameter) const
00761 { return dJointGetLMotorParam (_id, parameter); }
00762 };
00763
00764
00765
00766 #endif
00767 #endif