|
![](/i/fill.gif) |
Chambers wrote:
> So I was writing a general particle system capable of spitting out POV-Ray
> code (as SDL solutions are too slow for my tastes), and I found MegaPOV
> with mechsim. Needless to say, I've been busy playing with it, and find it
> both complete and effective. Good job on a good patch!
Thanks.
> Anyway, I noticed that I'm still not happy with the simulation speed, so I
> looked at the code for the patch. Collisions are checked between masses by
> calculating the distance, which requires a sqrt call. The only way I can
> think of to speed that up is to use a box format first, such as this
> pseudocode:
>
> if ((abs(dx)<max) and (abs(dy)<max)) and (abs(dz)<max)))
> if (sqrt(dx^2+dy^2+dz^2)<max)
> collision is true
> end
> end
This would be just a bounding box test that would certainly speed up the
collisions a bit but would not change anything about the principal
problem of mass interactions being O(n^2). You should have a look at
what Daniel Jungmann wrote recently (a few threads ago) which was mostly
meant for mass-face-collisions but also works on mass-mass collisions to
some extent.
And the sqrt() has to be calculated for all collisions that actually
occur since the force depends on the distance.
Christoph
--
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 01 May. 2004 _____./\/^>_*_<^\/\.______
Post a reply to this message
|
![](/i/fill.gif) |