3.5 Additional Key Applications

3.5.1 Intersection of Line Segments

In a graphics context, lines can represent light rays, but the edges of objects are usually line segments, not fully infinite lines. This means that two lines may intersect, but line segments on those lines may not. Determining whether two segments intersect is key, for instance, in deciding whether two-dimensional objects collide or not. Looking deeper into this problem does highlight a few more useful techniques in the associated vector geometry.

To set up the situation, suppose we have two lines c03-math-0422 and c03-math-0423 with segments on each. The first segment has end points c03-math-0424 and c03-math-0425 while the segment on the second line has end points c03-math-0426 and c03-math-0427. Once we form vectors c03-math-0428 and , we can describe each line. has equation , and line has equation .

Get Mathematical Structures for Computer Graphics now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.