29 #include "BulletDynamics/Dynamics/btRigidBody.h"
30 #include "btBulletDynamicsCommon.h"
36 double f,
double rf,
double res) :
43 if (
density < 0.0) {
throw std::range_error(
"Negative density"); }
44 if (
radius < 0.0) {
throw std::range_error(
"Negative radius"); }
45 if (
friction < 0.0) {
throw std::range_error(
"Negative friction"); }
46 if (
rollFriction < 0.0) {
throw std::range_error(
"Negative roll friction"); }
47 if (
restitution < 0.0) {
throw std::range_error(
"Negative restitution"); }
48 if (
friction > 1.0) {
throw std::range_error(
"Friction > 1"); }
49 if (
rollFriction > 1.0) {
throw std::range_error(
"Roll Friction > 1"); }
50 if (
restitution > 1.0) {
throw std::range_error(
"Restitution > 1"); }
59 tgRod::tgRod(btRigidBody* pRigidBody,
63 m_pRigidBody(pRigidBody),
64 m_mass((m_pRigidBody->getInvMass() > 0.0) ?
65 1.0 / (m_pRigidBody->getInvMass()) :
69 if (pRigidBody == NULL)
71 throw std::invalid_argument(
"Pointer to btRigidBody is NULL");
76 assert(m_pRigidBody == pRigidBody);
100 assert(m_pRigidBody->getMotionState() != NULL);
102 btTransform transform;
103 m_pRigidBody->getMotionState()->getWorldTransform(transform);
104 const btVector3& result = transform.getOrigin();
110 bool tgRod::invariant()
const
113 (m_pRigidBody != NULL) &&
Config(double r=0.5, double d=1.0, double f=0.5, double rf=0.0, double res=0.0)
const double rollFriction
btVector3 centerOfMass() const
virtual void render(const tgRod &rod) const
Contains the definition of interface class tgModelVisitor.
Contains the definition of class tgRod $Id$.
virtual void onVisit(const tgModelVisitor &v) const