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  void getAngles(dReal *angle1, dReal *angle2) const
00461     { dJointGetUniversalAngles (_id, angle1, angle2); }
00462 
00463   dReal getAngle1() const
00464     { return dJointGetUniversalAngle1 (_id); }
00465   dReal getAngle1Rate() const
00466     { return dJointGetUniversalAngle1Rate (_id); }
00467   dReal getAngle2() const
00468     { return dJointGetUniversalAngle2 (_id); }
00469   dReal getAngle2Rate() const
00470     { return dJointGetUniversalAngle2Rate (_id); }
00471 
00472   void addTorques (dReal torque1, dReal torque2)
00473    { dJointAddUniversalTorques(_id, torque1, torque2); }
00474 };
00475 
00476 
00477 class dHinge2Joint : public dJoint {
00478   // intentionally undefined, don't use these
00479   dHinge2Joint (const dHinge2Joint &);
00480   void operator = (const dHinge2Joint &);
00481 
00482 public:
00483   dHinge2Joint() { }
00484   dHinge2Joint (dWorldID world, dJointGroupID group=0)
00485     { _id = dJointCreateHinge2 (world, group); }
00486 
00487   void create (dWorldID world, dJointGroupID group=0) {
00488     if (_id) dJointDestroy (_id);
00489     _id = dJointCreateHinge2 (world, group);
00490   }
00491 
00492   void setAnchor (dReal x, dReal y, dReal z)
00493     { dJointSetHinge2Anchor (_id, x, y, z); }
00494   void setAxis1 (dReal x, dReal y, dReal z)
00495     { dJointSetHinge2Axis1 (_id, x, y, z); }
00496   void setAxis2 (dReal x, dReal y, dReal z)
00497     { dJointSetHinge2Axis2 (_id, x, y, z); }
00498 
00499   void getAnchor (dVector3 result) const
00500     { dJointGetHinge2Anchor (_id, result); }
00501   void getAnchor2 (dVector3 result) const
00502     { dJointGetHinge2Anchor2 (_id, result); }
00503   void getAxis1 (dVector3 result) const
00504     { dJointGetHinge2Axis1 (_id, result); }
00505   void getAxis2 (dVector3 result) const
00506     { dJointGetHinge2Axis2 (_id, result); }
00507 
00508   dReal getAngle1() const
00509     { return dJointGetHinge2Angle1 (_id); }
00510   dReal getAngle1Rate() const
00511     { return dJointGetHinge2Angle1Rate (_id); }
00512   dReal getAngle2Rate() const
00513     { return dJointGetHinge2Angle2Rate (_id); }
00514 
00515   void setParam (int parameter, dReal value)
00516     { dJointSetHinge2Param (_id, parameter, value); }
00517   dReal getParam (int parameter) const
00518     { return dJointGetHinge2Param (_id, parameter); }
00519 
00520   void addTorques(dReal torque1, dReal torque2)
00521    { dJointAddHinge2Torques(_id, torque1, torque2); }
00522 };
00523 
00524 
00525 class dPRJoint : public dJoint {
00526   dPRJoint (const dPRJoint &);
00527   void operator = (const dPRJoint &);
00528 
00529 public:
00530   dPRJoint() { }
00531   dPRJoint (dWorldID world, dJointGroupID group=0)
00532     { _id = dJointCreatePR (world, group); }
00533 
00534   void create (dWorldID world, dJointGroupID group=0) {
00535     if (_id) dJointDestroy (_id);
00536     _id = dJointCreatePR (world, group);
00537   }
00538 
00539   void setAnchor (dReal x, dReal y, dReal z)
00540     { dJointSetPRAnchor (_id, x, y, z); }
00541   void setAxis1 (dReal x, dReal y, dReal z)
00542     { dJointSetPRAxis1 (_id, x, y, z); }
00543   void setAxis2 (dReal x, dReal y, dReal z)
00544     { dJointSetPRAxis2 (_id, x, y, z); }
00545 
00546   void getAnchor (dVector3 result) const
00547     { dJointGetPRAnchor (_id, result); }
00548   void getAxis1 (dVector3 result) const
00549     { dJointGetPRAxis1 (_id, result); }
00550   void getAxis2 (dVector3 result) const
00551     { dJointGetPRAxis2 (_id, result); }
00552 
00553   dReal getPosition() const
00554     { return dJointGetPRPosition (_id); }
00555   dReal getPositionRate() const
00556     { return dJointGetPRPositionRate (_id); }
00557 
00558   void setParam (int parameter, dReal value)
00559     { dJointSetPRParam (_id, parameter, value); }
00560   dReal getParam (int parameter) const
00561     { return dJointGetPRParam (_id, parameter); }
00562 };
00563 
00564 
00565 class dFixedJoint : public dJoint {
00566   // intentionally undefined, don't use these
00567   dFixedJoint (const dFixedJoint &);
00568   void operator = (const dFixedJoint &);
00569 
00570 public:
00571   dFixedJoint() { }
00572   dFixedJoint (dWorldID world, dJointGroupID group=0)
00573     { _id = dJointCreateFixed (world, group); }
00574 
00575   void create (dWorldID world, dJointGroupID group=0) {
00576     if (_id) dJointDestroy (_id);
00577     _id = dJointCreateFixed (world, group);
00578   }
00579 
00580   void set()
00581     { dJointSetFixed (_id); }
00582 };
00583 
00584 
00585 class dContactJoint : public dJoint {
00586   // intentionally undefined, don't use these
00587   dContactJoint (const dContactJoint &);
00588   void operator = (const dContactJoint &);
00589 
00590 public:
00591   dContactJoint() { }
00592   dContactJoint (dWorldID world, dJointGroupID group, dContact *contact)
00593     { _id = dJointCreateContact (world, group, contact); }
00594 
00595   void create (dWorldID world, dJointGroupID group, dContact *contact) {
00596     if (_id) dJointDestroy (_id);
00597     _id = dJointCreateContact (world, group, contact);
00598   }
00599 };
00600 
00601 
00602 class dNullJoint : public dJoint {
00603   // intentionally undefined, don't use these
00604   dNullJoint (const dNullJoint &);
00605   void operator = (const dNullJoint &);
00606 
00607 public:
00608   dNullJoint() { }
00609   dNullJoint (dWorldID world, dJointGroupID group=0)
00610     { _id = dJointCreateNull (world, group); }
00611 
00612   void create (dWorldID world, dJointGroupID group=0) {
00613     if (_id) dJointDestroy (_id);
00614     _id = dJointCreateNull (world, group);
00615   }
00616 };
00617 
00618 
00619 class dAMotorJoint : public dJoint {
00620   // intentionally undefined, don't use these
00621   dAMotorJoint (const dAMotorJoint &);
00622   void operator = (const dAMotorJoint &);
00623 
00624 public:
00625   dAMotorJoint() { }
00626   dAMotorJoint (dWorldID world, dJointGroupID group=0)
00627     { _id = dJointCreateAMotor (world, group); }
00628 
00629   void create (dWorldID world, dJointGroupID group=0) {
00630     if (_id) dJointDestroy (_id);
00631     _id = dJointCreateAMotor (world, group);
00632   }
00633 
00634   void setMode (int mode)
00635     { dJointSetAMotorMode (_id, mode); }
00636   int getMode() const
00637     { return dJointGetAMotorMode (_id); }
00638 
00639   void setNumAxes (int num)
00640     { dJointSetAMotorNumAxes (_id, num); }
00641   int getNumAxes() const
00642     { return dJointGetAMotorNumAxes (_id); }
00643 
00644   void setAxis (int anum, int rel, dReal x, dReal y, dReal z)
00645     { dJointSetAMotorAxis (_id, anum, rel, x, y, z); }
00646   void getAxis (int anum, dVector3 result) const
00647     { dJointGetAMotorAxis (_id, anum, result); }
00648   int getAxisRel (int anum) const
00649     { return dJointGetAMotorAxisRel (_id, anum); }
00650 
00651   void setAngle (int anum, dReal angle)
00652     { dJointSetAMotorAngle (_id, anum, angle); }
00653   dReal getAngle (int anum) const
00654     { return dJointGetAMotorAngle (_id, anum); }
00655   dReal getAngleRate (int anum)
00656     { return dJointGetAMotorAngleRate (_id,anum); }
00657 
00658   void setParam (int parameter, dReal value)
00659     { dJointSetAMotorParam (_id, parameter, value); }
00660   dReal getParam (int parameter) const
00661     { return dJointGetAMotorParam (_id, parameter); }
00662 
00663   void addTorques(dReal torque1, dReal torque2, dReal torque3)
00664    { dJointAddAMotorTorques(_id, torque1, torque2, torque3); }
00665 };
00666 
00667 
00668 class dLMotorJoint : public dJoint {
00669   // intentionally undefined, don't use these
00670   dLMotorJoint (const dLMotorJoint &);
00671   void operator = (const dLMotorJoint &);
00672 
00673 public:
00674   dLMotorJoint() { }
00675   dLMotorJoint (dWorldID world, dJointGroupID group=0)
00676     { _id = dJointCreateLMotor (world, group); }
00677 
00678   void create (dWorldID world, dJointGroupID group=0) {
00679     if (_id) dJointDestroy (_id);
00680     _id = dJointCreateLMotor (world, group);
00681   }
00682 
00683   void setNumAxes (int num)
00684     { dJointSetLMotorNumAxes (_id, num); }
00685   int getNumAxes() const
00686     { return dJointGetLMotorNumAxes (_id); }
00687 
00688   void setAxis (int anum, int rel, dReal x, dReal y, dReal z)
00689     { dJointSetLMotorAxis (_id, anum, rel, x, y, z); }
00690   void getAxis (int anum, dVector3 result) const
00691     { dJointGetLMotorAxis (_id, anum, result); }
00692 
00693   void setParam (int parameter, dReal value)
00694     { dJointSetLMotorParam (_id, parameter, value); }
00695   dReal getParam (int parameter) const
00696     { return dJointGetLMotorParam (_id, parameter); }
00697 };
00698 
00699 
00700 
00701 #endif
00702 #endif

Generated on Sun Feb 11 10:40:27 2007 for Open Dynamics Engine by  doxygen 1.5.1