// 创建一个 HeadingPitchRoll 实例
var originalHPR = new Cesium.HeadingPitchRoll(
6.283185307179586, // heading
-0.5000392228306918, // pitch
6.283185307179586 // roll
);
// 将 HeadingPitchRoll 转换为 Quaternion
var quaternion = Cesium.Quaternion.fromHeadingPitchRoll(originalHPR);
// 再将 Quaternion 转换回 HeadingPitchRoll
var convertedHPR = Cesium.HeadingPitchRoll.fromQuaternion(quaternion);
// 输出原始和转换后的值
console.log(‘Original HPR:’, originalHPR);
console.log(‘Converted HPR:’, convertedHPR);
// 检查是否接近原始值
console.log(‘Heading match:’, Cesium.Math.equalsEpsilon(originalHPR.heading, convertedHPR.heading, Cesium.Math.EPSILON14));
console.log(‘Pitch match:’, Cesium.Math.equalsEpsilon(originalHPR.pitch, convertedHPR.pitch, Cesium.Math.EPSILON14));
console.log(‘Roll match:’, Cesium.Math.equalsEpsilon(originalHPR.roll, convertedHPR.roll, Cesium.Math.EPSILON14));