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

This commit is contained in:
chappuis.daniel 2009-09-06 17:10:13 +00:00
parent bf096063bd
commit b184152773
2 changed files with 4 additions and 2 deletions

View File

@ -19,6 +19,7 @@
// Libraries
#include "RK4.h"
#include <cassert>
// We want to use the ReactPhysics3D namespace
using namespace reactphysics3d;
@ -52,7 +53,7 @@ DerivativeBodyState RK4::evaluate(const BodyState& bodyState, const Time& time)
}
// Compute a derivative body state at time t + dt according to the last derivative body state
DerivativeBodyState RK4::evaluate(BodyState& bodyState, const Time& time, const Time& timeStep,
DerivativeBodyState RK4::evaluate(BodyState bodyState, const Time& time, const Time& timeStep,
const DerivativeBodyState& lastDerivativeBodyState) {
// Compute the bodyState at time t + dt
bodyState.computeAtTime(timeStep, lastDerivativeBodyState);
@ -69,6 +70,7 @@ DerivativeBodyState RK4::evaluate(BodyState& bodyState, const Time& time, const
// Integrate a body state over time. This method use the RK4 integration algorithm
void RK4::integrate(BodyState& bodyState, const Time& time, const Time& timeStep) {
// Compute the 4 derivatives body states at different time values.
DerivativeBodyState a = evaluate(bodyState, time);
DerivativeBodyState b = evaluate(bodyState, time, timeStep*0.5, a);

View File

@ -38,7 +38,7 @@ namespace reactphysics3d {
class RK4 : public IntegrationAlgorithm {
private :
DerivativeBodyState evaluate(const BodyState& bodyState, const Time& time); // Compute a derivative body state
DerivativeBodyState evaluate(BodyState& bodyState, const Time& time,
DerivativeBodyState evaluate(BodyState bodyState, const Time& time,
const Time& timeStep, const DerivativeBodyState& lastDerivativeBodyState); // Compute a derivative body state
public :