From a367378f9ebc95cbd4e595feb95dd64b0f3f2c22 Mon Sep 17 00:00:00 2001 From: Raul Santos Date: Mon, 29 Nov 2021 18:02:42 +0100 Subject: [PATCH] Rename Vector parameters to be consistent Renames parameters that were named differently across different scripting languages or their documentation to use the same name everywhere. --- core/math/vector3.cpp | 8 +-- core/math/vector3.h | 18 +++--- core/variant/variant_call.cpp | 8 +-- doc/classes/Vector2.xml | 6 +- doc/classes/Vector3.xml | 18 +++--- .../GodotSharp/GodotSharp/Core/Vector2.cs | 18 +++--- .../GodotSharp/GodotSharp/Core/Vector2i.cs | 32 +++++----- .../GodotSharp/GodotSharp/Core/Vector3.cs | 58 +++++++++---------- .../GodotSharp/GodotSharp/Core/Vector3i.cs | 24 ++++---- 9 files changed, 95 insertions(+), 95 deletions(-) diff --git a/core/math/vector3.cpp b/core/math/vector3.cpp index 42e3da0b273..b9bd04b8c1d 100644 --- a/core/math/vector3.cpp +++ b/core/math/vector3.cpp @@ -108,10 +108,10 @@ Vector3 Vector3::move_toward(const Vector3 &p_to, const real_t p_delta) const { return len <= p_delta || len < CMP_EPSILON ? p_to : v + vd / len * p_delta; } -Basis Vector3::outer(const Vector3 &p_b) const { - Vector3 row0(x * p_b.x, x * p_b.y, x * p_b.z); - Vector3 row1(y * p_b.x, y * p_b.y, y * p_b.z); - Vector3 row2(z * p_b.x, z * p_b.y, z * p_b.z); +Basis Vector3::outer(const Vector3 &p_with) const { + Vector3 row0(x * p_with.x, x * p_with.y, x * p_with.z); + Vector3 row1(y * p_with.x, y * p_with.y, y * p_with.z); + Vector3 row2(z * p_with.x, z * p_with.y, z * p_with.z); return Basis(row0, row1, row2); } diff --git a/core/math/vector3.h b/core/math/vector3.h index 02a56f684ee..6c21968aae1 100644 --- a/core/math/vector3.h +++ b/core/math/vector3.h @@ -128,9 +128,9 @@ struct Vector3 { return n.normalized(); } - _FORCE_INLINE_ Vector3 cross(const Vector3 &p_b) const; - _FORCE_INLINE_ real_t dot(const Vector3 &p_b) const; - Basis outer(const Vector3 &p_b) const; + _FORCE_INLINE_ Vector3 cross(const Vector3 &p_with) const; + _FORCE_INLINE_ real_t dot(const Vector3 &p_with) const; + Basis outer(const Vector3 &p_with) const; _FORCE_INLINE_ Vector3 abs() const; _FORCE_INLINE_ Vector3 floor() const; @@ -199,17 +199,17 @@ struct Vector3 { } }; -Vector3 Vector3::cross(const Vector3 &p_b) const { +Vector3 Vector3::cross(const Vector3 &p_with) const { Vector3 ret( - (y * p_b.z) - (z * p_b.y), - (z * p_b.x) - (x * p_b.z), - (x * p_b.y) - (y * p_b.x)); + (y * p_with.z) - (z * p_with.y), + (z * p_with.x) - (x * p_with.z), + (x * p_with.y) - (y * p_with.x)); return ret; } -real_t Vector3::dot(const Vector3 &p_b) const { - return x * p_b.x + y * p_b.y + z * p_b.z; +real_t Vector3::dot(const Vector3 &p_with) const { + return x * p_with.x + y * p_with.y + z * p_with.z; } Vector3 Vector3::abs() const { diff --git a/core/variant/variant_call.cpp b/core/variant/variant_call.cpp index 34b8b782d2a..b586757dcd0 100644 --- a/core/variant/variant_call.cpp +++ b/core/variant/variant_call.cpp @@ -1471,7 +1471,7 @@ static void _register_variant_builtin_methods() { bind_method(Vector2, angle, sarray(), varray()); bind_method(Vector2, angle_to, sarray("to"), varray()); bind_method(Vector2, angle_to_point, sarray("to"), varray()); - bind_method(Vector2, direction_to, sarray("b"), varray()); + bind_method(Vector2, direction_to, sarray("to"), varray()); bind_method(Vector2, distance_to, sarray("to"), varray()); bind_method(Vector2, distance_squared_to, sarray("to"), varray()); bind_method(Vector2, length, sarray(), varray()); @@ -1551,9 +1551,9 @@ static void _register_variant_builtin_methods() { bind_method(Vector3, max_axis, sarray(), varray()); bind_method(Vector3, angle_to, sarray("to"), varray()); bind_method(Vector3, signed_angle_to, sarray("to", "axis"), varray()); - bind_method(Vector3, direction_to, sarray("b"), varray()); - bind_method(Vector3, distance_to, sarray("b"), varray()); - bind_method(Vector3, distance_squared_to, sarray("b"), varray()); + bind_method(Vector3, direction_to, sarray("to"), varray()); + bind_method(Vector3, distance_to, sarray("to"), varray()); + bind_method(Vector3, distance_squared_to, sarray("to"), varray()); bind_method(Vector3, length, sarray(), varray()); bind_method(Vector3, length_squared, sarray(), varray()); bind_method(Vector3, limit_length, sarray("length"), varray(1.0)); diff --git a/doc/classes/Vector2.xml b/doc/classes/Vector2.xml index 431815e75aa..15f7d2f9e34 100644 --- a/doc/classes/Vector2.xml +++ b/doc/classes/Vector2.xml @@ -125,16 +125,16 @@ - + - Returns the normalized vector pointing from this vector to [code]b[/code]. This is equivalent to using [code](b - a).normalized()[/code]. + Returns the normalized vector pointing from this vector to [code]to[/code]. This is equivalent to using [code](b - a).normalized()[/code]. - Returns the squared distance between this vector and [code]b[/code]. + Returns the squared distance between this vector and [code]to[/code]. This method runs faster than [method distance_to], so prefer it if you need to compare vectors or need the squared distance for some formula. diff --git a/doc/classes/Vector3.xml b/doc/classes/Vector3.xml index 6d20cc85ea7..6d87ce9ea85 100644 --- a/doc/classes/Vector3.xml +++ b/doc/classes/Vector3.xml @@ -86,7 +86,7 @@ - Returns the cross product of this vector and [code]b[/code]. + Returns the cross product of this vector and [code]with[/code]. @@ -101,31 +101,31 @@ - + - Returns the normalized vector pointing from this vector to [code]b[/code]. This is equivalent to using [code](b - a).normalized()[/code]. + Returns the normalized vector pointing from this vector to [code]to[/code]. This is equivalent to using [code](b - a).normalized()[/code]. - + - Returns the squared distance between this vector and [code]b[/code]. + Returns the squared distance between this vector and [code]to[/code]. This method runs faster than [method distance_to], so prefer it if you need to compare vectors or need the squared distance for some formula. - + - Returns the distance between this vector and [code]b[/code]. + Returns the distance between this vector and [code]to[/code]. - Returns the dot product of this vector and [code]b[/code]. This can be used to compare the angle between two vectors. For example, this can be used to determine whether an enemy is facing the player. + Returns the dot product of this vector and [code]with[/code]. This can be used to compare the angle between two vectors. For example, this can be used to determine whether an enemy is facing the player. The dot product will be [code]0[/code] for a straight angle (90 degrees), greater than 0 for angles narrower than 90 degrees and lower than 0 for angles wider than 90 degrees. When using unit (normalized) vectors, the result will always be between [code]-1.0[/code] (180 degree angle) when the vectors are facing opposite directions, and [code]1.0[/code] (0 degree angle) when the vectors are aligned. [b]Note:[/b] [code]a.dot(b)[/code] is equivalent to [code]b.dot(a)[/code]. @@ -225,7 +225,7 @@ - Returns the outer product with [code]b[/code]. + Returns the outer product with [code]with[/code]. diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs index 0c3331900a3..30ecd22db7b 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs @@ -184,13 +184,13 @@ namespace Godot } /// - /// Returns the cross product of this vector and . + /// Returns the cross product of this vector and . /// - /// The other vector. + /// The other vector. /// The cross product value. - public real_t Cross(Vector2 b) + public real_t Cross(Vector2 with) { - return (x * b.y) - (y * b.x); + return (x * with.y) - (y * with.x); } /// @@ -222,13 +222,13 @@ namespace Godot } /// - /// Returns the normalized vector pointing from this vector to . + /// Returns the normalized vector pointing from this vector to . /// - /// The other vector to point towards. - /// The direction from this vector to . - public Vector2 DirectionTo(Vector2 b) + /// The other vector to point towards. + /// The direction from this vector to . + public Vector2 DirectionTo(Vector2 to) { - return new Vector2(b.x - x, b.y - y).Normalized(); + return new Vector2(to.x - x, to.y - y).Normalized(); } /// diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2i.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2i.cs index 6cac16d53bb..3bbc2ae2ba2 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2i.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2i.cs @@ -149,45 +149,45 @@ namespace Godot } /// - /// Returns the cross product of this vector and . + /// Returns the cross product of this vector and . /// - /// The other vector. + /// The other vector. /// The cross product vector. - public int Cross(Vector2i b) + public int Cross(Vector2i with) { - return x * b.y - y * b.x; + return x * with.y - y * with.x; } /// - /// Returns the squared distance between this vector and . + /// Returns the squared distance between this vector and . /// This method runs faster than , so prefer it if /// you need to compare vectors or need the squared distance for some formula. /// - /// The other vector to use. + /// The other vector to use. /// The squared distance between the two vectors. - public int DistanceSquaredTo(Vector2i b) + public int DistanceSquaredTo(Vector2i to) { - return (b - this).LengthSquared(); + return (to - this).LengthSquared(); } /// - /// Returns the distance between this vector and . + /// Returns the distance between this vector and . /// - /// The other vector to use. + /// The other vector to use. /// The distance between the two vectors. - public real_t DistanceTo(Vector2i b) + public real_t DistanceTo(Vector2i to) { - return (b - this).Length(); + return (to - this).Length(); } /// - /// Returns the dot product of this vector and . + /// Returns the dot product of this vector and . /// - /// The other vector to use. + /// The other vector to use. /// The dot product of the two vectors. - public int Dot(Vector2i b) + public int Dot(Vector2i with) { - return x * b.x + y * b.y; + return x * with.x + y * with.y; } /// diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs index 63d9be0a6da..15acf88f621 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs @@ -170,17 +170,17 @@ namespace Godot } /// - /// Returns the cross product of this vector and . + /// Returns the cross product of this vector and . /// - /// The other vector. + /// The other vector. /// The cross product vector. - public Vector3 Cross(Vector3 b) + public Vector3 Cross(Vector3 with) { return new Vector3 ( - (y * b.z) - (z * b.y), - (z * b.x) - (x * b.z), - (x * b.y) - (y * b.x) + (y * with.z) - (z * with.y), + (z * with.x) - (x * with.z), + (x * with.y) - (y * with.x) ); } @@ -212,46 +212,46 @@ namespace Godot } /// - /// Returns the normalized vector pointing from this vector to . + /// Returns the normalized vector pointing from this vector to . /// - /// The other vector to point towards. - /// The direction from this vector to . - public Vector3 DirectionTo(Vector3 b) + /// The other vector to point towards. + /// The direction from this vector to . + public Vector3 DirectionTo(Vector3 to) { - return new Vector3(b.x - x, b.y - y, b.z - z).Normalized(); + return new Vector3(to.x - x, to.y - y, to.z - z).Normalized(); } /// - /// Returns the squared distance between this vector and . + /// Returns the squared distance between this vector and . /// This method runs faster than , so prefer it if /// you need to compare vectors or need the squared distance for some formula. /// - /// The other vector to use. + /// The other vector to use. /// The squared distance between the two vectors. - public real_t DistanceSquaredTo(Vector3 b) + public real_t DistanceSquaredTo(Vector3 to) { - return (b - this).LengthSquared(); + return (to - this).LengthSquared(); } /// - /// Returns the distance between this vector and . + /// Returns the distance between this vector and . /// /// - /// The other vector to use. + /// The other vector to use. /// The distance between the two vectors. - public real_t DistanceTo(Vector3 b) + public real_t DistanceTo(Vector3 to) { - return (b - this).Length(); + return (to - this).Length(); } /// - /// Returns the dot product of this vector and . + /// Returns the dot product of this vector and . /// - /// The other vector to use. + /// The other vector to use. /// The dot product of the two vectors. - public real_t Dot(Vector3 b) + public real_t Dot(Vector3 with) { - return (x * b.x) + (y * b.y) + (z * b.z); + return (x * with.x) + (y * with.y) + (z * with.z); } /// @@ -412,16 +412,16 @@ namespace Godot } /// - /// Returns the outer product with . + /// Returns the outer product with . /// - /// The other vector. + /// The other vector. /// A representing the outer product matrix. - public Basis Outer(Vector3 b) + public Basis Outer(Vector3 with) { return new Basis( - x * b.x, x * b.y, x * b.z, - y * b.x, y * b.y, y * b.z, - z * b.x, z * b.y, z * b.z + x * with.x, x * with.y, x * with.z, + y * with.x, y * with.y, y * with.z, + z * with.x, z * with.y, z * with.z ); } diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3i.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3i.cs index 474876fc915..562f653fa8b 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3i.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3i.cs @@ -124,36 +124,36 @@ namespace Godot } /// - /// Returns the squared distance between this vector and . + /// Returns the squared distance between this vector and . /// This method runs faster than , so prefer it if /// you need to compare vectors or need the squared distance for some formula. /// - /// The other vector to use. + /// The other vector to use. /// The squared distance between the two vectors. - public int DistanceSquaredTo(Vector3i b) + public int DistanceSquaredTo(Vector3i to) { - return (b - this).LengthSquared(); + return (to - this).LengthSquared(); } /// - /// Returns the distance between this vector and . + /// Returns the distance between this vector and . /// /// - /// The other vector to use. + /// The other vector to use. /// The distance between the two vectors. - public real_t DistanceTo(Vector3i b) + public real_t DistanceTo(Vector3i to) { - return (b - this).Length(); + return (to - this).Length(); } /// - /// Returns the dot product of this vector and . + /// Returns the dot product of this vector and . /// - /// The other vector to use. + /// The other vector to use. /// The dot product of the two vectors. - public int Dot(Vector3i b) + public int Dot(Vector3i with) { - return x * b.x + y * b.y + z * b.z; + return x * with.x + y * with.y + z * with.z; } ///