Today I wrote a Mass Spring Damper system in Flash that uses the

positions of genres as determined by a self organizing map as initial

starting positions. Plus, it looks cool:

Here's some of the resources I used:

Euclidean distance

CVector3 Class Reference

CVector3

Mass on a Spring

Coulomb's law in Vector form.

Coulomb's law

Electric charge and Coulomb's law

Vector Addition

What is a Vector

Finding the magnitude or length of a vector

Euclidean Vector

Vector Magnitude

Stress majorization

Force Based Algorithm - Fantastic resource:

set up initial node velocities to (0,0)

set up initial node positions randomly // make sure no 2 nodes are in exactly the same position

loop

total_kinetic_energy := 0 // running sum of total kinetic energy over all particles

for each node

net-force := (0, 0) // running sum of total force on this particular node

for each other node

net-force := net-force + Coulomb_repulsion( this_node, other_node )

next node

for each spring connected to this node

net-force := net-force + Hooke_attraction( this_node, spring )

next spring

// without damping, it moves forever

this_node.velocity := (this_node.velocity + timestep * net-force) * damping

this_node.position := this_node.position + timestep * this_node.velocity

total_kinetic_energy := total_kinetic_energy + this_node.mass * (this_node.velocity)^2

next node

until total_kinetic_energy is less than some small number //the simulation has stopped moving

Mass Spring System - Some C++ code that kinda helped, but not so much.

Mass Spring Damper Example

Harmonic oscillator

Damping