From eaf747eca237cd4332c2a6d7cdede5334fdf2636 Mon Sep 17 00:00:00 2001 From: Christoph Haag Date: Wed, 10 Apr 2024 00:08:02 +0200 Subject: [PATCH] u/space_overseer: skip actually locating spaces in themselves It is always going to be identity. Keep calculating the offsets though. Part-of: --- src/xrt/auxiliary/util/u_space_overseer.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/xrt/auxiliary/util/u_space_overseer.c b/src/xrt/auxiliary/util/u_space_overseer.c index ee60e8010..7bda1add3 100644 --- a/src/xrt/auxiliary/util/u_space_overseer.c +++ b/src/xrt/auxiliary/util/u_space_overseer.c @@ -593,7 +593,13 @@ locate_spaces(struct xrt_space_overseer *xso, struct xrt_relation_chain xrc = {0}; m_relation_chain_push_pose_if_not_identity(&xrc, &offsets[i]); - build_relation_chain(uso, &xrc, ubase_space, uspace, at_timestamp_ns); + + // crude optimization: If locating a space in itself, we don't actually need to locate the space itself. + // only the offsets need to be applied. + if (spaces[i] != base_space) { + build_relation_chain(uso, &xrc, ubase_space, uspace, at_timestamp_ns); + } + m_relation_chain_push_inverted_pose_if_not_identity(&xrc, base_offset); // For base_space =~= space (approx equals).