Skip to content

five-on-it / packages/ai/src/traffic-route

packages/ai/src/traffic-route ​

The way an ambient car goes: the lanes it will take, as one polyline of lane centres it steers along. Along a road the lanes' ends meet at the bends (each bend one point, the middle of the two lanes' ends); through a junction the lane coming in is cut where it enters the junction's box and the lane going out where it leaves it, and a curve joins the two (a quadratic Bézier through where the two lanes' lines cross; straight across when they run on in line, a loop ahead for a U-turn at a dead end). Every junction crossed is a stop on the way: where its stop line is (the box's edge), where the box is left, which lanes come in and go out. Every point carries the speed its bend allows, so the speed plan brakes for a corner, a hairpin or a turn through a junction alike. Pure: the same lanes give the same route.

Interfaces ​

Variables ​

Functions ​