POV-Ray : Newsgroups : povray.animations : Motion simulation : Re: Motion simulation Server Time
28 Sep 2024 20:40:29 EDT (-0400)
  Re: Motion simulation  
From: Ryan Bennitt
Date: 29 Oct 2003 17:08:09
Message: <3fa03a49@news.povray.org>
> Hmm, having written all that out, I'm not entirely sure how you go about
> applying it to your system. This could be tricky due to the fact you're
> calculating both position and velocity from your acceleration values, which
> ifself is position/velocity dependent. Hmm, I'm going to have to think about
> this for a while...

Right, worked out what was confusing me. There's something not quite right about
your equations. Between each time step you are assuming that the acceleration is
constant. This is fine, and is due to your use of Euler's integration. However
your equations aren't reflecting this. Typically the equations of motion of a
particle with constant accleration are of the form:

v = v0 + a * t
p = p0 + v0 * t + 0.5 * a * t^2

For your system the following substitutions should be made:
t = ts (= time step)
v = v[n+1] (= velocity at next time step)
p = p[n+1] (= position at next time step)
v0 = v[n] (= current velocity)
p0 = p[n] (= current position)
a = a[n] (= acceleration calculated from resultant of forces at current time)

Therefore the equations of motion should be of the form:

v[n+1] = v[n] + a[n] * ts
p[n+1] = p[n] + v[n] * ts + 0.5 * a[n] * ts^2

Factoring in the equation for velocity into the equation for position you get:

p[n+1] = p[n] + 0.5 * ( v[n] + v[n+1] ) * ts

However your equations were of the form:

v[n+1] = v[n] + a[n] * ts
p[n+1] = p[n] + v[n+1] * ts

which is incorrect. Your equations were assuming that the position would change
according to the future velocity, whereas with a constant acceleration it would
change according to the average of the current and future velocity.

This should make it easier to apply Runge-Kutta, but not by much. I'm still not
too clear on how myself, but I'm working on it...

Ryan


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.