KurusView  1.0
MMatrix.h
Go to the documentation of this file.
1 
9 #ifndef INC_KURUSVIEW_MMATRIX_H
10 #define INC_KURUSVIEW_MMATRIX_H
11 
12 #include "MVector.h"
13 #include <iostream>
14 #include <vector>
15 
16 class MMatrix {
24  friend std::ostream &operator<<(std::ostream &os, MMatrix &obj);
25 
26 public:
30  MMatrix(const MVector &v1, const MVector &v2, const MVector &v3);
31 
35  MMatrix(double v1x, double v1y, double v1z, double v2x, double v2y, double v2z, double v3x, double v3y, double v3z);
36 
40  MMatrix() : mat3x3(3, MVector()) {};
41 
47  MMatrix operator+(MMatrix const &obj) const;
48 
54  MMatrix operator-(MMatrix const &obj) const;
55 
61  MMatrix operator*(const MMatrix &obj) const;
62 
68  MVector operator*(const MVector &obj) const;
69 
75  MMatrix operator*(double const &scalar) const;
76 
82  MMatrix operator/(double const &scalar) const;
83 
84 
88  void transpose();
89 
94  double determinant() const;
95 
99  void inverse();
100 
104  void setMat(int col, MVector vector);
105 
106  std::vector<MVector> &getMat();
107 
109  ~MMatrix() = default;
110 
111  bool operator==(const MMatrix &m) const;
112 
113  bool operator!=(const MMatrix &m) const;
114 
115 private:
117  std::vector<MVector> mat3x3;
118 
119 };
120 
126 MMatrix RotationMatrix(const std::vector<MVector> &Rotation);
127 
128 MMatrix ScalingMatrix(const double &scalingFactor);
129 
130 #endif //INC_KURUSVIEW_MMATRIX_H
~MMatrix()=default
default destructor
Header file for MVector class.
MMatrix operator-(MMatrix const &obj) const
operator- - overloads the - operator to subtract two matrices directly together
Definition: MMatrix.cpp:56
MMatrix()
default constructor - Initializes matrix to zero with MVector constructor
Definition: MMatrix.h:40
MMatrix operator/(double const &scalar) const
operator/ - overloads the / operator to divide a matrix by a scalar
Definition: MMatrix.cpp:279
MMatrix RotationMatrix(const std::vector< MVector > &Rotation)
RotationMatrix - calculates the rotation matrix of a specific set of angles.
Definition: MMatrix.cpp:316
MMatrix operator*(const MMatrix &obj) const
operator* - overloads the * operator to multiply a matrix by a matrix
Definition: MMatrix.cpp:103
void transpose()
transpose - Reflects matrix across the diagonal
Definition: MMatrix.cpp:185
friend std::ostream & operator<<(std::ostream &os, MMatrix &obj)
classic friend overloaded ostream operator<< declaration - prints MMatrix properties to stdout in hum...
Definition: MMatrix.cpp:3
double determinant() const
determinant - finds the determinant of the matrix
Definition: MMatrix.cpp:209
MMatrix operator+(MMatrix const &obj) const
operator+ - overloads the + operator to add two matrices directly together
Definition: MMatrix.cpp:34
void inverse()
inverse - Finds inverse of a matrix
Definition: MMatrix.cpp:228
void setMat(int col, MVector vector)
setMat - Sets a specific column in the 3x3 matrix (initializes one column to an MVector ...
Definition: MMatrix.cpp:275
Definition: MMatrix.h:16
Definition: MVector.h:19