Firstly, i draw lots of circles and they are moving slightly because I add noise in the centre of a circle.

Second, I draw some patterns combining `ellipse(mouseX,mouseY,random(1,3),random(1,3))`

,`rect`

, `line`

, etc.

Third, and this is the problem, I want to make the circles change color if they have a distance from the patterns less than a certain amount.

How could I calculate the distance between those circles' center and the pattern's border? They are both dependent variables.

Maybe because the shape functions are so well-packaged that they're not easy to break and use . i found a way to calculate Point to line distance : processing.org/discourse/beta/num_1276644884.html

However i don't understand it.

And then i found another way to think : to make it a problem of **compare each element in the array with every other element in the array** https://forum.processing.org/topic/constantly-resizing-ellipse-based-on-distance,

but i still dont know how to modify shape function like ellipse(x,y,radius1,radius2)into an array.

Please give me any hint.Thanks.