Import std.algo.delaunay
LloydRelax
function
@PanicsAtCaller Public Function LloydRelax(points: Vec2[], bounds: Rect, iterations: Int = 1): Vec2[]
The points moved, iterations times, each to the middle of its Voronoi cell in bounds,
which spreads them evenly: Lloyd's relaxation. A point whose cell is empty stays. A negative
number of iterations, a coordinate that's infinite or NaN, or bounds that aren't finite or
have a negative size, panics.
Examples
Local bounds = Rect(0, 0, 100, 100)
Local points = LloydRelax([Vec2(10, 10), Vec2(11, 10), Vec2(10, 11)], bounds, 20)
Expect(points.Count == 3)
For point In points
Expect(bounds.Contains(point))
End ForReport an issue with this page or with FutureBlitz on GitHub.