summaryrefslogtreecommitdiff
path: root/src/Math
diff options
context:
space:
mode:
Diffstat (limited to 'src/Math')
-rw-r--r--src/Math/Matrix.hpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Math/Matrix.hpp b/src/Math/Matrix.hpp
index 43f0721..d77760a 100644
--- a/src/Math/Matrix.hpp
+++ b/src/Math/Matrix.hpp
@@ -78,6 +78,16 @@ public:
return result;
}
+ Matrix<R, C, T> transpose() {
+ Matrix<R, C, T> result{};
+ for (int y = 0; y < R; y++) {
+ for (int x = 0; x < C; x++) {
+ result(x, y) = this->operator()(y, x);
+ }
+ }
+ return result;
+ }
+
Matrix<R, C, T> operator+(Matrix<R, C, T> other) {
Matrix<R, C, T> result{};
for (int i = 0; i < R * C; i++) {