if someone is interested in those algorithms/ideas:
GRAPHICS
I) the graphics part is i think to strightforward to more widely describe (you simply fire drawing calls, transform if form global coordinates to camera cordinates, and draw it as 2d routines on screen)
here i use my own rasterizer which is even kinda messy and maybe even slightly buggy (i cast 3d balls as a 2d balls which is afair not proper, also i cast 3d line as a 2 points to 2d than draw 2d line which also is not proper)
i also got a messy block of code related to 'mouse wrapping' which sometimes scaries me (but tnk to the windows for it [longer story])
PHYSICS
II) physical part is just like that, if
balls overlap i generate force equal to
float force = (pen*.3)*(pen*.3)
where pen is this penetration (balls overlaping in neutral units) this .3 was taken experimentally
then i change velocity from newton law
ball[i].vx+= (dx/d)* force /Mi;
//dx/d is a part of 'normal' (unity vector) just pointing the direction
thats about it (it taked some think to think it up but finally it showed thsi works fine)
as to border collisions:
ball[i].vx += H* pen ;
where pen is wall penetration and H = - 1.0; in that case
as to link forces (last form 3 that are acts here, two mentioned was ball-ball, ball-wall) it is
ball[i].vx+= -(dx/d)*force/Mi;
where that link force is in that case
force = (dev*.9)*(dev*.9)*sign(dev);
where dev is in that case 'deiation' (?)
from the distance that 'join' (link) prefers to keep between balls
thise all 3 magic numbers and all formulas i worged out experimentally
i could also give you numbers on sizes and masses but i need rest a bit
the containing box is from -700 to 700
in all 3 dimensions
ball radiuses are 8, 16, 18 and 20
most join distances are keeped at 100
masses of balls are usually set to 18 or 20
i give those numbers btw as quality of simulations seem to depend on them, and its important to find some well chosen valiues (what i set is not quite carefully chosen)
also maybe should note i calcilate 7 physical iteretions on one graphical draw of frame, and also dumping force of
ball[i].vx*=0.99990;
is set