st/oxr: Fix pure_relation_from_space

Fixes in particular the space transform submitted in composition layers
in local reference space.

Consider a pose given with a pose offset to an XrSpace as its origin.
To construct the Pose in global space, simply add up XrSpace pose in
global space, XrSpace pose offset and the given pose.

     Given pose with a
     pose offset to XrSpace as origin
            /|\         /|\
            /            |
           /             |
   XrSpace pose offset   |
         /|\             |
          |              |
          |              |
      XrSpace pose       |
     in global space     |
            /|\          |
             \           |
              \          |
            Global Space origin
This commit is contained in:
Christoph Haag 2022-03-30 01:40:38 +02:00
parent 922fdff62d
commit 068bf05057

View file

@ -259,9 +259,9 @@ oxr_space_pure_relation_from_space(struct oxr_logger *log,
}
struct xrt_relation_chain xrc = {0};
m_relation_chain_push_relation(&xrc, &pure_space_relation);
m_relation_chain_push_inverted_pose_if_not_identity(&xrc, &spc->pose);
m_relation_chain_push_relation(&xrc, relation);
m_relation_chain_push_pose_if_not_identity(&xrc, &spc->pose);
m_relation_chain_push_relation(&xrc, &pure_space_relation);
m_relation_chain_resolve(&xrc, out_relation);
return true;
}