Crs.NearestPointOnLine2d Methods
Returns the point on the given line that is nearest the given point.
Overload List
Name | Description | |
---|---|---|
Public method | NearestPointOnLine2d(PointCollection line, LineType lineType, System.Boolean lineClosed, Point point) | Returns the point on the given line that is nearest the given point. |
Public method | NearestPointOnLine2d(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
public Point NearestPointOnLine2d (
PointCollection line,
LineType lineType,
System.Boolean lineClosed,
Point point
)
Parameters
A given line as a collection of points.
The kind of line line is.
Whether there is a line segment from the last point back to the first.
A given point.
Return Value
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
public Point NearestPointOnLine2d (
IEnumerable< Point > line,
LineType lineType,
System.Boolean lineClosed,
Point point
)
Parameters
A given line as a collection of points.
The kind of line line is.
Whether there is a line segment from the last point back to the first.
A given point.
Return Value
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