Panda3D
 All Classes Functions Variables Enumerations
odeUniversalJoint.I
1 // Filename: odeUniversalJoint.I
2 // Created by: joswilso (27Dec06)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 INLINE void OdeUniversalJoint::
16 set_anchor(dReal x, dReal y, dReal z) {
17  dJointSetUniversalAnchor(_id, x, y, z);
18 }
19 
20 INLINE void OdeUniversalJoint::
21 set_anchor(const LVecBase3f &anchor) {
22  dJointSetUniversalAnchor(_id, anchor[0], anchor[1], anchor[2]);
23 }
24 
25 INLINE void OdeUniversalJoint::
26 set_axis1(dReal x, dReal y, dReal z) {
27  dJointSetUniversalAxis1(_id, x, y, z);
28 }
29 
30 INLINE void OdeUniversalJoint::
31 set_axis1(const LVecBase3f &axis) {
32  dJointSetUniversalAxis1(_id, axis[0], axis[1], axis[2]);
33 }
34 
35 INLINE void OdeUniversalJoint::
36 set_axis2(dReal x, dReal y, dReal z) {
37  dJointSetUniversalAxis2(_id, x, y, z);
38 }
39 
40 INLINE void OdeUniversalJoint::
41 set_axis2(const LVecBase3f &axis) {
42  dJointSetUniversalAxis2(_id, axis[0], axis[1], axis[2]);
43 }
44 
45 INLINE void OdeUniversalJoint::
46 add_torques(dReal torque1, dReal torque2) {
47  dJointAddUniversalTorques(_id, torque1, torque2);
48 }
49 
50 INLINE LVecBase3f OdeUniversalJoint::
51 get_anchor() const {
52  dVector3 result;
53  dJointGetUniversalAnchor(_id, result);
54  return LVecBase3f(result[0], result[1], result[2]);
55 }
56 
57 INLINE LVecBase3f OdeUniversalJoint::
58 get_anchor2() const {
59  dVector3 result;
60  dJointGetUniversalAnchor2(_id, result);
61  return LVecBase3f(result[0], result[1], result[2]);
62 }
63 
64 INLINE LVecBase3f OdeUniversalJoint::
65 get_axis1() const {
66  dVector3 result;
67  dJointGetUniversalAxis1(_id, result);
68  return LVecBase3f(result[0], result[1], result[2]);
69 }
70 
71 INLINE LVecBase3f OdeUniversalJoint::
72 get_axis2() const {
73  dVector3 result;
74  dJointGetUniversalAxis2(_id, result);
75  return LVecBase3f(result[0], result[1], result[2]);
76 }
77 
78 INLINE dReal OdeUniversalJoint::
79 get_angle1() const {
80  return dJointGetUniversalAngle1(_id);
81 }
82 
83 INLINE dReal OdeUniversalJoint::
84 get_angle2() const {
85  return dJointGetUniversalAngle2(_id);
86 }
87 
88 INLINE dReal OdeUniversalJoint::
89 get_angle1_rate() const {
90  return dJointGetUniversalAngle1Rate(_id);
91 }
92 
93 INLINE dReal OdeUniversalJoint::
94 get_angle2_rate() const {
95  return dJointGetUniversalAngle2Rate(_id);
96 }
97 
98 
99 INLINE void OdeUniversalJoint::
100 set_param_lo_stop(int axis, dReal val) {
101  nassertv( _id != 0 );
102  nassertv( 0 <= axis && axis <= 1 );
103  if ( axis == 0 ) {
104  dJointSetUniversalParam(_id, dParamLoStop, val);
105  } else if ( axis == 1 ) {
106  dJointSetUniversalParam(_id, dParamLoStop2, val);
107  }
108 }
109 
110 INLINE void OdeUniversalJoint::
111 set_param_hi_stop(int axis, dReal val) {
112  nassertv( _id != 0 );
113  nassertv( 0 <= axis && axis <= 1 );
114  if ( axis == 0 ) {
115  dJointSetUniversalParam(_id, dParamHiStop, val);
116  } else if ( axis == 1 ) {
117  dJointSetUniversalParam(_id, dParamHiStop2, val);
118  }
119 }
120 
121 INLINE void OdeUniversalJoint::
122 set_param_vel(int axis, dReal val) {
123  nassertv( _id != 0 );
124  nassertv( 0 <= axis && axis <= 1 );
125  if ( axis == 0 ) {
126  dJointSetUniversalParam(_id, dParamVel, val);
127  } else if ( axis == 1 ) {
128  dJointSetUniversalParam(_id, dParamVel2, val);
129  }
130 }
131 
132 INLINE void OdeUniversalJoint::
133 set_param_f_max(int axis, dReal val) {
134  nassertv( _id != 0 );
135  nassertv( 0 <= axis && axis <= 1 );
136  if ( axis == 0 ) {
137  dJointSetUniversalParam(_id, dParamFMax, val);
138  } else if ( axis == 1 ) {
139  dJointSetUniversalParam(_id, dParamFMax2, val);
140  }
141 }
142 
143 INLINE void OdeUniversalJoint::
144 set_param_fudge_factor(int axis, dReal val) {
145  nassertv( _id != 0 );
146  nassertv( 0 <= axis && axis <= 1 );
147  if ( axis == 0 ) {
148  dJointSetUniversalParam(_id, dParamFudgeFactor, val);
149  } else if ( axis == 1 ) {
150  dJointSetUniversalParam(_id, dParamFudgeFactor2, val);
151  }
152 }
153 
154 INLINE void OdeUniversalJoint::
155 set_param_bounce(int axis, dReal val) {
156  nassertv( _id != 0 );
157  nassertv( 0 <= axis && axis <= 1 );
158  if ( axis == 0 ) {
159  dJointSetUniversalParam(_id, dParamBounce, val);
160  } else if ( axis == 1 ) {
161  dJointSetUniversalParam(_id, dParamBounce2, val);
162  }
163 }
164 
165 INLINE void OdeUniversalJoint::
166 set_param_CFM(int axis, dReal val) {
167  nassertv( _id != 0 );
168  nassertv( 0 <= axis && axis <= 1 );
169  if ( axis == 0 ) {
170  dJointSetUniversalParam(_id, dParamCFM, val);
171  } else if ( axis == 1 ) {
172  dJointSetUniversalParam(_id, dParamCFM2, val);
173  }
174 }
175 
176 INLINE void OdeUniversalJoint::
177 set_param_stop_ERP(int axis, dReal val) {
178  nassertv( _id != 0 );
179  nassertv( 0 <= axis && axis <= 1 );
180  if ( axis == 0 ) {
181  dJointSetUniversalParam(_id, dParamStopERP, val);
182  } else if ( axis == 1 ) {
183  dJointSetUniversalParam(_id, dParamStopERP2, val);
184  }
185 }
186 
187 INLINE void OdeUniversalJoint::
188 set_param_stop_CFM(int axis, dReal val) {
189  nassertv( _id != 0 );
190  nassertv( 0 <= axis && axis <= 1 );
191  if ( axis == 0 ) {
192  dJointSetUniversalParam(_id, dParamStopCFM, val);
193  } else if ( axis == 1 ) {
194  dJointSetUniversalParam(_id, dParamStopCFM2, val);
195  }
196 }
197 
198 INLINE dReal OdeUniversalJoint::
199 get_param_lo_stop(int axis) const {
200  nassertr( _id != 0, 0 );
201  nassertr( 0 <= axis && axis <= 1, 0 );
202  if ( axis == 0 ) {
203  return dJointGetUniversalParam(_id, dParamLoStop);
204  } else if ( axis == 1 ) {
205  return dJointGetUniversalParam(_id, dParamLoStop2);
206  }
207  return 0;
208 }
209 
210 INLINE dReal OdeUniversalJoint::
211 get_param_hi_stop(int axis) const {
212  nassertr( _id != 0, 0 );
213  nassertr( 0 <= axis && axis <= 1, 0 );
214  if ( axis == 0 ) {
215  return dJointGetUniversalParam(_id, dParamHiStop);
216  } else if ( axis == 1 ) {
217  return dJointGetUniversalParam(_id, dParamHiStop2);
218  }
219  return 0;
220 }
221 
222 INLINE dReal OdeUniversalJoint::
223 get_param_vel(int axis) const {
224  nassertr( _id != 0, 0 );
225  nassertr( 0 <= axis && axis <= 1, 0 );
226  if ( axis == 0 ) {
227  return dJointGetUniversalParam(_id, dParamVel);
228  } else if ( axis == 1 ) {
229  return dJointGetUniversalParam(_id, dParamVel2);
230  }
231  return 0;
232 }
233 
234 INLINE dReal OdeUniversalJoint::
235 get_param_f_max(int axis) const {
236  nassertr( _id != 0, 0 );
237  nassertr( 0 <= axis && axis <= 1, 0 );
238  if ( axis == 0 ) {
239  return dJointGetUniversalParam(_id, dParamFMax);
240  } else if ( axis == 1 ) {
241  return dJointGetUniversalParam(_id, dParamFMax2);
242  }
243  return 0;
244 }
245 
246 INLINE dReal OdeUniversalJoint::
247 get_param_fudge_factor(int axis) const {
248  nassertr( _id != 0, 0 );
249  nassertr( 0 <= axis && axis <= 1, 0 );
250  if ( axis == 0 ) {
251  return dJointGetUniversalParam(_id, dParamFudgeFactor);
252  } else if ( axis == 1 ) {
253  return dJointGetUniversalParam(_id, dParamFudgeFactor2);
254  }
255  return 0;
256 }
257 
258 INLINE dReal OdeUniversalJoint::
259 get_param_bounce(int axis) const {
260  nassertr( _id != 0, 0 );
261  nassertr( 0 <= axis && axis <= 1, 0 );
262  if ( axis == 0 ) {
263  return dJointGetUniversalParam(_id, dParamBounce);
264  } else if ( axis == 1 ) {
265  return dJointGetUniversalParam(_id, dParamBounce2);
266  }
267  return 0;
268 }
269 
270 INLINE dReal OdeUniversalJoint::
271 get_param_CFM(int axis) const {
272  nassertr( _id != 0, 0 );
273  nassertr( 0 <= axis && axis <= 1, 0 );
274  if ( axis == 0 ) {
275  return dJointGetUniversalParam(_id, dParamCFM);
276  } else if ( axis == 1 ) {
277  return dJointGetUniversalParam(_id, dParamCFM2);
278  }
279  return 0;
280 }
281 
282 INLINE dReal OdeUniversalJoint::
283 get_param_stop_ERP(int axis) const {
284  nassertr( _id != 0, 0 );
285  nassertr( 0 <= axis && axis <= 1, 0 );
286  if ( axis == 0 ) {
287  return dJointGetUniversalParam(_id, dParamStopERP);
288  } else if ( axis == 1 ) {
289  return dJointGetUniversalParam(_id, dParamStopERP2);
290  }
291  return 0;
292 }
293 
294 INLINE dReal OdeUniversalJoint::
295 get_param_stop_CFM(int axis) const {
296  nassertr( _id != 0, 0 );
297  nassertr( 0 <= axis && axis <= 1, 0 );
298  if ( axis == 0 ) {
299  return dJointGetUniversalParam(_id, dParamStopCFM);
300  } else if ( axis == 1 ) {
301  return dJointGetUniversalParam(_id, dParamStopCFM2);
302  }
303  return 0;
304 }
305 
This is the base class for all three-component vectors and points.
Definition: lvecBase3.h:105