openTRI 0.1
Matrices

Data Structures

union  triMat3
 3D (3x3) Matrix More...
 
union  triMat4
 4D (4x4) Matrix More...
 

Typedefs

typedef union triMat3 triMat3
 3D (3x3) Matrix
 
typedef union triMat3 triMat3f
 
typedef union triMat4 triMat4
 4D (4x4) Matrix
 
typedef union triMat4 triMat4f
 

Functions

triMat4ftriMat4Identity (triMat4f *a)
 Make a matrix identity.
 
triMat4ftriMat4Zero (triMat4f *a)
 Make a matrix zero.
 
triMat4ftriMat4Copy (triMat4f *a, const triMat4f *b)
 Copy a matrix.
 
triMat4ftriMat4Mul (triMat4f *a, const triMat4f *b, const triMat4f *c)
 Matrix multiply (a = b*c).
 
triMat4ftriMat4Inv (triMat4f *a, const triMat4f *b)
 Invert a matrix.
 
triMat4ftriMat4Trans (triMat4f *a, const triMat4f *b)
 Transpose a matrix.
 
triFloat triMat4Det (const triMat4f *a)
 Calculate matrix determinant.
 
triFloat triMat4Trace (const triMat4f *a)
 Calculate matrix trace.
 
triVec4ftriMat4Apply (triVec4f *a, const triMat4f *b, const triVec4f *c)
 4x4 Matrix-Vector multiply (a = b*c).
 
triVec4ftriMat4Apply3 (triVec4f *a, const triMat4f *b, const triVec4f *c)
 3x3 Matrix-Vector multiply (a = b*c).
 

Detailed Description

Function Documentation

◆ triMat4Identity()

triMat4f * triMat4Identity ( triMat4f * a)

Make a matrix identity.

Matrix will contain the following after call:
| 1.0 0.0 0.0 0.0 |
| 0.0 1.0 0.0 0.0 |
| 0.0 0.0 1.0 0.0 |
| 0.0 0.0 0.0 1.0 |

Parameters
a- Pointer to destination matrix
Returns
Pointer to a

◆ triMat4Zero()

triMat4f * triMat4Zero ( triMat4f * a)

Make a matrix zero.

Matrix will contain the following after call:
| 0.0 0.0 0.0 0.0 |
| 0.0 0.0 0.0 0.0 |
| 0.0 0.0 0.0 0.0 |
| 0.0 0.0 0.0 0.0 |

Parameters
a- Pointer to destination matrix
Returns
Pointer to a

◆ triMat4Copy()

triMat4f * triMat4Copy ( triMat4f * a,
const triMat4f * b )

Copy a matrix.

Parameters
a- Pointer to destination matrix
b- Pointer to matrix to be copied
Returns
Pointer to a

◆ triMat4Mul()

triMat4f * triMat4Mul ( triMat4f * a,
const triMat4f * b,
const triMat4f * c )

Matrix multiply (a = b*c).

Parameters
a- Pointer to destination matrix
b- Pointer to first input matrix
c- Pointer to second input matrix
Returns
Pointer to a

◆ triMat4Inv()

triMat4f * triMat4Inv ( triMat4f * a,
const triMat4f * b )

Invert a matrix.

Full Inverse. For orthogonal matrices, triMat4Trans does the same.

Parameters
a- Pointer to destination matrix
b- Pointer to matrix to be inverted
Returns
Pointer to a

◆ triMat4Trans()

triMat4f * triMat4Trans ( triMat4f * a,
const triMat4f * b )

Transpose a matrix.

Parameters
a- Pointer to destination matrix
b- Pointer to matrix to be transposed
Returns
Pointer to a

◆ triMat4Det()

triFloat triMat4Det ( const triMat4f * a)

Calculate matrix determinant.

Parameters
a- Pointer to source matrix
Returns
Determinant of matrix a

◆ triMat4Trace()

triFloat triMat4Trace ( const triMat4f * a)

Calculate matrix trace.

Parameters
a- Pointer to source matrix
Returns
Trace of matrix a

◆ triMat4Apply()

triVec4f * triMat4Apply ( triVec4f * a,
const triMat4f * b,
const triVec4f * c )

4x4 Matrix-Vector multiply (a = b*c).

Parameters
a- Pointer to dest vector
b- Pointer to source matrix
c- Pointer to source vector
Returns
Pointer to a

◆ triMat4Apply3()

triVec4f * triMat4Apply3 ( triVec4f * a,
const triMat4f * b,
const triVec4f * c )

3x3 Matrix-Vector multiply (a = b*c).

Vectors are treated as 3D Vectors and the matrix as 3D matrix. This is useful if you only want to rotate a vector by the 4x4 Matrix (no translation).

Parameters
a- Pointer to dest vector
b- Pointer to source matrix
c- Pointer to source vector
Returns
Pointer to a