-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmatrix.hpp
More file actions
37 lines (30 loc) · 1.29 KB
/
matrix.hpp
File metadata and controls
37 lines (30 loc) · 1.29 KB
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
#ifndef MATRIX_HPP
#define MATRIX_HPP
#include "vector.hpp"
namespace cpp_utils {
class Matrix {
public:
double xx, xy, xz, yx, yy, yz, zx, zy, zz;
inline Matrix() : xx(1), xy(0), xz(0), yx(0), yy(1), yz(0), zx(0), zy(0), zz(1) {};
Matrix(double xx, double xy, double xz, double yx, double yy, double yz, double zx, double zy, double zz);
Matrix(double xx, double yy, double zz);
double det() const;
bool operator==(const Matrix &that) const;
inline bool operator!=(const Matrix &that) const {
return true != (*this == that);
};
Matrix operator+(const Matrix &that) const;
Matrix operator-(const Matrix &that) const;
Matrix operator*(const double &that) const;
inline Matrix operator/(const double & that) const {return *this * (1/that);};
inline Matrix operator-() {return *this * -1;};
Matrix operator*(const Matrix &that) const;
Vector operator*(const Vector &that) const;
Matrix inverse() const;
private:
double precision = 0.0001;
};
Vector operator*(const Vector that, const Matrix &those);
Matrix operator*(const double that, const Matrix &those);
}
#endif