constraints.cpp
Go to the documentation of this file.
00001 
00031 #include <btBulletDynamicsCommon.h>
00032 
00033 extern double bulletWorldScalingFactor;
00034 
00035 extern "C"
00036 {
00037 
00038   void deleteConstraint(btTypedConstraint *constraint)
00039   {
00040     delete constraint;
00041   }
00042 
00046   btTypedConstraint *newPoint2PointConstraint(
00047     btRigidBody *rbA, btRigidBody *rbB,
00048     const double *pivotInA, const double *pivotInB)
00049   {
00050     return new btPoint2PointConstraint(*rbA, *rbB,
00051       btVector3(pivotInA[0] * bulletWorldScalingFactor,
00052         pivotInA[1] * bulletWorldScalingFactor,
00053         pivotInA[2] * bulletWorldScalingFactor),
00054       btVector3(pivotInB[0] * bulletWorldScalingFactor,
00055         pivotInB[1] * bulletWorldScalingFactor,
00056         pivotInB[2] * bulletWorldScalingFactor));
00057   }
00058 
00059   bool isPoint2PointConstraint(const btTypedConstraint *ptr)
00060   {
00061     return dynamic_cast<const btPoint2PointConstraint *>(ptr) != NULL;
00062   }
00063 
00067   btTypedConstraint *newHingeConstraint(
00068     btRigidBody *rbA, btRigidBody *rbB,
00069     const double *frameInA, const double *frameInB)
00070   {
00071     btTransform transInA(
00072       btQuaternion(frameInA[3], frameInA[4], frameInA[5], frameInA[6]),
00073       btVector3(frameInA[0] * bulletWorldScalingFactor,
00074         frameInA[1] * bulletWorldScalingFactor,
00075         frameInA[2] * bulletWorldScalingFactor));
00076     btTransform transInB(
00077       btQuaternion(frameInB[3], frameInB[4], frameInB[5], frameInB[6]),
00078       btVector3(frameInB[0] * bulletWorldScalingFactor,
00079         frameInB[1] * bulletWorldScalingFactor,
00080         frameInB[2] * bulletWorldScalingFactor));
00081     
00082     return new btHingeConstraint(*rbA, *rbB, transInA, transInB);
00083   }
00084 
00085   bool isHingeConstraint(const btTypedConstraint *ptr)
00086   {
00087     return dynamic_cast<const btHingeConstraint *>(ptr) != NULL;
00088   }
00089 
00090   void setAngularOnly(btHingeConstraint *hinge, bool angularOnly)
00091   {
00092     hinge->setAngularOnly(angularOnly);
00093   }
00094 
00095   bool getAngularOnly(/*const*/ btHingeConstraint *hinge)
00096   {
00097     return hinge->getAngularOnly();
00098   }
00099 
00100   void enableAngularMotor(btHingeConstraint *hinge, bool enableMotor,
00101     double targetVelocity, double maxMotorImpulse)
00102   {
00103     hinge->enableAngularMotor(enableMotor, targetVelocity * bulletWorldScalingFactor, maxMotorImpulse);
00104   }
00105 
00106   void enableMotor(btHingeConstraint *hinge, bool enableMotor)
00107   {
00108     hinge->enableMotor(enableMotor);
00109   }
00110 
00111   bool getEnableMotor(btHingeConstraint *hinge)
00112   {
00113     return hinge->getEnableAngularMotor();
00114   }
00115 
00116   void setMaxMotorImpulse(btHingeConstraint *hinge, double maxMotorImpulse)
00117   {
00118     hinge->setMaxMotorImpulse(maxMotorImpulse * bulletWorldScalingFactor);
00119   }
00120 
00121   double getMaxMotorImpulse(/*const*/ btHingeConstraint *hinge)
00122   {
00123     return hinge->getMaxMotorImpulse();
00124   }
00125 
00126   double getMotorTargetVelocity(/*const*/ btHingeConstraint *hinge)
00127   {
00128     return hinge->getMotorTargetVelosity() / bulletWorldScalingFactor;
00129   }
00130 
00131   void setMotorTarget(btHingeConstraint *hinge, double targetAngle, double dt)
00132   {
00133     hinge->setMotorTarget(targetAngle, dt);
00134   }
00135 
00136   void setLimit(btHingeConstraint *hinge, double low, double high)
00137   {
00138     hinge->setLimit(low, high);
00139   }
00140   
00141   void setLimitComplex(btHingeConstraint *hinge,
00142     double low, double high,
00143     double softness, double biasFactor, double relaxationFactor)
00144   {
00145     hinge->setLimit(low, high, softness, biasFactor, relaxationFactor);
00146   }
00147 
00148   double getHingeAngle(/*const*/ btHingeConstraint *hinge)
00149   {
00150     return hinge->getHingeAngle();
00151   }
00152 
00153   double getLowerLimit(/*const*/ btHingeConstraint *hinge)
00154   {
00155     return hinge->getLowerLimit();
00156   }
00157 
00158   double getUpperLimit(/*const*/ btHingeConstraint *hinge)
00159   {
00160     return hinge->getUpperLimit();
00161   }
00162 
00166   btTypedConstraint *newSliderConstraint(
00167     btRigidBody *rbA, btRigidBody *rbB,
00168     const double *frameInA, const double *frameInB)
00169   {
00170     return new btSliderConstraint(*rbA, *rbB,
00171       btTransform(
00172         btQuaternion(frameInA[3], frameInA[4], frameInA[5], frameInA[6]),
00173         btVector3(frameInA[0]  * bulletWorldScalingFactor,
00174           frameInA[1] * bulletWorldScalingFactor, frameInA[2] * bulletWorldScalingFactor)),
00175       btTransform(
00176         btQuaternion(frameInB[3], frameInB[4], frameInB[5], frameInB[6]),
00177         btVector3(frameInB[0] * bulletWorldScalingFactor,
00178           frameInB[1] * bulletWorldScalingFactor, frameInB[2] * bulletWorldScalingFactor)),
00179       false);
00180   }
00181 
00182   bool isSliderConstraint(const btTypedConstraint *ptr)
00183   {
00184     return dynamic_cast<const btSliderConstraint *>(ptr) != NULL;
00185   }
00186 
00187   double getLowerLinLimit(/*const*/ btSliderConstraint *slider)
00188   {
00189     return slider->getLowerLinLimit();
00190   }
00191 
00192   void setLowerLinLimit(btSliderConstraint *slider, double lowerLimit)
00193   {
00194     slider->setLowerLinLimit(lowerLimit);
00195   }
00196 
00197   double getUpperLinLimit(/*const*/ btSliderConstraint *slider)
00198   {
00199     return slider->getUpperLinLimit();
00200   }
00201 
00202   void setUpperLinLimit(btSliderConstraint *slider, double lowerLimit)
00203   {
00204     slider->setUpperLinLimit(lowerLimit);
00205   }
00206 
00207   double getLowerAngLimit(btSliderConstraint *slider)
00208   {
00209     return slider->getLowerAngLimit();
00210   }
00211   
00212   void setLowerAngLimit(btSliderConstraint *slider, double lowerLimit)
00213   {
00214     slider->setLowerAngLimit(lowerLimit);
00215   }
00216 
00217   double getUpperAngLimit(/*const*/ btSliderConstraint *slider)
00218   {
00219     return slider->getUpperAngLimit();
00220   }
00221 
00222   void setUpperAngLimit(btSliderConstraint *slider, double lowerLimit)
00223   {
00224     slider->setUpperAngLimit(lowerLimit);
00225   }
00226 
00227         double getSoftnessDirLin(/*const*/ btSliderConstraint *slider)
00228   {
00229     return slider->getSoftnessDirLin();
00230   }
00231   
00232         double getRestitutionDirLin(/*const*/ btSliderConstraint *slider)
00233   {
00234     return slider->getRestitutionDirLin();
00235   }
00236   
00237         double getDampingDirLin(/*const*/ btSliderConstraint *slider)
00238   {
00239     return slider->getDampingDirLin();
00240   }
00241   
00242         double getSoftnessDirAng(/*const*/ btSliderConstraint *slider)
00243   {
00244     return slider->getSoftnessDirAng();
00245   }
00246   
00247         double getRestitutionDirAng(/*const*/ btSliderConstraint *slider)
00248   {
00249     return slider->getRestitutionDirAng();
00250   }
00251   
00252         double getDampingDirAng(/*const*/ btSliderConstraint *slider)
00253   {
00254     return slider->getDampingDirAng();
00255   }
00256   
00257         double getSoftnessLimLin(/*const*/ btSliderConstraint *slider)
00258   {
00259     return slider->getSoftnessLimLin();
00260   }
00261   
00262         double getRestitutionLimLin(/*const*/ btSliderConstraint *slider)
00263   {
00264     return slider->getRestitutionLimLin();
00265   }
00266   
00267         double getDampingLimLin(/*const*/ btSliderConstraint *slider)
00268   {
00269     return slider->getDampingLimLin();
00270   }
00271   
00272         double getSoftnessLimAng(/*const*/ btSliderConstraint *slider)
00273   {
00274     return slider->getSoftnessLimAng();
00275   }
00276   
00277         double getRestitutionLimAng(/*const*/ btSliderConstraint *slider)
00278   {
00279     return slider->getRestitutionLimAng();
00280   }
00281   
00282         double getDampingLimAng(/*const*/ btSliderConstraint *slider)
00283   {
00284     return slider->getDampingLimAng();
00285   }
00286   
00287         double getSoftnessOrthoLin(/*const*/ btSliderConstraint *slider)
00288   {
00289     return slider->getSoftnessOrthoLin();
00290   }
00291   
00292         double getRestitutionOrthoLin(/*const*/ btSliderConstraint *slider)
00293   {
00294     return slider->getRestitutionOrthoLin();
00295   }
00296   
00297         double getDampingOrthoLin(/*const*/ btSliderConstraint *slider)
00298   {
00299     return slider->getDampingOrthoLin();
00300   }
00301   
00302         double getSoftnessOrthoAng(/*const*/ btSliderConstraint *slider)
00303   {
00304     return slider->getSoftnessOrthoAng();
00305   }
00306   
00307         double getRestitutionOrthoAng(/*const*/ btSliderConstraint *slider)
00308   {
00309     return slider->getRestitutionOrthoAng();
00310   }
00311   
00312         double getDampingOrthoAng(/*const*/ btSliderConstraint *slider)
00313   {
00314     return slider->getDampingOrthoAng();
00315   }
00316 
00317         void setSoftnessDirLin(btSliderConstraint *slider, double softnessDirLin)
00318   {
00319     slider->setSoftnessDirLin(softnessDirLin);
00320   }
00321   
00322         void setRestitutionDirLin(btSliderConstraint *slider, double restitutionDirLin)
00323   {
00324     slider->setRestitutionDirLin(restitutionDirLin);
00325   }
00326   
00327         void setDampingDirLin(btSliderConstraint *slider, double dampingDirLin)
00328   {
00329     slider->setDampingDirLin(dampingDirLin);
00330   }
00331   
00332         void setSoftnessDirAng(btSliderConstraint *slider, double softnessDirAng)
00333   {
00334     slider->setSoftnessDirAng(softnessDirAng);
00335   }
00336   
00337         void setRestitutionDirAng(btSliderConstraint *slider, double restitutionDirAng)
00338   {
00339     slider->setRestitutionDirAng(restitutionDirAng);
00340   }
00341   
00342         void setDampingDirAng(btSliderConstraint *slider, double dampingDirAng)
00343   {
00344     slider->setDampingDirAng(dampingDirAng);
00345   }
00346   
00347         void setSoftnessLimLin(btSliderConstraint *slider, double softnessLimLin)
00348   {
00349     slider->setSoftnessLimLin(softnessLimLin);
00350   }
00351   
00352         void setRestitutionLimLin(btSliderConstraint *slider, double restitutionLimLin)
00353   {
00354     slider->setRestitutionLimLin(restitutionLimLin);
00355   }
00356   
00357         void setDampingLimLin(btSliderConstraint *slider, double dampingLimLin)
00358   {
00359     slider->setDampingLimLin(dampingLimLin);
00360   }
00361   
00362         void setSoftnessLimAng(btSliderConstraint *slider, double softnessLimAng)
00363   {
00364     slider->setSoftnessLimAng(softnessLimAng);
00365   }
00366   
00367         void setRestitutionLimAng(btSliderConstraint *slider, double restitutionLimAng)
00368   {
00369     slider->setRestitutionLimAng(restitutionLimAng);
00370   }
00371   
00372         void setDampingLimAng(btSliderConstraint *slider, double dampingLimAng)
00373   {
00374     slider->setDampingLimAng(dampingLimAng);
00375   }
00376   
00377         void setSoftnessOrthoLin(btSliderConstraint *slider, double softnessOrthoLin)
00378   {
00379     slider->setSoftnessOrthoLin(softnessOrthoLin);
00380   }
00381   
00382         void setRestitutionOrthoLin(btSliderConstraint *slider, double restitutionOrthoLin)
00383   {
00384     slider->setRestitutionOrthoLin(restitutionOrthoLin);
00385   }
00386   
00387         void setDampingOrthoLin(btSliderConstraint *slider, double dampingOrthoLin)
00388   {
00389     slider->setDampingOrthoLin(dampingOrthoLin);
00390   }
00391   
00392         void setSoftnessOrthoAng(btSliderConstraint *slider, double softnessOrthoAng)
00393   {
00394     slider->setSoftnessOrthoAng(softnessOrthoAng);
00395   }
00396   
00397         void setRestitutionOrthoAng(btSliderConstraint *slider, double restitutionOrthoAng)
00398   {
00399     slider->setRestitutionOrthoAng(restitutionOrthoAng);
00400   }
00401   
00402         void setDampingOrthoAng(btSliderConstraint *slider, double dampingOrthoAng)
00403   {
00404     slider->setDampingOrthoAng(dampingOrthoAng);
00405   }
00406   
00407   void setPoweredLinMotor(btSliderConstraint *slider, bool onOff)
00408   {
00409     slider->setPoweredLinMotor(onOff);
00410   }
00411 
00412   bool getPoweredLinMotor(/*const*/ btSliderConstraint *slider)
00413   {
00414     return slider->getPoweredLinMotor();
00415   }
00416 
00417         void setTargetLinMotorVelocity(btSliderConstraint *slider, double targetLinMotorVelocity)
00418   {
00419     slider->setTargetLinMotorVelocity(targetLinMotorVelocity * bulletWorldScalingFactor);
00420   }
00421   
00422         double getTargetLinMotorVelocity(/*const*/ btSliderConstraint *slider)
00423   {
00424     return slider->getTargetLinMotorVelocity() / bulletWorldScalingFactor;
00425   }
00426   
00427   void setMaxLinMotorForce(btSliderConstraint *slider, double maxLinMotorForce)
00428   {
00429     slider->setMaxLinMotorForce(maxLinMotorForce * bulletWorldScalingFactor);
00430   }
00431   
00432         double getMaxLinMotorForce(/*const*/ btSliderConstraint *slider)
00433   {
00434     return slider->getMaxLinMotorForce() / bulletWorldScalingFactor;
00435   }
00436   
00437         void setPoweredAngMotor(btSliderConstraint *slider, bool onOff)
00438   {
00439     slider->setPoweredAngMotor(onOff);
00440   }
00441   
00442         bool getPoweredAngMotor(/*const*/ btSliderConstraint *slider)
00443   {
00444     return slider->getPoweredAngMotor();
00445   }
00446   
00447         void setTargetAngMotorVelocity(btSliderConstraint *slider, double targetAngMotorVelocity)
00448   {
00449     slider->setTargetAngMotorVelocity(targetAngMotorVelocity);
00450   }
00451   
00452         double getTargetAngMotorVelocity(/*const*/ btSliderConstraint *slider)
00453   {
00454     return slider->getTargetAngMotorVelocity();
00455   }
00456   
00457         void setMaxAngMotorForce(btSliderConstraint *slider, double maxAngMotorForce)
00458   {
00459     slider->setMaxAngMotorForce(maxAngMotorForce);
00460   }
00461   
00462         double getMaxAngMotorForce(/*const*/ btSliderConstraint *slider)
00463   {
00464     return slider->getMaxAngMotorForce();
00465   }
00466   
00467         double getLinearPos(/*const*/ btSliderConstraint *slider)
00468   {
00469     return slider->getLinearPos() / bulletWorldScalingFactor;
00470   }
00471   
00472 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Friends


cl_bullet
Author(s): Lorenz Moesenlechner
autogenerated on Thu May 23 2013 05:47:18