Skip to content

five-on-it / packages/world/src/road-graph / buildRoadGraph

Function: buildRoadGraph() ​

buildRoadGraph(level, joinTolerance?): RoadGraph

Defined in: packages/world/src/road-graph.ts:210

Builds the road graph of a level. Two roads meet where their centre lines cross within both roads (a crossing) or within joinTolerance plus the other road's half-width of one road's end (a T: that end is moved onto the other's centre line, so a street that stops short inside the band, or runs a little past the line, still joins cleanly). Ends within joinTolerance of each other are one node; so are a bend and a crossing that close together.

Parameters ​

level ​

LevelData

joinTolerance? ​

number = JOIN_TOLERANCE

Returns ​

RoadGraph