mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-14 13:32:23 +00:00
LibGfx: Use VectorN
dot product of self for length()
No functional changes.
This commit is contained in:
parent
582fb3f263
commit
dfe002cfd4
Notes:
sideshowbarker
2024-07-17 11:06:35 +09:00
Author: https://github.com/gmta
Commit: dfe002cfd4
Pull-request: https://github.com/SerenityOS/serenity/pull/13970
Reviewed-by: https://github.com/alimpfard
Reviewed-by: https://github.com/linusg
Reviewed-by: https://github.com/sunverwerth ✅
1 changed files with 1 additions and 5 deletions
|
@ -201,11 +201,7 @@ public:
|
||||||
|
|
||||||
[[nodiscard]] constexpr T length() const
|
[[nodiscard]] constexpr T length() const
|
||||||
{
|
{
|
||||||
T squared_sum {};
|
return AK::sqrt(dot(*this));
|
||||||
UNROLL_LOOP
|
|
||||||
for (auto i = 0u; i < N; ++i)
|
|
||||||
squared_sum += m_data[i] * m_data[i];
|
|
||||||
return AK::sqrt(squared_sum);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] constexpr VectorN<2, T> xy() const requires(N >= 3)
|
[[nodiscard]] constexpr VectorN<2, T> xy() const requires(N >= 3)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue