Skip to content

editorGlobalsBundleOfOutlinesPolygon

Class: BundleOfOutlinesPolygon

A BundleOfOutlinesPolygon is a set of outlines, that are filled based on the even-odd fill rule. The order of the outlines as well as their winding order is independent of their semantics.

Here's an example of two nested outlines. ### is the filled polygon area. X-------------------X |###################| |#X-------------X###| |#| |###| |#| X-----X |###| |#| |#####| |###| |#| X-----X |###| |#X-------------X###| |###################| X-------------------X

Hierarchy

  • BundleOfOutlinesPolygon

Index

Constructors

Properties

Methods

Constructors

constructor

+ new BundleOfOutlinesPolygon(outlines: ArrayPoint2[][]): BundleOfOutlinesPolygon

Defined in src/util/polygon/BundleOfOutlinesPolygon.ts:40

Parameters:

Name Type Default
outlines ArrayPoint2[][] []

Returns: BundleOfOutlinesPolygon

Properties

Private outlines

outlines: ArrayPoint2[][]

Defined in src/util/polygon/BundleOfOutlinesPolygon.ts:40

Methods

Private _containsOutline

_containsOutline(containingOutline: ArrayPoint2[], containedOutline: ArrayPoint2[]): boolean

Defined in src/util/polygon/BundleOfOutlinesPolygon.ts:109

Parameters:

Name Type
containingOutline ArrayPoint2[]
containedOutline ArrayPoint2[]

Returns: boolean


addOutline

addOutline(outline: ArrayPoint2[]): void

Defined in src/util/polygon/BundleOfOutlinesPolygon.ts:46

Parameters:

Name Type
outline ArrayPoint2[]

Returns: void


getOutlines

getOutlines(): any[][][]

Defined in src/util/polygon/BundleOfOutlinesPolygon.ts:53

Returns: any[][][]

a clone of the outlines.


getOutlinesRef

getOutlinesRef(): any[][]

Defined in src/util/polygon/BundleOfOutlinesPolygon.ts:60

Returns: any[][]

a reference to the outlines. This should not be modified.


toPolygons

toPolygons(): Polygon[]

Defined in src/util/polygon/BundleOfOutlinesPolygon.ts:69

Converts the bunch of independent outlines to an array of polygons (potentially with holes) according to the even-odd fill rule https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/fill-rule. Note: This assumes, that there are no intersecting or touching outlines.

Returns: Polygon[]


Static fromPolygon

fromPolygon(...polygons: Polygon[]): BundleOfOutlinesPolygon‹›

Defined in src/util/polygon/BundleOfOutlinesPolygon.ts:31

Construct a new BundleOfOutlinesPolygon from one or more Polygons. Note: This transfers ownership of the underlying arrays. The Polygons passed to this function must therefore be considered invalid afterwards.

Parameters:

Name Type Description
...polygons Polygon[] -

Returns: BundleOfOutlinesPolygon‹›