Replace AABB/Rect2(i) HasNo* methods in C#

This commit is contained in:
Aaron Franke 2022-08-15 11:42:44 -05:00
parent 995b9f94e8
commit 7c2f0a82f0
No known key found for this signature in database
GPG Key ID: 40A1750B977E56BF
3 changed files with 49 additions and 41 deletions

View File

@ -132,15 +132,6 @@ namespace Godot
return new AABB(begin, end - begin);
}
/// <summary>
/// Returns the area of the <see cref="AABB"/>.
/// </summary>
/// <returns>The area.</returns>
public real_t GetArea()
{
return _size.x * _size.y * _size.z;
}
/// <summary>
/// Gets the position of one of the 8 endpoints of the <see cref="AABB"/>.
/// </summary>
@ -320,6 +311,15 @@ namespace Godot
dir.z > 0f ? -halfExtents.z : halfExtents.z);
}
/// <summary>
/// Returns the volume of the <see cref="AABB"/>.
/// </summary>
/// <returns>The volume.</returns>
public real_t GetVolume()
{
return _size.x * _size.y * _size.z;
}
/// <summary>
/// Returns a copy of the <see cref="AABB"/> grown a given amount of units towards all the sides.
/// </summary>
@ -339,30 +339,6 @@ namespace Godot
return res;
}
/// <summary>
/// Returns <see langword="true"/> if the <see cref="AABB"/> is flat or empty,
/// or <see langword="false"/> otherwise.
/// </summary>
/// <returns>
/// A <see langword="bool"/> for whether or not the <see cref="AABB"/> has area.
/// </returns>
public bool HasNoArea()
{
return _size.x <= 0f || _size.y <= 0f || _size.z <= 0f;
}
/// <summary>
/// Returns <see langword="true"/> if the <see cref="AABB"/> has no surface (no size),
/// or <see langword="false"/> otherwise.
/// </summary>
/// <returns>
/// A <see langword="bool"/> for whether or not the <see cref="AABB"/> has area.
/// </returns>
public bool HasNoSurface()
{
return _size.x <= 0f && _size.y <= 0f && _size.z <= 0f;
}
/// <summary>
/// Returns <see langword="true"/> if the <see cref="AABB"/> contains a point,
/// or <see langword="false"/> otherwise.
@ -389,6 +365,34 @@ namespace Godot
return true;
}
/// <summary>
/// Returns <see langword="true"/> if the <see cref="AABB"/>
/// has a surface or a length, and <see langword="false"/>
/// if the <see cref="AABB"/> is empty (all components
/// of <see cref="Size"/> are zero or negative).
/// </summary>
/// <returns>
/// A <see langword="bool"/> for whether or not the <see cref="AABB"/> has surface.
/// </returns>
public bool HasSurface()
{
return _size.x > 0.0f || _size.y > 0.0f || _size.z > 0.0f;
}
/// <summary>
/// Returns <see langword="true"/> if the <see cref="AABB"/> has
/// area, and <see langword="false"/> if the <see cref="AABB"/>
/// is linear, empty, or has a negative <see cref="Size"/>.
/// See also <see cref="GetVolume"/>.
/// </summary>
/// <returns>
/// A <see langword="bool"/> for whether or not the <see cref="AABB"/> has volume.
/// </returns>
public bool HasVolume()
{
return _size.x > 0.0f && _size.y > 0.0f && _size.z > 0.0f;
}
/// <summary>
/// Returns the intersection of this <see cref="AABB"/> and <paramref name="with"/>.
/// </summary>

View File

@ -234,15 +234,17 @@ namespace Godot
}
/// <summary>
/// Returns <see langword="true"/> if the <see cref="Rect2"/> is flat or empty,
/// or <see langword="false"/> otherwise.
/// Returns <see langword="true"/> if the <see cref="Rect2"/> has
/// area, and <see langword="false"/> if the <see cref="Rect2"/>
/// is linear, empty, or has a negative <see cref="Size"/>.
/// See also <see cref="GetArea"/>.
/// </summary>
/// <returns>
/// A <see langword="bool"/> for whether or not the <see cref="Rect2"/> has area.
/// </returns>
public bool HasNoArea()
public bool HasArea()
{
return _size.x <= 0 || _size.y <= 0;
return _size.x > 0.0f && _size.y > 0.0f;
}
/// <summary>

View File

@ -236,15 +236,17 @@ namespace Godot
}
/// <summary>
/// Returns <see langword="true"/> if the <see cref="Rect2i"/> is flat or empty,
/// or <see langword="false"/> otherwise.
/// Returns <see langword="true"/> if the <see cref="Rect2i"/> has
/// area, and <see langword="false"/> if the <see cref="Rect2i"/>
/// is linear, empty, or has a negative <see cref="Size"/>.
/// See also <see cref="GetArea"/>.
/// </summary>
/// <returns>
/// A <see langword="bool"/> for whether or not the <see cref="Rect2i"/> has area.
/// </returns>
public bool HasNoArea()
public bool HasArea()
{
return _size.x <= 0 || _size.y <= 0;
return _size.x > 0 && _size.y > 0;
}
/// <summary>