mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:27:45 +00:00
LibGfx: Add Matrix::operator*(T scalar)
This commit is contained in:
parent
95878688a7
commit
3d532571bb
1 changed files with 15 additions and 0 deletions
|
@ -104,6 +104,21 @@ public:
|
||||||
return division;
|
return division;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
friend constexpr Matrix operator*(Matrix const& matrix, T scalar)
|
||||||
|
{
|
||||||
|
Matrix scaled;
|
||||||
|
for (size_t i = 0; i < N; ++i) {
|
||||||
|
for (size_t j = 0; j < N; ++j)
|
||||||
|
scaled.m_elements[i][j] = matrix.m_elements[i][j] * scalar;
|
||||||
|
}
|
||||||
|
return scaled;
|
||||||
|
}
|
||||||
|
|
||||||
|
friend constexpr Matrix operator*(T scalar, Matrix const& matrix)
|
||||||
|
{
|
||||||
|
return matrix * scalar;
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] constexpr Matrix adjugate() const
|
[[nodiscard]] constexpr Matrix adjugate() const
|
||||||
{
|
{
|
||||||
if constexpr (N == 1)
|
if constexpr (N == 1)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue