Problem: The user location won't necessarily be exactly on the hike's line, but we want to display it on the hike nevertheless.
Thus we need a function that projects the actual user's position point onto the lines formed by the hike's waypoints, similar to the image shown below.
@MaelImhof and @davidholzwarth think this function is best put into LocationUtils, but if you have a different proposal please start a discussion about it.
We discussed the function further on the Telegram group and decided it would be best to have it return three things :
A projected location of the user onto the hike (even if the user is far away from the hike)
The length of the hike the user has already done according to the projected location
The distance between the actual and projected location. This will be used in the UI (not in the function) to determine using a threshold if the user is on the hike or not, and to display either the actual or projected location.
Problem: The user location won't necessarily be exactly on the hike's line, but we want to display it on the hike nevertheless.
Thus we need a function that projects the actual user's position point onto the lines formed by the hike's waypoints, similar to the image shown below.
@MaelImhof and @davidholzwarth think this function is best put into
LocationUtils
, but if you have a different proposal please start a discussion about it.