Calculate minimum distance from point to line segment
Uses parametric line representation and projection to find closest point. For degenerate segments (length < EPSILON_GEOMETRY), returns distance to endpoint.
@param px, py Point coordinates @param x1, y1 Line segment start point @param x2, y2 Line segment end point @return distance Minimum euclidean distance from point to segment
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in) | :: | px | |||
real(kind=wp), | intent(in) | :: | py | |||
real(kind=wp), | intent(in) | :: | x1 | |||
real(kind=wp), | intent(in) | :: | y1 | |||
real(kind=wp), | intent(in) | :: | x2 | |||
real(kind=wp), | intent(in) | :: | y2 |