Title: Finding the Largest Area AxisParallel Rectangle in a Polygon in On log2 n Time
1 Finding the Largest Area Axis-Parallel
Rectangle in a Polygon in O(n log2
n) Time
- MATHEMATICAL SCIENCES COLLOQUIUM
- Prof. Karen Daniels
- Wednesday, October 18, 2000
2Computational Geometryin Context
3Taxonomy of ProblemsSupporting Apparel
Manufacturing
4 5 Whats the Problem?
- Given a 2D polygon that
- does not intersect itself
- may have holes
- has n vertices
- Find the Largest-Area Axis-Parallel Rectangle
- How hard is it?
- How fast can we find it?
6 Related Work
7 Related Work(continued)
8 Summary of Algorithmic Results for a Variety of
Polygon Types
Karen Daniels Victor Milenkovic Dan Roth
this talk
W (n log(n))
9Establishing an Upper Bound of O(n log2 n)
10 Approach
- Establish O(n5) upper bound
- Characterize the Largest Rectangle (LR)
- examine cases based on polygon/LR contacts
- Reduce the O(n5) bound to O(n log2 n)
- Develop a general framework for dominant case
- based on rectangular visibility and matrix total
monotonicity - Use divide-and-conquer T(n) lt 2T( n/2 )
O(nlogn) - Apply the framework to obtain O(nlogn) for each
level
11Characterizing the LR
Independent Sliding Contact
Fixed Contact
Dependent Sliding Contacts
Reflex Contact
Contacts reduce degrees of freedom
12Characterizing the LR (continued)
Determining sets of contacts
13Characterizing the LR (continued)
Maximization Problems for Sliding Contacts
- 1-parameter
- Max. quadratic in 1 variable O(1)
- 1 Independent Sliding Contact
- 2 Dependent Sliding Contacts
- 3 Dependent Sliding Contacts
- 2-parameter
- Max. quadratic in 2 variables O(1)
- At least one rectangle corner is at an endpoint
of polygon edge - Reduces to 4 1-parameter problems
14O(n5) LR Algorithm
- Find_LR(Polygon P)
- area0 Find_LR_0_RC(P)
- area1 Find_LR_1_RC(P)
- area2 Find_LR_2_RC(P)
- area3 Find_LR_3_RC(P)
- area4 Find_LR_4_RC(P)
- return maximum(area0, area1, area2, area3,
area4) - Find_LR_0_RC(P)
- for i 1 to n for each edge of P
- for j 1 to n
- for k 1 to n
- for l 1 to n
- area area of LR for 0-RC
determining set for (i,j,k,l) - if LR is empty, then update maximum area
- return maximum area
O(n5)
O(n)
15 Approach
- Establish O(n5) upper bound
- Characterize the Largest Rectangle (LR)
- examine cases based on polygon/LR contacts
- Reduce the O(n5) bound to O(n log2 n)
- Develop a general framework for dominant case
- based on rectangular visibility and matrix total
monotonicity - Use divide-and-conquer T(n) lt 2T( n/2 )
O(nlogn) - Apply the framework to obtain O(nlogn) for each
level
16A General Framework for the 2-Contact Case
A General Framework for the 2-Contact Case
Area Matrix M for empty corner rectangles
Definition M is totally monotone if, for every
ilti and jltj corresponding to a legal 2x2 minor,
mij gt mij implies mij gt mij
Theorem Aggarwal,Suri87 If any entry of a
totally monotone matrix of size mxn can be
computed in O(1) time, then the row-maximum
problem for this matrix can be solved in Q(mn)
time.
LR is the Largest Empty Corner Rectangle (LECR)
17A General Framework for the 2-Contact Case
P
Goal reduce to the Largest Empty Corner
Rectangle (LECR) problem
E
V
P
Given vertically separated, y-monotone chains V,
E of P, orthogonalize them
E
V
- Property I
- Polygonal regions P and P satisfy P P and
each vertex-edge rectangle for P, V, and E is a
vertex-edge rectangle for P, V, and E. - Property II
- For every vertex v e V and every edge e e E if
any point q e interior(e) is rectangularly
visible from v inside P, then all of e is
rectangularly visible from v. - Property III
- If vertex v e V and a point q e E are
rectangularly visible with respect to
vertices(P), then v and q are rectangularly
visible with respect to P.
18LR Algorithm for a General Polygon
Lemma If V and E are y-monotone, then M
defined by our LR-measure (area) is totally
monotone.
- Monotonicity and Aggarwal et al.s matrix
searching-based O(nlogn) algorithm for the LECR
problem lead to the following
Lemma The LR in an n-vertex vertically
separated, horizontally convex polygon can be
found in O(n log n) time.
Goal Produce a vertically separated,
horizontally convex polygon for the merge step of
divide-and-conquer.
19LR Algorithm for a General Polygon
Partitioning the polygon with a vertical line
produces a vertically separated, horizontally
convex polygon for the merge step of
divide-and-conquer.
Theorem The LR in an n-vertex general polygon
can be found in O(n log2 n) time.
20O(n log2 n) LR Algorithm
- Find_LR(Polygon P)
- preprocess P
- H, V horizontal, vertical visibility
maps of P - P P U internal vertex projections
- return LR_DivideConquer(P, H, V)
- LR_DivideConquer(P, H, V)
- if P.numVertices is too smallcalculate
return LR area - Pleft , Pright left, right parts of
P L vertical partitioning line - Hleft , Hleft , Vleft , Vright H, V
updated for L - arealeft LR_DivideConquer(Pleft ,
Hleft , Vleft) - arearight LR_DivideConquer(Pright,
Hright , Vright) - Q U1ltiltk Qi L may
contain k partitions - areaQ LR_HV_DivideConquer(Q)
- return maximum(arealeft , arearight, areaQ )
O(n log n)
O(n log2 n)
T(n) lt 2T( n/2 ) O(nlogn)
U
U
T( n/2 )
T( n/2 )
O(n log n)
21Establishing a Lower Bound of W(n log n)
22Lower Bounds in Context
23Establishing a Lower Bound of W(n log n)
MAX-GAP instance given n real numbers x1, x2,
... xn find the maximum difference between 2
consecutive numbers in the sorted list.
O(n) time transformation
LR algorithm must take as least as much time as
MAX-GAP. But, MAX-GAP is already known to be in
W(n log n).
LR algorithm must take W(n log n) time for
self-intersecting polygons.
24Establishing a Lower Bound of W(n log n)
Extend to non-degenerate holes using symbolic
perturbation.
25 Summary
- Establish O(n log2 n) upper bound for LR
- Establish O(n5) upper bound
- Characterize the Largest Rectangle (LR)
- examine cases based on polygon/LR contacts
- Reduce the O(n5) bound to O(n log2 n)
- Develop a general framework for dominant case
- based on rectangular visibility and matrix total
monotonicity - Use divide-and-conquer T(n) lt 2T( n/2 )
O(nlogn) - Apply the framework to obtain O(nlogn) for each
level - Establish W(n log n) lower bound for LR
26For More Information
- Computational Geometry
- Graduate CS course in Computational Geometry to
be offered at UMass Lowell in Spring 01 - Introductory texts
- Computational Geometry in C (ORourke)
- Computational Geometry An Introduction
(Preparata Shamos) - Bibliography ftp//ftp.cs.usask.ca/pub/geometry/
- Softwarehttp//www.geom.umn.edu/software/cglist/
- My research
- http//www.cs.uml.edu/kdaniels
- Journal paper Finding the largest area
axis-parallel rectangle in a polygon - (Computational Geometry Theory and Applications)
- Prof. Victor Milenkovic Frequent co-author and
former PhD advisor - http//www.cs.miami.edu/vjm