Open Dynamics Engine
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:
ODE_API dReal dBodyGetAngularDamping(dBodyID b)
Get the body's angular damping scale.
Definition: ode.cpp:1034
ODE_API dReal dJointGetUniversalAngle1Rate(dJointID)
Get time derivative of angle.
ODE_API dReal dJointGetAMotorAngle(dJointID, int anum)
Get the current angle for axis.
ODE_API const dReal * dBodyGetAngularVel(dBodyID)
Get the angular velocity of a body.
Definition: ode.cpp:475
ODE_API void dWorldSetAngularDamping(dWorldID w, dReal scale)
Set the world's angular damping scale.
Definition: ode.cpp:1992
ODE_API dReal dJointGetPUPositionRate(dJointID)
Get the PR linear position's time derivative.
ODE_API void dBodyAddRelTorque(dBodyID, dReal fx, dReal fy, dReal fz)
Add torque at centre of mass of body in coordinates relative to body.
Definition: ode.cpp:542
ODE_API void dJointGetPistonAnchor2(dJointID, dVector3 result)
Get the joint anchor w.r.t. body 2.
ODE_API dReal dJointGetPUAngle1Rate(dJointID)
ODE_API void dBodyDisable(dBodyID)
Manually disable a body.
Definition: ode.cpp:854
ODE_API void dJointAddHinge2Torques(dJointID joint, dReal torque1, dReal torque2)
Applies torque1 about the hinge2's axis 1, torque2 about the hinge2's axis 2.
ODE_API int dBodyGetAutoDisableSteps(dBodyID)
Get auto steps a body must be thought of as idle to disable.
Definition: ode.cpp:951
ODE_API void dBodyEnable(dBodyID)
Manually enable a body.
Definition: ode.cpp:844
ODE_API dJointID dJointCreateLMotor(dWorldID, dJointGroupID)
Create a new joint of the L-motor type.
Definition: ode.cpp:1248
ODE_API dReal dJointGetBallParam(dJointID, int parameter)
get joint parameter
ODE_API int dBodyGetAutoDisableFlag(dBodyID)
Get auto disable flag.
Definition: ode.cpp:979
ODE_API void dBodySetPosition(dBodyID, dReal x, dReal y, dReal z)
Set position of a body.
Definition: ode.cpp:345
ODE_API dReal dWorldGetAngularDamping(dWorldID w)
Get the world's angular damping scale.
Definition: ode.cpp:1986
ODE_API void dJointAddSliderForce(dJointID joint, dReal force)
Applies the given force in the slider's direction.
ODE_API dReal dJointGetUniversalAngle2(dJointID)
Get angle.
ODE_API void dBodyAddRelForce(dBodyID, dReal fx, dReal fy, dReal fz)
Add force at centre of mass of body in coordinates relative to body.
Definition: ode.cpp:527
ODE_API const dReal * dBodyGetLinearVel(dBodyID)
Get the linear velocity of a body.
Definition: ode.cpp:468
ODE_API dReal dJointGetPUParam(dJointID, int parameter)
get joint parameter
Definition: contact.h:99
ODE_API void dBodySetGyroscopicMode(dBodyID b, int enabled)
Enable/disable the body's gyroscopic term.
Definition: ode.cpp:1136
ODE_API void dBodySetAngularDampingThreshold(dBodyID b, dReal threshold)
Set the body's angular damping threshold.
Definition: ode.cpp:1076
ODE_API void dWorldSetAutoDisableSteps(dWorldID, int steps)
Set auto disable steps for newly created bodies.
Definition: ode.cpp:1906
ODE_API int dJointIsEnabled(dJointID)
Check wether a joint is enabled.
ODE_API void dBodySetAutoDisableAngularThreshold(dBodyID, dReal angular_average_threshold)
Set auto disable angular average threshold.
Definition: ode.cpp:906
ODE_API void dJointGroupDestroy(dJointGroupID)
Destroy a joint group.All joints in the joint group will be destroyed.
Definition: ode.cpp:1312
ODE_API void dJointDisable(dJointID)
Manually disable a joint.
ODE_API void dBodySetDynamic(dBodyID)
Set rigid body to dynamic state (default).
Definition: ode.cpp:824
ODE_API dReal dJointGetPUAngle2(dJointID)
Get angle.
ODE_API dReal dJointGetPRPositionRate(dJointID)
Get the PR linear position's time derivative.
ODE_API dReal dBodyGetLinearDampingThreshold(dBodyID b)
Get the body's linear damping threshold.
Definition: ode.cpp:1057
ODE_API void dJointSetAMotorNumAxes(dJointID, int num)
set the nr of axes
ODE_API void dWorldSetContactSurfaceLayer(dWorldID, dReal depth)
Set the depth of the surface layer around all geometry objects.
Definition: ode.cpp:2068
ODE_API void dBodySetFiniteRotationMode(dBodyID, int mode)
controls the way a body's orientation is updated at each timestep.
Definition: ode.cpp:759
ODE_API dReal dJointGetHinge2Angle2Rate(dJointID)
Get time derivative of angle.
ODE_API int dBodyGetNumJoints(dBodyID b)
Get the number of joints that are attached to this body.
Definition: ode.cpp:805
ODE_API dReal dBodyGetLinearDamping(dBodyID b)
Get the body's linear damping scale.
Definition: ode.cpp:1018
ODE_API void dJointSetPUAxis1(dJointID, dReal x, dReal y, dReal z)
set the axis for the first axis or the universal articulation
ODE_API void dBodyDestroy(dBodyID)
Destroy a body.
ODE_API void dWorldGetGravity(dWorldID, dVector3 gravity)
Get the gravity vector for a given world.
Definition: ode.cpp:1624
ODE_API void dBodySetAngularDamping(dBodyID b, dReal scale)
Set the body's angular damping scale.
Definition: ode.cpp:1040
ODE_API void dWorldSetGravity(dWorldID, dReal x, dReal y, dReal z)
Set the world's global gravity vector.
Definition: ode.cpp:1615
ODE_API dReal dJointGetPRAngleRate(dJointID)
Get the PR angular position's time derivative.
ODE_API dReal dJointGetUniversalAngle1(dJointID)
Get angle.
ODE_API void dJointSetHinge2Axis1(dJointID, dReal x, dReal y, dReal z)
set axis
ODE_API dReal dWorldGetAutoDisableAngularThreshold(dWorldID)
Get auto disable angular threshold for newly created bodies.
Definition: ode.cpp:1871
ODE_API void dBodySetTorque(dBodyID b, dReal x, dReal y, dReal z)
Set the body torque accumulation vector.
Definition: ode.cpp:662
ODE_API dReal dWorldGetLinearDamping(dWorldID w)
Get the world's linear damping scale.
Definition: ode.cpp:1970
ODE_API void dJointSetPistonAxis(dJointID, dReal x, dReal y, dReal z)
set the joint axis
ODE_API void dJointSetAMotorAxis(dJointID, int anum, int rel, dReal x, dReal y, dReal z)
set axis
ODE_API dReal dJointGetHingeAngle(dJointID)
Get the hinge angle.
ODE_API void dJointSetData(dJointID, void *data)
Set the user-data pointer.
ODE_API int dBodyIsKinematic(dBodyID)
Check wether a body is in kinematic state.
Definition: ode.cpp:838
ODE_API void dJointGetPUAxis1(dJointID, dVector3 result)
Get the first axis of the universal component of the joint.
ODE_API dJointID dJointCreatePR(dWorldID, dJointGroupID)
Create a new joint of the PR (Prismatic and Rotoide) type.
Definition: ode.cpp:1210
ODE_API void dWorldDestroy(dWorldID world)
Destroy a world and everything in it.
ODE_API dReal dJointGetPUPosition(dJointID)
Get the PU linear position (i.e. the prismatic's extension)
ODE_API int dWorldGetAutoDisableFlag(dWorldID)
Get auto disable flag for newly created bodies.
Definition: ode.cpp:1927
ODE_API void dBodySetDampingDefaults(dBodyID b)
Resets the damping settings to the current world's settings.
Definition: ode.cpp:1082
ODE_API void dJointGetPistonAnchor(dJointID, dVector3 result)
Get the joint anchor.
ODE_API dReal dWorldGetAutoDisableTime(dWorldID)
Get auto disable time for newly created bodies.
Definition: ode.cpp:1913
ODE_API dReal dJointGetPRPosition(dJointID)
Get the PR linear position (i.e. the prismatic's extension)
ODE_API const dReal * dBodyGetForce(dBodyID)
Return the current accumulated force vector.
Definition: ode.cpp:639
ODE_API void dJointGetUniversalAxis2(dJointID, dVector3 result)
Get axis.
ODE_API dJointType dJointGetType(dJointID)
Get the type of the joint.
ODE_API void dJointSetUniversalAnchor(dJointID, dReal x, dReal y, dReal z)
set anchor
ODE_API void * dJointGetData(dJointID)
Get the user-data pointer.
ODE_API dJointGroupID dJointGroupCreate(int max_size)
Create a joint group.
Definition: ode.cpp:1304
ODE_API dJointID dJointCreateSlider(dWorldID, dJointGroupID)
Create a new joint of the slider type.
Definition: ode.cpp:1179
ODE_API void dBodySetLinearVel(dBodyID, dReal x, dReal y, dReal z)
Set the linear velocity of a body.
Definition: ode.cpp:389
ODE_API void dJointSetPRParam(dJointID, int parameter, dReal value)
set joint parameter
Definition: mass.h:88
ODE_API void dJointSetHingeAxis(dJointID, dReal x, dReal y, dReal z)
Set hinge axis.
ODE_API 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.
Definition: ode.cpp:617
ODE_API void dJointGetHingeAnchor(dJointID, dVector3 result)
Get the hinge anchor point, in world coordinates.
ODE_API dJointID dJointCreateUniversal(dWorldID, dJointGroupID)
Create a new joint of the universal type.
Definition: ode.cpp:1204
ODE_API void dJointGetUniversalAxis1(dJointID, dVector3 result)
Get axis.
ODE_API dReal dBodyGetAutoDisableLinearThreshold(dBodyID)
Get auto disable linear average threshold.
Definition: ode.cpp:885
ODE_API 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.
Definition: ode.cpp:704
ODE_API dReal dJointGetHingeParam(dJointID, int parameter)
get joint parameter
ODE_API void dWorldSetAutoDisableTime(dWorldID, dReal time)
Set auto disable time for newly created bodies.
Definition: ode.cpp:1920
ODE_API void dJointSetUniversalAxis1(dJointID, dReal x, dReal y, dReal z)
set axis
ODE_API void dJointSetAMotorMode(dJointID, int mode)
set mode
ODE_API void dJointSetHingeAnchor(dJointID, dReal x, dReal y, dReal z)
Set hinge anchor parameter.
ODE_API void dBodySetQuaternion(dBodyID, const dQuaternion q)
Set the orientation of a body.
Definition: ode.cpp:373
ODE_API void dBodyGetFiniteRotationAxis(dBodyID, dVector3 result)
Get the finite rotation axis.
Definition: ode.cpp:796
ODE_API void dWorldSetERP(dWorldID, dReal erp)
Set the global ERP value, that controls how much error correction is performed in each time step...
Definition: ode.cpp:1633
ODE_API void dWorldSetQuickStepW(dWorldID, dReal over_relaxation)
Set the SOR over-relaxation parameter.
Definition: ode.cpp:2040
Definition: ode/src/objects.h:161
ODE_API void dJointSetPistonParam(dJointID, int parameter, dReal value)
set joint parameter
ODE_API 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...
ODE_API dReal dJointGetUniversalAngle2Rate(dJointID)
Get time derivative of angle.
ODE_API void dBodySetForce(dBodyID b, dReal x, dReal y, dReal z)
Set the body force accumulation vector.
Definition: ode.cpp:653
ODE_API void dJointGetHingeAnchor2(dJointID, dVector3 result)
Get the joint anchor point, in world coordinates.
ODE_API void dBodySetLinearDamping(dBodyID b, dReal scale)
Set the body's linear damping scale.
Definition: ode.cpp:1024
ODE_API void dBodySetDamping(dBodyID b, dReal linear_scale, dReal angular_scale)
Convenience function to set linear and angular scales at once.
Definition: ode.cpp:1050
ODE_API int dJointGetLMotorNumAxes(dJointID)
Get nr of axes.
ODE_API dReal dWorldGetCFM(dWorldID)
Get the constraint force mixing value.
Definition: ode.cpp:1654
ODE_API dReal dWorldGetERP(dWorldID)
Get the error reduction parameter.
Definition: ode.cpp:1640
ODE_API 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.
ODE_API void dJointAddAMotorTorques(dJointID, dReal torque1, dReal torque2, dReal torque3)
Applies torque0 about the AMotor's axis 0, torque1 about the AMotor's axis 1, and torque2 about the A...
ODE_API void dBodyVectorToWorld(dBodyID, dReal px, dReal py, dReal pz, dVector3 result)
Convert from local to world coordinates.
Definition: ode.cpp:733
ODE_API dJointID dJointCreatePiston(dWorldID, dJointGroupID)
Create a new joint of the Piston type.
Definition: ode.cpp:1222
ODE_API void dBodyGetPosRelPoint(dBodyID, dReal px, dReal py, dReal pz, dVector3 result)
takes a point in global coordinates and returns the point's position in body-relative coordinates...
Definition: ode.cpp:720
ODE_API void dBodyGetRelPointPos(dBodyID, dReal px, dReal py, dReal pz, dVector3 result)
Get world position of a relative point on body.
Definition: ode.cpp:671
ODE_API void dJointSetBallParam(dJointID, int parameter, dReal value)
Param setting for Ball joints.
ODE_API void dJointGetSliderAxis(dJointID, dVector3 result)
Get the slider axis.
ODE_API void dBodyAddTorque(dBodyID, dReal fx, dReal fy, dReal fz)
Add torque at centre of mass of body in absolute coordinates.
Definition: ode.cpp:518
ODE_API int dWorldGetQuickStepNumIterations(dWorldID)
Get the number of iterations that the QuickStep method performs per step.
Definition: ode.cpp:2033
ODE_API void dJointSetUniversalParam(dJointID, int parameter, dReal value)
set joint parameter
ODE_API void * dBodyGetData(dBodyID)
Get the body's user-data pointer.
Definition: ode.cpp:338
ODE_API void dBodySetGravityMode(dBodyID b, int mode)
Set whether the body is influenced by the world's gravity or not.
Definition: ode.cpp:868
ODE_API void dBodyVectorFromWorld(dBodyID, dReal px, dReal py, dReal pz, dVector3 result)
Convert from world to local coordinates.
Definition: ode.cpp:746
ODE_API void dJointSetPistonAnchor(dJointID, dReal x, dReal y, dReal z)
set the joint anchor
ODE_API void dJointSetFeedback(dJointID, dJointFeedback *)
Sets the datastructure that is to receive the feedback.
ODE_API void dJointSetAMotorAngle(dJointID, int anum, dReal angle)
Tell the AMotor what the current angle is along axis anum.
ODE_API 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.
Definition: ode.cpp:596
ODE_API dReal dJointGetPRAngle(dJointID)
Get the PR angular position (i.e. the twist between the 2 bodies)
ODE_API dReal dJointGetSliderPosition(dJointID)
Get the slider linear position (i.e. the slider's extension)
ODE_API dReal dJointGetLMotorParam(dJointID, int parameter)
get joint parameter
ODE_API dReal dBodyGetAngularDampingThreshold(dBodyID b)
Get the body's angular damping threshold.
Definition: ode.cpp:1070
ODE_API void dBodyGetRelPointVel(dBodyID, dReal px, dReal py, dReal pz, dVector3 result)
Get velocity vector in global coords of a relative point on body.
Definition: ode.cpp:687
ODE_API dReal dWorldGetAutoDisableLinearThreshold(dWorldID)
Get auto disable linear threshold for newly created bodies.
Definition: ode.cpp:1857
ODE_API void dBodySetMaxAngularSpeed(dBodyID b, dReal max_speed)
Set the body's maximum angular speed.
Definition: ode.cpp:1099
ODE_API void dJointGetPRAnchor(dJointID, dVector3 result)
Get the joint anchor point, in world coordinates.
ODE_API int dJointGetAMotorMode(dJointID)
Get the angular motor mode.
ODE_API dReal dJointGetAMotorParam(dJointID, int parameter)
get joint parameter
ODE_API void dJointSetPUParam(dJointID, int parameter, dReal value)
set joint parameter
ODE_API void dJointSetHinge2Anchor(dJointID, dReal x, dReal y, dReal z)
set anchor
ODE_API dJointID dJointCreateContact(dWorldID, dJointGroupID, const dContact *)
Create a new joint of the contact type.
Definition: ode.cpp:1186
ODE_API dReal dJointGetSliderParam(dJointID, int parameter)
get joint parameter
ODE_API dReal dJointGetHinge2Param(dJointID, int parameter)
get joint parameter
ODE_API void dBodySetAutoDisableFlag(dBodyID, int do_auto_disable)
Set auto disable flag.
Definition: ode.cpp:986
ODE_API void dJointSetHinge2Axis2(dJointID, dReal x, dReal y, dReal z)
set axis
ODE_API int dJointGetAMotorNumAxes(dJointID)
Get the number of angular axes that will be controlled by the AMotor.
ODE_API dReal dJointGetAMotorAngleRate(dJointID, int anum)
Get the current angle rate for axis anum.
ODE_API void dWorldSetQuickStepNumIterations(dWorldID, int num)
Set the number of iterations that the QuickStep method performs per step.
Definition: ode.cpp:2026
ODE_API dReal dWorldGetQuickStepW(dWorldID)
Get the SOR over-relaxation parameter.
Definition: ode.cpp:2047
Definition: ode/src/objects.h:131
ODE_API int dWorldStep(dWorldID w, dReal stepsize)
Step the world.
Definition: ode.cpp:1803
ODE_API void dWorldSetLinearDamping(dWorldID w, dReal scale)
Set the world's linear damping scale.
Definition: ode.cpp:1976
ODE_API dReal dJointGetFixedParam(dJointID, int parameter)
get joint parameter
ODE_API void dBodyAddForce(dBodyID, dReal fx, dReal fy, dReal fz)
Add force at centre of mass of body in absolute coordinates.
Definition: ode.cpp:509
ODE_API int dWorldQuickStep(dWorldID w, dReal stepsize)
Quick-step the world.
Definition: ode.cpp:1822
ODE_API int dBodyGetFiniteRotationMode(dBodyID)
Get the way a body's orientation is updated each timestep.
Definition: ode.cpp:789
ODE_API void dBodySetLinearDampingThreshold(dBodyID b, dReal threshold)
Set the body's linear damping threshold.
Definition: ode.cpp:1063
ODE_API void dJointGetUniversalAnchor2(dJointID, dVector3 result)
Get the joint anchor point, in world coordinates.
ODE_API void dJointGetPUAnchor(dJointID, dVector3 result)
Get the joint anchor point, in world coordinates.
ODE_API dJointFeedback * dJointGetFeedback(dJointID)
Gets the datastructure that is to receive the feedback.
ODE_API void dJointSetPRAnchor(dJointID, dReal x, dReal y, dReal z)
set anchor
ODE_API void dJointGetPRAxis1(dJointID, dVector3 result)
Get the prismatic axis.
ODE_API void dBodySetMass(dBodyID, const dMass *mass)
Set the mass of a body.
Definition: ode.cpp:482
ODE_API void dJointAddPistonForce(dJointID joint, dReal force)
Applies the given force in the slider's direction.
ODE_API void dJointGetAMotorAxis(dJointID, int anum, dVector3 result)
Get the AMotor axes.
ODE_API dReal dJointGetSliderPositionRate(dJointID)
Get the slider linear position's time derivative.
ODE_API void dJointGetHinge2Anchor(dJointID, dVector3 result)
Get the joint anchor point, in world coordinates.
ODE_API 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.
Definition: ode.cpp:575
ODE_API dJointID dJointCreateHinge2(dWorldID, dJointGroupID)
Create a new joint of the hinge2 type.
Definition: ode.cpp:1197
ODE_API void dJointEnable(dJointID)
Manually enable a joint.
ODE_API dReal dJointGetHingeAngleRate(dJointID)
Get the hinge angle time derivative.
ODE_API int dJointGetAMotorAxisRel(dJointID, int anum)
Get axis.
ODE_API void dJointSetFixed(dJointID)
Call this on the fixed joint after it has been attached to remember the current desired relative offs...
ODE_API void dJointAddUniversalTorques(dJointID joint, dReal torque1, dReal torque2)
Applies torque1 about the universal's axis 1, torque2 about the universal's axis 2.
ODE_API dReal dWorldGetLinearDampingThreshold(dWorldID w)
Get the world's linear damping threshold.
Definition: ode.cpp:1946
ODE_API void dJointSetPRAxis1(dJointID, dReal x, dReal y, dReal z)
set the axis for the prismatic articulation
ODE_API dReal dBodyGetAutoDisableTime(dBodyID)
Get auto disable time.
Definition: ode.cpp:965
ODE_API void dBodySetFiniteRotationAxis(dBodyID, dReal x, dReal y, dReal z)
sets the finite rotation axis for a body.
Definition: ode.cpp:773
ODE_API void dBodyGetMass(dBodyID, dMass *mass)
Get the mass of a body.
Definition: ode.cpp:502
ODE_API void dBodySetKinematic(dBodyID)
Set rigid body to kinematic state. When in kinematic state the body isn't simulated as a dynamic body...
Definition: ode.cpp:831
ODE_API dReal dWorldGetAngularDampingThreshold(dWorldID w)
Get the world's angular damping threshold.
Definition: ode.cpp:1958
ODE_API void dJointGetPistonAxis(dJointID, dVector3 result)
Get the prismatic axis (This is also the rotoide axis.
ODE_API dJointID dJointCreateHinge(dWorldID, dJointGroupID)
Create a new joint of the hinge type.
Definition: ode.cpp:1172
ODE_API void dJointSetAMotorParam(dJointID, int parameter, dReal value)
set joint parameter
ODE_API int dWorldGetAutoDisableSteps(dWorldID)
Get auto disable steps for newly created bodies.
Definition: ode.cpp:1899
ODE_API void dJointGetLMotorAxis(dJointID, int anum, dVector3 result)
Get axis.
ODE_API void dJointGroupEmpty(dJointGroupID)
Empty a joint group.All joints in the joint group will be destroyed, but the joint group itself will ...
Definition: ode.cpp:1319
ODE_API void dJointSetPUAxis3(dJointID, dReal x, dReal y, dReal z)
set the axis for the prismatic articulation
ODE_API void dJointSetLMotorNumAxes(dJointID, int num)
Set the number of axes that will be controlled by the LMotor.
ODE_API void dJointGetPUAxis3(dJointID, dVector3 result)
Get the prismatic axis.
ODE_API dJointID dJointCreatePU(dWorldID, dJointGroupID)
Create a new joint of the PU (Prismatic and Universal) type.
Definition: ode.cpp:1216
ODE_API const dReal * dBodyGetTorque(dBodyID)
Return the current accumulated torque vector.
Definition: ode.cpp:646
ODE_API void dJointGetPRAxis2(dJointID, dVector3 result)
Get the Rotoide axis.
ODE_API dJointID dJointCreateFixed(dWorldID, dJointGroupID)
Create a new joint of the fixed type.
Definition: ode.cpp:1228
ODE_API void dWorldSetAutoDisableAngularThreshold(dWorldID, dReal angular_threshold)
Set auto disable angular threshold for newly created bodies.
Definition: ode.cpp:1878
ODE_API void dJointSetLMotorAxis(dJointID, int anum, int rel, dReal x, dReal y, dReal z)
Set the AMotor axes.
ODE_API dReal dJointGetPRParam(dJointID, int parameter)
get joint parameter
ODE_API dReal dJointGetUniversalParam(dJointID, int parameter)
get joint parameter
ODE_API dJointID dJointCreateAMotor(dWorldID, dJointGroupID)
Create a new joint of the A-motor type.
Definition: ode.cpp:1242
Definition: common.h:335
ODE_API void dBodySetAutoDisableSteps(dBodyID, int steps)
Set auto disable steps.
Definition: ode.cpp:958
ODE_API void dJointSetPRAxis2(dJointID, dReal x, dReal y, dReal z)
set the axis for the rotoide articulation
ODE_API const dReal * dBodyGetRotation(dBodyID)
Get the rotation of a body.
Definition: ode.cpp:424
ODE_API void dWorldSetAutoDisableLinearThreshold(dWorldID, dReal linear_threshold)
Set auto disable linear threshold for newly created bodies.
Definition: ode.cpp:1864
ODE_API void dJointGetHinge2Axis2(dJointID, dVector3 result)
Get joint axis.
ODE_API void dJointGetHinge2Axis1(dJointID, dVector3 result)
Get joint axis.
ODE_API dReal dJointGetHinge2Angle1Rate(dJointID)
Get time derivative of angle.
ODE_API int dAreConnected(dBodyID, dBodyID)
Utility function.
Definition: ode.cpp:1547
ODE_API void dJointSetHinge2Param(dJointID, int parameter, dReal value)
set joint parameter
ODE_API dBodyID dJointGetBody(dJointID, int index)
Return the bodies that this joint connects.
ODE_API 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.
ODE_API dReal dJointGetPistonPositionRate(dJointID)
Get the piston linear position's time derivative.
ODE_API void dBodySetData(dBodyID, void *data)
Set the body's user-data pointer.
Definition: ode.cpp:331
ODE_API void dBodySetAutoDisableLinearThreshold(dBodyID, dReal linear_average_threshold)
Set auto disable linear average threshold.
Definition: ode.cpp:892
ODE_API void dWorldImpulseToForce(dWorldID, dReal stepsize, dReal ix, dReal iy, dReal iz, dVector3 force)
Converts an impulse to a force.
Definition: ode.cpp:1842
ODE_API void dBodySetAngularVel(dBodyID, dReal x, dReal y, dReal z)
Set the angular velocity of a body.
Definition: ode.cpp:398
ODE_API void dBodySetAutoDisableTime(dBodyID, dReal time)
Set auto disable time.
Definition: ode.cpp:972
ODE_API void dJointSetSliderParam(dJointID, int parameter, dReal value)
set joint parameter
ODE_API void dJointSetUniversalAxis2(dJointID, dReal x, dReal y, dReal z)
set axis
ODE_API dJointID dJointCreateBall(dWorldID, dJointGroupID)
Create a new joint of the ball type.
Definition: ode.cpp:1165
ODE_API dReal dJointGetPistonParam(dJointID, int parameter)
get joint parameter
ODE_API 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.
ODE_API void dWorldSetLinearDampingThreshold(dWorldID w, dReal threshold)
Set the world's linear damping threshold.
Definition: ode.cpp:1952
ODE_API void dJointSetPUAxis2(dJointID, dReal x, dReal y, dReal z)
set the axis for the second axis or the universal articulation
ODE_API dReal dJointGetPistonPosition(dJointID)
Get the Piston linear position (i.e. the piston's extension)
ODE_API dReal dJointGetPUAngle1(dJointID)
Get angle.
ODE_API void dJointSetPUAnchor(dJointID, dReal x, dReal y, dReal z)
set anchor
ODE_API int dBodyGetGravityMode(dBodyID b)
Get whether the body is influenced by the world's gravity or not.
Definition: ode.cpp:876
ODE_API dReal dJointGetHinge2Angle1(dJointID)
Get angle.
ODE_API dReal dBodyGetMaxAngularSpeed(dBodyID b)
Get the body's maximum angular speed.
Definition: ode.cpp:1093
ODE_API void dJointSetSliderAxis(dJointID, dReal x, dReal y, dReal z)
set the joint axis
ODE_API void dJointGetHingeAxis(dJointID, dVector3 result)
get axis
ODE_API void dWorldSetDamping(dWorldID w, dReal linear_scale, dReal angular_scale)
Convenience function to set body linear and angular scales.
Definition: ode.cpp:2002
ODE_API void dJointGetUniversalAngles(dJointID, dReal *angle1, dReal *angle2)
Get both angles at the same time.
ODE_API void dBodySetRotation(dBodyID, const dMatrix3 R)
Set the orientation of a body.
Definition: ode.cpp:358
ODE_API void dJointSetHingeParam(dJointID, int parameter, dReal value)
set joint parameter
ODE_API void dWorldSetAngularDampingThreshold(dWorldID w, dReal threshold)
Set the world's angular damping threshold.
Definition: ode.cpp:1964
ODE_API void dJointSetLMotorParam(dJointID, int parameter, dReal value)
set joint parameter
ODE_API void dJointAddHingeTorque(dJointID joint, dReal torque)
Applies the torque about the hinge axis.
ODE_API dReal dBodyGetAutoDisableAngularThreshold(dBodyID)
Get auto disable angular average threshold.
Definition: ode.cpp:899
ODE_API dWorldID dWorldCreate(void)
Create a new, empty world and return its ID number.
Definition: ode.cpp:1571
ODE_API dReal dJointGetPUAngle2Rate(dJointID)
ODE_API void dWorldSetAutoDisableFlag(dWorldID, int do_auto_disable)
Set auto disable flag for newly created bodies.
Definition: ode.cpp:1934
ODE_API dBodyID dBodyCreate(dWorldID)
Create a body in given world.
ODE_API void dWorldSetCFM(dWorldID, dReal cfm)
Set the global CFM (constraint force mixing) value.
Definition: ode.cpp:1647
ODE_API dJointID dBodyGetJoint(dBodyID, int index)
Return a joint attached to this body, given by index.
Definition: ode.cpp:814
ODE_API int dBodyIsEnabled(dBodyID)
Check wether a body is enabled.
Definition: ode.cpp:861
ODE_API dReal dWorldGetContactSurfaceLayer(dWorldID)
Get the depth of the surface layer around all geometry objects.
Definition: ode.cpp:2075
ODE_API int dBodyGetGyroscopicMode(dBodyID b)
Get the body's gyroscopic state.
Definition: ode.cpp:1130
ODE_API int dJointGetNumBodies(dJointID)
Return the number of bodies attached to the joint.
ODE_API const dReal * dBodyGetPosition(dBodyID)
Get the position of a body.
Definition: ode.cpp:407
ODE_API dReal dWorldGetMaxAngularSpeed(dWorldID w)
Get the default maximum angular speed.
Definition: ode.cpp:2009
ODE_API void dWorldSetMaxAngularSpeed(dWorldID w, dReal max_speed)
Set the default maximum angular speed for new bodies.
Definition: ode.cpp:2015
ODE_API const dReal * dBodyGetQuaternion(dBodyID)
Get the rotation of a body.
Definition: ode.cpp:450
ODE_API void dJointGetUniversalAnchor(dJointID, dVector3 result)
Get the joint anchor point, in world coordinates.
ODE_API 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.
Definition: ode.cpp:557
ODE_API void dJointGetPUAxis2(dJointID, dVector3 result)
Get the second axis of the Universal component of the joint.