|
![](/i/fill.gif) |
David Buck wrote:
>
> In a nutshell, you need to implement something called a differential
> equation solver.
I have been nurturing the idea of developing some Laplace transform
macros for POV-Ray. Definitely not a project for the timid, or the
math-impaired.
> One technique (which is not very good) is to use Euler's Method.
> Basically, you calculate all the forces at any point in time. Gravity
> would be F=mg, springs are F= -kd, air resistance is F= -cv where c is
> the air resistance constant. From the forces you can calculate the
> accelerations of the particles (a=F/m). From the accelerations you can
> calculate the velocities (v2=v1 + at where t is the time increment) and
> from the velocities you can calculate the new positions (p2=p1 + vt).
Let me point out here that re-calculating the new position first, with the
formula P' = P + Vt + At^2/2 yields less inaccurate results. This still
results in an accumulating degree of imprecision; modifying the equations
to include third-order behavior reduces the imprecision; a bit of drag
(the cV factor you mention above) will reduce the wild thrashing that can
result from the accumulating errors.
> Then you recalculate the forces and do it all again.
>
> A better way (used by ElastoLab) is Adaptive Runge-Kutta but that
> technique goes well beyond what I can explain in a simple email.
For those interested, feed "Runge-Kutta" into your friendly
neighborhood search engine. Google registers over 3000 hits.
Regards,
John
Post a reply to this message
|
![](/i/fill.gif) |