The algorithm finds the curve with minimal length between two points on a given map.
The height map is given in the form of two dimensional array of nonnegative values. It is convenient to represent it as grey-scaled 8-bit image of dimension
A continuius curve
Optionally, the initial and final points can be fixed as
The solution to the formulated problem is based on the Bellman's principle of optimality, so it needs just
-
The shortest path with free ends
-
The shortest path with fixed ends
-
The shortest path for randomly generated image
After little modifications the algorithm can find curves with diagonal junctions. In this case the optimality criteria turns into