Rectilinear polygon
A rectilinear polygon, also known as an orthogonal polygon, is a simple polygon whose edges are axis-aligned, meaning all sides are either horizontal or vertical and parallel to the coordinate axes.[1][2] This alignment ensures that every interior angle at the vertices measures either 90° (convex) or 270° (reflex).[3][1] Rectilinear polygons are a cornerstone of computational geometry, where they model shapes with orthogonal constraints and support efficient algorithms for problems such as partitioning into rectangles, covering with axis-parallel rectangles, and computing the convex hull under the L1 (Manhattan) metric.[4][5] These polygons may be simple (without holes) or contain interior holes, facilitating applications in VLSI circuit layout, where they represent wiring channels and mask designs; geographic information systems (GIS) for map overlay and spatial partitioning; and architectural floorplanning for room divisions.[4][6] Notable computational challenges include minimum rectangle partitioning, which is solvable in linear time for hole-free cases but NP-hard with holes, and visibility problems like art gallery guarding, where rectilinear variants require fewer guards due to their structured edges.[4][1]Definition and Fundamentals
Definition
A rectilinear polygon, also known as an orthogonal polygon, is a polygon all of whose edges are horizontal or vertical line segments aligned with the coordinate axes.[7] This alignment ensures that the polygon is composed entirely of axis-parallel sides, distinguishing it from general polygons that may include edges at arbitrary angles.[8] In a rectilinear polygon, all interior angles measure either 90° (at convex vertices) or 270° (at reflex vertices), as the boundary traversal involves only 90° left or right turns, with the total turning angle summing to 360° for a simple closed shape.[7] No diagonal or slanted edges are permitted, which simplifies certain geometric computations but introduces specific challenges in areas like partitioning and visibility.[9] The term "rectilinear" originates from Late Latin rectilineus, combining rectus ("straight") and linea ("line"), referring to formations of straight lines; in geometric contexts, it specifically denotes axis-aligned orientations.[10] Rectilinear polygons were first systematically studied in computational geometry during the late 1970s, as the field emerged to address algorithmic problems in plane geometry.[9] A basic example is an L-shaped rectilinear polygon, formed by connecting vertices such as (0,0), (4,0), (4,1), (1,1), (1,3), and (0,3), which creates a simple non-convex shape with five 90° angles and one 270° reflex angle.[7]Edges and Vertices
In a rectilinear polygon, all edges are axis-aligned, meaning they are either horizontal or vertical, parallel to the coordinate axes.[11] This alignment ensures that edges meet orthogonally at vertices, with no diagonal or slanted segments present.[12] For the polygon to close properly, the edges must alternate between horizontal and vertical orientations when traversing the boundary in a consistent direction, such as counterclockwise.[11] As a result, a rectilinear polygon always has an even number of edges, since the alternation requires pairing to return to the starting point without misalignment.[13] The vertices of a rectilinear polygon occur at the endpoints of these edges and are characterized by interior angles of either 90° or 270°.[11] A vertex with a 90° interior angle is convex, where the polygon lies within the smaller angular sector, while a 270° interior angle defines a reflex vertex, where the polygon occupies the larger sector.[12] These vertices can be further classified into four types based on their angular measure and coordinate orientations, such as corner configurations (e.g., bottom-left or top-right for convex turns) or T-junction-like structures in boundary interactions, reflecting the direction of incoming and outgoing edges relative to the axes.[14] In a simple closed rectilinear polygon with n vertices, the number of reflex vertices r satisfies n = 2r + 4, ensuring the overall structure balances convex and reflex turns.[13] Rectilinear polygons are often represented as chains of alternating horizontal and vertical edges, starting from an arbitrary vertex and proceeding along the boundary.[11] The sequence of turns at vertices—90° left for convex and effectively 90° right for reflex in counterclockwise traversal—sums to a total turning angle of 360°, consistent with the properties of any simple closed polygon.[12] For example, a simple rectilinear hexagon (a non-convex L-shape) can be defined by the vertex coordinates (0,0), (4,0), (4,2), (2,2), (2,3), (0,3), forming edges that alternate: horizontal from (0,0) to (4,0), vertical to (4,2), horizontal to (2,2), vertical to (2,3), horizontal to (0,3), and vertical back to (0,0). This configuration includes five convex vertices (90° interiors at (0,0), (4,0), (4,2), (2,3), and (0,3)) and one reflex vertex (270° interior at (2,2)).[11]Classifications and Types
Simple Rectilinear Polygons
A simple rectilinear polygon is defined as a simple polygon whose boundary consists solely of horizontal and vertical line segments, with interior angles of either 90° or 270° at each vertex.[15] Simplicity in this context means the boundary forms a closed chain that does not intersect itself, dividing the plane into an interior region and an unbounded exterior without crossings.[16] This property ensures that the polygon satisfies the Jordan curve theorem for polygonal chains, separating the Euclidean plane into two connected components: a bounded interior and an unbounded exterior.[17] To construct a simple rectilinear polygon, one begins with a set of axis-aligned vertices and connects them using alternating horizontal and vertical edges, ensuring the path closes without overlaps or self-intersections and maintains an even total number of edges due to the directional alternation. For instance, a rectangle is formed by four such edges, while an L-shaped polygon requires six edges, with the boundary tracing a non-intersecting path around the interior.[15] Topologically, a simple rectilinear polygon is homeomorphic to a closed disk, possessing an Euler characteristic of 1, computed as V - E + F = n - n + 1, where n is the number of vertices (equal to the number of edges) and F = 1 accounts for the single interior face.[16] Its boundary constitutes a single closed Jordan curve, with no additional cycles or components. Unlike general simple polygons, which permit arbitrary angles, rectilinear polygons restrict turns to 90° or 270°, which simplifies visibility computations by aligning potential sightlines with the axes and reducing the complexity of intersection tests in algorithms.[18]Rectilinear Polygons with Holes
A rectilinear polygon with holes is defined as a region bounded by a simple rectilinear outer polygon and containing one or more disjoint simple rectilinear inner polygons, known as holes, that are fully enclosed within the outer boundary without touching it or each other.[2] These holes represent excluded areas within the otherwise simply connected outer polygon, maintaining the rectilinear constraint where all edges are axis-aligned horizontal or vertical segments.[19] Unlike simple rectilinear polygons, those with holes introduce interior voids that increase the topological complexity of the shape. Topologically, rectilinear polygons with holes form multiply connected domains, characterized by an Euler characteristic of \chi = V - E + F = 1 - h, where V is the total number of vertices, E the total number of edges across all boundaries, F = 1 accounts for the single connected interior face punctured by the holes, and h is the number of holes. This formula reflects the reduction in connectivity for each hole added, distinguishing these polygons from their hole-free counterparts, which have \chi = 1. The boundaries of the outer polygon and holes together form a collection of disjoint cycles, with the holes acting as "islands" that do not overlap.[19] Common constructions of rectilinear polygons with holes include annular shapes, such as a large axis-aligned rectangle enclosing a smaller rectangular void, or practical models like a rectilinear room layout with embedded rectilinear obstacles representing furniture or barriers.[20] To distinguish interior points from those in holes or exterior regions, winding numbers are employed: a point is interior if its winding number relative to the outer boundary is non-zero and zero relative to all hole boundaries, assuming consistent orientation (e.g., counterclockwise for the outer and clockwise for holes). Modern computational geometry research extends the treatment of rectilinear polygons to include nested holes, where holes may contain further sub-holes, enabling more complex hierarchical structures not fully addressed in earlier foundational work.[22] These extensions, prominent in post-2000 studies, facilitate applications in decomposition algorithms and visibility problems by processing nested components separately while preserving overall topology.[22]Geometric Properties
Area and Perimeter Calculations
The perimeter of a rectilinear polygon, which consists solely of horizontal and vertical edges, is obtained by summing the lengths of all edges. For a polygon with vertices (x_1, y_1), (x_2, y_2), \dots, (x_n, y_n) listed in counterclockwise order, the perimeter P is P = \sum_{i=1}^{n} \left( |x_i - x_{i+1}| + |y_i - y_{i+1}| \right), where (x_{n+1}, y_{n+1}) = (x_1, y_1). Since consecutive vertices differ in only one coordinate, this formula directly captures the Manhattan distance along each edge.[23] The area of a rectilinear polygon can be computed using the shoelace formula, applicable to any simple polygon but simplified here due to axis alignment. For the same vertex ordering, the area A is A = \frac{1}{2} \left| \sum_{i=1}^{n} (x_i y_{i+1} - x_{i+1} y_i) \right|, with (x_{n+1}, y_{n+1}) = (x_1, y_1); terms where coordinates are equal vanish, reducing to summations over horizontal and vertical spans. For rectilinear polygons on a lattice (integer coordinates), Pick's theorem provides an alternative: A = I + B/2 - 1, where I is the number of interior lattice points and B is the number of boundary lattice points.[23][24] Rectilinear polygons with holes have area equal to that of the outer boundary minus the areas of the interior holes, assuming holes are simple rectilinear polygons that do not intersect the boundary or each other. For example, an L-shaped polygon formed by a 4×3 rectangle minus a 2×1 rectangle at one corner has area $4 \times 3 - 2 \times 1 = 10. Each component's area is computed separately via the shoelace formula or Pick's theorem before subtraction.[25] Both perimeter and area calculations for rectilinear polygons require O(n) time, where n is the number of vertices, leveraging the axis alignment to avoid trigonometric functions needed in general polygon methods and enabling straightforward summation over edge projections.[26]Inscribed Squares and Rectangles
A rectilinear polygon always admits inscribed axis-aligned rectangles, as its boundary consists solely of horizontal and vertical segments, allowing for rectangles bounded by pairs of such edges or extensions thereof. The maximal inscribed rectangle is the axis-aligned rectangle of maximum area contained within the polygon. Finding this rectangle is a fundamental optimization problem in computational geometry, with applications in computer-aided design and map overlay. Seminal work by McKenna, O'Rourke, and Suri introduced a divide-and-conquer algorithm to compute it in O(n log^3 n) time for an n-vertex orthogonal polygon, by recursively partitioning the polygon along a vertical line and merging candidate rectangles across the partition. A more efficient approach leverages the structure of rectilinear polygons by scanning horizontal strips formed by sorting the distinct y-coordinates of vertices, which divide the polygon into trapezoidal strips of constant height. For each pair of consecutive horizontal lines defining a strip height h, the maximum possible width w is computed as the longest horizontal chord within the strip that lies entirely inside the polygon, often using interval intersection on the vertical edges. The area h · w is evaluated, and the global maximum is selected; extensions to non-consecutive strips use minimum-width computations over merged intervals. This method achieves O(n^2) time in a basic implementation but can be optimized to O(n log n) using priority queues for interval management. [27] The inscribed square problem is a constrained variant where the rectangle must have equal side lengths, maximizing the side length s such that an axis-aligned square of side s fits inside the polygon. This is NP-hard in general polygons but tractable in rectilinear cases due to the orthogonal constraint. Reflex vertices (interior angles of 270°) pose challenges, as they create "pockets" that limit square placement by blocking expansion in both directions simultaneously. For instance, in a staircase rectilinear polygon formed by descending horizontal and vertical steps of varying lengths, the largest inscribed square is often confined to the widest uniform step region, with side length equal to the minimum step height or width in that segment to avoid protrusion into adjacent reflex corners. The dimensions of the maximal inscribed rectangle relate to the orthogonal widths of the polygon—the minimum distance between pairs of parallel supporting lines in the horizontal and vertical directions, respectively. The maximum area is at most the product of these widths, providing a tight upper bound when the polygon is orthogonally convex (x- or y-monotone without reflex chains). In general rectilinear polygons, approximation algorithms from the 2010s, such as those achieving a constant-factor guarantee for the largest inscribed square in convex polygons, extend to rectilinear cases by discretizing possible orientations to axis-aligned, yielding O(1)-approximations in O(n polylog n) time. [28]Special Cases
Orthogonally Convex Polygons
An orthogonally convex rectilinear polygon, also known as an ortho-convex or hv-convex polygon, is defined as a simple rectilinear polygon whose intersection with any horizontal or vertical line is connected, meaning it is either empty, a single point, or a single line segment.[29] This property ensures that the polygon does not contain any "dents" or reflex chains that would cause such a line to intersect the interior in disconnected components.[11] Equivalently, an orthogonally convex rectilinear polygon is both x-monotone (its intersection with any vertical line is connected) and y-monotone (its intersection with any horizontal line is connected), forming shapes that resemble staircases without inward protrusions.[26] Key properties of orthogonally convex rectilinear polygons include the absence of interior reflex vertices that block axis-aligned sightlines, allowing for efficient geometric operations. These polygons are closed under orthogonal convex hull computations, where the smallest enclosing orthogonally convex shape can be derived directly from boundary chains.[30] Unlike general convex polygons, orthogonally convex ones permit 270-degree interior angles but maintain connectivity along coordinate axes, which distinguishes them from standard Euclidean convexity.[31] Rectangles serve as the simplest examples of orthogonally convex rectilinear polygons, as any axis-aligned line intersects them in at most one segment. In contrast, an L-shaped polygon fails this criterion, since a horizontal line passing through the junction of its arms typically intersects the boundary in two disjoint segments.[29] More complex examples include staircase polygons, where the boundary alternates monotonically between horizontal and vertical edges without backtracking. In computational geometry, orthogonally convex rectilinear polygons simplify visibility and intersection queries, as axis-aligned line segments between interior points remain fully contained within the polygon if they do not cross reflex chains.[32] This property facilitates applications in orthogonal convex hull algorithms and point covering problems, reducing time complexities for problems like minimum rectangle covers in VLSI design and image processing.[33]Monotone Rectilinear Polygons
A monotone rectilinear polygon is a special type of rectilinear polygon that is monotone with respect to either the x-axis or y-axis. Specifically, an x-monotone rectilinear polygon has the property that any vertical line intersects the polygon in at most one connected component, and its boundary can be split into an upper chain and a lower chain connecting the leftmost and rightmost vertices, where both chains have non-decreasing x-coordinates when traversed from left to right.[34] Similarly, a y-monotone rectilinear polygon satisfies the analogous condition with respect to horizontal lines and non-decreasing y-coordinates along its left and right chains.[35] This monotonicity simplifies the structure compared to general rectilinear polygons, as the vertices along each chain are naturally ordered by their coordinate in the direction of monotonicity. Monotone rectilinear polygons play a key role in divide-and-conquer algorithms within computational geometry, enabling efficient processing for tasks like triangulation and decomposition due to their ordered chains, which allow linear-time operations such as sorting vertices.[36] For instance, any y-monotone polygon, including rectilinear ones, can be triangulated in linear time by iteratively adding diagonals from the highest vertex to non-adjacent vertices on the opposite chain.[36] Moreover, every simple rectilinear polygon with n vertices can be partitioned into O(n) monotone rectilinear pieces using a sweep-line approach that identifies and resolves reflex chains, facilitating further geometric computations.[36] A classic example of an x-monotone rectilinear polygon is a Z-shaped figure formed by two offset horizontal rectangles connected by a vertical segment on alternating sides, ensuring that vertical lines cross the interior at most once and the boundary chains maintain increasing x-coordinates.[34] Such structures are prevalent in applications like VLSI design, where monotone rectilinear polygons model circuit components and enable efficient floorplanning through monotone staircase cuts that simplify routing and partitioning without introducing unnecessary bends.[37] In computer graphics, monotone rectilinear polygons support optimized rendering techniques, such as scanline rasterization on GPUs, by allowing monotonic segments to be processed sequentially along grid lines, reducing computational overhead in path rendering pipelines.[38]Computational Aspects
Algorithmic Problems
Rectilinear polygons present several distinctive algorithmic challenges due to their axis-aligned edges, which simplify certain computations compared to general polygons while introducing unique complexities at reflex vertices. Visibility ProblemsA key visibility problem is the art gallery theorem variant for rectilinear polygons, where \lfloor n/4 \rfloor guards suffice to cover any simple rectilinear polygon with n vertices, a tighter bound than the general \lfloor n/3 \rfloor due to the orthogonal structure. This result is established constructively via an algorithm that partitions the polygon into "stars" using horizontal cuts, ensuring each subpolygon is guarded by a single vertex. The algorithm employs a horizontal plane sweep to identify and resolve reflex chains, achieving O(n log n) time complexity by maintaining a status structure of active edges and computing visibility along scanlines. For rectilinear polygons with holes, up to \lfloor n/4 \rfloor guards are also sufficient, with partitioning into at most n/4 star-shaped subpolygons each of size at most 12. Intersection and Union Computations
The axis-alignment of edges enables efficient boolean operations like intersection and union between two rectilinear polygons. A plane sweep algorithm, adapted from the Bentley-Ottmann line segment intersection method, processes horizontal and vertical edges separately, detecting intersections in O(n log n + k) time, where n is the total number of edges and k is the number of intersection points. This approach maintains y- and x-ordered structures for active segments, simplifying overlap checks and constructing the output polygonal circuits by traversing endpoints and resolving inclusion relations. The O(n log n) term arises from sorting events and balanced tree operations, making it optimal for the worst case where k = O(n^2). Shortest Path Queries
Computing the shortest rectilinear path between two points inside a simple rectilinear polygon, under the Manhattan (L1) metric and avoiding obstacles formed by reflex vertices, benefits from the grid-like structure. An optimal data structure preprocesses the polygon in O(n) time to support queries in O(log n) time for any pair of points, by building a hierarchical decomposition into corridors and using shortest path maps along horizontal and vertical lines. This adapts continuous Dijkstra methods to the orthogonal domain, where paths consist of alternating horizontal and vertical segments, and reflex vertices are treated as blockers in a visibility graph of O(n) size. For vertex-to-vertex queries, the structure enables constant-time responses after linear preprocessing. NP-Hard Problems and Approximations
Many optimization problems on rectilinear polygons, such as the maximum independent set (selecting a maximum subset of non-intersecting subregions or vertices under visibility constraints), are NP-hard, inheriting complexity from rectangle intersection graphs. Post-2015 advances have yielded constant-factor approximations for the related maximum independent set of axis-aligned rectangles—a core subroutine in rectilinear decompositions—with a polynomial-time 3-approximation algorithm using local search and rounding techniques on conflict graphs. These improvements, building on earlier O(log log n)-approximations, achieve better ratios by exploiting strip decompositions and dynamic programming on sorted projections, with running times polynomial in n.