Skip to contents

Compute distance between point given as (px, py) and line spanned by points (lx1, ly1) and (lx2, ly2). From http://mathworld.wolfram.com/Point-LineDistance2-Dimensional.html

Usage

point_line_dist(px, py, lx_1, ly_1, lx_2, ly_2)

Arguments

px

x coordinate of point outside the

py

y coordinate of point

lx_1,

x coordinate of 1st point spanning a line

ly_1,

y coordinate of 1st point spanning a line

lx_2,

x coordinate of 2nd point spanning a line

ly_2,

y coordinate of 2nd point spanning a line