Files
j3ml/include/J3ML/LinearAlgebra/Matrix2x2.h
Redacted a5c96e8cae
Some checks failed
Run tests / Explore-Gitea-Actions (push) Failing after 1m10s
Build Docs With Doxygen / Explore-Gitea-Actions (push) Successful in 35s
Dependency Reconfiguration to support MSVC being picky :/
2024-06-16 23:02:32 -07:00

46 lines
1.1 KiB
C++

#pragma once
#include <J3ML/LinearAlgebra/Common.h>
namespace J3ML::LinearAlgebra {
class Matrix2x2 {
public:
enum { Rows = 3 };
enum { Cols = 3 };
static const Matrix2x2 Zero;
static const Matrix2x2 Identity;
static const Matrix2x2 NaN;
Matrix2x2() {}
Matrix2x2(float val);
Matrix2x2(float m00, float m01, float m10, float m11);
Matrix2x2(const Vector2& r1, const Vector2& r2);
explicit Matrix2x2(const float *data);
Vector2 GetRow(int index) const;
Vector2 GetColumn(int index) const;
void SetRow(int i, const Vector2& row);
void SetColumn(int i, const Vector2& col);
void SetAt(int x, int y, float value);
float At(int x, int y) const;
float &At(int x, int y);
float Determinant() const;
Matrix2x2 Inverse() const;
Matrix2x2 Transpose() const;
Vector2 Transform(const Vector2& rhs) const;
Vector2 operator * (const Vector2& rhs) const;
Matrix2x2 operator * (const Matrix2x2 &rhs) const;
protected:
float elems[2][2];
};
}