Namespaces

Types in MathNet.Spatial.Euclidean

Type PolyLine2D

Namespace MathNet.Spatial.Euclidean

Interfaces IEnumerable<Point2D>, IEquatable<PolyLine2D>

The PolyLine2D class represents a 2D curve in space made up of line segments joined end-to-end, and is stored as a sequential list of 2D points.

Constructors

Static Functions

Methods

Properties

Public Constructors

PolyLine2D(IEnumerable<Point2D> points)

Initializes a new instance of the PolyLine2D class. Creates a PolyLine2D from a pre-existing IEnumerable of Point2Ds
Parameters
IEnumerable<Point2D> points

A list of points.

Public Static Functions

PolyLine2D ReduceComplexity(IEnumerable<Point2D> points, double singleStepTolerance)

Reduce the complexity of a manifold of points represented as an IEnumerable of Point2D objects by iteratively removing all nonadjacent points which would each result in an error of less than the single step tolerance if removed. Iterate until no further changes are made.
Parameters
IEnumerable<Point2D> points

A list of points.

double singleStepTolerance

The tolerance (epsilon) for comparing sameness of line segments

Return
PolyLine2D

A new PolyLine2D with same segments merged.

Public Methods

Point2D ClosestPointTo(Point2D p)

Returns the closest point on the polyline to the given point.
Parameters
Point2D p

a point

Return
Point2D

A point which is the closest to the given point but still on the line.

bool Equals(PolyLine2D other, double tolerance)

Returns a value to indicate if a pair of polylines are equal
Parameters
PolyLine2D other

The polyline to compare against.

double tolerance

A tolerance (epsilon) to adjust for floating point error

Return
bool

true if the polylines are equal; otherwise false

bool Equals(PolyLine2D other)

bool Equals(object obj)

IEnumerator<Point2D> GetEnumerator()

Obsolete: Use Vertices instead, obsolete since 2018-01-12

int GetHashCode()

Point2D GetPointAtFractionAlongCurve(double fraction)

Get the point at a fractional distance along the curve. For instance, fraction=0.5 will return the point halfway along the length of the polyline.
Parameters
double fraction

The fractional length at which to compute the point

Return
Point2D

A point a fraction of the way along the line.

Point2D GetPointAtLengthFromStart(double lengthFromStart)

Get the point at a specified distance along the curve. A negative argument will return the first point, an argument greater than the length of the curve will return the last point.
Parameters
double lengthFromStart

The distance from the first point along the curve at which to return a point

Return
Point2D

A point which is the specified distance along the line

Type GetType()

string ToString()

Public Properties

int Count get;

Gets the number of points in the polyline
Obsolete: Use VertexCount instead, obsolete since 2018-01-12

Point2D Item get;

Returns a point in the polyline by index number
Obsolete: Use Vertices instead, obsolete since 2018-01-12

double Length get;

Gets the length of the polyline as the sum of the length of the individual segments

int VertexCount get;

Gets the number of vertices in the polyline.

IEnumerable<Point2D> Vertices get;

Gets a list of vertices