K-Means Voronoi Relaxation
This interactive visualization uses k-means clustering and Lloyd’s algorithm to relax a Voronoi diagram, normalizing the dispersion of 20,000 random points across 100 polygons. As the animation runs, each polygon’s center moves toward the centroid of its assigned points, equalizing polygon populations over successive steps. The SVG rendering uses D3 v4’s `d3.voronoi` for polygon generation, with color scaling from white to black indicating point density per cell, and text labels showing live counts. Buttons control start, stop, and redraw actions, while deviation statistics update in real time.
AI-generated descriptionThis is an experiment in moving and shaping voronoi polygons to normalize the dispersion of points. The idea arose while <a href="http://bl.ocks.org/alexmacy/6272668a45ce0f8a1fed7880814bc21e" target="_blank">mapping emergency calls logged by the San Francisco Fire Department</a>, and was also inspired by Noah Veltman's <a href="http://bl.ocks.org/veltman/3d1fb70e6993d4eb2eff7112c9e7bcf4" target="_blank">Voronoi relaxation</a>.
To do this, I kind of combined aspects of <a href="//en.wikipedia.org/wiki/Lloyd%27s_algorithm" target="_blank">Lloyd's algorithm</a> and <a href="https://en.wikipedia.org/wiki/K-means_clustering" target="_blank">k-means clustering</a>.