xxxxxxxxxx
41
/*
while experimenting with quad-trees, i made this and it looks super wierd
the points are attracted to the mouse, but they also try to move away from other points if they are touching
*/
let cells = []
function setup() {
createCanvas(400, 400);
//let bound = new Rectangle(200,200,200,200)
//qtree = new QuadTree(bound)
for (let i = 0; i < 500; i++) {
let x = randomGaussian(width/2,width/8)
let y = randomGaussian(width/2,width/8)
let p = new Cell(x,y)
cells.push(p)
}
//print(qtree)
}
let qtree = -1
function draw() {
background(220);
qtree = new QuadTree(new Rectangle(200,200,200,200))
qtree.setUp(cells)
qtree.show()
stroke(0)
strokeWeight(3)
for (let p of cells) {
p.move()
point(p.x,p.y)
}
}