Monado OpenXR Runtime
Loading...
Searching...
No Matches
openvr_math.cpp File Reference

Implementation of math utilities for OpenVR. More...

#include "openvr_math.hpp"
#include <cstring>
Include dependency graph for openvr_math.cpp:

Functions

void xrt::state_trackers::openvr::xrt_pose_to_openvr_hmd_matrix34 (const xrt_pose &pose, vr::HmdMatrix34_t &openvr_mat)
 Converts an xrt_pose to an OpenVR HmdMatrix34, which is used for representing poses in OpenVR.
 
void xrt::state_trackers::openvr::xrt_matrix_4x4_to_openvr_hmd_matrix34 (const xrt_matrix_4x4 &mat, vr::HmdMatrix34_t &openvr_mat)
 Converts a 4x4 matrix in column-major format (as used by xrt_matrix_4x4) to an OpenVR HmdMatrix34, which is a 3x4 matrix in row-major format.
 
void xrt::state_trackers::openvr::openvr_hmd_matrix34_identity (vr::HmdMatrix34_t &mat)
 Sets an OpenVR HmdMatrix34_t to the identity matrix.
 

Detailed Description

Implementation of math utilities for OpenVR.

Author
Beyley Cardellio ep1cm.nosp@m.1n10.nosp@m.n123@.nosp@m.gmai.nosp@m.l.com

Function Documentation

◆ openvr_hmd_matrix34_identity()

void xrt::state_trackers::openvr::openvr_hmd_matrix34_identity ( vr::HmdMatrix34_t &  mat)

Sets an OpenVR HmdMatrix34_t to the identity matrix.

This is a 3x4 matrix where the upper-left 3x3 portion is the identity rotation, and the rightmost column is the zero translation.

Parameters
matThe OpenVR HmdMatrix34_t to set to the identity matrix.

References xrt::state_trackers::openvr::openvr_hmd_matrix34_identity().

Referenced by xrt::state_trackers::openvr::openvr_hmd_matrix34_identity().

◆ xrt_matrix_4x4_to_openvr_hmd_matrix34()

void xrt::state_trackers::openvr::xrt_matrix_4x4_to_openvr_hmd_matrix34 ( const xrt_matrix_4x4 mat,
vr::HmdMatrix34_t &  openvr_mat 
)

Converts a 4x4 matrix in column-major format (as used by xrt_matrix_4x4) to an OpenVR HmdMatrix34, which is a 3x4 matrix in row-major format.

This involves dropping the last row of the 4x4 matrix, and transposing the data to convert from column-major to row-major.

Parameters
matThe xrt_matrix_4x4 to convert.
openvr_matThe output OpenVR HmdMatrix34_t to write the result into.

References xrt::state_trackers::openvr::xrt_matrix_4x4_to_openvr_hmd_matrix34().

Referenced by xrt::state_trackers::openvr::xrt_matrix_4x4_to_openvr_hmd_matrix34(), and xrt::state_trackers::openvr::xrt_pose_to_openvr_hmd_matrix34().

◆ xrt_pose_to_openvr_hmd_matrix34()

void xrt::state_trackers::openvr::xrt_pose_to_openvr_hmd_matrix34 ( const xrt_pose pose,
vr::HmdMatrix34_t &  openvr_mat 
)

Converts an xrt_pose to an OpenVR HmdMatrix34, which is used for representing poses in OpenVR.

This involves converting the xrt_pose to a 4x4 isometry matrix, and then dropping the last row to fit it into the 3x4 OpenVR format.

Parameters
poseThe xrt_pose to convert.
openvr_matThe output OpenVR HmdMatrix34_t to write the result into.

References xrt::state_trackers::openvr::xrt_matrix_4x4_to_openvr_hmd_matrix34(), and xrt::state_trackers::openvr::xrt_pose_to_openvr_hmd_matrix34().

Referenced by xrt::state_trackers::openvr::xrt_pose_to_openvr_hmd_matrix34().