I keep seeing the "derivativeTypes" parameter when reviewing the SampledProperty code and/or documentation and keep wondering what it does and if it may be helpful to me.
Can somebody provide an explanation of what the derivateTypes parameter is and how it would be used? And maybe a simple example.
This feature is not fully finished, which is why it’s not well documented.
HermitePolynomialApproximation can use derivative information to produce better interpolation results. Currently, this means using velocity information to interpolate position. Cartesian properties in CZML can be specified as “cartesianVelocity” to load both position samples and velocity samples into a SampledPositionProperty.
In the current code, derivativeTypes is always an array containing the type Cartesian (the derivative of a Cartesian position is a Cartesian velocity) but in the future the types may be different. (For example, I believe the derivative of a Quaternion orientation is a Cartesian)
We used this feature in the NORAD Tracks Santa app last year to give better visual quality. Specifically, Hermite degree 3 to interpolate position with velocity, and Lagrange degree 1 to interpolate orientation.
Thanks for the explanation Scott. So if I know what my speed is in MPH at the same time as my position sample, can this be used to improve interpolation? How would you create the Cartesian from MPH?
Cesium uses SI units exclusively, so in this case, since the position is X/Y/Z meters in the Earth Fixed coordinate system, the velocity must be meters/second in that X/Y/Z coordinate system, i.e. a three dimensional velocity vector, not just a scalar speed.
If your data does not contain true velocity information, then I suspect higher-order interpolation is probably not useful.
I would go even further and state the unless you have precise velocity information that accurately correlates with position, it will actually reduce the quality of interpolation.
I'm not sure I follow what you are saying. A speed value IS a velocity vector... referenced locally to the object. If we know the entity's position and orientation, the speed value can be converted to the world coordinate vector.
Matthew, if I DID have very precise speed information correlated with position, would my quality of interpolation improve by providing velocity as a derivative? What type of difference would I notice compared to only providing position and orientation?
It’s hard to describe. You might see less "wiggle’ at sharp banks and turns. You might not see any difference at all. It depends on what type of data you have. If it’s a highly maneuvering aircraft, it will make a difference. If you have a car, probably not. The average use case will not benefit from Hermite interpolation with velocity information, it’s just not needed.
Our application has to position and move a 3D ship model in real time (or with a short delay). We have GPS lat/lon, heading and speed data available. The lat/lon values are somewhat noisy, the (gyroscope) heading and speed are not.
At the moment we use the lat/lon and heading to move the 3D model, both as sampled properties. We get new data every one or two seconds, and set the timestamp of the sampled properties 2 or 3 seconds ahead so the interpolation can do its work.
That works fine, but we noticed that the provided lat/lon points are always part of the route, so gps noise is not filtered out. That is probably the way the interpolation function works (there is no difference between Linear or Lagrange/Hermite interpolation).
We were wondering if Hermite interpolation with a derivativeTypes (i.e. speed) would give different results here (i.e. filter out some gps noise). But maybe this filter functionality is outside the scope of Cesium interpolation?
I would suggest setting the samples to the real GPS time and instead set the clock to animate 2-3 seconds behind. You can also set the ForwardExtapolationType, which means you can set the clock to the right time as well.
Hermite will not help you here because your data would have to be very precise, which it sounds like it it isn’t. Lagrange would probably be a decent fit (compared to Linear) and doesn’t require velocity. I would also set the interpolation order to something like 5).