git-svn-id: https://reactphysics3d.googlecode.com/svn/trunk@111 92aac97c-a6ce-11dd-a772-7fcde58d38e6

This commit is contained in:
chappuis.daniel 2009-03-07 14:40:14 +00:00
parent 3e2ea5acd9
commit 320913007c
2 changed files with 17 additions and 3 deletions

View File

@ -39,7 +39,7 @@ BodyState::BodyState(const BodyState& bodyState)
: position(bodyState.position), linearMomentum(bodyState.linearMomentum), orientation(bodyState.orientation),
angularMomentum(bodyState.angularMomentum), linearVelocity(bodyState.linearVelocity),
angularVelocity(bodyState.angularVelocity), spin(bodyState.spin), inertiaTensorInverse(bodyState.inertiaTensorInverse),
massInverse(bodyState.massInverse) {
massInverse(bodyState.massInverse), force(bodyState.force) {
}
// Destructor
@ -86,11 +86,11 @@ void BodyState::computeAtTime(const Time& timeStep, const DerivativeBodyState& l
// Return the force on the body at time t
Vector3D BodyState::computeForce(Time time) const {
// TODO : Implement this method
return Vector3D(0.0, 0.0, 0.0);
return force + Vector3D(0.0, 0.0, 0.0);
}
// Return the torque on the body at time
Vector3D BodyState::computeTorque(Time time) const {
// TODO : Implement this method
return Vector3D(0.0, 0.0 ,0.0);
return force + Vector3D(0.0, 0.0 ,0.0);
}

View File

@ -40,6 +40,7 @@ class BodyState {
Vector3D linearMomentum; // Linear momentum of the body
Quaternion orientation; // Orientation quaternion of the body
Vector3D angularMomentum; // Angular momentum of the body
Vector3D force; // force on the body
// Secondary values
Vector3D linearVelocity; // Linear velocity of the body
@ -68,6 +69,8 @@ class BodyState {
Quaternion getSpin() const; // Return the spin of the body
void setMassInverse(Kilogram massInverse); // Set the inverse of the mass
void setInertiaTensorInverse(const Matrix3x3& inertiaTensorInverse); // Set the inverse of the inertia tensor
Vector3D getForce() const; // Return the force over the body
void setForce(const Vector3D force); // Set the force over the body
void recalculate(); // Recalculate the secondary values
// of the BodyState from the primary ones
@ -144,6 +147,17 @@ inline void BodyState::setInertiaTensorInverse(const Matrix3x3& inertiaTensorInv
this->inertiaTensorInverse = inertiaTensorInverse;
}
// Return the force over the body
inline Vector3D BodyState::getForce() const {
return force;
}
// Set the force over the body
inline void BodyState::setForce(const Vector3D force) {
this->force = force;
}
} // End of the ReactPhysics3D namespace
#endif