I'm programming an web app and I need some help with a problem, as my mathematical skills are not great. I have 4 points in an XOY system with the origin in the top left. I need to make sure that any point does not cross the imaginary line between two other that are diagonally-opposed. This example shows better what I mean.
So A and C should not go across the imaginary line BD and B and D should not go across the imaginary line AC.
Few notes
- The points can be moved around in any possible way.
- I'm working only with positive coordinates.
What I know: x and y coordinates for all the points.
What I don't know: any of the angles.
What I need to find out: The maximum x and y coordinates that a point can reach before it passes to the other side of the line. Something like: Max(Ax) = Bx - ...; Max(Ay) = By - .... Thanks.

The dot product of the vector $\vec {DA}$ and the vector, orthogonal to the vector $\vec {DB}$, should be non-negative.
In coordinates:
$$(x_A - x_D) \cdot (y_B - y_D) - (y_A - y_D) \cdot (x_B - x_D) \ge 0$$
where: $$A = (x_A, y_A)$$ $$B = (x_B, y_B)$$ $$D = (x_D, y_D)$$