Line intersects rectangle?
Posted on 2009-04-03
How can I test if a line (defined by two x,y endpoints) intersects a rectangle?
I have a bunch of rectangles draw on a screen, and want to know if a user's mouse intersects any of them when they move the mouse. I only get mouse move messages every so often, so if the user moves the mouse fast enough, most of the mouse location points are missed. So I'm looking to figure out which rectangles could have been intersected between two mouse points.