Hi all,
I am trying to render a position uncertainty ellipsoid around a moving object in CesiumJS. I have computed the radii of the ellipsoid and the rotation matrix to orient the ellipsoid in the ECEF (ITRF) frame using eigenvalue decomposition of the covariance matrix expressed in the ECEF frame.
I have tried implementing this in two ways:
- By using the
ellipsoid
property of the Entity API; positioning the ellipsoid using theposition
property of the entity and orienting the ellipsoid by constructing a quaternion from the ECEF rotation matrix and using this quaternion as the entity’sorientation
- By using the Primitive API; constructing an
EllipsoidGeometry
and using themodelMatrix
both to position and rotate the entity in ECEF space
I would have expected these to produce identical results, but only the second approach (using the Primitive API) orients the ellipsoid correctly. What is the difference between passing a rotation (and translation) matrix as modelMatrix
using the primitive API and passing an equivalent quaternion to the orientation
parameter of the Entity API? Note that for the primitive API, I have tried constructing the model matrix both using the rotation matrix directly and using a quaternion constructed from the rotation matrix, and both work, so the conversion from rotation matrix to quaternion isn’t the issue. The descriptions I can find for these in the documentation are:
modelMatrix: The 4x4 transformation matrix that transforms the primitive (all geometry instances) from model to world coordinates.
orientation: Gets or sets the orientation in respect to Earth-fixed-Earth-centered (ECEF). Defaults to east-north-up at entity position.
While the solution with the Primitive API works for a single time, implementing using the Entity API would make animating the object over time much more straightforward.