TransWikia.com

Compute a rotation relative to ENU

Geographic Information Systems Asked on August 24, 2021

I am using CESIUM JS. I posted a message in cesium forum some days ago, but I didn’t manage to find a solution.

I have a 3D camera moving freely on a map.
I have a 2D map (let’s call it minimap) that show a flat representation of the current location.

In the Minimap, I would like to represent the rotation (only heading since it’s 2D) of the camera.

enter image description here

Now, since the 2d MAP always point to the globe north, and the camera is free to rotate in all the direction, I need to represent the rotation of the camera relative to East North Up coordinate (ENU) to use the correct heading for the minimap.

Cesium provide a lot of tools https://cesium.com/docs/cesiumjs-ref-doc/Transforms.html?classFilter=Transform#.eastNorthUpToFixedFrame

and I tried to use them, but it’s really confusing and I don’t quite get exactly how it works.

I tried for exemple

// get a fixed frame (matrix4) at my current position with the correct ENU
matrix = Cesium.Transforms.eastNorthUpToFixedFrame(camera.position)
// use the matrix 4 to get heading pitch roll at the current fixed frame
headpitchroll = Cesium.Transforms.fixedFrameToHeadingPitchRoll(matrix)
// substract current north to the camera rotation
heading = camera.heading - headpitchroll.heading

But is not displaying the correct rotation.

Should I do something similar to this ?

get a fixed frame with no rotation of the current ENU
apply the camera rotation in this frame
get the heading of that rotation in that frame

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP