Skip to main content
100%

Annulus Sampling II

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

A static annulus is drawn on a Canvas, with points appearing over time to demonstrate uniform random sampling within the ring. The code uses the D3.js timer to animate the process, plotting 50 new points per frame. Each point’s radius is derived from the square root of a uniform random value scaled between the squared inner and outer radii, ensuring spatial uniformity. The implementation relies on Canvas API calls like `arc()` and `fill()`, with the sampling logic computed via JavaScript’s `Math.random()` and trigonometric functions.

AI-generated description

A demonstration of how to chose a random point uniformly within an annulus. Compare to naïve sampling.

gpl-3.0 Licensed

Similar vizzes