OSVR-Core  0.6-1962-g59773924
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Math data structures

Basic structures and conversion utilities for common math entites.This is not intended to be a full math library. It is expected that you convert the values in these structures into your own math types. If you do not yet have a math library, Eigen is highly recommended. More...

Modules

 Matrix conventions and bit flags
 

Namespaces

 osvr::util::eigen_interop
 

Classes

struct  OSVR_Pose3
 A structure defining a 3D (6DOF) rigid body pose: translation and rotation. More...
 
struct  OSVR_Quaternion
 A structure defining a quaternion, often a unit quaternion representing 3D rotation. More...
 
struct  OSVR_RadialDistortionParameters
 Parameters for a per-color-component radial distortion shader. More...
 
struct  OSVR_Vec2
 A structure defining a 2D vector, which represents position. More...
 
struct  OSVR_Vec3
 A structure defining a 3D vector, often a position/translation. More...
 

Typedefs

typedef struct OSVR_Pose3 OSVR_Pose3
 A structure defining a 3D (6DOF) rigid body pose: translation and rotation.
 
typedef struct OSVR_Quaternion OSVR_Quaternion
 A structure defining a quaternion, often a unit quaternion representing 3D rotation.
 
typedef struct
OSVR_RadialDistortionParameters 
OSVR_RadialDistortionParameters
 Parameters for a per-color-component radial distortion shader.
 
typedef struct OSVR_Vec2 OSVR_Vec2
 A structure defining a 2D vector, which represents position.
 
typedef struct OSVR_Vec3 OSVR_Vec3
 A structure defining a 3D vector, often a position/translation.
 

Functions

Eigen::Map< Eigen::Vector3d > osvr::util::vecMap (OSVR_Vec3 &vec)
 Wrap an OSVR_Vec3 in an Eigen object that allows it to interoperate with Eigen as though it were an Eigen::Vector3d. More...
 
Eigen::Map< const Eigen::Vector3d > osvr::util::vecMap (OSVR_Vec3 const &vec)
 
Eigen::Quaterniond osvr::util::fromQuat (OSVR_Quaternion const &q)
 Convert an OSVR_Quaternion to an Eigen::Quaterniond.
 
void osvr::util::toQuat (Eigen::Quaterniond const &src, OSVR_Quaternion &q)
 Convert an Eigen::Quaterniond to a OSVR_Quaternion.
 
Eigen::Isometry3d osvr::util::fromPose (OSVR_Pose3 const &pose)
 Turn an OSVR_Pose3 into an Eigen::Transform. More...
 
void osvr::util::toPose (Eigen::Isometry3d const &xform, OSVR_Pose3 &pose)
 Turn an Eigen::Isometry3d (transform) into an OSVR_Pose3. More...
 
void osvr::util::toPose (Eigen::Matrix4d const &mat, OSVR_Pose3 &pose)
 Turn an Eigen::Matrix4d (transform) into an OSVR_Pose3. More...
 
OSVR_ReturnCode osvrPose3ToMatrixd (OSVR_Pose3 const *pose, OSVR_MatrixConventions flags, double *mat)
 Set a matrix of doubles based on a Pose3. More...
 
OSVR_ReturnCode osvrPose3ToMatrixf (OSVR_Pose3 const *pose, OSVR_MatrixConventions flags, float *mat)
 Set a matrix of floats based on a Pose3. More...
 
void osvrPose3SetIdentity (OSVR_Pose3 *pose)
 Set a pose to identity.
 
double osvrQuatGetW (OSVR_Quaternion const *q)
 Accessor for quaternion component W.
 
void osvrQuatSetW (OSVR_Quaternion *q, double val)
 Setter for quaternion component W.
 
double osvrQuatGetX (OSVR_Quaternion const *q)
 Accessor for quaternion component X.
 
void osvrQuatSetX (OSVR_Quaternion *q, double val)
 Setter for quaternion component X.
 
double osvrQuatGetY (OSVR_Quaternion const *q)
 Accessor for quaternion component Y.
 
void osvrQuatSetY (OSVR_Quaternion *q, double val)
 Setter for quaternion component Y.
 
double osvrQuatGetZ (OSVR_Quaternion const *q)
 Accessor for quaternion component Z.
 
void osvrQuatSetZ (OSVR_Quaternion *q, double val)
 Setter for quaternion component Z.
 
void osvrQuatSetIdentity (OSVR_Quaternion *q)
 Set a quaternion to the identity rotation.
 
double osvrVec2GetX (OSVR_Vec2 const *v)
 Accessor for Vec2 component X.
 
void osvrVec2SetX (OSVR_Vec2 *v, double val)
 Setter for Vec2 component X.
 
double osvrVec2GetY (OSVR_Vec2 const *v)
 Accessor for Vec2 component Y.
 
void osvrVec2SetY (OSVR_Vec2 *v, double val)
 Setter for Vec2 component Y.
 
void osvrVec2Zero (OSVR_Vec2 *v)
 Set a Vec2 to the zero vector.
 
double osvrVec3GetX (OSVR_Vec3 const *v)
 Accessor for Vec3 component X.
 
void osvrVec3SetX (OSVR_Vec3 *v, double val)
 Setter for Vec3 component X.
 
double osvrVec3GetY (OSVR_Vec3 const *v)
 Accessor for Vec3 component Y.
 
void osvrVec3SetY (OSVR_Vec3 *v, double val)
 Setter for Vec3 component Y.
 
double osvrVec3GetZ (OSVR_Vec3 const *v)
 Accessor for Vec3 component Z.
 
void osvrVec3SetZ (OSVR_Vec3 *v, double val)
 Setter for Vec3 component Z.
 
void osvrVec3Zero (OSVR_Vec3 *v)
 Set a Vec3 to the zero vector.
 

Variables

OSVR_Vec3 OSVR_RadialDistortionParameters::k1
 Vector of K1 coefficients for the R, G, B channels.
 
OSVR_Vec2 OSVR_RadialDistortionParameters::centerOfProjection
 Center of projection for the radial distortion, relative to the bounds of this surface.
 

Detailed Description

Basic structures and conversion utilities for common math entites.

This is not intended to be a full math library. It is expected that you convert the values in these structures into your own math types. If you do not yet have a math library, Eigen is highly recommended.

Function Documentation

Eigen::Map<Eigen::Vector3d> osvr::util::vecMap ( OSVR_Vec3 vec)
inline

#include <osvr/Util/EigenInterop.h>

Wrap an OSVR_Vec3 in an Eigen object that allows it to interoperate with Eigen as though it were an Eigen::Vector3d.

Parameters
vecA vector to wrap
Returns
an Eigen::Map allowing use of the OSVR_Vec3 as an Eigen::Vector3d.

Definition at line 52 of file EigenInterop.h.

Eigen::Map<const Eigen::Vector3d> osvr::util::vecMap ( OSVR_Vec3 const &  vec)
inline

#include <osvr/Util/EigenInterop.h>

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. For constant vectors.

Definition at line 58 of file EigenInterop.h.

Eigen::Isometry3d osvr::util::fromPose ( OSVR_Pose3 const &  pose)
inline

#include <osvr/Util/EigenInterop.h>

Turn an OSVR_Pose3 into an Eigen::Transform.

Parameters
poseInput pose
Returns
an Eigen::Isometry3d (convertible to an Eigen::Affine3d) 3-dimensional transform object equivalent to pose.

Definition at line 81 of file EigenInterop.h.

void osvr::util::toPose ( Eigen::Isometry3d const &  xform,
OSVR_Pose3 pose 
)
inline

#include <osvr/Util/EigenInterop.h>

Turn an Eigen::Isometry3d (transform) into an OSVR_Pose3.

Parameters
[in]xformInput transform.
[out]poseDestination to set based on xform.

Definition at line 93 of file EigenInterop.h.

void osvr::util::toPose ( Eigen::Matrix4d const &  mat,
OSVR_Pose3 pose 
)
inline

#include <osvr/Util/EigenInterop.h>

Turn an Eigen::Matrix4d (transform) into an OSVR_Pose3.

Parameters
[in]matInput transform. Assumed to contain only position and orientation.
[out]poseDestination to set based on xform.

Definition at line 104 of file EigenInterop.h.

OSVR_ReturnCode osvrPose3ToMatrixd ( OSVR_Pose3 const *  pose,
OSVR_MatrixConventions  flags,
double *  mat 
)

#include <osvr/Util/MatrixConventionsC.h>

Set a matrix of doubles based on a Pose3.

Parameters
poseThe Pose3 to convert
flagsMemory ordering flag - see Matrix flags
[out]matan array of 16 doubles
OSVR_ReturnCode osvrPose3ToMatrixf ( OSVR_Pose3 const *  pose,
OSVR_MatrixConventions  flags,
float *  mat 
)

#include <osvr/Util/MatrixConventionsC.h>

Set a matrix of floats based on a Pose3.

Parameters
poseThe Pose3 to convert
flagsMemory ordering flag - see Matrix flags
[out]matan array of 16 floats