OrekitException in CartesianOrbit.shiftedBy for near-parabolic orbit
The following snippet:
Vector3D position = new Vector3D(-1466739.735988, 1586390.713569, 6812901.677773);
Vector3D velocity = new Vector3D(-9532.812, -4321.894, -1409.018);
PVCoordinates pvCoordinates = new PVCoordinates(position, velocity);
CartesianOrbit orbit = new CartesianOrbit(pvCoordinates, FramesFactory.getEME2000(), date, 3.986004415E14);
KeplerianOrbit keplerianOrbit = new KeplerianOrbit(orbit);
System.out.println(orbit.shiftedBy(908.5374153478582));
causes a MathIllegalStateException
because the iterative algorithm in the private method CartesianOrbit.meanToEccentric(double, double, double)
fails to converge after 50 iterations. If the absolute value of the variable shift
ever got below 1.0e-12
, it would converge, but the sequence of values for shift
is
-0.002645455729001226
2.633633797526559E-4
-4.1053297963915966E-8
-1.1039059891245789E-12
1.103905989119014E-12
-1.1039059891245789E-12
1.103905989119014E-12
...
After the 4th iteration, shift
ping-pongs back and forth between -1.1e-12 and 1.1e-12.
In this case, the orbit is near-parabolic (eccentricity = 0.9999914443634164) and near perigee (true anomaly = -3.755789881001165 degrees), which is a hard case for solving Kepler's equation, and the currently-implemented algorithm isn't up to the task.