title: How to check if line segment intersects a rectangle?
body: <p>If you have 2 points, (x1, y1) and (x2, y2), which represent two opposite corners  of a rectangle, and 2 other points, (x3,y3) and (x4,y4), which represent 2 endpoints of a line segment, how can you check if the line segment intersects the rectangle?</p>
  
  <p>(The line segment is just the segment contained between the given endpoints. It is not an infinite length line defined by those two points.)</p>