Fixed #347 - Relaxed convergence criteria for inverse_terra functions.

Asking the latitude and longitude directly beneath
the Sun causes inverse_terra not to converge, because the
convergence increment `W` never got below 1.48e-8, but the
convergence limit was 1.0e-8. I increased the limit to 2.0e-8
in all programming language versions.

I'm hoping that is a big enough tolerance for all cases now,
but I will do more testing to see if further fixes are required
for even more distant bodies than the Sun.
This commit is contained in:
Don Cross
2024-05-27 16:20:45 -04:00
parent 1c6a11c03d
commit 0309762a64
20 changed files with 35 additions and 19 deletions

View File

@@ -1449,7 +1449,7 @@ def _inverse_terra(ovec: List[float], st: float) -> Observer:
radicand = cos2 + _EARTH_FLATTENING_SQUARED*sin2
denom = math.sqrt(radicand)
W = (factor*sin*cos)/denom - z*cos + p*sin
if abs(W) < 1.0e-8:
if abs(W) < 2.0e-8:
# The error is now negligible
break
# Error is still too large. Find the next estimate.