mirror of
https://github.com/orange-cpp/omath.git
synced 2026-04-30 07:23:26 +00:00
update
This commit is contained in:
@@ -129,8 +129,7 @@ namespace omath
|
|||||||
{
|
{
|
||||||
return x * other.x + y * other.y;
|
return x * other.x + y * other.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
|
||||||
[[nodiscard]] constexpr Type length() const noexcept
|
[[nodiscard]] constexpr Type length() const noexcept
|
||||||
{
|
{
|
||||||
return std::hypot(this->x, this->y);
|
return std::hypot(this->x, this->y);
|
||||||
@@ -141,18 +140,6 @@ namespace omath
|
|||||||
const Type len = length();
|
const Type len = length();
|
||||||
return len > 0.f ? *this / len : *this;
|
return len > 0.f ? *this / len : *this;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
[[nodiscard]] Type length() const noexcept
|
|
||||||
{
|
|
||||||
return std::hypot(x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] Vector2 normalized() const noexcept
|
|
||||||
{
|
|
||||||
const Type len = length();
|
|
||||||
return len > static_cast<Type>(0) ? *this / len : *this;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
[[nodiscard]] constexpr Type length_sqr() const noexcept
|
[[nodiscard]] constexpr Type length_sqr() const noexcept
|
||||||
{
|
{
|
||||||
return x * x + y * y;
|
return x * x + y * y;
|
||||||
|
|||||||
@@ -129,7 +129,6 @@ namespace omath
|
|||||||
return Vector2<Type>::dot(other) + z * other.z;
|
return Vector2<Type>::dot(other) + z * other.z;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
|
||||||
[[nodiscard]] constexpr Type length() const
|
[[nodiscard]] constexpr Type length() const
|
||||||
{
|
{
|
||||||
return std::hypot(this->x, this->y, z);
|
return std::hypot(this->x, this->y, z);
|
||||||
@@ -149,29 +148,6 @@ namespace omath
|
|||||||
|
|
||||||
return length_value != 0 ? *this / length_value : *this;
|
return length_value != 0 ? *this / length_value : *this;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
[[nodiscard]] Type length() const noexcept
|
|
||||||
{
|
|
||||||
return std::hypot(this->x, this->y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] Vector3 normalized() const noexcept
|
|
||||||
{
|
|
||||||
const Type len = this->length();
|
|
||||||
|
|
||||||
return len != static_cast<Type>(0) ? *this / len : *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] Type length_2d() const noexcept
|
|
||||||
{
|
|
||||||
return Vector2<Type>::length();
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] Type distance_to(const Vector3& v_other) const noexcept
|
|
||||||
{
|
|
||||||
return (*this - v_other).length();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
[[nodiscard]] constexpr Type length_sqr() const noexcept
|
[[nodiscard]] constexpr Type length_sqr() const noexcept
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user