|
![](/i/fill.gif) |
Invisible wrote:
> OK, so here's a question.
>
> I have a particle system that implements RK4 integration. It works
> great. However... for each step, it involves computing the force acting
> on a particle several times. That's fine if the force is an invariant
> function of the particle's position and/or velocity (and possibly time).
> But what do you do if the forces acting on a particle depend on the
> positions of the other particles? o_O
If you have a natural fear of O(N^2) problems, then I have some bad news
for you.
To accurately calculate the current force on each particle in a system,
you have to match up every possible pair of particles, all (n^2-n)/2 of
such pairs, and calculate the force that each of the particles in the
pair exerts on the other (generally equal and opposite, according to Mr.
Newton, so there is only one force calculation for each pair).
Try to get n as low as possible.
Regards,
John
Post a reply to this message
|
![](/i/fill.gif) |