# Math

Sony VectorMath library wrapper.

## Typedefs

Type

Description

typedef math::Matrix3

A type definition for a 3×3 matrix based on VectorMath::Matrix3.

typedef math::Matrix4

A type definition for a 4×4 matrix based on VectorMath::Matrix4.

typedef math::Point2

A type definition for a 2 component point based on VectorMath::Point2.

typedef math::Point3

A type definition for a 3 component point based on VectorMath::Point3.

typedef math::Vector2

A type definition for a 2 component vector based on VectorMath::Vector2.

typedef math::Vector3

A type definition for a 3 component vector based on VectorMath::Vector3.

typedef math::Vector4

A type definition for a 4 component vector based on VectorMath::Vector4.

## Functions

Return type

Description

Vec4

cauldron::PolarToVector (float yaw, float pitch)
Converts polar rotation to a vector representation.

const Mat4

cauldron::Perspective ( float fovyRadians, float aspect, float zNear, float zFar, bool invertedDepth )
Construct a perspective projection matrix with an inverted depth argument.

const Mat4

cauldron::Orthographic ( float left, float right, float bottom, float top, float zNear, float zFar, bool invertedDepth )
Construct an orthographic projection matrix with z in range [0, 1].

Mat4

cauldron::InverseMatrix (const Mat4 & srcMatrix)
Returns the inverse of a matrix.

Mat3

cauldron::InverseMatrix (const Mat3 & srcMatrix)
Returns the inverse of a matrix.

Mat4

Construct a matrix positioned at ‘eye’ and rotated to face ‘lookAt’.

Mat4

cauldron::TransposeMatrix (const Mat4 & srcMatrix)
Returns the transpose of a matrix.

Vec4

cauldron::MinPerElement (const Vec4 & vec1, const Vec4 & vec2)
Returns a vector composed of per-element minimums.

Vec4

cauldron::MaxPerElement (const Vec4 & vec1, const Vec4 & vec2)
Returns a vector composed of per-element maximums.

## Detailed description

Sony VectorMath library wrapper.

### Typedefs

#### Mat3

Copied!

``typedef math::Matrix3 Mat3``

A type definition for a 3×3 matrix based on VectorMath::Matrix3.

#### Mat4

Copied!

``typedef math::Matrix4 Mat4``

A type definition for a 4×4 matrix based on VectorMath::Matrix4.

#### Point2

Copied!

``typedef math::Point2 Point2``

A type definition for a 2 component point based on VectorMath::Point2.

#### Point3

Copied!

``typedef math::Point3 Point3``

A type definition for a 3 component point based on VectorMath::Point3.

#### Vec2

Copied!

``typedef math::Vector2 Vec2``

A type definition for a 2 component vector based on VectorMath::Vector2.

#### Vec3

Copied!

``typedef math::Vector3 Vec3``

A type definition for a 3 component vector based on VectorMath::Vector3.

#### Vec4

Copied!

``typedef math::Vector4 Vec4``

A type definition for a 4 component vector based on VectorMath::Vector4.

### Global functions

#### PolarToVector

Copied!

``Vec4  cauldron::PolarToVector (float yaw, float pitch)``

Converts polar rotation to a vector representation.

Parameters:

Returns:

`Vec4` representation of the polar rotation.

#### Perspective

Copied!

``````const Mat4  cauldron::Perspective (
float aspect,
float zNear,
float zFar,
bool invertedDepth
)``````

Construct a perspective projection matrix with an inverted depth argument.

Parameters:

 fovyRadians FOV (in radians). aspect Aspect ratio. zNear Near plane. zFar Far plane. invertedDepth True if using inverted infinite depth.

Returns:

`Mat4` perspective matrix.

#### Orthographic

Copied!

``````const Mat4  cauldron::Orthographic (
float left,
float right,
float bottom,
float top,
float zNear,
float zFar,
bool invertedDepth
)``````

Construct an orthographic projection matrix with z in range [0, 1].

Parameters:

 left Left plane. right Right plane. bottom Bottom plane. top Top plane. zNear Near plane. zFar Far plane. invertedDepth True if using inverted infinite depth.

Returns:

`Mat4` orthographic matrix.

#### InverseMatrix

Copied!

``Mat4  cauldron::InverseMatrix (const Mat4 & srcMatrix)``

Returns the inverse of a matrix.

Parameters:

 srcMatrix The matrix to inverse.

Returns:

`Mat4` inverted matrix.

#### InverseMatrix

Copied!

``Mat3  cauldron::InverseMatrix (const Mat3 & srcMatrix)``

Returns the inverse of a matrix.

Parameters:

 srcMatrix The matrix to inverse.

Returns:

`Mat3` inverted matrix.

#### LookAtMatrix

Copied!

``Mat4  cauldron::LookAtMatrix (Vec4  eye, Vec4  lookAt, Vec4  up)``

Construct a matrix positioned at ‘eye’ and rotated to face ‘lookAt’.

Parameters:

 eye Source (translation). lookAt Look at (direction). up Up vector to orient the matrix properly.

Returns:

`Mat4` matrix.

#### TransposeMatrix

Copied!

``Mat4  cauldron::TransposeMatrix (const Mat4 & srcMatrix)``

Returns the transpose of a matrix.

Parameters:

 srcMatrix The matrix to transpose.

Returns:

`Mat4` transposed matrix.

#### MinPerElement

Copied!

``Vec4  cauldron::MinPerElement (const Vec4 & vec1, const Vec4 & vec2)``

Returns a vector composed of per-element minimums.

Parameters:

 vec1 Vector1. vec2 Vector2.

Returns:

`Vec4` the 4-component vector of minimums per element.

#### MaxPerElement

Copied!

``Vec4  cauldron::MaxPerElement (const Vec4 & vec1, const Vec4 & vec2)``

Returns a vector composed of per-element maximums.

Parameters:

 vec1 Vector1. vec2 Vector2.

Returns:

`Vec4` the 4-component vector of maximums per element.