Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find if points are within a circle with given center and radius

Tags:

geometry

We have a point (x,y) and a set of some other points (xi,yi). How can we determine which of (xi,yi) are within a circle with center (x,y) and radius r (a given number)?

like image 429
jim Avatar asked Oct 26 '09 21:10

jim


People also ask

How do you determine if a point lies within a circle?

If the distance is greater than the radius, the point lies outside. If it's equal to the radius, the point lies on the circle. And if it's less than the radius, you guessed it right, the point will lie inside the circle. As simple as that!


1 Answers

(xi-x)**2 + (yi-y)**2 < r**2
like image 145
ZZ Coder Avatar answered Oct 05 '22 00:10

ZZ Coder