Extra functionality for BoundingBox2d
values.
poissonDiskSamples : Basics.Int -> BoundingBox2d units coordinates -> Random.Generator (List (Point2d units coordinates))
Create a random generator
for a list of points within a given bounding box. Unlike randomPoint
, this generator has the
property that it will keep the points apart from each other and will therefore fill the bounding
box in a random, but relatively uniform way.
The first argument represents how many points to generate, however due to the nature of the algorithm this acts more as a hint and it will generally generate slightly fewer points.
For comparison, here are some points generated by pure random sampling:
And here are some generated using Poisson disk sampling: