Panda3D
odeAMotorJoint.I
1 // Filename: odeAMotorJoint.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 OdeAMotorJoint::
16 set_num_axes(int num) {
17  dJointSetAMotorNumAxes(_id, num);
18 }
19 
20 INLINE void OdeAMotorJoint::
21 set_axis(int anum, int rel, dReal x, dReal y, dReal z) {
22  dJointSetAMotorAxis(_id, anum, rel, x, y, z);
23 }
24 
25 INLINE void OdeAMotorJoint::
26 set_axis(int anum, int rel, const LVecBase3f &axis) {
27  dJointSetAMotorAxis(_id, anum, rel, axis[0], axis[1], axis[2]);
28 }
29 
30 INLINE void OdeAMotorJoint::
31 set_angle(int anum, dReal angle) {
32  dJointSetAMotorAngle(_id, anum, angle);
33 }
34 
35 INLINE void OdeAMotorJoint::
36 set_mode(int mode) {
37  dJointSetAMotorMode(_id, mode);
38 }
39 
40 INLINE void OdeAMotorJoint::
41 add_torques(dReal torque1, dReal torque2, dReal torque3) {
42  dJointAddAMotorTorques(_id, torque1, torque2, torque3);
43 }
44 
45 INLINE int OdeAMotorJoint::
46 get_num_axes() const {
47  return dJointGetAMotorNumAxes(_id);
48 }
49 
50 INLINE LVecBase3f OdeAMotorJoint::
51 get_axis(int anum) const {
52  dVector3 result;
53  dJointGetAMotorAxis(_id, anum, result);
54  return LVecBase3f(result[0], result[1], result[2]);
55 }
56 
57 INLINE int OdeAMotorJoint::
58 get_axis_rel(int anum) const {
59  return dJointGetAMotorAxisRel(_id, anum);
60 }
61 
62 INLINE dReal OdeAMotorJoint::
63 get_angle(int anum) const {
64  return dJointGetAMotorAngle(_id, anum);
65 }
66 
67 INLINE dReal OdeAMotorJoint::
68 get_angle_rate(int anum) const {
69  return dJointGetAMotorAngleRate(_id, anum);
70 }
71 
72 INLINE int OdeAMotorJoint::
73 get_mode() const {
74  return dJointGetAMotorMode(_id);
75 }
76 
77 INLINE void OdeAMotorJoint::
78 set_param_lo_stop(int axis, dReal val) {
79  nassertv( _id != 0 );
80  nassertv( 0 <= axis && axis <= 2 );
81  if ( axis == 0 ) {
82  dJointSetAMotorParam(_id, dParamLoStop, val);
83  } else if ( axis == 1 ) {
84  dJointSetAMotorParam(_id, dParamLoStop, val);
85  } else if ( axis == 2 ) {
86  dJointSetAMotorParam(_id, dParamLoStop, val);
87  }
88 }
89 
90 INLINE void OdeAMotorJoint::
91 set_param_hi_stop(int axis, dReal val) {
92  nassertv( _id != 0 );
93  nassertv( 0 <= axis && axis <= 2 );
94  if ( axis == 0 ) {
95  dJointSetAMotorParam(_id, dParamHiStop, val);
96  } else if ( axis == 1 ) {
97  dJointSetAMotorParam(_id, dParamHiStop, val);
98  } else if ( axis == 2 ) {
99  dJointSetAMotorParam(_id, dParamHiStop, val);
100  }
101 }
102 
103 INLINE void OdeAMotorJoint::
104 set_param_vel(int axis, dReal val) {
105  nassertv( _id != 0 );
106  nassertv( 0 <= axis && axis <= 2 );
107  if ( axis == 0 ) {
108  dJointSetAMotorParam(_id, dParamVel, val);
109  } else if ( axis == 1 ) {
110  dJointSetAMotorParam(_id, dParamVel, val);
111  } else if ( axis == 2 ) {
112  dJointSetAMotorParam(_id, dParamVel, val);
113  }
114 }
115 
116 INLINE void OdeAMotorJoint::
117 set_param_f_max(int axis, dReal val) {
118  nassertv( _id != 0 );
119  nassertv( 0 <= axis && axis <= 2 );
120  if ( axis == 0 ) {
121  dJointSetAMotorParam(_id, dParamFMax, val);
122  } else if ( axis == 1 ) {
123  dJointSetAMotorParam(_id, dParamFMax, val);
124  } else if ( axis == 2 ) {
125  dJointSetAMotorParam(_id, dParamFMax, val);
126  }
127 }
128 
129 INLINE void OdeAMotorJoint::
130 set_param_fudge_factor(int axis, dReal val) {
131  nassertv( _id != 0 );
132  nassertv( 0 <= axis && axis <= 2 );
133  if ( axis == 0 ) {
134  dJointSetAMotorParam(_id, dParamFudgeFactor, val);
135  } else if ( axis == 1 ) {
136  dJointSetAMotorParam(_id, dParamFudgeFactor, val);
137  } else if ( axis == 2 ) {
138  dJointSetAMotorParam(_id, dParamFudgeFactor, val);
139  }
140 }
141 
142 INLINE void OdeAMotorJoint::
143 set_param_bounce(int axis, dReal val) {
144  nassertv( _id != 0 );
145  nassertv( 0 <= axis && axis <= 2 );
146  if ( axis == 0 ) {
147  dJointSetAMotorParam(_id, dParamBounce, val);
148  } else if ( axis == 1 ) {
149  dJointSetAMotorParam(_id, dParamBounce, val);
150  } else if ( axis == 2 ) {
151  dJointSetAMotorParam(_id, dParamBounce, val);
152  }
153 }
154 
155 INLINE void OdeAMotorJoint::
156 set_param_CFM(int axis, dReal val) {
157  nassertv( _id != 0 );
158  nassertv( 0 <= axis && axis <= 2 );
159  if ( axis == 0 ) {
160  dJointSetAMotorParam(_id, dParamCFM, val);
161  } else if ( axis == 1 ) {
162  dJointSetAMotorParam(_id, dParamCFM, val);
163  } else if ( axis == 2 ) {
164  dJointSetAMotorParam(_id, dParamCFM, val);
165  }
166 }
167 
168 INLINE void OdeAMotorJoint::
169 set_param_stop_ERP(int axis, dReal val) {
170  nassertv( _id != 0 );
171  nassertv( 0 <= axis && axis <= 2 );
172  if ( axis == 0 ) {
173  dJointSetAMotorParam(_id, dParamStopERP, val);
174  } else if ( axis == 1 ) {
175  dJointSetAMotorParam(_id, dParamStopERP, val);
176  } else if ( axis == 2 ) {
177  dJointSetAMotorParam(_id, dParamStopERP, val);
178  }
179 }
180 
181 INLINE void OdeAMotorJoint::
182 set_param_stop_CFM(int axis, dReal val) {
183  nassertv( _id != 0 );
184  nassertv( 0 <= axis && axis <= 2 );
185  if ( axis == 0 ) {
186  dJointSetAMotorParam(_id, dParamStopCFM, val);
187  } else if ( axis == 1 ) {
188  dJointSetAMotorParam(_id, dParamStopCFM, val);
189  } else if ( axis == 2 ) {
190  dJointSetAMotorParam(_id, dParamStopCFM, val);
191  }
192 }
193 
194 INLINE dReal OdeAMotorJoint::
195 get_param_lo_stop(int axis) const {
196  nassertr( _id != 0, 0 );
197  nassertr( 0 <= axis && axis <= 2, 0 );
198  if ( axis == 0 ) {
199  return dJointGetAMotorParam(_id, dParamLoStop);
200  } else if ( axis == 1 ) {
201  return dJointGetAMotorParam(_id, dParamLoStop);
202  } else if ( axis == 2 ) {
203  return dJointGetAMotorParam(_id, dParamLoStop);
204  }
205  return 0;
206 }
207 
208 INLINE dReal OdeAMotorJoint::
209 get_param_hi_stop(int axis) const {
210  nassertr( _id != 0, 0 );
211  nassertr( 0 <= axis && axis <= 2, 0 );
212  if ( axis == 0 ) {
213  return dJointGetAMotorParam(_id, dParamHiStop);
214  } else if ( axis == 1 ) {
215  return dJointGetAMotorParam(_id, dParamHiStop);
216  } else if ( axis == 2 ) {
217  return dJointGetAMotorParam(_id, dParamHiStop);
218  }
219  return 0;
220 }
221 
222 INLINE dReal OdeAMotorJoint::
223 get_param_vel(int axis) const {
224  nassertr( _id != 0, 0 );
225  nassertr( 0 <= axis && axis <= 2, 0 );
226  if ( axis == 0 ) {
227  return dJointGetAMotorParam(_id, dParamVel);
228  } else if ( axis == 1 ) {
229  return dJointGetAMotorParam(_id, dParamVel);
230  } else if ( axis == 2 ) {
231  return dJointGetAMotorParam(_id, dParamVel);
232  }
233  return 0;
234 }
235 
236 INLINE dReal OdeAMotorJoint::
237 get_param_f_max(int axis) const {
238  nassertr( _id != 0, 0 );
239  nassertr( 0 <= axis && axis <= 2, 0 );
240  if ( axis == 0 ) {
241  return dJointGetAMotorParam(_id, dParamFMax);
242  } else if ( axis == 1 ) {
243  return dJointGetAMotorParam(_id, dParamFMax);
244  } else if ( axis == 2 ) {
245  return dJointGetAMotorParam(_id, dParamFMax);
246  }
247  return 0;
248 }
249 
250 INLINE dReal OdeAMotorJoint::
251 get_param_fudge_factor(int axis) const {
252  nassertr( _id != 0, 0 );
253  nassertr( 0 <= axis && axis <= 2, 0 );
254  if ( axis == 0 ) {
255  return dJointGetAMotorParam(_id, dParamFudgeFactor);
256  } else if ( axis == 1 ) {
257  return dJointGetAMotorParam(_id, dParamFudgeFactor);
258  } else if ( axis == 2 ) {
259  return dJointGetAMotorParam(_id, dParamFudgeFactor);
260  }
261  return 0;
262 }
263 
264 INLINE dReal OdeAMotorJoint::
265 get_param_bounce(int axis) const {
266  nassertr( _id != 0, 0 );
267  nassertr( 0 <= axis && axis <= 2, 0 );
268  if ( axis == 0 ) {
269  return dJointGetAMotorParam(_id, dParamBounce);
270  } else if ( axis == 1 ) {
271  return dJointGetAMotorParam(_id, dParamBounce);
272  } else if ( axis == 2 ) {
273  return dJointGetAMotorParam(_id, dParamBounce);
274  }
275  return 0;
276 }
277 
278 INLINE dReal OdeAMotorJoint::
279 get_param_CFM(int axis) const {
280  nassertr( _id != 0, 0 );
281  nassertr( 0 <= axis && axis <= 2, 0 );
282  if ( axis == 0 ) {
283  return dJointGetAMotorParam(_id, dParamCFM);
284  } else if ( axis == 1 ) {
285  return dJointGetAMotorParam(_id, dParamCFM);
286  } else if ( axis == 2 ) {
287  return dJointGetAMotorParam(_id, dParamCFM);
288  }
289  return 0;
290 }
291 
292 INLINE dReal OdeAMotorJoint::
293 get_param_stop_ERP(int axis) const {
294  nassertr( _id != 0, 0 );
295  nassertr( 0 <= axis && axis <= 2, 0 );
296  if ( axis == 0 ) {
297  return dJointGetAMotorParam(_id, dParamStopERP);
298  } else if ( axis == 1 ) {
299  return dJointGetAMotorParam(_id, dParamStopERP);
300  } else if ( axis == 2 ) {
301  return dJointGetAMotorParam(_id, dParamStopERP);
302  }
303  return 0;
304 }
305 
306 INLINE dReal OdeAMotorJoint::
307 get_param_stop_CFM(int axis) const {
308  nassertr( _id != 0, 0 );
309  nassertr( 0 <= axis && axis <= 2, 0 );
310  if ( axis == 0 ) {
311  return dJointGetAMotorParam(_id, dParamStopCFM);
312  } else if ( axis == 1 ) {
313  return dJointGetAMotorParam(_id, dParamStopCFM);
314  } else if ( axis == 2 ) {
315  return dJointGetAMotorParam(_id, dParamStopCFM);
316  }
317  return 0;
318 }
319 
This is the base class for all three-component vectors and points.
Definition: lvecBase3.h:105