Report the `agents`

within the "cone of vision" in front of each one of the
`turtles`

.

inCone(turtles, radius, angle, agents, world, torus = FALSE) # S4 method for agentMatrix,numeric,numeric,matrix inCone(turtles, radius, angle, agents, world, torus = FALSE)

turtles | AgentMatrix object representing the moving agents. |
---|---|

radius | Numeric. Vector of distances from |

angle | Numeric. Vector of angles to define the size of the cone of vision
for the |

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. |

world | WorldMatrix or worldArray object. |

torus | Logical to determine if the |

Matrix (ncol = 3) with the first column "pxcor"
and the second column "pycor" representing the coordinates of the
patches among `agents2`

within the cone of vision of each of the
`turtles`

which are reprensented by the "id" column, if
`agents`

are patches, or

Matrix (ncol = 2) with the first column "who"
representing the "who" numbers of the
turtles among `agents2`

within the cone of vision of each of the
`turtles`

which are reprensented by the "id" column, if
`agents`

are turtles.

`agents`

are reported if there are within `radius`

distance of the turtle and their direction from the turtle is within
`[-angle, + angle]`

of the turtle's heading.

Distances to patches are calculated to their center.

If `torus = FALSE`

, `world`

does not need to be provided.

If `torus = TRUE`

, the `radius`

distances are calculated
around the sides of the `world`

to select `agents`

.

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#in-cone

w1 <- createWorld(minPxcor = 0, maxPxcor = 4, minPycor = 0, maxPycor = 4) t1 <- createTurtles(n = 10, coords = randomXYcor(w1, n = 10)) p1 <- inCone(turtles = t1, radius = 2, agents = patches(w1), angle = 90) t2 <- inCone(turtles = turtle(t1, who = 0), radius = 2, angle = 90, agents = t1)