function forEachNested(arr, fn){
for(var i=0; i<arr.length; i++){
for(var j=i+1; j<arr.length; j++){
var result = fn(arr[i], arr[j], i, j, arr);
if(result === false){
return;
}
}
}
}
var options = {
numClusters: 8,
particleRadius: 16,
showPhysics: true,
showParticles: true,
springStrength: 0.01,
minDistanceSpringStrength: 0.05
};
var gui = new dat.gui.GUI();
gui.add(options, 'numClusters', 5, 16).step(1);
gui.add(options, 'showPhysics');
gui.add(options, 'showParticles');
gui.add(options, 'springStrength', 0, 0.1).step(0.001);
gui.add(options, 'minDistanceSpringStrength', 0, 0.1).step(0.001);
gui.add({ makeGraph: makeGraph }, 'makeGraph').name('New Graph');
var clusters,
physics;
var bottomPadding = 200;
function setup(){
var p5Renderer2D = createCanvas(window.innerWidth, window.innerHeight - bottomPadding);
document.getElementById('example-container').appendChild(p5Renderer2D.canvas);
physics = new VerletPhysics2D();
physics.setWorldBounds(new Rect(10, 10, width-20, height-20));