Name
lint
Synopsis
int lint(Pointp1
, Pointp2
, Pointp3
, Pointp4
);
Return Value
1 if the two line segments intersect, or otherwise.
Description
Tests whether two line segments intersect. Specify one line
segment using its endpoints as p0
and
p1
. Specify the second line segment
using its endpoints as p3
and
p4
. Each point is a structure of type
Point
. Although
Point
has three members for
representing points in three dimensions, we can use it to
represent points in two dimensions by setting
z
to 0. Since the
lint operation works in two dimensions, it
ignores the z-coordinate of each
point.
Complexity
O (1)
Get Mastering Algorithms with C 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.