From 1c046dc523ee401bb54f0a3fce013f4c72bbab0c Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sat, 24 Dec 2022 01:18:06 +0000 Subject: [PATCH] m/space: Move functions to correct section --- src/xrt/auxiliary/math/m_space.cpp | 69 +++++++++++++++--------------- 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/src/xrt/auxiliary/math/m_space.cpp b/src/xrt/auxiliary/math/m_space.cpp index 36731f15d..67c7a54fd 100644 --- a/src/xrt/auxiliary/math/m_space.cpp +++ b/src/xrt/auxiliary/math/m_space.cpp @@ -17,40 +17,6 @@ #include #include -extern "C" void -m_space_relation_invert(struct xrt_space_relation *relation, struct xrt_space_relation *out_relation) -{ - assert(relation != NULL); - assert(out_relation != NULL); - - out_relation->relation_flags = relation->relation_flags; - math_pose_invert(&relation->pose, &out_relation->pose); - out_relation->linear_velocity = m_vec3_mul_scalar(relation->linear_velocity, -1); - out_relation->angular_velocity = m_vec3_mul_scalar(relation->angular_velocity, -1); -} - -extern "C" void -m_space_relation_interpolate(struct xrt_space_relation *a, - struct xrt_space_relation *b, - float t, - enum xrt_space_relation_flags flags, - struct xrt_space_relation *out_relation) -{ - out_relation->relation_flags = flags; - - if (flags & XRT_SPACE_RELATION_ORIENTATION_VALID_BIT) { - math_quat_slerp(&a->pose.orientation, &b->pose.orientation, t, &out_relation->pose.orientation); - } - if (flags & XRT_SPACE_RELATION_POSITION_VALID_BIT) { - out_relation->pose.position = m_vec3_lerp(a->pose.position, b->pose.position, t); - } - if (flags & XRT_SPACE_RELATION_LINEAR_VELOCITY_VALID_BIT) { - out_relation->linear_velocity = m_vec3_lerp(a->linear_velocity, b->linear_velocity, t); - } - if (flags & XRT_SPACE_RELATION_ANGULAR_VELOCITY_VALID_BIT) { - out_relation->angular_velocity = m_vec3_lerp(a->angular_velocity, b->angular_velocity, t); - } -} /* * @@ -324,3 +290,38 @@ m_relation_chain_resolve(const struct xrt_relation_chain *xrc, struct xrt_space_ *out_relation = r; } + +extern "C" void +m_space_relation_invert(struct xrt_space_relation *relation, struct xrt_space_relation *out_relation) +{ + assert(relation != NULL); + assert(out_relation != NULL); + + out_relation->relation_flags = relation->relation_flags; + math_pose_invert(&relation->pose, &out_relation->pose); + out_relation->linear_velocity = m_vec3_mul_scalar(relation->linear_velocity, -1); + out_relation->angular_velocity = m_vec3_mul_scalar(relation->angular_velocity, -1); +} + +extern "C" void +m_space_relation_interpolate(struct xrt_space_relation *a, + struct xrt_space_relation *b, + float t, + enum xrt_space_relation_flags flags, + struct xrt_space_relation *out_relation) +{ + out_relation->relation_flags = flags; + + if (flags & XRT_SPACE_RELATION_ORIENTATION_VALID_BIT) { + math_quat_slerp(&a->pose.orientation, &b->pose.orientation, t, &out_relation->pose.orientation); + } + if (flags & XRT_SPACE_RELATION_POSITION_VALID_BIT) { + out_relation->pose.position = m_vec3_lerp(a->pose.position, b->pose.position, t); + } + if (flags & XRT_SPACE_RELATION_LINEAR_VELOCITY_VALID_BIT) { + out_relation->linear_velocity = m_vec3_lerp(a->linear_velocity, b->linear_velocity, t); + } + if (flags & XRT_SPACE_RELATION_ANGULAR_VELOCITY_VALID_BIT) { + out_relation->angular_velocity = m_vec3_lerp(a->angular_velocity, b->angular_velocity, t); + } +}