Interactive Shortest-distance calculations on Triangulations

As a means to bring attention to my latest book, Mastering SciPy, I wrote a blog post summarizing some of the techniques illustrated in one of its chapters: Computational Geometry in Python. On that post, I created an example of computation of shortest distances between two vertices of the constrained conforming Delaunay triangulation of a polygon with holes, in which I imposed a maximum allowed area on the required triangles. To illustrate this technique, I chose two vertices randomly, produced the code to calculate the sequence of segments that facilitate the shortest path between them, and presented the corresponding visualization.

Ever since publishing that post, I thought it would be even nicer to have an interactive diagram, where just by hovering over the vertices of the triangulation, we could quickly compute and display those paths. It took me a while, but now with the assistance of bokeh, it came to fruition. Well, here it is!

Use the mouse wheel to zoom in and out (you may have to activate that option in the diagram toolbar), drag and drop to pan the underlying triangulation, and notice what happens when the mouse hovers over each of the different vertices.