Poisson Disk Sampling is a popular algorithm used in computer graphics to generate evenly spaced and non-random points. It is useful in a variety of applications, such as generating realistic textures and landscapes, or even in generating virtual scenarios for video games.
To generate 2D Poisson Sampling in C#, we can use the algorithm described in this article: https://www.jasondavies.com/poisson-disc/
main.cs2613 chars75 lines
This code generates Poisson Sampling by selecting a random point from the active list, generating several new samples around it, and checking if each of these new samples is valid (i.e., not too close to any of the existing points). If a new sample is valid, it is added to the active list and the points list. If no new valid samples are found, the current point is removed from the active list. The process continues until we have generated the desired number of points.
You can use this function to generate Poisson Sampling for any point in your C# application.
gistlibby LogSnag