1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 22:47:44 +00:00

LibGfx+LibSoftGPU: Add and use Vector.xy()

Also use `.xyz()` where appropriate.
This commit is contained in:
Jelle Raaijmakers 2022-03-06 19:12:01 +01:00 committed by Andreas Kling
parent 439617cf6f
commit d75135663b
2 changed files with 12 additions and 7 deletions

View file

@ -201,7 +201,12 @@ public:
return AK::sqrt(m_data[0] * m_data[0] + m_data[1] * m_data[1] + m_data[2] * m_data[2] + m_data[3] * m_data[3]);
}
[[nodiscard]] constexpr VectorN<3, T> xyz() const requires(N == 4)
[[nodiscard]] constexpr VectorN<2, T> xy() const requires(N >= 3)
{
return VectorN<2, T>(x(), y());
}
[[nodiscard]] constexpr VectorN<3, T> xyz() const requires(N >= 4)
{
return VectorN<3, T>(x(), y(), z());
}