From bubbles to routes

If canvas does not appear here, try a better browser, like chrome.

This code creates routes from the contacts between bubbles. Red shows primary routes (circle centre to circle centre) and Green shows secondary routes (contact point to contact point). Both could be useful for pathfinding in different situations. Red tends towards the middle of open spaces so would be good to simulate exploration where line of sight is required and there is no danger from being seen by other agents in the system. Green tends towards more direct routes so should produce shorter paths when the objective is more about getting from A to B as fast as possible rather than exploring the environemnt. We could also create a behaviour that tends to stay close to bondaries and weave about by only allowing routes between adjacent contact points on the circumference of the circles.

Again this has been implemented in JavaScript and drawn with a canvas. You can click on the canvas to add line segments to the world. Each pair of clicks adds a new line between them. This causes any intersecting bubbles to be removed, and the space will be re-mapped with new bubbles and routes over time