-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMatrix.h
47 lines (41 loc) · 1.44 KB
/
Matrix.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#pragma once
#include "Vertex.h"
#include <initializer_list>
#include <vector>
const int ROWS = 4;
const int COLUMNS = 4;
class Matrix
{
public:
// Default constructor
Matrix();
// Constructor that initialises all elements. Note that an initialiser
// list is used to pass in the values. This is a new C++ feature.
Matrix(std::initializer_list<float> list);
// Copy constructor
Matrix(const Matrix& other);
// Destructor
~Matrix();
// Get matrix grid
float GetMatrix() const;
// Retrieve value in matrix at specified row and column
float GetM(const int row, const int column) const;
// Set value in matrix at specified row and column
void SetM(const int row, const int column, const float value);
// Copy assignment operator
Matrix& operator= (const Matrix &rhs);
// Multiply two matrices together
const Matrix operator*(const Matrix &other) const;
// Multiply a matrix by a vertex, returning a vertex
const Vertex operator*(const Vertex &other) const;
// Static methods for transformations
static Matrix TranslationMatrix(float x, float y, float z);
static Matrix ScalingMatrix(float x, float y, float z);
static Matrix XRotationMatrix(float angle);
static Matrix YRotationMatrix(float angle);
static Matrix ZRotationMatrix(float angle);
static Matrix XYZRotationMatrix(float angleX, float angleY, float angleZ);
private:
float _matrix[ROWS][COLUMNS];
void cpyMatrix(const Matrix &other);
};