Fix C++ Vector3::Angle to return value in degrees just like C# API (instead of radians)
This commit is contained in:
@@ -321,7 +321,7 @@ float Float3::Angle(const Float3& from, const Float3& to)
|
||||
const float dot = Math::Clamp(Dot(Normalize(from), Normalize(to)), -1.0f, 1.0f);
|
||||
if (Math::Abs(dot) > 1.0f - ZeroTolerance)
|
||||
return dot > 0.0f ? 0.0f : PI;
|
||||
return Math::Acos(dot);
|
||||
return Math::Acos(dot) * RadiansToDegrees;
|
||||
}
|
||||
|
||||
template<>
|
||||
@@ -649,7 +649,7 @@ double Double3::Angle(const Double3& from, const Double3& to)
|
||||
const double dot = Math::Clamp(Dot(Normalize(from), Normalize(to)), -1.0, 1.0);
|
||||
if (Math::Abs(dot) > 1.0 - ZeroTolerance)
|
||||
return dot > 0.0 ? 0.0 : PI;
|
||||
return Math::Acos(dot);
|
||||
return Math::Acos(dot) * RadiansToDegrees;
|
||||
}
|
||||
|
||||
template<>
|
||||
|
||||
@@ -812,11 +812,11 @@ public:
|
||||
static FLAXENGINE_API T TriangleArea(const Vector3Base& v0, const Vector3Base& v1, const Vector3Base& v2);
|
||||
|
||||
/// <summary>
|
||||
/// Calculates the angle (in radians) between from and to. This is always the smallest value.
|
||||
/// Calculates the angle (in degrees) between from and to. This is always the smallest value.
|
||||
/// </summary>
|
||||
/// <param name="from">The first vector.</param>
|
||||
/// <param name="to">The second vector.</param>
|
||||
/// <returns>The angle (in radians).</returns>
|
||||
/// <returns>The angle (in degrees).</returns>
|
||||
static FLAXENGINE_API T Angle(const Vector3Base& from, const Vector3Base& to);
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user