View source: R/intersectingPoint.R
| intersectingPoint | R Documentation |
Calculates the perpendicular point and distance to a line for a series of points.
intersectingPoint(pts, p1 = NULL, p2 = NULL, intercept = NULL, slope = NULL)
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. |
A matrix containing columns giving the x and y values of the intersecting point on the line, and the distance to each point.
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.
Eric Archer eric.archer@noaa.gov
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.