swfscMisc (version 1.3)

crossing.point: Crossing Point

Description

Return point where two lines cross

Usage

crossing.point(l1, l2)

Arguments

l1, l2

matrices representing two lines, where first two columns are x and y values respectively

Value

a data.frame of x and y values of points where lines cross

Examples

Run this code
# NOT RUN {
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)

# }

Run the code above in your browser using DataLab