classicui_plat/ode_api/inc/odecpp.h
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*************************************************************************
       
     2  *									 *
       
     3  * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith.	 *
       
     4  * All rights reserved.  Email: russ@q12.org   Web: www.q12.org 	 *
       
     5  *									 *
       
     6  * This library is free software; you can redistribute it and/or	 *
       
     7  * modify it under the terms of EITHER: 				 *
       
     8  *   (1) The GNU Lesser General Public License as published by the Free  *
       
     9  *	 Software Foundation; either version 2.1 of the License, or (at  *
       
    10  *	 your option) any later version. The text of the GNU Lesser	 *
       
    11  *	 General Public License is included with this library in the	 *
       
    12  *	 file LICENSE.TXT.						 *
       
    13  *   (2) The BSD-style license that is included with this library in	 *
       
    14  *	 the file LICENSE-BSD.TXT.					 *
       
    15  *									 *
       
    16  * This library is distributed in the hope that it will be useful,	 *
       
    17  * but WITHOUT ANY WARRANTY; without even the implied warranty of	 *
       
    18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files	 *
       
    19  * LICENSE.TXT and LICENSE-BSD.TXT for more details.			 *
       
    20  *									 *
       
    21  *************************************************************************/
       
    22 
       
    23 /* C++ interface for non-collision stuff */
       
    24 
       
    25 
       
    26 #ifndef _ODE_ODECPP_H_
       
    27 #define _ODE_ODECPP_H_
       
    28 #ifdef __cplusplus
       
    29 
       
    30 #include "error.h"
       
    31 
       
    32 
       
    33 class dWorld {
       
    34   dWorldID _id;
       
    35 
       
    36   // intentionally undefined, don't use these
       
    37   dWorld (const dWorld &);
       
    38   void operator= (const dWorld &);
       
    39 
       
    40 public:
       
    41   dWorld()
       
    42     { _id = dWorldCreate(); }
       
    43   ~dWorld()
       
    44     { dWorldDestroy (_id); }
       
    45 
       
    46   dWorldID id() const
       
    47     { return _id; }
       
    48   operator dWorldID() const
       
    49     { return _id; }
       
    50 
       
    51   void setGravity (dReal x, dReal y, dReal z)
       
    52     { dWorldSetGravity (_id,x,y,z); }
       
    53   void getGravity (dVector3 g) const
       
    54     { dWorldGetGravity (_id,g); }
       
    55 
       
    56   void setERP (dReal erp)
       
    57     { dWorldSetERP(_id, erp); }
       
    58   dReal getERP() const
       
    59     { return dWorldGetERP(_id); }
       
    60 
       
    61   void setCFM (dReal cfm)
       
    62     { dWorldSetCFM(_id, cfm); }
       
    63   dReal getCFM() const
       
    64     { return dWorldGetCFM(_id); }
       
    65 
       
    66   void step (dReal stepsize)
       
    67     { dWorldStep (_id,stepsize); }
       
    68 
       
    69   void stepFast1 (dReal stepsize, int maxiterations)
       
    70     { dWorldStepFast1 (_id,stepsize,maxiterations); }
       
    71   void setAutoEnableDepthSF1(dWorldID, int depth)
       
    72     { dWorldSetAutoEnableDepthSF1 (_id, depth); }
       
    73   int getAutoEnableDepthSF1(dWorldID)
       
    74     { return dWorldGetAutoEnableDepthSF1 (_id); }
       
    75 
       
    76   void  setAutoDisableLinearThreshold (dReal threshold) 
       
    77     { dWorldSetAutoDisableLinearThreshold (_id,threshold); }
       
    78   dReal getAutoDisableLinearThreshold()
       
    79     { return dWorldGetAutoDisableLinearThreshold (_id); }
       
    80   void setAutoDisableAngularThreshold (dReal threshold)
       
    81     { dWorldSetAutoDisableAngularThreshold (_id,threshold); }
       
    82   dReal getAutoDisableAngularThreshold()
       
    83     { return dWorldGetAutoDisableAngularThreshold (_id); }
       
    84   void setAutoDisableSteps (int steps)
       
    85     { dWorldSetAutoDisableSteps (_id,steps); }
       
    86   int getAutoDisableSteps()
       
    87     { return dWorldGetAutoDisableSteps (_id); }
       
    88   void setAutoDisableTime (dReal time)
       
    89     { dWorldSetAutoDisableTime (_id,time); }
       
    90   dReal getAutoDisableTime()
       
    91     { return dWorldGetAutoDisableTime (_id); }
       
    92   void setAutoDisableFlag (int do_auto_disable)
       
    93     { dWorldSetAutoDisableFlag (_id,do_auto_disable); }
       
    94   int getAutoDisableFlag()
       
    95     { return dWorldGetAutoDisableFlag (_id); }
       
    96 
       
    97   void impulseToForce (dReal stepsize, dReal ix, dReal iy, dReal iz,
       
    98 		       dVector3 force)
       
    99     { dWorldImpulseToForce (_id,stepsize,ix,iy,iz,force); }
       
   100 };
       
   101 
       
   102 
       
   103 class dBody {
       
   104   dBodyID _id;
       
   105 
       
   106   // intentionally undefined, don't use these
       
   107   dBody (const dBody &);
       
   108   void operator= (const dBody &);
       
   109 
       
   110 public:
       
   111   dBody()
       
   112     { _id = 0; }
       
   113   dBody (dWorldID world)
       
   114     { _id = dBodyCreate (world); }
       
   115   ~dBody()
       
   116     { if (_id) dBodyDestroy (_id); }
       
   117 
       
   118   void create (dWorldID world) {
       
   119     if (_id) dBodyDestroy (_id);
       
   120     _id = dBodyCreate (world);
       
   121   }
       
   122 
       
   123   dBodyID id() const
       
   124     { return _id; }
       
   125   operator dBodyID() const
       
   126     { return _id; }
       
   127 
       
   128   void setData (void *data)
       
   129     { dBodySetData (_id,data); }
       
   130   void *getData() const
       
   131     { return dBodyGetData (_id); }
       
   132 
       
   133   void setPosition (dReal x, dReal y, dReal z)
       
   134     { dBodySetPosition (_id,x,y,z); }
       
   135   void setRotation (const dMatrix3 R)
       
   136     { dBodySetRotation (_id,R); }
       
   137   void setQuaternion (const dQuaternion q)
       
   138     { dBodySetQuaternion (_id,q); }
       
   139   void setLinearVel  (dReal x, dReal y, dReal z)
       
   140     { dBodySetLinearVel (_id,x,y,z); }
       
   141   void setAngularVel (dReal x, dReal y, dReal z)
       
   142     { dBodySetAngularVel (_id,x,y,z); }
       
   143 
       
   144   const dReal * getPosition() const
       
   145     { return dBodyGetPosition (_id); }
       
   146   const dReal * getRotation() const
       
   147     { return dBodyGetRotation (_id); }
       
   148   const dReal * getQuaternion() const
       
   149     { return dBodyGetQuaternion (_id); }
       
   150   const dReal * getLinearVel() const
       
   151     { return dBodyGetLinearVel (_id); }
       
   152   const dReal * getAngularVel() const
       
   153     { return dBodyGetAngularVel (_id); }
       
   154 
       
   155   void setMass (const dMass *mass)
       
   156     { dBodySetMass (_id,mass); }
       
   157   void getMass (dMass *mass) const
       
   158     { dBodyGetMass (_id,mass); }
       
   159 
       
   160   void addForce (dReal fx, dReal fy, dReal fz)
       
   161     { dBodyAddForce (_id, fx, fy, fz); }
       
   162   void addTorque (dReal fx, dReal fy, dReal fz)
       
   163     { dBodyAddTorque (_id, fx, fy, fz); }
       
   164   void addRelForce (dReal fx, dReal fy, dReal fz)
       
   165     { dBodyAddRelForce (_id, fx, fy, fz); }
       
   166   void addRelTorque (dReal fx, dReal fy, dReal fz)
       
   167     { dBodyAddRelTorque (_id, fx, fy, fz); }
       
   168   void addForceAtPos (dReal fx, dReal fy, dReal fz,
       
   169 		      dReal px, dReal py, dReal pz)
       
   170     { dBodyAddForceAtPos (_id, fx, fy, fz, px, py, pz); }
       
   171   void addForceAtRelPos (dReal fx, dReal fy, dReal fz,
       
   172 		      dReal px, dReal py, dReal pz)
       
   173     { dBodyAddForceAtRelPos (_id, fx, fy, fz, px, py, pz); }
       
   174   void addRelForceAtPos (dReal fx, dReal fy, dReal fz,
       
   175 			 dReal px, dReal py, dReal pz)
       
   176     { dBodyAddRelForceAtPos (_id, fx, fy, fz, px, py, pz); }
       
   177   void addRelForceAtRelPos (dReal fx, dReal fy, dReal fz,
       
   178 			    dReal px, dReal py, dReal pz)
       
   179     { dBodyAddRelForceAtRelPos (_id, fx, fy, fz, px, py, pz); }
       
   180 
       
   181   const dReal * getForce() const
       
   182     { return dBodyGetForce(_id); }
       
   183   const dReal * getTorque() const
       
   184     { return dBodyGetTorque(_id); }
       
   185   void setForce (dReal x, dReal y, dReal z)
       
   186     { dBodySetForce (_id,x,y,z); }
       
   187   void setTorque (dReal x, dReal y, dReal z)
       
   188     { dBodySetTorque (_id,x,y,z); }
       
   189 
       
   190   void enable()
       
   191     { dBodyEnable (_id); }
       
   192   void disable()
       
   193     { dBodyDisable (_id); }
       
   194   int isEnabled() const
       
   195     { return dBodyIsEnabled (_id); }
       
   196 
       
   197   void getRelPointPos (dReal px, dReal py, dReal pz, dVector3 result) const
       
   198     { dBodyGetRelPointPos (_id, px, py, pz, result); }
       
   199   void getRelPointVel (dReal px, dReal py, dReal pz, dVector3 result) const
       
   200     { dBodyGetRelPointVel (_id, px, py, pz, result); }
       
   201   void getPointVel (dReal px, dReal py, dReal pz, dVector3 result) const
       
   202     { dBodyGetPointVel (_id,px,py,pz,result); }
       
   203   void getPosRelPoint (dReal px, dReal py, dReal pz, dVector3 result) const
       
   204     { dBodyGetPosRelPoint (_id,px,py,pz,result); }
       
   205   void vectorToWorld (dReal px, dReal py, dReal pz, dVector3 result) const
       
   206     { dBodyVectorToWorld (_id,px,py,pz,result); }
       
   207   void vectorFromWorld (dReal px, dReal py, dReal pz, dVector3 result) const
       
   208     { dBodyVectorFromWorld (_id,px,py,pz,result); }
       
   209 
       
   210   void setFiniteRotationMode (int mode)
       
   211     { dBodySetFiniteRotationMode (_id, mode); }
       
   212   void setFiniteRotationAxis (dReal x, dReal y, dReal z)
       
   213     { dBodySetFiniteRotationAxis (_id, x, y, z); }
       
   214 
       
   215   int getFiniteRotationMode() const
       
   216     { return dBodyGetFiniteRotationMode (_id); }
       
   217   void getFiniteRotationAxis (dVector3 result) const
       
   218     { dBodyGetFiniteRotationAxis (_id, result); }
       
   219 
       
   220   int getNumJoints() const
       
   221     { return dBodyGetNumJoints (_id); }
       
   222   dJointID getJoint (int index) const
       
   223     { return dBodyGetJoint (_id, index); }
       
   224 
       
   225   void setGravityMode (int mode)
       
   226     { dBodySetGravityMode (_id,mode); }
       
   227   int getGravityMode() const
       
   228     { return dBodyGetGravityMode (_id); }
       
   229 
       
   230   int isConnectedTo (dBodyID body) const
       
   231     { return dAreConnected (_id, body); }
       
   232 
       
   233   void  setAutoDisableLinearThreshold (dReal threshold) 
       
   234     { dBodySetAutoDisableLinearThreshold (_id,threshold); }
       
   235   dReal getAutoDisableLinearThreshold()
       
   236     { return dBodyGetAutoDisableLinearThreshold (_id); }
       
   237   void setAutoDisableAngularThreshold (dReal threshold)
       
   238     { dBodySetAutoDisableAngularThreshold (_id,threshold); }
       
   239   dReal getAutoDisableAngularThreshold()
       
   240     { return dBodyGetAutoDisableAngularThreshold (_id); }
       
   241   void setAutoDisableSteps (int steps)
       
   242     { dBodySetAutoDisableSteps (_id,steps); }
       
   243   int getAutoDisableSteps()
       
   244     { return dBodyGetAutoDisableSteps (_id); }
       
   245   void setAutoDisableTime (dReal time)
       
   246     { dBodySetAutoDisableTime (_id,time); }
       
   247   dReal getAutoDisableTime()
       
   248     { return dBodyGetAutoDisableTime (_id); }
       
   249   void setAutoDisableFlag (int do_auto_disable)
       
   250     { dBodySetAutoDisableFlag (_id,do_auto_disable); }
       
   251   int getAutoDisableFlag()
       
   252     { return dBodyGetAutoDisableFlag (_id); }
       
   253 };
       
   254 
       
   255 
       
   256 class dJointGroup {
       
   257   dJointGroupID _id;
       
   258 
       
   259   // intentionally undefined, don't use these
       
   260   dJointGroup (const dJointGroup &);
       
   261   void operator= (const dJointGroup &);
       
   262 
       
   263 public:
       
   264   dJointGroup (int dummy_arg=0)
       
   265     { _id = dJointGroupCreate (0); }
       
   266   ~dJointGroup()
       
   267     { dJointGroupDestroy (_id); }
       
   268   void create (int dummy_arg=0) {
       
   269     if (_id) dJointGroupDestroy (_id);
       
   270     _id = dJointGroupCreate (0);
       
   271   }
       
   272 
       
   273   dJointGroupID id() const
       
   274     { return _id; }
       
   275   operator dJointGroupID() const
       
   276     { return _id; }
       
   277 
       
   278   void empty()
       
   279     { dJointGroupEmpty (_id); }
       
   280 };
       
   281 
       
   282 
       
   283 class dJoint {
       
   284 private:
       
   285   // intentionally undefined, don't use these
       
   286   dJoint (const dJoint &) ;
       
   287   void operator= (const dJoint &);
       
   288 
       
   289 protected:
       
   290   dJointID _id;
       
   291 
       
   292 public:
       
   293   dJoint()
       
   294     { _id = 0; }
       
   295   ~dJoint()
       
   296     { if (_id) dJointDestroy (_id); }
       
   297 
       
   298   dJointID id() const
       
   299     { return _id; }
       
   300   operator dJointID() const
       
   301     { return _id; }
       
   302 
       
   303   void attach (dBodyID body1, dBodyID body2)
       
   304     { dJointAttach (_id, body1, body2); }
       
   305 
       
   306   void setData (void *data)
       
   307     { dJointSetData (_id, data); }
       
   308   void *getData() const
       
   309     { return dJointGetData (_id); }
       
   310 
       
   311   int getType() const
       
   312     { return dJointGetType (_id); }
       
   313 
       
   314   dBodyID getBody (int index) const
       
   315     { return dJointGetBody (_id, index); }
       
   316 
       
   317   void setFeedback(dJointFeedback *fb)
       
   318     { dJointSetFeedback(_id, fb); }
       
   319   dJointFeedback *getFeedback() const
       
   320     { return dJointGetFeedback(_id); }
       
   321 };
       
   322 
       
   323 
       
   324 class dBallJoint : public dJoint {
       
   325 private:
       
   326   // intentionally undefined, don't use these
       
   327   dBallJoint (const dBallJoint &);
       
   328   void operator= (const dBallJoint &);
       
   329 
       
   330 public:
       
   331   dBallJoint() { }
       
   332   dBallJoint (dWorldID world, dJointGroupID group=0)
       
   333     { _id = dJointCreateBall (world, group); }
       
   334 
       
   335   void create (dWorldID world, dJointGroupID group=0) {
       
   336     if (_id) dJointDestroy (_id);
       
   337     _id = dJointCreateBall (world, group);
       
   338   }
       
   339 
       
   340   void setAnchor (dReal x, dReal y, dReal z)
       
   341     { dJointSetBallAnchor (_id, x, y, z); }
       
   342   void getAnchor (dVector3 result) const
       
   343     { dJointGetBallAnchor (_id, result); }
       
   344   void getAnchor2 (dVector3 result) const
       
   345     { dJointGetBallAnchor2 (_id, result); }
       
   346 } ;
       
   347 
       
   348 
       
   349 class dHingeJoint : public dJoint {
       
   350   // intentionally undefined, don't use these
       
   351   dHingeJoint (const dHingeJoint &);
       
   352   void operator = (const dHingeJoint &);
       
   353 
       
   354 public:
       
   355   dHingeJoint() { }
       
   356   dHingeJoint (dWorldID world, dJointGroupID group=0)
       
   357     { _id = dJointCreateHinge (world, group); }
       
   358 
       
   359   void create (dWorldID world, dJointGroupID group=0) {
       
   360     if (_id) dJointDestroy (_id);
       
   361     _id = dJointCreateHinge (world, group);
       
   362   }
       
   363 
       
   364   void setAnchor (dReal x, dReal y, dReal z)
       
   365     { dJointSetHingeAnchor (_id, x, y, z); }
       
   366   void getAnchor (dVector3 result) const
       
   367     { dJointGetHingeAnchor (_id, result); }
       
   368   void getAnchor2 (dVector3 result) const
       
   369     { dJointGetHingeAnchor2 (_id, result); }
       
   370 
       
   371   void setAxis (dReal x, dReal y, dReal z)
       
   372     { dJointSetHingeAxis (_id, x, y, z); }
       
   373   void getAxis (dVector3 result) const
       
   374     { dJointGetHingeAxis (_id, result); }
       
   375 
       
   376   dReal getAngle() const
       
   377     { return dJointGetHingeAngle (_id); }
       
   378   dReal getAngleRate() const
       
   379     { return dJointGetHingeAngleRate (_id); }
       
   380 
       
   381   void setParam (int parameter, dReal value)
       
   382     { dJointSetHingeParam (_id, parameter, value); }
       
   383   dReal getParam (int parameter) const
       
   384     { return dJointGetHingeParam (_id, parameter); }
       
   385 
       
   386   void addTorque (dReal torque)
       
   387 	{ dJointAddHingeTorque(_id, torque); }
       
   388 };
       
   389 
       
   390 
       
   391 class dSliderJoint : public dJoint {
       
   392   // intentionally undefined, don't use these
       
   393   dSliderJoint (const dSliderJoint &);
       
   394   void operator = (const dSliderJoint &);
       
   395 
       
   396 public:
       
   397   dSliderJoint() { }
       
   398   dSliderJoint (dWorldID world, dJointGroupID group=0)
       
   399     { _id = dJointCreateSlider (world, group); }
       
   400 
       
   401   void create (dWorldID world, dJointGroupID group=0) {
       
   402     if (_id) dJointDestroy (_id);
       
   403     _id = dJointCreateSlider (world, group);
       
   404   }
       
   405 
       
   406   void setAxis (dReal x, dReal y, dReal z)
       
   407     { dJointSetSliderAxis (_id, x, y, z); }
       
   408   void getAxis (dVector3 result) const
       
   409     { dJointGetSliderAxis (_id, result); }
       
   410 
       
   411   dReal getPosition() const
       
   412     { return dJointGetSliderPosition (_id); }
       
   413   dReal getPositionRate() const
       
   414     { return dJointGetSliderPositionRate (_id); }
       
   415 
       
   416   void setParam (int parameter, dReal value)
       
   417     { dJointSetSliderParam (_id, parameter, value); }
       
   418   dReal getParam (int parameter) const
       
   419     { return dJointGetSliderParam (_id, parameter); }
       
   420 
       
   421   void addForce (dReal force)
       
   422 	{ dJointAddSliderForce(_id, force); }
       
   423 };
       
   424 
       
   425 
       
   426 class dUniversalJoint : public dJoint {
       
   427   // intentionally undefined, don't use these
       
   428   dUniversalJoint (const dUniversalJoint &);
       
   429   void operator = (const dUniversalJoint &);
       
   430 
       
   431 public:
       
   432   dUniversalJoint() { }
       
   433   dUniversalJoint (dWorldID world, dJointGroupID group=0)
       
   434     { _id = dJointCreateUniversal (world, group); }
       
   435 
       
   436   void create (dWorldID world, dJointGroupID group=0) {
       
   437     if (_id) dJointDestroy (_id);
       
   438     _id = dJointCreateUniversal (world, group);
       
   439   }
       
   440 
       
   441   void setAnchor (dReal x, dReal y, dReal z)
       
   442     { dJointSetUniversalAnchor (_id, x, y, z); }
       
   443   void setAxis1 (dReal x, dReal y, dReal z)
       
   444     { dJointSetUniversalAxis1 (_id, x, y, z); }
       
   445   void setAxis2 (dReal x, dReal y, dReal z)
       
   446     { dJointSetUniversalAxis2 (_id, x, y, z); }
       
   447   void setParam (int parameter, dReal value)
       
   448     { dJointSetUniversalParam (_id, parameter, value); }
       
   449 
       
   450   void getAnchor (dVector3 result) const
       
   451     { dJointGetUniversalAnchor (_id, result); }
       
   452   void getAnchor2 (dVector3 result) const
       
   453     { dJointGetUniversalAnchor2 (_id, result); }
       
   454   void getAxis1 (dVector3 result) const
       
   455     { dJointGetUniversalAxis1 (_id, result); }
       
   456   void getAxis2 (dVector3 result) const
       
   457     { dJointGetUniversalAxis2 (_id, result); }
       
   458   dReal getParam (int parameter) const
       
   459     { return dJointGetUniversalParam (_id, parameter); }
       
   460  void getAngles(dReal *angle1, dReal *angle2) const
       
   461     { dJointGetUniversalAngles (_id, angle1, angle2); }
       
   462 
       
   463   dReal getAngle1() const
       
   464     { return dJointGetUniversalAngle1 (_id); }
       
   465   dReal getAngle1Rate() const
       
   466     { return dJointGetUniversalAngle1Rate (_id); }
       
   467   dReal getAngle2() const
       
   468     { return dJointGetUniversalAngle2 (_id); }
       
   469   dReal getAngle2Rate() const
       
   470     { return dJointGetUniversalAngle2Rate (_id); }
       
   471 
       
   472   void addTorques (dReal torque1, dReal torque2)
       
   473 	{ dJointAddUniversalTorques(_id, torque1, torque2); }
       
   474 };
       
   475 
       
   476 
       
   477 class dHinge2Joint : public dJoint {
       
   478   // intentionally undefined, don't use these
       
   479   dHinge2Joint (const dHinge2Joint &);
       
   480   void operator = (const dHinge2Joint &);
       
   481 
       
   482 public:
       
   483   dHinge2Joint() { }
       
   484   dHinge2Joint (dWorldID world, dJointGroupID group=0)
       
   485     { _id = dJointCreateHinge2 (world, group); }
       
   486 
       
   487   void create (dWorldID world, dJointGroupID group=0) {
       
   488     if (_id) dJointDestroy (_id);
       
   489     _id = dJointCreateHinge2 (world, group);
       
   490   }
       
   491 
       
   492   void setAnchor (dReal x, dReal y, dReal z)
       
   493     { dJointSetHinge2Anchor (_id, x, y, z); }
       
   494   void setAxis1 (dReal x, dReal y, dReal z)
       
   495     { dJointSetHinge2Axis1 (_id, x, y, z); }
       
   496   void setAxis2 (dReal x, dReal y, dReal z)
       
   497     { dJointSetHinge2Axis2 (_id, x, y, z); }
       
   498 
       
   499   void getAnchor (dVector3 result) const
       
   500     { dJointGetHinge2Anchor (_id, result); }
       
   501   void getAnchor2 (dVector3 result) const
       
   502     { dJointGetHinge2Anchor2 (_id, result); }
       
   503   void getAxis1 (dVector3 result) const
       
   504     { dJointGetHinge2Axis1 (_id, result); }
       
   505   void getAxis2 (dVector3 result) const
       
   506     { dJointGetHinge2Axis2 (_id, result); }
       
   507 
       
   508   dReal getAngle1() const
       
   509     { return dJointGetHinge2Angle1 (_id); }
       
   510   dReal getAngle1Rate() const
       
   511     { return dJointGetHinge2Angle1Rate (_id); }
       
   512   dReal getAngle2Rate() const
       
   513     { return dJointGetHinge2Angle2Rate (_id); }
       
   514 
       
   515   void setParam (int parameter, dReal value)
       
   516     { dJointSetHinge2Param (_id, parameter, value); }
       
   517   dReal getParam (int parameter) const
       
   518     { return dJointGetHinge2Param (_id, parameter); }
       
   519 
       
   520   void addTorques(dReal torque1, dReal torque2)
       
   521 	{ dJointAddHinge2Torques(_id, torque1, torque2); }
       
   522 };
       
   523 
       
   524 
       
   525 class dPRJoint : public dJoint {
       
   526   dPRJoint (const dPRJoint &);
       
   527   void operator = (const dPRJoint &);
       
   528 
       
   529 public:
       
   530   dPRJoint() { }
       
   531   dPRJoint (dWorldID world, dJointGroupID group=0)
       
   532     { _id = dJointCreatePR (world, group); }
       
   533 
       
   534   void create (dWorldID world, dJointGroupID group=0) {
       
   535     if (_id) dJointDestroy (_id);
       
   536     _id = dJointCreatePR (world, group);
       
   537   }
       
   538 
       
   539   void setAnchor (dReal x, dReal y, dReal z)
       
   540     { dJointSetPRAnchor (_id, x, y, z); }
       
   541   void setAxis1 (dReal x, dReal y, dReal z)
       
   542     { dJointSetPRAxis1 (_id, x, y, z); }
       
   543   void setAxis2 (dReal x, dReal y, dReal z)
       
   544     { dJointSetPRAxis2 (_id, x, y, z); }
       
   545 
       
   546   void getAnchor (dVector3 result) const
       
   547     { dJointGetPRAnchor (_id, result); }
       
   548   void getAxis1 (dVector3 result) const
       
   549     { dJointGetPRAxis1 (_id, result); }
       
   550   void getAxis2 (dVector3 result) const
       
   551     { dJointGetPRAxis2 (_id, result); }
       
   552 
       
   553   dReal getPosition() const
       
   554     { return dJointGetPRPosition (_id); }
       
   555   dReal getPositionRate() const
       
   556     { return dJointGetPRPositionRate (_id); }
       
   557 
       
   558   void setParam (int parameter, dReal value)
       
   559     { dJointSetPRParam (_id, parameter, value); }
       
   560   dReal getParam (int parameter) const
       
   561     { return dJointGetPRParam (_id, parameter); }
       
   562 };
       
   563 
       
   564 
       
   565 class dFixedJoint : public dJoint {
       
   566   // intentionally undefined, don't use these
       
   567   dFixedJoint (const dFixedJoint &);
       
   568   void operator = (const dFixedJoint &);
       
   569 
       
   570 public:
       
   571   dFixedJoint() { }
       
   572   dFixedJoint (dWorldID world, dJointGroupID group=0)
       
   573     { _id = dJointCreateFixed (world, group); }
       
   574 
       
   575   void create (dWorldID world, dJointGroupID group=0) {
       
   576     if (_id) dJointDestroy (_id);
       
   577     _id = dJointCreateFixed (world, group);
       
   578   }
       
   579 
       
   580   void set()
       
   581     { dJointSetFixed (_id); }
       
   582 };
       
   583 
       
   584 
       
   585 class dContactJoint : public dJoint {
       
   586   // intentionally undefined, don't use these
       
   587   dContactJoint (const dContactJoint &);
       
   588   void operator = (const dContactJoint &);
       
   589 
       
   590 public:
       
   591   dContactJoint() { }
       
   592   dContactJoint (dWorldID world, dJointGroupID group, dContact *contact)
       
   593     { _id = dJointCreateContact (world, group, contact); }
       
   594 
       
   595   void create (dWorldID world, dJointGroupID group, dContact *contact) {
       
   596     if (_id) dJointDestroy (_id);
       
   597     _id = dJointCreateContact (world, group, contact);
       
   598   }
       
   599 };
       
   600 
       
   601 
       
   602 class dNullJoint : public dJoint {
       
   603   // intentionally undefined, don't use these
       
   604   dNullJoint (const dNullJoint &);
       
   605   void operator = (const dNullJoint &);
       
   606 
       
   607 public:
       
   608   dNullJoint() { }
       
   609   dNullJoint (dWorldID world, dJointGroupID group=0)
       
   610     { _id = dJointCreateNull (world, group); }
       
   611 
       
   612   void create (dWorldID world, dJointGroupID group=0) {
       
   613     if (_id) dJointDestroy (_id);
       
   614     _id = dJointCreateNull (world, group);
       
   615   }
       
   616 };
       
   617 
       
   618 
       
   619 class dAMotorJoint : public dJoint {
       
   620   // intentionally undefined, don't use these
       
   621   dAMotorJoint (const dAMotorJoint &);
       
   622   void operator = (const dAMotorJoint &);
       
   623 
       
   624 public:
       
   625   dAMotorJoint() { }
       
   626   dAMotorJoint (dWorldID world, dJointGroupID group=0)
       
   627     { _id = dJointCreateAMotor (world, group); }
       
   628 
       
   629   void create (dWorldID world, dJointGroupID group=0) {
       
   630     if (_id) dJointDestroy (_id);
       
   631     _id = dJointCreateAMotor (world, group);
       
   632   }
       
   633 
       
   634   void setMode (int mode)
       
   635     { dJointSetAMotorMode (_id, mode); }
       
   636   int getMode() const
       
   637     { return dJointGetAMotorMode (_id); }
       
   638 
       
   639   void setNumAxes (int num)
       
   640     { dJointSetAMotorNumAxes (_id, num); }
       
   641   int getNumAxes() const
       
   642     { return dJointGetAMotorNumAxes (_id); }
       
   643 
       
   644   void setAxis (int anum, int rel, dReal x, dReal y, dReal z)
       
   645     { dJointSetAMotorAxis (_id, anum, rel, x, y, z); }
       
   646   void getAxis (int anum, dVector3 result) const
       
   647     { dJointGetAMotorAxis (_id, anum, result); }
       
   648   int getAxisRel (int anum) const
       
   649     { return dJointGetAMotorAxisRel (_id, anum); }
       
   650 
       
   651   void setAngle (int anum, dReal angle)
       
   652     { dJointSetAMotorAngle (_id, anum, angle); }
       
   653   dReal getAngle (int anum) const
       
   654     { return dJointGetAMotorAngle (_id, anum); }
       
   655   dReal getAngleRate (int anum)
       
   656     { return dJointGetAMotorAngleRate (_id,anum); }
       
   657 
       
   658   void setParam (int parameter, dReal value)
       
   659     { dJointSetAMotorParam (_id, parameter, value); }
       
   660   dReal getParam (int parameter) const
       
   661     { return dJointGetAMotorParam (_id, parameter); }
       
   662 
       
   663   void addTorques(dReal torque1, dReal torque2, dReal torque3)
       
   664 	{ dJointAddAMotorTorques(_id, torque1, torque2, torque3); }
       
   665 };
       
   666 
       
   667 
       
   668 class dLMotorJoint : public dJoint {
       
   669   // intentionally undefined, don't use these
       
   670   dLMotorJoint (const dLMotorJoint &);
       
   671   void operator = (const dLMotorJoint &);
       
   672 
       
   673 public:
       
   674   dLMotorJoint() { }
       
   675   dLMotorJoint (dWorldID world, dJointGroupID group=0)
       
   676     { _id = dJointCreateLMotor (world, group); }
       
   677 
       
   678   void create (dWorldID world, dJointGroupID group=0) {
       
   679     if (_id) dJointDestroy (_id);
       
   680     _id = dJointCreateLMotor (world, group);
       
   681   }
       
   682 
       
   683   void setNumAxes (int num)
       
   684     { dJointSetLMotorNumAxes (_id, num); }
       
   685   int getNumAxes() const
       
   686     { return dJointGetLMotorNumAxes (_id); }
       
   687 
       
   688   void setAxis (int anum, int rel, dReal x, dReal y, dReal z)
       
   689     { dJointSetLMotorAxis (_id, anum, rel, x, y, z); }
       
   690   void getAxis (int anum, dVector3 result) const
       
   691     { dJointGetLMotorAxis (_id, anum, result); }
       
   692 
       
   693   void setParam (int parameter, dReal value)
       
   694     { dJointSetLMotorParam (_id, parameter, value); }
       
   695   dReal getParam (int parameter) const
       
   696     { return dJointGetLMotorParam (_id, parameter); }
       
   697 };
       
   698 
       
   699 
       
   700 
       
   701 #endif
       
   702 #endif