You mean you would make the collision in the beginning artificial and then with every collision you would artificially correct their path to the beforehand calculated one?
Now you let them orbit around the gravity center with random start positions/velocities (simulation).
Delete all tiny dots in simulation that collide.
Check for every tiny dot that is left, what was the nearest distance to any other dot during orbit. Increase the radius of tiny dot to that minimal distance.
Run simulation again with same positions/velocities but without the dots that had collision and with increased dot size as calculated.
EDIT: I know that it's not how it actually works. It was an answer to "How could I implement this, if I want that behavior on purpose"
Tbh it would probably be simpler to start with exclusively large dots and every time there is a hit, simply shave off exactly as much radius as is needed to prevent that collision the next time. If the dot becomes too tiny, delete it, just to make it not look messy.
If you reduce the radius instead of increasing, you get rid of the whole complexity of figuring out the maximum possible radius based on other dots orbits.
Anyway, both of these approaches might take quite a while to run if the system isn't periodic over a reasonable time-frame.
That is a genius way of getting the same affect, but I would be much more interested in how the above actually works. The above comes from some sort of physics, the ball sizes are predetermined and the engine figures out the optimal paths. That is way more interesting than just forcefully generating this effect.
Wouldn’t you want to increase the radius by half of that tiny distance between them, at least in some cases? Because for the dot that you were minimally close to, it may form a pair where you were the dot that that dot was also minimally close to, so you’d both increase by the distance between you and end up colliding.
Unless it can be proven that no such pair will ever exist (which I don’t think is the case - I mean certainly not with just 2 dots for example because you’d always be minimally close to the other dot because there is no other option).
And then because you’re only increasing by half the distance, you wouldn’t be maximally big in the cases where you didn’t form a pair...maybe you could mitigate this by checking for pairs and adding half when you’re in a pair and full when you’re not which would add a little complexity to each dot calculation (O(the number of dots)) but not much.
28
u/anyonethinkingabout Jun 25 '20
no, you calculate the bubble sizes beforehand, before rendering