C++ Java Unity
C++ Reference
Vuforia::Tool Namespace Reference

Various geometry and linear algebra utility functions. More...

Functions

VUFORIA_API Matrix44F convertPose2GLMatrix (const Matrix34F &pose)
 Convert a 3x4 Vuforia pose matrix to an 4x4 column-major OpenGL model-view matrix. More...
 
VUFORIA_API Matrix44F convert2GLMatrix (const Matrix34F &matrix34F)
 Convert a 3x4 Vuforia matrix to an 4x4 column-major OpenGL matrix. More...
 
VUFORIA_API Matrix44F convertPerspectiveProjection2GLMatrix (const Matrix34F &projection, float nearPlane, float farPlane)
 Convert a 3x4 Vuforia perspective projection matrix to a 4x4 column-major OpenGL matrix. More...
 
VUFORIA_API Vec2F projectPoint (const CameraCalibration &calib, const Matrix34F &pose, const Vec3F &point)
 Project a 3D scene point onto a camera image. More...
 
VUFORIA_API Vec2F projectPointToPlaneXY (const CameraCalibration &calib, const Matrix34F &pose, const Vec2F &screenPoint)
 Project a camera coordinate onto a plane with given pose. More...
 
VUFORIA_API Matrix34F multiply (const Matrix34F &matLeft, const Matrix34F &matRight)
 Multiply two Vuforia pose matrices together and return the result. More...
 
VUFORIA_API Matrix44F multiply (const Matrix44F &matLeft, const Matrix44F &matRight)
 Multiply two Vuforia-style 4x4-matrices (row-major order) and return the result. More...
 
VUFORIA_API Vec4F multiply (const Vec4F &vec, const Matrix44F &mat)
 Multiply a vector and a Vuforia-style 4x4-matrix (row-major order) and return the result. More...
 
VUFORIA_API Vec4F multiply (const Matrix44F &mat, const Vec4F &vec)
 Multiply a Vuforia-style 4x4-matrix (row-major order) and a vector and return the result. More...
 
VUFORIA_API Matrix44F multiplyGL (const Matrix44F &matLeft, const Matrix44F &matRight)
 Multiply two OpenGL-style matrices (col-major order) and return the result. More...
 
VUFORIA_API void setTranslation (Matrix34F &pose, const Vec3F &translation)
 Set the translation part of a Vuforia-style 3x4 pose matrix. More...
 
VUFORIA_API void setRotation (Matrix34F &pose, const Vec3F &axis, float angle)
 Set the rotation part of a Vuforia-style 3x4 pose matrix. More...
 
VUFORIA_API void setRotationFromQuaternion (Matrix34F &pose, const Vec4F &quaternion)
 Set the rotation part of a Vuforia-style 3x4 pose matrix. More...
 

Detailed Description

Various geometry and linear algebra utility functions.

Function Documentation

VUFORIA_API Matrix44F Vuforia::Tool::convertPose2GLMatrix ( const Matrix34F pose)

Convert a 3x4 Vuforia pose matrix to an 4x4 column-major OpenGL model-view matrix.

Vuforia uses 3x4 row-major matrices for pose data. This function takes such a pose matrix (rotation, translation) and returns an OpenGL-compatible model-view matrix.

VUFORIA_API Matrix44F Vuforia::Tool::convert2GLMatrix ( const Matrix34F matrix34F)

Convert a 3x4 Vuforia matrix to an 4x4 column-major OpenGL matrix.

Vuforia uses 3x4 row-major matrices. This function takes such a matrix (which may or may not represent a transformation/pose) and returns an OpenGL-compatible matrix.

VUFORIA_API Matrix44F Vuforia::Tool::convertPerspectiveProjection2GLMatrix ( const Matrix34F projection,
float  nearPlane,
float  farPlane 
)

Convert a 3x4 Vuforia perspective projection matrix to a 4x4 column-major OpenGL matrix.

Vuforia uses 3x4 row-major matrices for perspective projection data. This function takes such a perspective projection matrix and returns an OpenGL-compatible perspective projection matrix using the given near and far planes.

VUFORIA_API Vec2F Vuforia::Tool::projectPoint ( const CameraCalibration calib,
const Matrix34F pose,
const Vec3F point 
)

Project a 3D scene point onto a camera image.

This function takes a 3D point in scene coordinates and transforms it using the given pose matrix, then projects it onto the camera image and returns the result in pixel coordinates.

Parameters
calibThe camera calibration, used to compensate for visual distortion
poseThe pose matrix to use to transform the point.
pointA point in the same space as the pose matrix that you want to transform to camera coordinates.
Returns
A point in the camera image, in device coordinates (pixels).
Note
Because the camera resolution and screen resolution can be different, camera coordinates are usually not the same as screen coordinates. If you need screen coordinates, apply another transformation using the same VideoBackgroundConfig data as you used for Renderer::setVideoBackgroundConfig() to convert camera pixel coordinates to screen pixel coordinates.
VUFORIA_API Vec2F Vuforia::Tool::projectPointToPlaneXY ( const CameraCalibration calib,
const Matrix34F pose,
const Vec2F screenPoint 
)

Project a camera coordinate onto a plane with given pose.

Parameters
calibThe camera calibration, used to compensate for visual distortion
poseA pose matrix describing the origin and orientation of the plane (the plane itself occupies on the X-Y axes with normal in the Z axis direction)
screenPointThe point to project, in camera coordinates (not the same as screen coordinates - see projectPoint())
Returns
An point in the coordinates of the plane (i.e. an offset from the origin in the X-Y plane) that corresponds to the input screenPoint.
VUFORIA_API Matrix34F Vuforia::Tool::multiply ( const Matrix34F matLeft,
const Matrix34F matRight 
)

Multiply two Vuforia pose matrices together and return the result.

In order to apply a transformation A on top of a transformation B, perform: multiply(B,A).

VUFORIA_API Matrix44F Vuforia::Tool::multiply ( const Matrix44F matLeft,
const Matrix44F matRight 
)

Multiply two Vuforia-style 4x4-matrices (row-major order) and return the result.

VUFORIA_API Vec4F Vuforia::Tool::multiply ( const Vec4F vec,
const Matrix44F mat 
)

Multiply a vector and a Vuforia-style 4x4-matrix (row-major order) and return the result.

VUFORIA_API Vec4F Vuforia::Tool::multiply ( const Matrix44F mat,
const Vec4F vec 
)

Multiply a Vuforia-style 4x4-matrix (row-major order) and a vector and return the result.

VUFORIA_API Matrix44F Vuforia::Tool::multiplyGL ( const Matrix44F matLeft,
const Matrix44F matRight 
)

Multiply two OpenGL-style matrices (col-major order) and return the result.

VUFORIA_API void Vuforia::Tool::setTranslation ( Matrix34F pose,
const Vec3F translation 
)

Set the translation part of a Vuforia-style 3x4 pose matrix.

VUFORIA_API void Vuforia::Tool::setRotation ( Matrix34F pose,
const Vec3F axis,
float  angle 
)

Set the rotation part of a Vuforia-style 3x4 pose matrix.

Parameters
poseThe pose matrix on which the rotation should be set.
axisThe 3D axis around which the pose should rotate
angleThe angle to rotate around the axis, in degrees.
VUFORIA_API void Vuforia::Tool::setRotationFromQuaternion ( Matrix34F pose,
const Vec4F quaternion 
)

Set the rotation part of a Vuforia-style 3x4 pose matrix.

Parameters
poseThe pose matrix on which the rotation should be set.
quaternionA 4D vector describing the rotation to set as a quaternion (x, y, z, w)