Panda3D
|
00001 // Filename: odeUniversalJoint.I 00002 // Created by: joswilso (27Dec06) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 INLINE void OdeUniversalJoint:: 00016 set_anchor(dReal x, dReal y, dReal z) { 00017 dJointSetUniversalAnchor(_id, x, y, z); 00018 } 00019 00020 INLINE void OdeUniversalJoint:: 00021 set_anchor(const LVecBase3f &anchor) { 00022 dJointSetUniversalAnchor(_id, anchor[0], anchor[1], anchor[2]); 00023 } 00024 00025 INLINE void OdeUniversalJoint:: 00026 set_axis1(dReal x, dReal y, dReal z) { 00027 dJointSetUniversalAxis1(_id, x, y, z); 00028 } 00029 00030 INLINE void OdeUniversalJoint:: 00031 set_axis1(const LVecBase3f &axis) { 00032 dJointSetUniversalAxis1(_id, axis[0], axis[1], axis[2]); 00033 } 00034 00035 INLINE void OdeUniversalJoint:: 00036 set_axis2(dReal x, dReal y, dReal z) { 00037 dJointSetUniversalAxis2(_id, x, y, z); 00038 } 00039 00040 INLINE void OdeUniversalJoint:: 00041 set_axis2(const LVecBase3f &axis) { 00042 dJointSetUniversalAxis2(_id, axis[0], axis[1], axis[2]); 00043 } 00044 00045 INLINE void OdeUniversalJoint:: 00046 add_torques(dReal torque1, dReal torque2) { 00047 dJointAddUniversalTorques(_id, torque1, torque2); 00048 } 00049 00050 INLINE LVecBase3f OdeUniversalJoint:: 00051 get_anchor() const { 00052 dVector3 result; 00053 dJointGetUniversalAnchor(_id, result); 00054 return LVecBase3f(result[0], result[1], result[2]); 00055 } 00056 00057 INLINE LVecBase3f OdeUniversalJoint:: 00058 get_anchor2() const { 00059 dVector3 result; 00060 dJointGetUniversalAnchor2(_id, result); 00061 return LVecBase3f(result[0], result[1], result[2]); 00062 } 00063 00064 INLINE LVecBase3f OdeUniversalJoint:: 00065 get_axis1() const { 00066 dVector3 result; 00067 dJointGetUniversalAxis1(_id, result); 00068 return LVecBase3f(result[0], result[1], result[2]); 00069 } 00070 00071 INLINE LVecBase3f OdeUniversalJoint:: 00072 get_axis2() const { 00073 dVector3 result; 00074 dJointGetUniversalAxis2(_id, result); 00075 return LVecBase3f(result[0], result[1], result[2]); 00076 } 00077 00078 INLINE dReal OdeUniversalJoint:: 00079 get_angle1() const { 00080 return dJointGetUniversalAngle1(_id); 00081 } 00082 00083 INLINE dReal OdeUniversalJoint:: 00084 get_angle2() const { 00085 return dJointGetUniversalAngle2(_id); 00086 } 00087 00088 INLINE dReal OdeUniversalJoint:: 00089 get_angle1_rate() const { 00090 return dJointGetUniversalAngle1Rate(_id); 00091 } 00092 00093 INLINE dReal OdeUniversalJoint:: 00094 get_angle2_rate() const { 00095 return dJointGetUniversalAngle2Rate(_id); 00096 } 00097 00098 00099 INLINE void OdeUniversalJoint:: 00100 set_param_lo_stop(int axis, dReal val) { 00101 nassertv( _id != 0 ); 00102 nassertv( 0 <= axis && axis <= 1 ); 00103 if ( axis == 0 ) { 00104 dJointSetUniversalParam(_id, dParamLoStop, val); 00105 } else if ( axis == 1 ) { 00106 dJointSetUniversalParam(_id, dParamLoStop2, val); 00107 } 00108 } 00109 00110 INLINE void OdeUniversalJoint:: 00111 set_param_hi_stop(int axis, dReal val) { 00112 nassertv( _id != 0 ); 00113 nassertv( 0 <= axis && axis <= 1 ); 00114 if ( axis == 0 ) { 00115 dJointSetUniversalParam(_id, dParamHiStop, val); 00116 } else if ( axis == 1 ) { 00117 dJointSetUniversalParam(_id, dParamHiStop2, val); 00118 } 00119 } 00120 00121 INLINE void OdeUniversalJoint:: 00122 set_param_vel(int axis, dReal val) { 00123 nassertv( _id != 0 ); 00124 nassertv( 0 <= axis && axis <= 1 ); 00125 if ( axis == 0 ) { 00126 dJointSetUniversalParam(_id, dParamVel, val); 00127 } else if ( axis == 1 ) { 00128 dJointSetUniversalParam(_id, dParamVel2, val); 00129 } 00130 } 00131 00132 INLINE void OdeUniversalJoint:: 00133 set_param_f_max(int axis, dReal val) { 00134 nassertv( _id != 0 ); 00135 nassertv( 0 <= axis && axis <= 1 ); 00136 if ( axis == 0 ) { 00137 dJointSetUniversalParam(_id, dParamFMax, val); 00138 } else if ( axis == 1 ) { 00139 dJointSetUniversalParam(_id, dParamFMax2, val); 00140 } 00141 } 00142 00143 INLINE void OdeUniversalJoint:: 00144 set_param_fudge_factor(int axis, dReal val) { 00145 nassertv( _id != 0 ); 00146 nassertv( 0 <= axis && axis <= 1 ); 00147 if ( axis == 0 ) { 00148 dJointSetUniversalParam(_id, dParamFudgeFactor, val); 00149 } else if ( axis == 1 ) { 00150 dJointSetUniversalParam(_id, dParamFudgeFactor2, val); 00151 } 00152 } 00153 00154 INLINE void OdeUniversalJoint:: 00155 set_param_bounce(int axis, dReal val) { 00156 nassertv( _id != 0 ); 00157 nassertv( 0 <= axis && axis <= 1 ); 00158 if ( axis == 0 ) { 00159 dJointSetUniversalParam(_id, dParamBounce, val); 00160 } else if ( axis == 1 ) { 00161 dJointSetUniversalParam(_id, dParamBounce2, val); 00162 } 00163 } 00164 00165 INLINE void OdeUniversalJoint:: 00166 set_param_CFM(int axis, dReal val) { 00167 nassertv( _id != 0 ); 00168 nassertv( 0 <= axis && axis <= 1 ); 00169 if ( axis == 0 ) { 00170 dJointSetUniversalParam(_id, dParamCFM, val); 00171 } else if ( axis == 1 ) { 00172 dJointSetUniversalParam(_id, dParamCFM2, val); 00173 } 00174 } 00175 00176 INLINE void OdeUniversalJoint:: 00177 set_param_stop_ERP(int axis, dReal val) { 00178 nassertv( _id != 0 ); 00179 nassertv( 0 <= axis && axis <= 1 ); 00180 if ( axis == 0 ) { 00181 dJointSetUniversalParam(_id, dParamStopERP, val); 00182 } else if ( axis == 1 ) { 00183 dJointSetUniversalParam(_id, dParamStopERP2, val); 00184 } 00185 } 00186 00187 INLINE void OdeUniversalJoint:: 00188 set_param_stop_CFM(int axis, dReal val) { 00189 nassertv( _id != 0 ); 00190 nassertv( 0 <= axis && axis <= 1 ); 00191 if ( axis == 0 ) { 00192 dJointSetUniversalParam(_id, dParamStopCFM, val); 00193 } else if ( axis == 1 ) { 00194 dJointSetUniversalParam(_id, dParamStopCFM2, val); 00195 } 00196 } 00197 00198 INLINE dReal OdeUniversalJoint:: 00199 get_param_lo_stop(int axis) const { 00200 nassertr( _id != 0, 0 ); 00201 nassertr( 0 <= axis && axis <= 1, 0 ); 00202 if ( axis == 0 ) { 00203 return dJointGetUniversalParam(_id, dParamLoStop); 00204 } else if ( axis == 1 ) { 00205 return dJointGetUniversalParam(_id, dParamLoStop2); 00206 } 00207 return 0; 00208 } 00209 00210 INLINE dReal OdeUniversalJoint:: 00211 get_param_hi_stop(int axis) const { 00212 nassertr( _id != 0, 0 ); 00213 nassertr( 0 <= axis && axis <= 1, 0 ); 00214 if ( axis == 0 ) { 00215 return dJointGetUniversalParam(_id, dParamHiStop); 00216 } else if ( axis == 1 ) { 00217 return dJointGetUniversalParam(_id, dParamHiStop2); 00218 } 00219 return 0; 00220 } 00221 00222 INLINE dReal OdeUniversalJoint:: 00223 get_param_vel(int axis) const { 00224 nassertr( _id != 0, 0 ); 00225 nassertr( 0 <= axis && axis <= 1, 0 ); 00226 if ( axis == 0 ) { 00227 return dJointGetUniversalParam(_id, dParamVel); 00228 } else if ( axis == 1 ) { 00229 return dJointGetUniversalParam(_id, dParamVel2); 00230 } 00231 return 0; 00232 } 00233 00234 INLINE dReal OdeUniversalJoint:: 00235 get_param_f_max(int axis) const { 00236 nassertr( _id != 0, 0 ); 00237 nassertr( 0 <= axis && axis <= 1, 0 ); 00238 if ( axis == 0 ) { 00239 return dJointGetUniversalParam(_id, dParamFMax); 00240 } else if ( axis == 1 ) { 00241 return dJointGetUniversalParam(_id, dParamFMax2); 00242 } 00243 return 0; 00244 } 00245 00246 INLINE dReal OdeUniversalJoint:: 00247 get_param_fudge_factor(int axis) const { 00248 nassertr( _id != 0, 0 ); 00249 nassertr( 0 <= axis && axis <= 1, 0 ); 00250 if ( axis == 0 ) { 00251 return dJointGetUniversalParam(_id, dParamFudgeFactor); 00252 } else if ( axis == 1 ) { 00253 return dJointGetUniversalParam(_id, dParamFudgeFactor2); 00254 } 00255 return 0; 00256 } 00257 00258 INLINE dReal OdeUniversalJoint:: 00259 get_param_bounce(int axis) const { 00260 nassertr( _id != 0, 0 ); 00261 nassertr( 0 <= axis && axis <= 1, 0 ); 00262 if ( axis == 0 ) { 00263 return dJointGetUniversalParam(_id, dParamBounce); 00264 } else if ( axis == 1 ) { 00265 return dJointGetUniversalParam(_id, dParamBounce2); 00266 } 00267 return 0; 00268 } 00269 00270 INLINE dReal OdeUniversalJoint:: 00271 get_param_CFM(int axis) const { 00272 nassertr( _id != 0, 0 ); 00273 nassertr( 0 <= axis && axis <= 1, 0 ); 00274 if ( axis == 0 ) { 00275 return dJointGetUniversalParam(_id, dParamCFM); 00276 } else if ( axis == 1 ) { 00277 return dJointGetUniversalParam(_id, dParamCFM2); 00278 } 00279 return 0; 00280 } 00281 00282 INLINE dReal OdeUniversalJoint:: 00283 get_param_stop_ERP(int axis) const { 00284 nassertr( _id != 0, 0 ); 00285 nassertr( 0 <= axis && axis <= 1, 0 ); 00286 if ( axis == 0 ) { 00287 return dJointGetUniversalParam(_id, dParamStopERP); 00288 } else if ( axis == 1 ) { 00289 return dJointGetUniversalParam(_id, dParamStopERP2); 00290 } 00291 return 0; 00292 } 00293 00294 INLINE dReal OdeUniversalJoint:: 00295 get_param_stop_CFM(int axis) const { 00296 nassertr( _id != 0, 0 ); 00297 nassertr( 0 <= axis && axis <= 1, 0 ); 00298 if ( axis == 0 ) { 00299 return dJointGetUniversalParam(_id, dParamStopCFM); 00300 } else if ( axis == 1 ) { 00301 return dJointGetUniversalParam(_id, dParamStopCFM2); 00302 } 00303 return 0; 00304 } 00305