NaN appearing in OneAxisEllipsoid for points near Earth center
When computing inter-satellites view of two GNSS satellites almost opposite to each other (and hence which should never see each other), one intermediate point is evaluated close to Earth center. It generates a NaN. Here is a small example:
@Test
public void testPointNearCenter() {
final OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
Constants.WGS84_EARTH_FLATTENING,
FramesFactory.getITRF(IERSConventions.IERS_2010, false));
final Vector3D p1 = new Vector3D( 14605530.402633, 7681001.886684, 24582223.005261);
final Vector3D p2 = new Vector3D(-14650836.411867, -7561887.405778, -24575352.170908);
final Vector3D pMid = new Vector3D(0.5, p1, 0.5, p2);
System.out.println(earth.transform(pMid, earth.getFrame(), null));
}
The reason is that convergence is not reached in Toshio Fukushima's algorithm and phi is still set to Double.POSITIVE_INFINITY
when the loop exceeds its max count. The example above would need 137 iterations to converge
An even worst point is new Vector3D(-20923.23737959098, 56464.586571323685, -7647.317096056417)
, which needs 1150 iterations to converge.
Edited by Luc Maisonobe