I am building a web app (in Qwik) that requires parsing a .xctsk file (paragliding competition tasks), and drawing the task on a map. A task consists of a bunch of circles in a given order.
I have successfully implemented the file parsing, and drawing the circles, and I now need to draw the shortest path that links every circle in the given order. It should end up looking like this:
![](https://cdn.statically.io/img/i.sstatic.net/IQ1bApWk.jpg)
I can easily connect the circles' centers with polylines, like the screenshot below, but I have no clue on how to find the points that give the shortest path. Any idea would be very much welcome!
![](https://cdn.statically.io/img/i.sstatic.net/MrfsJ0pB.png)
Here is my code:
task?.turnpoints.forEach((tp, index) => {
circle([tp.waypoint.lat, tp.waypoint.lon], {
radius: tp.radius,
color: "orange",
}).addTo(mapContainer$.value!);
if (index < task.turnpoints.length - 1) {
polyline(
[
[
task.turnpoints[index].waypoint.lat,
task.turnpoints[index].waypoint.lon,
],
[
task.turnpoints[index + 1].waypoint.lat,
task.turnpoints[index + 1].waypoint.lon,
],
],
{ color: "black" },
).addTo(mapContainer$.value!);
}
});
I tried looking for information on other forums, as well as math formulas, but did not find any clue.