distancePointSegment: Compute the distance of a point from a line segment
Description
compute the distance of a point from a line segment given the
x, y axes of the points.
Usage
distancePointSegment(px, py, x1, y1, x2, y2)
Arguments
px
A numeric vector, x axis of the points
py
A numeric vector, y axis of the points
x1
A number, x axis of the end point of the line segment
y1
A number, y axis of the end point of the line segment
x2
A number, x axis of the other end point of the line segment
y2
A number, y axis of the other end point of the line segment
Value
numeric vector, the length between the pointS and the line segment. If the
intersection point is outside the line segment, return the distance to the nearest
endpoint.