Logo Euclid

Polyline2D Type

A class holding a list of 2D points representing a mutable 2D Polyline. If the last point is the same as the first point, the Polyline2D is considered closed. The source-of-truth storage is an interleaved float buffer: x0, y0, x1, y1, ...

Constructors

Constructor Description

Polyline2D(capacity)

Full Usage: Polyline2D(capacity)

Parameters:
    capacity : int

Returns: Polyline2D

Create a new empty Polyline2D with predefined point count capacity.

capacity : int
Returns: Polyline2D

Instance members

Instance member Description

this.AddPoint

Full Usage: this.AddPoint

Parameters:

Adds a point to the end of the Polyline2D.

pt : Pt

this.AddXY

Full Usage: this.AddXY

Parameters:
    x : float
    y : float

Adds a point from x and y coordinates.

x : float
y : float

this.Area

Full Usage: this.Area

Returns: float

Calculates the area of the Polyline2D . The segment from the last point to the first point is included in the area calculation. For self intersecting Polylines the result is invalid.

Returns: float

this.AsFSharpCode

Full Usage: this.AsFSharpCode

Returns: string

Format a 2D polyline into an F# code string that can be used to recreate the polyline.

Returns: string

this.AsPoints

Full Usage: this.AsPoints

Returns: ResizeArray<Pt>

Converts the float buffer of the Polyline2D into a list of Points. Use .XYs to access the live internal buffer.

Returns: ResizeArray<Pt>

this.AsString

Full Usage: this.AsString

Returns: string

Format Polyline2D into string including its length.

Returns: string

this.BoundingRectangle

Full Usage: this.BoundingRectangle

Returns: BRect

Gets bounding rectangle of the Polyline2D

Returns: BRect

this.Center

Full Usage: this.Center

Returns: Pt

Returns the average center of all points of the Polyline2D.

Returns: Pt

this.Clone

Full Usage: this.Clone

Returns: Polyline2D

Creates a copy of the Polyline2D. Same as polyline.Duplicate()

Returns: Polyline2D

this.CloseInPlace

Full Usage: this.CloseInPlace

Parameters:
    ?toleranceForAddingPoint : float - Optional. 1e-6 by default The tolerance used to decide whether to snap the last point to the first point.

Close the Polyline2D if it is not already closed. If the ends are closer than the tolerance, the last point is set equal to the first point. Otherwise the start point is added to the end of the Polyline2D.

?toleranceForAddingPoint : float

Optional. 1e-6 by default The tolerance used to decide whether to snap the last point to the first point.

this.ClosestParameter

Full Usage: this.ClosestParameter

Parameters:
Returns: float

Returns the parameter on the Polyline2D that is the closest point to the given point. The integer part of the parameter is the index of the segment that the point is on. The fractional part of the parameter is the parameter from 0.0 to 1.0 on the segment. The domain Polyline2D starts at 0.0 and ends at points.Count - 1.0 .

p : Pt
Returns: float

this.ClosestParameterXY

Full Usage: this.ClosestParameterXY

Parameters:
    x : float
    y : float

Returns: float

Returns the parameter on the Polyline2D that is the closest point to the given point. The integer part of the parameter is the index of the segment that the point is on. The fractional part of the parameter is the parameter from 0.0 to 1.0 on the segment. The domain Polyline2D starts at 0.0 and ends at points.Count - 1.0 .

x : float
y : float
Returns: float

this.ClosestPoint

Full Usage: this.ClosestPoint

Parameters:
Returns: Pt

Returns the point on the Polyline2D that is the closest point to the given point. This might be a point on a segment or a vertex of the Polyline2D.

p : Pt
Returns: Pt

this.ClosestPointIndex

Full Usage: this.ClosestPointIndex

Parameters:
Returns: int

Returns the index into the Polylines point list of the point that is closest to the given point.

p : Pt
Returns: int

this.Contains

Full Usage: this.Contains

Parameters:
    pt : Pt - The point to test.

Returns: bool TRUE if the point is inside, FALSE otherwise.

Tests if a point is inside the closed Polyline2D using the ray casting algorithm.

pt : Pt

The point to test.

Returns: bool

TRUE if the point is inside, FALSE otherwise.

this.ContainsXY

Full Usage: this.ContainsXY

Parameters:
    x : float - The X coordinate of the point to test.
    y : float - The Y coordinate of the point to test.

Returns: bool TRUE if the point is inside, FALSE otherwise.

Tests if a point is inside the closed Polyline2D using the ray casting algorithm.

The first and last point of the Polyline2D need to be identical for correct results. Self-intersecting polygons give "alternating" inside/outside regions Uses ray casting: runs an infinite horizontal ray (increasing x, fixed y) from the test point and counts edge crossings. Each crossing toggles inside/outside state (Jordan curve theorem). Always returns FALSE if the Polyline2D has less than 3 points. Boundary cases: Points exactly on edges or vertices have implementation-specific behavior. Horizontal edges are handled by the strict inequality convention (pi.Y > y) != (pj.Y > y). Points on left/bottom edges tend to be considered inside, right/top edges outside. The result may differ from checking the pl.WindingNumber 0 for boundary points.

x : float

The X coordinate of the point to test.

y : float

The Y coordinate of the point to test.

Returns: bool

TRUE if the point is inside, FALSE otherwise.

this.DistanceTo

Full Usage: this.DistanceTo

Parameters:
Returns: float

Returns the distance of the test point to the closest point on the Polyline2D.

p : Pt
Returns: float

this.DistanceToXY

Full Usage: this.DistanceToXY

Parameters:
    x : float
    y : float

Returns: float

Returns the distance of the test point to the closest point on the Polyline2D.

x : float
y : float
Returns: float

this.Duplicate

Full Usage: this.Duplicate

Returns: Polyline2D

Creates a copy of the Polyline2D Same as polyline.Clone()

Returns: Polyline2D

this.End

Full Usage: this.End

Returns: Pt

Gets or sets last or end point of the Polyline2D This is the point at index Points.Count - 1. Same as Polyline2D.LastPoint

Returns: Pt

this.EvaluateAt

Full Usage: this.EvaluateAt

Parameters:
    t : float

Returns: Pt

Returns the point at a given parameter on the Polyline2D. The integer part of the parameter is the index of the segment that the point is on. The fractional part of the parameter is the parameter from 0.0 to 1.0 on the segment. The domain Polyline2D starts at 0.0 and ends at points.Count - 1.0 . If the parameter is within 1e-6 of an integer value, the integer value is used as parameter.

t : float
Returns: Pt

this.FindLabelPoint

Full Usage: this.FindLabelPoint

Parameters:
    precision : float

Returns: Pt * float

Finds a point inside a closed Polyline2D that is the farthest away from the edges of the Polyline2D. Uses the Polylabel algorithm from Mapbox. It is a highly optimized algorithm specifically designed to find the pole of inaccessibility for polygons. The point within the polygon that is farthest from the edges, often used for optimal label placement. Adaptive Precision: Can trade accuracy for speed based on your needs. The precision must be a positive number, otherwise an error is raised. Returns the best point and its distance to the polygon edge. Supplying an open polyline is allowed, but the computed "inside" still assumes the points describe a closed boundary (first and last vertices should match).

precision : float
Returns: Pt * float

this.FirstPoint

Full Usage: this.FirstPoint

Returns: Pt

Gets or sets the first point of the Polyline2D. This is the point at index 0. Same as Polyline2D.Start

Returns: Pt

this.FirstSegment

Full Usage: this.FirstSegment

Returns: Line2D

Gets the first segment of the Polyline2D.

Returns: Line2D

this.GetPt

Full Usage: this.GetPt

Parameters:
    position : int

Returns: Pt

Gets the point at the given position. (does Pt(xys.[position * 2], xys.[position * 2 + 1]) internally)

position : int
Returns: Pt

this.GetSegment

Full Usage: this.GetSegment

Parameters:
    i : int

Returns: Line2D

Gets the segment at index i of the Polyline2D.

i : int
Returns: Line2D

this.GetX

Full Usage: this.GetX

Parameters:
    position : int

Returns: float

Gets the x coordinate of the point at the given position. (does xys.[position * 2] internally)

position : int
Returns: float

this.GetY

Full Usage: this.GetY

Parameters:
    position : int

Returns: float

Gets the y coordinate of the point at the given position. (does xys.[position * 2 + 1] internally)

position : int
Returns: float

this.IsAlmostClosed

Full Usage: this.IsAlmostClosed

Parameters:
    tolerance : float

Returns: bool

Tests if Polyline2D is closed within given tolerance. Returns False if the Polyline2D has less than 3 points.

tolerance : float
Returns: bool

this.IsClockwise

Full Usage: this.IsClockwise

Returns: bool

Test if Polyline2D is Clockwise. The Polyline2D does not need to be actually closed. The signed area of the Polyline2D is calculated. If it is negative the Polyline2D is Clockwise.

Returns: bool

this.IsClosed

Full Usage: this.IsClosed

Returns: bool

Tests if Polyline2D start and end points are exactly the same. Returns False if the Polyline2D has less than 3 points.

Returns: bool

this.IsCounterClockwise

Full Usage: this.IsCounterClockwise

Returns: bool

Test if Polyline2D is CounterClockwise. The Polyline2D does not need to be actually closed. The signed area of the Polyline2D is calculated. If it is positive the Polyline2D is Counter Clockwise.

Returns: bool

this.LastPoint

Full Usage: this.LastPoint

Returns: Pt

Gets or sets the last point of the Polyline2D. This is the point at index Points.Count - 1. Same as Polyline2D.End

Returns: Pt

this.LastSegment

Full Usage: this.LastSegment

Returns: Line2D

Gets the last segment of the Polyline2D.

Returns: Line2D

this.Length

Full Usage: this.Length

Returns: float

Gets the length of the Polyline2D Returns 0.0 if there are less than 2 points.

Returns: float

this.Move

Full Usage: this.Move

Parameters:
Returns: Polyline2D

Returns a Polyline2D moved by a vector.

v : Vc
Returns: Polyline2D

this.MoveX

Full Usage: this.MoveX

Parameters:
    distance : float

Returns: Polyline2D

Returns a Polyline2D moved by a given distance in X direction.

distance : float
Returns: Polyline2D

this.MoveY

Full Usage: this.MoveY

Parameters:
    distance : float

Returns: Polyline2D

Returns a Polyline2D moved by a given distance in Y direction.

distance : float
Returns: Polyline2D

this.PointCount

Full Usage: this.PointCount

Returns: int

Gets the count of points in the Polyline2D

Returns: int

this.Reverse

Full Usage: this.Reverse

Returns: Polyline2D

Returns new Polyline2D in reversed Order.

Returns: Polyline2D

this.ReverseInPlace

Full Usage: this.ReverseInPlace

Reverse order of the Polyline2D in place.

this.Rotate

Full Usage: this.Rotate

Parameters:
Returns: Polyline2D

Rotation a Polyline2D around the World-Origin by a Rotation2D.

r : Rotation2D
Returns: Polyline2D

this.RotateWithCenter

Full Usage: this.RotateWithCenter

Parameters:
Returns: Polyline2D

Rotation a Polyline2D around a given center point by a Rotation2D.

cen : Pt
r : Rotation2D
Returns: Polyline2D

this.Scale

Full Usage: this.Scale

Parameters:
    factor : float

Returns: Polyline2D

Scales the 2D polyline by a given factor. Scale center is World Origin 0,0

factor : float
Returns: Polyline2D

this.ScaleOn

Full Usage: this.ScaleOn

Parameters:
    cen : Pt
    factor : float

Returns: Polyline2D

Scales the 2D polyline by a given factor on a given center point.

cen : Pt
factor : float
Returns: Polyline2D

this.SecondLastPoint

Full Usage: this.SecondLastPoint

Returns: Pt

Gets or sets the second last point of the Polyline2D.

Returns: Pt

this.SecondPoint

Full Usage: this.SecondPoint

Returns: Pt

Gets or sets the second point of the Polyline2D. This is the point at index 1.

Returns: Pt

this.SegmentCount

Full Usage: this.SegmentCount

Returns: int

Gets the count of segments in the Polyline2D This is poly.Points.Count - 1

Returns: int

this.SegmentVectors

Full Usage: this.SegmentVectors

Returns: ResizeArray<Vc>

Returns the line vectors of all segments of the Polyline2D as a list of Vc. The length of the list is one less than the point count.

Returns: ResizeArray<Vc>

this.SegmentVectorsXY

Full Usage: this.SegmentVectorsXY

Returns: ResizeArray<float>

Returns the line vectors of all segments of the Polyline2D as a flat list of x and y components. The length of the list is 2 less than the xys count, so one less vector than points in the polyline.

Returns: ResizeArray<float>

this.Segments

Full Usage: this.Segments

Returns: ResizeArray<Line2D>

Returns all segments of the Polyline2D as a list of Line2D.

Returns: ResizeArray<Line2D>

this.SetPointXY

Full Usage: this.SetPointXY

Parameters:
    position : int
    x : float
    y : float

Sets the x and y coordinates of the point at the given index. NOTE: setting the first or last point on a closed Polyline2D might open it. (sets xys.[position * 2] and xys.[position * 2 + 1] internally )

position : int
x : float
y : float

this.SetPointXYClosed

Full Usage: this.SetPointXYClosed

Parameters:
    position : int
    x : float
    y : float

Sets the x and y coordinates of the point at the given position. On a closed Polyline2D, setting the first or last point will set both to the same point. Raises an error if the position is out of range. (sets xys.[position * 2] and xys.[position * 2 + 1] internally)

position : int
x : float
y : float

this.SetPt

Full Usage: this.SetPt

Parameters:
    position : int
    pt : Pt

Sets the point at given position to the given point. ( sets xys.[position * 2] and xys.[position * 2 + 1] internally)

position : int
pt : Pt

this.SignedArea

Full Usage: this.SignedArea

Returns: float

Calculates the signed area of the Polyline2D . If it is positive the Polyline2D is Counter Clockwise. Polyline does not need to be exactly closed. The segment from the last point to the first point is included in the area calculation. For self intersecting Polylines the result is invalid. Raises an error on an empty Polyline2D.

Returns: float

this.SignedDistanceTo

Full Usage: this.SignedDistanceTo

Parameters:
    point : Pt

Returns: float

Calculates the shortest distance from the test point to the polyline with `DistanceTo`, then signs that value by testing containment via the ray-casting based `Contains` helper. Returns a positive distance for points that lie inside the polyline boundary and negative otherwise. For reliable results the polyline should be closed and have identical first and last vertices.

point : Pt
Returns: float

this.SignedDistanceToXY

Full Usage: this.SignedDistanceToXY

Parameters:
    x : float
    y : float

Returns: float

Calculates the shortest distance from the test point to the polyline with `DistanceTo`, then signs that value by testing containment via the ray-casting based `Contains` helper. Returns a positive distance for points that lie inside the polyline boundary and negative otherwise. For reliable results the polyline should be closed and have identical first and last vertices.

x : float
y : float
Returns: float

this.Start

Full Usage: this.Start

Returns: Pt

Gets or sets first point of the Polyline2D This is the point at index 0. Same as Polyline2D.FirstPoint

Returns: Pt

this.WindingNumber

Full Usage: this.WindingNumber

Parameters:
    point : Pt - The point to test.

Returns: int The winding number. Zero means outside, non-zero means inside.

Count how many times the polygon winds around the point. If the result is 0 then the point is outside of the Polyline2D. A non-zero value indicates the point is inside.

The first and last point of the Polyline2D need to be identical for correct results. Boundary cases: Points exactly on edges or vertices may return inconsistent results due to floating-point precision. For points on horizontal edges, behavior depends on the edge direction. This method Handles self-intersecting polygons more intuitively than the pl.Contains method.

point : Pt

The point to test.

Returns: int

The winding number. Zero means outside, non-zero means inside.

this.XYs

Full Usage: this.XYs

Returns: ResizeArray<float>

Gets the X and Y interleaved ResizeArray of the Polyline2D: x0, y0, x1, y1, ... This is the live internal buffer, so changes to the list will be reflected in the Polyline2D.

Returns: ResizeArray<float>

Static members

Static member Description

Polyline2D.addPoint pt p

Full Usage: Polyline2D.addPoint pt p

Parameters:
Modifiers: inline

Adds a point to the end of the Polyline2D.

pt : Pt
p : Polyline2D

Polyline2D.addXY x y p

Full Usage: Polyline2D.addXY x y p

Parameters:
Modifiers: inline

Adds a point from x and y coordinates.

x : float
y : float
p : Polyline2D

Polyline2D.area p

Full Usage: Polyline2D.area p

Parameters:
Returns: float
Modifiers: inline

Calculates the area of the Polyline2D . The segment from the last point to the first point is included in the area calculation. For self intersecting Polylines the result is invalid.

p : Polyline2D
Returns: float

Polyline2D.asFSharpCode p

Full Usage: Polyline2D.asFSharpCode p

Parameters:
Returns: string
Modifiers: inline

Format a 2D polyline into an F# code string that can be used to recreate the polyline.

p : Polyline2D
Returns: string

Polyline2D.asPoints p

Full Usage: Polyline2D.asPoints p

Parameters:
Returns: ResizeArray<Pt>
Modifiers: inline

Converts the float buffer of the Polyline2D into a list of Points. Use .XYs to access the live internal buffer.

p : Polyline2D
Returns: ResizeArray<Pt>

Polyline2D.asString p

Full Usage: Polyline2D.asString p

Parameters:
Returns: string
Modifiers: inline

Format Polyline2D into string including its length.

p : Polyline2D
Returns: string

Polyline2D.boundingRectangle p

Full Usage: Polyline2D.boundingRectangle p

Parameters:
Returns: BRect
Modifiers: inline

Gets bounding rectangle of the Polyline2D

p : Polyline2D
Returns: BRect

Polyline2D.center p

Full Usage: Polyline2D.center p

Parameters:
Returns: Pt
Modifiers: inline

Returns the average center of all points of the Polyline2D.

p : Polyline2D
Returns: Pt

Polyline2D.clone p

Full Usage: Polyline2D.clone p

Parameters:
Returns: Polyline2D
Modifiers: inline

Creates a copy of the Polyline2D. Same as polyline.Duplicate()

p : Polyline2D
Returns: Polyline2D

Polyline2D.close toleranceForAddingPoint pl

Full Usage: Polyline2D.close toleranceForAddingPoint pl

Parameters:
Returns: Polyline2D

Returns a new closed Polyline2D. If the first and last point are within the tolerance of each other, the last point is set equal to the first point. Otherwise one point is added. Raises an error if the Polyline2D has fewer than 3 points, same as CloseInPlace.

toleranceForAddingPoint : float
pl : Polyline2D
Returns: Polyline2D

Polyline2D.closeInPlace toleranceForAddingPoint pl

Full Usage: Polyline2D.closeInPlace toleranceForAddingPoint pl

Parameters:
    toleranceForAddingPoint : float - The tolerance used to decide whether to snap the last point to the first point.
    pl : Polyline2D - The Polyline2D to close.

Returns: Polyline2D A reference to the same Polyline2D as the input

Close the Polyline2D in place using the given tolerance. If the ends are closer than the tolerance, the last point is set equal to the first point. Otherwise the start point is added to the end of the Polyline2D.

toleranceForAddingPoint : float

The tolerance used to decide whether to snap the last point to the first point.

pl : Polyline2D

The Polyline2D to close.

Returns: Polyline2D

A reference to the same Polyline2D as the input

Polyline2D.closestParameter pl pt

Full Usage: Polyline2D.closestParameter pl pt

Parameters:
Returns: float
Modifiers: inline

Returns the parameter on the Polyline2D that is the closest point to the given point. The integer part of the parameter is the index of the segment that the point is on. The fractional part of the parameter is the parameter from 0.0 to 1.0 on the segment. The domain Polyline2D starts at 0.0 and ends at points.Count - 1.0 .

pl : Polyline2D
pt : Pt
Returns: float

Polyline2D.closestParameterXY pl x y

Full Usage: Polyline2D.closestParameterXY pl x y

Parameters:
Returns: float
Modifiers: inline

Returns the parameter on the Polyline2D that is the closest point to the given point. The integer part of the parameter is the index of the segment that the point is on. The fractional part of the parameter is the parameter from 0.0 to 1.0 on the segment. The domain Polyline2D starts at 0.0 and ends at points.Count - 1.0 .

pl : Polyline2D
x : float
y : float
Returns: float

Polyline2D.closestPoint pl pt

Full Usage: Polyline2D.closestPoint pl pt

Parameters:
Returns: Pt
Modifiers: inline

Returns the point on the Polyline2D that is the closest point to the given point.

pl : Polyline2D
pt : Pt
Returns: Pt

Polyline2D.closestPointIndex pl pt

Full Usage: Polyline2D.closestPointIndex pl pt

Parameters:
Returns: int
Modifiers: inline

Returns the index into the Polylines point list of the point that is closest to the given point.

pl : Polyline2D
pt : Pt
Returns: int

Polyline2D.contains pt pl

Full Usage: Polyline2D.contains pt pl

Parameters:
    pt : Pt - The point to test.
    pl : Polyline2D - The closed Polyline2D.

Returns: bool TRUE if the point is inside, FALSE otherwise.
Modifiers: inline

Tests if a point is inside the closed Polyline2D using the ray casting algorithm.

The first and last point of the Polyline2D need to be identical for correct results. Self-intersecting polygons give "alternating" inside/outside regions Uses ray casting: runs an infinite horizontal ray (increasing x, fixed y) from the test point and counts edge crossings. Each crossing toggles inside/outside state (Jordan curve theorem). Always returns FALSE if the Polyline2D has less than 3 points. Boundary cases: Points exactly on edges or vertices have implementation-specific behavior. Horizontal edges are handled by the strict inequality convention (pi.Y > y) != (pj.Y > y). Points on left/bottom edges tend to be considered inside, right/top edges outside. The result may differ from checking the pl.WindingNumber 0 for boundary points.

pt : Pt

The point to test.

pl : Polyline2D

The closed Polyline2D.

Returns: bool

TRUE if the point is inside, FALSE otherwise.

Polyline2D.containsXY x y pl

Full Usage: Polyline2D.containsXY x y pl

Parameters:
    x : float - The X coordinate of the point to test.
    y : float - The Y coordinate of the point to test.
    pl : Polyline2D - The closed Polyline2D.

Returns: bool TRUE if the point is inside, FALSE otherwise.
Modifiers: inline

Tests if a point is inside the closed Polyline2D using the ray casting algorithm.

x : float

The X coordinate of the point to test.

y : float

The Y coordinate of the point to test.

pl : Polyline2D

The closed Polyline2D.

Returns: bool

TRUE if the point is inside, FALSE otherwise.

Polyline2D.createDirectly xys

Full Usage: Polyline2D.createDirectly xys

Parameters:
    xys : ResizeArray<float>

Returns: Polyline2D

Create a new Polyline2D by using the provided X and Y interleaved ResizeArray directly. Unsafe because later changes to the ResizeArray will be reflected in the Polyline2D.

xys : ResizeArray<float>
Returns: Polyline2D

Polyline2D.createEmpty capacity

Full Usage: Polyline2D.createEmpty capacity

Parameters:
    capacity : int

Returns: Polyline2D
Modifiers: inline

Create a new empty Polyline2D without any points. But predefined capacity.

capacity : int
Returns: Polyline2D

Polyline2D.createFromBRectCCW r

Full Usage: Polyline2D.createFromBRectCCW r

Parameters:
Returns: Polyline2D

Creates a counter-clockwise Polyline2D starting at the MinX and MinY for the bounding Rectangle

r : BRect
Returns: Polyline2D

Polyline2D.createFromBRectCW r

Full Usage: Polyline2D.createFromBRectCW r

Parameters:
Returns: Polyline2D

Creates a clockwise Polyline2D starting at the MinX and MinY for the bounding Rectangle

r : BRect
Returns: Polyline2D

Polyline2D.createFromPts points

Full Usage: Polyline2D.createFromPts points

Parameters:
    points : Pt seq

Returns: Polyline2D

Create a new Polyline2D by copying over all points. This will allocate a new ResizeArray and copy all points.

points : Pt seq
Returns: Polyline2D

Polyline2D.createFromRectCCW r

Full Usage: Polyline2D.createFromRectCCW r

Parameters:
Returns: Polyline2D

Creates a counter-clockwise closed Polyline2D starting at the Origin of the Rect2D

r : Rect2D
Returns: Polyline2D

Polyline2D.createFromRectCW r

Full Usage: Polyline2D.createFromRectCW r

Parameters:
Returns: Polyline2D

Creates a clockwise closed Polyline2D starting at the Origin of the Rect2D

r : Rect2D
Returns: Polyline2D

Polyline2D.createFromXYMembers xyObjs

Full Usage: Polyline2D.createFromXYMembers xyObjs

Parameters:
    xyObjs : ^T seq

Returns: Polyline2D
Modifiers: inline
Type parameters: ^T, ^a, ^b (requires (member get_X : ^T -> ^a) and (member get_Y : ^T -> ^b) and (static member op_Explicit : ^a -> Microsoft.FSharp.Core.float) and (static member op_Explicit : ^b -> Microsoft.FSharp.Core.float))

Creates a Polyline2D from a list of objects with X and Y members (uppercase).

xyObjs : ^T seq
Returns: Polyline2D

Polyline2D.createFromxyMembers xyObjs

Full Usage: Polyline2D.createFromxyMembers xyObjs

Parameters:
    xyObjs : ^T seq

Returns: Polyline2D
Modifiers: inline
Type parameters: ^T, ^a, ^b (requires (member get_x : ^T -> ^a) and (member get_y : ^T -> ^b) and (static member op_Explicit : ^a -> Microsoft.FSharp.Core.float) and (static member op_Explicit : ^b -> Microsoft.FSharp.Core.float))

Creates a Polyline2D from a list of objects with x and y members (lowercase).

xyObjs : ^T seq
Returns: Polyline2D

Polyline2D.distanceTo pl pt

Full Usage: Polyline2D.distanceTo pl pt

Parameters:
Returns: float
Modifiers: inline

Returns the distance of the test point to the closest point on the Polyline2D.

pl : Polyline2D
pt : Pt
Returns: float

Polyline2D.distanceToXY pl x y

Full Usage: Polyline2D.distanceToXY pl x y

Parameters:
Returns: float
Modifiers: inline

Returns the distance of the test point to the closest point on the Polyline2D.

pl : Polyline2D
x : float
y : float
Returns: float

Polyline2D.duplicate p

Full Usage: Polyline2D.duplicate p

Parameters:
Returns: Polyline2D
Modifiers: inline

Creates a copy of the Polyline2D Same as polyline.Clone()

p : Polyline2D
Returns: Polyline2D

Polyline2D.end' p

Full Usage: Polyline2D.end' p

Parameters:
Returns: Pt
Modifiers: inline

Gets the last or end point of the Polyline2D This is the point at index Points.Count - 1. Same as Polyline2D.LastPoint

p : Polyline2D
Returns: Pt

Polyline2D.ensureClockwise pl

Full Usage: Polyline2D.ensureClockwise pl

Parameters:
Returns: Polyline2D
Modifiers: inline

Tests if Polyline2D is Clockwise. Returns the same instance if the Polyline2D is already Clockwise, otherwise returns a new reversed Polyline2D.

pl : Polyline2D
Returns: Polyline2D

Polyline2D.ensureClockwiseInPlace pl

Full Usage: Polyline2D.ensureClockwiseInPlace pl

Parameters:
Returns: Polyline2D
Modifiers: inline

Tests if Polyline2D is Clockwise. If not reverse the Polyline2D in place. Always returns the same instance.

pl : Polyline2D
Returns: Polyline2D

Polyline2D.ensureCounterClockwise pl

Full Usage: Polyline2D.ensureCounterClockwise pl

Parameters:
Returns: Polyline2D
Modifiers: inline

Tests if Polyline2D is Counter Clockwise. Returns the same instance if the Polyline2D is already Counter Clockwise, otherwise returns a new reversed Polyline2D.

pl : Polyline2D
Returns: Polyline2D

Polyline2D.ensureCounterClockwiseInPlace pl

Full Usage: Polyline2D.ensureCounterClockwiseInPlace pl

Parameters:
Returns: Polyline2D
Modifiers: inline

Tests if Polyline2D is Counter Clockwise. If not reverse the Polyline2D in place. Always returns the same instance.

pl : Polyline2D
Returns: Polyline2D

Polyline2D.equals pl1 pl2

Full Usage: Polyline2D.equals pl1 pl2

Parameters:
    pl1 : Polyline2D - The first Polyline2D instance.
    pl2 : Polyline2D - The second Polyline2D instance.

Returns: bool True if the two Polyline2D instances are equal, otherwise false.

Tests if two Polyline2D have the same point count and if their corresponding points are exactly equal.

pl1 : Polyline2D

The first Polyline2D instance.

pl2 : Polyline2D

The second Polyline2D instance.

Returns: bool

True if the two Polyline2D instances are equal, otherwise false.

Polyline2D.equalsTol tol pl1 pl2

Full Usage: Polyline2D.equalsTol tol pl1 pl2

Parameters:
    tol : float - The tolerance value for comparing the coordinates.
    pl1 : Polyline2D - The first Polyline2D instance.
    pl2 : Polyline2D - The second Polyline2D instance.

Returns: bool

Tests if two Polyline2D have the same point count and if their corresponding points are equal within a given tolerance.

tol : float

The tolerance value for comparing the coordinates.

pl1 : Polyline2D

The first Polyline2D instance.

pl2 : Polyline2D

The second Polyline2D instance.

Returns: bool

Polyline2D.evaluateAt t pl

Full Usage: Polyline2D.evaluateAt t pl

Parameters:
Returns: Pt

Returns the point at a given parameter on the Polyline2D. The integer part of the parameter is the index of the segment that the point is on. The fractional part of the parameter is the parameter from 0.0 to 1.0 on the segment. The domain Polyline2D starts at 0.0 and ends at points.Count - 1.0 .

t : float
pl : Polyline2D
Returns: Pt

Polyline2D.findLabelPoint precision pl

Full Usage: Polyline2D.findLabelPoint precision pl

Parameters:
Returns: Pt * float

Finds a point inside a closed Polyline2D that is the farthest away from the edges of the Polyline2D. Uses the Polylabel algorithm from Mapbox. It is a highly optimized algorithm specifically designed to find the pole of inaccessibility for polygons. The point within the polygon that is farthest from the edges, often used for optimal label placement. Adaptive Precision: Can trade accuracy for speed based on your needs. The precision must be a positive number, otherwise an error is raised. Returns the best point and its distance to the polygon edge. Supplying an open polyline is allowed, but the computed "inside" still assumes the points describe a closed boundary (first and last vertices should match).

precision : float
pl : Polyline2D
Returns: Pt * float

Polyline2D.firstPoint p

Full Usage: Polyline2D.firstPoint p

Parameters:
Returns: Pt
Modifiers: inline

Gets the first point of the Polyline2D. This is the point at index 0. Same as Polyline2D.Start

p : Polyline2D
Returns: Pt

Polyline2D.firstSegment p

Full Usage: Polyline2D.firstSegment p

Parameters:
Returns: Line2D
Modifiers: inline

Gets the first segment of the Polyline2D.

p : Polyline2D
Returns: Line2D

Polyline2D.getPt position p

Full Usage: Polyline2D.getPt position p

Parameters:
Returns: Pt
Modifiers: inline

Gets the point at the given position. (does Pt(xys.[position * 2], xys.[position * 2 + 1]) internally)

position : int
p : Polyline2D
Returns: Pt

Polyline2D.getSegment i p

Full Usage: Polyline2D.getSegment i p

Parameters:
Returns: Line2D
Modifiers: inline

Gets the segment at index i of the Polyline2D.

i : int
p : Polyline2D
Returns: Line2D

Polyline2D.getX position p

Full Usage: Polyline2D.getX position p

Parameters:
Returns: float
Modifiers: inline

Gets the x coordinate of the point at the given index. (does xys.[position * 2] internally)

position : int
p : Polyline2D
Returns: float

Polyline2D.getXYs p

Full Usage: Polyline2D.getXYs p

Parameters:
Returns: ResizeArray<float>
Modifiers: inline

Gets the X and Y interleaved ResizeArray of the Polyline2D: x0, y0, x1, y1, ... This is the live internal buffer, so changes to the list will be reflected in the Polyline2D.

p : Polyline2D
Returns: ResizeArray<float>

Polyline2D.getY position p

Full Usage: Polyline2D.getY position p

Parameters:
Returns: float
Modifiers: inline

Gets the y coordinate of the point at the given index. (does xys.[position * 2 + 1] internally)

position : int
p : Polyline2D
Returns: float

Polyline2D.isAlmostClosed tolerance p

Full Usage: Polyline2D.isAlmostClosed tolerance p

Parameters:
Returns: bool
Modifiers: inline

Tests if Polyline2D is closed within given tolerance. Returns False if the Polyline2D has less than 3 points.

tolerance : float
p : Polyline2D
Returns: bool

Polyline2D.isClockwise p

Full Usage: Polyline2D.isClockwise p

Parameters:
Returns: bool
Modifiers: inline

Test if Polyline2D is Clockwise. The Polyline2D does not need to be actually closed. The signed area of the Polyline2D is calculated. If it is negative the Polyline2D is Clockwise.

p : Polyline2D
Returns: bool

Polyline2D.isClosed p

Full Usage: Polyline2D.isClosed p

Parameters:
Returns: bool
Modifiers: inline

Tests if Polyline2D start and end points are exactly the same. Returns False if the Polyline2D has less than 3 points.

p : Polyline2D
Returns: bool

Polyline2D.isCounterClockwise p

Full Usage: Polyline2D.isCounterClockwise p

Parameters:
Returns: bool
Modifiers: inline

Test if Polyline2D is CounterClockwise. The Polyline2D does not need to be actually closed. The signed area of the Polyline2D is calculated. If it is positive the Polyline2D is Counter Clockwise.

p : Polyline2D
Returns: bool

Polyline2D.iter action pl

Full Usage: Polyline2D.iter action pl

Parameters:
    action : float -> float -> unit - A function that takes the X and Y coordinates of a point.
    pl : Polyline2D - The Polyline2D to iterate over.

Modifiers: inline

Iterate over each point in the Polyline2D.

action : float -> float -> unit

A function that takes the X and Y coordinates of a point.

pl : Polyline2D

The Polyline2D to iterate over.

Polyline2D.iterLineSegments action pl

Full Usage: Polyline2D.iterLineSegments action pl

Parameters:
    action : Line2D -> unit - A function that takes a Line2D representing the segment.
    pl : Polyline2D - The Polyline2D to iterate over.

Modifiers: inline

Iterate over each segment in the Polyline2D.

action : Line2D -> unit

A function that takes a Line2D representing the segment.

pl : Polyline2D

The Polyline2D to iterate over.

Polyline2D.iterPt action pl

Full Usage: Polyline2D.iterPt action pl

Parameters:
    action : Pt -> unit - A function that takes a point.
    pl : Polyline2D - The Polyline2D to iterate over.

Iterate over each point in the Polyline2D and perform an action.

action : Pt -> unit

A function that takes a point.

pl : Polyline2D

The Polyline2D to iterate over.

Polyline2D.iterPtSkipLast action pl

Full Usage: Polyline2D.iterPtSkipLast action pl

Parameters:
    action : Pt -> unit - A function that takes a point.
    pl : Polyline2D - The Polyline2D to iterate over.

Modifiers: inline

Iterate over each point in the Polyline2D except the last point.

action : Pt -> unit

A function that takes a point.

pl : Polyline2D

The Polyline2D to iterate over.

Polyline2D.iterSegments action pl

Full Usage: Polyline2D.iterSegments action pl

Parameters:
    action : float -> float -> float -> float -> unit - A function that takes startX, startY, endX, and endY coordinates of a segment.
    pl : Polyline2D - The Polyline2D to iterate over.

Modifiers: inline

Iterate over each segment in the Polyline2D.

action : float -> float -> float -> float -> unit

A function that takes startX, startY, endX, and endY coordinates of a segment.

pl : Polyline2D

The Polyline2D to iterate over.

Polyline2D.iterSkipLast action pl

Full Usage: Polyline2D.iterSkipLast action pl

Parameters:
    action : float -> float -> unit - A function that takes the X and Y coordinates of a point.
    pl : Polyline2D - The Polyline2D to iterate over.

Modifiers: inline

Iterate over each point in the Polyline2D except the last point.

action : float -> float -> unit

A function that takes the X and Y coordinates of a point.

pl : Polyline2D

The Polyline2D to iterate over.

Polyline2D.iteri action pl

Full Usage: Polyline2D.iteri action pl

Parameters:
    action : int -> float -> float -> unit - A function that takes the index of the X coordinate (in the flat coordinate array) and the X and Y coordinates of a point.
    pl : Polyline2D - The Polyline2D to iterate over.

Iterate over each point in the Polyline2D with index.

action : int -> float -> float -> unit

A function that takes the index of the X coordinate (in the flat coordinate array) and the X and Y coordinates of a point.

pl : Polyline2D

The Polyline2D to iterate over.

Polyline2D.iteriPt action pl

Full Usage: Polyline2D.iteriPt action pl

Parameters:
    action : int -> Pt -> unit - A function that takes the the position of the point (index/2) and the point itself.
    pl : Polyline2D - The Polyline2D to iterate over.

Iterate over each point in the Polyline2D with index and perform an action.

action : int -> Pt -> unit

A function that takes the the position of the point (index/2) and the point itself.

pl : Polyline2D

The Polyline2D to iterate over.

Polyline2D.lastPoint p

Full Usage: Polyline2D.lastPoint p

Parameters:
Returns: Pt
Modifiers: inline

Gets the last point of the Polyline2D. This is the point at index Points.Count - 1. Same as Polyline2D.End

p : Polyline2D
Returns: Pt

Polyline2D.lastSegment p

Full Usage: Polyline2D.lastSegment p

Parameters:
Returns: Line2D
Modifiers: inline

Gets the last segment of the Polyline2D.

p : Polyline2D
Returns: Line2D

Polyline2D.length p

Full Usage: Polyline2D.length p

Parameters:
Returns: float
Modifiers: inline

Gets the length of the Polyline2D. The sum of the lengths of all segments.

p : Polyline2D
Returns: float

Polyline2D.map mapping pl

Full Usage: Polyline2D.map mapping pl

Parameters:
    mapping : float -> float -> Pt - A function that takes the X and Y coordinates of a point and returns a new point.
    pl : Polyline2D - The Polyline2D to map over.

Returns: Polyline2D A new Polyline2D with the mapped points.

Apply a mapping function to each point in the Polyline2D. Returns new Polyline2D.

mapping : float -> float -> Pt

A function that takes the X and Y coordinates of a point and returns a new point.

pl : Polyline2D

The Polyline2D to map over.

Returns: Polyline2D

A new Polyline2D with the mapped points.

Polyline2D.mapPt mapping pl

Full Usage: Polyline2D.mapPt mapping pl

Parameters:
    mapping : Pt -> Pt - A function that takes a point and returns a new point.
    pl : Polyline2D - The Polyline2D to map over.

Returns: Polyline2D A new Polyline2D with the mapped points.

Apply a mapping function to each point in the Polyline2D. Returns new Polyline2D.

mapping : Pt -> Pt

A function that takes a point and returns a new point.

pl : Polyline2D

The Polyline2D to map over.

Returns: Polyline2D

A new Polyline2D with the mapped points.

Polyline2D.mapi mapping pl

Full Usage: Polyline2D.mapi mapping pl

Parameters:
    mapping : int -> float -> float -> Pt - A function that takes the index of the X coordinate (in the flat coordinate array) and the X and Y coordinates of a point and returns a new point.
    pl : Polyline2D - The Polyline2D to map over.

Returns: Polyline2D A new Polyline2D with the mapped points.

Apply a mapping function to each point in the Polyline2D with index. Returns new Polyline2D.

mapping : int -> float -> float -> Pt

A function that takes the index of the X coordinate (in the flat coordinate array) and the X and Y coordinates of a point and returns a new point.

pl : Polyline2D

The Polyline2D to map over.

Returns: Polyline2D

A new Polyline2D with the mapped points.

Polyline2D.mapiPt mapping pl

Full Usage: Polyline2D.mapiPt mapping pl

Parameters:
    mapping : int -> Pt -> Pt - A function that takes the the position of the point (index/2) and the point itself, and returns a new point.
    pl : Polyline2D - The Polyline2D to map over.

Returns: Polyline2D A new Polyline2D with the mapped points.

Apply a mapping function to each point in the Polyline2D with point position (not float index). Returns new Polyline2D.

mapping : int -> Pt -> Pt

A function that takes the the position of the point (index/2) and the point itself, and returns a new point.

pl : Polyline2D

The Polyline2D to map over.

Returns: Polyline2D

A new Polyline2D with the mapped points.

Polyline2D.move v pl

Full Usage: Polyline2D.move v pl

Parameters:
Returns: Polyline2D

Move a Polyline2D by a vector. (same as Polyline2D.translate)

v : Vc
pl : Polyline2D
Returns: Polyline2D

Polyline2D.moveX distance pl

Full Usage: Polyline2D.moveX distance pl

Parameters:
Returns: Polyline2D

Returns a Polyline2D moved by a given distance in X direction.

distance : float
pl : Polyline2D
Returns: Polyline2D

Polyline2D.moveY distance pl

Full Usage: Polyline2D.moveY distance pl

Parameters:
Returns: Polyline2D

Returns a Polyline2D moved by a given distance in Y direction.

distance : float
pl : Polyline2D
Returns: Polyline2D

Polyline2D.offset (polyLine, constantOffsetDistance, ?loop, ?checkOrientation, ?uTurnBehavior, ?useUTurnBehaviorAbove)

Full Usage: Polyline2D.offset (polyLine, constantOffsetDistance, ?loop, ?checkOrientation, ?uTurnBehavior, ?useUTurnBehaviorAbove)

Parameters:
    polyLine : Polyline2D - A 2D Polyline, open or closed.
    constantOffsetDistance : float - The offset distance for all segments of the polyline. A positive distance offset to the inside of the polyline. A negative distance offset to the outside of the polyline.
    ?loop : bool - bool, Optional (false). Set to true to explicitly consider last point and first point to be from a closed loop, even if they are not at the same location.
    ?checkOrientation : bool - bool, Optional(true). By default the algorithm always checks if the polyline is clockwise or counter clockwise. So that positive offset distances are always towards the inside of the polyline. Set this parameter to FALSE if you want to skip the orientation check. Clockwise polylines will offset to the outside, counter-clockwise polylines to the inside.
    ?uTurnBehavior : UTurn - Optional. Default value: `Offset2D.UTurn.Fail`. What to do at a 180 degree U-turn? Fail, Chamfer with two points, Use179 or Skip the point.
    ?useUTurnBehaviorAbove : MeasureProduct<cosine, MeasureOne> - Optional. Default value: `Cosine.``175.0`` `. The angle between normals after which, instead of a normal miter, the joint is chamfered by adding an extra point.

Returns: Polyline2D A new 2D polyline.

Offsets a Polyline in 2D space by finding the local offset in each corner. Auto detects if given points are from a closed Polyline (first point = last point) and loops them. By default this function raises an Exception on duplicate points, 180 degree U-Turns. But this can be configured with optional parameters.

polyLine : Polyline2D

A 2D Polyline, open or closed.

constantOffsetDistance : float

The offset distance for all segments of the polyline. A positive distance offset to the inside of the polyline. A negative distance offset to the outside of the polyline.

?loop : bool

bool, Optional (false). Set to true to explicitly consider last point and first point to be from a closed loop, even if they are not at the same location.

?checkOrientation : bool

bool, Optional(true). By default the algorithm always checks if the polyline is clockwise or counter clockwise. So that positive offset distances are always towards the inside of the polyline. Set this parameter to FALSE if you want to skip the orientation check. Clockwise polylines will offset to the outside, counter-clockwise polylines to the inside.

?uTurnBehavior : UTurn

Optional. Default value: `Offset2D.UTurn.Fail`. What to do at a 180 degree U-turn? Fail, Chamfer with two points, Use179 or Skip the point.

?useUTurnBehaviorAbove : MeasureProduct<cosine, MeasureOne>

Optional. Default value: `Cosine.``175.0`` `. The angle between normals after which, instead of a normal miter, the joint is chamfered by adding an extra point.

Returns: Polyline2D

A new 2D polyline.

Polyline2D.offset' offsetDistance pl

Full Usage: Polyline2D.offset' offsetDistance pl

Parameters:
Returns: Polyline2D
Modifiers: inline

Offsets a Polyline in 2D space by finding the local offset in each corner. Auto detects if given points are from a closed Polyline (first point = last point) and loops them. Raises an Exception on duplicate points and 180 degree U-Turns. Positive offset distances are always towards the inside of the polyline, negative offset distances to the outside.

offsetDistance : float
pl : Polyline2D
Returns: Polyline2D

Polyline2D.offsetVar (polyLine, multipleOffsetDistances, ?loop, ?checkOrientation, ?varDistParallelBehavior, ?uTurnBehavior, ?useVarDistParallelBehaviorBelow, ?useUTurnBehaviorAbove)

Full Usage: Polyline2D.offsetVar (polyLine, multipleOffsetDistances, ?loop, ?checkOrientation, ?varDistParallelBehavior, ?uTurnBehavior, ?useVarDistParallelBehaviorBelow, ?useUTurnBehaviorAbove)

Parameters:
    polyLine : Polyline2D - A 2D Polyline, open or closed.
    multipleOffsetDistances : IList<float> - The parallel offset distances for each segment of the polyline. A positive distance offsets inwards in corners, a negative offset outwards. For open and closed polylines this list of distances must have one item less than number of points in the polyline. Except if the polyline is open and the loop parameter is set to true. Then points and distances list shall have the same count.
    ?loop : bool - bool, Optional (false). Set to true to explicitly consider last point and first point to be from a closed loop, even if they are not at the same location.
    ?checkOrientation : bool - bool, Optional(true). By default the algorithm always checks if the polyline is clockwise or counter clockwise. So that positive offset distances are always towards the inside of the polyline. Set this parameter to FALSE if you want to skip the orientation check. Clockwise polylines will offset to the outside, counter-clockwise polylines to the inside.
    ?varDistParallelBehavior : VarDistParallel - Optional. Default value: `Offset2D.VarDistParallel.Fail`. What to do with colinear segments below 'useVarDistParallelBehaviorBelow' degrees when offset distances are different too.
    ?uTurnBehavior : UTurn - Optional. Default value: `Offset2D.UTurn.Fail`. What to do at a 180 degree U-turn? Fail, Chamfer with two points, Use179 or Skip the point.
    ?useVarDistParallelBehaviorBelow : MeasureProduct<cosine, MeasureOne> - Optional. Default value: `Cosine.``5.0`` `. The angle between normals below which points are considered colinear and VarDistParallelBehavior is applied if distances are not the same.
    ?useUTurnBehaviorAbove : MeasureProduct<cosine, MeasureOne> - Optional. Default value: `Cosine.``175.0`` `. The angle between normals after which, instead of a normal miter, the joint is chamfered by adding an extra point.

Returns: Polyline2D A new 2D polyline.

Offsets a Polyline in 2D space by finding the local offset in each corner. Auto detects if given points are from a closed Polyline (first point = last point) and loops them. By default this function raises an Exception on duplicate points, 180 degree U-Turns, and variable distances at colinear segments. But this can be configured with optional parameters.

polyLine : Polyline2D

A 2D Polyline, open or closed.

multipleOffsetDistances : IList<float>

The parallel offset distances for each segment of the polyline. A positive distance offsets inwards in corners, a negative offset outwards. For open and closed polylines this list of distances must have one item less than number of points in the polyline. Except if the polyline is open and the loop parameter is set to true. Then points and distances list shall have the same count.

?loop : bool

bool, Optional (false). Set to true to explicitly consider last point and first point to be from a closed loop, even if they are not at the same location.

?checkOrientation : bool

bool, Optional(true). By default the algorithm always checks if the polyline is clockwise or counter clockwise. So that positive offset distances are always towards the inside of the polyline. Set this parameter to FALSE if you want to skip the orientation check. Clockwise polylines will offset to the outside, counter-clockwise polylines to the inside.

?varDistParallelBehavior : VarDistParallel

Optional. Default value: `Offset2D.VarDistParallel.Fail`. What to do with colinear segments below 'useVarDistParallelBehaviorBelow' degrees when offset distances are different too.

?uTurnBehavior : UTurn

Optional. Default value: `Offset2D.UTurn.Fail`. What to do at a 180 degree U-turn? Fail, Chamfer with two points, Use179 or Skip the point.

?useVarDistParallelBehaviorBelow : MeasureProduct<cosine, MeasureOne>

Optional. Default value: `Cosine.``5.0`` `. The angle between normals below which points are considered colinear and VarDistParallelBehavior is applied if distances are not the same.

?useUTurnBehaviorAbove : MeasureProduct<cosine, MeasureOne>

Optional. Default value: `Cosine.``175.0`` `. The angle between normals after which, instead of a normal miter, the joint is chamfered by adding an extra point.

Returns: Polyline2D

A new 2D polyline.

Polyline2D.pointCount p

Full Usage: Polyline2D.pointCount p

Parameters:
Returns: int
Modifiers: inline

Gets the number of points in the Polyline2D.

p : Polyline2D
Returns: int

Polyline2D.removeDuplicateAndColinearPoints angleTolerance distanceTolerance pl

Full Usage: Polyline2D.removeDuplicateAndColinearPoints angleTolerance distanceTolerance pl

Parameters:
Returns: Polyline2D

Removes consecutive duplicate points and colinear points from the Polyline2D within given tolerances. This algorithm allows the last and first point to be identical if the Polyline2D is closed. Colinear points are removed when the angle between segments is smaller than the cosine threshold (e.g. cosine of 0.5 degrees ). If the Polyline2D is closed and starts and ends with colinear segments, the first point is replaced with the last non-colinear point. So the joint of the loop is now moved to the last non-colinear point. So that there are no colinear segments even between start and end. Raises an error if all points are within the distanceTolerance of the first point.

angleTolerance : float<MeasureProduct<cosine, MeasureOne>>
distanceTolerance : float
pl : Polyline2D
Returns: Polyline2D

Polyline2D.removeDuplicatePoints distanceTolerance pl

Full Usage: Polyline2D.removeDuplicatePoints distanceTolerance pl

Parameters:
    distanceTolerance : float - The distance within which points are considered duplicates.
    pl : Polyline2D - A 2D Polyline, open or closed.

Returns: Polyline2D

Removes consecutive duplicate points from the Polyline2D within a given tolerance.

From a cluster of points that are closer than the distanceTolerance, only the first point is kept. Use 'Polyline2D.removeDuplicatePointsFaithfully' if you want to keep the edges in their position by re-intersecting segments. The position of start and end point is NOT changed. Use Polyline2D.close to ensure start and end point are identical.

distanceTolerance : float

The distance within which points are considered duplicates.

pl : Polyline2D

A 2D Polyline, open or closed.

Returns: Polyline2D

Polyline2D.removeDuplicatePointsFaithfully distanceTolerance pl

Full Usage: Polyline2D.removeDuplicatePointsFaithfully distanceTolerance pl

Parameters:
    distanceTolerance : float - The distance within which points are considered duplicates.
    pl : Polyline2D - A 2D Polyline, open or closed.

Returns: Polyline2D

Removes consecutive duplicate points from the Polyline2D within a given tolerance.

This algorithm ensures to keep edges in their position by re-intersects segments if points are closer than the distanceTolerance but not identical. The position of start and end point is NOT changed. Use Polyline2D.close to ensure start and end point are identical.

distanceTolerance : float

The distance within which points are considered duplicates.

pl : Polyline2D

A 2D Polyline, open or closed.

Returns: Polyline2D

Polyline2D.removeUTurns minCos polyLine

Full Usage: Polyline2D.removeUTurns minCos polyLine

Parameters:
    minCos : float<MeasureProduct<cosine, MeasureOne>> - The angle between segments so that they are considered a U-turn. For example, for 179.9 degrees use 'Cosine.``179.9``'.
    polyLine : Polyline2D - A 2D Polyline, open or closed.

Returns: Polyline2D If no U-turns are present, the List of points of the original Polyline2D is reused and a new Polyline2D is created with that list. If U-turns are present, a new ResizeArray of points is returned with simple U-turns removed.

Removes simple sharp U-Turns from a Polyline

The Offset2D module also has a removeUTurns function that takes precomputed unit vectors and is therefore more efficient. For nested U-turns and colinear points in U-turns segments use 'removeUTurnsDeeply'. That function calls repeatedly until no more U-turns are present.

minCos : float<MeasureProduct<cosine, MeasureOne>>

The angle between segments so that they are considered a U-turn. For example, for 179.9 degrees use 'Cosine.``179.9``'.

polyLine : Polyline2D

A 2D Polyline, open or closed.

Returns: Polyline2D

If no U-turns are present, the List of points of the original Polyline2D is reused and a new Polyline2D is created with that list. If U-turns are present, a new ResizeArray of points is returned with simple U-turns removed.

Polyline2D.removeUTurnsDeeply minCos polyLine

Full Usage: Polyline2D.removeUTurnsDeeply minCos polyLine

Parameters:
    minCos : float<MeasureProduct<cosine, MeasureOne>> - The angle between segments so that they are considered a U-turn. For example, for 179.9 degrees use 'Cosine.``179.9``'.
    polyLine : Polyline2D - A 2D Polyline, open or closed.

Returns: Polyline2D If no U-turns are present, the List of points of the original Polyline2D is reused and a new Polyline2D is created with that list. If U-turns are present, a new ResizeArray of points is returned with all U-turns removed.

Removes all sharp U-Turns from a Polyline recursively until no more U-turns are present. This function calls 'removeUTurns' repeatedly until no more U-turns are present. Use this function when you have nested U-turns and colinear points in U-turns segments.

minCos : float<MeasureProduct<cosine, MeasureOne>>

The angle between segments so that they are considered a U-turn. For example, for 179.9 degrees use 'Cosine.``179.9``'.

polyLine : Polyline2D

A 2D Polyline, open or closed.

Returns: Polyline2D

If no U-turns are present, the List of points of the original Polyline2D is reused and a new Polyline2D is created with that list. If U-turns are present, a new ResizeArray of points is returned with all U-turns removed.

Polyline2D.reverse p

Full Usage: Polyline2D.reverse p

Parameters:
Returns: Polyline2D

Returns new Polyline2D in reversed Order.

p : Polyline2D
Returns: Polyline2D

Polyline2D.reverseInPlace p

Full Usage: Polyline2D.reverseInPlace p

Parameters:
Returns: Polyline2D A reference to the same Polyline2D as the input

Reverse order of the Polyline2D in place.

p : Polyline2D

The Polyline2D to reverse.

Returns: Polyline2D

A reference to the same Polyline2D as the input

Polyline2D.rotate r pl

Full Usage: Polyline2D.rotate r pl

Parameters:
Returns: Polyline2D

Rotation a Polyline2D around Z-Axis.

r : Rotation2D
pl : Polyline2D
Returns: Polyline2D

Polyline2D.rotateWithCenter cen r pl

Full Usage: Polyline2D.rotateWithCenter cen r pl

Parameters:
Returns: Polyline2D

Rotation a Polyline2D round given center point an a local Z-axis.

cen : Pt
r : Rotation2D
pl : Polyline2D
Returns: Polyline2D

Polyline2D.scale factor pl

Full Usage: Polyline2D.scale factor pl

Parameters:
Returns: Polyline2D

Scales the Polyline2D by a given factor. Scale center is World Origin 0,0 Returns a new Polyline2D.

factor : float
pl : Polyline2D
Returns: Polyline2D

Polyline2D.scaleOn cen factor pl

Full Usage: Polyline2D.scaleOn cen factor pl

Parameters:
Returns: Polyline2D
Modifiers: inline

Scales the 2D polyline by a given factor on a given center point.

cen : Pt
factor : float
pl : Polyline2D
Returns: Polyline2D

Polyline2D.secondLastPoint p

Full Usage: Polyline2D.secondLastPoint p

Parameters:
Returns: Pt
Modifiers: inline

Gets the second last point of the Polyline2D.

p : Polyline2D
Returns: Pt

Polyline2D.secondPoint p

Full Usage: Polyline2D.secondPoint p

Parameters:
Returns: Pt
Modifiers: inline

Gets the second point of the Polyline2D. This is the point at index 1.

p : Polyline2D
Returns: Pt

Polyline2D.segmentCount p

Full Usage: Polyline2D.segmentCount p

Parameters:
Returns: int
Modifiers: inline

Gets the number of segments in the Polyline2D.

p : Polyline2D
Returns: int

Polyline2D.segmentVectors p

Full Usage: Polyline2D.segmentVectors p

Parameters:
Returns: ResizeArray<Vc>
Modifiers: inline

Returns the line vectors of all segments of the Polyline2D as a list of Vc.

p : Polyline2D
Returns: ResizeArray<Vc>

Polyline2D.segmentVectorsXY p

Full Usage: Polyline2D.segmentVectorsXY p

Parameters:
Returns: ResizeArray<float>
Modifiers: inline

Returns the line vectors of all segments of the Polyline2D as a flat list of x and y components. The length of the list is 2 less than the xys count, so one less vector than points in the polyline.

p : Polyline2D
Returns: ResizeArray<float>

Polyline2D.segments p

Full Usage: Polyline2D.segments p

Parameters:
Returns: ResizeArray<Line2D>
Modifiers: inline

Returns all segments of the Polyline2D as a list of Line2D.

p : Polyline2D
Returns: ResizeArray<Line2D>

Polyline2D.setPointXY x y position p

Full Usage: Polyline2D.setPointXY x y position p

Parameters:
    x : float
    y : float
    position : int
    p : Polyline2D

Modifiers: inline

Sets the x and y coordinates of the point at the given index. NOTE: setting the first or last point on a closed Polyline2D might open it. (sets xys.[position * 2] and xys.[position * 2 + 1] internally )

x : float
y : float
position : int
p : Polyline2D

Polyline2D.setPointXYClosed x y position p

Full Usage: Polyline2D.setPointXYClosed x y position p

Parameters:
    x : float
    y : float
    position : int
    p : Polyline2D

Modifiers: inline

Sets the x and y coordinates of the point at the given index. On a closed Polyline2D, setting the first or last point will set both to the same point. Raises an error if the index is out of range. (sets xys.[position * 2] and xys.[position * 2 + 1] internally)

x : float
y : float
position : int
p : Polyline2D

Polyline2D.setPt position pt p

Full Usage: Polyline2D.setPt position pt p

Parameters:
Modifiers: inline

Sets the point at given position to the given point. ( sets xys.[position * 2] and xys.[position * 2 + 1] internally)

position : int
pt : Pt
p : Polyline2D

Polyline2D.signedArea p

Full Usage: Polyline2D.signedArea p

Parameters:
Returns: float
Modifiers: inline

Calculates the signed area of the Polyline2D . If it is positive the Polyline2D is Counter Clockwise. Polyline does not need to be exactly closed. The segment from the last point to the first point is included in the area calculation. For self intersecting Polylines the result is invalid.

p : Polyline2D
Returns: float

Polyline2D.signedDistanceTo point pl

Full Usage: Polyline2D.signedDistanceTo point pl

Parameters:
Returns: float
Modifiers: inline

Calculates the shortest distance from the test point to the polyline with `DistanceTo`, then signs that value by testing containment via the ray-casting based `Contains` helper. Returns a positive distance for points that lie inside the polyline boundary and negative otherwise. For reliable results the polyline should be closed and have identical first and last vertices.

point : Pt
pl : Polyline2D
Returns: float

Polyline2D.signedDistanceToXY x y pl

Full Usage: Polyline2D.signedDistanceToXY x y pl

Parameters:
Returns: float
Modifiers: inline

Calculates the shortest distance from the test point to the polyline with `DistanceTo`, then signs that value by testing containment via the ray-casting based `Contains` helper. Returns a positive distance for points that lie inside the polyline boundary and negative otherwise. For reliable results the polyline should be closed and have identical first and last vertices.

x : float
y : float
pl : Polyline2D
Returns: float

Polyline2D.start p

Full Usage: Polyline2D.start p

Parameters:
Returns: Pt
Modifiers: inline

Gets first point of the Polyline2D

p : Polyline2D
Returns: Pt

Polyline2D.subPolyline a b pl

Full Usage: Polyline2D.subPolyline a b pl

Parameters:
Returns: Polyline2D

Returns new Polyline2D from point at Parameter a to point at Parameter b. If 'a' is bigger than 'b' then the new Polyline2D is in opposite direction. If the start parameter is less than 1e-4 below the next integer it snaps up to that vertex. If the end parameter is less than 1e-4 above the previous integer it snaps down to that vertex. Raises an error if a parameter is outside the domain of the Polyline2D (0.0 to points.Count - 1.0).

a : float
b : float
pl : Polyline2D
Returns: Polyline2D

Polyline2D.translate v pl

Full Usage: Polyline2D.translate v pl

Parameters:
Returns: Polyline2D

Move a Polyline2D by a vector. (same as Polyline2D.move)

v : Vc
pl : Polyline2D
Returns: Polyline2D

Polyline2D.tryFind condition pl

Full Usage: Polyline2D.tryFind condition pl

Parameters:
    condition : float -> float -> bool - A function that takes the X and Y coordinates of a point and returns a boolean indicating whether the condition is satisfied.
    pl : Polyline2D - The Polyline2D to search through.

Returns: Pt option Some(Pt) if a point satisfying the condition is found, otherwise None.
Modifiers: inline

Find the first point in the Polyline2D that satisfies a given condition. Returns Some(point) if found, otherwise None.

condition : float -> float -> bool

A function that takes the X and Y coordinates of a point and returns a boolean indicating whether the condition is satisfied.

pl : Polyline2D

The Polyline2D to search through.

Returns: Pt option

Some(Pt) if a point satisfying the condition is found, otherwise None.

Polyline2D.tryFindIndex condition pl

Full Usage: Polyline2D.tryFindIndex condition pl

Parameters:
    condition : float -> float -> bool - A function that takes the X and Y coordinates of a point and returns a boolean indicating whether the condition is satisfied.
    pl : Polyline2D - The Polyline2D to search through.

Returns: int option Some(index of x) the index of the x value in the polylines flat array if found, otherwise None.
Modifiers: inline

Find the index of the first point in the Polyline2D that satisfies a given condition. Returns Some(index) if found, otherwise None.

condition : float -> float -> bool

A function that takes the X and Y coordinates of a point and returns a boolean indicating whether the condition is satisfied.

pl : Polyline2D

The Polyline2D to search through.

Returns: int option

Some(index of x) the index of the x value in the polylines flat array if found, otherwise None.

Polyline2D.tryFindLast condition pl

Full Usage: Polyline2D.tryFindLast condition pl

Parameters:
    condition : float -> float -> bool - A function that takes the X and Y coordinates of a point and returns a boolean indicating whether the condition is satisfied.
    pl : Polyline2D - The Polyline2D to search through.

Returns: Pt option Some(Pt) if a point satisfying the condition is found, otherwise None.
Modifiers: inline

Find the last point in the Polyline2D that satisfies a given condition. Returns Some(point) if found, otherwise None.

condition : float -> float -> bool

A function that takes the X and Y coordinates of a point and returns a boolean indicating whether the condition is satisfied.

pl : Polyline2D

The Polyline2D to search through.

Returns: Pt option

Some(Pt) if a point satisfying the condition is found, otherwise None.

Polyline2D.tryFindLastIndex condition pl

Full Usage: Polyline2D.tryFindLastIndex condition pl

Parameters:
    condition : float -> float -> bool - A function that takes the X and Y coordinates of a point and returns a boolean indicating whether the condition is satisfied.
    pl : Polyline2D - The Polyline2D to search through.

Returns: int option Some(index of x) the index of the x value in the polylines flat array if found, otherwise None.
Modifiers: inline

Find the index of the last point in the Polyline2D that satisfies a given condition. Returns Some(index) if found, otherwise None.

condition : float -> float -> bool

A function that takes the X and Y coordinates of a point and returns a boolean indicating whether the condition is satisfied.

pl : Polyline2D

The Polyline2D to search through.

Returns: int option

Some(index of x) the index of the x value in the polylines flat array if found, otherwise None.

Polyline2D.tryFindSelfIntersection pl

Full Usage: Polyline2D.tryFindSelfIntersection pl

Parameters:
Returns: Option<Pt * int * int>

Tries to find a self intersection in Polyline2D. This function is optimized for polylines with fewer than 50 points. A closed Polyline2D, is not reported as a self intersection. Also returns Some if two non-adjacent segments are just touching. If found returns the first intersection point and the indices of the two segments that intersect. If no intersection is found returns None. Returns None for Polylines with fewer than 3 points (less than two segments). This is an iterative O(n^2) algorithm For larger polylines with more than 50 points, tryFindSelfIntersectionWithBRect is faster on .NET, but never on Fable JS.

pl : Polyline2D
Returns: Option<Pt * int * int>

Polyline2D.tryFindSelfIntersectionWithBRect pl

Full Usage: Polyline2D.tryFindSelfIntersectionWithBRect pl

Parameters:
Returns: Option<Pt * int * int>

Tries to find a self intersection in Polyline2D. This function is the same as tryFindSelfIntersection but with an initial broad phase using bounding rectangles to quickly exclude non-intersecting segments. It runs faster than tryFindSelfIntersection for polylines with more than 50 points, but only on .NET, not on Fable JS. A closed Polyline2D, is not reported as a self intersection. Also returns Some if two non-adjacent segments are just touching. If found returns the first intersection point and the indices of the two segments that intersect. If no intersection is found returns None. Returns None for Polylines with fewer than 3 points (less than two segments). This is an iterative O(n^2) algorithm This function is optimized for polylines with more than 50 points.

pl : Polyline2D
Returns: Option<Pt * int * int>

Polyline2D.windingNumber point pl

Full Usage: Polyline2D.windingNumber point pl

Parameters:
    point : Pt - The point to test.
    pl : Polyline2D - The closed Polyline2D.

Returns: int The winding number. Zero means outside, non-zero means inside.
Modifiers: inline

Count how many times the polygon winds around the point. If the result is 0 then the point is outside of the Polyline2D. A non-zero value indicates the point is inside.

The first and last point of the Polyline2D need to be identical for correct results. Boundary cases: Points exactly on edges or vertices may return inconsistent results due to floating-point precision. For points on horizontal edges, behavior depends on the edge direction. This method Handles self-intersecting polygons more intuitively than the pl.Contains method.

point : Pt

The point to test.

pl : Polyline2D

The closed Polyline2D.

Returns: int

The winding number. Zero means outside, non-zero means inside.

Type something to start searching.