Collision Detection (Canvas)
✓ Published0🌍 Public
Mmbostock
Last edited Feb 9, 2016
Created on Aug 1, 2012
This example demonstrates a force-directed layout with collision detection among 200 nodes. A fixed root node acts as a repulsive force, while the user can move it by mousing over the canvas, causing nearby nodes to repel away. The visualization uses the d3.layout.force simulation library, with a d3.geom.quadtree for efficient spatial collision checks. Rendering is done on an HTML5 Canvas via the getContext("2d") API, drawing all nodes as steelblue circles on each tick. The code is adapted from a talk on force layouts, showing real-time interaction and physics-based movement.
AI-generated descriptionA fork of the SVG version. Mouseover to repel nodes. Adapted from my talk on force layouts.
gpl-3.0 Licensed