As explained by Jason Davies, Lloyd’s relaxation algorithm (named after Stuart P. Lloyd) generates a centroidal Voronoi tessellation, which is where the seed point for each Voronoi region is also its centroid.
The algorithm computes the Voronoi diagram for a set of points, moves each point towards the centroid of its Voronoi region, and repeats.
Important concepts:
- Convergence - every point that is being "relaxed" is moving towards the center point of a Voronoi cell, but due to computational limits in numerical precision it may not ever perfectly reach it. Therefore it is a good idea to use some sort of preset distance threshold value that causes points to stop moving once they are close enough to their target point.
Articles:
- Lloyd's algorithm on Wikipedia
- Voronoi relaxation (Lloyd's algorithm) in Processing by Alberto Giachino
Code projects:
- Javascript implementation of Steven Fortune's algorithm to compute Voronoi diagrams - Demo 5: Lloyd's relaxation by Raymond Hill (JavaScript) (source repo)
- Lloyd's Algorithm by Mike Bostock on Observable (JavaScript and D3.js)
- Lloyd's Relaxation by Luca Sbardella (JavaScript and D3.js)
- Lloyd's Relaxation by Jason Davies (JavaScript, see DOM for source code)