`patchAt.Rd`

Report the coordinates of the patches at `(dx, dy)`

distances of the `agents`

.

patchAt(world, agents, dx, dy, torus = FALSE) # S4 method for worldNLR,matrix,numeric,numeric patchAt(world, agents, dx, dy, torus = FALSE)

world | WorldMatrix or worldArray object. |
---|---|

agents | Matrix (ncol = 2) with the first column "pxcor" and the second column "pycor" representing the patches coordinates, or AgentMatrix object representing the moving agents. |

dx | Numeric. Vector of distances to the east (right) from the |

dy | Numeric. Vector of distances to the north (up) from the |

torus | Logical to determine if the |

Matrix (ncol = 2) with the first column "pxcor" and the second column
"pycor" representing the coordinates of the patches at `(dx, dy)`

distances of the `agents`

. The order of the patches follows the order
of the `agents`

.

If the patch at distance `(dx, dy)`

of an agent is outside of the `world`

's extent and `torus = FALSE`

,
`NA`

are returned
for the patch coordinates;
if `torus = TRUE`

, the patch coordinates from a wrapped `world`

are
returned.

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

https://ccl.northwestern.edu/netlogo/docs/dictionary.html#patch-at

https://ccl.northwestern.edu/netlogo/docs/dictionary.html#at-points

w1 <- createWorld(minPxcor = 0, maxPxcor = 9, minPycor = 0, maxPycor = 9) patchCorner <- patchAt(world = w1, agents = patch(w1, 0, 0), dx = 1, dy = 1) t1 <- createTurtles(n = 1, coords = cbind(xcor = 0, ycor = 0)) patchCorner <- patchAt(world = w1, agents = t1, dx = 1, dy = 1)