mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-04 06:06:17 +00:00
math: Make it possible to get a rotation from a rotation matrix
This commit is contained in:
parent
35fcd2ae3d
commit
7618f4c5a4
|
@ -102,6 +102,17 @@ math_vec3_accum(const struct xrt_vec3 *additional, struct xrt_vec3 *inAndOut);
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Create a rotation from a 3x3 rotation matrix.
|
||||||
|
*
|
||||||
|
* @relates xrt_quat
|
||||||
|
* @relates xrt_matrix_3x3
|
||||||
|
* @ingroup aux_math
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
math_quat_from_matrix_3x3(const struct xrt_matrix_3x3 *mat,
|
||||||
|
struct xrt_quat *result);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Check if this quat can be used in transformation operations.
|
* Check if this quat can be used in transformation operations.
|
||||||
*
|
*
|
||||||
|
|
|
@ -81,6 +81,19 @@ math_vec3_accum(const struct xrt_vec3 *additional, struct xrt_vec3 *inAndOut)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" void
|
||||||
|
math_quat_from_matrix_3x3(const struct xrt_matrix_3x3 *mat,
|
||||||
|
struct xrt_quat *result)
|
||||||
|
{
|
||||||
|
Eigen::Matrix3f m;
|
||||||
|
m << mat->v[0], mat->v[1], mat->v[2], mat->v[3], mat->v[4], mat->v[5],
|
||||||
|
mat->v[6], mat->v[7], mat->v[8];
|
||||||
|
|
||||||
|
Eigen::Quaternionf q(m);
|
||||||
|
map_quat(*result) = q;
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" bool
|
extern "C" bool
|
||||||
math_quat_validate(const struct xrt_quat *quat)
|
math_quat_validate(const struct xrt_quat *quat)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue