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   void setParam (int parameter, dReal value)
00347     { dJointSetBallParam (_id, parameter, value); }
00348   dReal getParam (int parameter) const
00349     { return dJointGetBallParam (_id, parameter); }
00350 } ;
00351 
00352 
00353 class dHingeJoint : public dJoint {
00354   // intentionally undefined, don't use these
00355   dHingeJoint (const dHingeJoint &);
00356   void operator = (const dHingeJoint &);
00357 
00358 public:
00359   dHingeJoint() { }
00360   dHingeJoint (dWorldID world, dJointGroupID group=0)
00361     { _id = dJointCreateHinge (world, group); }
00362 
00363   void create (dWorldID world, dJointGroupID group=0) {
00364     if (_id) dJointDestroy (_id);
00365     _id = dJointCreateHinge (world, group);
00366   }
00367 
00368   void setAnchor (dReal x, dReal y, dReal z)
00369     { dJointSetHingeAnchor (_id, x, y, z); }
00370   void getAnchor (dVector3 result) const
00371     { dJointGetHingeAnchor (_id, result); }
00372   void getAnchor2 (dVector3 result) const
00373     { dJointGetHingeAnchor2 (_id, result); }
00374 
00375   void setAxis (dReal x, dReal y, dReal z)
00376     { dJointSetHingeAxis (_id, x, y, z); }
00377   void getAxis (dVector3 result) const
00378     { dJointGetHingeAxis (_id, result); }
00379 
00380   dReal getAngle() const
00381     { return dJointGetHingeAngle (_id); }
00382   dReal getAngleRate() const
00383     { return dJointGetHingeAngleRate (_id); }
00384 
00385   void setParam (int parameter, dReal value)
00386     { dJointSetHingeParam (_id, parameter, value); }
00387   dReal getParam (int parameter) const
00388     { return dJointGetHingeParam (_id, parameter); }
00389 
00390   void addTorque (dReal torque)
00391    { dJointAddHingeTorque(_id, torque); }
00392 };
00393 
00394 
00395 class dSliderJoint : public dJoint {
00396   // intentionally undefined, don't use these
00397   dSliderJoint (const dSliderJoint &);
00398   void operator = (const dSliderJoint &);
00399 
00400 public:
00401   dSliderJoint() { }
00402   dSliderJoint (dWorldID world, dJointGroupID group=0)
00403     { _id = dJointCreateSlider (world, group); }
00404 
00405   void create (dWorldID world, dJointGroupID group=0) {
00406     if (_id) dJointDestroy (_id);
00407     _id = dJointCreateSlider (world, group);
00408   }
00409 
00410   void setAxis (dReal x, dReal y, dReal z)
00411     { dJointSetSliderAxis (_id, x, y, z); }
00412   void getAxis (dVector3 result) const
00413     { dJointGetSliderAxis (_id, result); }
00414 
00415   dReal getPosition() const
00416     { return dJointGetSliderPosition (_id); }
00417   dReal getPositionRate() const
00418     { return dJointGetSliderPositionRate (_id); }
00419 
00420   void setParam (int parameter, dReal value)
00421     { dJointSetSliderParam (_id, parameter, value); }
00422   dReal getParam (int parameter) const
00423     { return dJointGetSliderParam (_id, parameter); }
00424 
00425   void addForce (dReal force)
00426    { dJointAddSliderForce(_id, force); }
00427 };
00428 
00429 
00430 class dUniversalJoint : public dJoint {
00431   // intentionally undefined, don't use these
00432   dUniversalJoint (const dUniversalJoint &);
00433   void operator = (const dUniversalJoint &);
00434 
00435 public:
00436   dUniversalJoint() { }
00437   dUniversalJoint (dWorldID world, dJointGroupID group=0)
00438     { _id = dJointCreateUniversal (world, group); }
00439 
00440   void create (dWorldID world, dJointGroupID group=0) {
00441     if (_id) dJointDestroy (_id);
00442     _id = dJointCreateUniversal (world, group);
00443   }
00444 
00445   void setAnchor (dReal x, dReal y, dReal z)
00446     { dJointSetUniversalAnchor (_id, x, y, z); }
00447   void setAxis1 (dReal x, dReal y, dReal z)
00448     { dJointSetUniversalAxis1 (_id, x, y, z); }
00449   void setAxis2 (dReal x, dReal y, dReal z)
00450     { dJointSetUniversalAxis2 (_id, x, y, z); }
00451   void setParam (int parameter, dReal value)
00452     { dJointSetUniversalParam (_id, parameter, value); }
00453 
00454   void getAnchor (dVector3 result) const
00455     { dJointGetUniversalAnchor (_id, result); }
00456   void getAnchor2 (dVector3 result) const
00457     { dJointGetUniversalAnchor2 (_id, result); }
00458   void getAxis1 (dVector3 result) const
00459     { dJointGetUniversalAxis1 (_id, result); }
00460   void getAxis2 (dVector3 result) const
00461     { dJointGetUniversalAxis2 (_id, result); }
00462   dReal getParam (int parameter) const
00463     { return dJointGetUniversalParam (_id, parameter); }
00464  void getAngles(dReal *angle1, dReal *angle2) const
00465     { dJointGetUniversalAngles (_id, angle1, angle2); }
00466 
00467   dReal getAngle1() const
00468     { return dJointGetUniversalAngle1 (_id); }
00469   dReal getAngle1Rate() const
00470     { return dJointGetUniversalAngle1Rate (_id); }
00471   dReal getAngle2() const
00472     { return dJointGetUniversalAngle2 (_id); }
00473   dReal getAngle2Rate() const
00474     { return dJointGetUniversalAngle2Rate (_id); }
00475 
00476   void addTorques (dReal torque1, dReal torque2)
00477    { dJointAddUniversalTorques(_id, torque1, torque2); }
00478 };
00479 
00480 
00481 class dHinge2Joint : public dJoint {
00482   // intentionally undefined, don't use these
00483   dHinge2Joint (const dHinge2Joint &);
00484   void operator = (const dHinge2Joint &);
00485 
00486 public:
00487   dHinge2Joint() { }
00488   dHinge2Joint (dWorldID world, dJointGroupID group=0)
00489     { _id = dJointCreateHinge2 (world, group); }
00490 
00491   void create (dWorldID world, dJointGroupID group=0) {
00492     if (_id) dJointDestroy (_id);
00493     _id = dJointCreateHinge2 (world, group);
00494   }
00495 
00496   void setAnchor (dReal x, dReal y, dReal z)
00497     { dJointSetHinge2Anchor (_id, x, y, z); }
00498   void setAxis1 (dReal x, dReal y, dReal z)
00499     { dJointSetHinge2Axis1 (_id, x, y, z); }
00500   void setAxis2 (dReal x, dReal y, dReal z)
00501     { dJointSetHinge2Axis2 (_id, x, y, z); }
00502 
00503   void getAnchor (dVector3 result) const
00504     { dJointGetHinge2Anchor (_id, result); }
00505   void getAnchor2 (dVector3 result) const
00506     { dJointGetHinge2Anchor2 (_id, result); }
00507   void getAxis1 (dVector3 result) const
00508     { dJointGetHinge2Axis1 (_id, result); }
00509   void getAxis2 (dVector3 result) const
00510     { dJointGetHinge2Axis2 (_id, result); }
00511 
00512   dReal getAngle1() const
00513     { return dJointGetHinge2Angle1 (_id); }
00514   dReal getAngle1Rate() const
00515     { return dJointGetHinge2Angle1Rate (_id); }
00516   dReal getAngle2Rate() const
00517     { return dJointGetHinge2Angle2Rate (_id); }
00518 
00519   void setParam (int parameter, dReal value)
00520     { dJointSetHinge2Param (_id, parameter, value); }
00521   dReal getParam (int parameter) const
00522     { return dJointGetHinge2Param (_id, parameter); }
00523 
00524   void addTorques(dReal torque1, dReal torque2)
00525    { dJointAddHinge2Torques(_id, torque1, torque2); }
00526 };
00527 
00528 
00529 class dPRJoint : public dJoint {
00530   dPRJoint (const dPRJoint &);
00531   void operator = (const dPRJoint &);
00532 
00533 public:
00534   dPRJoint() { }
00535   dPRJoint (dWorldID world, dJointGroupID group=0)
00536     { _id = dJointCreatePR (world, group); }
00537 
00538   void create (dWorldID world, dJointGroupID group=0) {
00539     if (_id) dJointDestroy (_id);
00540     _id = dJointCreatePR (world, group);
00541   }
00542 
00543   void setAnchor (dReal x, dReal y, dReal z)
00544     { dJointSetPRAnchor (_id, x, y, z); }
00545   void setAxis1 (dReal x, dReal y, dReal z)
00546     { dJointSetPRAxis1 (_id, x, y, z); }
00547   void setAxis2 (dReal x, dReal y, dReal z)
00548     { dJointSetPRAxis2 (_id, x, y, z); }
00549 
00550   void getAnchor (dVector3 result) const
00551     { dJointGetPRAnchor (_id, result); }
00552   void getAxis1 (dVector3 result) const
00553     { dJointGetPRAxis1 (_id, result); }
00554   void getAxis2 (dVector3 result) const
00555     { dJointGetPRAxis2 (_id, result); }
00556 
00557   dReal getPosition() const
00558     { return dJointGetPRPosition (_id); }
00559   dReal getPositionRate() const
00560     { return dJointGetPRPositionRate (_id); }
00561 
00562   void setParam (int parameter, dReal value)
00563     { dJointSetPRParam (_id, parameter, value); }
00564   dReal getParam (int parameter) const
00565     { return dJointGetPRParam (_id, parameter); }
00566 };
00567 
00568 
00569 class dFixedJoint : public dJoint {
00570   // intentionally undefined, don't use these
00571   dFixedJoint (const dFixedJoint &);
00572   void operator = (const dFixedJoint &);
00573 
00574 public:
00575   dFixedJoint() { }
00576   dFixedJoint (dWorldID world, dJointGroupID group=0)
00577     { _id = dJointCreateFixed (world, group); }
00578 
00579   void create (dWorldID world, dJointGroupID group=0) {
00580     if (_id) dJointDestroy (_id);
00581     _id = dJointCreateFixed (world, group);
00582   }
00583 
00584   void set()
00585     { dJointSetFixed (_id); }
00586 
00587   void setParam (int parameter, dReal value)
00588     { dJointSetFixedParam (_id, parameter, value); }
00589 
00590   dReal getParam (int parameter) const
00591     { return dJointGetFixedParam (_id, parameter); }
00592 };
00593 
00594 
00595 class dContactJoint : public dJoint {
00596   // intentionally undefined, don't use these
00597   dContactJoint (const dContactJoint &);
00598   void operator = (const dContactJoint &);
00599 
00600 public:
00601   dContactJoint() { }
00602   dContactJoint (dWorldID world, dJointGroupID group, dContact *contact)
00603     { _id = dJointCreateContact (world, group, contact); }
00604 
00605   void create (dWorldID world, dJointGroupID group, dContact *contact) {
00606     if (_id) dJointDestroy (_id);
00607     _id = dJointCreateContact (world, group, contact);
00608   }
00609 };
00610 
00611 
00612 class dNullJoint : public dJoint {
00613   // intentionally undefined, don't use these
00614   dNullJoint (const dNullJoint &);
00615   void operator = (const dNullJoint &);
00616 
00617 public:
00618   dNullJoint() { }
00619   dNullJoint (dWorldID world, dJointGroupID group=0)
00620     { _id = dJointCreateNull (world, group); }
00621 
00622   void create (dWorldID world, dJointGroupID group=0) {
00623     if (_id) dJointDestroy (_id);
00624     _id = dJointCreateNull (world, group);
00625   }
00626 };
00627 
00628 
00629 class dAMotorJoint : public dJoint {
00630   // intentionally undefined, don't use these
00631   dAMotorJoint (const dAMotorJoint &);
00632   void operator = (const dAMotorJoint &);
00633 
00634 public:
00635   dAMotorJoint() { }
00636   dAMotorJoint (dWorldID world, dJointGroupID group=0)
00637     { _id = dJointCreateAMotor (world, group); }
00638 
00639   void create (dWorldID world, dJointGroupID group=0) {
00640     if (_id) dJointDestroy (_id);
00641     _id = dJointCreateAMotor (world, group);
00642   }
00643 
00644   void setMode (int mode)
00645     { dJointSetAMotorMode (_id, mode); }
00646   int getMode() const
00647     { return dJointGetAMotorMode (_id); }
00648 
00649   void setNumAxes (int num)
00650     { dJointSetAMotorNumAxes (_id, num); }
00651   int getNumAxes() const
00652     { return dJointGetAMotorNumAxes (_id); }
00653 
00654   void setAxis (int anum, int rel, dReal x, dReal y, dReal z)
00655     { dJointSetAMotorAxis (_id, anum, rel, x, y, z); }
00656   void getAxis (int anum, dVector3 result) const
00657     { dJointGetAMotorAxis (_id, anum, result); }
00658   int getAxisRel (int anum) const
00659     { return dJointGetAMotorAxisRel (_id, anum); }
00660 
00661   void setAngle (int anum, dReal angle)
00662     { dJointSetAMotorAngle (_id, anum, angle); }
00663   dReal getAngle (int anum) const
00664     { return dJointGetAMotorAngle (_id, anum); }
00665   dReal getAngleRate (int anum)
00666     { return dJointGetAMotorAngleRate (_id,anum); }
00667 
00668   void setParam (int parameter, dReal value)
00669     { dJointSetAMotorParam (_id, parameter, value); }
00670   dReal getParam (int parameter) const
00671     { return dJointGetAMotorParam (_id, parameter); }
00672 
00673   void addTorques(dReal torque1, dReal torque2, dReal torque3)
00674    { dJointAddAMotorTorques(_id, torque1, torque2, torque3); }
00675 };
00676 
00677 
00678 class dLMotorJoint : public dJoint {
00679   // intentionally undefined, don't use these
00680   dLMotorJoint (const dLMotorJoint &);
00681   void operator = (const dLMotorJoint &);
00682 
00683 public:
00684   dLMotorJoint() { }
00685   dLMotorJoint (dWorldID world, dJointGroupID group=0)
00686     { _id = dJointCreateLMotor (world, group); }
00687 
00688   void create (dWorldID world, dJointGroupID group=0) {
00689     if (_id) dJointDestroy (_id);
00690     _id = dJointCreateLMotor (world, group);
00691   }
00692 
00693   void setNumAxes (int num)
00694     { dJointSetLMotorNumAxes (_id, num); }
00695   int getNumAxes() const
00696     { return dJointGetLMotorNumAxes (_id); }
00697 
00698   void setAxis (int anum, int rel, dReal x, dReal y, dReal z)
00699     { dJointSetLMotorAxis (_id, anum, rel, x, y, z); }
00700   void getAxis (int anum, dVector3 result) const
00701     { dJointGetLMotorAxis (_id, anum, result); }
00702 
00703   void setParam (int parameter, dReal value)
00704     { dJointSetLMotorParam (_id, parameter, value); }
00705   dReal getParam (int parameter) const
00706     { return dJointGetLMotorParam (_id, parameter); }
00707 };
00708 
00709 
00710 
00711 #endif
00712 #endif

Generated on Fri Oct 12 08:36:51 2007 for Open Dynamics Engine by  doxygen 1.5.3