I have previously managed to check or detect if a click is inside a circle or a rectangle. Now I want to fill a shape with dots using Poisson-Disc algorithm. How can I detect if the current dot is within the bounds of a complex shape? Let’s take the below shape as an example:
function draw() {
background(220);
strokeWeight(1)
beginShape()
vertex(200,80)
bezierVertex(240,80,300,100,300,120)
vertex(300,150)
vertex(280,160)
vertex(280,170)
vertex(300,180)
vertex(300,220)
bezierVertex(300,240,240,260,200,260)
vertex(100,200)
vertex(100,150)
vertex(200,100)
endShape(CLOSE)
}
I believe that if P5 is able to fill the shape, somehow P5 ‘knows’ with great accuracy (and pretty fast) what is inside and what is outside that shape. Is there a way we can access that info? If not, what would be the approach to check for a valid coordinate inside the shape?