Java – find coordinates in circles

I'm using Google maps under Grails for mashup. Users can create geonces by selecting points and radii on the map This will be stored in my database, and the application continuously receives a set of coordinates from the GPS device

I want to compare the received coordinates with the area stored in the circle If the point is inside (or outside) the circle, the program will trigger an action However, I want to know how to find out that the coordinates are inside / outside the circle There is a JavaScript library that allows this, but I need to do it on the server

Is there a Java (or even groovy) library? How would you achieve it?

Solution

If the distance from the point to the center of the circle is < = the radius of the circle, it is within the circle

java. awt. geom. Point2D. Double is perfect for this

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>