gmath.c - nmea_distance_ellipsoid
Brought to you by:
xtimor
There is a problem when the longitude of the start pose and the end pose are the same. The distance between the two points are always 0.
The problem is caused by the output condition of the iteration. Now is:
while ((fabs(delta_lambda) > 1e-12) && (remaining_steps > 0))
but delta_lambda is set as zero when the lon are the same and the iteration calculation doesn't start.
We need to do at least one iteration. A possible solution is like this:
while (( remaining_steps == 20 ) || ((fabs(delta_lambda) > 1e-12) && (remaining_steps > 0)))
In this way the calculation is correct.
Thank you
Matteo unetti
can you clone from https://github.com/fhuberts/nmealib and supply patch?