mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-07 15:46:12 +00:00
aux/math: Add math_quat_slerp()
This commit is contained in:
parent
4581a7a9a6
commit
fabf01ff39
|
@ -290,6 +290,15 @@ void
|
||||||
math_quat_rotate_derivative(const struct xrt_quat *rot, const struct xrt_vec3 *deriv, struct xrt_vec3 *result);
|
math_quat_rotate_derivative(const struct xrt_quat *rot, const struct xrt_vec3 *deriv, struct xrt_vec3 *result);
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Slerp (spherical linear interpolation) between two quaternions
|
||||||
|
*
|
||||||
|
* @relates xrt_quat
|
||||||
|
* @ingroup aux_math
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
math_quat_slerp(const struct xrt_quat *left, const struct xrt_quat *right, float t, struct xrt_quat *result);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* Matrix functions
|
* Matrix functions
|
||||||
|
|
|
@ -299,6 +299,18 @@ math_quat_rotate_derivative(const struct xrt_quat *quat, const struct xrt_vec3 *
|
||||||
*result = ret;
|
*result = ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" void
|
||||||
|
math_quat_slerp(const struct xrt_quat *left, const struct xrt_quat *right, float t, struct xrt_quat *result)
|
||||||
|
{
|
||||||
|
assert(left != NULL);
|
||||||
|
assert(right != NULL);
|
||||||
|
assert(result != NULL);
|
||||||
|
|
||||||
|
auto l = copy(left);
|
||||||
|
auto r = copy(right);
|
||||||
|
|
||||||
|
map_quat(*result) = l.slerp(t, r);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue