The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

a/math: Add math_quat_from_vec_a_to_vec_b()

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2188>

authored by

Jan Schmidt and committed by
Marge Bot
36eaad64 4555f5e7

+17
+11
src/xrt/auxiliary/math/m_api.h
··· 246 246 math_quat_from_plus_x_z(const struct xrt_vec3 *plus_x, const struct xrt_vec3 *plus_z, struct xrt_quat *result); 247 247 248 248 /*! 249 + * Create a rotation from two vectors vec_a and vec_b that would 250 + * rotate vec_a into vec_b 251 + * 252 + * @relates xrt_quat 253 + * @see xrt_vec3 254 + * @ingroup aux_math 255 + */ 256 + void 257 + math_quat_from_vec_a_to_vec_b(const struct xrt_vec3 *vec_a, const struct xrt_vec3 *vec_b, struct xrt_quat *result); 258 + 259 + /*! 249 260 * Check if this quat can be used in transformation operations. 250 261 * 251 262 * @relates xrt_quat
+6
src/xrt/auxiliary/math/m_base.cpp
··· 253 253 math_quat_from_matrix_3x3(&m, result); 254 254 } 255 255 256 + extern "C" void 257 + math_quat_from_vec_a_to_vec_b(const struct xrt_vec3 *vec_a, const struct xrt_vec3 *vec_b, struct xrt_quat *result) 258 + { 259 + map_quat(*result) = Eigen::Quaternionf::FromTwoVectors(copy(vec_a), copy(vec_b)); 260 + } 261 + 256 262 static bool 257 263 quat_validate(const float precision, const struct xrt_quat *quat) 258 264 {