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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.