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)

## Arguments

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.

dist

Numeric. Vector of distances from the agents. Must be of length 1 or of the same length as the number of agents.

angle

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.

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 directions angle of agents. The order of the patches follows the order of the agents.

## Details

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.

If agents are turtles, their headings are not taken into account; the given directions angle are used. To find a patch at certain distance from a turtle using the turtle's heading, look at pacthAhead(), patchLeft() or patchRight().

Sarah Bauduin

## Examples

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)