qrohlf / trianglify

Algorithmically generated triangle art
http://qrohlf.com/trianglify/
GNU General Public License v3.0
10.08k stars 669 forks source link

Upgrade cell generation algorithm #150

Open qrohlf opened 2 years ago

qrohlf commented 2 years ago

https://bost.ocks.org/mike/algorithms/

Bridson’s algorithm for Poisson-disc sampling solves your problem with using a square grid for initial point generation, it gives you uniform triangle size and randomized point distribution. Would probably really enhance the visual here.

You could also go with the best-candidate algorithm on the same page, which has the nice property of the numCandidates tuning parameter mapping nicely to the triangle variance param that's currently used to randomly distort the square grid.