Stippling
This stippling example uses a capacity-constrained point distribution algorithm to render a portrait of President Obama from a grayscale source image. The canvas displays 2000 colored sites, each with 15 assigned points, which iteratively swap points and recenter to achieve a uniform, dense stipple pattern. The animation runs in a loop, redrawing the points and site locations every frame. The code uses Canvas `getImageData` to read pixel density, then applies a custom algorithm with flat typed arrays (`Float32Array`, `Uint32Array`) to optimize performance in the browser.
AI-generated descriptionStress testing the stippling application of this capacity-constrained distribution method. By storing everything in a few flat typed arrays, a group of 2000 sites seems possible (though still quite slow) in browser.
See also: Philippe Rivière's neighbors-of-neighbors variation on the algorithm
forked from <a href='http://bl.ocks.org/veltman/'>veltman</a>'s block: <a href='http://bl.ocks.org/veltman/04dc09a2fd164da21f34c5301538cb0e'>Stippling</a>