R: Point to line distance

pline {GEOmap} | R Documentation

## Point to line distance

### Description

get sortest distance from arbitrary point to a segment.

### Usage

    pline(x1, y1, x2, y2, ex, ey)

### Arguments

`x1` | x coordinate segment start
`y1` | y coordinate segment start
`x2` | x coordinate segment end
`y2` | y coordinate segment end
`ex` | x, point
`ey` | y point

### Value

vector of:

`dis` | distance to segment
`dee` | distance to line
`zee` | projection along line
`px` | x, point of intersection
`py` | y, point of intersection

### Author(s)

Jonathan M. Lees<jonathan.lees@unc.edu>

### See Also

polyintern

### Examples

    L=list()
    L$x=c(-0.161416832868, 0.484046270443,-0.472622257679)
    L$y=c(-0.735779816514, 0.306422018349, 0.192660550459)

    P = pline(L$x[1], L$y[1], L$x[2], L$y[2], L$x[3], L$y[3])

    plot(L$x, L$y, type='n', asp=1)
    segments(L$x[1], L$y[1], L$x[2], L$y[2])
    points( L$x[3], L$y[3])

    segments(L$x[3], L$y[3], P[4], P[5], col='red')

[Package GEOmap version 2.4-0 Index]