The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

aux/math: Add function to calculate quad model matrix.

authored by

Lubosz Sarnecki and committed by
Jakob Bornecrantz
fc271ad5 68c5eecb

+27
+11
src/xrt/auxiliary/math/m_api.h
··· 268 268 math_matrix_4x4_view_from_pose(const struct xrt_pose *pose, 269 269 struct xrt_matrix_4x4 *result); 270 270 271 + /*! 272 + * Compute quad layer model matrix from xrt_pose and xrt_vec2 size. 273 + * 274 + * @relates xrt_matrix_4x4 275 + * @ingroup aux_math 276 + */ 277 + void 278 + math_matrix_4x4_quad_model(const struct xrt_pose *pose, 279 + const struct xrt_vec2 *size, 280 + struct xrt_matrix_4x4 *result); 281 + 271 282 /* 272 283 * 273 284 * Pose functions.
+16
src/xrt/auxiliary/math/m_base.cpp
··· 265 265 map_matrix_4x4(*result) = transformation.matrix().inverse(); 266 266 } 267 267 268 + void 269 + math_matrix_4x4_quad_model(const struct xrt_pose *pose, 270 + const struct xrt_vec2 *size, 271 + struct xrt_matrix_4x4 *result) 272 + { 273 + Eigen::Vector3f position = copy(&pose->position); 274 + Eigen::Quaternionf orientation = copy(&pose->orientation); 275 + 276 + auto scale = Eigen::Scaling(size->x, size->y, 1.0f); 277 + 278 + Eigen::Translation3f translation(position); 279 + Eigen::Affine3f transformation = translation * orientation * scale; 280 + 281 + map_matrix_4x4(*result) = transformation.matrix(); 282 + } 283 + 268 284 /* 269 285 * 270 286 * Exported pose functions.