How to check if a point is inside a polygon

I have a Polygon :

image

I want to check if the location of the object is inside this Polygon .
As an example of x: 5 and y: 5, How can I check if this Coordinator is inside this polygon (Java)?

+4
source share
1 answer

If you create polgyon using the Polygon class, which is included in java, use the contains() method.

http://docs.oracle.com/javase/6/docs/api/java/awt/Polygon.html

Take a look at the description of the method.

contains(int x, int y) - determines whether the specified coordinates are inside this polygon.

+8
source

All Articles