Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Matrix2.h by Vasillen M. Chizhov
- #pragma once
- #include "util.h"
- namespace myGameMathLib
- {
- class Matrix2
- {
- public:
- FP _11, _12;
- FP _21, _22;
- public:
- //ctors
- Matrix2();
- Matrix2(FP value);
- Matrix2(FP _11, FP _12, FP _21, FP _22);
- Matrix2(const Matrix2& another);
- public:
- Matrix2& operator=(const Matrix2& another);
- Matrix2& operator+=(const Matrix2& another);
- Matrix2& operator-=(const Matrix2& another);
- Matrix2& operator*=(const Matrix2& another);
- Matrix2& operator*=(FP scalar);
- Matrix2& operator/=(FP scalar);
- Matrix2 operator+();
- Matrix2 operator-();
- public:
- FP det() const;
- FP trace() const;
- Matrix2 transpose() const;
- Matrix2 inverse() const;
- public:
- static Matrix2 rotation(FP angle);
- static Matrix2 shearX(FP shearX);
- static Matrix2 shearY(FP shearY);
- static Matrix2 scaling(FP sx, FP sy);
- public:
- static Matrix2 Identity;
- static Matrix2 Zero;
- };
- bool operator==(const Matrix2& mat1, const Matrix2& mat2);
- bool operator!=(const Matrix2& mat1, const Matrix2& mat2);
- Matrix2 operator+(const Matrix2& mat1, const Matrix2& mat2);
- Matrix2 operator-(const Matrix2& mat1, const Matrix2& mat2);
- Matrix2 operator*(const Matrix2& mat1, const Matrix2& mat2);
- Matrix2 operator*(const Matrix2& mat, FP scalar);
- Matrix2 operator*(FP scalar, const Matrix2& mat);
- Matrix2 operator/(const Matrix2& mat, FP scalar);
- Matrix2 operator/(FP scalar, const Matrix2& mat);
- FP det(const Matrix2& mat);
- FP trace(const Matrix2& mat);
- Matrix2 transpose(const Matrix2& mat);
- void transpose(Matrix2& mat);
- Matrix2 inverse(const Matrix2& mat);
- void inverse(Matrix2& mat);
- std::ostream& operator<<(std::ostream& os, const Matrix2& mat);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement