512 Chapter 9 Physics
The number of particles in the mass-spring system is passed to the constructor. The
second parameter,
fStep, is the step size used in the Runge-Kutta numerical solver.
After construction, you must set the spring constants and spring resting lengths via
the appropriate member functions.
The
Acceleration function is an override of the base class virtual function and is
what is called by the Runge-Kutta numer ical solver. This function handles the internal
forces that the springs exert on the masses. The implementation is
template <class Real, class TVector>
TVector MassSpringCurve<Real,TVector>::Acceleration (int i, Real fTime,
const TVector* akPosition, const TVector* akVelocity)
{
TVector kAcceleration = ExternalAcceleration(i,fTime, ...