IslandManager Class
Splits the system of bodies and equations into independent islands
Constructor
IslandManager
-
[options]
Parameters:
-
[options]Object optional
Item Index
Methods
Properties
Methods
addEquations
-
eqs
Add equations. Same as .addEquation, but this time the argument is an array of Equations
Parameters:
-
eqsArray
bfs
-
root -
bds -
eqs
Runs the search algorithm, starting at a root node. The resulting bodies and equations will be stored in the provided arrays.
Parameters:
-
rootIslandNodeThe node to start from
-
bdsArrayAn array to append resulting Bodies to.
-
eqsArrayAn array to append resulting Equations to.
emit
-
event
Emit an event.
Parameters:
-
eventObject-
typeString
-
Returns:
The self object, for chainability.
getUnvisitedNode
-
nodes
Get an unvisited node from a list of nodes.
Parameters:
-
nodesArray
Returns:
The node if found, else false.
has
-
type -
listener
Check if an event listener is added
Parameters:
-
typeString -
listenerFunction
Returns:
off
-
type -
listener
Remove an event listener
Parameters:
-
typeString -
listenerFunction
Returns:
The self object, for chainability.
on
-
type -
listener
Add an event listener
Parameters:
-
typeString -
listenerFunction
Returns:
The self object, for chainability.
removeAllEquations
()
Remove all currently added equations.
sortEquations
()
Sort all equations using the .equationSortFunction. Should be called by subclasses before solving.
split
-
world
Split the world into independent islands. The result is stored in .islands.
Parameters:
-
worldWorld
Returns:
The generated islands
Properties
equations
Array
The equations to split. Manually fill this array before running .split().
equationSortFunction
Function | Boolean
Function that is used to sort all equations before each solve.
islandPool
IslandPool
nodePool
IslandNodePool
nodes
Array
The resulting graph nodes.
queue
Array
private
The node queue, used when traversing the graph of nodes.
