R/compute_midpoint_between_twoPoints_onLinePassingThroughThem.R

Defines functions compute_midpoint_between_twoPoints_onLinePassingThroughThem

Documented in compute_midpoint_between_twoPoints_onLinePassingThroughThem

#' Compute a midpoint coordinates between two points on line passing through them
#' 
#' @param point1_coord A vector of point 1 coordinate, where point1_coord[1] is the X-axis coordinate while point1_coord[2] is the Y-axis coordinate.
#' @param point2_coord A vector of point 2 coordinate, where point1_coord[1] is the X-axis coordinate while point1_coord[2] is the Y-axis coordinate.
#' @export

compute_midpoint_between_twoPoints_onLinePassingThroughThem <- function(point1_coord=c(0,0),point2_coord=c(1,1)){
  x <- (point2_coord[1] - point1_coord[1])/2 + point1_coord[1]
  y <- (point2_coord[2] - point1_coord[2])/2 + point1_coord[2]
  return(c(x=x,y=y))
}
msxakk89/dat documentation built on Aug. 3, 2020, 6:39 p.m.