diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2022-03-12 21:09:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-12 21:09:46 +0100 |
commit | 5959d38c6838d3470ba2b1e166602366cdbac6c5 (patch) | |
tree | 863514ca0d23c90171719d6de8b32ac6e461ee9f | |
parent | 2724e5728875e3f676af8b5ab9fafdbe4c5261e0 (diff) | |
parent | 89c49902749b4e93e98f1858fc26a32c0c2708b7 (diff) |
Merge pull request #59075 from aaronfranke/cs-slerp-doc-xml-and-test
Fix Slerp C# docs and add test cases for vectors in the same direction
-rw-r--r-- | modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs | 5 | ||||
-rw-r--r-- | modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs | 5 | ||||
-rw-r--r-- | tests/core/math/test_vector2.h | 3 | ||||
-rw-r--r-- | tests/core/math/test_vector3.h | 3 |
4 files changed, 12 insertions, 4 deletions
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs index ee218cb1f8..d4b623b2ea 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs @@ -511,8 +511,9 @@ namespace Godot /// Returns the result of the spherical linear interpolation between /// this vector and <paramref name="to"/> by amount <paramref name="weight"/>. /// - /// This method also handles interpolating the lengths if the input vectors have different lengths. - /// For the special case of one or both input vectors having zero length, this method behaves like [method lerp]. + /// This method also handles interpolating the lengths if the input vectors + /// have different lengths. For the special case of one or both input vectors + /// having zero length, this method behaves like <see cref="Lerp"/>. /// </summary> /// <param name="to">The destination vector for interpolation.</param> /// <param name="weight">A value on the range of 0.0 to 1.0, representing the amount of interpolation.</param> diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs index 45e5287610..eddfa76f10 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs @@ -551,8 +551,9 @@ namespace Godot /// Returns the result of the spherical linear interpolation between /// this vector and <paramref name="to"/> by amount <paramref name="weight"/>. /// - /// This method also handles interpolating the lengths if the input vectors have different lengths. - /// For the special case of one or both input vectors having zero length, this method behaves like [method lerp]. + /// This method also handles interpolating the lengths if the input vectors + /// have different lengths. For the special case of one or both input vectors + /// having zero length, this method behaves like <see cref="Lerp"/>. /// </summary> /// <param name="to">The destination vector for interpolation.</param> /// <param name="weight">A value on the range of 0.0 to 1.0, representing the amount of interpolation.</param> diff --git a/tests/core/math/test_vector2.h b/tests/core/math/test_vector2.h index ff60467bf4..9b7800164a 100644 --- a/tests/core/math/test_vector2.h +++ b/tests/core/math/test_vector2.h @@ -90,6 +90,9 @@ TEST_CASE("[Vector2] Interpolation methods") { Vector2(5, 0).slerp(Vector2(0, 5), 0.5).is_equal_approx(Vector2(5, 5) * Math_SQRT12), "Vector2 slerp with non-normalized values should work as expected."); CHECK_MESSAGE( + Vector2(1, 1).slerp(Vector2(2, 2), 0.5).is_equal_approx(Vector2(1.5, 1.5)), + "Vector2 slerp with colinear inputs should behave as expected."); + CHECK_MESSAGE( Vector2().slerp(Vector2(), 0.5) == Vector2(), "Vector2 slerp with both inputs as zero vectors should return a zero vector."); CHECK_MESSAGE( diff --git a/tests/core/math/test_vector3.h b/tests/core/math/test_vector3.h index 847a7c0b3f..6f99fada2b 100644 --- a/tests/core/math/test_vector3.h +++ b/tests/core/math/test_vector3.h @@ -111,6 +111,9 @@ TEST_CASE("[Vector3] Interpolation methods") { Vector3(5, 0, 0).slerp(Vector3(0, 3, 4), 0.5).is_equal_approx(Vector3(3.535533905029296875, 2.121320486068725586, 2.828427314758300781)), "Vector3 slerp with non-normalized values should work as expected."); CHECK_MESSAGE( + Vector3(1, 1, 1).slerp(Vector3(2, 2, 2), 0.5).is_equal_approx(Vector3(1.5, 1.5, 1.5)), + "Vector3 slerp with colinear inputs should behave as expected."); + CHECK_MESSAGE( Vector3().slerp(Vector3(), 0.5) == Vector3(), "Vector3 slerp with both inputs as zero vectors should return a zero vector."); CHECK_MESSAGE( |