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