I am making a physics engine for my computer science class and couldn't figure out how to get the spring/mass system to come to equilibrium into a box-like shape such as the one on the left. I can understand why the one on the right is in equilibrium but I don't know how to make the system not do that. (Keep in mind, these are ideal springs and point-particles so the springs pass through each other)
All the springs have the same spring constant and there is no force exerted on the particle in the x/y direction if the two particles' x/y components are separated by 0.5m
Fx(1) = -k[(x2-x1)-0.5] + -k[(x3-x1)-0.5] + -k[(x4-x1)-0.5]
Fy(1) = -k[(y2-y1)-0.5] + -k[(y3-y1)-0.5] + -k[(y4-y1)-0.5] [/B]
and so on...
The Attempt at a Solution
I tested each of the 6 springs individually on their two important masses and it definitely brings them to equilibrium 0.5m apart (in the relevant components -- so for the diagonals technically .707 but still 0.5 in each component)
My intuition tells me that the spring constants along the diagonals should be different but because I am working with components but I feel like because the diagonals work as intended on their own, I should just leave them be.
Not quite sure where I went wrong or what I could change about the diagonals