The answer you're looking for is covered by many answers on this page:
http://stackoverflow.com/questions/563198/how-do-you-detect-where-two-line-segments-intersect
The answer you're looking for is covered by many answers on this page:
http://stackoverflow.com/questions/563198/how-do-you-detect-where-two-line-segments-intersect