new BiBreadthFirstFinder(allowDiagonal)
Bi-directional Breadth-First-Search path finder.
- Source:
- ./src/modules/BiBreadthFirst.js, line 7
Parameters:
Name | Type | Description |
---|---|---|
allowDiagonal |
boolean | Whether diagonal movement is allowed. |
Extends
Methods
-
<protected> _constructPath(x1, y1, x2, y2, which) → {Array.<Array.<number>>}
-
Construct the path according to the nodes' parents.
- Source:
- ./src/modules/BiBreadthFirst.js, line 214
Parameters:
Name Type Description x1
number X coordinate of one of the meeting nodes. y1
number Y coordinate of one of the meeting nodes. x2
number X coordinate of the other meeting node. y2
number Y coordinate of the other meeting node. which
string Construction initiated by `source` or `target`. Returns:
The path, including both start and end positions.- Type
- Array.<Array.<number>>
-
_expand(which) → {boolean}
-
Expand one of the queues.
- Source:
- ./src/modules/BiBreadthFirst.js, line 80
Parameters:
Name Type Description which
string Expand `source` or `target`. Returns:
Whether the path has been found.- Type
- boolean
-
_expandSource() → {boolean}
-
Expand the source open list.
- Source:
- ./src/modules/BiBreadthFirst.js, line 61
Returns:
Whether the path has been found.- Type
- boolean
-
_expandTarget() → {boolean}
-
Expand the target open list.
- Source:
- ./src/modules/BiBreadthFirst.js, line 70
Returns:
Whether the path has been found.- Type
- boolean
-
<protected> _find() → {Array.<[number, number]>}
-
Find and return the the path.
- Source:
- ./src/modules/BiBreadthFirst.js, line 22
Returns:
The path, including both start and end positions.- Type
- Array.<[number, number]>
-
<protected> _inspectNodeAt(x, y, px, py, which) → {boolean}
-
Push the position into the open list if this position is not in the list. Otherwise, if the position can be accessed with a lower cost from the given parent position, then update its parent and cost
- Source:
- ./src/modules/BiBreadthFirst.js, line 180
Parameters:
Name Type Description x
number The x coordinate of the position. y
number The y coordinate of the position. px
number The x coordinate of the parent position. py
number The y coordinate of the parent position. which
string Inspection by 'source' or 'target'. Returns:
Whether the path has been found.- Type
- boolean
-
<protected> _inspectSurround(x, y, which) → {boolean}
-
Inspect the surrounding nodes of the given position
- Source:
- ./src/modules/BiBreadthFirst.js, line 103
Parameters:
Name Type Description x
number The x coordinate of the position. y
number The y coordinate of the position. which
string Inspection by 'source' or 'target'. Returns:
Whether the path has been found.- Type
- boolean
-
<protected> _inspectSurroundDiagonal(x, y, which) → {boolean}
-
Inspect the surrounding nodes of the given position (including the diagonal ones).
- Source:
- ./src/modules/BiBreadthFirst.js, line 132
Parameters:
Name Type Description x
number The x coordinate of the position. y
number The y coordinate of the position. which
string Inspection by 'source' or 'target'. Returns:
Whether the path has been found.- Type
- boolean