objects.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. /*************************************************************************
  2. * *
  3. * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
  4. * All rights reserved. Email: [email protected] 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. #ifndef _ODE_OBJECTS_H_
  23. #define _ODE_OBJECTS_H_
  24. #include <ode/common.h>
  25. #include <ode/mass.h>
  26. #include <ode/contact.h>
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. /* world */
  31. dWorldID dWorldCreate();
  32. void dWorldDestroy (dWorldID);
  33. void dWorldSetGravity (dWorldID, dReal x, dReal y, dReal z);
  34. void dWorldGetGravity (dWorldID, dVector3 gravity);
  35. void dWorldSetERP (dWorldID, dReal erp);
  36. dReal dWorldGetERP (dWorldID);
  37. void dWorldSetCFM (dWorldID, dReal cfm);
  38. dReal dWorldGetCFM (dWorldID);
  39. void dWorldStep (dWorldID, dReal stepsize);
  40. void dWorldImpulseToForce (dWorldID, dReal stepsize,
  41. dReal ix, dReal iy, dReal iz, dVector3 force);
  42. /* StepFast1 functions */
  43. void dWorldStepFast1(dWorldID, dReal stepsize, int maxiterations);
  44. void dWorldSetAutoEnableDepthSF1(dWorldID, int autoEnableDepth);
  45. int dWorldGetAutoEnableDepthSF1(dWorldID);
  46. void dBodySetAutoDisableThresholdSF1(dBodyID, dReal autoDisableThreshold);
  47. /* These functions are not yet implemented by ODE. */
  48. /*
  49. dReal dBodyGetAutoDisableThresholdSF1(dBodyID);
  50. void dBodySetAutoDisableStepsSF1(dBodyID, int AutoDisableSteps);
  51. int dBodyGetAutoDisableStepsSF1(dBodyID);
  52. void dBodySetAutoDisableSF1(dBodyID, int doAutoDisable);
  53. int dBodyGetAutoDisableSF1(dBodyID);
  54. */
  55. /* bodies */
  56. dBodyID dBodyCreate (dWorldID);
  57. void dBodyDestroy (dBodyID);
  58. void dBodySetData (dBodyID, void *data);
  59. void *dBodyGetData (dBodyID);
  60. void dBodySetPosition (dBodyID, dReal x, dReal y, dReal z);
  61. void dBodySetRotation (dBodyID, const dMatrix3 R);
  62. void dBodySetQuaternion (dBodyID, const dQuaternion q);
  63. void dBodySetLinearVel (dBodyID, dReal x, dReal y, dReal z);
  64. void dBodySetAngularVel (dBodyID, dReal x, dReal y, dReal z);
  65. const dReal * dBodyGetPosition (dBodyID);
  66. const dReal * dBodyGetRotation (dBodyID); /* ptr to 4x3 rot matrix */
  67. const dReal * dBodyGetQuaternion (dBodyID);
  68. const dReal * dBodyGetLinearVel (dBodyID);
  69. const dReal * dBodyGetAngularVel (dBodyID);
  70. void dBodySetMass (dBodyID, const dMass *mass);
  71. void dBodyGetMass (dBodyID, dMass *mass);
  72. void dBodyAddForce (dBodyID, dReal fx, dReal fy, dReal fz);
  73. void dBodyAddTorque (dBodyID, dReal fx, dReal fy, dReal fz);
  74. void dBodyAddRelForce (dBodyID, dReal fx, dReal fy, dReal fz);
  75. void dBodyAddRelTorque (dBodyID, dReal fx, dReal fy, dReal fz);
  76. void dBodyAddForceAtPos (dBodyID, dReal fx, dReal fy, dReal fz,
  77. dReal px, dReal py, dReal pz);
  78. void dBodyAddForceAtRelPos (dBodyID, dReal fx, dReal fy, dReal fz,
  79. dReal px, dReal py, dReal pz);
  80. void dBodyAddRelForceAtPos (dBodyID, dReal fx, dReal fy, dReal fz,
  81. dReal px, dReal py, dReal pz);
  82. void dBodyAddRelForceAtRelPos (dBodyID, dReal fx, dReal fy, dReal fz,
  83. dReal px, dReal py, dReal pz);
  84. const dReal * dBodyGetForce (dBodyID);
  85. const dReal * dBodyGetTorque (dBodyID);
  86. void dBodySetForce (dBodyID b, dReal x, dReal y, dReal z);
  87. void dBodySetTorque (dBodyID b, dReal x, dReal y, dReal z);
  88. void dBodyGetRelPointPos (dBodyID, dReal px, dReal py, dReal pz,
  89. dVector3 result);
  90. void dBodyGetRelPointVel (dBodyID, dReal px, dReal py, dReal pz,
  91. dVector3 result);
  92. void dBodyGetPointVel (dBodyID, dReal px, dReal py, dReal pz,
  93. dVector3 result);
  94. void dBodyGetPosRelPoint (dBodyID, dReal px, dReal py, dReal pz,
  95. dVector3 result);
  96. void dBodyVectorToWorld (dBodyID, dReal px, dReal py, dReal pz,
  97. dVector3 result);
  98. void dBodyVectorFromWorld (dBodyID, dReal px, dReal py, dReal pz,
  99. dVector3 result);
  100. void dBodySetFiniteRotationMode (dBodyID, int mode);
  101. void dBodySetFiniteRotationAxis (dBodyID, dReal x, dReal y, dReal z);
  102. int dBodyGetFiniteRotationMode (dBodyID);
  103. void dBodyGetFiniteRotationAxis (dBodyID, dVector3 result);
  104. int dBodyGetNumJoints (dBodyID b);
  105. dJointID dBodyGetJoint (dBodyID, int index);
  106. void dBodyEnable (dBodyID);
  107. void dBodyDisable (dBodyID);
  108. int dBodyIsEnabled (dBodyID);
  109. void dBodySetGravityMode (dBodyID b, int mode);
  110. int dBodyGetGravityMode (dBodyID b);
  111. /* joints */
  112. dJointID dJointCreateBall (dWorldID, dJointGroupID);
  113. dJointID dJointCreateHinge (dWorldID, dJointGroupID);
  114. dJointID dJointCreateSlider (dWorldID, dJointGroupID);
  115. dJointID dJointCreateContact (dWorldID, dJointGroupID, const dContact *);
  116. dJointID dJointCreateHinge2 (dWorldID, dJointGroupID);
  117. dJointID dJointCreateUniversal (dWorldID, dJointGroupID);
  118. dJointID dJointCreateFixed (dWorldID, dJointGroupID);
  119. dJointID dJointCreateNull (dWorldID, dJointGroupID);
  120. dJointID dJointCreateAMotor (dWorldID, dJointGroupID);
  121. void dJointDestroy (dJointID);
  122. dJointGroupID dJointGroupCreate (int max_size);
  123. void dJointGroupDestroy (dJointGroupID);
  124. void dJointGroupEmpty (dJointGroupID);
  125. void dJointAttach (dJointID, dBodyID body1, dBodyID body2);
  126. void dJointSetData (dJointID, void *data);
  127. void *dJointGetData (dJointID);
  128. int dJointGetType (dJointID);
  129. dBodyID dJointGetBody (dJointID, int index);
  130. void dJointSetFeedback (dJointID, dJointFeedback *);
  131. dJointFeedback *dJointGetFeedback (dJointID);
  132. /******************** breakable joint contribution ***********************/
  133. void dJointSetBreakable (dJointID, int b);
  134. void dJointSetBreakCallback (dJointID, dJointBreakCallback *callbackFunc);
  135. void dJointSetBreakMode (dJointID, int mode);
  136. int dJointGetBreakMode (dJointID);
  137. void dJointSetBreakForce (dJointID, int body, dReal x, dReal y, dReal z);
  138. void dJointSetBreakTorque (dJointID, int body, dReal x, dReal y, dReal z);
  139. int dJointIsBreakable (dJointID);
  140. void dJointGetBreakForce (dJointID, int body, dReal *force);
  141. void dJointGetBreakTorque (dJointID, int body, dReal *torque);
  142. /*************************************************************************/
  143. void dJointSetBallAnchor (dJointID, dReal x, dReal y, dReal z);
  144. void dJointSetHingeAnchor (dJointID, dReal x, dReal y, dReal z);
  145. void dJointSetHingeAxis (dJointID, dReal x, dReal y, dReal z);
  146. void dJointSetHingeParam (dJointID, int parameter, dReal value);
  147. void dJointAddHingeTorque(dJointID joint, dReal torque);
  148. void dJointSetSliderAxis (dJointID, dReal x, dReal y, dReal z);
  149. void dJointSetSliderParam (dJointID, int parameter, dReal value);
  150. void dJointAddSliderForce(dJointID joint, dReal force);
  151. void dJointSetHinge2Anchor (dJointID, dReal x, dReal y, dReal z);
  152. void dJointSetHinge2Axis1 (dJointID, dReal x, dReal y, dReal z);
  153. void dJointSetHinge2Axis2 (dJointID, dReal x, dReal y, dReal z);
  154. void dJointSetHinge2Param (dJointID, int parameter, dReal value);
  155. void dJointAddHinge2Torques(dJointID joint, dReal torque1, dReal torque2);
  156. void dJointSetUniversalAnchor (dJointID, dReal x, dReal y, dReal z);
  157. void dJointSetUniversalAxis1 (dJointID, dReal x, dReal y, dReal z);
  158. void dJointSetUniversalAxis2 (dJointID, dReal x, dReal y, dReal z);
  159. void dJointSetUniversalParam (dJointID, int parameter, dReal value);
  160. void dJointAddUniversalTorques(dJointID joint, dReal torque1, dReal torque2);
  161. void dJointSetFixed (dJointID);
  162. void dJointSetAMotorNumAxes (dJointID, int num);
  163. void dJointSetAMotorAxis (dJointID, int anum, int rel,
  164. dReal x, dReal y, dReal z);
  165. void dJointSetAMotorAngle (dJointID, int anum, dReal angle);
  166. void dJointSetAMotorParam (dJointID, int parameter, dReal value);
  167. void dJointSetAMotorMode (dJointID, int mode);
  168. void dJointAddAMotorTorques (dJointID, dReal torque1, dReal torque2, dReal torque3);
  169. void dJointGetBallAnchor (dJointID, dVector3 result);
  170. void dJointGetBallAnchor2 (dJointID, dVector3 result);
  171. void dJointGetHingeAnchor (dJointID, dVector3 result);
  172. void dJointGetHingeAnchor2 (dJointID, dVector3 result);
  173. void dJointGetHingeAxis (dJointID, dVector3 result);
  174. dReal dJointGetHingeParam (dJointID, int parameter);
  175. dReal dJointGetHingeAngle (dJointID);
  176. dReal dJointGetHingeAngleRate (dJointID);
  177. dReal dJointGetSliderPosition (dJointID);
  178. dReal dJointGetSliderPositionRate (dJointID);
  179. void dJointGetSliderAxis (dJointID, dVector3 result);
  180. dReal dJointGetSliderParam (dJointID, int parameter);
  181. void dJointGetHinge2Anchor (dJointID, dVector3 result);
  182. void dJointGetHinge2Anchor2 (dJointID, dVector3 result);
  183. void dJointGetHinge2Axis1 (dJointID, dVector3 result);
  184. void dJointGetHinge2Axis2 (dJointID, dVector3 result);
  185. dReal dJointGetHinge2Param (dJointID, int parameter);
  186. dReal dJointGetHinge2Angle1 (dJointID);
  187. dReal dJointGetHinge2Angle1Rate (dJointID);
  188. dReal dJointGetHinge2Angle2Rate (dJointID);
  189. void dJointGetUniversalAnchor (dJointID, dVector3 result);
  190. void dJointGetUniversalAnchor2 (dJointID, dVector3 result);
  191. void dJointGetUniversalAxis1 (dJointID, dVector3 result);
  192. void dJointGetUniversalAxis2 (dJointID, dVector3 result);
  193. dReal dJointGetUniversalParam (dJointID, int parameter);
  194. dReal dJointGetUniversalAngle1 (dJointID);
  195. dReal dJointGetUniversalAngle2 (dJointID);
  196. dReal dJointGetUniversalAngle1Rate (dJointID);
  197. dReal dJointGetUniversalAngle2Rate (dJointID);
  198. int dJointGetAMotorNumAxes (dJointID);
  199. void dJointGetAMotorAxis (dJointID, int anum, dVector3 result);
  200. int dJointGetAMotorAxisRel (dJointID, int anum);
  201. dReal dJointGetAMotorAngle (dJointID, int anum);
  202. dReal dJointGetAMotorAngleRate (dJointID, int anum);
  203. dReal dJointGetAMotorParam (dJointID, int parameter);
  204. int dJointGetAMotorMode (dJointID);
  205. int dAreConnected (dBodyID, dBodyID);
  206. int dAreConnectedExcluding (dBodyID, dBodyID, int joint_type);
  207. #ifdef __cplusplus
  208. }
  209. #endif
  210. #endif