How this calculation works
Partition a rectangular window by a collection of infinite planar lines and report the resulting cells, their areas and shared-edge adjacency. Each line is entered through coefficients ax plus by equals c. Repeated proportional line equations are coalesced. The window is essential: unbounded arrangement regions become bounded clipped cells whose areas can be measured.
Split the finite rectangle by each distinct infinite line; retain positive-area cells and shared-edge adjacency.A worked example
The coordinate axes split the square [−1,1]² into four cells, each area one. Adjacent quadrants share an edge; opposite quadrants meet only at a vertex and are not adjacent. The cell areas sum to the window area four.
Good to know
1–12 lines with nonzero normals and a finite rectangular window. Numerically coincident normalized lines are merged. Floating-point clipping/adjacency tolerances apply; this is a clipped arrangement, not the total count of unbounded plane regions.
Reference: Method reference: Planar line arrangement calculator with cells and adjacency (opens in a new tab) ↗
Infinite lines rather than segments
A line extends across the entire window even when its coefficients were derived from a short drawn segment. The equation’s normal vector is a,b, so both coefficients cannot be zero.
Multiplying all coefficients by the same nonzero number represents the same line. The calculator normalizes and coalesces such duplicates within numerical tolerance. Distinct but nearly coincident lines may be difficult to distinguish at floating-point precision.
Computes the topology and regions of a whole arrangement, not just an individual line equation. The Polygonal curve linking number calculator from two closed loops offers a complementary calculation under its own stated assumptions.
Clipping creates arrangement cells
Starting from the rectangle, each line splits every crossed polygon into its two half-plane pieces. Pieces with positive area become cells.
A line outside the window adds no cell, while a line through an existing vertex may divide fewer cells than a generic line. The familiar maximum region formula assumes general position and an unrestricted plane; it should not be applied blindly to parallel, concurrent or window-clipped lines.
Worked example and mathematical rule
The coordinate axes split the square [−1,1]² into four cells, each area one. Adjacent quadrants share an edge; opposite quadrants meet only at a vertex and are not adjacent. The cell areas sum to the window area four.
Split the finite rectangle by each distinct infinite line; retain positive-area cells and shared-edge adjacency.
Areas and conservation
Cell areas come from polygon boundary coordinates, and their total should equal the rectangle’s area up to numerical tolerance. A line has zero area, so splitting does not remove mass from the window.
Tiny sliver cells can be sensitive to rounding and the positive-area threshold. The conservation check is a useful diagnostic, but it does not prove every adjacency has been identified correctly or every nearly degenerate configuration is resolved.
Adjacency needs a shared edge
Two cells are adjacent when their boundaries share a segment of positive length, not merely a single corner. This distinction matters at intersections where several regions meet.
The returned cell indices refer to the generated polygon list rather than a spatial ordering such as left-to-right. A different input line order can change those indices and polygon starting vertices while preserving the geometric partition. Compare geometry or area multisets rather than raw list order.
Degenerate configurations
Parallel lines can create strips, several concurrent lines can meet at one point, and a line can coincide with the window boundary. These cases are not errors simply because they achieve fewer than the general-position maximum regions.
Duplicate equations should not create duplicate cuts. Very large coefficients with tiny differences can obscure the actual geometry; rescale equations and coordinates sensibly while retaining enough precision to distinguish genuinely separate lines.
What the clipped arrangement represents
The result describes only the stated rectangle. It does not enumerate unbounded faces outside the window, compute a full projective arrangement or optimize the line placement.
For a planar subdivision application, record the window bounds and tolerance along with the line equations. Check that every cell vertex remains inside the rectangle and that each original line’s sign is consistent within a cell. Those tests help catch mistaken coefficient orientation or a window entered in the wrong coordinate units.
A few questions, answered
Are the inputs finite segments?
No. Each equation defines an infinite line clipped by the window.
Do cells touching at one vertex count as adjacent?
No. They must share a positive-length boundary segment.
Why is the region count below the usual maximum?
Parallelism, concurrence, duplicates and clipping can reduce the count.
Should cell areas sum to the window area?
Yes, within numerical tolerance.