fix formatting and add comment

This commit is contained in:
LDprg 2022-09-06 09:59:21 +02:00 committed by Vittorio Romeo
parent 0584448a06
commit f521e2ec48
2 changed files with 5 additions and 3 deletions

View File

@ -106,8 +106,9 @@ template <typename T>
T Vector2<T>::length() const
{
static_assert(std::is_floating_point_v<T>, "Vector2::length() is only supported for floating point types");
return std::sqrt(x*x + y*y);
// don't use std::hypot because of slow performance
return std::sqrt(x * x + y * y);
}
} // namespace sf

View File

@ -48,7 +48,8 @@ T Vector3<T>::length() const
{
static_assert(std::is_floating_point_v<T>, "Vector3::length() is only supported for floating point types");
return std::sqrt(x*x + y*y + z*z);
// don't use std::hypot because of slow performance
return std::sqrt(x * x + y * y + z * z);
}
} // namespace sf