GridGraph
Defined in: GridGraph.ts:35
A grid graph with A* search. Coordinates in and out are world pixels.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new GridGraph(
options):GridGraph
Defined in: GridGraph.ts:47
Parameters
Section titled “Parameters”options
Section titled “options”Returns
Section titled “Returns”GridGraph
Properties
Section titled “Properties”
readonlycols:number
Defined in: GridGraph.ts:36
origin
Section titled “origin”
readonlyorigin:Vec2
Defined in: GridGraph.ts:40
readonlyrows:number
Defined in: GridGraph.ts:37
tileHeight
Section titled “tileHeight”
readonlytileHeight:number
Defined in: GridGraph.ts:39
tileWidth
Section titled “tileWidth”
readonlytileWidth:number
Defined in: GridGraph.ts:38
Methods
Section titled “Methods”cellToWorld()
Section titled “cellToWorld()”cellToWorld(
col,row):Vec2
Defined in: GridGraph.ts:75
Tile centre, in world pixels.
Parameters
Section titled “Parameters”number
number
Returns
Section titled “Returns”Vec2
findPath()
Section titled “findPath()”findPath(
startWorld,goalWorld):Path|null
Defined in: GridGraph.ts:89
Start/goal are world pixels, converted via worldToCell. Returns null
when either cell is out of bounds, or the goal cell isn’t walkable (the
start cell may be blocked — an agent can straddle a blocked edge; only
the goal must be walkable). Same start/goal cell returns a one-waypoint,
zero-cost path regardless of that cell’s walkability.
Parameters
Section titled “Parameters”startWorld
Section titled “startWorld”Vec2Like
goalWorld
Section titled “goalWorld”Vec2Like
Returns
Section titled “Returns”Path | null
inBounds()
Section titled “inBounds()”inBounds(
col,row):boolean
Defined in: GridGraph.ts:63
Parameters
Section titled “Parameters”number
number
Returns
Section titled “Returns”boolean
worldToCell()
Section titled “worldToCell()”worldToCell(
v):GridCell
Defined in: GridGraph.ts:67
Parameters
Section titled “Parameters”Vec2Like