| patchDistDir | R Documentation |
Patches at given distances and directionsReport the coordinates of the patches at the given
distances and directions from the agents.
patchDistDir(world, agents, dist, angle, torus = FALSE)
## S4 method for signature 'worldNLR,matrix,numeric,numeric'
patchDistDir(world, agents, dist, angle, torus = FALSE)
world |
|
agents |
Matrix ( `AgentMatrix` object representing the moving `agents`. |
dist |
Numeric. Vector of distances from the |
angle |
Numeric. Absolute directions from the |
torus |
Logical to determine if the |
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()`.
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.
Sarah Bauduin
Wilensky, U. 1999. NetLogo. https://www.netlogo.org. Center for Connected Learning and Computer-Based Modeling, Northwestern University. Evanston, IL.
https://docs.netlogo.org/dictionary.html#patch-at-heading-and-distance
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.