crossing.point {swfscMisc} | R Documentation |
Return point where two lines cross
crossing.point(l1, l2)
l1 , l2 |
matrices representing two lines, where first two columns are x and y values respectively |
a data.frame of x and y values of points where lines cross
Eric Archer eric.archer@noaa.gov
x <- 1:100
line1 <- cbind(x, 3 + 3 * x)
line2 <- cbind(x, 10 - 3 * x)
plot(line1[, 1], line1[, 2], type = "l", col = "red")
lines(line2[, 1], line2[, 2], col = "blue")
cr.pt <- crossing.point(line1, line2)
print(cr.pt)