Here's a code snippet for generating Poisson Disk Sampling for any point in C#. It uses an algorithm called "Bridson's Algorithm" to create a set of points that are at least a certain minimum distance apart from each other.
main.cs2533 chars60 linesThis function takes in a point, a minimum distance between points, and optional parameters for number of desired samples and number of attempts to place each sample. It returns a list of Vector2 points that are at least minimumDistance apart. The IsValid function is where the distance check is performed and ensures that no two points are closer than minimumDistance. The algorithm uses a grid to ensure that the sampling is evenly spaced and the search for nearby points is optimized.
gistlibby LogSnag