3D City v-1.0
Computer Graphics Project
maths.h File Reference
#include <cassert>
#include <cmath>
#include <iostream>
#include <cstring>
#include <array>
#include "glm/glm.hpp"

Go to the source code of this file.

Classes

struct  vec2_T< T >
 2d Vector class for storing x and y. More...
 
struct  vec3_T< T >
 3 element Vector class for storing x, y and z. More...
 
struct  vec4_T< T >
 4 element Vector class for storing x, y, z and w. More...
 
class  mat< Type, x_dim, y_dim >
 A general matrix class for any size of matrix. More...
 

Typedefs

typedef vec2_T< float > vec2
 
typedef vec3_T< float > vec3
 
typedef vec4_T< float > vec4
 
typedef mat< float, 4, 4 > mat4f
 
typedef mat< float, 3, 3 > mat3f
 
typedef mat< double, 4, 4 > mat4d
 
typedef mat< double, 3, 3 > mat3d
 
typedef mat< int, 4, 4 > mat4i
 
typedef mat< int, 3, 3 > mat3i
 
typedef mat< unsigned int, 4, 4 > mat4u
 
typedef mat< unsigned int, 3, 3 > mat3u
 

Functions

template<class Type , size_t x1, size_t y1, size_t x2>
mat< Type, x2, y1 > operator* (const mat< Type, x1, y1 > &first, const mat< Type, x2, x1 > &second)
 operator overload for matrix multiplication. More...
 
template<class Type >
mat< Type, 4, 4 > operator* (const mat< Type, 4, 4 > &first, const mat< Type, 4, 4 > &second)
 operator overload for matrix multiplication (specialized for mat4). More...
 
template<class Type >
vec3_T< Type > operator* (const mat< Type, 4, 4 > &mat, const vec3_T< Type > &in)
 operator overload for mat4 multiplication with vec3 . More...
 
template<class Type >
vec3_T< Type > operator* (const mat< Type, 3, 3 > &mat, const vec3_T< Type > &in)
 operator overload for mat3 multiplication with vec3. More...
 
template<class Type >
vec4_T< Type > operator* (const mat< Type, 4, 4 > &mat, const vec4_T< Type > &in)
 operator overload for mat4 multiplication with vec4. More...
 

Variables

constexpr float radian = 3.14159265f / 180.f
 
constexpr float epsilon = 1e-4f
 
constexpr float pi = 3.14159265f
 

Typedef Documentation

◆ mat3d

typedef mat<double, 3, 3> mat3d

Definition at line 753 of file maths.h.

◆ mat3f

typedef mat<float, 3, 3> mat3f

Definition at line 751 of file maths.h.

◆ mat3i

typedef mat<int, 3, 3> mat3i

Definition at line 755 of file maths.h.

◆ mat3u

typedef mat<unsigned int, 3, 3> mat3u

Definition at line 757 of file maths.h.

◆ mat4d

typedef mat<double, 4, 4> mat4d

Definition at line 752 of file maths.h.

◆ mat4f

typedef mat<float, 4, 4> mat4f

Definition at line 750 of file maths.h.

◆ mat4i

typedef mat<int, 4, 4> mat4i

Definition at line 754 of file maths.h.

◆ mat4u

typedef mat<unsigned int, 4, 4> mat4u

Definition at line 756 of file maths.h.

◆ vec2

typedef vec2_T<float> vec2

Definition at line 153 of file maths.h.

◆ vec3

typedef vec3_T<float> vec3

Definition at line 305 of file maths.h.

◆ vec4

typedef vec4_T<float> vec4

Definition at line 439 of file maths.h.

Function Documentation

◆ operator*() [1/5]

template<class Type >
vec3_T< Type > operator* ( const mat< Type, 3, 3 > &  mat,
const vec3_T< Type > &  in 
)

operator overload for mat3 multiplication with vec3.

Definition at line 731 of file maths.h.

◆ operator*() [2/5]

template<class Type >
mat< Type, 4, 4 > operator* ( const mat< Type, 4, 4 > &  first,
const mat< Type, 4, 4 > &  second 
)

operator overload for matrix multiplication (specialized for mat4).

Definition at line 697 of file maths.h.

◆ operator*() [3/5]

template<class Type >
vec3_T< Type > operator* ( const mat< Type, 4, 4 > &  mat,
const vec3_T< Type > &  in 
)

operator overload for mat4 multiplication with vec3 .

Definition at line 720 of file maths.h.

◆ operator*() [4/5]

template<class Type >
vec4_T< Type > operator* ( const mat< Type, 4, 4 > &  mat,
const vec4_T< Type > &  in 
)

operator overload for mat4 multiplication with vec4.

Definition at line 742 of file maths.h.

◆ operator*() [5/5]

template<class Type , size_t x1, size_t y1, size_t x2>
mat< Type, x2, y1 > operator* ( const mat< Type, x1, y1 > &  first,
const mat< Type, x2, x1 > &  second 
)

operator overload for matrix multiplication.

Definition at line 680 of file maths.h.

Variable Documentation

◆ epsilon

constexpr float epsilon = 1e-4f
constexpr

Definition at line 11 of file maths.h.

◆ pi

constexpr float pi = 3.14159265f
constexpr

Definition at line 12 of file maths.h.

◆ radian

constexpr float radian = 3.14159265f / 180.f
constexpr

Definition at line 10 of file maths.h.