Layout Rectangle Overlap Pairs
List unique unordered rectangle pairs with positive overlap area; edge touching, z-order and occlusion are not counted as area overlap.
Description
List unique unordered rectangle pairs with positive overlap area; edge touching, z-order and occlusion are not counted as area overlap.
Pairwise rectangle overlap distinguishes positive shared area from edge contact. Rectangles use origin and extent rather than opposite corners.
When to use this tool
List unique unordered rectangle pairs with positive overlap area; edge touching, z-order and occlusion are not counted as area overlap.
- Prepare the supplied rectangles fields for this operation.
- Compare the complete example with the representation used by your own input before carrying the result into another step.
How to use the tool and how it works
- Enter rectangles. Use the exact text syntax, units and index conventions explained below.
- Run the tool. If input validation fails, correct the supplied fields before interpreting any result.
- Read result.pairs. Interpret false, null and empty lists using the distinctions below; they can be valid outputs.
Require each rectangle as [x,y,width,height] with nonnegative extents. For each index pair compute clipped intersection width/height and emit the pair with overlapArea only when their product is positive.1
| Input field | Meaning and representation | Accepted input |
|---|---|---|
| rectangles | rectangles. | Numeric rows; at most 128 rows and 128 values per row |
| Output field | Interpretation |
|---|---|
| result | Object containing the named outputs below. |
| result.pairs | The pairs list in the ordering and representation described above. |
{
"input": {
"rectangles": [
[
0,
0,
2,
2
],
[
1,
1,
2,
2
]
]
},
"output": {
"result": {
"pairs": [
{
"leftIndex": 0,
"rightIndex": 1,
"overlapArea": 1
}
]
}
}
} Limitations and assumptions
- Zero-area rectangles and boundary contact are excluded. Rotations, z-order, occlusion and DOM measurements are not modeled.
- Rectangle arrays use [x,y,width,height] with nonnegative extents. All dimensions must use the same coordinate frame and unit; values are supplied rather than measured from a page.
- Every declared top-level field is required and unexpected fields are rejected. Numeric inputs must be finite; ordinary text fields are bounded to 8,192 UTF-16 code units, with tighter operation-specific limits where stated.
- String lists have at most 128 entries of at most 128 code units; matrices have at most 128 rows and columns. Larger numeric lists and parsed JSON have separate bounded budgets. Nonfinite results and excessively large serialized outputs are rejected.
- Indexes are zero-based and spans have an exclusive end unless explicitly stated otherwise. A valid false, null or empty-list result is distinct from malformed input.
Alternative or Complementary methods
Measure the actual layout when browser behavior matters. The formulas use supplied coordinates and explicit simplifications; they do not account for every box, writing mode, clipping ancestor or simultaneous layout change.
References
Similar or alternative tools
- Layout Inset Content Rectangle
Compute axis-aligned inset content geometry, retaining an overconstrained flag when opposing insets exceed available size.
- Layout Adjacent Gap Measure
Measure signed physical adjacency gap from the first trailing edge to the second leading edge; negative means overlap along that axis.