3-D Covariance (Ellipsoid Geometry) Orientation Issue

1. A concise explanation of the problem you're experiencing.

I'm working on a project where we want to visualize 3-D spacecraft position covariance. To do this, we're using the ellipsoid geometry in Cesium and using the eigen values and eigen vectors of the spacecraft position covariance matrix to size and orient the ellipsoid, respectively. For orientation, the eigen vector matrix is being turned into a quaternion; this quaternion is what is actually being used to orient the ellipsoid.

Using this method actually works great, for the most part. The issue arises when Cesium reaches the end of an ephemeris file (which contains position, velocity, covariance ellipsoid size, and covariance ellipsoid orientation quaternion). Anytime Cesium transitions from one ephemeris file to the next ephemeris file, the covariance ellipsoid orientation incorrectly changes by a constant 90 degrees resulting in an ellpsoid perpendicular to its correct orientation.

I've looked at the actual data being sent to Cesium, and the orientation quaternions from the first file match the orientation quaternion from the second file either exactly or to within either negation (i.e. q1 = -q2, which is the same rotation in the opposite direction) or a 180 degree rotation (i.e. q1 = q2p where p is a 180 degree rotation about either x, y, or z axis). Given this fact, the worst Cesium should be showing is a 360 degree flip (q1 = -q2) back to the original position and not a constant 90 degree offset.

Does anyone have any ideas why this might be happening when transitioning from one ephemeris file to the next?

2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.


3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

I need to visualize and properly orient 3-d position covariance for spacecraft.

4. The Cesium version you're using, your operating system and browser.

Browser: Firefox and Chrome
OS: Windows 7 and Linux CentOS
Cesium Version: 1.25