R/computeIntersectionOfLines.R

Defines functions computeIntersectionOfLines

Documented in computeIntersectionOfLines

#' Compute the coordinates of the intersection of two lines
#' 
#' @param m1 A numeric of the slope of the first line.
#' @param b1 A numeric of the intercept of the first line.
#' @param m2 A numeric of the slope of the second line.
#' @param b2 A numeric of the intercept of the second line.
#' @return A vector of coordinates where the two lines intersect. 
#' @export

computeIntersectionOfLines <- function(m1,b1,m2,b2){
  x <- (b2-b1) / (m1-m2)
  y <- x*m1 + b1
  o <- c(x,y)
  names(o) <- c("x", "y")
  return(o)
}
# t
msxakk89/dat documentation built on Aug. 3, 2020, 6:39 p.m.