region2.fromParts
A region of several parts, each an outline with holes, wound as Region2.of winds them.
Usage
Region2.fromParts(parts: readonly RegionPart[]): Region2Parameters
partsreadonly RegionPart[]Each part as { outer, holes }; disjoint outlines. Required. In model.
Returns
A frozen region; Region2.empty’s shape (no parts) for an empty list.
Guarantees
- outlines wind counter-clockwise and holes clockwise (part.outer.isCounterClockwise(), !hole.isCounterClockwise())
- parts.length equals the input’s
- The same result on every machine.
Example
const p = (x) => ({ outer: Polygon2.rectangle(1, 1, Point2.of(x, 0)).value, holes: [] })
Region2.fromParts([p(0), p(3)]).area() // → 2