Closed naktinis closed 7 years ago
I would suggest adding the following test:
s = LatLon(53.3206, -1.7297)
e = LatLon(53.1887, 0.1334)
p1 = LatLon(53.36366, -1.83883)
p2 = LatLon(53.35423, -1.60881)
d1 = p1.alongTrackDistanceTo(s, e) # -7702.7
d2 = p2.alongTrackDistanceTo(s, e) # 7587.6
I would expect d1
to be negative as p1
projects onto the great circle defined by s->e
to the opposite side than d2
.
Thank you! Tried that, but d1
is 7702.7, positive and not negative.
Yes, it currently is. I think the sign can be determined by looking at the difference between bearings of s->e
and s->p
. I.e. checking if cos(bearing_s_to_e - bearing_s_to_p) > 0
.
That works. New version PyGeodesy-17.4.27
with your tests and an other one from Aviation Formula.
An other open issue. There is also a crossTrackDistanceTo
method for the sphericalNvector
LatLon
class and an alongTrackDistanceTo
method is also available since PyGeodesy-17.5.11
.
Done.
It would be convenient to have a method for computing along-track distance: "distance from the start point to the closest point on the path (to the end point) to the third point". The formula (as provided here) is:
Where
dXt
is cross-track distance andd13
is the distance from start to the point of interest.It is also possible to modify it to support negative values, which makes sense in certain cases.
I would be happy to add this method if you're considering accepting pull requests.