Paths inside a Polygon
Paths inside a Polygon
This Demonstration illustrates an algorithm for finding the shortest path that stays inside a polygon and connects two given interior points. Aside from the start and finish, such a path must go from reflex vertex to reflex vertex; thus you start by first making the graph whose edges (shown in blue) are all the segments that stay inside the polygon and connect two such vertices (and the start and finish points). Then a standard shortest path algorithm yields the desired path. You can drag the start and finish points to new locations.