Poisson-Disc-Sampling icon indicating copy to clipboard operation
Poisson-Disc-Sampling copied to clipboard

Sample a uniformly random point from spawnCentre

Open laurelkeys opened this issue 4 years ago • 0 comments

The straightforward approach of using Random.Range(radius, 2*radius) to sample from the annulus around the spawnCentre unfortunately results in a distribution biased towards the smaller radius.

By using Mathf.Sqrt(Random.Range(radius*radius, 4*radius*radius)) we can generate points uniformly inside the annulus.

These two animations give a good illustration of the difference between the techniques: Annulus Sampling I (the "naive" approach) and Annulus Sampling II (the proposed change).

laurelkeys avatar Sep 17 '19 11:09 laurelkeys