How to check if 2 rays intersect?

Revision en2, by TheScienceGuy, 2020-12-03 08:12:46

We are given the 2D coordinates (all integers) 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 stack exchange, but the answers were not backed up by explanation.

Tags computational-geometry, algorithms

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English TheScienceGuy 2020-12-03 08:12:46 15 Tiny change: 'ordinates of 2 poin' -> 'ordinates (all integers) of 2 poin'
en1 English TheScienceGuy 2020-12-03 08:12:10 506 Initial revision (published)