← Back to carmenta.com
Carmenta Engine SDK Documentation
×

Crs.NearestPointOnLine2d Methods

Returns the point on the given line that is nearest the given point.

Thread safety: This method is thread-safe.

Overload List

 NameDescription
Public methodNearestPointOnLine2d(PointCollection line, LineType lineType, System.Boolean lineClosed, Point point)Returns the point on the given line that is nearest the given point.
Public methodNearestPointOnLine2d(IEnumerable< Point > line, LineType lineType, System.Boolean lineClosed, Point point)Returns the point of the given line that is nearest the given point.

NearestPointOnLine2d(PointCollection line, LineType lineType, System.Boolean lineClosed, Point point)

Returns the point on the given line that is nearest the given point.

Syntax

C#
public Point NearestPointOnLine2d (
    PointCollection line,
    LineType lineType,
    System.Boolean lineClosed,
    Point point
)

Parameters

line
Type: A collection of Point elements.
A given line as a collection of points.
lineType
Type: LineType
The kind of line line is.
lineClosed
Type: System.Boolean
Whether there is a line segment from the last point back to the first.
point
Type: Point
A given point.

Return Value

Type: Point
The point on the given line that is nearest the given point.

Remarks

The method returns the point on the given line that is nearest the given point. The line may contain any number of points, and its segments may be rhumb lines or great-circle segments (the lines types RhumbLine and GreatCircle are supported, but not GreatCircleApprox).

"Nearest" refers to horizontal great-circle distance on the ellipsoid surface: the z values of the given point and line are ignored. The z value of the returned point does not mean altitude; instead, its integer part tells on which line segment the nearest point is, and its fractional part tells how far along that segment the nearest point is. Example: if the z value is 1.5, then the nearest point is halfway between vertex 1 and 2 of the line (the vertices are numbered 0, 1, 2, ...).

Accuracy

If the Projection is a NonGeoreferencedProjection, then the computation is done in the plane, with unknown accuracy. Otherwise, the point and line are unprojected to LongLat, then the nearest point is computed on the ellipsoid surface, and it is finally projected and returned. Disregarding the errors that may be caused by unproject and project, the nearest point is found with submillimeter accuracy.

NearestPointOnLine2d(IEnumerable< Point > line, LineType lineType, System.Boolean lineClosed, Point point)

Returns the point of the given line that is nearest the given point.

Syntax

C#
public Point NearestPointOnLine2d (
    IEnumerable< Point > line,
    LineType lineType,
    System.Boolean lineClosed,
    Point point
)

Parameters

line
Type: A collection of Point elements.
A given line as a collection of points.
lineType
Type: LineType
The kind of line line is.
lineClosed
Type: System.Boolean
Whether there is a line segment from the last point back to the first.
point
Type: Point
A given point.

Return Value

Type: Point
The point on the given line that is nearest the given point.

Remarks

The method returns the point on the given line that is nearest the given point. The line may contain any number of points, and its segments may be rhumb lines or great-circle segments (the lines types RhumbLine and GreatCircle are supported, but not GreatCircleApprox).

"Nearest" refers to horizontal great-circle distance on the ellipsoid surface: the z values of the given point and line are ignored. The z value of the returned point does not mean altitude; instead, its integer part tells on which line segment the nearest point is, and its fractional part tells how far along that segment the nearest point is. Example: if the z value is 1.5, then the nearest point is halfway between vertex 1 and 2 of the line (the vertices are numbered 0, 1, 2, ...).

Accuracy

If the Projection is a NonGeoreferencedProjection, then the computation is done in the plane, with unknown accuracy. Otherwise, the point and line are unprojected to LongLat, then the nearest point is computed on the ellipsoid surface, and it is finally projected and returned. Disregarding the errors that may be caused by unproject and project, the nearest point is found with submillimeter accuracy.

Platforms

Windows, Linux, Android

See Also

Reference

Crs Class
Core Module

By accessing the information on this site you accept our terms and conditions and privacy policy.
This site uses cookies to enhance your experience and provide additional functionality.

Accept