AgentList

Geometry methods for patches, turtles, and other AgentArrays Return all agents within rect, radius, cone from given agent. If meToo, include given object, default excludes it Typically the AgentArray is a subset of larger sets, reducing the size, then uses these inRect, inRadius or inCone methods

Constructor

new AgentList(model, …args)

Parameters:
NameTypeAttributesDescription
modelModel

The Model this AgentList belongs to

argsany<repeatable>

The arguments passed to super

Methods

inRect(agent, dx, dy, meToo)

Return all agents within rectangle from given agent. dx & dy are (float) half width/height of rect

Parameters:
NameTypeDefaultDescription
agentAgent
dxnumber
dynumber
meToobooleanfalse
Returns:

An AgentList of agents within the rect. Include agent if metoo

inRadius(agent, radius, meToo)

Return all agents in AgentArray within radius from given agent.

Parameters:
NameTypeDefaultDescription
agentAgent
radiusnumber
meToobooleanfalse
Returns:

An AgentList of agents within the radius. Include agent if metoo

inCone(agent, radius, coneAngle, heading, meToo)

As above, but also limited to the angle coneAngle around an angle from object agent. coneAngle and direction in radians.

Parameters:
NameTypeDefaultDescription
agentAgent
radiusnumber
coneAnglenumber
headingnumber
meToobooleanfalse
Returns:

An AgentList of agents within the angle. Include agent if metoo