Logo Euclid.Kontur

KonturEngine Type

Runs boolean operations on Kontur values. Holds all scratch buffers of the algorithm, so that repeated
 operations on one engine do not allocate anything but the result Polyline2Ds.
 Not thread safe, use one engine per thread.
 The tolerance is absolute, in the units of the coordinates: points closer than the tolerance are the same
 point, a point closer than the tolerance to a segment lies on it. See DESIGN.md section 2.

Constructors

Constructor Description

KonturEngine(tolerance)

Full Usage: KonturEngine(tolerance)

Parameters:
    tolerance : float

Returns: KonturEngine
tolerance : float
Returns: KonturEngine

Instance members

Instance member Description

this.Execute

Full Usage: this.Execute

Parameters:
    subject : Kontur - The subject Kontur.
    clip : Kontur - The clip Kontur. May be empty, then Union returns the subject simplified under its fill rule.
    op : ClipType - Union, Intersection, Difference (subject minus clip) or Xor.

Returns: Kontur A simple Kontur with fill rule Positive: no self intersections, no overlaps, outer contours counter clockwise, holes clockwise. Input vertices of the result keep their exact coordinates.

Runs one boolean operation between a subject and a clip Kontur. The fill rule of each Kontur decides what is inside it, see the docs of FillRule.

subject : Kontur

The subject Kontur.

clip : Kontur

The clip Kontur. May be empty, then Union returns the subject simplified under its fill rule.

op : ClipType

Union, Intersection, Difference (subject minus clip) or Xor.

Returns: Kontur

A simple Kontur with fill rule Positive: no self intersections, no overlaps, outer contours counter clockwise, holes clockwise. Input vertices of the result keep their exact coordinates.

this.ExecuteWithData

Full Usage: this.ExecuteWithData

Parameters:
    subject : KonturData<'T> - The subject Kontur with one value per point.
    clip : KonturData<'T> - The clip Kontur with one value per point. May be empty, then Union returns the subject simplified under its fill rule.
    op : ClipType - Union, Intersection, Difference (subject minus clip) or Xor.
    onCrossing : CrossedSegment<'T> -> CrossedSegment<'T> -> 'T - Returns the value of a new vertex from the two segments crossing there. The first segment is the subject segment when a subject segment crosses a clip segment. For a crossing of two segments of the same Kontur it is the earlier one, by path and then by point.

Returns: KonturData<'T> A simple Kontur with fill rule Positive, as from Execute, and one array of values per result contour, with one value per point, the closing point included. The result can be the input of the next operation.
Type parameters: 'T

Runs one boolean operation like Execute, and also hands the values of the input points on to the vertices of the result, for tracking where each result vertex comes from. An input vertex that is part of the result keeps the value of its input point. That includes an input vertex lying on a segment of the other Kontur, it is no new vertex. Points within tolerance of each other become one result vertex, which keeps the value of the first of them: subject before clip, then the earlier path, then the earlier point. An input point wins over a crossing within tolerance of it. A new vertex where two segments cross gets the value that onCrossing returns for the two segments. onCrossing is called once for every crossing that is part of the result, after the result contours are complete, so a crossing that two result contours share gets the same value in both. Operations without data pay nothing for this: the engine records only integers, and only while this method runs.

subject : KonturData<'T>

The subject Kontur with one value per point.

clip : KonturData<'T>

The clip Kontur with one value per point. May be empty, then Union returns the subject simplified under its fill rule.

op : ClipType

Union, Intersection, Difference (subject minus clip) or Xor.

onCrossing : CrossedSegment<'T> -> CrossedSegment<'T> -> 'T

Returns the value of a new vertex from the two segments crossing there. The first segment is the subject segment when a subject segment crosses a clip segment. For a crossing of two segments of the same Kontur it is the earlier one, by path and then by point.

Returns: KonturData<'T>

A simple Kontur with fill rule Positive, as from Execute, and one array of values per result contour, with one value per point, the closing point included. The result can be the input of the next operation.

this.Simplify

Full Usage: this.Simplify

Parameters:
Returns: Kontur

Resolves the self intersections and overlaps of one Kontur under its fill rule. The same as a Union with an empty clip.

shape : Kontur
Returns: Kontur

this.SimplifyWithData

Full Usage: this.SimplifyWithData

Parameters:
    shape : KonturData<'T> - The Kontur with one value per point.
    onCrossing : CrossedSegment<'T> -> CrossedSegment<'T> -> 'T - Returns the value of a new vertex from the two segments crossing there, the earlier one first.

Returns: KonturData<'T> A simple Kontur with fill rule Positive and one array of values per result contour.
Type parameters: 'T

Resolves the self intersections and overlaps of one Kontur under its fill rule, like Simplify, and hands the values of its points on to the vertices of the result, see ExecuteWithData.

shape : KonturData<'T>

The Kontur with one value per point.

onCrossing : CrossedSegment<'T> -> CrossedSegment<'T> -> 'T

Returns the value of a new vertex from the two segments crossing there, the earlier one first.

Returns: KonturData<'T>

A simple Kontur with fill rule Positive and one array of values per result contour.

this.Tolerance

Full Usage: this.Tolerance

Returns: float

The absolute tolerance of this engine.

Returns: float

this.UnionAll

Full Usage: this.UnionAll

Parameters:
Returns: Kontur

Union of any number of Kontur values, each under its own fill rule. Every Kontur is simplified on its own first, then all results are merged in one NonZero pass.

shapes : Kontur seq
Returns: Kontur

this.UnionAllWithData

Full Usage: this.UnionAllWithData

Parameters:
    shapes : KonturData<'T> seq - The Kontur values with one value per point.
    onCrossing : CrossedSegment<'T> -> CrossedSegment<'T> -> 'T - Returns the value of a new vertex from the two segments crossing there, the earlier one first.

Returns: KonturData<'T> A simple Kontur with fill rule Positive and one array of values per result contour.
Type parameters: 'T

Union of any number of Kontur values like UnionAll, and hands the values of their points on to the vertices of the result, see ExecuteWithData. Every Kontur is simplified on its own first, then all results are merged in one NonZero pass, so onCrossing may get segments of earlier results, carrying values it returned itself.

shapes : KonturData<'T> seq

The Kontur values with one value per point.

onCrossing : CrossedSegment<'T> -> CrossedSegment<'T> -> 'T

Returns the value of a new vertex from the two segments crossing there, the earlier one first.

Returns: KonturData<'T>

A simple Kontur with fill rule Positive and one array of values per result contour.

Static members

Static member Description

KonturEngine.DefaultTolerance

Full Usage: KonturEngine.DefaultTolerance

Returns: float

The default absolute tolerance: 1e-6

Returns: float

Type something to start searching.