mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-29 18:08:29 +00:00
a/math: Add math_quat_from_vec_a_to_vec_b()
Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2188>
This commit is contained in:
parent
4555f5e7f9
commit
36eaad6419
|
@ -245,6 +245,17 @@ math_quat_from_matrix_3x3(const struct xrt_matrix_3x3 *mat, struct xrt_quat *res
|
|||
void
|
||||
math_quat_from_plus_x_z(const struct xrt_vec3 *plus_x, const struct xrt_vec3 *plus_z, struct xrt_quat *result);
|
||||
|
||||
/*!
|
||||
* Create a rotation from two vectors vec_a and vec_b that would
|
||||
* rotate vec_a into vec_b
|
||||
*
|
||||
* @relates xrt_quat
|
||||
* @see xrt_vec3
|
||||
* @ingroup aux_math
|
||||
*/
|
||||
void
|
||||
math_quat_from_vec_a_to_vec_b(const struct xrt_vec3 *vec_a, const struct xrt_vec3 *vec_b, struct xrt_quat *result);
|
||||
|
||||
/*!
|
||||
* Check if this quat can be used in transformation operations.
|
||||
*
|
||||
|
|
|
@ -253,6 +253,12 @@ math_quat_from_plus_x_z(const struct xrt_vec3 *plus_x, const struct xrt_vec3 *pl
|
|||
math_quat_from_matrix_3x3(&m, result);
|
||||
}
|
||||
|
||||
extern "C" void
|
||||
math_quat_from_vec_a_to_vec_b(const struct xrt_vec3 *vec_a, const struct xrt_vec3 *vec_b, struct xrt_quat *result)
|
||||
{
|
||||
map_quat(*result) = Eigen::Quaternionf::FromTwoVectors(copy(vec_a), copy(vec_b));
|
||||
}
|
||||
|
||||
static bool
|
||||
quat_validate(const float precision, const struct xrt_quat *quat)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue