These two functions should not be inverse or converted to each other, but the test results are not like this

// 创建一个 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));

This is a combination of 360° = 0° and floating precision issues.

The original heading is 6.283185307179586, which is 360°.
The converted heading is -2.4492935982947064e-16, a very small number, very close to 0°.