-
Notifications
You must be signed in to change notification settings - Fork 0
Foundations
Background on the Largest Inscribed Rectangle problem and the geometric principles underlying LIRiAP algorithms.
Given a simple polygon P (possibly with holes), find the rectangle R of maximum area such that R is strictly contained in P. The rectangle may be rotated (non-axis-aligned).
- Axis-aligned: Rectangle sides parallel to coordinate axes
- Rotated: Rectangle may have any orientation
- With constraints: Maximum aspect ratio, minimum area, etc.
For axis-aligned rectangles, Daniels et al. (1997) proved that the optimal rectangle always has at least two sides determined by vertex coordinates of the polygon. This enables efficient exact solvers using vertex-coordinate grids.
The general (rotated) case is NP-hard to solve exactly. Approaches include:
- Heuristic search over orientation space
- Grid-based approximation
- Boundary-coordinate raster methods (BCRS)
The classic stack-based algorithm for finding the largest rectangle in a histogram. Runs in O(n) time.
Reference: Klingel, E. (1986). Finding the largest rectangle in a polygon.
For convex polygons, the optimal axis-aligned rectangle has its top and bottom edges tangent at polygon vertices.
References:
- Alt, H., Hagerup, T., Mehlhorn, K., Preparata, F.P. (1987). Deterministic simulation of idealized parallel computers. Information and Computation.
- Amenta, N. (1994). A short proof of an interesting heuristic result. Proc. 5th ACM-SIAM SODA.
Theorem: The largest axis-aligned rectangle in a simple polygon always has at least two sides determined by vertex x- or y-coordinates.
Reference: Daniels, K., Milenkovic, V., Roth, D. (1997). Finding the largest axis-aligned rectangle in a polygon. Proc. 13th Canadian Conf. Computational Geometry.
Bounded scalar optimization for angle refinement.
Reference: Brent, R.P. (1973). Algorithms for Finding Zeros and Extrema of Functions Without Calculating Derivatives.
References:
- Bentley, J.L. (1977). Programming Pearls: Fast Algorithms for Polygon Containment.
- Preparata, F.P., Shamos, M.I. (1985). Computational Geometry: An Introduction.
- Heuristic edge-direction analysis
- Grid-based search with refinement
- No containment guarantee
- Edge-guided candidate generation
- Coarse-to-fine grid search
- Explicit containment certification
- Best-effort fallback when strict fails
- Boundary-coordinate raster solve (BCRS)
- Uses polygon vertex coordinates as grid lines
- CABF expansion for boundary fitting
- Novel contributions in variable-pitch LRH and coordinate-ascent fitting
- Exact solvers for fixed-orientation
- Alt/Amenta for convex polygons
- Daniels et al. vertex-grid for general polygons
- Vertex-coordinate precision
- Low vertex count (<100): Exact methods feasible
- Medium vertex count (100-1000): Grid-based methods appropriate
- High vertex count (>1000): Need downsampling or approximation
- Approximation: No guarantee
- Contained: Strict when certification passes
- BCRS: Strict when certification passes
- Axis-Aligned: Exact (vertex-coordinate precision)
- Speed vs. accuracy
- Strictness vs. always-return
- Single-threaded vs. parallel