# Need help with transforms

Hello,

I’m working with Cesium for a few years now, first let me say thank you for developping such an amazing tool !

Now to the core of the problem, I have a plane modelized as an entity, which owns positions and orientations properties.

How to trace polylines at the tips of the wings (approximately) I just need to show the global attitude of the plane once or twice per second.

I’ve been checking Cesium.Transforms and I guess that my answer lies somwhere there, as I’d like to make a clever operation on my previously computed trajectory and attitude data to make this offset, but can’t make it so far.

Charles

1 Like

Hey,

What do you mean by “trace polylines”? What are you trying to do? Track the coordinate at the wing-tips, something like that? If your bounding box is uniform with the plane tips (ie. tips are against the wall of a bounding box) then tranforms can work, but transforms aren’t easy.

Any sandcastle example to get us started?

Cheers,

Alex

Hi Alex, thanks for your quick answer, yes I’d like to “draw” the wing tips trajectories (sry for that) around the main path of my plane, but they don’t need to be exactly at the tips, it could be a distance of 15m doesn’t matter.

a basic sandcastle could be the one of the interpolated positions that has interpolated orientations as well :

Charles

I guess your starting point is to;

1. Find the bounding box of your model (airplane), and the center over the wings
2. Look into Cesium.VelocityOrientationProperty(position)
3. Pull out the heading / yaw from 2. and calculate the offset based on 1.
4. Add those two positions to an array of positions that you’ve got to two polylines with Cesium.CallbackProperty()

I guess 3. is the tricky one, and there’s probably many approaches, from using world coordinates, to cartesian offsets, and so on. Cesium Transforms are mostly in cartesian, so maybe that’s a better bet.

My approach to this would be find the center of your model in world coordinates, add the wingspan distance in meters, and offset where the wings cross the body, as well as height. If you can draw a point right there, then the rest is somewhat easier. Create two world coordinates with those offsets perpendicular to the models heading angle. First I’d do it assuming the plane is aligned with the horizon, then see if you can pull the yaw out, and adjust the height of the two new world coordinates (which is easy as they are in meters). If you want to be precise you can triangulate the offset in meters, but even aproximations might be good enough here.

As to do the actual math of all this I don’t have time right now (will take a few hours of fiddling around, I think), but I’m sure someone out there have done something similar. None of this is Cesium specific apart from finding the heading and yaw of your model, so a bit of searching around will probably yield something (“how to add point offset to coordinate based on heading / yaw”)

Cheers,

Alex

Thank you Alex for this comprehensive answer, it is indeed the 3. that I need help with, I’ll keep on searching maybe in math forums. Thanks again for your time!

Charles