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 and with segments on each. The first segment has end points and while the segment on the second line has end points and . Once we form vectors 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.