intersection
The area two rectangles have in common.
Rectangles that only touch (along an edge or at a corner) have no area in common.
Available since v3.1.5
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
a | Rect | A rectangle |
b | Rect | Another rectangle |
Returns
Section titled “Returns”Rect | undefined — The overlapping rectangle, or undefined when they do not overlap
Examples
Section titled “Examples”Visible part of a layer
Section titled “Visible part of a layer”Intersect a layer with the viewport.
Touching rectangles
Section titled “Touching rectangles”Sharing an edge is not overlapping.
Related Types
Section titled “Related Types”An axis-aligned rectangle: its top-left corner and its size. Width and height are expected to be non-negative.
