- #1
fargoth
- 320
- 6
Hi, I've got a list of particles (where each particle has it's coordinates in space and velocity)
these particles can interact with each-other ([tex]f=\frac{a}{r^4}-\frac{b}{r^8}[/tex])
(i'll add 6 - 12 soon too)
anyway, as it is now, the program has a complexity of [tex]O(\frac{n(n-1)}{2})[/tex]
because every pair has to be calculated to get the force.
the problem is - its too slow for realtime simulation - and i want it to be interactive (changing the temperature, zooming in and out, etc.)
so, i started thinking about approximations i could do to make it work with O(n), and still get good results...
I think calculating the force for near neighbors is enough - but then i need a quick way to know who those neighbors are for a given particle (in less then O(n)).
I thought i'd use an octree (for 3D case) or quadtree (for 2D case), but i can't think of a way to maintain it - because the particles are always moving from place to place... i need to rebuild it each time...
I hope i was clear enough.. my question is - do you think my approach is the best one?
do you have any suggestion as to how to maintain the tree, or alternatively use a better approximation?
these particles can interact with each-other ([tex]f=\frac{a}{r^4}-\frac{b}{r^8}[/tex])
(i'll add 6 - 12 soon too)
anyway, as it is now, the program has a complexity of [tex]O(\frac{n(n-1)}{2})[/tex]
because every pair has to be calculated to get the force.
the problem is - its too slow for realtime simulation - and i want it to be interactive (changing the temperature, zooming in and out, etc.)
so, i started thinking about approximations i could do to make it work with O(n), and still get good results...
I think calculating the force for near neighbors is enough - but then i need a quick way to know who those neighbors are for a given particle (in less then O(n)).
I thought i'd use an octree (for 3D case) or quadtree (for 2D case), but i can't think of a way to maintain it - because the particles are always moving from place to place... i need to rebuild it each time...
I hope i was clear enough.. my question is - do you think my approach is the best one?
do you have any suggestion as to how to maintain the tree, or alternatively use a better approximation?