Panda3D
|
00001 // Filename: odeAMotorJoint.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 OdeAMotorJoint:: 00016 set_num_axes(int num) { 00017 dJointSetAMotorNumAxes(_id, num); 00018 } 00019 00020 INLINE void OdeAMotorJoint:: 00021 set_axis(int anum, int rel, dReal x, dReal y, dReal z) { 00022 dJointSetAMotorAxis(_id, anum, rel, x, y, z); 00023 } 00024 00025 INLINE void OdeAMotorJoint:: 00026 set_axis(int anum, int rel, const LVecBase3f &axis) { 00027 dJointSetAMotorAxis(_id, anum, rel, axis[0], axis[1], axis[2]); 00028 } 00029 00030 INLINE void OdeAMotorJoint:: 00031 set_angle(int anum, dReal angle) { 00032 dJointSetAMotorAngle(_id, anum, angle); 00033 } 00034 00035 INLINE void OdeAMotorJoint:: 00036 set_mode(int mode) { 00037 dJointSetAMotorMode(_id, mode); 00038 } 00039 00040 INLINE void OdeAMotorJoint:: 00041 add_torques(dReal torque1, dReal torque2, dReal torque3) { 00042 dJointAddAMotorTorques(_id, torque1, torque2, torque3); 00043 } 00044 00045 INLINE int OdeAMotorJoint:: 00046 get_num_axes() const { 00047 return dJointGetAMotorNumAxes(_id); 00048 } 00049 00050 INLINE LVecBase3f OdeAMotorJoint:: 00051 get_axis(int anum) const { 00052 dVector3 result; 00053 dJointGetAMotorAxis(_id, anum, result); 00054 return LVecBase3f(result[0], result[1], result[2]); 00055 } 00056 00057 INLINE int OdeAMotorJoint:: 00058 get_axis_rel(int anum) const { 00059 return dJointGetAMotorAxisRel(_id, anum); 00060 } 00061 00062 INLINE dReal OdeAMotorJoint:: 00063 get_angle(int anum) const { 00064 return dJointGetAMotorAngle(_id, anum); 00065 } 00066 00067 INLINE dReal OdeAMotorJoint:: 00068 get_angle_rate(int anum) const { 00069 return dJointGetAMotorAngleRate(_id, anum); 00070 } 00071 00072 INLINE int OdeAMotorJoint:: 00073 get_mode() const { 00074 return dJointGetAMotorMode(_id); 00075 } 00076 00077 INLINE void OdeAMotorJoint:: 00078 set_param_lo_stop(int axis, dReal val) { 00079 nassertv( _id != 0 ); 00080 nassertv( 0 <= axis && axis <= 2 ); 00081 if ( axis == 0 ) { 00082 dJointSetAMotorParam(_id, dParamLoStop, val); 00083 } else if ( axis == 1 ) { 00084 dJointSetAMotorParam(_id, dParamLoStop, val); 00085 } else if ( axis == 2 ) { 00086 dJointSetAMotorParam(_id, dParamLoStop, val); 00087 } 00088 } 00089 00090 INLINE void OdeAMotorJoint:: 00091 set_param_hi_stop(int axis, dReal val) { 00092 nassertv( _id != 0 ); 00093 nassertv( 0 <= axis && axis <= 2 ); 00094 if ( axis == 0 ) { 00095 dJointSetAMotorParam(_id, dParamHiStop, val); 00096 } else if ( axis == 1 ) { 00097 dJointSetAMotorParam(_id, dParamHiStop, val); 00098 } else if ( axis == 2 ) { 00099 dJointSetAMotorParam(_id, dParamHiStop, val); 00100 } 00101 } 00102 00103 INLINE void OdeAMotorJoint:: 00104 set_param_vel(int axis, dReal val) { 00105 nassertv( _id != 0 ); 00106 nassertv( 0 <= axis && axis <= 2 ); 00107 if ( axis == 0 ) { 00108 dJointSetAMotorParam(_id, dParamVel, val); 00109 } else if ( axis == 1 ) { 00110 dJointSetAMotorParam(_id, dParamVel, val); 00111 } else if ( axis == 2 ) { 00112 dJointSetAMotorParam(_id, dParamVel, val); 00113 } 00114 } 00115 00116 INLINE void OdeAMotorJoint:: 00117 set_param_f_max(int axis, dReal val) { 00118 nassertv( _id != 0 ); 00119 nassertv( 0 <= axis && axis <= 2 ); 00120 if ( axis == 0 ) { 00121 dJointSetAMotorParam(_id, dParamFMax, val); 00122 } else if ( axis == 1 ) { 00123 dJointSetAMotorParam(_id, dParamFMax, val); 00124 } else if ( axis == 2 ) { 00125 dJointSetAMotorParam(_id, dParamFMax, val); 00126 } 00127 } 00128 00129 INLINE void OdeAMotorJoint:: 00130 set_param_fudge_factor(int axis, dReal val) { 00131 nassertv( _id != 0 ); 00132 nassertv( 0 <= axis && axis <= 2 ); 00133 if ( axis == 0 ) { 00134 dJointSetAMotorParam(_id, dParamFudgeFactor, val); 00135 } else if ( axis == 1 ) { 00136 dJointSetAMotorParam(_id, dParamFudgeFactor, val); 00137 } else if ( axis == 2 ) { 00138 dJointSetAMotorParam(_id, dParamFudgeFactor, val); 00139 } 00140 } 00141 00142 INLINE void OdeAMotorJoint:: 00143 set_param_bounce(int axis, dReal val) { 00144 nassertv( _id != 0 ); 00145 nassertv( 0 <= axis && axis <= 2 ); 00146 if ( axis == 0 ) { 00147 dJointSetAMotorParam(_id, dParamBounce, val); 00148 } else if ( axis == 1 ) { 00149 dJointSetAMotorParam(_id, dParamBounce, val); 00150 } else if ( axis == 2 ) { 00151 dJointSetAMotorParam(_id, dParamBounce, val); 00152 } 00153 } 00154 00155 INLINE void OdeAMotorJoint:: 00156 set_param_CFM(int axis, dReal val) { 00157 nassertv( _id != 0 ); 00158 nassertv( 0 <= axis && axis <= 2 ); 00159 if ( axis == 0 ) { 00160 dJointSetAMotorParam(_id, dParamCFM, val); 00161 } else if ( axis == 1 ) { 00162 dJointSetAMotorParam(_id, dParamCFM, val); 00163 } else if ( axis == 2 ) { 00164 dJointSetAMotorParam(_id, dParamCFM, val); 00165 } 00166 } 00167 00168 INLINE void OdeAMotorJoint:: 00169 set_param_stop_ERP(int axis, dReal val) { 00170 nassertv( _id != 0 ); 00171 nassertv( 0 <= axis && axis <= 2 ); 00172 if ( axis == 0 ) { 00173 dJointSetAMotorParam(_id, dParamStopERP, val); 00174 } else if ( axis == 1 ) { 00175 dJointSetAMotorParam(_id, dParamStopERP, val); 00176 } else if ( axis == 2 ) { 00177 dJointSetAMotorParam(_id, dParamStopERP, val); 00178 } 00179 } 00180 00181 INLINE void OdeAMotorJoint:: 00182 set_param_stop_CFM(int axis, dReal val) { 00183 nassertv( _id != 0 ); 00184 nassertv( 0 <= axis && axis <= 2 ); 00185 if ( axis == 0 ) { 00186 dJointSetAMotorParam(_id, dParamStopCFM, val); 00187 } else if ( axis == 1 ) { 00188 dJointSetAMotorParam(_id, dParamStopCFM, val); 00189 } else if ( axis == 2 ) { 00190 dJointSetAMotorParam(_id, dParamStopCFM, val); 00191 } 00192 } 00193 00194 INLINE dReal OdeAMotorJoint:: 00195 get_param_lo_stop(int axis) const { 00196 nassertr( _id != 0, 0 ); 00197 nassertr( 0 <= axis && axis <= 2, 0 ); 00198 if ( axis == 0 ) { 00199 return dJointGetAMotorParam(_id, dParamLoStop); 00200 } else if ( axis == 1 ) { 00201 return dJointGetAMotorParam(_id, dParamLoStop); 00202 } else if ( axis == 2 ) { 00203 return dJointGetAMotorParam(_id, dParamLoStop); 00204 } 00205 return 0; 00206 } 00207 00208 INLINE dReal OdeAMotorJoint:: 00209 get_param_hi_stop(int axis) const { 00210 nassertr( _id != 0, 0 ); 00211 nassertr( 0 <= axis && axis <= 2, 0 ); 00212 if ( axis == 0 ) { 00213 return dJointGetAMotorParam(_id, dParamHiStop); 00214 } else if ( axis == 1 ) { 00215 return dJointGetAMotorParam(_id, dParamHiStop); 00216 } else if ( axis == 2 ) { 00217 return dJointGetAMotorParam(_id, dParamHiStop); 00218 } 00219 return 0; 00220 } 00221 00222 INLINE dReal OdeAMotorJoint:: 00223 get_param_vel(int axis) const { 00224 nassertr( _id != 0, 0 ); 00225 nassertr( 0 <= axis && axis <= 2, 0 ); 00226 if ( axis == 0 ) { 00227 return dJointGetAMotorParam(_id, dParamVel); 00228 } else if ( axis == 1 ) { 00229 return dJointGetAMotorParam(_id, dParamVel); 00230 } else if ( axis == 2 ) { 00231 return dJointGetAMotorParam(_id, dParamVel); 00232 } 00233 return 0; 00234 } 00235 00236 INLINE dReal OdeAMotorJoint:: 00237 get_param_f_max(int axis) const { 00238 nassertr( _id != 0, 0 ); 00239 nassertr( 0 <= axis && axis <= 2, 0 ); 00240 if ( axis == 0 ) { 00241 return dJointGetAMotorParam(_id, dParamFMax); 00242 } else if ( axis == 1 ) { 00243 return dJointGetAMotorParam(_id, dParamFMax); 00244 } else if ( axis == 2 ) { 00245 return dJointGetAMotorParam(_id, dParamFMax); 00246 } 00247 return 0; 00248 } 00249 00250 INLINE dReal OdeAMotorJoint:: 00251 get_param_fudge_factor(int axis) const { 00252 nassertr( _id != 0, 0 ); 00253 nassertr( 0 <= axis && axis <= 2, 0 ); 00254 if ( axis == 0 ) { 00255 return dJointGetAMotorParam(_id, dParamFudgeFactor); 00256 } else if ( axis == 1 ) { 00257 return dJointGetAMotorParam(_id, dParamFudgeFactor); 00258 } else if ( axis == 2 ) { 00259 return dJointGetAMotorParam(_id, dParamFudgeFactor); 00260 } 00261 return 0; 00262 } 00263 00264 INLINE dReal OdeAMotorJoint:: 00265 get_param_bounce(int axis) const { 00266 nassertr( _id != 0, 0 ); 00267 nassertr( 0 <= axis && axis <= 2, 0 ); 00268 if ( axis == 0 ) { 00269 return dJointGetAMotorParam(_id, dParamBounce); 00270 } else if ( axis == 1 ) { 00271 return dJointGetAMotorParam(_id, dParamBounce); 00272 } else if ( axis == 2 ) { 00273 return dJointGetAMotorParam(_id, dParamBounce); 00274 } 00275 return 0; 00276 } 00277 00278 INLINE dReal OdeAMotorJoint:: 00279 get_param_CFM(int axis) const { 00280 nassertr( _id != 0, 0 ); 00281 nassertr( 0 <= axis && axis <= 2, 0 ); 00282 if ( axis == 0 ) { 00283 return dJointGetAMotorParam(_id, dParamCFM); 00284 } else if ( axis == 1 ) { 00285 return dJointGetAMotorParam(_id, dParamCFM); 00286 } else if ( axis == 2 ) { 00287 return dJointGetAMotorParam(_id, dParamCFM); 00288 } 00289 return 0; 00290 } 00291 00292 INLINE dReal OdeAMotorJoint:: 00293 get_param_stop_ERP(int axis) const { 00294 nassertr( _id != 0, 0 ); 00295 nassertr( 0 <= axis && axis <= 2, 0 ); 00296 if ( axis == 0 ) { 00297 return dJointGetAMotorParam(_id, dParamStopERP); 00298 } else if ( axis == 1 ) { 00299 return dJointGetAMotorParam(_id, dParamStopERP); 00300 } else if ( axis == 2 ) { 00301 return dJointGetAMotorParam(_id, dParamStopERP); 00302 } 00303 return 0; 00304 } 00305 00306 INLINE dReal OdeAMotorJoint:: 00307 get_param_stop_CFM(int axis) const { 00308 nassertr( _id != 0, 0 ); 00309 nassertr( 0 <= axis && axis <= 2, 0 ); 00310 if ( axis == 0 ) { 00311 return dJointGetAMotorParam(_id, dParamStopCFM); 00312 } else if ( axis == 1 ) { 00313 return dJointGetAMotorParam(_id, dParamStopCFM); 00314 } else if ( axis == 2 ) { 00315 return dJointGetAMotorParam(_id, dParamStopCFM); 00316 } 00317 return 0; 00318 } 00319