Ensure pose quaternions are normalized

This commit is contained in:
Patrick Nicolas
2026-02-13 23:25:45 +01:00
parent 66a56dac82
commit 627e87c144
+12 -6
View File
@@ -260,13 +260,19 @@ std::pair<XrTime, xrt_space_relation> pose_list::get_at(XrTime at_timestamp_ns)
if (orientation.y)
{
flags(XRT_SPACE_RELATION_ORIENTATION_VALID_BIT | XRT_SPACE_RELATION_ORIENTATION_TRACKED_BIT);
if (auto norm2 = orientation.y->squaredNorm();
norm2 > 0.9 and norm2 < 1.1)
{
flags(XRT_SPACE_RELATION_ORIENTATION_VALID_BIT | XRT_SPACE_RELATION_ORIENTATION_TRACKED_BIT);
ret.pose.orientation = {
.x = (*orientation.y)[1],
.y = (*orientation.y)[2],
.z = (*orientation.y)[3],
.w = (*orientation.y)[0]};
orientation.y->normalize();
ret.pose.orientation = {
.x = (*orientation.y)[1],
.y = (*orientation.y)[2],
.z = (*orientation.y)[3],
.w = (*orientation.y)[0]};
}
if (orientation.dy)
{