You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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!
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:
The text was updated successfully, but these errors were encountered: