My name is Alex and I am from Romania. Firstly I cannot thank you enough for providing these examples and explanations. It has helped me a lot.
I am working on a 2D modable pool game and the 2D collision program was a lifesaver. It is better than any of my previous attempts and although I was never very good at mathematics and especially physics, I finally understand things in a bit more depth.
I have managed to create a little test frame for multiple ball collisions using a 0.1 of a pixel iteration for each ball
(int)Math.ceil((10000/UPDATE_RATE)/0.1); //number of tests per frame with an iteration that is ALWAYS below 0.1 of a pixel
and dividing the speeds accordingly to match the iteration.
This method actually works, but I am realizing that it is extremely inefficient and there is always a loss(which I may be able to accept though) since the balls have to always overlap(worst case possible 0.2 in between two balls) and then pull back r1+r2+0.01 across the segment that connects their centers so that they do not collide anymore when it happens. (0.01 is something to ignore the double variable imprecision). At more than 30-40 balls lag can inevitably be felt.
I haven't used EJS before. I will try this program. Also is there any way you could kindly provide the .java code file for the .jar file provided? It would help me immensely and I would like to ask if it is ok to use fragments of code from your applets into personal projects. I will give credit if necessary once the application is done!
Thank you again!