   How to tell if two segments intersect.
  ok so i'm trying to make an algorithm that checks for the collision of a square and a line(really just a segment that extends to end of screen). i'm trying to do this by checking for each segment and as soon as it comes across one segment that intersects with the Line then it returns 1. so my problem is how to tell if two segments intersect, segments that are not necessarily parallel to an axis. any help is welcome, thanks.   
Quote:so my problem is how to tell if two segments intersect, segments that are not necessarily parallel to an axis.The answer to this question is easily found online - just Google/search for 'line intersection' or 'line segment intersection'.However, segment-segment intersection isn't what you want for a 2-d ray-box test. Instead, use the SAT if you only need a Boolean result, or slab-based clipping if you need additional intersection information as well (i.e. time of intersection and intersection point and normal).   ;  Please don't crosspost.;A team at Carnegie Mellon's Entertainment Technology Center launched a project to determine how to get multiple game genres -- racing, first person shooter, and puzzle -- to blend into one socially competitive experience, and here present the results of that experiment.  View the full article