I have a convex polygon (typically just a rotated square), and I know all of 4 points. How do I determine if a given point (yellow/green) is inside the polygon?
EDIT: For this particular project, I don't have access to all of the libraries of the JDK, such as AWT.
Best Answer
This page: http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html shows how to do this for any polygon.
I have a Java implementation of this, but it is too big to post here in its entirety. However, you should be able to work it out:
And here is a sketch of the Point class