Panda3D
Loading...
Searching...
No Matches
odeHinge2Joint.I
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file odeHinge2Joint.I
10 * @author joswilso
11 * @date 2006-12-27
12 */
13
14INLINE void OdeHinge2Joint::
15set_anchor(dReal x, dReal y, dReal z) {
16 dJointSetHinge2Anchor(_id, x, y, z);
17}
18
19INLINE void OdeHinge2Joint::
20set_anchor(const LVecBase3f &anchor) {
21 dJointSetHinge2Anchor(_id, anchor[0], anchor[1], anchor[2]);
22}
23
24INLINE void OdeHinge2Joint::
25set_axis1(dReal x, dReal y, dReal z) {
26 dJointSetHinge2Axis1(_id, x, y, z);
27}
28
29INLINE void OdeHinge2Joint::
30set_axis1(const LVecBase3f &axis) {
31 dJointSetHinge2Axis1(_id, axis[0], axis[1], axis[2]);
32}
33
34INLINE void OdeHinge2Joint::
35set_axis2(dReal x, dReal y, dReal z) {
36 dJointSetHinge2Axis2(_id, x, y, z);
37}
38
39INLINE void OdeHinge2Joint::
40set_axis2(const LVecBase3f &axis) {
41 dJointSetHinge2Axis2(_id, axis[0], axis[1], axis[2]);
42}
43
44INLINE void OdeHinge2Joint::
45add_torques(dReal torque1, dReal torque2) {
46 dJointAddHinge2Torques(_id, torque1, torque2);
47}
48
49INLINE LVecBase3f OdeHinge2Joint::
50get_anchor() const {
51 dVector3 result;
52 dJointGetHinge2Anchor(_id, result);
53 return LVecBase3f(result[0], result[1], result[2]);
54}
55
56INLINE LVecBase3f OdeHinge2Joint::
57get_anchor2() const {
58 dVector3 result;
59 dJointGetHinge2Anchor2(_id, result);
60 return LVecBase3f(result[0], result[1], result[2]);
61}
62
63INLINE LVecBase3f OdeHinge2Joint::
64get_axis1() const {
65 dVector3 result;
66 dJointGetHinge2Axis1(_id, result);
67 return LVecBase3f(result[0], result[1], result[2]);
68}
69
70INLINE LVecBase3f OdeHinge2Joint::
71get_axis2() const {
72 dVector3 result;
73 dJointGetHinge2Axis2(_id, result);
74 return LVecBase3f(result[0], result[1], result[2]);
75}
76
77INLINE dReal OdeHinge2Joint::
78get_angle1() const {
79 return dJointGetHinge2Angle1(_id);
80}
81
82INLINE dReal OdeHinge2Joint::
83get_angle1_rate() const {
84 return dJointGetHinge2Angle1Rate(_id);
85}
86
87INLINE dReal OdeHinge2Joint::
88get_angle2_rate() const {
89 return dJointGetHinge2Angle2Rate(_id);
90}
91
92INLINE void OdeHinge2Joint::
93set_param_lo_stop(int axis, dReal val) {
94 nassertv( _id != 0 );
95 nassertv( 0 <= axis && axis <= 1 );
96 if ( axis == 0 ) {
97 dJointSetHinge2Param(_id, dParamLoStop, val);
98 } else if ( axis == 1 ) {
99 dJointSetHinge2Param(_id, dParamLoStop2, val);
100 }
101}
102
103INLINE void OdeHinge2Joint::
104set_param_hi_stop(int axis, dReal val) {
105 nassertv( _id != 0 );
106 nassertv( 0 <= axis && axis <= 1 );
107 if ( axis == 0 ) {
108 dJointSetHinge2Param(_id, dParamHiStop, val);
109 } else if ( axis == 1 ) {
110 dJointSetHinge2Param(_id, dParamHiStop2, val);
111 }
112}
113
114INLINE void OdeHinge2Joint::
115set_param_vel(int axis, dReal val) {
116 nassertv( _id != 0 );
117 nassertv( 0 <= axis && axis <= 1 );
118 if ( axis == 0 ) {
119 dJointSetHinge2Param(_id, dParamVel, val);
120 } else if ( axis == 1 ) {
121 dJointSetHinge2Param(_id, dParamVel2, val);
122 }
123}
124
125INLINE void OdeHinge2Joint::
126set_param_f_max(int axis, dReal val) {
127 nassertv( _id != 0 );
128 nassertv( 0 <= axis && axis <= 1 );
129 if ( axis == 0 ) {
130 dJointSetHinge2Param(_id, dParamFMax, val);
131 } else if ( axis == 1 ) {
132 dJointSetHinge2Param(_id, dParamFMax2, val);
133 }
134}
135
136INLINE void OdeHinge2Joint::
137set_param_fudge_factor(int axis, dReal val) {
138 nassertv( _id != 0 );
139 nassertv( 0 <= axis && axis <= 1 );
140 if ( axis == 0 ) {
141 dJointSetHinge2Param(_id, dParamFudgeFactor, val);
142 } else if ( axis == 1 ) {
143 dJointSetHinge2Param(_id, dParamFudgeFactor2, val);
144 }
145}
146
147INLINE void OdeHinge2Joint::
148set_param_bounce(int axis, dReal val) {
149 nassertv( _id != 0 );
150 nassertv( 0 <= axis && axis <= 1 );
151 if ( axis == 0 ) {
152 dJointSetHinge2Param(_id, dParamBounce, val);
153 } else if ( axis == 1 ) {
154 dJointSetHinge2Param(_id, dParamBounce2, val);
155 }
156}
157
158INLINE void OdeHinge2Joint::
159set_param_CFM(int axis, dReal val) {
160 nassertv( _id != 0 );
161 nassertv( 0 <= axis && axis <= 1 );
162 if ( axis == 0 ) {
163 dJointSetHinge2Param(_id, dParamCFM, val);
164 } else if ( axis == 1 ) {
165 dJointSetHinge2Param(_id, dParamCFM2, val);
166 }
167}
168
169INLINE void OdeHinge2Joint::
170set_param_stop_ERP(int axis, dReal val) {
171 nassertv( _id != 0 );
172 nassertv( 0 <= axis && axis <= 1 );
173 if ( axis == 0 ) {
174 dJointSetHinge2Param(_id, dParamStopERP, val);
175 } else if ( axis == 1 ) {
176 dJointSetHinge2Param(_id, dParamStopERP2, val);
177 }
178}
179
180INLINE void OdeHinge2Joint::
181set_param_stop_CFM(int axis, dReal val) {
182 nassertv( _id != 0 );
183 nassertv( 0 <= axis && axis <= 1 );
184 if ( axis == 0 ) {
185 dJointSetHinge2Param(_id, dParamStopCFM, val);
186 } else if ( axis == 1 ) {
187 dJointSetHinge2Param(_id, dParamStopCFM2, val);
188 }
189}
190
191INLINE void OdeHinge2Joint::
192set_param_suspension_ERP(int axis, dReal val) {
193 nassertv( _id != 0 );
194 nassertv( 0 <= axis && axis <= 1 );
195 if ( axis == 0 ) {
196 dJointSetHinge2Param(_id, dParamSuspensionERP, val);
197 } else if ( axis == 1 ) {
198 dJointSetHinge2Param(_id, dParamSuspensionERP2, val);
199 }
200}
201
202INLINE void OdeHinge2Joint::
203set_param_suspension_CFM(int axis, dReal val) {
204 nassertv( _id != 0 );
205 nassertv( 0 <= axis && axis <= 1 );
206 if ( axis == 0 ) {
207 dJointSetHinge2Param(_id, dParamSuspensionCFM, val);
208 } else if ( axis == 1 ) {
209 dJointSetHinge2Param(_id, dParamSuspensionCFM2, val);
210 }
211}
212
213INLINE dReal OdeHinge2Joint::
214get_param_lo_stop(int axis) const {
215 nassertr( _id != 0, 0 );
216 nassertr( 0 <= axis && axis <= 1, 0 );
217 if ( axis == 0 ) {
218 return dJointGetHinge2Param(_id, dParamLoStop);
219 } else if ( axis == 1 ) {
220 return dJointGetHinge2Param(_id, dParamLoStop2);
221 }
222 return 0;
223}
224
225INLINE dReal OdeHinge2Joint::
226get_param_hi_stop(int axis) const {
227 nassertr( _id != 0, 0 );
228 nassertr( 0 <= axis && axis <= 1, 0 );
229 if ( axis == 0 ) {
230 return dJointGetHinge2Param(_id, dParamHiStop);
231 } else if ( axis == 1 ) {
232 return dJointGetHinge2Param(_id, dParamHiStop2);
233 }
234 return 0;
235}
236
237INLINE dReal OdeHinge2Joint::
238get_param_vel(int axis) const {
239 nassertr( _id != 0, 0 );
240 nassertr( 0 <= axis && axis <= 1, 0 );
241 if ( axis == 0 ) {
242 return dJointGetHinge2Param(_id, dParamVel);
243 } else if ( axis == 1 ) {
244 return dJointGetHinge2Param(_id, dParamVel2);
245 }
246 return 0;
247}
248
249INLINE dReal OdeHinge2Joint::
250get_param_f_max(int axis) const {
251 nassertr( _id != 0, 0 );
252 nassertr( 0 <= axis && axis <= 1, 0 );
253 if ( axis == 0 ) {
254 return dJointGetHinge2Param(_id, dParamFMax);
255 } else if ( axis == 1 ) {
256 return dJointGetHinge2Param(_id, dParamFMax2);
257 }
258 return 0;
259}
260
261INLINE dReal OdeHinge2Joint::
262get_param_fudge_factor(int axis) const {
263 nassertr( _id != 0, 0 );
264 nassertr( 0 <= axis && axis <= 1, 0 );
265 if ( axis == 0 ) {
266 return dJointGetHinge2Param(_id, dParamFudgeFactor);
267 } else if ( axis == 1 ) {
268 return dJointGetHinge2Param(_id, dParamFudgeFactor2);
269 }
270 return 0;
271}
272
273INLINE dReal OdeHinge2Joint::
274get_param_bounce(int axis) const {
275 nassertr( _id != 0, 0 );
276 nassertr( 0 <= axis && axis <= 1, 0 );
277 if ( axis == 0 ) {
278 return dJointGetHinge2Param(_id, dParamBounce);
279 } else if ( axis == 1 ) {
280 return dJointGetHinge2Param(_id, dParamBounce2);
281 }
282 return 0;
283}
284
285INLINE dReal OdeHinge2Joint::
286get_param_CFM(int axis) const {
287 nassertr( _id != 0, 0 );
288 nassertr( 0 <= axis && axis <= 1, 0 );
289 if ( axis == 0 ) {
290 return dJointGetHinge2Param(_id, dParamCFM);
291 } else if ( axis == 1 ) {
292 return dJointGetHinge2Param(_id, dParamCFM2);
293 }
294 return 0;
295}
296
297INLINE dReal OdeHinge2Joint::
298get_param_stop_ERP(int axis) const {
299 nassertr( _id != 0, 0 );
300 nassertr( 0 <= axis && axis <= 1, 0 );
301 if ( axis == 0 ) {
302 return dJointGetHinge2Param(_id, dParamStopERP);
303 } else if ( axis == 1 ) {
304 return dJointGetHinge2Param(_id, dParamStopERP2);
305 }
306 return 0;
307}
308
309INLINE dReal OdeHinge2Joint::
310get_param_stop_CFM(int axis) const {
311 nassertr( _id != 0, 0 );
312 nassertr( 0 <= axis && axis <= 1, 0 );
313 if ( axis == 0 ) {
314 return dJointGetHinge2Param(_id, dParamStopCFM);
315 } else if ( axis == 1 ) {
316 return dJointGetHinge2Param(_id, dParamStopCFM2);
317 }
318 return 0;
319}
320
321INLINE dReal OdeHinge2Joint::
322get_param_suspension_ERP(int axis) const {
323 nassertr( _id != 0, 0 );
324 nassertr( 0 <= axis && axis <= 1, 0 );
325 if ( axis == 0 ) {
326 return dJointGetHinge2Param(_id, dParamSuspensionERP);
327 } else if ( axis == 1 ) {
328 return dJointGetHinge2Param(_id, dParamSuspensionERP2);
329 }
330 return 0;
331}
332
333INLINE dReal OdeHinge2Joint::
334get_param_suspension_CFM(int axis) const {
335 nassertr( _id != 0, 0 );
336 nassertr( 0 <= axis && axis <= 1, 0 );
337 if ( axis == 0 ) {
338 return dJointGetHinge2Param(_id, dParamSuspensionCFM);
339 } else if ( axis == 1 ) {
340 return dJointGetHinge2Param(_id, dParamSuspensionCFM2);
341 }
342 return 0;
343}