util.distPointLineSeg: distPointLineSeg calculates the distance between a point and...

View source: R/utils.R

util.distPointLineSegR Documentation

distPointLineSeg calculates the distance between a point and a line segment defined by two points

Description

The function projects the point onto the line and returns the perpendicular distance between the point and the line if the projection fall within the line segment. If the projection falls outside the line segments it returns the closest distance between the point and the closest end segment point

Usage

util.distPointLineSeg(xp, yp, x1, y1, x2, y2)

Arguments

xp

the x coordinate of the point

yp

the y coordinate of the point

x1

the x coordinate of the end point of the line

y1

the y coordinate of the end point of the line

x2

the x coordinate of the other end point of the line

y2

the y coordinate of the other end point of the line

Value

the closest distance between the point and the line segment


UCD-GW-Nitrate/gwtools documentation built on April 5, 2025, 5:01 p.m.