Skip to main content
100%

Mitchell’s Best-Candidate IV

✓ Published0🌍 Public
Mmbostock
Last edited Feb 9, 2016
Created on Jun 6, 2014

This example reconstructs a low-fidelity version of Van Gogh’s *The Starry Night* on a Canvas element. The page loads the original image, samples 10,000 points using a best-candidate algorithm that maximizes spacing between random points, and then draws a Voronoi diagram where each cell is filled with the color of the source pixel nearest the cell’s seed. The implementation uses d3.v3’s `d3.geom.quadtree` for fast nearest-neighbor searches during sampling and `d3.geom.voronoi` to compute the clipped cells. Colors are read directly from the loaded image via Canvas `getImageData` and applied with `fillStyle`. The result is a stylized, mosaic-like approximation of the painting.

AI-generated description

10,000 best-candidate samples of Van Gogh’s The Starry Night. Compare to poisson-disc samples.

gpl-3.0 Licensed

Similar vizzes