Download - Search and Intersection
Goal:
Given a set of line segments partition space into
trapezoids with horizontal tops/bottoms so that each
trapezoid has unique left/right
neighbors.*
Trapezoidal Decomposition
π1
π1
π2
π2
π1
π2
π2
π1
*Assume no line segment is vertical.
Goal:
Given a partition of 2D space into polygons,
(efficiently) compute a (compact) data-structure that
enables fast point-in-polygon queries.
Example (Nearest-Neighbor):
Given the Voronoi diagram of
a set of points, we would like
to quickly determine to which
Voronoi cell a point belongs.
Trapezoidal Decomposition
Approach:
Construct the partition iteratively, adding new line-
segments into existing partition:
Add end-point, performing top/bottom split of
containing trapezoid.
Trapezoidal Decomposition
π΄
π΄
π
Approach:
Construct the partition iteratively, adding new line-
segments into existing partition:
Add end-point, performing top/bottom split of
containing trapezoid.
Trapezoidal Decomposition
π΅
π΅ πΆ
π(π)
πΆπ
Approach:
Construct the partition iteratively, adding new line-
segments into existing partition:
Add end-point.
Add line segment, splitting the trapezoid into 2, 3, or 4
sub-trapezoids.
Trapezoidal Decomposition
π΄
π΄
π
Approach:
Construct the partition iteratively, adding new line-
segments into existing partition:
Add end-point.
Add line segment, splitting the trapezoid into 2, 3, or 4
sub-trapezoids.
Trapezoidal Decomposition
π΅ πΆ
π(π)
π΅ πΆ
π
Approach:
Construct the partition iteratively, adding new line-
segments into existing partition:
Add end-point.
Add line segment, splitting the trapezoid into 2, 3, or 4
sub-trapezoids.
Trapezoidal Decomposition
π΄
π΄ π
π
Approach:
Construct the partition iteratively, adding new line-
segments into existing partition:
Add end-point.
Add line segment, splitting the trapezoid into 2, 3, or 4
sub-trapezoids.
Trapezoidal Decomposition
π΅π΅ πΆ
ππ(π)
π
πΆ
Approach:
Construct the partition iteratively, adding new line-
segments into existing partition:
Add end-point.
Add line segment, splitting the trapezoid into 2, 3, or 4
sub-trapezoids.
Trapezoidal Decomposition
π·πΈ
π(π) πΆ
ππ(π)
π
πΆπ· πΈ
Approach:
Construct the partition iteratively, adding new line-
segments into existing partition:
Add end-point.
Add line segment, splitting the trapezoid into 2, 3, or 4
sub-trapezoids.
Trapezoidal Decomposition
π΄
π΄π
π
π
Approach:
Construct the partition iteratively, adding new line-
segments into existing partition:
Add end-point.
Add line segment, splitting the trapezoid into 2, 3, or 4
sub-trapezoids.
Trapezoidal Decomposition
π΅
π΅ πΆπ
π(π)
π
πΆ
π
Approach:
Construct the partition iteratively, adding new line-
segments into existing partition:
Add end-point.
Add line segment, splitting the trapezoid into 2, 3, or 4
sub-trapezoids.
Trapezoidal Decomposition
π·
π(π) πΆπ
π(π)
π
π· πΈ
πΈπ
πΆ
Approach:
Construct the partition iteratively, adding new line-
segments into existing partition:
Add end-point.
Add line segment, splitting the trapezoid into 2, 3, or 4
sub-trapezoids.
Trapezoidal Decomposition
πΊπ(π) πΆ
π
π(π)
π
πΈπ· π(π)
πΉπ
πΉ πΊ
π·
Approach:
Construct the partition iteratively, adding new line-
segments into existing partition:
Add end-point.
Add line segment.
Merge vertically adjacent trapezoids
if they are bounded by the same
edges (in the same order).
Trapezoidal Decomposition
π΅
π΄
π΄
π΅
β β
Approach:
Construct the partition iteratively, adding new line-
segments into existing partition:
Add end-point.
Add line segment.
Merge vertically adjacent trapezoids
if they are bounded by the same
edges (in the same order).
Trapezoidal Decomposition
β βπΆ
πΆ
Approach:
Construct the partition iteratively, adding new line-
segments into existing partition:
Add end-point.
Add line segment.
Merge vertically adjacent trapezoids
if they are bounded by the same
edges (in the same order).
Trapezoidal Decomposition
β β
πΆ
We get a directed binary tree with:
β’ interior nodes β left/right or top/bottom partitions
β’ leaves β trapezoids
Left child: above/left
Right child: below/right
πΆ
Add end-point
Add line segment
Merge adjacent trapezoids
Trapezoidal Decomposition
π΄
π΄ π1
π2
Add end-point
Add line segment
Merge adjacent trapezoids
Trapezoidal Decomposition
π΅
πΆ
π1
π2
π(π1)
π΅ πΆ
Add end-point
Add line segment
Merge adjacent trapezoids
Trapezoidal Decomposition
π΅
πΆ
π1
π2
π(π1)
π΅ πΆ
Add end-point
Add line segment
Merge adjacent trapezoids
Trapezoidal Decomposition
π΅
π·
πΈ
π1
π2
π(π1)
π΅ π π2
π· πΈ
Add end-point
Add line segment (2)
Merge adjacent trapezoids
Trapezoidal Decomposition
π΅
π·
πΈ
π1
π2
π(π1)
π΅ π π2
π· πΈ
Add end-point
Add line segment (2)
Merge adjacent trapezoids
Trapezoidal Decomposition
π΅
πΈ
πΊπΉ
π1
π2
π(π1)
π΅ π π2
π(π) πΈ
πΉ πΊ
Add end-point
Add line segment
Merge adjacent trapezoids
Trapezoidal Decomposition
π΅
πΈ
πΊπΉ
π1
π2
π(π1)
π΅ π π2
π(π) πΈ
πΉ πΊ
π1
π2
Add end-point
Add line segment
Merge adjacent trapezoids
Trapezoidal Decomposition
π΅
πΈ
πΌπΉ
π»
π1
π1
π2
π(π1)
π΅ π π2
π(π) πΈ
πΉ π(π1)
π» πΌ
Add end-point
Add line segment
Merge adjacent trapezoids
Trapezoidal Decomposition
π΅
πΈ
πΌπΉ
π»
π1
π1
π2
π2
π(π1)
π΅ π π2
π(π) πΈ
πΉ π(π1)
π» πΌ
Add end-point
Add line segment
Merge adjacent trapezoids
Trapezoidal Decomposition
π΅
π½
πΌπΉ
π»
πΎ
π1
π1
π2
π2
π(π1)
π΅ π π2
π(π) π π2
πΉ π(π1)
π» πΌ
π½ πΎ
Add end-point
Add line segment (2)
Merge adjacent trapezoids
Trapezoidal Decomposition
π΅
π½
πΌπΉ
π»
πΎ
π1
π1
π2
π2
π(π1)
π΅ π π2
π(π) π π2
πΉ π(π1)
π» πΌ
π½ πΎ
Add end-point
Add line segment (2)
Merge adjacent trapezoids
Trapezoidal Decomposition
π΅
πΏ
πΌπΉ
π»
πΎ
π
π1
π1
π2
π2
π(π1)
π΅ π π2
π(π) π π2
πΉ π(π1)
π» πΌ
π(π) πΎ
ππΏ
Add end-point
Add line segment (3)
Merge adjacent trapezoids
Trapezoidal Decomposition
π΅
πΏ
πΌπΉ
π»
πΎ
π
π1
π1
π2
π2
π(π1)
π΅ π π2
π(π) π π2
πΉ π(π1)
π» πΌ
π(π) πΎ
ππΏ
Add end-point
Add line segment (3)
Merge adjacent trapezoids
Trapezoidal Decomposition
π΅
πΏ
πΌπ
π»
πΎ
π
π π
π1
π1
π2
π2
π(π1)
π΅ π π2
π(π) π π2
π(ππ) π(π1)
π» πΌ
π(π) πΎ
ππ π(π)
π π
πΏ
Add end-point
Add line segment
Merge adjacent trapezoids
Trapezoidal Decomposition
π΅
πΏ
πΌπ
π»
πΎ
π
π π
π1
π1
π2
π2
π(π1)
π΅ π π2
π(π) π π2
π(ππ) π(π1)
π» πΌ
π(π) πΎ
ππ π(π)
π π
πΏ
Add end-point
Add line segment
Merge adjacent trapezoids
Trapezoidal Decomposition
π΅
πΌπ
π»
πΎ
π
π
π
π1
π1
π2
π2
π(π1)
π΅ π π2
π(π) π π2
π(ππ) π(π1)
π» πΌ
π(π) πΎ
ππ π(π)
π π
Add end-point
Add line segment (3)
Merge adjacent trapezoids
Trapezoidal Decomposition
π΅
πΌπ
π»
πΎ
π
π
π
π1
π1
π2
π2
π(π1)
π΅ π π2
π(π) π π2
π(ππ) π(π1)
π» πΌ
π(π) πΎ
ππ π(π)
π π
Add end-point
Add line segment (3)
Merge adjacent trapezoids
Trapezoidal Decomposition
π1π(π1)
π΅
π΅ π π2
π(π) π π2 ππ
π(ππ) π(π1)
π1
π»
π» π(ππ)
π(π) πΎ
πΎ
π
π
π π(π)π
π π
π
π(π΅) π
π
π π
π
π2
π2
Because of merging, we can have multiple paths
into the same trapezoid.
Trapezoidal Decomposition
π1π(π1)
π΅
π΅ π π2
π(π) π π2 ππ
π(ππ) π(π1)
π1
π»
π» π(ππ)
π(π) πΎ
πΎ
π
π
π π(π)π
π π
π
π(π΅) π
π
π π
π
π2
π2
Because of merging, we can have multiple paths
into the same trapezoid.
Trapezoidal Decomposition
π1π(π1)
π΅
π΅ π π2
π(π) π π2 ππ
π(ππ) π(π1)
π1
π»
π» π(ππ)
π(π) πΎ
πΎ
π
π
π π(π)π
π π
π
π(π΅) π
π
π π
π
π2
π2
Assuming the tree stays balanced, construction has complexity
π((π + π) log π) and query has complexity π(log π) .
If line segments are added in random order , the tree
will be well-balanced, with high probability.
Extreme Points
Linear Programming:
Given a set of linear constraints:
πΆπ = π π, ππ β₯ ππ
and a linear energy function:
πΈ π = π, π + π
we would like to find the point π that satisfies the
constraints and minimizes the energy.
Extreme Points
Linear Programming: Since the constraints are linear, each one defines a
half-space of valid solutions.
The intersection of these
half-spaces is convex.
Since the energy is
linear, it has a constant
gradient π»πΈ pointing
away from the minimum.
The minimizer is the point
in the convex region which
is extreme along direction π.
π»πΈ
Extreme Points (2D)
Given a convex polygon π, we would like to find the
extreme points along a particular direction.
Without loss of generality, we can assume that the
direction is vertical.
Extreme Points (2D)
Pick a vertex π£π at random: Both edges rising β Right
Both edges falling β Left
Otherwise, extremal
Consider vertex π£π, π = π +π
2:
If π£π is left and π£π right:
β max β π, π min β [π, π]
If π£π right and π£π left: β¦
If π£π and π£π right:
Β» If π£π above π£π:β Both extrema in π, π
Β» β¦
π£π
π£π
Extreme Points (2D)
Pick a vertex π£π at random: Both edges rising β Right
Both edges falling β Left
Otherwise, extremal
Consider vertex π£π, π = π +π
2:
If π£π is left and π£π right:
β max β π, π min β [π, π]
If π£π right and π£π left: β¦
If π£π and π£π right:
Β» If π£π above π£π:β Both extrema in π, π
Β» β¦
π£π
π£π
With repeated bisection, we can find
the two extrema in π(log π ) time.
Extreme Points (3D)
Given a convex polyhedron π, we would like to find
the (without loss of generality) highest point.
[Kirkpatrick, 1983]
Compute a hierarchy of nested polytopes, compute
the highest point on the coarsest polytopes and use
that to efficiently compute the highest point on the
next polytope.
Definition:
Given a graph, a set of vertices is said to be
independent if there is no edge in the graph that
connects vertices in the set.
Key Idea:
Identify an independent set of vertices
on ππ with low degree, remove
those, and set ππ+1 to the
convex hull of whatβs left.
Repeat for subsequent levels of the hierarchy.
Constructing the Hierarchy
Greedy Algorithm:
β’ While not done Find a vertex with degree β€ 8.
If none of its neighbors have been marked as
independent, mark it as independent.
Claim:
This algorithm will mark a at least 1/18 of the
vertices as independent.
Constructing the Hierarchy
Proof:
By Eulerβs formula, for a triangulated polyhedron:
πΈ = 3π β 6.
β The sum of the degrees of the vertices, Ξ£, is
equal to twice the number of edges, and hence:
Ξ£ = 6π β 12.
β There are at least π/2 vertices with degree β€ 8.
Otherwise, there are at least π/2 vertices with
degree β₯ 9 and the rest have degree at least 3:
Ξ£ β₯9π
2+
3π
2= 6π > 6π β 12 = Ξ£ (ββ)
Constructing the Hierarchy
Proof:
There are at least π/2 vertices with degree β€ 8.
β Marking a low-degree vertex as independent, we
invalidate (at most) 8 other vertices.
β Repeating, we will mark at least 1/9 of the low-
degree vertices as independent
β 1/18 of all vertices will be independent.
Constructing the Hierarchy
Using this to construct our polytope hierarchy:
β’ We will have π(log |π|) levels.
β’ We will require π(|π|) storage.
Claim:
If we remove a point on a polytope, the convex hull
of the remaining points can be obtained by
computing the convex hull of the points on the
boundary and using the βouterβ half of the triangles.
Proof:
The remaining triangles must still be on the hull.
Any new triangles canβt connect to non-boundary
vertices because then the hull would be non-
manifold.
Constructing the Hierarchy
Claim:
If we remove a point on a polytope, the convex hull
of the remaining points can be obtained by
computing the convex hull of the points on the
boundary and using the βouterβ half of the triangles.
Proof:
The remaining triangles must still be on the hull.
Any new triangles canβt connect to non-boundary
vertices because then the hull would be non-
manifold.
Constructing the Hierarchy
Since the removed vertices are independent and have
degree β€ 8, the coarser convex hull can be computed in
time proportional to the number of removed points.
Since a removed vertex does not appear later
on in the hierarchy, the complexity of
computing the hierarchy is π |π| .
Claim:
After remove the highest vertex π£ β π, the next
highest vertex π€ has to be in the one-ring of π£.
Proof: (by contradiction)
Assume π€ is interior.
β The closed loop of neighbors
of π€ are below π€.
β π must be below the cone apexed
at π€ and going through its neighbors.
β π€ was above π£. (ββ)
Constructing the Hierarchy
π£
Claim:
After remove the highest vertex π£ β π, the next
highest vertex π€ has to be in the one-ring of π£.
Proof: (by contradiction)
Assume π€ is interior.
β The closed loop of neighbors
of π€ are below π€.
β π must be below the cone apexed
at π€ and going through its neighbors.
β π€ was above π£. (ββ)
Constructing the Hierarchy
π£
Given the highest vertex, π£π+1 β ππ+1 the highest
vertex π£π β ππ is either π£π+1 or is in its one-ring.
We canβt test all neighbors of π£π+1
because π£π+1 may have large degree!
Definition:
An edge π on ππ+1 is exposed by a vertex π β ππ, if
π is in the triangulation of the hole resulting from the
removal of π.
Constructing the Hierarchy
Definition:
An edge π on ππ+1 is exposed by a vertex π β ππ, if
π is in the triangulation of the hole resulting from the
removal of π.
Constructing the Hierarchy
An edge π β ππ+1 is exposed by π β ππ
if π is visible to π when viewing ππ+1.
An edge in ππ+1 can be exposed by at most two vertices.
Notation:
Given a polytope π, we can project it onto the π¦π§-
plane. We denote by πΏ and π the edges that project
on to the left-most and right-most edges coming out
of the highest vertex.
Constructing the Hierarchy
π πΏ
π£π πΏ π£
Claim:
Given the highest vertex, π£π+1 β ππ+1 the highest
vertex π£π β ππ is either π£π+1, or the vertex that
exposes one of πΏπ+1 and π π+1.
Constructing the Hierarchy
π π+1 πΏπ+1
π£π+1
π£ππ£π
π£π+1π π+1πΏπ+1
Proof: Draw triangles (π£π , πΏπ+1) and (π£π , π π+1).
One of these cannot intersect ππ+1
(otherwise its projection would intersect).
β One of πΏπ+1 or π π+1 is exposed by π£π.
Constructing the Hierarchy
π£π π£π
π£π+1πΏπ+1
π£π
π π+1 πΏπ+1
π£π+1π π+1
Proof: Draw triangles (π£π , πΏπ+1) and (π£π , π π+1).
One of these cannot intersect ππ+1
(otherwise its projection would intersect).
β One of πΏπ+1 or π π+1 is exposed by π£π.
Constructing the Hierarchy
π£π π£π
π£π+1πΏπ+1
π£π
π π+1 πΏπ+1
π£π+1π π+1
If we know the highest vertex π£π+1 β ππ+1 and
we know πΏπ+1 and π π+1, then we get the
highest vertex π£π β ππ in π(1).
If π£π+1 is removed at level π + 2:
β π£π+1 has degree β€ 8β We can find πΏπ+1 and π π+1 with exhaustive search.
Otherwise, we can use πΏπ+2 and π π+2 to compute πΏπ+1
and π π+1 in time π(1).
β’ We can construct the polytope hierarchy in π π time.
β’ We can find the extreme point, with respect to an
arbitrary direction, in π log π .