mario-s / gpx_split_rs

GPX file splitter written in Rust
Apache License 2.0
0 stars 0 forks source link

wrong interception point #7

Closed mario-s closed 5 months ago

mario-s commented 5 months ago

After following along the discussion at https://sourceforge.net/p/geographiclib/discussion/1026621/thread/21aaff9f/ and testing the function with the coordinates from this sample: https://github.com/bmwcarit/barefoot#spatial-search-and-operations.

I came to the conclusion, that the current function calculates the interception point incorrect.

A quick test can be done when using the above coordinates on this page: https://geo.javawa.nl/coordcalc/mobi_en.html

Further reading regarding algorithms for geodesics: https://link.springer.com/article/10.1007/s00190-012-0578-z

mario-s commented 5 months ago

The calculate for distance from point to line on https://geo.javawa.nl/coordcalc/mobi_en.html gives me a result which seems to be wrong, when the point is outside the boundary. In the following sample the closest point is identical with point A. I expected a point with the coordinates N 3.00000° E 0.00000°.

Point C: | N 3.00000° E 1.00000° Point A: | N 2.00000° E 0.00000° Point B: | S 1.00000° E 0.00000° Closest point on the line: | N 2.00000° E 0.00000°

However when point C is within the boundary the result matches my expectation. Point C: N 0.00000° E 1.00000° Point A: N 2.00000° E 0.00000° Point B: S 1.00000° E 0.00000° Closest point on the line: S 0.00000° E 0.00000°