NaN Altitude rate in OneAxisEllipsoid
The test case below fails because the computed altitude rate is NaN
. It is a tricky case where the point is exactly on Earth's pole and traveling perpendicular to Earth's axis. The NaN
seems to be created when computing dr = dr2.sqrt()
where d(dr)/dt = 1/2 dr2**(-1/2) d(dr2)/dt
which when dr2=0
and d(dr2)/dt = 0
reduces to 0/0
causing the NaN
.
Alternatively if one projected the point into the local tangent plane to the ellipsoid then the altitude rate is the velocity in the zenith direction, which is clearly zero.
@Test
public void testGp() {
AbsoluteDate epoch = AbsoluteDate.ARBITRARY_EPOCH;
OneAxisEllipsoid earth = ReferenceEllipsoid.getWgs84(FramesFactory.getGCRF());
FieldGeodeticPoint<DerivativeStructure> gp = earth.transform(
new PVCoordinates(new Vector3D(0, 0, earth.getC()), new Vector3D(0, 1, 0)),
earth.getBodyFrame(), epoch);
assertThat(gp.getAltitude().getPartialDerivative(1), closeTo(0.0, 1e-12));
}