fix formatting and add comment
This commit is contained in:
parent
0584448a06
commit
f521e2ec48
@ -106,8 +106,9 @@ template <typename T>
|
|||||||
T Vector2<T>::length() const
|
T Vector2<T>::length() const
|
||||||
{
|
{
|
||||||
static_assert(std::is_floating_point_v<T>, "Vector2::length() is only supported for floating point types");
|
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
|
} // namespace sf
|
||||||
|
@ -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");
|
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
|
} // namespace sf
|
||||||
|
Loading…
Reference in New Issue
Block a user