Polygon Partitioning
OโRourke, Chapter 2
de Berg, Chapter 3
Announcements
โข Assignment 1 posted
โข TA office hours: Thursday @ 4PM
Malone 239
Monotonicity
A polygonal chain ๐ถ is strictly monotone w.r.t.
a line ๐ฟ if every line ๐ฟโฒ perp. to ๐ฟ meets ๐ถ at at
most one point.๐ฟ
๐ฟโฒ
๐ถ
Monotonicity
A polygonal chain ๐ถ is strictly monotone w.r.t.
a line ๐ฟ if every line ๐ฟโฒ perp. to ๐ฟ meets ๐ถ at at
most one point.
It is monotone w.r.t. a line
๐ฟ if every line ๐ฟโฒ perp. to ๐ฟintersects ๐ถ in at most one
connected component.
๐ฟ
๐ฟโฒ
๐ถ
Monotonicity
A polygonal ๐ is monotone w.r.t. a line ๐ฟ if its
boundary can be split into two polygon
chains, ๐ด and ๐ต, such that each chain is
monotonic w.r.t. ๐ฟ. ๐ฟ
๐ฟโฒ
๐๐ด ๐ต
Monotonicity
A polygonal ๐ is monotone w.r.t. a line ๐ฟ if its
boundary can be split into two polygon
chains, ๐ด and ๐ต, such that each chain is
monotonic w.r.t. ๐ฟ.
โ It is monotone w.r.t. ๐ฟ if
the intersection of ๐ with
any line ๐ฟโฒ perp. to ๐ฟ has
at most two connected
components.
๐ฟ
๐ฟโฒ
๐๐ด ๐ต
Note
The vertices of a monotone polygon (w.r.t. the
vertical axis) can be sorted by ๐ฆ-value in
linear time.
โข ๐(๐): Compute the
highest vertex.
โข ๐(๐): Merge the two
(sorted) chains.
๐
Interior Cusps
An interior cusp of a polygon ๐ (w.r.t. the
vertical axis) is a reflex* vertex ๐ฃ โ ๐ whose
neighboring vertices are either at or above, or
at or below ๐ฃ.๐
*Recall that reflex vertices have interior angle strictly greater than ๐.
Claim
If ๐ has no interior cusps (w.r.t. the vertical
axis), it is monotone (w.r.t. the vertical axis).*
*Note that it can have interior cusps and still be monotone.
๐
Claim
If ๐ has no interior cusps (w.r.t. the vertical
axis), it is monotone (w.r.t. the vertical axis).
Note: We cannot change the condition so that
interior cusps have to be strictly above
Proof
If it isnโt monotone, there will be a line ๐ฟโฒintersecting ๐ in three or more points, ๐, ๐,
and ๐. (Assume these are the first three.)
WLOG, assume the polygon interior is to the
left of ๐ (and right of ๐ and ๐): If the order of the vertices in the polygon is ๐๐๐ we
hit an interior cusp at the top going from ๐ to ๐.
๐ฟโฒ๐ ๐ ๐
Proof
If it isnโt monotone, there will be a line ๐ฟโฒintersecting ๐ in three or more points, ๐, ๐,
and ๐. (Assume these are the first three.)
WLOG, assume the polygon interior is to the
left of ๐ (and right of ๐ and ๐): If the order of the vertices in the polygon is ๐๐๐ we
hit an interior cusp at the top going from ๐ to ๐.
Otherwise, we hit an interior
cusp at the bottom going
from ๐ to ๐.
๐ฟโฒ๐ ๐ ๐
Claim
A monotone polygon can be triangulated in
linear time.
๐
Outline
Invariant
When triangulating from the top vertex, at any
๐ฆ-value, the un-triangulated vertices above
๐ฆ can be broken up into two chains: One contains a single vertex
The other has only reflex vertices.
Outline
When we hit the next vertex it can be: On the side with one vertex
ยป Connect the vertex to all vertices on the
other side and pop off the triangles.
The invariant is preserved!
Outline
When you hit the next vertex it can be: On the side with reflex vertices
ยป Either the new vertex makes the previous one reflex
โ Do nothing
The invariant is preserved!
Outline
When you hit the next vertex it can be: On the side with reflex vertices
ยป Either the new vertex makes the previous one reflex
โ Do nothing
ยปOr it doesnโtโ Recursively connect and pop
When we canโt connect back anymore, we
have a new reflex vertex.
The invariant is preserved!
Trapezoidalization
A horizontal trapezoidalization is obtained by
drawing a horizontal line through every vertex
of the polygon.*
*Assuming distinct vertices have different ๐ฆ-values.
๐
Trapezoidalization
A horizontal trapezoidalization is obtained by
drawing a horizontal line through every vertex
of the polygon.
The supporting vertices of a
trapezoid are the two vertices
of ๐ defining the horizontals of
the trapezoid.
Note:
Interior (vertical) cusps are vertices
that are internal to their horizontals.
๐
Given a trapezoidalization of ๐, we can obtain
a partition into monotone (w.r.t. the vertical
axis) polygons: For upward cusps, connect the
supporting vertices on the
trapezoid below the cusp
For downward cusps, connect the
supporting vertices on the
trapezoid above the cusp.
Trapezoids โ Monotone Polygons
๐
Given a trapezoidalization of ๐, we can obtain
a partition into monotone (w.r.t. the vertical
axis) polygons: For upward cusps, connect the
supporting vertices on the
trapezoid below the cusp
For downward cusps, connect the
supporting vertices on the
trapezoid above the cusp.
This decomposes the polygon into
sub-polygons without interior cusps.
โ Each sub-polygon is monotone.
Trapezoids โ Monotone Polygons
๐
Line/Plane Sweep
Given a polygon ๐, sweep a horizontal line
downwards maintaining a sorted โactive
edgeโ list โ those edges that are intersected
by the current horizontal.
Note:
The list of active edges
can only change when
the horizontal passes
through a vertex.
0
12
3
45
7
89
6
0,3 โ (0,2)
0,3 โ 1,5 โ 1,6 โ (0,2)
0,3 โ 1,5 โ 1,6 โ (2,8)
3,7 โ 1,5 โ 1,6 โ (2,8)
3,7 โ 1,5 โ 4,5 โ 4,7 โ 1,6 โ (2,8)
3,7 โ 4,7 โ 1,6 โ (2,8)3,7 โ 4,7 โ 6,9 โ (2,8)
6,9 โ (2,8)
6,9 โ (8,9)
Algorithm
PlaneSweep( ๐ , ๐ธ โ ๐ ร ๐ ):โ SortByLargestToSmallestHeight( ๐ )โ ๐ด โ โ
โ For each ๐ฃ โ ๐โข (๐1, ๐2) โ EndPoints( ๐ฃ )โข If( Before( ๐ฃ , ๐1 ): Remove( ๐ด , ๐1 )โข Else: Insert( ๐ด , ๐1)โข If( Before( ๐ฃ , ๐2 ): Remove( ๐ด , ๐2 )โข Else: Insert( ๐ด , ๐2 )
Algorithm
PlaneSweep( ๐ , ๐ธ โ ๐ ร ๐ ):โ SortByLargestToSmallestHeight( ๐ )โ ๐ด โ โ
โ For each ๐ฃ โ ๐โข (๐1, ๐2) โ EndPoints( ๐ฃ )โข If( Before( ๐ฃ , ๐1 ): Remove( ๐ด , ๐1 )โข Else: Insert( ๐ด , ๐1)โข If( Before( ๐ฃ , ๐2 ): Remove( ๐ด , ๐2 )โข Else: Insert( ๐ด , ๐2 )
๐1 ๐2
๐ฃ
๐1 ๐2 ๐ด = โฏ๐1 โ ๐1 โ ๐2 โ ๐2โฆ
๐ด = โฏ๐1 โ ๐2โฆ
Algorithm
PlaneSweep( ๐ , ๐ธ โ ๐ ร ๐ ):โ SortByLargestToSmallestHeight( ๐ )โ ๐ด โ โ
โ For each ๐ฃ โ ๐โข (๐1, ๐2) โ EndPoints( ๐ฃ )โข If( Before( ๐ฃ , ๐1 ): Remove( ๐ด , ๐1 )โข Else: Insert( ๐ด , ๐1)โข If( Before( ๐ฃ , ๐2 ): Remove( ๐ด , ๐2 )โข Else: Insert( ๐ด , ๐2 )
๐1 ๐2
๐ฃ
๐1
๐2
๐ด = โฏ๐1 โ ๐1 โ ๐2โฆ
๐ด = โฏ๐1 โ ๐2 โ ๐2โฆ
Algorithm
PlaneSweep( ๐ , ๐ธ โ ๐ ร ๐ ):โ SortByLargestToSmallestHeight( ๐ )โ ๐ด โ โ
โ For each ๐ฃ โ ๐โข (๐1, ๐2) โ EndPoints( ๐ฃ )โข If( Before( ๐ฃ , ๐1 ): Remove( ๐ด , ๐1 )โข Else: Insert( ๐ด , ๐1)โข If( Before( ๐ฃ , ๐2 ): Remove( ๐ด , ๐2 )โข Else: Insert( ๐ด , ๐2 )
๐1 ๐2
๐ฃ๐1 ๐2
๐ด = โฏ๐1 โ ๐2โฆ
๐ด = โฏ๐1 โ ๐1 โ ๐2 โ ๐2โฆ
Algorithm
PlaneSweep( ๐ , ๐ธ โ ๐ ร ๐ ):โ SortByLargestToSmallestHeight( ๐ )โ ๐ด โ โ
โ For each ๐ฃ โ ๐โข (๐1, ๐2) โ EndPoints( ๐ฃ )โข If( Before( ๐ฃ , ๐1 ): Remove( ๐ด , ๐1 )โข Else: Insert( ๐ด , ๐1)โข If( Before( ๐ฃ , ๐2 ): Remove( ๐ด , ๐2 )โข Else: Insert( ๐ด , ๐2 )
๐ log ๐w/ balanced tree
(e.g. std::map)
๐(๐ log ๐)
๐(๐)
Constructing a Trapezoidalization
A trapezoidal partition can be computed in
๐(๐ log ๐) time by performing a line-sweep
and adding (part of) the
horizontal to the left
and right neighbors
as we hit new vertices.
0
12
3
45
7
89
6
0,3 โ (0,2)
0,3 โ 1,5 โ 1,6 โ (0,2)
0,3 โ 1,5 โ 1,6 โ (2,8)
3,7 โ 1,5 โ 1,6 โ (2,8)
3,7 โ 1,5 โ 4,5 โ 4,7 โ 1,6 โ (2,8)
3,7 โ 4,7 โ 1,6 โ (2,8)3,7 โ 4,7 โ 6,9 โ (2,8)
6,9 โ (2,8)
6,9 โ (8,9)
Constructing a Trapezoidalization
Note:
We had assumed that the vertices have
different ๐ฆ-coordinates.
This isnโt actually necessary. It suffices to sort
lexicographically. (If two vertices have the
same ๐ฆ-coordinates then the one with larger
๐ฅ-coordinate is first.)
Constructing a Trapezoidalization
Note:
We had assumed that the vertices have
different ๐ฆ-coordinates.
Conceptually, this amounts to applying a tiny
rotation in the CCW direction.
Triangulation
Triangulate( ๐ ):โ Construct a trapezoidalization
Triangulation
Triangulate( ๐ ):โ Construct a trapezoidalizationโ Partition into monotone polygons
Triangulation
Triangulate( ๐ ):โ Construct a trapezoidalizationโ Partition into monotone polygonsโ Triangulate the monotone polygons
Top Related