mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 17:10:23 +00: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
1 changed files with 3 additions and 2 deletions
|
@ -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 a new issue