diff options
author | Aaron Franke <arnfranke@yahoo.com> | 2022-08-15 11:42:44 -0500 |
---|---|---|
committer | Aaron Franke <arnfranke@yahoo.com> | 2022-09-04 23:03:36 -0500 |
commit | 7c2f0a82f0726d299e12a93ea78f9f718ae04919 (patch) | |
tree | ac353d9b3df8c537e8fcc72c7fcafe311911fede /modules/mono/glue | |
parent | 995b9f94e8378b3e1dd81068925e9d34c68445c6 (diff) |
Replace AABB/Rect2(i) HasNo* methods in C#
Diffstat (limited to 'modules/mono/glue')
-rw-r--r-- | modules/mono/glue/GodotSharp/GodotSharp/Core/AABB.cs | 70 | ||||
-rw-r--r-- | modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs | 10 | ||||
-rw-r--r-- | modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2i.cs | 10 |
3 files changed, 49 insertions, 41 deletions
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/AABB.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/AABB.cs index 17f680361d..d8a6644a66 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/AABB.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/AABB.cs @@ -133,15 +133,6 @@ namespace Godot } /// <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> /// <param name="idx">Which endpoint to get.</param> @@ -321,6 +312,15 @@ namespace Godot } /// <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> /// <param name="by">The amount to grow by.</param> @@ -340,30 +340,6 @@ namespace Godot } /// <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. /// </summary> @@ -390,6 +366,34 @@ namespace Godot } /// <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> /// <param name="with">The other <see cref="AABB"/>.</param> diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs index 0b475fec19..e80d75dacf 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs @@ -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> diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2i.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2i.cs index 8a2a98d6ee..b2768476cc 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2i.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2i.cs @@ -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> |