Hello!

If I have a square given by the coordinates of its peaks, for instance (x1,y1), (x2,y2), (x3,y3) and (x4,y4) in this order , how do I check whether a point P(x,y) is within this square? The square can be either aligned to the xOy system or not (it might be rotated, etc).

I am not interested in any geometrical demonstration, I only want to know if there's any relation between the x-s and the y-s, because I want to implement this relation in a Java program...

Thank you and I am waiting for your opinions!!