mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:27:35 +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
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…
Add table
Add a link
Reference in a new issue