LibGfx: Add Matrix::operator+(Matrix const & other)

This commit is contained in:
MacDue 2022-10-01 22:35:52 +01:00 committed by Andreas Kling
parent 6aa82f8b0b
commit 95878688a7
Notes: sideshowbarker 2024-07-17 18:38:54 +09:00

View File

@ -84,6 +84,16 @@ public:
return product;
}
constexpr Matrix operator+(Matrix const& other) const
{
Matrix sum;
for (size_t i = 0; i < N; ++i) {
for (size_t j = 0; j < N; ++j)
sum.m_elements[i][j] = m_elements[i][j] + other.m_elements[i][j];
}
return sum;
}
constexpr Matrix operator/(T divisor) const
{
Matrix division;