···9797 return Eigen::Map<Eigen::Matrix4f>(m.v);
9898}
9999100100+/*!
101101+ * @brief Wrap an internal 4x4 matrix f64 struct in an Eigen type, const overload.
102102+ *
103103+ * Permits zero-overhead manipulation of `const xrt_matrix_4x4_f64&` by Eigen routines as if it were a
104104+ * `const Eigen::Matrix4d&`.
105105+ */
106106+static inline Eigen::Map<const Eigen::Matrix4d>
107107+map_matrix_4x4_f64(const struct xrt_matrix_4x4_f64 &m)
108108+{
109109+ return Eigen::Map<const Eigen::Matrix4d>(m.v);
110110+}
111111+112112+/*!
113113+ * @brief Wrap an internal 4x4 matrix struct in an Eigen type, non-const overload.
114114+ *
115115+ * Permits zero-overhead manipulation of `xrt_matrix_4x4_f64&` by Eigen routines as if it were a `Eigen::Matrix4d&`.
116116+ */
117117+static inline Eigen::Map<Eigen::Matrix4d>
118118+map_matrix_4x4_f64(struct xrt_matrix_4x4_f64 &m)
119119+{
120120+ return Eigen::Map<Eigen::Matrix4d>(m.v);
121121+}
122122+123123+100124/*
101125 *
102126 * Pose deconstruction helpers.
+100
src/xrt/auxiliary/math/m_matrix_4x4_f64.h
···11+// Copyright 2019-2021, Collabora, Ltd.
22+// SPDX-License-Identifier: BSL-1.0
33+/*!
44+ * @file
55+ * @brief C matrix 4x4 f64 math library.
66+ * @author Jakob Bornecrantz <jakob@collabora.com>
77+ *
88+ * @see xrt_matrix_4x4_f64
99+ * @ingroup aux_math
1010+ */
1111+1212+#pragma once
1313+1414+#include "xrt/xrt_defines.h"
1515+1616+#include "m_mathinclude.h"
1717+1818+1919+#ifdef __cplusplus
2020+extern "C" {
2121+#endif
2222+2323+2424+/*!
2525+ * Initialize Matrix4x4 F64 with identity.
2626+ *
2727+ * @relates xrt_matrix_4x4_f64
2828+ * @ingroup aux_math
2929+ */
3030+void
3131+m_mat4_f64_identity(struct xrt_matrix_4x4_f64 *result);
3232+3333+/*!
3434+ * Invert a Matrix4x4 F64.
3535+ *
3636+ * @relates xrt_matrix_4x4_f64
3737+ * @ingroup aux_math
3838+ */
3939+void
4040+m_mat4_f64_invert(const struct xrt_matrix_4x4_f64 *matrix, struct xrt_matrix_4x4_f64 *result);
4141+4242+/*!
4343+ * Multiply Matrix4x4 F64.
4444+ *
4545+ * @relates xrt_matrix_4x4_f64
4646+ * @ingroup aux_math
4747+ */
4848+void
4949+m_mat4_f64_multiply(const struct xrt_matrix_4x4_f64 *left,
5050+ const struct xrt_matrix_4x4_f64 *right,
5151+ struct xrt_matrix_4x4_f64 *result);
5252+5353+/*!
5454+ * Initialize Matrix4x4 F64 with a orientation.
5555+ *
5656+ * @relates xrt_matrix_4x4_f64
5757+ * @ingroup aux_math
5858+ */
5959+void
6060+m_mat4_f64_orientation(const struct xrt_quat *quat, struct xrt_matrix_4x4_f64 *result);
6161+6262+/*!
6363+ * Initialize Matrix4x4 F64 with a pose and size that can be used as a model matrix.
6464+ *
6565+ * @relates xrt_matrix_4x4_f64
6666+ * @ingroup aux_math
6767+ */
6868+void
6969+m_mat4_f64_model(const struct xrt_pose *pose, const struct xrt_vec3 *size, struct xrt_matrix_4x4_f64 *result);
7070+7171+/*!
7272+ * Initialize Matrix4x4 F64 with a pose that can be used as a view martix.
7373+ *
7474+ * @relates xrt_matrix_4x4_f64
7575+ * @ingroup aux_math
7676+ */
7777+void
7878+m_mat4_f64_view(const struct xrt_pose *pose, const struct xrt_vec3 *size, struct xrt_matrix_4x4_f64 *result);
7979+8080+8181+#ifdef __cplusplus
8282+}
8383+8484+8585+static inline struct xrt_matrix_4x4_f64 // Until clang-format-11 is on the CI.
8686+operator*(const struct xrt_matrix_4x4_f64 &a, const struct xrt_matrix_4x4_f64 &b)
8787+{
8888+ struct xrt_matrix_4x4_f64 ret = {{0}};
8989+ m_mat4_f64_multiply(&l, &r, &ret);
9090+ return ret;
9191+}
9292+9393+static inline void
9494+operator*=(struct xrt_matrix_4x4_f64 &a, const struct xrt_matrix_4x4_f64 &b)
9595+{
9696+ a = a * b;
9797+}
9898+9999+100100+#endif