All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Loading...
Searching...
No Matches
Math Utilities

Functions

VuVector2F vuZeroVector2F ()
 Get a 2D zero vector (0,0)
 
VuVector2F vuOneVector2F ()
 Get a 2D one vector (1,1)
 
VuVector2F vuVector2FNegate (VuVector2F v)
 Negate a 2D vector.
 
VuVector2F vuVector2FAbs (VuVector2F v)
 Get the absolute vector of a 2D vector.
 
float vuVector2FMag (VuVector2F v)
 Compute the Euclidian norm of a 2D vector.
 
float vuVector2FMagSquared (VuVector2F v)
 Compute the Squared Euclidian norm of a 2D vector.
 
VuVector2F vuVector2FNormalize (VuVector2F v)
 Get a normalized 2D vector.
 
VuVector2F vuVector2FScale (VuVector2F v, float s)
 Multiply a 2D vector by a scalar value.
 
VuVector2F vuVector2FAdd (VuVector2F v1, VuVector2F v2)
 Get the sum of two 2D vectors.
 
VuVector2F vuVector2FSub (VuVector2F v1, VuVector2F v2)
 Get the difference of two 2D vectors.
 
float vuVector2FAngle (VuVector2F v1, VuVector2F v2)
 Compute the angle between two 2D vectors in degrees.
 
float vuVector2FDist (VuVector2F v1, VuVector2F v2)
 Compute the Euclidean distance between two 2D vectors.
 
VuVector2F vuVector2FLerp (VuVector2F v1, VuVector2F v2, float t)
 Compute the linear interpolation between two 2D vectors.
 
float vuVector2FDot (VuVector2F v1, VuVector2F v2)
 Compute the dot product of two 2D vectors.
 
VuVector3F vuZeroVector3F ()
 Get a 3D zero vector (0,0,0)
 
VuVector3F vuOneVector3F ()
 Get a 3D one vector (1,1,1)
 
VuVector3F vuVector2FToVector3F (VuVector2F v)
 Convert a 2D vector to a 3D vector (insert 0 as the last component)
 
VuVector3F vuVector3FNegate (VuVector3F v)
 Negate a 3D vector.
 
VuVector3F vuVector3FAbs (VuVector3F v)
 Get the absolute vector of a 3D vector.
 
float vuVector3FMag (VuVector3F v)
 Compute the Euclidian norm of a 3D vector.
 
float vuVector3FMagSquared (VuVector3F v)
 Compute the Squared Euclidian norm of a 3D vector.
 
VuVector3F vuVector3FNormalize (VuVector3F v)
 Get a normalized 3D vector.
 
VuVector3F vuVector3FScale (VuVector3F v, float s)
 Multiply a 3D vector by a scalar value.
 
VuVector3F vuVector3FAdd (VuVector3F v1, VuVector3F v2)
 Get the sum of two 3D vectors.
 
VuVector3F vuVector3FSub (VuVector3F v1, VuVector3F v2)
 Get the difference of two 3D vectors.
 
float vuVector3FAngle (VuVector3F v1, VuVector3F v2)
 Compute the angle between two 3D vectors in degrees.
 
float vuVector3FDist (VuVector3F v1, VuVector3F v2)
 Compute the Euclidean distance between two 3D vectors.
 
VuVector3F vuVector3FLerp (VuVector3F v1, VuVector3F v2, float t)
 Compute the linear interpolation between two 3D vectors.
 
float vuVector3FDot (VuVector3F v1, VuVector3F v2)
 Compute the dot product of two 3D vectors.
 
VuVector3F vuVector3FCross (VuVector3F v1, VuVector3F v2)
 Compute the cross product of two 3D vectors.
 
VuVector3F vuVector3FTransform (VuMatrix44F m, VuVector3F v)
 Transform a 3D vector by a 4x4 matrix.
 
VuVector3F vuVector3FTransformR (VuVector3F v, VuMatrix44F m)
 Transform a 3D vector by a 4x4 matrix.
 
VuVector3F vuVector3FTransformNormal (VuMatrix44F m, VuVector3F v)
 Transform a normal by a 4x4 matrix (rotation only)
 
VuVector3F vuVector3FTransformNormalR (VuVector3F v, VuMatrix44F m)
 Transform a normal by a 4x4 matrix (rotation only)
 
VuVector4F vuZeroVector4F ()
 Get a 4D zero vector (0,0,0,0)
 
VuVector4F vuOneVector4F ()
 Get a 4D one vector (1,1,1,1)
 
VuVector4F vuVector4FNegate (VuVector4F v)
 Negate a 4D vector.
 
VuVector4F vuVector4FAbs (VuVector4F v)
 Get the absolute vector of a 4D vector.
 
float vuVector4FMag (VuVector4F v)
 Compute the Euclidian norm of a 4D vector.
 
float vuVector4FMagSquared (VuVector4F v)
 Compute the Squared Euclidian norm of a 4D vector.
 
VuVector4F vuVector4FNormalize (VuVector4F v)
 Get a normalized 4D vector.
 
VuVector4F vuVector4FScale (VuVector4F v, float s)
 Multiply a 4D vector by a scalar value.
 
VuVector4F vuVector4FAdd (VuVector4F v1, VuVector4F v2)
 Get the sum of two 4D vectors.
 
VuVector4F vuVector4FSub (VuVector4F v1, VuVector4F v2)
 Get the difference of two 4D vectors.
 
float vuVector4FDist (VuVector4F v1, VuVector4F v2)
 Compute the Euclidean distance between two 4D vectors.
 
VuVector4F vuVector4FLerp (VuVector4F v1, VuVector4F v2, float t)
 Compute the linear interpolation between two 4D vectors.
 
float vuVector4FDot (VuVector4F v1, VuVector4F v2)
 Compute the dot product of two 4D vectors.
 
VuVector4F vuVector4FTransform (VuMatrix44F m, VuVector4F v)
 Transform a 4D vector by a 4x4 matrix.
 
VuVector4F vuVector4FTransformR (VuVector4F v, VuMatrix44F m)
 Transform a 4D vector by 4x4 matrix and return the result.
 
VuVector8F vuZeroVector8F ()
 Get an 8D zero vector (0,0,0,0,0,0,0,0)
 
VuVector8F vuOneVector8F ()
 Get an 8D one vector (1,1,1,1,1,1,1,1)
 
VuMatrix33F vuZeroMatrix33F ()
 Get a 3x3 zero matrix.
 
VuMatrix33F vuIdentityMatrix33F ()
 Get a 3x3 identity matrix.
 
VuMatrix44F vuZeroMatrix44F ()
 Get a 4x4 zero matrix.
 
VuMatrix44F vuIdentityMatrix44F ()
 Get a 4x4 identity matrix.
 
VuBool vuMatrix44FIsIdentity (VuMatrix44F m)
 Check whether the 4x4 matrix is an identity matrix.
 
VuMatrix44F vuMatrix44FTranspose (VuMatrix44F m)
 Get the transpose of a 4x4 matrix.
 
float vuMatrix44FDeterminant (VuMatrix44F m)
 Get the determinant of a 4x4 matrix.
 
VuMatrix44F vuMatrix44FInverse (VuMatrix44F m)
 Get the inverse of a 4x4 matrix.
 
VuMatrix44F vuMatrix44FRotationMatrix (float angle, VuVector3F axis)
 Get a rotation matrix specified by axis-angle rotation (angle is in degrees)
 
VuMatrix44F vuMatrix44FTranslationMatrix (VuVector3F trans)
 Get a translation matrix specified by a translation vector.
 
VuMatrix44F vuMatrix44FScalingMatrix (VuVector3F scale)
 Get a scaling matrix specified by a scale vector.
 
VuMatrix44F vuMatrix44FTRSMatrix (VuVector3F trans, float angle, VuVector3F axis, VuVector3F scale)
 Get a transformation matrix composed of a translation vector, axis-angle rotation, and scaling vector.
 
VuMatrix44F vuMatrix44FPoseQuatMatrix (VuVector3F trans, VuVector4F quat)
 Get a transformation matrix composed of a translation vector and rotation (quaternion)
 
VuMatrix44F vuMatrix44FTranslate (VuVector3F trans, VuMatrix44F m)
 Translate a matrix by a vector and return the result.
 
VuMatrix44F vuMatrix44FRotate (float angle, VuVector3F axis, VuMatrix44F m)
 Rotate a matrix by a given axis/angle rotation (angle is in degrees)
 
VuMatrix44F vuMatrix44FScale (VuVector3F scale, VuMatrix44F m)
 Scale a matrix by a scalig vector.
 
VuMatrix44F vuMatrix44FPerspective (float fovy, float aspectRatio, float nearPlane, float farPlane)
 Create a perspective projection matrix immediately suitable for rendering in OpenGL (Z axis pointing towards the viewer)
 
VuMatrix44F vuMatrix44FOrthographic (float left, float right, float bottom, float top, float nearPlane, float farPlane)
 Create an orthographic projection matrix immediately suitable for rendering in OpenGL (Z axis pointing towards the viewer)
 
VuMatrix44F vuMatrix44FLookAt (VuVector3F eye, VuVector3F target, VuVector3F up)
 Create a "look-at" view matrix immediately suitable for rendering in OpenGL.
 
VuMatrix44F vuMatrix44FMultiplyMatrix (VuMatrix44F mA, VuMatrix44F mB)
 Multiply the two 4x4 matrices A and B and return (mA * mB)
 
void vuMatrix44FGetPoseRot (VuMatrix44F m, VuVector3F *trans, VuVector3F *axis, float *angle)
 Extract translation and rotation (axis-angle; angle is in degrees) from a 4x4 matrix.
 
void vuMatrix44FGetPoseQuat (VuMatrix44F m, VuVector3F *trans, VuVector4F *quat)
 Extract translation and rotation (quaternion) from a 4x4 matrix.
 
void vuMatrix44FGetTRS (VuMatrix44F m, VuVector3F *trans, VuVector3F *axis, float *angle, VuVector3F *scale)
 Decompose a 4x4 matrix into translation, rotation and non-uniform scale components.
 
void vuMatrix44FGetTRSQuat (VuMatrix44F m, VuVector3F *trans, VuVector4F *quat, VuVector3F *scale)
 Decompose a 4x4 matrix into translation, rotation and non-uniform scale components.
 

Detailed Description

Linear algebra-related data types and functions used by Vuforia Engine

Function Documentation

◆ vuVector2FNegate()

VuVector2F vuVector2FNegate ( VuVector2F v)

Negate a 2D vector.

Note
result = -v

◆ vuVector2FAbs()

VuVector2F vuVector2FAbs ( VuVector2F v)

Get the absolute vector of a 2D vector.

Note
result = |v|

◆ vuVector2FMag()

float vuVector2FMag ( VuVector2F v)

Compute the Euclidian norm of a 2D vector.

Note
result = ||v||

◆ vuVector2FMagSquared()

float vuVector2FMagSquared ( VuVector2F v)

Compute the Squared Euclidian norm of a 2D vector.

Note
result = ||v||^2

◆ vuVector2FNormalize()

VuVector2F vuVector2FNormalize ( VuVector2F v)

Get a normalized 2D vector.

Note
result = v/||v||

◆ vuVector2FScale()

VuVector2F vuVector2FScale ( VuVector2F v,
float s )

Multiply a 2D vector by a scalar value.

Note
result = v * s

◆ vuVector2FAdd()

VuVector2F vuVector2FAdd ( VuVector2F v1,
VuVector2F v2 )

Get the sum of two 2D vectors.

Note
result = v1 + v2

◆ vuVector2FSub()

VuVector2F vuVector2FSub ( VuVector2F v1,
VuVector2F v2 )

Get the difference of two 2D vectors.

Note
result = v1 - v2

◆ vuVector2FLerp()

VuVector2F vuVector2FLerp ( VuVector2F v1,
VuVector2F v2,
float t )

Compute the linear interpolation between two 2D vectors.

Note
result = v1*t+(1-t)*v2

◆ vuVector2FDot()

float vuVector2FDot ( VuVector2F v1,
VuVector2F v2 )

Compute the dot product of two 2D vectors.

Note
result = v1.v2

◆ vuVector3FNegate()

VuVector3F vuVector3FNegate ( VuVector3F v)

Negate a 3D vector.

Note
result = -v

◆ vuVector3FAbs()

VuVector3F vuVector3FAbs ( VuVector3F v)

Get the absolute vector of a 3D vector.

Note
result = |v|

◆ vuVector3FMag()

float vuVector3FMag ( VuVector3F v)

Compute the Euclidian norm of a 3D vector.

Note
result = ||v||

◆ vuVector3FMagSquared()

float vuVector3FMagSquared ( VuVector3F v)

Compute the Squared Euclidian norm of a 3D vector.

Note
result = ||v||^2

◆ vuVector3FNormalize()

VuVector3F vuVector3FNormalize ( VuVector3F v)

Get a normalized 3D vector.

Note
result = v/||v||

◆ vuVector3FScale()

VuVector3F vuVector3FScale ( VuVector3F v,
float s )

Multiply a 3D vector by a scalar value.

Note
result = v * s

◆ vuVector3FAdd()

VuVector3F vuVector3FAdd ( VuVector3F v1,
VuVector3F v2 )

Get the sum of two 3D vectors.

Note
result = v1 + v2

◆ vuVector3FSub()

VuVector3F vuVector3FSub ( VuVector3F v1,
VuVector3F v2 )

Get the difference of two 3D vectors.

Note
result = v1 - v2

◆ vuVector3FLerp()

VuVector3F vuVector3FLerp ( VuVector3F v1,
VuVector3F v2,
float t )

Compute the linear interpolation between two 3D vectors.

Note
result = v1*t+(1-t)*v2

◆ vuVector3FDot()

float vuVector3FDot ( VuVector3F v1,
VuVector3F v2 )

Compute the dot product of two 3D vectors.

Note
result = v1.v2

◆ vuVector3FCross()

VuVector3F vuVector3FCross ( VuVector3F v1,
VuVector3F v2 )

Compute the cross product of two 3D vectors.

Note
result = v1 x v2

◆ vuVector3FTransform()

VuVector3F vuVector3FTransform ( VuMatrix44F m,
VuVector3F v )

Transform a 3D vector by a 4x4 matrix.

Note
result = m * v (pre-multiply)

◆ vuVector3FTransformR()

VuVector3F vuVector3FTransformR ( VuVector3F v,
VuMatrix44F m )

Transform a 3D vector by a 4x4 matrix.

Note
result = v * m (post-multiply)

◆ vuVector3FTransformNormal()

VuVector3F vuVector3FTransformNormal ( VuMatrix44F m,
VuVector3F v )

Transform a normal by a 4x4 matrix (rotation only)

Note
result = m * v (pre-multiply)

◆ vuVector3FTransformNormalR()

VuVector3F vuVector3FTransformNormalR ( VuVector3F v,
VuMatrix44F m )

Transform a normal by a 4x4 matrix (rotation only)

Note
result = v * m (post-multiply)

◆ vuVector4FNegate()

VuVector4F vuVector4FNegate ( VuVector4F v)

Negate a 4D vector.

Note
result = -v

◆ vuVector4FAbs()

VuVector4F vuVector4FAbs ( VuVector4F v)

Get the absolute vector of a 4D vector.

Note
result = |v|

◆ vuVector4FMag()

float vuVector4FMag ( VuVector4F v)

Compute the Euclidian norm of a 4D vector.

Note
result = ||v||

◆ vuVector4FMagSquared()

float vuVector4FMagSquared ( VuVector4F v)

Compute the Squared Euclidian norm of a 4D vector.

Note
result = ||v||^2

◆ vuVector4FNormalize()

VuVector4F vuVector4FNormalize ( VuVector4F v)

Get a normalized 4D vector.

Note
result = v/||v||

◆ vuVector4FScale()

VuVector4F vuVector4FScale ( VuVector4F v,
float s )

Multiply a 4D vector by a scalar value.

Note
result = v * s

◆ vuVector4FAdd()

VuVector4F vuVector4FAdd ( VuVector4F v1,
VuVector4F v2 )

Get the sum of two 4D vectors.

Note
result = v1 + v2

◆ vuVector4FSub()

VuVector4F vuVector4FSub ( VuVector4F v1,
VuVector4F v2 )

Get the difference of two 4D vectors.

Note
result = v1 - v2

◆ vuVector4FLerp()

VuVector4F vuVector4FLerp ( VuVector4F v1,
VuVector4F v2,
float t )

Compute the linear interpolation between two 4D vectors.

Note
result = v1*t+(1-t)*v2

◆ vuVector4FDot()

float vuVector4FDot ( VuVector4F v1,
VuVector4F v2 )

Compute the dot product of two 4D vectors.

Note
result = v1.v2

◆ vuVector4FTransform()

VuVector4F vuVector4FTransform ( VuMatrix44F m,
VuVector4F v )

Transform a 4D vector by a 4x4 matrix.

Note
result = m * v (pre-multiply)

◆ vuVector4FTransformR()

VuVector4F vuVector4FTransformR ( VuVector4F v,
VuMatrix44F m )

Transform a 4D vector by 4x4 matrix and return the result.

Note
result = v * m (post-multiply)

◆ vuMatrix44FTRSMatrix()

VuMatrix44F vuMatrix44FTRSMatrix ( VuVector3F trans,
float angle,
VuVector3F axis,
VuVector3F scale )

Get a transformation matrix composed of a translation vector, axis-angle rotation, and scaling vector.

Note
result = T(trans) * R(angle, axis) * S(scale)

◆ vuMatrix44FPoseQuatMatrix()

VuMatrix44F vuMatrix44FPoseQuatMatrix ( VuVector3F trans,
VuVector4F quat )

Get a transformation matrix composed of a translation vector and rotation (quaternion)

Parameters
transInput translation vector
quatInput rotation as quaternion in [x y z w] order
Returns
The resulting transformation matrix

◆ vuMatrix44FTranslate()

VuMatrix44F vuMatrix44FTranslate ( VuVector3F trans,
VuMatrix44F m )

Translate a matrix by a vector and return the result.

Note
The resulting matrix is post-multiplied: result = M * T(trans)

◆ vuMatrix44FRotate()

VuMatrix44F vuMatrix44FRotate ( float angle,
VuVector3F axis,
VuMatrix44F m )

Rotate a matrix by a given axis/angle rotation (angle is in degrees)

Note
The result is post-multiplied: result = M * R(angle, axis)

◆ vuMatrix44FScale()

VuMatrix44F vuMatrix44FScale ( VuVector3F scale,
VuMatrix44F m )

Scale a matrix by a scalig vector.

Note
The result is post-multiplied: result = M * S (scale)

◆ vuMatrix44FPerspective()

VuMatrix44F vuMatrix44FPerspective ( float fovy,
float aspectRatio,
float nearPlane,
float farPlane )

Create a perspective projection matrix immediately suitable for rendering in OpenGL (Z axis pointing towards the viewer)

Parameters
fovyField of view half angle in degrees in the y direction
aspectRatioAspect ratio that determines the field of view in the x direction
nearPlaneNear clipping plane
farPlaneFar clipping plane
Returns
Perspective projection matrix

◆ vuMatrix44FOrthographic()

VuMatrix44F vuMatrix44FOrthographic ( float left,
float right,
float bottom,
float top,
float nearPlane,
float farPlane )

Create an orthographic projection matrix immediately suitable for rendering in OpenGL (Z axis pointing towards the viewer)

Parameters
leftCoordinates for the left vertical clipping planes
rightCoordinates for the right vertical clipping planes
bottomCoordinates for the bottom horizontal clipping planes
topCoordinates for the top horizontal clipping planes
nearPlaneNear clipping plane
farPlaneFar clipping plane
Returns
Orthographic projection matrix

◆ vuMatrix44FLookAt()

VuMatrix44F vuMatrix44FLookAt ( VuVector3F eye,
VuVector3F target,
VuVector3F up )

Create a "look-at" view matrix immediately suitable for rendering in OpenGL.

Parameters
eyeCoordinates of the eye point's position
targetCoordinates of the reference point's position indicating the center of the scene
upDirection of the up vector
Returns
View matrix

◆ vuMatrix44FGetPoseRot()

void vuMatrix44FGetPoseRot ( VuMatrix44F m,
VuVector3F * trans,
VuVector3F * axis,
float * angle )

Extract translation and rotation (axis-angle; angle is in degrees) from a 4x4 matrix.

Parameters
mInput matrix
transOutput translation vector
axisOutput axis of rotation (axis-angle)
angleOutput angle of rotation in degrees (axis-angle)

◆ vuMatrix44FGetPoseQuat()

void vuMatrix44FGetPoseQuat ( VuMatrix44F m,
VuVector3F * trans,
VuVector4F * quat )

Extract translation and rotation (quaternion) from a 4x4 matrix.

Parameters
mInput matrix
transOutput translation vector
quatOutput rotation as quaternion in [x y z w] order

◆ vuMatrix44FGetTRS()

void vuMatrix44FGetTRS ( VuMatrix44F m,
VuVector3F * trans,
VuVector3F * axis,
float * angle,
VuVector3F * scale )

Decompose a 4x4 matrix into translation, rotation and non-uniform scale components.

Decomposes the matrix M such that M = T(trans) * R(angle, axis) * S(scale). M must be decomposable into T, R and S only and therefore must not contain shear/skew components and the bottom row must be of form [0 0 0 w] where w != 0. Since scale decomposition is ambiguous, the function will return a scale vector having at most one negative entry.

Parameters
mInput matrix
transOutput translation vector
angleOutput rotation angle in degrees
axisOutput rotation axis (normalized)
scaleOutput vector containing the diagonal entries of a scale matrix S
See also
vuMatrix44FTRSMatrix

◆ vuMatrix44FGetTRSQuat()

void vuMatrix44FGetTRSQuat ( VuMatrix44F m,
VuVector3F * trans,
VuVector4F * quat,
VuVector3F * scale )

Decompose a 4x4 matrix into translation, rotation and non-uniform scale components.

Decomposes the matrix M such that M = T(trans) * R(quat) * S(scale). M must be decomposable into T, R and S only and therefore must not contain shear/skew components and the bottom row must be of form [0 0 0 w] where w != 0. Since scale decomposition is ambiguous, the function will return a scale vector having at most one negative entry.

Parameters
mInput matrix
transOutput translation vector
quatOutput rotation as a normalized quaternion in [x y z w] order
scaleOutput vector containing the diagonal entries of a scale matrix S
See also
vuMatrix44FTRSMatrix