Report the coordinates of the patches at the given
distances and directions from the agents.
patchDistDir(world, agents, dist, angle, torus = FALSE)
# S4 method for worldNLR,matrix,numeric,numeric
patchDistDir(world, agents, dist, angle, torus = FALSE)WorldMatrix or worldArray object.
Matrix (ncol = 2) with the first column pxcor and the second
column pycor representing the patches coordinates, or
Numeric. Vector of distances from the agents. Must be
of length 1 or of the same length as the number of agents.
Numeric. Absolute directions from the agents. angle
must be of length 1 or of the same length as the number of
agents. Angles are in degrees with 0 being North.
Logical to determine if the world is wrapped. Default is
torus = FALSE.
Matrix (ncol = 2) with the first column pxcor and the second column
pycor representing the coordinates of the patches at the distances
dist and directions angle of agents.
The order of the patches follows the order of the agents.
If torus = FALSE and the patch at distance dist and
direction angle of an agent 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.
Wilensky, U. 1999. NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern University. Evanston, IL.
w1 <- createWorld(minPxcor = 0, maxPxcor = 9, minPycor = 0, maxPycor = 9)
p1 <- patchDistDir(world = w1, agents = patch(w1, 0, 0), dist = 1, angle = 45)
t1 <- createTurtles(n = 1, coords = cbind(xcor = 0, ycor = 0), heading = 315)
p2 <- patchDistDir(world = w1, agents = t1, dist = 1, angle = 45)