Voronoi colorized spanning tree
A Voronoi diagram of 1000 random sites is colored by a spanning tree that connects each site to its nearest neighbor closer to a moving root point. As the mouse moves, the root updates, the tree edges redraw, and every cell's fill derives from the tree's branch angles and depth. The example uses d3.v4 with `d3.voronoi` to compute cells and custom `diagram.find` and `diagram.next` methods for tree construction, then renders SVG polygons and lines with HSL colors.
AI-generated descriptionUsing <a href='http://bl.ocks.org/Fil/1b7ddbcd71454d685d1259781968aefc'>Voronoi.find(x,y)</a> to create a spanning tree.
The strategy is to hop from any site to the nearest site that is nearer to the designated root (See <a href='http://bl.ocks.org/Fil/2d10b09c5c50eee6d311ad5272b95a27'>Voronoi spanning tree 2</a>).
We then traverse the tree to paint the cells with nice colors.
Original work by Philippe Rivière for d3-voronoi (issue 17).