The goal of Poisson disk sampling a set of random points where no 2 points are closer than a certain minimum distance.
The current implementation samples the points in 2D (parallel to the XY plane) and then projects the along the Z axis onto the mesh. This creates the unexpected (and undesirable in most cases?) artefact that "steep" faces have less points.
The proposed implementation does the Poisson disk sampling directly on the input mesh, resulting in an even spread of points over the mesh. I would argue that this should be the default behavior of the Poisson disk sampling method for point distribution.
The new implementation also allows specifying a density that is too high for the Poisson radius, and as a result a kind of clustering appears. Although it's not strictly Poisson Disk sampling anymore that way, I kind of like the effect, so I haven't removed it. I see it as a happy little accident :)
In the images below, the density decreases along the x-axis and the Poisson radius decreases along the y-axis.
Before, 2D sampling + Z-projection:
{F9540436}
After, directly sampling on mesh surface:
{F9540435}
The implementation is based on the algorithm described in: [[ http://www.cemyuksel.com/research/sampleelimination/sampleelimination.pdf | Sample Elimination for Generating Poisson Disk Sample Sets (Yuksel 2015)]]. Previously I had tried the approach from Cline et al. 2009, but I would have needed an R Tree datastructure to make it fast, which Blender doesn't have yet. So I stuck to Yuksel's approach that uses a KD Tree.
Also, I'm aware the patch currently still contains a duplicated function **points_distance_weight_calculate**, because for my implementation it's more convenient to change one of the arguments from an array to Vector.