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_dot()

Add a function to compute the dot product of 2 quaternions

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

authored by

Jan Schmidt and committed by
Marge Bot
ab5b21de 36eaad64

+14
+14
src/xrt/auxiliary/math/m_api.h
··· 293 293 math_quat_len(const struct xrt_quat *quat); 294 294 295 295 /*! 296 + * The dot product of 2 quaternions. It has a analogous interpretation 297 + * as for vec3. For unit quaternions, it provides cos(theta) of the 298 + * angle between the 2 quaternion rotations. 299 + * 300 + * @relates xrt_quat 301 + * @ingroup aux_math 302 + */ 303 + static inline float 304 + math_quat_dot(const struct xrt_quat *l, const struct xrt_quat *r) 305 + { 306 + return l->x * r->x + l->y * r->y + l->z * r->z + l->w * r->w; 307 + } 308 + 309 + /*! 296 310 * Normalize a quaternion. 297 311 * 298 312 * @relates xrt_quat