intersectingPoint {swfscMisc}R Documentation

Intersecting Point

Description

Calculates the perpendicular point and distance to a line for a series of points.

Usage

intersectingPoint(pts, p1 = NULL, p2 = NULL, intercept = NULL, slope = NULL)

Arguments

pts

two element vector or two column matrix of x and y values of points.

p1, p2

two element vectors of two points laying on line.

intercept, slope

the intercept and slope of the line.

Value

A matrix containing columns giving the x and y values of the intersecting point on the line, and the distance to each point.

Note

The line can be specified by providing either p1 and p2 or intercept and slope. If intercept and slope are specified, then p1 and p2 will be ignored.

Author(s)

Eric Archer eric.archer@noaa.gov

Examples


pts <- cbind(x = runif(5, 0, 10), y = runif(5, 0, 10))

intersectingPoint(pts, p1 = c(-1, -1), p2 = c(60, 60))

intersectingPoint(pts, intercept = 0, slope = 1)


[Package swfscMisc version 1.6.5 Index]