Nodes that mutually repel each other self-organise into an even spatial distribution without explicit placement logic
In a repulsion-based layout, each agent computes an outward force from every other agent, accumulates a velocity vector, and updates its position each frame. Starting all nodes at the canvas centre, they naturally spread to fill the canvas evenly — no explicit grid or placement is needed. This is an emergent spatial property: global order arises from purely local rules. Key parameters are force strength and a minimum-distance clamp to prevent infinite repulsion at overlap. The pattern extends to attract+repel graph layouts: edges attract connected nodes while all nodes repel each other, producing readable graph drawings.
Examples
nodes[i].attractNodes(nodes); nodes[i].update(); // M_6_1_01 starts 200 nodes at centre; after ~60 frames they cover the canvas uniformly. distribute nodes on the display by letting them repel each other.
Assessment
Modify the repulsion sketch to also draw lines between nodes closer than 80px. Describe how adding attraction along those edges would change the equilibrium configuration.