Learn R Programming

swfscMisc (version 1.6.5)

intersectingPoint: 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)

Value

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

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.

Author

Eric Archer eric.archer@noaa.gov

Examples

Run this code

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)

Run the code above in your browser using DataLab