Professional Documents
Culture Documents
Computational Geometry
Computational Geometry
Pratyay Kuila
▪ Definition: Given two distinct points p1 and p2, the line segment p1p2 is the
set of convex combinations of p1 and p2. We call p1 and p2 the endpoints of
segment p1p2.
p2 p3
p3 p2
p1 p2 p4
p0 p1 p1
Thereby, the angle that p2 makes with the positive x axis is greater than
the angle that p1 does. Therefore, vector p1 is clockwise from vector p2
with respect to the origin (0, 0).
Two line segments intersect if and only if either (or both) of the
following conditions holds:
1. Each segment straddles the line containing the other.
2. An endpoint of one segment lies on the other segment. (This
condition comes from the boundary case.)
Terminologies
Consider two segments s1 and s2. We say that these segments are
comparable at x if the vertical sweep line with x-coordinate x
intersects both of them.
s1 is above s2 at x, written s1 ≥x s2, if s1 and s2 are comparable at
x and the intersection of s1 with the sweep line at x is higher than
the intersection of s2 with the same sweep line, or if s1 and s2
intersect at the sweep line.
➢ It determines only whether or not any intersection exists; it does not print all
the intersections.
P x y P x y