Physics simulation of masses and springs