Fact-checked by Grok 2 weeks ago

Rectilinear polygon

A rectilinear polygon, also known as an orthogonal polygon, is a simple whose edges are axis-aligned, meaning all sides are either horizontal or vertical and parallel to the coordinate axes. This alignment ensures that every interior angle at the vertices measures either 90° () or 270° (). Rectilinear polygons are a cornerstone of , where they model shapes with orthogonal constraints and support efficient algorithms for problems such as partitioning into , covering with axis-parallel , and computing the under the L1 () metric. 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. Notable computational challenges include minimum partitioning, which is solvable in linear time for hole-free cases but NP-hard with holes, and visibility problems like guarding, where rectilinear variants require fewer guards due to their structured edges.

Definition and Fundamentals

Definition

A rectilinear , also known as an orthogonal , is a all of whose edges are or vertical line segments aligned with the coordinate axes. This alignment ensures that the is composed entirely of axis-parallel sides, distinguishing it from general that may include edges at arbitrary angles. In a rectilinear , all interior angles measure either 90° (at vertices) or 270° (at 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. No diagonal or slanted edges are permitted, which simplifies certain geometric computations but introduces specific challenges in areas like partitioning and . 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. polygons were first systematically studied in during the late 1970s, as the field emerged to address algorithmic problems in plane geometry. 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 non-convex shape with five 90° angles and one 270° angle.

Edges and Vertices

In a rectilinear polygon, all edges are axis-aligned, meaning they are either horizontal or vertical, parallel to the coordinate axes. This alignment ensures that edges meet orthogonally at vertices, with no diagonal or slanted segments present. For the polygon to close properly, the edges must alternate between horizontal and vertical orientations when traversing the boundary in a consistent , such as counterclockwise. 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. The of a rectilinear occur at the endpoints of these edges and are characterized by interior of either 90° or 270°. A with a 90° interior is , where the lies within the smaller angular sector, while a 270° interior defines a , where the occupies the larger sector. These 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 turns) or T-junction-like structures in boundary interactions, reflecting the direction of incoming and outgoing edges relative to the axes. In a simple closed rectilinear with n , the number of r satisfies n = 2r + 4, ensuring the overall structure balances and turns. Rectilinear polygons are often represented as chains of alternating and vertical edges, starting from an arbitrary and proceeding along the . The sequence of turns at vertices—90° left for and effectively 90° right for in counterclockwise traversal—sums to a total turning angle of 360°, consistent with the properties of any simple closed polygon. For example, a simple 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 vertices (90° interiors at (0,0), (4,0), (4,2), (2,3), and (0,3)) and one reflex vertex (270° interior at (2,2)).

Classifications and Types

Simple Rectilinear Polygons

A simple rectilinear polygon is defined as a simple polygon whose consists solely of and vertical line segments, with interior angles of either 90° or 270° at each . 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. This property ensures that the polygon satisfies the for polygonal chains, separating the into two connected components: a bounded interior and an unbounded exterior. To construct a rectilinear , one begins with a set of axis-aligned vertices and connects them using alternating horizontal and vertical edges, ensuring the closes without overlaps or self-intersections and maintains an even total number of edges due to the directional alternation. For instance, a is formed by four such edges, while an L-shaped requires six edges, with the boundary tracing a non-intersecting around the interior. Topologically, a simple rectilinear polygon is homeomorphic to a closed disk, possessing an 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. Its 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 computations by aligning potential sightlines with the axes and reducing the complexity of intersection tests in algorithms.

Rectilinear Polygons with Holes

A with holes is defined as a bounded by a simple outer and containing one or more disjoint simple inner , known as holes, that are fully enclosed within the outer without touching it or each other. These holes represent excluded areas within the otherwise simply connected outer , maintaining the rectilinear constraint where all edges are axis-aligned horizontal or vertical segments. Unlike simple , 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. Common constructions of rectilinear polygons with holes include annular shapes, such as a large axis-aligned enclosing a smaller rectangular void, or practical models like a rectilinear room layout with embedded rectilinear obstacles representing furniture or barriers. 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 (e.g., counterclockwise for the outer and for holes). Modern 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. These extensions, prominent in post-2000 studies, facilitate applications in algorithms and problems by processing nested components separately while preserving overall .

Geometric Properties

Area and Perimeter Calculations

The perimeter of a rectilinear , which consists solely of horizontal and vertical edges, is obtained by summing the lengths of all edges. For a 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. The area of a rectilinear polygon can be computed using the , 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 (integer coordinates), provides an alternative: A = I + B/2 - 1, where I is the number of interior points and B is the number of boundary points. Rectilinear polygons with holes have area equal to that of the outer minus the areas of the interior holes, assuming holes are rectilinear polygons that do not intersect the or each other. For example, an L-shaped polygon formed by a 4×3 minus a 2×1 at one corner has area $4 \times 3 - 2 \times 1 = 10. Each component's area is computed separately via the or before subtraction. 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.

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 polygons by scanning strips formed by the distinct y-coordinates of vertices, which divide the into trapezoidal strips of constant height. For each pair of consecutive lines defining a strip height h, the maximum possible width w is computed as the longest chord within the strip that lies entirely inside the , often using 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 . This method achieves O(n^2) time in a basic implementation but can be optimized to O(n log n) using priority queues for management. The is a constrained variant where the must have equal side s, maximizing the side length s such that an axis-aligned square of side s fits inside the . This is NP-hard in general polygons but tractable in cases due to the orthogonal constraint. 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 formed by descending horizontal and vertical steps of varying s, 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 corners. The dimensions of the maximal inscribed relate to the orthogonal widths of the —the minimum distance between pairs of supporting lines in the and vertical directions, respectively. The maximum area is at most the product of these widths, providing a tight upper bound when the is orthogonally (x- or y-monotone without reflex chains). In general polygons, approximation algorithms from the , such as those achieving a constant-factor for the largest inscribed square in polygons, extend to cases by discretizing possible orientations to axis-aligned, yielding O(1)-approximations in O(n polylog n) time.

Special Cases

Orthogonally Convex Polygons

An orthogonally rectilinear polygon, also known as an ortho- or hv- polygon, is defined as a rectilinear polygon whose with any or vertical line is connected, meaning it is either empty, a single point, or a single . This property ensures that the polygon does not contain any "dents" or reflex chains that would cause such a line to the interior in disconnected components. Equivalently, an orthogonally rectilinear polygon is both x-monotone (its with any vertical line is connected) and y-monotone (its with any line is connected), forming shapes that resemble staircases without inward protrusions. Key properties of orthogonally convex rectilinear polygons include the absence of interior vertices that block axis-aligned sightlines, allowing for efficient geometric operations. These polygons are closed under orthogonal computations, where the smallest enclosing orthogonally convex shape can be derived directly from boundary chains. Unlike general polygons, orthogonally convex ones permit 270-degree interior angles but maintain connectivity along coordinate axes, which distinguishes them from standard convexity. Rectangles serve as the simplest examples of orthogonally convex rectilinear polygons, as any axis-aligned line intersects them in at most one . In contrast, an L-shaped polygon fails this , since a line passing through the junction of its arms typically intersects the boundary in two disjoint . More complex examples include staircase polygons, where the boundary alternates monotonically between and vertical edges without backtracking. In , 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. This property facilitates applications in orthogonal and point covering problems, reducing time complexities for problems like minimum rectangle covers in VLSI design and image processing.

Monotone Rectilinear Polygons

A polygon is a special type of polygon that is with respect to either the x-axis or y-axis. Specifically, an x- polygon has the property that any vertical line intersects the polygon in at most one , 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. Similarly, a y- polygon satisfies the analogous condition with respect to horizontal lines and non-decreasing y-coordinates along its left and right chains. This monotonicity simplifies the structure compared to general polygons, as the vertices along each chain are naturally ordered by their coordinate in the direction of . Monotone rectilinear polygons play a key role in divide-and-conquer algorithms within , enabling efficient processing for tasks like and decomposition due to their ordered , which allow linear-time operations such as vertices. For instance, any y- polygon, including ones, can be triangulated in linear time by iteratively adding diagonals from the highest vertex to non-adjacent vertices on the opposite . Moreover, every simple polygon with n vertices can be partitioned into O(n) pieces using a sweep-line approach that identifies and resolves reflex , facilitating further geometric computations. 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. 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. In , 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.

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 Problems
A 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 . The algorithm employs a horizontal plane sweep to identify and resolve reflex chains, achieving O(n log n) by maintaining a status structure of active edges and computing 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 operations like and between two rectilinear polygons. A plane sweep algorithm, adapted from the Bentley-Ottmann , 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 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 (L1) and avoiding obstacles formed by vertices, benefits from the grid-like structure. An optimal preprocesses the polygon in O(n) time to support queries in O(log n) time for any pair of points, by building a hierarchical 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 vertices are treated as blockers in a 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 polygons, such as the maximum independent set (selecting a maximum of non-intersecting subregions or vertices under constraints), are NP-hard, inheriting from rectangle intersection graphs. Post-2015 advances have yielded constant-factor approximations for the related maximum independent set of axis-aligned —a core subroutine in rectilinear decompositions—with a -time 3-approximation using local search and techniques on 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 in n.

Rectangular Decomposition

Rectangular decomposition refers to the process of partitioning a rectilinear polygon into a collection of non-overlapping rectangles whose union exactly covers the polygon. This technique simplifies complex shapes for computational purposes by breaking them into basic rectangular components. A fundamental approach for simple hole-free rectilinear polygons involves identifying reflex vertices—those with an internal of 270°—and extending vertical or horizontal lines from these vertices until they intersect the polygon boundary or another such line, thereby forming rectangles. This method leverages the orthogonal nature of the edges to ensure the extensions align properly without introducing slanted cuts. For simple cases without collinear edges, the process can be executed in time using a linear traversal or scanline technique that processes vertices in order. Consider an L-shaped rectilinear polygon, formed by removing a smaller from the corner of a larger one, resulting in two reflex vertices. Extending a horizontal line from one reflex vertex across the interior splits the shape into two adjacent rectangles, demonstrating how a single cut resolves multiple concavities. In general, any such requires at least \lceil r/2 \rceil + 1 rectangles, where r denotes the number of reflex vertices, as each cut can eliminate at most two reflex vertices by connecting opposing concavities, and the number of rectangles equals the number of cuts plus one. More sophisticated algorithms adapt trapezoidal decomposition methods to rectilinear polygons, where the standard vertical lines from vertices produce trapezoids that simplify to rectangles due to the absence of diagonal edges. These adaptations maintain the O(n log n) expected of the original trapezoidal method while yielding a guaranteed linear number of rectangles. For polygons with holes, the algorithm extends lines across the interior while treating hole boundaries as obstacles, effectively filling the space between outer and inner contours to form a valid . Rectangular decomposition finds applications in floorplanning for and VLSI , where it aids in optimization by representing rooms or circuit blocks as rectangles, and in for finite element analysis, enabling structured grids over irregular domains. Determining a decomposition with the minimum number of rectangles is NP-hard for polygons with holes but can be solved in polynomial time for hole-free cases.