Advertisement

2d line/box intersection, and where?

Started by April 22, 2003 08:31 PM
0 comments, last by Alan Kemp 21 years, 9 months ago
Hi, I am trying to determine first if a line and a box (2d, and box is always axis aligned) intersect, and then if they do, where length along the line the intersection is (ie, the distance from the start point). Does anyone know a fast way to do this, or is my best bet to treat each of the four sides of the box as line segments and run four line-line intersection tests? Thanks for any ideas, Alan
"There will come a time when you believe everything is finished. That will be the beginning." -Louis L'Amour
That''s probably a good idea. If you have line AB and rect QWER, I''d check intersections between AB and QW, AB and WE, AB and ER, and AB and RQ.

Radical Ion Entertainment | Free programming books
----------[Development Journal]

This topic is closed to new replies.

Advertisement