I know the formula for determining if a point(x, y) is inside a circle is (x - x_c)^2 + (y - y_c)^2 < radius^2
but what if my x and y are in degrees (lat/long)?
Asked
Active
Viewed 531 times
0

Mossi
- 997
- 5
- 15
- 28
-
1how precise do you need it to be. if you don't need it be super precise, you can always assume that the world is flat – Sam I am says Reinstate Monica Jul 07 '14 at 22:52
-
1See [this question](http://stackoverflow.com/questions/27928/how-do-i-calculate-distance-between-two-latitude-longitude-points) for calculating distance from the center. – interjay Jul 07 '14 at 22:53
-
I actually need it to be precise. And I have already gone through that link -it's addressing a different topic. – Mossi Jul 07 '14 at 22:55
-
That link is addressing the same topic exactly. – interjay Jul 07 '14 at 23:07
-
But I've already figured out how to calculate the radius. Edit: I see now. I have to basically calculate the distance between the point and the centre using the same logic and see if that's less than the radius. Makes sense. Thanks! – Mossi Jul 07 '14 at 23:09
1 Answers
0
As mentioned by interjay, the solution is to calculate the distance between the point and the center of the circle and compare it with the radius. The code is available here:
Calculate distance between two latitude-longitude points? (Haversine formula)