Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixedFrameToHeadingPitchRoll bug ? #12067

Closed
cnchore opened this issue Jul 5, 2024 · 1 comment
Closed

fixedFrameToHeadingPitchRoll bug ? #12067

cnchore opened this issue Jul 5, 2024 · 1 comment

Comments

@cnchore
Copy link

cnchore commented Jul 5, 2024

What happened?

const modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(
Cesium.Cartesian3.fromDegrees(120.33820052, 30.32139976, 560.66),
new Cesium.HeadingPitchRoll(Cesium.Math.toRadians(30), Cesium.Math.toRadians(-90), Cesium.Math.toRadians(60)),
Cesium.Ellipsoid.WGS84,
Cesium.Transforms.eastNorthUpToFixedFrame
);
const rotation = Cesium.Matrix4.getMatrix3(modelMatrix, new Cesium.Matrix3());
const quaternion = Cesium.Quaternion.fromRotationMatrix(rotation);
const hpr = Cesium.HeadingPitchRoll.fromQuaternion(quaternion);
console.log("🚀 hpr:", Cesium.Math.toDegrees(hpr.heading), Cesium.Math.toDegrees(hpr.pitch), Cesium.Math.toDegrees(hpr.roll));
// console: 59.661799480000006 -30.321414538290494 180

why not 30 -90 60 ?

const hpr1 = Cesium.Transforms.fixedFrameToHeadingPitchRoll(modelMatrix, Cesium.Ellipsoid.WGS84, Cesium.Transforms.eastNorthUpToFixedFrame);
console.log("🚀 hpr1:", Cesium.Math.toDegrees(hpr1.heading), Cesium.Math.toDegrees(hpr1.pitch), Cesium.Math.toDegrees(hpr1.roll));
// console : 68.19859051364818 -90 68.19859051364818
why not 30 -90 60 ?

Reproduction steps

const modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(
Cesium.Cartesian3.fromDegrees(120.33820052, 30.32139976, 560.66),
new Cesium.HeadingPitchRoll(Cesium.Math.toRadians(30), Cesium.Math.toRadians(-90), Cesium.Math.toRadians(60)),
Cesium.Ellipsoid.WGS84,
Cesium.Transforms.eastNorthUpToFixedFrame
);
const rotation = Cesium.Matrix4.getMatrix3(modelMatrix, new Cesium.Matrix3());
const quaternion = Cesium.Quaternion.fromRotationMatrix(rotation);
const hpr = Cesium.HeadingPitchRoll.fromQuaternion(quaternion);
console.log("🚀 hpr:", Cesium.Math.toDegrees(hpr.heading), Cesium.Math.toDegrees(hpr.pitch), Cesium.Math.toDegrees(hpr.roll));
// console: 59.661799480000006 -30.321414538290494 180

why not 30 -90 60 ?

const hpr1 = Cesium.Transforms.fixedFrameToHeadingPitchRoll(modelMatrix, Cesium.Ellipsoid.WGS84, Cesium.Transforms.eastNorthUpToFixedFrame);
console.log("🚀 hpr1:", Cesium.Math.toDegrees(hpr1.heading), Cesium.Math.toDegrees(hpr1.pitch), Cesium.Math.toDegrees(hpr1.roll));
// console : 68.19859051364818 -90 68.19859051364818
why not 30 -90 60 ?

Sandcastle example

No response

Environment

Browser:
CesiumJS Version: Cesium 1.116
Operating System:

@ggetz
Copy link
Contributor

ggetz commented Jul 8, 2024

Hi @cnchore, the rotations are in world space, not in local space.

CesiumJS is a big project, so we use GitHub for feature requests and bug tracking exclusively. In the future, please take any questions to the Cesium Forum where there are members of the community and developers from the team who can help. Thanks!

@ggetz ggetz closed this as completed Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants