GCP Assignment 1
Public Member Functions | Public Attributes | List of all members
Maths::Mat4 Struct Reference

Contains the Mat4 structure with functions and overloaded operators. This is row major. More...

#include <Mat4.h>

Collaboration diagram for Maths::Mat4:
Collaboration graph

Public Member Functions

 Mat4 ()
 Constructs the Mat4 setting the values of the matrix to 0. More...
 
 Mat4 (Vec4 v1, Vec4 v2, Vec4 v3, Vec4 v4)
 Constructs the Mat4 setting the values to the input vectors. More...
 
Mat4operator+= (Mat4 mIn)
 Overloads the += operator. More...
 
Mat4operator-= (Mat4 mIn)
 Overloads the -= operator. More...
 
void setAsIdentityMatrix ()
 Sets the values of the matrix to that of a identity matrix. More...
 
void setAsPerspectiveMatrix (float fovy, float aspect, float n, float f)
 Sets the values of the matrix to that of a Perspective matrix. More...
 
void setPos (Vec3 pv)
 Sets the position of the matrix using the input vector. More...
 
void setPos (Mat4 &matrix, Vec3 pos)
 
void scale (Mat4 &matrix, float sv)
 Scales the matrix using the input vector. More...
 
void translate (Mat4 &matrix, Vec3 tv)
 Translates the matrix using the input vector. More...
 
void rotateAlongX (Mat4 &matrix, float angle)
 Rotate the matrix using the angle of rotation along the x axis. More...
 
void rotateAlongY (Mat4 &matrix, float angle)
 Rotate the matrix using the angle of rotation along the y axis. More...
 
void rotateAlongZ (Mat4 &matrix, float angle)
 Rotate the matrix using the angle of rotation along the z axis. More...
 
void rotatePointAroundXAxis (Mat4 &matrix, Maths::Vec3 axisPoint, float angle)
 
void rotatePointAroundYAxis (Mat4 &matrix, Maths::Vec3 axisPoint, float angle)
 
void rotatePointAroundZAxis (Mat4 &matrix, Maths::Vec3 axisPoint, float angle)
 
Vec3 getPos ()
 Gets the position of the matrix. More...
 
float * getMatrixArray ()
 A function to get a pointer to the first index of the array. More...
 

Public Attributes

float m [16]
 

Detailed Description

Contains the Mat4 structure with functions and overloaded operators. This is row major.

Constructor & Destructor Documentation

◆ Mat4() [1/2]

Maths::Mat4::Mat4 ( )
inline

Constructs the Mat4 setting the values of the matrix to 0.

◆ Mat4() [2/2]

Maths::Mat4::Mat4 ( Vec4  v1,
Vec4  v2,
Vec4  v3,
Vec4  v4 
)
inline

Constructs the Mat4 setting the values to the input vectors.

Parameters
v1The first inputed vector.
v2The second inputed vector.
v3The third inputed vector.
v4The forth inputed vector.

Member Function Documentation

◆ getMatrixArray()

float* Maths::Mat4::getMatrixArray ( )
inline

A function to get a pointer to the first index of the array.

Returns
A pointer to the first index of the array.
Here is the caller graph for this function:

◆ getPos()

Vec3 Maths::Mat4::getPos ( )
inline

Gets the position of the matrix.

Returns
pv The position of the matrix as a vec3.

◆ operator+=()

Mat4* Maths::Mat4::operator+= ( Mat4  mIn)
inline

Overloads the += operator.

Parameters
vecInThe input Mat4.
Returns
The new matrix.

◆ operator-=()

Mat4* Maths::Mat4::operator-= ( Mat4  mIn)
inline

Overloads the -= operator.

Parameters
vecInThe input Mat4.
Returns
The new matrix.

◆ rotateAlongX()

void Maths::Mat4::rotateAlongX ( Mat4 matrix,
float  angle 
)

Rotate the matrix using the angle of rotation along the x axis.

Parameters
matrixA pointer to the matrix to rotate.
angleThe angle to rotate the matrix by.
formatThe type of angle, must be a Radian
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rotateAlongY()

void Maths::Mat4::rotateAlongY ( Mat4 matrix,
float  angle 
)

Rotate the matrix using the angle of rotation along the y axis.

Parameters
matrixA pointer to the matrix to rotate.
angleThe angle to rotate the matrix by.
formatThe type of angle, must be a Radian
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rotateAlongZ()

void Maths::Mat4::rotateAlongZ ( Mat4 matrix,
float  angle 
)

Rotate the matrix using the angle of rotation along the z axis.

Parameters
matrixA pointer to the matrix to rotate.
angleThe angle to rotate the matrix by.
formatThe type of angle, must be a Radian
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rotatePointAroundXAxis()

void Maths::Mat4::rotatePointAroundXAxis ( Mat4 matrix,
Maths::Vec3  axisPoint,
float  angle 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rotatePointAroundYAxis()

void Maths::Mat4::rotatePointAroundYAxis ( Mat4 matrix,
Maths::Vec3  axisPoint,
float  angle 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rotatePointAroundZAxis()

void Maths::Mat4::rotatePointAroundZAxis ( Mat4 matrix,
Maths::Vec3  axisPoint,
float  angle 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ scale()

void Maths::Mat4::scale ( Mat4 matrix,
float  sv 
)

Scales the matrix using the input vector.

Parameters
angleThe angle to rotate the matrix by.
sVThe scale vector vec3 to scale the matrix by.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setAsIdentityMatrix()

void Maths::Mat4::setAsIdentityMatrix ( )
inline

Sets the values of the matrix to that of a identity matrix.

Here is the caller graph for this function:

◆ setAsPerspectiveMatrix()

void Maths::Mat4::setAsPerspectiveMatrix ( float  fovy,
float  aspect,
float  n,
float  f 
)
inline

Sets the values of the matrix to that of a Perspective matrix.

Parameters
fovyThe field of view on the y axis.
aThe aspect.
fThe z plane which is far from the camera.
nThe z plane closer to the camera.
Here is the caller graph for this function:

◆ setPos() [1/2]

void Maths::Mat4::setPos ( Vec3  pv)
inline

Sets the position of the matrix using the input vector.

Parameters
pvThe position vector vec3 to set the matrix position.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPos() [2/2]

void Maths::Mat4::setPos ( Mat4 matrix,
Vec3  pos 
)
Here is the call graph for this function:

◆ translate()

void Maths::Mat4::translate ( Mat4 matrix,
Vec3  tv 
)

Translates the matrix using the input vector.

Parameters
matrixA pointer to the matrix to rotate.
tvThe translation vector vec3 to set the matrix position.
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m

float Maths::Mat4::m[16]

matrix variables [00]x [01]y [02]z [03]w [04]x [05]y [06]z [07]w [08]x [09]y [10]z [11]w [12]x [13]y [14]z [15]w


The documentation for this struct was generated from the following files: