Logo Euclid.Kontur

Kontur Type

A Kontur (German for contour) is a region of the plane defined by one or more closed Polyline2Ds and a fill rule.
 Paths may self intersect, overlap each other, or be nested. The fill rule decides what is inside.
 The fill rule belongs to the Kontur, not to the boolean operation, unlike in Clipper.
 Subject and clip get separate winding numbers on every edge, and each fill rule is applied to
 its own winding number before the boolean combines them. So two different fill rules never
 conflict, they are two independent decisions.
 What this buys is one pass instead of two: an EvenOdd glyph unioned with a NonZero CAD outline
 works in one operation. With a fill rule per operation the glyph would have to be simplified
 first, then unioned.
 Kontur values returned by a boolean operation are always simple: no self intersections, no overlaps,
 outer paths counter clockwise, holes clockwise, and their fill rule is Positive. Such a result
 reads the same under NonZero, Positive and EvenOdd, so the rule of a result never has to be changed.
 A Kontur does not copy the Polyline2Ds it is given. They are still mutable, so they must not be changed
 in a way that opens them while the Kontur is in use.

Instance members

Instance member Description

this.AsString

Full Usage: this.AsString

Returns: string

Format this Kontur into a string with its fill rule, count of paths and count of points.

Returns: string

this.BoundingRectangle

Full Usage: this.BoundingRectangle

Returns: BRect

The axis aligned bounding rectangle around all paths. Fails on an empty Kontur.

Returns: BRect

this.Contains

Full Usage: this.Contains

Parameters:
Returns: bool

Tests if the point is inside this Kontur according to its fill rule. Points exactly on a path may give either result.

pt : Pt
Returns: bool

this.FillRule

Full Usage: this.FillRule

Returns: FillRule

How the winding number decides what is inside this Kontur.

Returns: FillRule

this.IsEmpty

Full Usage: this.IsEmpty

Returns: bool

TRUE if this Kontur has no paths.

Returns: bool

this.PathCount

Full Usage: this.PathCount

Returns: int

The count of paths in this Kontur.

Returns: int

this.Paths

Full Usage: this.Paths

Returns: ResizeArray<Polyline2D>

The closed paths of this Kontur. Each path stores its first point twice, as first and as last point. This is the live internal list, do not add open paths to it.

Returns: ResizeArray<Polyline2D>

this.SignedArea

Full Usage: this.SignedArea

Returns: float

The sum of the signed areas of all paths. Counter clockwise paths count positive. This is the area of the Kontur only if the paths do not overlap and holes are oriented opposite to their outer path, which is the case for every Kontur returned by a boolean operation.

Returns: float

this.WindingNumber

Full Usage: this.WindingNumber

Parameters:
Returns: int

Counts how often the paths of this Kontur wind around the point. The sum of Polyline2D.WindingNumber over all paths. Points exactly on a path may give either side's result.

pt : Pt
Returns: int

Static members

Static member Description

Kontur.create (paths, ?fillRule)

Full Usage: Kontur.create (paths, ?fillRule)

Parameters:
    paths : Polyline2D seq - The closed Polyline2Ds. Each must have its first point repeated as last point and at least three distinct points.
    ?fillRule : FillRule - Optional, FillRule.NonZero by default. How the winding number decides what is inside. See the docs of FillRule for why the rule belongs to the Kontur.

Returns: Kontur A new Kontur.

Creates a Kontur from closed paths and a fill rule. The paths are not copied, the Kontur refers to the given Polyline2Ds.

paths : Polyline2D seq

The closed Polyline2Ds. Each must have its first point repeated as last point and at least three distinct points.

?fillRule : FillRule

Optional, FillRule.NonZero by default. How the winding number decides what is inside. See the docs of FillRule for why the rule belongs to the Kontur.

Returns: Kontur

A new Kontur.

Kontur.createSingleton (path, ?fillRule)

Full Usage: Kontur.createSingleton (path, ?fillRule)

Parameters:
    path : Polyline2D - The closed Polyline2D. It must have its first point repeated as last point and at least three distinct points.
    ?fillRule : FillRule - Optional, FillRule.NonZero by default. How the winding number decides what is inside.

Returns: Kontur A new Kontur with one path.

Creates a Kontur from one closed path.

path : Polyline2D

The closed Polyline2D. It must have its first point repeated as last point and at least three distinct points.

?fillRule : FillRule

Optional, FillRule.NonZero by default. How the winding number decides what is inside.

Returns: Kontur

A new Kontur with one path.

Kontur.empty fillRule

Full Usage: Kontur.empty fillRule

Parameters:
Returns: Kontur

Creates an empty Kontur without any paths.

fillRule : FillRule
Returns: Kontur

Type something to start searching.