ODE  0.13.1
 All Data Structures Functions Variables Typedefs Enumerations Groups
odecpp.h
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 
31 
32 
33 //namespace ode {
34 
35 
36 class dWorldSimpleIDContainer {
37 protected:
38  dWorldID _id;
39 
40  dWorldSimpleIDContainer(): _id(0) {}
41  ~dWorldSimpleIDContainer() { destroy(); }
42 
43  void destroy() {
44  if (_id) {
45  dWorldDestroy(_id);
46  _id = 0;
47  }
48  }
49 };
50 
51 class dWorldDynamicIDContainer: public dWorldSimpleIDContainer {
52 protected:
53  virtual ~dWorldDynamicIDContainer() {}
54 };
55 
56 template <class dWorldTemplateBase>
57 class dWorldTemplate: public dWorldTemplateBase {
58  // intentionally undefined, don't use these
59  dWorldTemplate (const dWorldTemplate<dWorldTemplateBase> &);
60  void operator= (const dWorldTemplate<dWorldTemplateBase> &);
61 
62 protected:
63  dWorldID get_id() const { return dWorldTemplateBase::_id; }
64  void set_id(dWorldID value) { dWorldTemplateBase::_id = value; }
65 
66 public:
67  dWorldTemplate()
68  { set_id(dWorldCreate()); }
69 
70  dWorldID id() const
71  { return get_id(); }
72  operator dWorldID() const
73  { return get_id(); }
74 
75  void setGravity (dReal x, dReal y, dReal z)
76  { dWorldSetGravity (get_id(), x, y, z); }
77  void setGravity (const dVector3 g)
78  { setGravity (g[0], g[1], g[2]); }
79  void getGravity (dVector3 g) const
80  { dWorldGetGravity (get_id(), g); }
81 
82  void setERP (dReal erp)
83  { dWorldSetERP(get_id(), erp); }
84  dReal getERP() const
85  { return dWorldGetERP(get_id()); }
86 
87  void setCFM (dReal cfm)
88  { dWorldSetCFM(get_id(), cfm); }
89  dReal getCFM() const
90  { return dWorldGetCFM(get_id()); }
91 
92  void step (dReal stepsize)
93  { dWorldStep (get_id(), stepsize); }
94 
95  void quickStep(dReal stepsize)
96  { dWorldQuickStep (get_id(), stepsize); }
97  void setQuickStepNumIterations(int num)
98  { dWorldSetQuickStepNumIterations (get_id(), num); }
99  int getQuickStepNumIterations() const
100  { return dWorldGetQuickStepNumIterations (get_id()); }
101  void setQuickStepW(dReal over_relaxation)
102  { dWorldSetQuickStepW (get_id(), over_relaxation); }
103  dReal getQuickStepW() const
104  { return dWorldGetQuickStepW (get_id()); }
105 
106  void setAutoDisableLinearThreshold (dReal threshold)
107  { dWorldSetAutoDisableLinearThreshold (get_id(), threshold); }
108  dReal getAutoDisableLinearThreshold() const
109  { return dWorldGetAutoDisableLinearThreshold (get_id()); }
110  void setAutoDisableAngularThreshold (dReal threshold)
111  { dWorldSetAutoDisableAngularThreshold (get_id(), threshold); }
112  dReal getAutoDisableAngularThreshold() const
113  { return dWorldGetAutoDisableAngularThreshold (get_id()); }
114  void setAutoDisableSteps (int steps)
115  { dWorldSetAutoDisableSteps (get_id(), steps); }
116  int getAutoDisableSteps() const
117  { return dWorldGetAutoDisableSteps (get_id()); }
118  void setAutoDisableTime (dReal time)
119  { dWorldSetAutoDisableTime (get_id(), time); }
120  dReal getAutoDisableTime() const
121  { return dWorldGetAutoDisableTime (get_id()); }
122  void setAutoDisableFlag (int do_auto_disable)
123  { dWorldSetAutoDisableFlag (get_id(), do_auto_disable); }
124  int getAutoDisableFlag() const
125  { return dWorldGetAutoDisableFlag (get_id()); }
126 
127  dReal getLinearDampingThreshold() const
128  { return dWorldGetLinearDampingThreshold(get_id()); }
129  void setLinearDampingThreshold(dReal threshold)
130  { dWorldSetLinearDampingThreshold(get_id(), threshold); }
131  dReal getAngularDampingThreshold() const
132  { return dWorldGetAngularDampingThreshold(get_id()); }
133  void setAngularDampingThreshold(dReal threshold)
134  { dWorldSetAngularDampingThreshold(get_id(), threshold); }
135  dReal getLinearDamping() const
136  { return dWorldGetLinearDamping(get_id()); }
137  void setLinearDamping(dReal scale)
138  { dWorldSetLinearDamping(get_id(), scale); }
139  dReal getAngularDamping() const
140  { return dWorldGetAngularDamping(get_id()); }
141  void setAngularDamping(dReal scale)
142  { dWorldSetAngularDamping(get_id(), scale); }
143  void setDamping(dReal linear_scale, dReal angular_scale)
144  { dWorldSetDamping(get_id(), linear_scale, angular_scale); }
145 
146  dReal getMaxAngularSpeed() const
147  { return dWorldGetMaxAngularSpeed(get_id()); }
148  void setMaxAngularSpeed(dReal max_speed)
149  { dWorldSetMaxAngularSpeed(get_id(), max_speed); }
150 
151  void setContactSurfaceLayer(dReal depth)
152  { dWorldSetContactSurfaceLayer (get_id(), depth); }
153  dReal getContactSurfaceLayer() const
154  { return dWorldGetContactSurfaceLayer (get_id()); }
155 
156  void impulseToForce (dReal stepsize, dReal ix, dReal iy, dReal iz,
157  dVector3 force)
158  { dWorldImpulseToForce (get_id(), stepsize, ix, iy, iz, force); }
159 };
160 
161 
162 class dBodySimpleIDContainer {
163 protected:
164  dBodyID _id;
165 
166  dBodySimpleIDContainer(): _id(0) {}
167  ~dBodySimpleIDContainer() { destroy(); }
168 
169  void destroy() {
170  if (_id) {
171  dBodyDestroy(_id);
172  _id = 0;
173  }
174  }
175 };
176 
177 class dBodyDynamicIDContainer: public dBodySimpleIDContainer {
178 protected:
179  virtual ~dBodyDynamicIDContainer() {}
180 };
181 
182 template <class dBodyTemplateBase, class dWorldTemplateBase>
183 class dBodyTemplate: public dBodyTemplateBase {
184  // intentionally undefined, don't use these
185  dBodyTemplate (const dBodyTemplate<dBodyTemplateBase, dWorldTemplateBase> &);
186  void operator= (const dBodyTemplate<dBodyTemplateBase, dWorldTemplateBase> &);
187 
188 protected:
189  dBodyID get_id() const { return dBodyTemplateBase::_id; }
190  void set_id(dBodyID value) { dBodyTemplateBase::_id = value; }
191 
192  void destroy() { dBodyTemplateBase::destroy(); }
193 
194 public:
195  dBodyTemplate()
196  { }
197  dBodyTemplate (dWorldID world)
198  { set_id(dBodyCreate(world)); }
199  dBodyTemplate (dWorldTemplate<dWorldTemplateBase>& world)
200  { set_id(dBodyCreate(world.id())); }
201 
202  void create (dWorldID world) {
203  destroy();
204  set_id(dBodyCreate(world));
205  }
206  void create (dWorldTemplate<dWorldTemplateBase>& world) {
207  create(world.id());
208  }
209 
210  dBodyID id() const
211  { return get_id(); }
212  operator dBodyID() const
213  { return get_id(); }
214 
215  void setData (void *data)
216  { dBodySetData (get_id(), data); }
217  void *getData() const
218  { return dBodyGetData (get_id()); }
219 
220  void setPosition (dReal x, dReal y, dReal z)
221  { dBodySetPosition (get_id(), x, y, z); }
222  void setPosition (const dVector3 p)
223  { setPosition(p[0], p[1], p[2]); }
224 
225  void setRotation (const dMatrix3 R)
226  { dBodySetRotation (get_id(), R); }
227  void setQuaternion (const dQuaternion q)
228  { dBodySetQuaternion (get_id(), q); }
229  void setLinearVel (dReal x, dReal y, dReal z)
230  { dBodySetLinearVel (get_id(), x, y, z); }
231  void setLinearVel (const dVector3 v)
232  { setLinearVel(v[0], v[1], v[2]); }
233  void setAngularVel (dReal x, dReal y, dReal z)
234  { dBodySetAngularVel (get_id(), x, y, z); }
235  void setAngularVel (const dVector3 v)
236  { setAngularVel (v[0], v[1], v[2]); }
237 
238  const dReal * getPosition() const
239  { return dBodyGetPosition (get_id()); }
240  const dReal * getRotation() const
241  { return dBodyGetRotation (get_id()); }
242  const dReal * getQuaternion() const
243  { return dBodyGetQuaternion (get_id()); }
244  const dReal * getLinearVel() const
245  { return dBodyGetLinearVel (get_id()); }
246  const dReal * getAngularVel() const
247  { return dBodyGetAngularVel (get_id()); }
248 
249  void setMass (const dMass *mass)
250  { dBodySetMass (get_id(), mass); }
251  void setMass (const dMass &mass)
252  { setMass (&mass); }
253  dMass getMass () const
254  { dMass mass; dBodyGetMass (get_id(), &mass); return mass; }
255 
256  void addForce (dReal fx, dReal fy, dReal fz)
257  { dBodyAddForce (get_id(), fx, fy, fz); }
258  void addForce (const dVector3 f)
259  { addForce (f[0], f[1], f[2]); }
260  void addTorque (dReal fx, dReal fy, dReal fz)
261  { dBodyAddTorque (get_id(), fx, fy, fz); }
262  void addTorque (const dVector3 t)
263  { addTorque(t[0], t[1], t[2]); }
264 
265  void addRelForce (dReal fx, dReal fy, dReal fz)
266  { dBodyAddRelForce (get_id(), fx, fy, fz); }
267  void addRelForce (const dVector3 f)
268  { addRelForce (f[0], f[1], f[2]); }
269  void addRelTorque (dReal fx, dReal fy, dReal fz)
270  { dBodyAddRelTorque (get_id(), fx, fy, fz); }
271  void addRelTorque (const dVector3 t)
272  { addRelTorque (t[0], t[1], t[2]); }
273 
274  void addForceAtPos (dReal fx, dReal fy, dReal fz,
275  dReal px, dReal py, dReal pz)
276  { dBodyAddForceAtPos (get_id(), fx, fy, fz, px, py, pz); }
277  void addForceAtPos (const dVector3 f, const dVector3 p)
278  { addForceAtPos (f[0], f[1], f[2], p[0], p[1], p[2]); }
279 
280  void addForceAtRelPos (dReal fx, dReal fy, dReal fz,
281  dReal px, dReal py, dReal pz)
282  { dBodyAddForceAtRelPos (get_id(), fx, fy, fz, px, py, pz); }
283  void addForceAtRelPos (const dVector3 f, const dVector3 p)
284  { addForceAtRelPos (f[0], f[1], f[2], p[0], p[1], p[2]); }
285 
286  void addRelForceAtPos (dReal fx, dReal fy, dReal fz,
287  dReal px, dReal py, dReal pz)
288  { dBodyAddRelForceAtPos (get_id(), fx, fy, fz, px, py, pz); }
289  void addRelForceAtPos (const dVector3 f, const dVector3 p)
290  { addRelForceAtPos (f[0], f[1], f[2], p[0], p[1], p[2]); }
291 
292  void addRelForceAtRelPos (dReal fx, dReal fy, dReal fz,
293  dReal px, dReal py, dReal pz)
294  { dBodyAddRelForceAtRelPos (get_id(), fx, fy, fz, px, py, pz); }
295  void addRelForceAtRelPos (const dVector3 f, const dVector3 p)
296  { addRelForceAtRelPos (f[0], f[1], f[2], p[0], p[1], p[2]); }
297 
298  const dReal * getForce() const
299  { return dBodyGetForce(get_id()); }
300  const dReal * getTorque() const
301  { return dBodyGetTorque(get_id()); }
302  void setForce (dReal x, dReal y, dReal z)
303  { dBodySetForce (get_id(), x, y, z); }
304  void setForce (const dVector3 f)
305  { setForce (f[0], f[1], f[2]); }
306  void setTorque (dReal x, dReal y, dReal z)
307  { dBodySetTorque (get_id(), x, y, z); }
308  void setTorque (const dVector3 t)
309  { setTorque (t[0], t[1], t[2]); }
310 
311  void setDynamic()
312  { dBodySetDynamic (get_id()); }
313  void setKinematic()
314  { dBodySetKinematic (get_id()); }
315  bool isKinematic() const
316  { return dBodyIsKinematic (get_id()) != 0; }
317 
318  void enable()
319  { dBodyEnable (get_id()); }
320  void disable()
321  { dBodyDisable (get_id()); }
322  bool isEnabled() const
323  { return dBodyIsEnabled (get_id()) != 0; }
324 
325  void getRelPointPos (dReal px, dReal py, dReal pz, dVector3 result) const
326  { dBodyGetRelPointPos (get_id(), px, py, pz, result); }
327  void getRelPointPos (const dVector3 p, dVector3 result) const
328  { getRelPointPos (p[0], p[1], p[2], result); }
329 
330  void getRelPointVel (dReal px, dReal py, dReal pz, dVector3 result) const
331  { dBodyGetRelPointVel (get_id(), px, py, pz, result); }
332  void getRelPointVel (const dVector3 p, dVector3 result) const
333  { getRelPointVel (p[0], p[1], p[2], result); }
334 
335  void getPointVel (dReal px, dReal py, dReal pz, dVector3 result) const
336  { dBodyGetPointVel (get_id(), px, py, pz, result); }
337  void getPointVel (const dVector3 p, dVector3 result) const
338  { getPointVel (p[0], p[1], p[2], result); }
339 
340  void getPosRelPoint (dReal px, dReal py, dReal pz, dVector3 result) const
341  { dBodyGetPosRelPoint (get_id(), px, py, pz, result); }
342  void getPosRelPoint (const dVector3 p, dVector3 result) const
343  { getPosRelPoint (p[0], p[1], p[2], result); }
344 
345  void vectorToWorld (dReal px, dReal py, dReal pz, dVector3 result) const
346  { dBodyVectorToWorld (get_id(), px, py, pz, result); }
347  void vectorToWorld (const dVector3 p, dVector3 result) const
348  { vectorToWorld (p[0], p[1], p[2], result); }
349 
350  void vectorFromWorld (dReal px, dReal py, dReal pz, dVector3 result) const
351  { dBodyVectorFromWorld (get_id(), px, py, pz, result); }
352  void vectorFromWorld (const dVector3 p, dVector3 result) const
353  { vectorFromWorld (p[0], p[1], p[2], result); }
354 
355  void setFiniteRotationMode (bool mode)
356  { dBodySetFiniteRotationMode (get_id(), mode); }
357 
358  void setFiniteRotationAxis (dReal x, dReal y, dReal z)
359  { dBodySetFiniteRotationAxis (get_id(), x, y, z); }
360  void setFiniteRotationAxis (const dVector3 a)
361  { setFiniteRotationAxis (a[0], a[1], a[2]); }
362 
363  bool getFiniteRotationMode() const
364  { return dBodyGetFiniteRotationMode (get_id()) != 0; }
365  void getFiniteRotationAxis (dVector3 result) const
366  { dBodyGetFiniteRotationAxis (get_id(), result); }
367 
368  int getNumJoints() const
369  { return dBodyGetNumJoints (get_id()); }
370  dJointID getJoint (int index) const
371  { return dBodyGetJoint (get_id(), index); }
372 
373  void setGravityMode (bool mode)
374  { dBodySetGravityMode (get_id(), mode); }
375  bool getGravityMode() const
376  { return dBodyGetGravityMode (get_id()) != 0; }
377 
378  bool isConnectedTo (dBodyID body) const
379  { return dAreConnected (get_id(), body) != 0; }
380 
381  void setAutoDisableLinearThreshold (dReal threshold)
382  { dBodySetAutoDisableLinearThreshold (get_id(), threshold); }
383  dReal getAutoDisableLinearThreshold() const
384  { return dBodyGetAutoDisableLinearThreshold (get_id()); }
385  void setAutoDisableAngularThreshold (dReal threshold)
386  { dBodySetAutoDisableAngularThreshold (get_id(), threshold); }
387  dReal getAutoDisableAngularThreshold() const
388  { return dBodyGetAutoDisableAngularThreshold (get_id()); }
389  void setAutoDisableSteps (int steps)
390  { dBodySetAutoDisableSteps (get_id(), steps); }
391  int getAutoDisableSteps() const
392  { return dBodyGetAutoDisableSteps (get_id()); }
393  void setAutoDisableTime (dReal time)
394  { dBodySetAutoDisableTime (get_id(), time); }
395  dReal getAutoDisableTime() const
396  { return dBodyGetAutoDisableTime (get_id()); }
397  void setAutoDisableFlag (bool do_auto_disable)
398  { dBodySetAutoDisableFlag (get_id(), do_auto_disable); }
399  bool getAutoDisableFlag() const
400  { return dBodyGetAutoDisableFlag (get_id()) != 0; }
401 
402  dReal getLinearDamping() const
403  { return dBodyGetLinearDamping(get_id()); }
404  void setLinearDamping(dReal scale)
405  { dBodySetLinearDamping(get_id(), scale); }
406  dReal getAngularDamping() const
407  { return dBodyGetAngularDamping(get_id()); }
408  void setAngularDamping(dReal scale)
409  { dBodySetAngularDamping(get_id(), scale); }
410  void setDamping(dReal linear_scale, dReal angular_scale)
411  { dBodySetDamping(get_id(), linear_scale, angular_scale); }
412  dReal getLinearDampingThreshold() const
413  { return dBodyGetLinearDampingThreshold(get_id()); }
414  void setLinearDampingThreshold(dReal threshold) const
415  { dBodySetLinearDampingThreshold(get_id(), threshold); }
416  dReal getAngularDampingThreshold() const
417  { return dBodyGetAngularDampingThreshold(get_id()); }
418  void setAngularDampingThreshold(dReal threshold)
419  { dBodySetAngularDampingThreshold(get_id(), threshold); }
420  void setDampingDefaults()
421  { dBodySetDampingDefaults(get_id()); }
422 
423  dReal getMaxAngularSpeed() const
424  { return dBodyGetMaxAngularSpeed(get_id()); }
425  void setMaxAngularSpeed(dReal max_speed)
426  { dBodySetMaxAngularSpeed(get_id(), max_speed); }
427 
428  bool getGyroscopicMode() const
429  { return dBodyGetGyroscopicMode(get_id()) != 0; }
430  void setGyroscopicMode(bool mode)
431  { dBodySetGyroscopicMode(get_id(), mode); }
432 
433 };
434 
435 
436 class dJointGroupSimpleIDContainer {
437 protected:
438  dJointGroupID _id;
439 
440  dJointGroupSimpleIDContainer(): _id(0) {}
441  ~dJointGroupSimpleIDContainer() { destroy(); }
442 
443  void destroy() {
444  if (_id) {
445  dJointGroupDestroy(_id);
446  _id = 0;
447  }
448  }
449 };
450 
451 class dJointGroupDynamicIDContainer: public dJointGroupSimpleIDContainer {
452 protected:
453  virtual ~dJointGroupDynamicIDContainer() {}
454 };
455 
456 template <class dJointGroupTemplateBase>
457 class dJointGroupTemplate: public dJointGroupTemplateBase {
458  // intentionally undefined, don't use these
459  dJointGroupTemplate (const dJointGroupTemplate<dJointGroupTemplateBase> &);
460  void operator= (const dJointGroupTemplate<dJointGroupTemplateBase> &);
461 
462 protected:
463  dJointGroupID get_id() const { return dJointGroupTemplateBase::_id; }
464  void set_id(dJointGroupID value) { dJointGroupTemplateBase::_id = value; }
465 
466  void destroy() { dJointGroupTemplateBase::destroy(); }
467 
468 public:
469  dJointGroupTemplate ()
470  { set_id(dJointGroupCreate(0)); }
471 
472  void create () {
473  destroy();
474  set_id(dJointGroupCreate(0));
475  }
476 
477  dJointGroupID id() const
478  { return get_id(); }
479  operator dJointGroupID() const
480  { return get_id(); }
481 
482  void empty()
483  { dJointGroupEmpty (get_id()); }
484  void clear()
485  { empty(); }
486 };
487 
488 
489 class dJointSimpleIDContainer {
490 protected:
491  dJointID _id;
492 
493  dJointSimpleIDContainer(): _id(0) {}
494  ~dJointSimpleIDContainer() { destroy(); }
495 
496  void destroy() {
497  if (_id) {
498  dJointDestroy (_id);
499  _id = 0;
500  }
501  }
502 };
503 
504 class dJointDynamicIDContainer: public dJointSimpleIDContainer {
505 protected:
506  virtual ~dJointDynamicIDContainer() {}
507 };
508 
509 template <class dJointTemplateBase, class dWorldTemplateBase, class dBodyTemplateBase>
510 class dJointTemplate: public dJointTemplateBase {
511 private:
512  // intentionally undefined, don't use these
513  dJointTemplate (const dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &) ;
514  void operator= (const dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
515 
516 protected:
517  dJointID get_id() const { return dJointTemplateBase::_id; }
518  void set_id(dJointID value) { dJointTemplateBase::_id = value; }
519 
520  void destroy() { dJointTemplateBase::destroy(); }
521 
522 protected:
523  dJointTemplate() // don't let user construct pure dJointTemplate objects
524  { }
525 
526 public:
527  dJointID id() const
528  { return get_id(); }
529  operator dJointID() const
530  { return get_id(); }
531 
532  int getNumBodies() const
533  { return dJointGetNumBodies(get_id()); }
534 
535  void attach (dBodyID body1, dBodyID body2)
536  { dJointAttach (get_id(), body1, body2); }
537  void attach (dBodyTemplate<dBodyTemplateBase, dWorldTemplateBase>& body1, dBodyTemplate<dBodyTemplateBase, dWorldTemplateBase>& body2)
538  { attach(body1.id(), body2.id()); }
539 
540  void enable()
541  { dJointEnable (get_id()); }
542  void disable()
543  { dJointDisable (get_id()); }
544  bool isEnabled() const
545  { return dJointIsEnabled (get_id()) != 0; }
546 
547  void setData (void *data)
548  { dJointSetData (get_id(), data); }
549  void *getData() const
550  { return dJointGetData (get_id()); }
551 
552  dJointType getType() const
553  { return dJointGetType (get_id()); }
554 
555  dBodyID getBody (int index) const
556  { return dJointGetBody (get_id(), index); }
557 
558  void setFeedback(dJointFeedback *fb)
559  { dJointSetFeedback(get_id(), fb); }
560  dJointFeedback *getFeedback() const
561  { return dJointGetFeedback(get_id()); }
562 
563  // If not implemented it will do nothing as describe in the doc
564  virtual void setParam (int, dReal) {};
565  virtual dReal getParam (int) const { return 0; }
566 };
567 
568 
569 template <class dJointTemplateBase, class dWorldTemplateBase, class dBodyTemplateBase>
570 class dBallJointTemplate : public dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> {
571 private:
572  // intentionally undefined, don't use these
573  dBallJointTemplate (const dBallJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
574  void operator= (const dBallJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
575 
576 protected:
577  typedef dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> dBaseTemplate;
578 
579  dJointID get_id() const { return dBaseTemplate::get_id(); }
580  void set_id(dJointID value) { dBaseTemplate::set_id(value); }
581 
582  void destroy() { dBaseTemplate::destroy(); }
583 
584 public:
585  dBallJointTemplate() { }
586  dBallJointTemplate (dWorldID world, dJointGroupID group=0)
587  { set_id(dJointCreateBall(world, group)); }
588  dBallJointTemplate (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
589  { set_id(dJointCreateBall(world.id(), group)); }
590 
591  void create (dWorldID world, dJointGroupID group=0) {
592  destroy();
593  set_id(dJointCreateBall(world, group));
594  }
595  void create (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
596  { create(world.id(), group); }
597 
598  void setAnchor (dReal x, dReal y, dReal z)
599  { dJointSetBallAnchor (get_id(), x, y, z); }
600  void setAnchor (const dVector3 a)
601  { setAnchor (a[0], a[1], a[2]); }
602  void getAnchor (dVector3 result) const
603  { dJointGetBallAnchor (get_id(), result); }
604  void getAnchor2 (dVector3 result) const
605  { dJointGetBallAnchor2 (get_id(), result); }
606  virtual void setParam (int parameter, dReal value)
607  { dJointSetBallParam (get_id(), parameter, value); }
608  virtual dReal getParam (int parameter) const
609  { return dJointGetBallParam (get_id(), parameter); }
610  // TODO: expose params through methods
611 } ;
612 
613 
614 template <class dJointTemplateBase, class dWorldTemplateBase, class dBodyTemplateBase>
615 class dHingeJointTemplate : public dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> {
616 private:
617  // intentionally undefined, don't use these
618  dHingeJointTemplate (const dHingeJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
619  void operator = (const dHingeJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
620 
621 protected:
622  typedef dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> dBaseTemplate;
623 
624  dJointID get_id() const { return dBaseTemplate::get_id(); }
625  void set_id(dJointID value) { dBaseTemplate::set_id(value); }
626 
627  void destroy() { dBaseTemplate::destroy(); }
628 
629 public:
630  dHingeJointTemplate() { }
631  dHingeJointTemplate (dWorldID world, dJointGroupID group=0)
632  { set_id(dJointCreateHinge(world, group)); }
633  dHingeJointTemplate (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
634  { set_id(dJointCreateHinge(world.id(), group)); }
635 
636  void create (dWorldID world, dJointGroupID group=0) {
637  destroy();
638  set_id(dJointCreateHinge (world, group));
639  }
640  void create (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
641  { create(world.id(), group); }
642 
643  void setAnchor (dReal x, dReal y, dReal z)
644  { dJointSetHingeAnchor (get_id(), x, y, z); }
645  void setAnchor (const dVector3 a)
646  { setAnchor (a[0], a[1], a[2]); }
647  void getAnchor (dVector3 result) const
648  { dJointGetHingeAnchor (get_id(), result); }
649  void getAnchor2 (dVector3 result) const
650  { dJointGetHingeAnchor2 (get_id(), result); }
651 
652  void setAxis (dReal x, dReal y, dReal z)
653  { dJointSetHingeAxis (get_id(), x, y, z); }
654  void setAxis (const dVector3 a)
655  { setAxis(a[0], a[1], a[2]); }
656  void getAxis (dVector3 result) const
657  { dJointGetHingeAxis (get_id(), result); }
658 
659  dReal getAngle() const
660  { return dJointGetHingeAngle (get_id()); }
661  dReal getAngleRate() const
662  { return dJointGetHingeAngleRate (get_id()); }
663 
664  virtual void setParam (int parameter, dReal value)
665  { dJointSetHingeParam (get_id(), parameter, value); }
666  virtual dReal getParam (int parameter) const
667  { return dJointGetHingeParam (get_id(), parameter); }
668  // TODO: expose params through methods
669 
670  void addTorque (dReal torque)
671  { dJointAddHingeTorque(get_id(), torque); }
672 };
673 
674 
675 template <class dJointTemplateBase, class dWorldTemplateBase, class dBodyTemplateBase>
676 class dSliderJointTemplate : public dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> {
677 private:
678  // intentionally undefined, don't use these
679  dSliderJointTemplate (const dSliderJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
680  void operator = (const dSliderJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
681 
682 protected:
683  typedef dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> dBaseTemplate;
684 
685  dJointID get_id() const { return dBaseTemplate::get_id(); }
686  void set_id(dJointID value) { dBaseTemplate::set_id(value); }
687 
688  void destroy() { dBaseTemplate::destroy(); }
689 
690 public:
691  dSliderJointTemplate() { }
692  dSliderJointTemplate (dWorldID world, dJointGroupID group=0)
693  { set_id(dJointCreateSlider(world, group)); }
694  dSliderJointTemplate (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
695  { set_id(dJointCreateSlider(world.id(), group)); }
696 
697  void create (dWorldID world, dJointGroupID group=0) {
698  destroy();
699  set_id(dJointCreateSlider(world, group));
700  }
701  void create (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
702  { create(world.id(), group); }
703 
704  void setAxis (dReal x, dReal y, dReal z)
705  { dJointSetSliderAxis (get_id(), x, y, z); }
706  void setAxis (const dVector3 a)
707  { setAxis (a[0], a[1], a[2]); }
708  void getAxis (dVector3 result) const
709  { dJointGetSliderAxis (get_id(), result); }
710 
711  dReal getPosition() const
712  { return dJointGetSliderPosition (get_id()); }
713  dReal getPositionRate() const
714  { return dJointGetSliderPositionRate (get_id()); }
715 
716  virtual void setParam (int parameter, dReal value)
717  { dJointSetSliderParam (get_id(), parameter, value); }
718  virtual dReal getParam (int parameter) const
719  { return dJointGetSliderParam (get_id(), parameter); }
720  // TODO: expose params through methods
721 
722  void addForce (dReal force)
723  { dJointAddSliderForce(get_id(), force); }
724 };
725 
726 
727 template <class dJointTemplateBase, class dWorldTemplateBase, class dBodyTemplateBase>
728 class dUniversalJointTemplate : public dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> {
729 private:
730  // intentionally undefined, don't use these
731  dUniversalJointTemplate (const dUniversalJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
732  void operator = (const dUniversalJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
733 
734 protected:
735  typedef dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> dBaseTemplate;
736 
737  dJointID get_id() const { return dBaseTemplate::get_id(); }
738  void set_id(dJointID value) { dBaseTemplate::set_id(value); }
739 
740  void destroy() { dBaseTemplate::destroy(); }
741 
742 public:
743  dUniversalJointTemplate() { }
744  dUniversalJointTemplate (dWorldID world, dJointGroupID group=0)
745  { set_id(dJointCreateUniversal(world, group)); }
746  dUniversalJointTemplate (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
747  { set_id(dJointCreateUniversal(world.id(), group)); }
748 
749  void create (dWorldID world, dJointGroupID group=0) {
750  destroy();
751  set_id(dJointCreateUniversal(world, group));
752  }
753  void create (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
754  { create(world.id(), group); }
755 
756  void setAnchor (dReal x, dReal y, dReal z)
757  { dJointSetUniversalAnchor (get_id(), x, y, z); }
758  void setAnchor (const dVector3 a)
759  { setAnchor(a[0], a[1], a[2]); }
760  void setAxis1 (dReal x, dReal y, dReal z)
761  { dJointSetUniversalAxis1 (get_id(), x, y, z); }
762  void setAxis1 (const dVector3 a)
763  { setAxis1 (a[0], a[1], a[2]); }
764  void setAxis2 (dReal x, dReal y, dReal z)
765  { dJointSetUniversalAxis2 (get_id(), x, y, z); }
766  void setAxis2 (const dVector3 a)
767  { setAxis2 (a[0], a[1], a[2]); }
768 
769  void getAnchor (dVector3 result) const
770  { dJointGetUniversalAnchor (get_id(), result); }
771  void getAnchor2 (dVector3 result) const
772  { dJointGetUniversalAnchor2 (get_id(), result); }
773  void getAxis1 (dVector3 result) const
774  { dJointGetUniversalAxis1 (get_id(), result); }
775  void getAxis2 (dVector3 result) const
776  { dJointGetUniversalAxis2 (get_id(), result); }
777 
778  virtual void setParam (int parameter, dReal value)
779  { dJointSetUniversalParam (get_id(), parameter, value); }
780  virtual dReal getParam (int parameter) const
781  { return dJointGetUniversalParam (get_id(), parameter); }
782  // TODO: expose params through methods
783 
784  void getAngles(dReal *angle1, dReal *angle2) const
785  { dJointGetUniversalAngles (get_id(), angle1, angle2); }
786 
787  dReal getAngle1() const
788  { return dJointGetUniversalAngle1 (get_id()); }
789  dReal getAngle1Rate() const
790  { return dJointGetUniversalAngle1Rate (get_id()); }
791  dReal getAngle2() const
792  { return dJointGetUniversalAngle2 (get_id()); }
793  dReal getAngle2Rate() const
794  { return dJointGetUniversalAngle2Rate (get_id()); }
795 
796  void addTorques (dReal torque1, dReal torque2)
797  { dJointAddUniversalTorques(get_id(), torque1, torque2); }
798 };
799 
800 
801 template <class dJointTemplateBase, class dWorldTemplateBase, class dBodyTemplateBase>
802 class dHinge2JointTemplate : public dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> {
803 private:
804  // intentionally undefined, don't use these
805  dHinge2JointTemplate (const dHinge2JointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
806  void operator = (const dHinge2JointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
807 
808 protected:
809  typedef dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> dBaseTemplate;
810 
811  dJointID get_id() const { return dBaseTemplate::get_id(); }
812  void set_id(dJointID value) { dBaseTemplate::set_id(value); }
813 
814  void destroy() { dBaseTemplate::destroy(); }
815 
816 public:
817  dHinge2JointTemplate() { }
818  dHinge2JointTemplate (dWorldID world, dJointGroupID group=0)
819  { set_id(dJointCreateHinge2(world, group)); }
820  dHinge2JointTemplate (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
821  { set_id(dJointCreateHinge2(world.id(), group)); }
822 
823  void create (dWorldID world, dJointGroupID group=0) {
824  destroy();
825  set_id(dJointCreateHinge2(world, group));
826  }
827  void create (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
828  { create(world.id(), group); }
829 
830  void setAnchor (dReal x, dReal y, dReal z)
831  { dJointSetHinge2Anchor (get_id(), x, y, z); }
832  void setAnchor (const dVector3 a)
833  { setAnchor(a[0], a[1], a[2]); }
834  void setAxis1 (dReal x, dReal y, dReal z)
835  { dJointSetHinge2Axis1 (get_id(), x, y, z); }
836  void setAxis1 (const dVector3 a)
837  { setAxis1 (a[0], a[1], a[2]); }
838  void setAxis2 (dReal x, dReal y, dReal z)
839  { dJointSetHinge2Axis2 (get_id(), x, y, z); }
840  void setAxis2 (const dVector3 a)
841  { setAxis2 (a[0], a[1], a[2]); }
842 
843  void getAnchor (dVector3 result) const
844  { dJointGetHinge2Anchor (get_id(), result); }
845  void getAnchor2 (dVector3 result) const
846  { dJointGetHinge2Anchor2 (get_id(), result); }
847  void getAxis1 (dVector3 result) const
848  { dJointGetHinge2Axis1 (get_id(), result); }
849  void getAxis2 (dVector3 result) const
850  { dJointGetHinge2Axis2 (get_id(), result); }
851 
852  dReal getAngle1() const
853  { return dJointGetHinge2Angle1 (get_id()); }
854  dReal getAngle1Rate() const
855  { return dJointGetHinge2Angle1Rate (get_id()); }
856  dReal getAngle2Rate() const
857  { return dJointGetHinge2Angle2Rate (get_id()); }
858 
859  virtual void setParam (int parameter, dReal value)
860  { dJointSetHinge2Param (get_id(), parameter, value); }
861  virtual dReal getParam (int parameter) const
862  { return dJointGetHinge2Param (get_id(), parameter); }
863  // TODO: expose params through methods
864 
865  void addTorques(dReal torque1, dReal torque2)
866  { dJointAddHinge2Torques(get_id(), torque1, torque2); }
867 };
868 
869 
870 template <class dJointTemplateBase, class dWorldTemplateBase, class dBodyTemplateBase>
871 class dPRJointTemplate : public dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> {
872 private:
873  // intentionally undefined, don't use these
874  dPRJointTemplate (const dPRJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
875  void operator = (const dPRJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
876 
877 protected:
878  typedef dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> dBaseTemplate;
879 
880  dJointID get_id() const { return dBaseTemplate::get_id(); }
881  void set_id(dJointID value) { dBaseTemplate::set_id(value); }
882 
883  void destroy() { dBaseTemplate::destroy(); }
884 
885 public:
886  dPRJointTemplate() { }
887  dPRJointTemplate (dWorldID world, dJointGroupID group=0)
888  { set_id(dJointCreatePR(world, group)); }
889  dPRJointTemplate (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
890  { set_id(dJointCreatePR(world.id(), group)); }
891 
892  void create (dWorldID world, dJointGroupID group=0) {
893  destroy();
894  set_id(dJointCreatePR(world, group));
895  }
896  void create (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
897  { create(world.id(), group); }
898 
899  void setAnchor (dReal x, dReal y, dReal z)
900  { dJointSetPRAnchor (get_id(), x, y, z); }
901  void setAnchor (const dVector3 a)
902  { setAnchor (a[0], a[1], a[2]); }
903  void setAxis1 (dReal x, dReal y, dReal z)
904  { dJointSetPRAxis1 (get_id(), x, y, z); }
905  void setAxis1 (const dVector3 a)
906  { setAxis1(a[0], a[1], a[2]); }
907  void setAxis2 (dReal x, dReal y, dReal z)
908  { dJointSetPRAxis2 (get_id(), x, y, z); }
909  void setAxis2 (const dVector3 a)
910  { setAxis2(a[0], a[1], a[2]); }
911 
912  void getAnchor (dVector3 result) const
913  { dJointGetPRAnchor (get_id(), result); }
914  void getAxis1 (dVector3 result) const
915  { dJointGetPRAxis1 (get_id(), result); }
916  void getAxis2 (dVector3 result) const
917  { dJointGetPRAxis2 (get_id(), result); }
918 
919  dReal getPosition() const
920  { return dJointGetPRPosition (get_id()); }
921  dReal getPositionRate() const
922  { return dJointGetPRPositionRate (get_id()); }
923 
924  dReal getAngle() const
925  { return dJointGetPRAngle (get_id()); }
926  dReal getAngleRate() const
927  { return dJointGetPRAngleRate (get_id()); }
928 
929  virtual void setParam (int parameter, dReal value)
930  { dJointSetPRParam (get_id(), parameter, value); }
931  virtual dReal getParam (int parameter) const
932  { return dJointGetPRParam (get_id(), parameter); }
933 };
934 
935 
936 
937 template <class dJointTemplateBase, class dWorldTemplateBase, class dBodyTemplateBase>
938 class dPUJointTemplate : public dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase>
939 {
940 private:
941  // intentionally undefined, don't use these
942  dPUJointTemplate (const dPUJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
943  void operator = (const dPUJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
944 
945 protected:
946  typedef dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> dBaseTemplate;
947 
948  dJointID get_id() const { return dBaseTemplate::get_id(); }
949  void set_id(dJointID value) { dBaseTemplate::set_id(value); }
950 
951  void destroy() { dBaseTemplate::destroy(); }
952 
953 public:
954  dPUJointTemplate() { }
955  dPUJointTemplate (dWorldID world, dJointGroupID group=0)
956  { set_id(dJointCreatePU(world, group)); }
957  dPUJointTemplate (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
958  { set_id(dJointCreatePU(world.id(), group)); }
959 
960  void create (dWorldID world, dJointGroupID group=0)
961  {
962  destroy();
963  set_id(dJointCreatePU(world, group));
964  }
965  void create (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
966  { create(world.id(), group); }
967 
968  void setAnchor (dReal x, dReal y, dReal z)
969  { dJointSetPUAnchor (get_id(), x, y, z); }
970  void setAnchor (const dVector3 a)
971  { setAnchor (a[0], a[1], a[2]); }
972  void setAxis1 (dReal x, dReal y, dReal z)
973  { dJointSetPUAxis1 (get_id(), x, y, z); }
974  void setAxis1 (const dVector3 a)
975  { setAxis1(a[0], a[1], a[2]); }
976  void setAxis2 (dReal x, dReal y, dReal z)
977  { dJointSetPUAxis2 (get_id(), x, y, z); }
978  void setAxis3 (dReal x, dReal y, dReal z)
979  { dJointSetPUAxis3 (get_id(), x, y, z); }
980  void setAxis3 (const dVector3 a)
981  { setAxis3(a[0], a[1], a[2]); }
982  void setAxisP (dReal x, dReal y, dReal z)
983  { dJointSetPUAxis3 (get_id(), x, y, z); }
984  void setAxisP (const dVector3 a)
985  { setAxisP(a[0], a[1], a[2]); }
986 
987  virtual void getAnchor (dVector3 result) const
988  { dJointGetPUAnchor (get_id(), result); }
989  void getAxis1 (dVector3 result) const
990  { dJointGetPUAxis1 (get_id(), result); }
991  void getAxis2 (dVector3 result) const
992  { dJointGetPUAxis2 (get_id(), result); }
993  void getAxis3 (dVector3 result) const
994  { dJointGetPUAxis3 (get_id(), result); }
995  void getAxisP (dVector3 result) const
996  { dJointGetPUAxis3 (get_id(), result); }
997 
998  dReal getAngle1() const
999  { return dJointGetPUAngle1 (get_id()); }
1000  dReal getAngle1Rate() const
1001  { return dJointGetPUAngle1Rate (get_id()); }
1002  dReal getAngle2() const
1003  { return dJointGetPUAngle2 (get_id()); }
1004  dReal getAngle2Rate() const
1005  { return dJointGetPUAngle2Rate (get_id()); }
1006 
1007  dReal getPosition() const
1008  { return dJointGetPUPosition (get_id()); }
1009  dReal getPositionRate() const
1010  { return dJointGetPUPositionRate (get_id()); }
1011 
1012  virtual void setParam (int parameter, dReal value)
1013  { dJointSetPUParam (get_id(), parameter, value); }
1014  virtual dReal getParam (int parameter) const
1015  { return dJointGetPUParam (get_id(), parameter); }
1016  // TODO: expose params through methods
1017 };
1018 
1019 
1020 
1021 
1022 
1023 template <class dJointTemplateBase, class dWorldTemplateBase, class dBodyTemplateBase>
1024 class dPistonJointTemplate : public dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase>
1025 {
1026 private:
1027  // intentionally undefined, don't use these
1028  dPistonJointTemplate (const dPistonJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
1029  void operator = (const dPistonJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
1030 
1031 protected:
1032  typedef dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> dBaseTemplate;
1033 
1034  dJointID get_id() const { return dBaseTemplate::get_id(); }
1035  void set_id(dJointID value) { dBaseTemplate::set_id(value); }
1036 
1037  void destroy() { dBaseTemplate::destroy(); }
1038 
1039 public:
1040  dPistonJointTemplate() { }
1041  dPistonJointTemplate (dWorldID world, dJointGroupID group=0)
1042  { set_id(dJointCreatePiston(world, group)); }
1043  dPistonJointTemplate (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
1044  { set_id(dJointCreatePiston(world, group)); }
1045 
1046  void create (dWorldID world, dJointGroupID group=0)
1047  {
1048  destroy();
1049  set_id(dJointCreatePiston(world, group));
1050  }
1051  void create (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
1052  { create(world.id(), group); }
1053 
1054  void setAnchor (dReal x, dReal y, dReal z)
1055  { dJointSetPistonAnchor (get_id(), x, y, z); }
1056  void setAnchor (const dVector3 a)
1057  { setAnchor (a[0], a[1], a[2]); }
1058  void getAnchor (dVector3 result) const
1059  { dJointGetPistonAnchor (get_id(), result); }
1060  void getAnchor2 (dVector3 result) const
1061  { dJointGetPistonAnchor2 (get_id(), result); }
1062 
1063  void setAxis (dReal x, dReal y, dReal z)
1064  { dJointSetPistonAxis (get_id(), x, y, z); }
1065  void setAxis (const dVector3 a)
1066  { setAxis(a[0], a[1], a[2]); }
1067  void getAxis (dVector3 result) const
1068  { dJointGetPistonAxis (get_id(), result); }
1069 
1070  dReal getPosition() const
1071  { return dJointGetPistonPosition (get_id()); }
1072  dReal getPositionRate() const
1073  { return dJointGetPistonPositionRate (get_id()); }
1074 
1075  virtual void setParam (int parameter, dReal value)
1076  { dJointSetPistonParam (get_id(), parameter, value); }
1077  virtual dReal getParam (int parameter) const
1078  { return dJointGetPistonParam (get_id(), parameter); }
1079  // TODO: expose params through methods
1080 
1081  void addForce (dReal force)
1082  { dJointAddPistonForce (get_id(), force); }
1083 };
1084 
1085 
1086 
1087 template <class dJointTemplateBase, class dWorldTemplateBase, class dBodyTemplateBase>
1088 class dFixedJointTemplate : public dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase>
1089 {
1090 private:
1091  // intentionally undefined, don't use these
1092  dFixedJointTemplate (const dFixedJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
1093  void operator = (const dFixedJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
1094 
1095 protected:
1096  typedef dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> dBaseTemplate;
1097 
1098  dJointID get_id() const { return dBaseTemplate::get_id(); }
1099  void set_id(dJointID value) { dBaseTemplate::set_id(value); }
1100 
1101  void destroy() { dBaseTemplate::destroy(); }
1102 
1103 public:
1104  dFixedJointTemplate() { }
1105  dFixedJointTemplate (dWorldID world, dJointGroupID group=0)
1106  { set_id(dJointCreateFixed(world, group)); }
1107  dFixedJointTemplate (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
1108  { set_id(dJointCreateFixed(world, group)); }
1109 
1110  void create (dWorldID world, dJointGroupID group=0) {
1111  destroy();
1112  set_id(dJointCreateFixed(world, group));
1113  }
1114  void create (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
1115  { create(world.id(), group); }
1116 
1117  void set()
1118  { dJointSetFixed (get_id()); }
1119 
1120  virtual void setParam (int parameter, dReal value)
1121  { dJointSetFixedParam (get_id(), parameter, value); }
1122 
1123  virtual dReal getParam (int parameter) const
1124  { return dJointGetFixedParam (get_id(), parameter); }
1125  // TODO: expose params through methods
1126 };
1127 
1128 
1129 template <class dJointTemplateBase, class dWorldTemplateBase, class dBodyTemplateBase>
1130 class dContactJointTemplate : public dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> {
1131 private:
1132  // intentionally undefined, don't use these
1133  dContactJointTemplate (const dContactJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
1134  void operator = (const dContactJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
1135 
1136 protected:
1137  typedef dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> dBaseTemplate;
1138 
1139  dJointID get_id() const { return dBaseTemplate::get_id(); }
1140  void set_id(dJointID value) { dBaseTemplate::set_id(value); }
1141 
1142  void destroy() { dBaseTemplate::destroy(); }
1143 
1144 public:
1145  dContactJointTemplate() { }
1146  dContactJointTemplate (dWorldID world, dJointGroupID group, dContact *contact)
1147  { set_id(dJointCreateContact(world, group, contact)); }
1148  dContactJointTemplate (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group, dContact *contact)
1149  { set_id(dJointCreateContact(world.id(), group, contact)); }
1150 
1151  void create (dWorldID world, dJointGroupID group, dContact *contact) {
1152  destroy();
1153  set_id(dJointCreateContact(world, group, contact));
1154  }
1155 
1156  void create (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group, dContact *contact)
1157  { create(world.id(), group, contact); }
1158 };
1159 
1160 
1161 template <class dJointTemplateBase, class dWorldTemplateBase, class dBodyTemplateBase>
1162 class dNullJointTemplate : public dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> {
1163 private:
1164  // intentionally undefined, don't use these
1165  dNullJointTemplate (const dNullJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
1166  void operator = (const dNullJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
1167 
1168 protected:
1169  typedef dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> dBaseTemplate;
1170 
1171  dJointID get_id() const { return dBaseTemplate::get_id(); }
1172  void set_id(dJointID value) { dBaseTemplate::set_id(value); }
1173 
1174  void destroy() { dBaseTemplate::destroy(); }
1175 
1176 public:
1177  dNullJointTemplate() { }
1178  dNullJointTemplate (dWorldID world, dJointGroupID group=0)
1179  { set_id(dJointCreateNull(world, group)); }
1180  dNullJointTemplate (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
1181  { set_id(dJointCreateNull (world.id(), group)); }
1182 
1183  void create (dWorldID world, dJointGroupID group=0) {
1184  destroy();
1185  set_id(dJointCreateNull(world, group));
1186  }
1187  void create (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
1188  { create(world.id(), group); }
1189 };
1190 
1191 
1192 template <class dJointTemplateBase, class dWorldTemplateBase, class dBodyTemplateBase>
1193 class dAMotorJointTemplate : public dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> {
1194 private:
1195  // intentionally undefined, don't use these
1196  dAMotorJointTemplate (const dAMotorJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
1197  void operator = (const dAMotorJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
1198 
1199 protected:
1200  typedef dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> dBaseTemplate;
1201 
1202  dJointID get_id() const { return dBaseTemplate::get_id(); }
1203  void set_id(dJointID value) { dBaseTemplate::set_id(value); }
1204 
1205  void destroy() { dBaseTemplate::destroy(); }
1206 
1207 public:
1208  dAMotorJointTemplate() { }
1209  dAMotorJointTemplate (dWorldID world, dJointGroupID group=0)
1210  { set_id(dJointCreateAMotor(world, group)); }
1211  dAMotorJointTemplate (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
1212  { set_id(dJointCreateAMotor(world.id(), group)); }
1213 
1214  void create (dWorldID world, dJointGroupID group=0) {
1215  destroy();
1216  set_id(dJointCreateAMotor(world, group));
1217  }
1218  void create (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
1219  { create(world.id(), group); }
1220 
1221  void setMode (int mode)
1222  { dJointSetAMotorMode (get_id(), mode); }
1223  int getMode() const
1224  { return dJointGetAMotorMode (get_id()); }
1225 
1226  void setNumAxes (int num)
1227  { dJointSetAMotorNumAxes (get_id(), num); }
1228  int getNumAxes() const
1229  { return dJointGetAMotorNumAxes (get_id()); }
1230 
1231  void setAxis (int anum, int rel, dReal x, dReal y, dReal z)
1232  { dJointSetAMotorAxis (get_id(), anum, rel, x, y, z); }
1233  void setAxis (int anum, int rel, const dVector3 a)
1234  { setAxis(anum, rel, a[0], a[1], a[2]); }
1235  void getAxis (int anum, dVector3 result) const
1236  { dJointGetAMotorAxis (get_id(), anum, result); }
1237  int getAxisRel (int anum) const
1238  { return dJointGetAMotorAxisRel (get_id(), anum); }
1239 
1240  void setAngle (int anum, dReal angle)
1241  { dJointSetAMotorAngle (get_id(), anum, angle); }
1242  dReal getAngle (int anum) const
1243  { return dJointGetAMotorAngle (get_id(), anum); }
1244  dReal getAngleRate (int anum)
1245  { return dJointGetAMotorAngleRate (get_id(), anum); }
1246 
1247  void setParam (int parameter, dReal value)
1248  { dJointSetAMotorParam (get_id(), parameter, value); }
1249  dReal getParam (int parameter) const
1250  { return dJointGetAMotorParam (get_id(), parameter); }
1251  // TODO: expose params through methods
1252 
1253  void addTorques(dReal torque1, dReal torque2, dReal torque3)
1254  { dJointAddAMotorTorques(get_id(), torque1, torque2, torque3); }
1255 };
1256 
1257 
1258 template <class dJointTemplateBase, class dWorldTemplateBase, class dBodyTemplateBase>
1259 class dLMotorJointTemplate : public dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> {
1260 private:
1261  // intentionally undefined, don't use these
1262  dLMotorJointTemplate (const dLMotorJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
1263  void operator = (const dLMotorJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> &);
1264 
1265 protected:
1266  typedef dJointTemplate<dJointTemplateBase, dWorldTemplateBase, dBodyTemplateBase> dBaseTemplate;
1267 
1268  dJointID get_id() const { return dBaseTemplate::get_id(); }
1269  void set_id(dJointID value) { dBaseTemplate::set_id(value); }
1270 
1271  void destroy() { dBaseTemplate::destroy(); }
1272 
1273 public:
1274  dLMotorJointTemplate() { }
1275  dLMotorJointTemplate (dWorldID world, dJointGroupID group=0)
1276  { set_id(dJointCreateLMotor(world, group)); }
1277  dLMotorJointTemplate (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
1278  { set_id(dJointCreateLMotor(world.id(), group)); }
1279 
1280  void create (dWorldID world, dJointGroupID group=0) {
1281  destroy();
1282  set_id(dJointCreateLMotor(world, group));
1283  }
1284  void create (dWorldTemplate<dWorldTemplateBase>& world, dJointGroupID group=0)
1285  { create(world.id(), group); }
1286 
1287  void setNumAxes (int num)
1288  { dJointSetLMotorNumAxes (get_id(), num); }
1289  int getNumAxes() const
1290  { return dJointGetLMotorNumAxes (get_id()); }
1291 
1292  void setAxis (int anum, int rel, dReal x, dReal y, dReal z)
1293  { dJointSetLMotorAxis (get_id(), anum, rel, x, y, z); }
1294  void setAxis (int anum, int rel, const dVector3 a)
1295  { setAxis(anum, rel, a[0], a[1], a[2]); }
1296  void getAxis (int anum, dVector3 result) const
1297  { dJointGetLMotorAxis (get_id(), anum, result); }
1298 
1299  void setParam (int parameter, dReal value)
1300  { dJointSetLMotorParam (get_id(), parameter, value); }
1301  dReal getParam (int parameter) const
1302  { return dJointGetLMotorParam (get_id(), parameter); }
1303  // TODO: expose params through methods
1304 };
1305 
1306 //}
1307 
1308 #if !defined(dODECPP_WORLD_TEMPLATE_BASE)
1309 
1310 #if defined(dODECPP_BODY_TEMPLATE_BASE) || defined(dODECPP_JOINTGROUP_TEMPLATE_BASE) || defined(dODECPP_JOINT_TEMPLATE_BASE)
1311 #error All the odecpp template bases must be defined or not defined together
1312 #endif
1313 
1314 #define dODECPP_WORLD_TEMPLATE_BASE dWorldDynamicIDContainer
1315 #define dODECPP_BODY_TEMPLATE_BASE dBodyDynamicIDContainer
1316 #define dODECPP_JOINTGROUP_TEMPLATE_BASE dJointGroupDynamicIDContainer
1317 #define dODECPP_JOINT_TEMPLATE_BASE dJointDynamicIDContainer
1318 
1319 #else // #if defined(dODECPP_WORLD_TEMPLATE_BASE)
1320 
1321 #if !defined(dODECPP_BODY_TEMPLATE_BASE) || !defined(dODECPP_JOINTGROUP_TEMPLATE_BASE) || !defined(dODECPP_JOINT_TEMPLATE_BASE)
1322 #error All the odecpp template bases must be defined or not defined together
1323 #endif
1324 
1325 #endif // #if defined(dODECPP_WORLD_TEMPLATE_BASE)
1326 
1327 
1328 typedef dWorldTemplate<dODECPP_WORLD_TEMPLATE_BASE> dWorld;
1329 typedef dBodyTemplate<dODECPP_BODY_TEMPLATE_BASE, dODECPP_WORLD_TEMPLATE_BASE> dBody;
1330 typedef dJointGroupTemplate<dODECPP_JOINTGROUP_TEMPLATE_BASE> dJointGroup;
1331 typedef dJointTemplate<dODECPP_JOINT_TEMPLATE_BASE, dODECPP_WORLD_TEMPLATE_BASE, dODECPP_BODY_TEMPLATE_BASE> dJoint;
1332 typedef dBallJointTemplate<dODECPP_JOINT_TEMPLATE_BASE, dODECPP_WORLD_TEMPLATE_BASE, dODECPP_BODY_TEMPLATE_BASE> dBallJoint;
1333 typedef dHingeJointTemplate<dODECPP_JOINT_TEMPLATE_BASE, dODECPP_WORLD_TEMPLATE_BASE, dODECPP_BODY_TEMPLATE_BASE> dHingeJoint;
1334 typedef dSliderJointTemplate<dODECPP_JOINT_TEMPLATE_BASE, dODECPP_WORLD_TEMPLATE_BASE, dODECPP_BODY_TEMPLATE_BASE> dSliderJoint;
1335 typedef dUniversalJointTemplate<dODECPP_JOINT_TEMPLATE_BASE, dODECPP_WORLD_TEMPLATE_BASE, dODECPP_BODY_TEMPLATE_BASE> dUniversalJoint;
1336 typedef dHinge2JointTemplate<dODECPP_JOINT_TEMPLATE_BASE, dODECPP_WORLD_TEMPLATE_BASE, dODECPP_BODY_TEMPLATE_BASE> dHinge2Joint;
1337 typedef dPRJointTemplate<dODECPP_JOINT_TEMPLATE_BASE, dODECPP_WORLD_TEMPLATE_BASE, dODECPP_BODY_TEMPLATE_BASE> dPRJoint;
1338 typedef dPUJointTemplate<dODECPP_JOINT_TEMPLATE_BASE, dODECPP_WORLD_TEMPLATE_BASE, dODECPP_BODY_TEMPLATE_BASE> dPUJoint;
1339 typedef dPistonJointTemplate<dODECPP_JOINT_TEMPLATE_BASE, dODECPP_WORLD_TEMPLATE_BASE, dODECPP_BODY_TEMPLATE_BASE> dPistonJoint;
1340 typedef dFixedJointTemplate<dODECPP_JOINT_TEMPLATE_BASE, dODECPP_WORLD_TEMPLATE_BASE, dODECPP_BODY_TEMPLATE_BASE> dFixedJoint;
1341 typedef dContactJointTemplate<dODECPP_JOINT_TEMPLATE_BASE, dODECPP_WORLD_TEMPLATE_BASE, dODECPP_BODY_TEMPLATE_BASE> dContactJoint;
1342 typedef dNullJointTemplate<dODECPP_JOINT_TEMPLATE_BASE, dODECPP_WORLD_TEMPLATE_BASE, dODECPP_BODY_TEMPLATE_BASE> dNullJoint;
1343 typedef dAMotorJointTemplate<dODECPP_JOINT_TEMPLATE_BASE, dODECPP_WORLD_TEMPLATE_BASE, dODECPP_BODY_TEMPLATE_BASE> dAMotorJoint;
1344 typedef dLMotorJointTemplate<dODECPP_JOINT_TEMPLATE_BASE, dODECPP_WORLD_TEMPLATE_BASE, dODECPP_BODY_TEMPLATE_BASE> dLMotorJoint;
1345 
1346 
1347 #endif
1348 #endif
1349 
1350 // Local variables:
1351 // mode:c++
1352 // c-basic-offset:2
1353 // End:
dReal dJointGetHinge2Angle1(dJointID)
Get angle.
void dJointGetLMotorAxis(dJointID, int anum, dVector3 result)
Get axis.
void dJointGetAMotorAxis(dJointID, int anum, dVector3 result)
Get the AMotor axes.
int dWorldStep(dWorldID w, dReal stepsize)
Step the world.
dJointGroupID dJointGroupCreate(int max_size)
Create a joint group.
const dReal * dBodyGetLinearVel(dBodyID)
Get the linear velocity of a body.
dReal dWorldGetAutoDisableTime(dWorldID)
Get auto disable time for newly created bodies.
void dJointGroupEmpty(dJointGroupID)
Empty a joint group.All joints in the joint group will be destroyed, but the joint group itself will ...
void dJointSetFeedback(dJointID, dJointFeedback *)
Sets the datastructure that is to receive the feedback.
dReal dJointGetAMotorAngle(dJointID, int anum)
Get the current angle for axis.
void dJointSetData(dJointID, void *data)
Set the user-data pointer.
dJointID dJointCreateContact(dWorldID, dJointGroupID, const dContact *)
Create a new joint of the contact type.
dReal dBodyGetAngularDamping(dBodyID b)
Get the body&#39;s angular damping scale.
void dJointAttach(dJointID, dBodyID body1, dBodyID body2)
Attach the joint to some new bodies.If the joint is already attached, it will be detached from the ol...
dReal dBodyGetAngularDampingThreshold(dBodyID b)
Get the body&#39;s angular damping threshold.
void dJointSetUniversalParam(dJointID, int parameter, dReal value)
set joint parameter
int dWorldGetQuickStepNumIterations(dWorldID)
Get the number of iterations that the QuickStep method performs per step.
Definition: contact.h:99
void dBodySetData(dBodyID, void *data)
Set the body&#39;s user-data pointer.
const dReal * dBodyGetQuaternion(dBodyID)
Get the rotation of a body.
dReal dJointGetSliderPosition(dJointID)
Get the slider linear position (i.e. the slider&#39;s extension)
dReal dJointGetPUPositionRate(dJointID)
Get the PR linear position&#39;s time derivative.
dReal dBodyGetAutoDisableAngularThreshold(dBodyID)
Get auto disable angular average threshold.
void dBodySetAutoDisableFlag(dBodyID, int do_auto_disable)
Set auto disable flag.
void dBodySetLinearDampingThreshold(dBodyID b, dReal threshold)
Set the body&#39;s linear damping threshold.
dReal dBodyGetAutoDisableLinearThreshold(dBodyID)
Get auto disable linear average threshold.
int dJointGetAMotorNumAxes(dJointID)
Get the number of angular axes that will be controlled by the AMotor.
dReal dJointGetPRPositionRate(dJointID)
Get the PR linear position&#39;s time derivative.
void dWorldSetLinearDamping(dWorldID w, dReal scale)
Set the world&#39;s linear damping scale.
void dBodyDestroy(dBodyID)
Destroy a body.
void dJointGetUniversalAngles(dJointID, dReal *angle1, dReal *angle2)
Get both angles at the same time.
void dJointDestroy(dJointID)
Destroy a joint.disconnects it from its attached bodies and removing it from the world. However, if the joint is a member of a group then this function has no effect - to destroy that joint the group must be emptied or destroyed.
int dBodyGetGravityMode(dBodyID b)
Get whether the body is influenced by the world&#39;s gravity or not.
void dBodyAddForceAtRelPos(dBodyID, dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz)
Add force at specified point in body in local coordinates.
void dJointGetPistonAnchor2(dJointID, dVector3 result)
Get the joint anchor w.r.t. body 2.
void dJointSetPistonParam(dJointID, int parameter, dReal value)
set joint parameter
dReal dWorldGetCFM(dWorldID)
Get the constraint force mixing value.
int dBodyGetFiniteRotationMode(dBodyID)
Get the way a body&#39;s orientation is updated each timestep.
void dJointGetPistonAxis(dJointID, dVector3 result)
Get the prismatic axis (This is also the rotoide axis.
const dReal * dBodyGetAngularVel(dBodyID)
Get the angular velocity of a body.
void dBodyAddRelTorque(dBodyID, dReal fx, dReal fy, dReal fz)
Add torque at centre of mass of body in coordinates relative to body.
int dJointGetAMotorAxisRel(dJointID, int anum)
Get axis.
void dWorldSetMaxAngularSpeed(dWorldID w, dReal max_speed)
Set the default maximum angular speed for new bodies.
dReal dJointGetFixedParam(dJointID, int parameter)
get joint parameter
void dWorldGetGravity(dWorldID, dVector3 gravity)
Get the gravity vector for a given world.
dReal dJointGetPRPosition(dJointID)
Get the PR linear position (i.e. the prismatic&#39;s extension)
dReal dJointGetPistonPositionRate(dJointID)
Get the piston linear position&#39;s time derivative.
void dBodyAddForce(dBodyID, dReal fx, dReal fy, dReal fz)
Add force at centre of mass of body in absolute coordinates.
int dBodyGetGyroscopicMode(dBodyID b)
Get the body&#39;s gyroscopic state.
void dWorldSetAutoDisableTime(dWorldID, dReal time)
Set auto disable time for newly created bodies.
void dJointGetUniversalAxis1(dJointID, dVector3 result)
Get axis.
void dBodySetAngularDampingThreshold(dBodyID b, dReal threshold)
Set the body&#39;s angular damping threshold.
int dAreConnected(dBodyID, dBodyID)
Utility function.
dReal dJointGetHinge2Angle1Rate(dJointID)
Get time derivative of angle.
void dJointGetPUAxis2(dJointID, dVector3 result)
Get the second axis of the Universal component of the joint.
dReal dJointGetSliderParam(dJointID, int parameter)
get joint parameter
void dJointSetPUAxis3(dJointID, dReal x, dReal y, dReal z)
set the axis for the prismatic articulation
void dBodySetDamping(dBodyID b, dReal linear_scale, dReal angular_scale)
Convenience function to set linear and angular scales at once.
dReal dJointGetLMotorParam(dJointID, int parameter)
get joint parameter
dReal dJointGetUniversalAngle2Rate(dJointID)
Get time derivative of angle.
void dJointSetPRAxis2(dJointID, dReal x, dReal y, dReal z)
set the axis for the rotoide articulation
Definition: mass.h:88
void dJointSetBallParam(dJointID, int parameter, dReal value)
Param setting for Ball joints.
void dJointGetPUAxis1(dJointID, dVector3 result)
Get the first axis of the universal component of the joint.
void dJointDisable(dJointID)
Manually disable a joint.
void dWorldSetAngularDamping(dWorldID w, dReal scale)
Set the world&#39;s angular damping scale.
void dJointSetPistonAnchor(dJointID, dReal x, dReal y, dReal z)
set the joint anchor
void dJointSetPUParam(dJointID, int parameter, dReal value)
set joint parameter
dReal dJointGetPistonPosition(dJointID)
Get the Piston linear position (i.e. the piston&#39;s extension)
void dWorldSetCFM(dWorldID, dReal cfm)
Set the global CFM (constraint force mixing) value.
dReal dWorldGetLinearDamping(dWorldID w)
Get the world&#39;s linear damping scale.
void dWorldSetContactSurfaceLayer(dWorldID, dReal depth)
Set the depth of the surface layer around all geometry objects.
void dJointGetUniversalAnchor(dJointID, dVector3 result)
Get the joint anchor point, in world coordinates.
void dJointAddHinge2Torques(dJointID joint, dReal torque1, dReal torque2)
Applies torque1 about the hinge2&#39;s axis 1, torque2 about the hinge2&#39;s axis 2.
dReal dJointGetPUAngle1(dJointID)
Get angle.
void dJointSetPistonAxis(dJointID, dReal x, dReal y, dReal z)
set the joint axis
void dBodySetFiniteRotationMode(dBodyID, int mode)
controls the way a body&#39;s orientation is updated at each timestep.
void dJointSetSliderParam(dJointID, int parameter, dReal value)
set joint parameter
void dBodySetLinearVel(dBodyID, dReal x, dReal y, dReal z)
Set the linear velocity of a body.
void dBodySetGyroscopicMode(dBodyID b, int enabled)
Enable/disable the body&#39;s gyroscopic term.
int dBodyGetAutoDisableFlag(dBodyID)
Get auto disable flag.
const dReal * dBodyGetRotation(dBodyID)
Get the rotation of a body.
void dJointSetUniversalAxis2(dJointID, dReal x, dReal y, dReal z)
set axis
int dJointIsEnabled(dJointID)
Check wether a joint is enabled.
void dBodySetPosition(dBodyID, dReal x, dReal y, dReal z)
Set position of a body.
void dJointSetHinge2Axis2(dJointID, dReal x, dReal y, dReal z)
set axis
void dJointGetUniversalAxis2(dJointID, dVector3 result)
Get axis.
int dWorldQuickStep(dWorldID w, dReal stepsize)
Quick-step the world.
void dJointSetLMotorNumAxes(dJointID, int num)
Set the number of axes that will be controlled by the LMotor.
dReal dWorldGetAutoDisableAngularThreshold(dWorldID)
Get auto disable angular threshold for newly created bodies.
void dBodySetAngularDamping(dBodyID b, dReal scale)
Set the body&#39;s angular damping scale.
void dJointGetPRAnchor(dJointID, dVector3 result)
Get the joint anchor point, in world coordinates.
void dBodyGetRelPointPos(dBodyID, dReal px, dReal py, dReal pz, dVector3 result)
Get world position of a relative point on body.
void dJointSetAMotorParam(dJointID, int parameter, dReal value)
set joint parameter
dReal dJointGetUniversalParam(dJointID, int parameter)
get joint parameter
void dBodyVectorToWorld(dBodyID, dReal px, dReal py, dReal pz, dVector3 result)
Convert from local to world coordinates.
void dJointSetHingeParam(dJointID, int parameter, dReal value)
set joint parameter
dReal dJointGetUniversalAngle2(dJointID)
Get angle.
dJointID dJointCreateLMotor(dWorldID, dJointGroupID)
Create a new joint of the L-motor type.
void dJointSetFixed(dJointID)
Call this on the fixed joint after it has been attached to remember the current desired relative offs...
void dJointSetHingeAxis(dJointID, dReal x, dReal y, dReal z)
Set hinge axis.
int dWorldGetAutoDisableFlag(dWorldID)
Get auto disable flag for newly created bodies.
void dBodySetAutoDisableSteps(dBodyID, int steps)
Set auto disable steps.
void dBodyGetRelPointVel(dBodyID, dReal px, dReal py, dReal pz, dVector3 result)
Get velocity vector in global coords of a relative point on body.
dJointID dJointCreateSlider(dWorldID, dJointGroupID)
Create a new joint of the slider type.
dJointID dBodyGetJoint(dBodyID, int index)
Return a joint attached to this body, given by index.
void dBodyGetPosRelPoint(dBodyID, dReal px, dReal py, dReal pz, dVector3 result)
takes a point in global coordinates and returns the point&#39;s position in body-relative coordinates...
dReal dWorldGetAngularDamping(dWorldID w)
Get the world&#39;s angular damping scale.
dReal dJointGetHinge2Angle2Rate(dJointID)
Get time derivative of angle.
void dJointSetHingeAnchor(dJointID, dReal x, dReal y, dReal z)
Set hinge anchor parameter.
void dWorldSetAutoDisableFlag(dWorldID, int do_auto_disable)
Set auto disable flag for newly created bodies.
const dReal * dBodyGetTorque(dBodyID)
Return the current accumulated torque vector.
void dWorldSetLinearDampingThreshold(dWorldID w, dReal threshold)
Set the world&#39;s linear damping threshold.
void dJointSetUniversalAxis1(dJointID, dReal x, dReal y, dReal z)
set axis
void dJointGetHingeAnchor(dJointID, dVector3 result)
Get the hinge anchor point, in world coordinates.
void dBodySetDynamic(dBodyID)
Set rigid body to dynamic state (default).
void dBodyGetMass(dBodyID, dMass *mass)
Get the mass of a body.
dReal dJointGetUniversalAngle1Rate(dJointID)
Get time derivative of angle.
void dWorldDestroy(dWorldID world)
Destroy a world and everything in it.
void dBodySetLinearDamping(dBodyID b, dReal scale)
Set the body&#39;s linear damping scale.
void dBodyAddForceAtPos(dBodyID, dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz)
Add force at specified point in body in global coordinates.
void dWorldSetQuickStepW(dWorldID, dReal over_relaxation)
Set the SOR over-relaxation parameter.
void dWorldImpulseToForce(dWorldID, dReal stepsize, dReal ix, dReal iy, dReal iz, dVector3 force)
Converts an impulse to a force.
void dJointAddUniversalTorques(dJointID joint, dReal torque1, dReal torque2)
Applies torque1 about the universal&#39;s axis 1, torque2 about the universal&#39;s axis 2.
dReal dJointGetUniversalAngle1(dJointID)
Get angle.
int dJointGetNumBodies(dJointID)
Return the number of bodies attached to the joint.
void dJointSetLMotorParam(dJointID, int parameter, dReal value)
set joint parameter
void dJointSetHinge2Param(dJointID, int parameter, dReal value)
set joint parameter
dReal dJointGetPUAngle2(dJointID)
Get angle.
int dBodyIsKinematic(dBodyID)
Check wether a body is in kinematic state.
void dBodySetAutoDisableTime(dBodyID, dReal time)
Set auto disable time.
int dBodyIsEnabled(dBodyID)
Check wether a body is enabled.
void dJointSetHinge2Anchor(dJointID, dReal x, dReal y, dReal z)
set anchor
int dWorldGetAutoDisableSteps(dWorldID)
Get auto disable steps for newly created bodies.
int dBodyGetNumJoints(dBodyID b)
Get the number of joints that are attached to this body.
void dJointSetSliderAxis(dJointID, dReal x, dReal y, dReal z)
set the joint axis
void dWorldSetERP(dWorldID, dReal erp)
Set the global ERP value, that controls how much error correction is performed in each time step...
void dWorldSetAngularDampingThreshold(dWorldID w, dReal threshold)
Set the world&#39;s angular damping threshold.
void dWorldSetAutoDisableAngularThreshold(dWorldID, dReal angular_threshold)
Set auto disable angular threshold for newly created bodies.
dJointID dJointCreatePiston(dWorldID, dJointGroupID)
Create a new joint of the Piston type.
void dJointEnable(dJointID)
Manually enable a joint.
dJointID dJointCreatePU(dWorldID, dJointGroupID)
Create a new joint of the PU (Prismatic and Universal) type.
void dJointSetUniversalAnchor(dJointID, dReal x, dReal y, dReal z)
set anchor
void dBodyAddRelForceAtRelPos(dBodyID, dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz)
Add force at specified point in body in local coordinates.
void dJointSetAMotorNumAxes(dJointID, int num)
set the nr of axes
dReal dJointGetPRAngle(dJointID)
Get the PR angular position (i.e. the twist between the 2 bodies)
void dBodySetForce(dBodyID b, dReal x, dReal y, dReal z)
Set the body force accumulation vector.
dReal dWorldGetLinearDampingThreshold(dWorldID w)
Get the world&#39;s linear damping threshold.
void dJointAddPistonForce(dJointID joint, dReal force)
Applies the given force in the slider&#39;s direction.
void dJointGetHinge2Axis2(dJointID, dVector3 result)
Get joint axis.
void dBodyAddRelForce(dBodyID, dReal fx, dReal fy, dReal fz)
Add force at centre of mass of body in coordinates relative to body.
void dJointGroupDestroy(dJointGroupID)
Destroy a joint group.All joints in the joint group will be destroyed.
void * dJointGetData(dJointID)
Get the user-data pointer.
dReal dJointGetHinge2Param(dJointID, int parameter)
get joint parameter
void dBodySetAutoDisableAngularThreshold(dBodyID, dReal angular_average_threshold)
Set auto disable angular average threshold.
void dBodySetGravityMode(dBodyID b, int mode)
Set whether the body is influenced by the world&#39;s gravity or not.
void dJointGetHingeAxis(dJointID, dVector3 result)
get axis
dReal dJointGetHingeParam(dJointID, int parameter)
get joint parameter
void dJointGetPRAxis2(dJointID, dVector3 result)
Get the Rotoide axis.
dJointID dJointCreateAMotor(dWorldID, dJointGroupID)
Create a new joint of the A-motor type.
void dJointGetPistonAnchor(dJointID, dVector3 result)
Get the joint anchor.
void dWorldSetQuickStepNumIterations(dWorldID, int num)
Set the number of iterations that the QuickStep method performs per step.
dReal dJointGetAMotorParam(dJointID, int parameter)
get joint parameter
void dJointSetAMotorMode(dJointID, int mode)
set mode
void dBodySetMaxAngularSpeed(dBodyID b, dReal max_speed)
Set the body&#39;s maximum angular speed.
dReal dJointGetPRParam(dJointID, int parameter)
get joint parameter
void dBodyAddTorque(dBodyID, dReal fx, dReal fy, dReal fz)
Add torque at centre of mass of body in absolute coordinates.
void dBodySetFiniteRotationAxis(dBodyID, dReal x, dReal y, dReal z)
sets the finite rotation axis for a body.
dReal dWorldGetAutoDisableLinearThreshold(dWorldID)
Get auto disable linear threshold for newly created bodies.
dReal dJointGetBallParam(dJointID, int parameter)
get joint parameter
void dJointGetHingeAnchor2(dJointID, dVector3 result)
Get the joint anchor point, in world coordinates.
dReal dJointGetHingeAngle(dJointID)
Get the hinge angle.
int dBodyGetAutoDisableSteps(dBodyID)
Get auto steps a body must be thought of as idle to disable.
dWorldID dWorldCreate(void)
Create a new, empty world and return its ID number.
void dJointSetBallAnchor(dJointID, dReal x, dReal y, dReal z)
Set the joint anchor point.The joint will try to keep this point on each body together. The input is specified in world coordinates.
void dJointGetPUAxis3(dJointID, dVector3 result)
Get the prismatic axis.
void dBodyVectorFromWorld(dBodyID, dReal px, dReal py, dReal pz, dVector3 result)
Convert from world to local coordinates.
void dBodySetAutoDisableLinearThreshold(dBodyID, dReal linear_average_threshold)
Set auto disable linear average threshold.
void dJointSetAMotorAxis(dJointID, int anum, int rel, dReal x, dReal y, dReal z)
set axis
void dBodyEnable(dBodyID)
Manually enable a body.
dJointID dJointCreatePR(dWorldID, dJointGroupID)
Create a new joint of the PR (Prismatic and Rotoide) type.
void dJointSetPUAxis2(dJointID, dReal x, dReal y, dReal z)
set the axis for the second axis or the universal articulation
dReal dJointGetPUAngle1Rate(dJointID)
void dJointSetLMotorAxis(dJointID, int anum, int rel, dReal x, dReal y, dReal z)
Set the AMotor axes.
dReal dWorldGetERP(dWorldID)
Get the error reduction parameter.
dBodyID dJointGetBody(dJointID, int index)
Return the bodies that this joint connects.
int dJointGetLMotorNumAxes(dJointID)
Get nr of axes.
dJointFeedback * dJointGetFeedback(dJointID)
Gets the datastructure that is to receive the feedback.
Definition: common.h:335
void dJointGetHinge2Anchor2(dJointID, dVector3 result)
Get the joint anchor point, in world coordinates. This returns the point on body 2. If the joint is perfectly satisfied, this will return the same value as dJointGetHinge2Anchor. If not, this value will be slightly different. This can be used, for example, to see how far the joint has come apart.
dReal dBodyGetLinearDampingThreshold(dBodyID b)
Get the body&#39;s linear damping threshold.
void dBodyGetPointVel(dBodyID, dReal px, dReal py, dReal pz, dVector3 result)
Get velocity vector in global coords of a globally specified point on a body.
void dBodyAddRelForceAtPos(dBodyID, dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz)
Add force at specified point in body in global coordinates.
void dWorldSetAutoDisableSteps(dWorldID, int steps)
Set auto disable steps for newly created bodies.
void dJointAddAMotorTorques(dJointID, dReal torque1, dReal torque2, dReal torque3)
Applies torque0 about the AMotor&#39;s axis 0, torque1 about the AMotor&#39;s axis 1, and torque2 about the A...
const dReal * dBodyGetPosition(dBodyID)
Get the position of a body.
void dWorldSetDamping(dWorldID w, dReal linear_scale, dReal angular_scale)
Convenience function to set body linear and angular scales.
void dBodySetRotation(dBodyID, const dMatrix3 R)
Set the orientation of a body.
dReal dBodyGetMaxAngularSpeed(dBodyID b)
Get the body&#39;s maximum angular speed.
dReal dJointGetPUPosition(dJointID)
Get the PU linear position (i.e. the prismatic&#39;s extension)
void dJointGetPRAxis1(dJointID, dVector3 result)
Get the prismatic axis.
void dWorldSetGravity(dWorldID, dReal x, dReal y, dReal z)
Set the world&#39;s global gravity vector.
dReal dJointGetHingeAngleRate(dJointID)
Get the hinge angle time derivative.
dReal dBodyGetAutoDisableTime(dBodyID)
Get auto disable time.
dJointID dJointCreateBall(dWorldID, dJointGroupID)
Create a new joint of the ball type.
void dJointSetPUAxis1(dJointID, dReal x, dReal y, dReal z)
set the axis for the first axis or the universal articulation
dJointID dJointCreateHinge2(dWorldID, dJointGroupID)
Create a new joint of the hinge2 type.
const dReal * dBodyGetForce(dBodyID)
Return the current accumulated force vector.
dReal dWorldGetAngularDampingThreshold(dWorldID w)
Get the world&#39;s angular damping threshold.
void dBodyGetFiniteRotationAxis(dBodyID, dVector3 result)
Get the finite rotation axis.
dBodyID dBodyCreate(dWorldID)
Create a body in given world.
int dJointGetAMotorMode(dJointID)
Get the angular motor mode.
void dJointGetSliderAxis(dJointID, dVector3 result)
Get the slider axis.
void dJointSetPRAnchor(dJointID, dReal x, dReal y, dReal z)
set anchor
void dJointAddSliderForce(dJointID joint, dReal force)
Applies the given force in the slider&#39;s direction.
dReal dJointGetPUAngle2Rate(dJointID)
void dBodySetAngularVel(dBodyID, dReal x, dReal y, dReal z)
Set the angular velocity of a body.
dReal dJointGetPUParam(dJointID, int parameter)
get joint parameter
dReal dWorldGetMaxAngularSpeed(dWorldID w)
Get the default maximum angular speed.
void dJointSetPRAxis1(dJointID, dReal x, dReal y, dReal z)
set the axis for the prismatic articulation
void dJointGetUniversalAnchor2(dJointID, dVector3 result)
Get the joint anchor point, in world coordinates.
dJointType dJointGetType(dJointID)
Get the type of the joint.
void dBodySetQuaternion(dBodyID, const dQuaternion q)
Set the orientation of a body.
void dJointGetHinge2Anchor(dJointID, dVector3 result)
Get the joint anchor point, in world coordinates.
void dJointSetPRParam(dJointID, int parameter, dReal value)
set joint parameter
void dJointAddHingeTorque(dJointID joint, dReal torque)
Applies the torque about the hinge axis.
void dBodySetMass(dBodyID, const dMass *mass)
Set the mass of a body.
void dJointGetHinge2Axis1(dJointID, dVector3 result)
Get joint axis.
void dJointSetPUAnchor(dJointID, dReal x, dReal y, dReal z)
set anchor
dReal dWorldGetQuickStepW(dWorldID)
Get the SOR over-relaxation parameter.
void dJointSetHinge2Axis1(dJointID, dReal x, dReal y, dReal z)
set axis
void * dBodyGetData(dBodyID)
Get the body&#39;s user-data pointer.
void dBodyDisable(dBodyID)
Manually disable a body.
dJointID dJointCreateFixed(dWorldID, dJointGroupID)
Create a new joint of the fixed type.
void dBodySetDampingDefaults(dBodyID b)
Resets the damping settings to the current world&#39;s settings.
dReal dWorldGetContactSurfaceLayer(dWorldID)
Get the depth of the surface layer around all geometry objects.
dReal dJointGetAMotorAngleRate(dJointID, int anum)
Get the current angle rate for axis anum.
dJointID dJointCreateUniversal(dWorldID, dJointGroupID)
Create a new joint of the universal type.
void dBodySetTorque(dBodyID b, dReal x, dReal y, dReal z)
Set the body torque accumulation vector.
dReal dJointGetSliderPositionRate(dJointID)
Get the slider linear position&#39;s time derivative.
dReal dJointGetPRAngleRate(dJointID)
Get the PR angular position&#39;s time derivative.
void dBodySetKinematic(dBodyID)
Set rigid body to kinematic state. When in kinematic state the body isn&#39;t simulated as a dynamic body...
dReal dBodyGetLinearDamping(dBodyID b)
Get the body&#39;s linear damping scale.
dJointID dJointCreateHinge(dWorldID, dJointGroupID)
Create a new joint of the hinge type.
void dJointGetPUAnchor(dJointID, dVector3 result)
Get the joint anchor point, in world coordinates.
void dWorldSetAutoDisableLinearThreshold(dWorldID, dReal linear_threshold)
Set auto disable linear threshold for newly created bodies.
dReal dJointGetPistonParam(dJointID, int parameter)
get joint parameter
void dJointSetAMotorAngle(dJointID, int anum, dReal angle)
Tell the AMotor what the current angle is along axis anum.