polygon2.outset
The ring grown by a distance with mitred corners; gaps that close become holes.
Usage
polygon.outset(distance: number): Result<Region2>Parameters
distancenumberHow far to move the edges outward; finite and ≥ 0. Required. Range [0, 1.7976931348623157e+308] model.
Returns
Ok with a region, usually one part; it can enclose holes (a C-shape whose mouth closes).
Errors
Guarantees
- a square of side s outset by d has area (s + 2d)² (Region2.area)
- contains every corner of the input (Region2.contains)
- outlines wind counter-clockwise and holes clockwise (part.outer.isCounterClockwise(), !hole.isCounterClockwise())
- The same result on every machine.
Use instead
polygon2.offset: round or bevel corners are needed and no hole can form
Example
const r = Polygon2.rectangle(2, 2).value.outset(1) // → area 16 once loadGeometryKernel() has run