Skip to content

Instantly share code, notes, and snippets.

@bhouston
Created August 22, 2017 13:22
Show Gist options
  • Save bhouston/b3d8c1c7a5e3fde701527eca801f352a to your computer and use it in GitHub Desktop.
Save bhouston/b3d8c1c7a5e3fde701527eca801f352a to your computer and use it in GitHub Desktop.
var shuffle = require('shuffle-array');
var PoissonDiskSampling = require('poisson-disk-sampling');
var p = new PoissonDiskSampling([1000, 1000], 100, 100, 10);
var points = p.fill();
for( i = 0; i < points.length; i ++ ) {
points[i][0] = Math.round( points[i][0] * 100 ) / (1000*100);
points[i][1] = Math.round( points[i][1] * 100 ) / (1000*100);
}
shuffle( points );
shuffle( points );
for( i = 0; i < points.length; i ++ ) {
console.log( "poissonDisk[" + i + "] = vec2( " + points[i][0] + ", " + points[i][0] + " );\\n\\" );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment