A short implementation of blue noise sampling for triangle meshes
This project demonstrates a simple yet efficient algorithm to compute a blue noise sampling of a triangle mesh. The number of sample can be set to any value. The algorithm is described in the paper Sample Elimination for Generating Poisson Disk Sample Sets by Cem Yuksel.
You will need
The demo
Using one the sample STL files provided with the naive implementation demo
xzcat meshes/fox.stl.xz | python mesh-sampling.py
By default, 2048 samples are computed. You can select a different number of samples, say, 256, using a command-line switch
xzcat meshes/fox.stl.xz | python mesh-sampling.py -s256
This implementation takes a shortcut, by considering Euclidean distances between samples in the 3d space, not geodesic path lengths on the mesh. In practice, for a dense enough sampling, this should have a neglible impact on the result. However, I plan to add an option to use proper geodesic path lengths.
The algorithm calls for a priority queue, while in this implementation, a plain sorted list is used.
This project is licensed under the MIT License - see the LICENSE.md file for details