In some rare case, like those reported by #3, https://github.com/rspatial/geosphere/blob/0a775039177646d093edc23c709267ffc7094d76/R/alongTrack.R#L28
The angle in the acos(cos(dp) / cos(xtr)) function can be slightly lower than -1 or higher than +1 due to due to the rounding and machine precision. I added this quick (and maybe a bit dirty) fix to ensure that the angle stays within the domain of the arc-cosine function.
Hi !
In some rare case, like those reported by #3, https://github.com/rspatial/geosphere/blob/0a775039177646d093edc23c709267ffc7094d76/R/alongTrack.R#L28 The angle in the
acos(cos(dp) / cos(xtr))
function can be slightly lower than -1 or higher than +1 due to due to the rounding and machine precision. I added this quick (and maybe a bit dirty) fix to ensure that the angle stays within the domain of the arc-cosine function.