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:
-
eqs
Array
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:
-
root
IslandNodeThe node to start from
-
bds
ArrayAn array to append resulting Bodies to.
-
eqs
ArrayAn array to append resulting Equations to.
emit
-
event
Emit an event.
Parameters:
-
event
Object-
type
String
-
Returns:
The self object, for chainability.
getUnvisitedNode
-
nodes
Get an unvisited node from a list of nodes.
Parameters:
-
nodes
Array
Returns:
The node if found, else false.
has
-
type
-
listener
Check if an event listener is added
Parameters:
-
type
String -
listener
Function
Returns:
off
-
type
-
listener
Remove an event listener
Parameters:
-
type
String -
listener
Function
Returns:
The self object, for chainability.
on
-
type
-
listener
Add an event listener
Parameters:
-
type
String -
listener
Function
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:
-
world
World
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.