Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- constant c_inverse_squares
- constant c_springs
- constant c_gravity
- constant c_dampening
- foreach (node n1)
- foreach (node n2)
- force = (0, 0)
- if (n1 != n2)
- force += inverse_squares (n1, n2)
- force += gravity (n1, n2)
- if (n1 isconnectedto n2)
- force += hookelaw (n1, n2)
- endif
- endif
- n1.velocity += force
- n1.velocity *= c_dampening
- end
- end
- for nodes { position += node.velocity}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement