Monado OpenXR Runtime
xrt_quat Struct Reference

A quaternion with single floats. More...

#include <xrt/xrt_defines.h>

Collaboration diagram for xrt_quat:

Data Fields

float x
 
float y
 
float z
 
float w
 

Related Functions

(Note that these are not member functions.)

void math_quat_from_angle_vector (float angle_rads, const struct xrt_vec3 *vector, struct xrt_quat *result)
 Create a rotation from an angle in radians and a unit vector. More...
 
void math_quat_from_euler_angles (const struct xrt_vec3 *angles, struct xrt_quat *result)
 Create a rotation from euler angles to a quaternion. More...
 
void math_quat_to_euler_angles (const struct xrt_quat *quat, struct xrt_vec3 *euler_angles)
 Create a rotation from a quaternion to euler angles. More...
 
void math_quat_from_matrix_3x3 (const struct xrt_matrix_3x3 *mat, struct xrt_quat *result)
 Create a rotation from a 3x3 rotation (row major) matrix. More...
 
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 plus x and z, by creating a rotation matrix by crossing z and x to get the y axis. More...
 
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)
 Create a rotation from two vectors vec_a and vec_b that would rotate vec_a into vec_b. More...
 
bool math_quat_validate (const struct xrt_quat *quat)
 Check if this quat can be used in transformation operations. More...
 
bool math_quat_validate_within_1_percent (const struct xrt_quat *quat)
 Check if this quat is within 1% of unit length. More...
 
void math_quat_invert (const struct xrt_quat *quat, struct xrt_quat *out_quat)
 Invert a quaternion. More...
 
float math_quat_len (const struct xrt_quat *quat)
 The euclidean norm or length of a quaternion. More...
 
static float math_quat_dot (const struct xrt_quat *l, const struct xrt_quat *r)
 The dot product of 2 quaternions. More...
 
void math_quat_normalize (struct xrt_quat *inout)
 Normalize a quaternion. More...
 
bool math_quat_ensure_normalized (struct xrt_quat *inout)
 Normalizes a quaternion if it has accumulated float precision errors. More...
 
void math_quat_rotate_vec3 (const struct xrt_quat *left, const struct xrt_vec3 *right, struct xrt_vec3 *result)
 Rotate a vector. More...
 
void math_quat_rotate (const struct xrt_quat *left, const struct xrt_quat *right, struct xrt_quat *result)
 Rotate a quaternion (compose rotations). More...
 
void math_quat_unrotate (const struct xrt_quat *left, const struct xrt_quat *right, struct xrt_quat *result)
 Inverse of math_quat_rotate. More...
 
void math_quat_integrate_velocity (const struct xrt_quat *quat, const struct xrt_vec3 *ang_vel, float dt, struct xrt_quat *result)
 Integrate a local angular velocity vector (exponential map) and apply to a quaternion. More...
 
void math_quat_finite_difference (const struct xrt_quat *quat0, const struct xrt_quat *quat1, float dt, struct xrt_vec3 *out_ang_vel)
 Compute a global angular velocity vector (exponential map format) by taking the finite difference of two quaternions. More...
 
void math_quat_exp (const struct xrt_vec3 *axis_angle, struct xrt_quat *out_quat)
 Takes a rotation vector equal to half of a Rodrigues rotation vector and returns its corresponding unit quaternion. More...
 
void math_quat_ln (const struct xrt_quat *quat, struct xrt_vec3 *out_axis_angle)
 Takes a unit quaternion and returns a rotation vector equal to half of its corresponding Rodrigues rotation vector. More...
 
void math_quat_rotate_derivative (const struct xrt_quat *quat, const struct xrt_vec3 *deriv, struct xrt_vec3 *result)
 Used to rotate a derivative like a angular velocity. More...
 
void math_quat_slerp (const struct xrt_quat *left, const struct xrt_quat *right, float t, struct xrt_quat *result)
 Slerp (spherical linear interpolation) between two quaternions. More...
 
void math_quat_from_swing (const struct xrt_vec2 *swing, struct xrt_quat *result)
 Converts a 2D vector to a quaternion. More...
 
void math_quat_from_swing_twist (const struct xrt_vec2 *swing, const float twist, struct xrt_quat *result)
 Converts a 2D vector and a float to a quaternion. More...
 
void math_quat_to_swing_twist (const struct xrt_quat *in, struct xrt_vec2 *out_swing, float *out_twist)
 Converts a quaternion to XY-swing and Z-twist. More...
 
void math_quat_decompose_swing_twist (const struct xrt_quat *in, const struct xrt_vec3 *twist_axis, struct xrt_quat *swing, struct xrt_quat *twist)
 Decompose a quaternion to swing and twist component rotations around a target axis. More...
 
#define XRT_QUAT_IDENTITY
 Identity value for xrt_quat. More...
 

Detailed Description

A quaternion with single floats.

Friends And Related Function Documentation

◆ XRT_QUAT_IDENTITY

#define XRT_QUAT_IDENTITY
related

The documentation for this struct was generated from the following files: