API Docs for: 0.3
Show:

Group Class

Extends Entity
Module: Group
Parent Module: Entities

Group Entity where agents belong.

Constructor

Group

(
  • group
)

Parameters:

Methods

addAgent

(
  • agent
)

Adds a single agent to the group.

Parameters:

addAgents

(
  • agentsCount
)

Add agents to the group.

Parameters:

  • agentsCount Number

    the number of agents

addEntity

(
  • joint
)

Description

Parameters:

Returns:

assignBehavior

(
  • behavior
)

Assign a behavior model to the group.

Parameters:

assignEndContext

(
  • context
)

Sets the end context where agents are destroyed.

Parameters:

assignPath

(
  • path
  • idx
)

Assign a path to the group and its agents.

Parameters:

assignStartContext

(
  • context
)

Sets the start context where agents are created

Parameters:

calcNewId

(
  • id
)

Description

Parameters:

Returns:

CallExpression

CreateFromModel

(
  • group
)
Render.Group

Create a group render view from a group entity.

Parameters:

Returns:

Render.Group:

CreateFromPoint

(
  • x
  • y
  • parent
  • options
)
Render.Group

Create a group render and entity in a point.

Parameters:

Returns:

Render.Group:

createGraphics

(
  • group
)

Inherited from Entity but overwritten in src\app\Render\Group.js:60

Create base graphics for group.

Parameters:

destroy

()

Inherited from Entity but overwritten in src\app\Render\Group.js:50

Destroy render group.

destroy

()

Destroy the Group

destroyGraphics

(
  • container
  • graphics
)

Destroy base graphics.

Parameters:

  • container Pixi.Container
  • graphics Pixi.Graphics

dragTo

(
  • pos
  • anchor
)

Drag action in groups.

Parameters:

  • pos Vec2
  • anchor Vec2

emptyAgents

()

Removes all agents from the group.

generateAgents

(
  • agentsCount
  • startContext
)

Generate a number of agents in a context. Used internally by the group.

Parameters:

Returns:

newAgents

getAnchor

() Vec2

Get render group anchor.

Returns:

Vec2:

anchor

getArea

() Array

Gets the smaller rectangle area that contains the group agents

Returns:

Array:

array of two {Vec2} [[Xmin,Xmax][Ymin,YMax]]

getEndContext

() Context

Gets the start context where agents are created

Returns:

Context:

end context

getGroup

() Group

Get associated group entity.

Returns:

getPath

() Array

Gets the path asigned to the group that agents will follow.

Returns:

Array:

paths

getPathStartIdx

() Number

Gets the start index of the agents in the group path.

Returns:

Number:

start index

getPos

() Vec2

Inherited from Entity but overwritten in src\app\Render\Group.js:154

Get group position.

Returns:

Vec2:

position

getRadius

() Number

Get radius

Returns:

Number:

radius

getStartContext

() Context

Gets the end context where agents are destoyed optionally.

Returns:

Context:

end context

in

(
  • pos
)
Boolean

Check if am agent is within a group area.

Parameters:

  • pos Vec2

Returns:

Boolean:

true if inside; false otherwise

incrRadius

(
  • dr
)

Increment radius by dr.

Parameters:

isPathCircular

() Boolean

Gets the flag pathCircular from options.

Returns:

Boolean:

true if path is circular

isPathReverse

() Boolean

Gets the flag pathReverse from options.

Returns:

Boolean:

true if path is reversed

myContextPos

() Vec2

Generates a position within the group start context.

Returns:

Vec2:

point

myInitPos

(
  • pos
)
Vec2

Generates a random init position in the group radius centered at pos.

Parameters:

  • pos Vec2

    center position

Returns:

Vec2:

point

removeAgents

(
  • agents
)

Remove the given agents from the group.

Parameters:

removeEntity

(
  • joint
)

Description

Parameters:

Returns:

render

(
  • options
)

Inherited from Entity but overwritten in src\app\Render\Group.js:76

Animate group, update position and radius.

Parameters:

Returns:

setInteractive

(
  • displayObject
)

Set render entity as interactive.

Parameters:

  • displayObject Pixi.DisplayObject

setRadius

(
  • radius
)

Set radius

Parameters:

step

()

Advances the simulation of the group by creating/destroying agents in its contexts.

unAssign

(
  • entity
)

Unassing a start, end contexts or a path from the group.

Parameters:

  • entity Entity

    , context or path.

updatePos

(
  • x
  • y
)

Description

Parameters:

Returns: