mirror of
https://github.com/godotengine/godot.git
synced 2024-12-03 01:22:21 +00:00
Add IsZeroApprox
to C# vectors
This commit is contained in:
parent
3c9bf4bc21
commit
14c16746f3
@ -529,7 +529,7 @@
|
||||
<return type="bool" />
|
||||
<param index="0" name="x" type="float" />
|
||||
<description>
|
||||
Returns [code]true[/code] if [param x] is zero or almost zero.
|
||||
Returns [code]true[/code] if [param x] is zero or almost zero. The comparison is done using a tolerance calculation with a small internal epsilon.
|
||||
This function is faster than using [method is_equal_approx] with one value as zero.
|
||||
</description>
|
||||
</method>
|
||||
|
@ -460,10 +460,11 @@ namespace Godot
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns <see langword="true"/> if <paramref name="s"/> is approximately zero.
|
||||
/// Returns <see langword="true"/> if <paramref name="s"/> is zero or almost zero.
|
||||
/// The comparison is done using a tolerance calculation with <see cref="Epsilon"/>.
|
||||
///
|
||||
/// This method is faster than using <see cref="IsEqualApprox(real_t, real_t)"/> with one value as zero.
|
||||
/// This method is faster than using <see cref="IsEqualApprox(real_t, real_t)"/> with
|
||||
/// one value as zero.
|
||||
/// </summary>
|
||||
/// <param name="s">The value to check.</param>
|
||||
/// <returns>A <see langword="bool"/> for whether or not the value is nearly zero.</returns>
|
||||
|
@ -988,6 +988,18 @@ namespace Godot
|
||||
return Mathf.IsEqualApprox(x, other.x) && Mathf.IsEqualApprox(y, other.y);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns <see langword="true"/> if this vector's values are approximately zero,
|
||||
/// by running <see cref="Mathf.IsZeroApprox(real_t)"/> on each component.
|
||||
/// This method is faster than using <see cref="IsEqualApprox"/> with one value
|
||||
/// as a zero vector.
|
||||
/// </summary>
|
||||
/// <returns>Whether or not the vector is approximately zero.</returns>
|
||||
public readonly bool IsZeroApprox()
|
||||
{
|
||||
return Mathf.IsZeroApprox(x) && Mathf.IsZeroApprox(y);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serves as the hash function for <see cref="Vector2"/>.
|
||||
/// </summary>
|
||||
|
@ -1059,6 +1059,18 @@ namespace Godot
|
||||
return Mathf.IsEqualApprox(x, other.x) && Mathf.IsEqualApprox(y, other.y) && Mathf.IsEqualApprox(z, other.z);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns <see langword="true"/> if this vector's values are approximately zero,
|
||||
/// by running <see cref="Mathf.IsZeroApprox(real_t)"/> on each component.
|
||||
/// This method is faster than using <see cref="IsEqualApprox"/> with one value
|
||||
/// as a zero vector.
|
||||
/// </summary>
|
||||
/// <returns>Whether or not the vector is approximately zero.</returns>
|
||||
public readonly bool IsZeroApprox()
|
||||
{
|
||||
return Mathf.IsZeroApprox(x) && Mathf.IsZeroApprox(y) && Mathf.IsZeroApprox(z);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serves as the hash function for <see cref="Vector3"/>.
|
||||
/// </summary>
|
||||
|
@ -856,6 +856,18 @@ namespace Godot
|
||||
return Mathf.IsEqualApprox(x, other.x) && Mathf.IsEqualApprox(y, other.y) && Mathf.IsEqualApprox(z, other.z) && Mathf.IsEqualApprox(w, other.w);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns <see langword="true"/> if this vector's values are approximately zero,
|
||||
/// by running <see cref="Mathf.IsZeroApprox(real_t)"/> on each component.
|
||||
/// This method is faster than using <see cref="IsEqualApprox"/> with one value
|
||||
/// as a zero vector.
|
||||
/// </summary>
|
||||
/// <returns>Whether or not the vector is approximately zero.</returns>
|
||||
public readonly bool IsZeroApprox()
|
||||
{
|
||||
return Mathf.IsZeroApprox(x) && Mathf.IsZeroApprox(y) && Mathf.IsZeroApprox(z) && Mathf.IsZeroApprox(w);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serves as the hash function for <see cref="Vector4"/>.
|
||||
/// </summary>
|
||||
|
Loading…
Reference in New Issue
Block a user