I need to check if a point is inside a rectangle (which can be not parallel to the axes) but not on its perimeter. In 2 dimensions.
I'm checking if the point is inside by finding the intersection between the rectangle and the line parallel to the y axis going through the point, and checking if the point is between the intersection points. Like in the drawing, where on the left it's inside, and on the right it isn't.
The rectangle is represented by 4 vertices: $x_1$ $x_2$ $x_3$ $x_4$, and the point is $p$
What I want to do is to create 4 vectors, which are the vectors from the point to each of the 4 vertices as such: $v_i=x_i-p$ And then to check if there are two vectors of adjacent numbers (1 & 2, 2 & 3, 3 & 4, and 4 & 1) whose dot product is -1: $v_1\cdot v_2$
I know that it'll give me a right answer, but can this give a false positive. Meaning, is there a case where a point is inside the rectangle and not on the perimeter, but the dot result of two adjacent vectors $v_i$ will be -1?