How to determine if 2 rays intersect? We are given the 2D coordinates of 2 points: the first point is where the ray starts and it goes through the second point. We are given another ray in the same way. How do we determine if they have a point of intersection? I would like to know the general algorithm and its explanation, don't mind about the extreme cases (e.g. when the rays have the same starting point). P.S. I saw a similar question on another stack exchange, but the answers did were not backed up by explanation.
I'm copying my answer for the similar question - with minimal changes.

The vector equation:
$$P_1 + \alpha * (P_2 - P_1) = P_3 + \beta * (P_4 - P_3)$$
where $P_1 = (x_1, y_1)$ etc., should have a solution, satisfying following conditions:
$$\alpha \ge 0, \beta \ge 0$$
then these two rays $(P_1, P_2)$ and $(P_3, P_4)$ do intersect. However, there are many corner cases here (for example, $P_1 = P_2$ etc.). Also, you can get wrong answers because of the limited precision of your data representation in computer.