Small, interactive experiments.
Algorithms are easier to understand when you can poke at them. Everything here runs in your browser.
01Neighbourhoods
Nearest neighbours and normal estimation
A point cloud has no connectivity, so almost every operation starts by asking: which points are near this one? Here, 3,000 points are sampled from a torus with a little noise. Pick a point (click it) and the demo finds its k nearest neighbours, exactly, by brute force.
The surface normal is then estimated from that neighbourhood with principal component analysis: the direction of least variance of the neighbours' covariance. Change k to see the trade-off: too few neighbours and noise dominates; too many and the neighbourhood bends around the curved surface.
A normal from PCA has no sign. Here it's flipped to face the viewer, one common convention. Making orientation consistent across a whole cloud is a harder problem.