# Entity animation with cartesian derivatives

Dear All,

I am quite new to Cesium and this is probably just a case of me being stupid.

I am trying to ‘move’ an entity with Cartesian3Velocity coordinates.

From what I can see, if I have a point (entity) with Cartesian coordinates [x,y,z] and derivatives [dx,dy,dz] at the same point, a path and velocity could be calculated, just like the equations of constant acceleration and vector resolution.

For the life of me I cannot see a way of doing this in Cesium. I have done copious reading on the forums and in the documentation, but in all cases I have been told that in order to ‘move’ an entity, I need time and position samples in order to interpolate. Unless I am very much missing the point, this renders the derivative elements in the cartesian3Velocity array completely useless? Is there no way to transform an entity with only one data point and its derivatives?

The closest I have come to a solution is extrapolation in the SampledPositionProperty. Is this actually what I have been looking for all along, or does no function for this exist in Cesium?

I thank you in advance for trying to understand my ramblings.

Toby

Hello Toby,

We don’t have anything built in that will move an entity based on velocity. I would recommend using a SampledPositionProperty. Have you seen this interpolation example? http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Interpolation.html&label=Showcases

Best,

Hannah

Currently, velocity information is only used as an option to improve interpolation results with the Hermite interpolation algorithm. There is currently no way to obtain the values of derivatives from SampledProperty, though this would be a welcome addition in the future.

When using the entity system in Cesium, it’s better not to think of your code as responsible for “moving” entities. Instead, entities are data objects which are queried each frame for the value of their various properties (such as position, but all properties work this way) as a function of time - by calling getValue(time, result) - and then those values are rendered in the display.

Properties are essentially functions of time, i.e. f(t) -> result, and entities simply group together those functions. The details of how a particular property computes its value are encapsulated within the property itself, and you can conceptually consider the provided property types as different functions of time.

You could consider using a CallbackProperty, which gives you complete responsibility for computing and returning a value for position as a function of time. You could then handle the equations of motion yourself.

In practice, pre-computing position samples (into ephemeris) and using simple client-side interpolation is typically the most performant option, and produces reasonably good results, especially when the calculations are complex, or calculated using more advanced analysis packages (such as AGI’s products).

Thank you Scott and Hannah for your help!
I think what I will do is to dynamically calculate the eci coordinates in js and calculate a set of coordinates for one hour in advance, then interpolate between the two. From what I have read, it is possible to extrapolate as well, am I right? Also, I'm thinking of just using Lagrange, is there a recommendation of which method to use in which scenarios ?

Thanks again!

Toby