Paths inside a Polygon
Requires a Wolfram Notebook System
Interact on desktop, mobile and cloud with the free Wolfram Player or other Wolfram Language products.
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.
Contributed by: Stan Wagon (April 2012)
Suggested by: Karen Saxe
(Macalester College)
Open content licensed under CC BY-NC-SA
Snapshots
Details
The algorithm presented here is relatively simple. A more sophisticated algorithm that is theoretically faster is called the funnel algorithm (see [1, 2]).
References
[1] B. Chazelle, "A Theorem on Polygon Cutting with Applications," in 23rd Annual Symposium on Foundations of Computer Science, 1982, pp. 339–349.
[2] D. T. Lee and F. P. Preparata, "Euclidean Shortest Paths in the Presence of Rectilinear Barriers," Networks, 14(3), 1984 pp. 393–410.
Permanent Citation
"Paths inside a Polygon"
http://demonstrations.wolfram.com/PathsInsideAPolygon/
Wolfram Demonstrations Project
Published: April 27 2012