Reputation: 8731
I have a point(x,y) array and i want to use it to see if a point (x2,y2) is in the polygon created my the point cloud. How can I check it?
I found http://www.pointclouds.org/documentation/tutorials/hull_2d.php but I really don't know how to do he same with Java.
The only real goal is to create a method to check if a point is in or out of the polygon, I don't really need to create the polygon I think.
Upvotes: 0
Views: 730
Reputation: 57381
Just use java.awt.Polygon. The constructor to create Polygon
public Polygon(int xpoints[], int ypoints[], int npoints)
Than use either of
public boolean contains(Point2D p)
public boolean contains(double x, double y)
passing the point x and y
Upvotes: 3