Report the coordinates of the patches at the given distances of the turtles in the direction of their headings.

patchAhead(world, turtles, dist, torus = FALSE)

# S4 method for worldNLR,agentMatrix,numeric
patchAhead(world, turtles, dist, torus = FALSE)

## Arguments

world

WorldMatrix or worldArray object.

turtles

AgentMatrix object representing the moving agents.

dist

Numeric. Vector of distances from the turtles. dist must be of length 1 or of length turtles.

torus

Logical to determine if the world is wrapped. Default is torus = FALSE.

## Value

Matrix (ncol = 2) with the first column pxcor and the second column pycor representing the coordinates of the patches at the distances dist and turtles's headings directions of turtles. The order of the patches follows the order of the turtles.

## Details

If torus = FALSE and the patch at distance dist of a turtle is outside the world's extent, NA are returned for the patch coordinates. If torus = TRUE, the patch coordinates from a wrapped world are returned.

## References

Wilensky, U. 1999. NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern University. Evanston, IL.

Sarah Bauduin

## Examples

w1 <- createWorld(minPxcor = 0, maxPxcor = 9, minPycor = 0, maxPycor = 9)
t1 <- createTurtles(n = 10, coords = randomXYcor(w1, n = 10))
patchAhead(world = w1, turtles = t1, dist = 1)
#>       pxcor pycor
#>  [1,]     1     9
#>  [2,]     9     4
#>  [3,]     8     0
#>  [4,]    NA    NA
#>  [5,]     5     7
#>  [6,]     2     5
#>  [7,]     8     4
#>  [8,]     2     5
#>  [9,]     6     3
#> [10,]     7     2