I have two dimensional Cartesian system and I need to check if certain point is within the geometry formed by four other points. I have few thousands different geometries all with different points to check. So I'm writing a program for it.
HERE is a solution method I started with and it works if the data points are always given in same order: A(x,y) B(x,y) C(x,y) and D(x,y) with the point P(x,y). (But it's not)
My points are randomly given, so when connecting between the dots they might go to "opposite" corner so the drawing wouldn't be box exactly.
Case 1: A(x,y) B(x,y) C(x,y) D(x,y) with the point P(x,y).
Case 2: C(x,y) A(x,y) D(x,y) B(x,y) with the point P(x,y).
Case 3: D(x,y) B(x,y) A(x,y) C(x,y) with the point P(x,y).
Case 4: B(x,y) D(x,y) A(x,y) C(x,y) with the point P(x,y).
So it's impossible to write a program with earlier mentioned method. I've been looking around and I can't seem to find a method that doesn't care in which order it gets the coordinates of the geometry.
Thanks.