- Main Page
- Modules
- Data Structures
- Files

# odecpp.h

    00001 /*************************************************************************
    00002  *                          *
    00003  * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith.    *
    00004  * All rights reserved.  Email: russ@q12.org   Web: www.q12.org    *
    00005  *                          *
    00006  * This library is free software; you can redistribute it and/or   *
    00007  * modify it under the terms of EITHER:             *
    00008  *   (1) The GNU Lesser General Public License as published by the Free  *
    00009  *  Software Foundation; either version 2.1 of the License, or (at  *
    00010  *  your option) any later version. The text of the GNU Lesser  *
    00011  *  General Public License is included with this library in the    *
    00012  *  file LICENSE.TXT.                   *
    00013  *   (2) The BSD-style license that is included with this library in  *
    00014  *  the file LICENSE-BSD.TXT.              *
    00015  *                          *
    00016  * This library is distributed in the hope that it will be useful,    *
    00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of  *
    00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files    *
    00019  * LICENSE.TXT and LICENSE-BSD.TXT for more details.         *
    00020  *                          *
    00021  *************************************************************************/
    00022
    00023 /* C++ interface for non-collision stuff */
    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   // intentionally undefined, don't use these
    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   // intentionally undefined, don't use these
    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   // intentionally undefined, don't use these
    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   // intentionally undefined, don't use these
    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
    00324 class dBallJoint : public dJoint {
    00325 private:
    00326   // intentionally undefined, don't use these
    00327   dBallJoint (const dBallJoint &);
    00328   void operator= (const dBallJoint &);
    00329
    00330 public:
    00331   dBallJoint() { }
    00332   dBallJoint (dWorldID world, dJointGroupID group=0)
    00333     { _id = dJointCreateBall (world, group); }
    00334
    00335   void create (dWorldID world, dJointGroupID group=0) {
    00336     if (_id) dJointDestroy (_id);
    00337     _id = dJointCreateBall (world, group);
    00338   }
    00339
    00340   void setAnchor (dReal x, dReal y, dReal z)
    00341     { dJointSetBallAnchor (_id, x, y, z); }
    00342   void getAnchor (dVector3 result) const
    00343     { dJointGetBallAnchor (_id, result); }
    00344   void getAnchor2 (dVector3 result) const
    00345     { dJointGetBallAnchor2 (_id, result); }
    00346 } ;
    00347
    00348
    00349 class dHingeJoint : public dJoint {
    00350   // intentionally undefined, don't use these
    00351   dHingeJoint (const dHingeJoint &);
    00352   void operator = (const dHingeJoint &);
    00353
    00354 public:
    00355   dHingeJoint() { }
    00356   dHingeJoint (dWorldID world, dJointGroupID group=0)
    00357     { _id = dJointCreateHinge (world, group); }
    00358
    00359   void create (dWorldID world, dJointGroupID group=0) {
    00360     if (_id) dJointDestroy (_id);
    00361     _id = dJointCreateHinge (world, group);
    00362   }
    00363
    00364   void setAnchor (dReal x, dReal y, dReal z)
    00365     { dJointSetHingeAnchor (_id, x, y, z); }
    00366   void getAnchor (dVector3 result) const
    00367     { dJointGetHingeAnchor (_id, result); }
    00368   void getAnchor2 (dVector3 result) const
    00369     { dJointGetHingeAnchor2 (_id, result); }
    00370
    00371   void setAxis (dReal x, dReal y, dReal z)
    00372     { dJointSetHingeAxis (_id, x, y, z); }
    00373   void getAxis (dVector3 result) const
    00374     { dJointGetHingeAxis (_id, result); }
    00375
    00376   dReal getAngle() const
    00377     { return dJointGetHingeAngle (_id); }
    00378   dReal getAngleRate() const
    00379     { return dJointGetHingeAngleRate (_id); }
    00380
    00381   void setParam (int parameter, dReal value)
    00382     { dJointSetHingeParam (_id, parameter, value); }
    00383   dReal getParam (int parameter) const
    00384     { return dJointGetHingeParam (_id, parameter); }
    00385
    00386   void addTorque (dReal torque)
    00387    { dJointAddHingeTorque(_id, torque); }
    00388 };
    00389
    00390
    00391 class dSliderJoint : public dJoint {
    00392   // intentionally undefined, don't use these
    00393   dSliderJoint (const dSliderJoint &);
    00394   void operator = (const dSliderJoint &);
    00395
    00396 public:
    00397   dSliderJoint() { }
    00398   dSliderJoint (dWorldID world, dJointGroupID group=0)
    00399     { _id = dJointCreateSlider (world, group); }
    00400
    00401   void create (dWorldID world, dJointGroupID group=0) {
    00402     if (_id) dJointDestroy (_id);
    00403     _id = dJointCreateSlider (world, group);
    00404   }
    00405
    00406   void setAxis (dReal x, dReal y, dReal z)
    00407     { dJointSetSliderAxis (_id, x, y, z); }
    00408   void getAxis (dVector3 result) const
    00409     { dJointGetSliderAxis (_id, result); }
    00410
    00411   dReal getPosition() const
    00412     { return dJointGetSliderPosition (_id); }
    00413   dReal getPositionRate() const
    00414     { return dJointGetSliderPositionRate (_id); }
    00415
    00416   void setParam (int parameter, dReal value)
    00417     { dJointSetSliderParam (_id, parameter, value); }
    00418   dReal getParam (int parameter) const
    00419     { return dJointGetSliderParam (_id, parameter); }
    00420
    00421   void addForce (dReal force)
    00422    { dJointAddSliderForce(_id, force); }
    00423 };
    00424
    00425
    00426 class dUniversalJoint : public dJoint {
    00427   // intentionally undefined, don't use these
    00428   dUniversalJoint (const dUniversalJoint &);
    00429   void operator = (const dUniversalJoint &);
    00430
    00431 public:
    00432   dUniversalJoint() { }
    00433   dUniversalJoint (dWorldID world, dJointGroupID group=0)
    00434     { _id = dJointCreateUniversal (world, group); }
    00435
    00436   void create (dWorldID world, dJointGroupID group=0) {
    00437     if (_id) dJointDestroy (_id);
    00438     _id = dJointCreateUniversal (world, group);
    00439   }
    00440
    00441   void setAnchor (dReal x, dReal y, dReal z)
    00442     { dJointSetUniversalAnchor (_id, x, y, z); }
    00443   void setAxis1 (dReal x, dReal y, dReal z)
    00444     { dJointSetUniversalAxis1 (_id, x, y, z); }
    00445   void setAxis2 (dReal x, dReal y, dReal z)
    00446     { dJointSetUniversalAxis2 (_id, x, y, z); }
    00447   void setParam (int parameter, dReal value)
    00448     { dJointSetUniversalParam (_id, parameter, value); }
    00449
    00450   void getAnchor (dVector3 result) const
    00451     { dJointGetUniversalAnchor (_id, result); }
    00452   void getAnchor2 (dVector3 result) const
    00453     { dJointGetUniversalAnchor2 (_id, result); }
    00454   void getAxis1 (dVector3 result) const
    00455     { dJointGetUniversalAxis1 (_id, result); }
    00456   void getAxis2 (dVector3 result) const
    00457     { dJointGetUniversalAxis2 (_id, result); }
    00458   dReal getParam (int parameter) const
    00459     { return dJointGetUniversalParam (_id, parameter); }
    00460   dReal getAngle1() const
    00461     { return dJointGetUniversalAngle1 (_id); }
    00462   dReal getAngle1Rate() const
    00463     { return dJointGetUniversalAngle1Rate (_id); }
    00464   dReal getAngle2() const
    00465     { return dJointGetUniversalAngle2 (_id); }
    00466   dReal getAngle2Rate() const
    00467     { return dJointGetUniversalAngle2Rate (_id); }
    00468
    00469   void addTorques (dReal torque1, dReal torque2)
    00470    { dJointAddUniversalTorques(_id, torque1, torque2); }
    00471 };
    00472
    00473
    00474 class dHinge2Joint : public dJoint {
    00475   // intentionally undefined, don't use these
    00476   dHinge2Joint (const dHinge2Joint &);
    00477   void operator = (const dHinge2Joint &);
    00478
    00479 public:
    00480   dHinge2Joint() { }
    00481   dHinge2Joint (dWorldID world, dJointGroupID group=0)
    00482     { _id = dJointCreateHinge2 (world, group); }
    00483
    00484   void create (dWorldID world, dJointGroupID group=0) {
    00485     if (_id) dJointDestroy (_id);
    00486     _id = dJointCreateHinge2 (world, group);
    00487   }
    00488
    00489   void setAnchor (dReal x, dReal y, dReal z)
    00490     { dJointSetHinge2Anchor (_id, x, y, z); }
    00491   void setAxis1 (dReal x, dReal y, dReal z)
    00492     { dJointSetHinge2Axis1 (_id, x, y, z); }
    00493   void setAxis2 (dReal x, dReal y, dReal z)
    00494     { dJointSetHinge2Axis2 (_id, x, y, z); }
    00495
    00496   void getAnchor (dVector3 result) const
    00497     { dJointGetHinge2Anchor (_id, result); }
    00498   void getAnchor2 (dVector3 result) const
    00499     { dJointGetHinge2Anchor2 (_id, result); }
    00500   void getAxis1 (dVector3 result) const
    00501     { dJointGetHinge2Axis1 (_id, result); }
    00502   void getAxis2 (dVector3 result) const
    00503     { dJointGetHinge2Axis2 (_id, result); }
    00504
    00505   dReal getAngle1() const
    00506     { return dJointGetHinge2Angle1 (_id); }
    00507   dReal getAngle1Rate() const
    00508     { return dJointGetHinge2Angle1Rate (_id); }
    00509   dReal getAngle2Rate() const
    00510     { return dJointGetHinge2Angle2Rate (_id); }
    00511
    00512   void setParam (int parameter, dReal value)
    00513     { dJointSetHinge2Param (_id, parameter, value); }
    00514   dReal getParam (int parameter) const
    00515     { return dJointGetHinge2Param (_id, parameter); }
    00516
    00517   void addTorques(dReal torque1, dReal torque2)
    00518    { dJointAddHinge2Torques(_id, torque1, torque2); }
    00519 };
    00520
    00521
    00522 class dFixedJoint : public dJoint {
    00523   // intentionally undefined, don't use these
    00524   dFixedJoint (const dFixedJoint &);
    00525   void operator = (const dFixedJoint &);
    00526
    00527 public:
    00528   dFixedJoint() { }
    00529   dFixedJoint (dWorldID world, dJointGroupID group=0)
    00530     { _id = dJointCreateFixed (world, group); }
    00531
    00532   void create (dWorldID world, dJointGroupID group=0) {
    00533     if (_id) dJointDestroy (_id);
    00534     _id = dJointCreateFixed (world, group);
    00535   }
    00536
    00537   void set()
    00538     { dJointSetFixed (_id); }
    00539 };
    00540
    00541
    00542 class dContactJoint : public dJoint {
    00543   // intentionally undefined, don't use these
    00544   dContactJoint (const dContactJoint &);
    00545   void operator = (const dContactJoint &);
    00546
    00547 public:
    00548   dContactJoint() { }
    00549   dContactJoint (dWorldID world, dJointGroupID group, dContact *contact)
    00550     { _id = dJointCreateContact (world, group, contact); }
    00551
    00552   void create (dWorldID world, dJointGroupID group, dContact *contact) {
    00553     if (_id) dJointDestroy (_id);
    00554     _id = dJointCreateContact (world, group, contact);
    00555   }
    00556 };
    00557
    00558
    00559 class dNullJoint : public dJoint {
    00560   // intentionally undefined, don't use these
    00561   dNullJoint (const dNullJoint &);
    00562   void operator = (const dNullJoint &);
    00563
    00564 public:
    00565   dNullJoint() { }
    00566   dNullJoint (dWorldID world, dJointGroupID group=0)
    00567     { _id = dJointCreateNull (world, group); }
    00568
    00569   void create (dWorldID world, dJointGroupID group=0) {
    00570     if (_id) dJointDestroy (_id);
    00571     _id = dJointCreateNull (world, group);
    00572   }
    00573 };
    00574
    00575
    00576 class dAMotorJoint : public dJoint {
    00577   // intentionally undefined, don't use these
    00578   dAMotorJoint (const dAMotorJoint &);
    00579   void operator = (const dAMotorJoint &);
    00580
    00581 public:
    00582   dAMotorJoint() { }
    00583   dAMotorJoint (dWorldID world, dJointGroupID group=0)
    00584     { _id = dJointCreateAMotor (world, group); }
    00585
    00586   void create (dWorldID world, dJointGroupID group=0) {
    00587     if (_id) dJointDestroy (_id);
    00588     _id = dJointCreateAMotor (world, group);
    00589   }
    00590
    00591   void setMode (int mode)
    00592     { dJointSetAMotorMode (_id, mode); }
    00593   int getMode() const
    00594     { return dJointGetAMotorMode (_id); }
    00595
    00596   void setNumAxes (int num)
    00597     { dJointSetAMotorNumAxes (_id, num); }
    00598   int getNumAxes() const
    00599     { return dJointGetAMotorNumAxes (_id); }
    00600
    00601   void setAxis (int anum, int rel, dReal x, dReal y, dReal z)
    00602     { dJointSetAMotorAxis (_id, anum, rel, x, y, z); }
    00603   void getAxis (int anum, dVector3 result) const
    00604     { dJointGetAMotorAxis (_id, anum, result); }
    00605   int getAxisRel (int anum) const
    00606     { return dJointGetAMotorAxisRel (_id, anum); }
    00607
    00608   void setAngle (int anum, dReal angle)
    00609     { dJointSetAMotorAngle (_id, anum, angle); }
    00610   dReal getAngle (int anum) const
    00611     { return dJointGetAMotorAngle (_id, anum); }
    00612   dReal getAngleRate (int anum)
    00613     { return dJointGetAMotorAngleRate (_id,anum); }
    00614
    00615   void setParam (int parameter, dReal value)
    00616     { dJointSetAMotorParam (_id, parameter, value); }
    00617   dReal getParam (int parameter) const
    00618     { return dJointGetAMotorParam (_id, parameter); }
    00619
    00620   void addTorques(dReal torque1, dReal torque2, dReal torque3)
    00621    { dJointAddAMotorTorques(_id, torque1, torque2, torque3); }
    00622 };
    00623
    00624
    00625 class dLMotorJoint : public dJoint {
    00626   // intentionally undefined, don't use these
    00627   dLMotorJoint (const dLMotorJoint &);
    00628   void operator = (const dLMotorJoint &);
    00629
    00630 public:
    00631   dLMotorJoint() { }
    00632   dLMotorJoint (dWorldID world, dJointGroupID group=0)
    00633     { _id = dJointCreateLMotor (world, group); }
    00634
    00635   void create (dWorldID world, dJointGroupID group=0) {
    00636     if (_id) dJointDestroy (_id);
    00637     _id = dJointCreateLMotor (world, group);
    00638   }
    00639
    00640   void setNumAxes (int num)
    00641     { dJointSetLMotorNumAxes (_id, num); }
    00642   int getNumAxes() const
    00643     { return dJointGetLMotorNumAxes (_id); }
    00644
    00645   void setAxis (int anum, int rel, dReal x, dReal y, dReal z)
    00646     { dJointSetLMotorAxis (_id, anum, rel, x, y, z); }
    00647   void getAxis (int anum, dVector3 result) const
    00648     { dJointGetLMotorAxis (_id, anum, result); }
    00649
    00650   void setParam (int parameter, dReal value)
    00651     { dJointSetLMotorParam (_id, parameter, value); }
    00652   dReal getParam (int parameter) const
    00653     { return dJointGetLMotorParam (_id, parameter); }
    00654 };
    00655
    00656
    00657
    00658 #endif
    00659 #endif