Ensure pose quaternions are normalized
This commit is contained in:
@@ -260,13 +260,19 @@ std::pair<XrTime, xrt_space_relation> pose_list::get_at(XrTime at_timestamp_ns)
|
|||||||
|
|
||||||
if (orientation.y)
|
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 = {
|
orientation.y->normalize();
|
||||||
.x = (*orientation.y)[1],
|
|
||||||
.y = (*orientation.y)[2],
|
ret.pose.orientation = {
|
||||||
.z = (*orientation.y)[3],
|
.x = (*orientation.y)[1],
|
||||||
.w = (*orientation.y)[0]};
|
.y = (*orientation.y)[2],
|
||||||
|
.z = (*orientation.y)[3],
|
||||||
|
.w = (*orientation.y)[0]};
|
||||||
|
}
|
||||||
|
|
||||||
if (orientation.dy)
|
if (orientation.dy)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user