GoDigram for .NET Framework and .NET Core
Northwoods.Go Namespace / GoStroke Class / NearestPointOnLine Method
One end of the line.
The other end of the line.
The point to be closest to.
A PointF that is on the finite length straight line segment from a to b
In This Topic
    NearestPointOnLine Method
    In This Topic
    Return a point on a straight line segment that is closest to a given point.
    Syntax
    public static bool NearestPointOnLine( 
       PointF a,
       PointF b,
       PointF p,
       out PointF result
    )

    Parameters

    a
    One end of the line.
    b
    The other end of the line.
    p
    The point to be closest to.
    result
    A PointF that is on the finite length straight line segment from a to b

    Return Value

    true if the point p is on a perpendicular line to the line segment; false if the point p is beyond either end of the line segment. When this returns false, the result will be either a or b.
    See Also