polygon2.outset

The ring grown by a distance with mitred corners; gaps that close become holes.

GeometricSince 0.4.0

Usage

TypeScript
polygon.outset(distance: number): Result<Region2>

Parameters

  • distancenumber

    How 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

Example

TypeScript
const r = Polygon2.rectangle(2, 2).value.outset(1) // → area 16 once loadGeometryKernel() has run

See also