R/randomMove.R

Defines functions randomMove

Documented in randomMove

#' The function randomly selects an angle (0:360) and moves the lobster. This is called when a lobster
#' is outside the area of influence.
#' @param xLobster current x coordinate of the lobster
#' @param yLobster current y coordinate of the lobster
#' @param  dStep   fixed length of movemnet in each timestep 
#' @export

randomMove<- function(xLobster, yLobster, dStep){
  
  randomAngle<- runif(n=1, min = 0, max=360) 
  xNew<- dStep * cos(randomAngle * pi / 180) + xLobster 
  yNew<- dStep * sin(randomAngle * pi / 180) + yLobster
  
  return( list(EASTING = xNew, NORTHING = yNew) )
}
vpourfaraj/lobsterCatch0.1 documentation built on Feb. 25, 2021, 2:56 p.m.