region2.of
A region of one outline and its holes, rewound so the outline is counter-clockwise and holes clockwise.
Usage
Region2.of(outer: Polygon2, holes?: readonly Polygon2[]): Region2Parameters
outerPolygon2The outline, either orientation. Required. In model.
holesreadonly Polygon2[]Holes inside the outline, either orientation. Default
[]. In model.
Returns
A frozen region of one part; rings already wound correctly are kept as the same objects.
Guarantees
- outlines wind counter-clockwise and holes clockwise (part.outer.isCounterClockwise(), !hole.isCounterClockwise())
- parts.length === 1
- The same result on every machine.
Example
Region2.of(Polygon2.rectangle(4, 4).value, [Polygon2.rectangle(2, 2).value]).area() // → 12