mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 21:37:58 +03:00
LibGfx: Templatize VectorN::length()
This allows us to get a `float` length from an `IntVector3` without needing to convert to `FloatVector3` first.
This commit is contained in:
parent
70ea2a2258
commit
16ca9ec762
Notes:
sideshowbarker
2024-07-17 07:15:08 +09:00
Author: https://github.com/gmta Commit: https://github.com/SerenityOS/serenity/commit/16ca9ec762 Pull-request: https://github.com/SerenityOS/serenity/pull/15171 Reviewed-by: https://github.com/linusg
@ -205,9 +205,10 @@ public:
|
||||
operator*=(inv_length);
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr T length() const
|
||||
template<typename O = T>
|
||||
[[nodiscard]] constexpr O length() const
|
||||
{
|
||||
return AK::sqrt(dot(*this));
|
||||
return AK::sqrt<O>(dot(*this));
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr VectorN<2, T> xy() const requires(N >= 3)
|
||||
|
Loading…
Reference in New Issue
Block a user