From 7c2f0a82f0726d299e12a93ea78f9f718ae04919 Mon Sep 17 00:00:00 2001 From: Aaron Franke Date: Mon, 15 Aug 2022 11:42:44 -0500 Subject: Replace AABB/Rect2(i) HasNo* methods in C# --- .../mono/glue/GodotSharp/GodotSharp/Core/AABB.cs | 70 ++++++++++++---------- .../mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs | 10 ++-- .../mono/glue/GodotSharp/GodotSharp/Core/Rect2i.cs | 10 ++-- 3 files changed, 49 insertions(+), 41 deletions(-) (limited to 'modules/mono/glue') 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 @@ -132,15 +132,6 @@ namespace Godot return new AABB(begin, end - begin); } - /// - /// Returns the area of the . - /// - /// The area. - public real_t GetArea() - { - return _size.x * _size.y * _size.z; - } - /// /// Gets the position of one of the 8 endpoints of the . /// @@ -320,6 +311,15 @@ namespace Godot dir.z > 0f ? -halfExtents.z : halfExtents.z); } + /// + /// Returns the volume of the . + /// + /// The volume. + public real_t GetVolume() + { + return _size.x * _size.y * _size.z; + } + /// /// Returns a copy of the grown a given amount of units towards all the sides. /// @@ -339,30 +339,6 @@ namespace Godot return res; } - /// - /// Returns if the is flat or empty, - /// or otherwise. - /// - /// - /// A for whether or not the has area. - /// - public bool HasNoArea() - { - return _size.x <= 0f || _size.y <= 0f || _size.z <= 0f; - } - - /// - /// Returns if the has no surface (no size), - /// or otherwise. - /// - /// - /// A for whether or not the has area. - /// - public bool HasNoSurface() - { - return _size.x <= 0f && _size.y <= 0f && _size.z <= 0f; - } - /// /// Returns if the contains a point, /// or otherwise. @@ -389,6 +365,34 @@ namespace Godot return true; } + /// + /// Returns if the + /// has a surface or a length, and + /// if the is empty (all components + /// of are zero or negative). + /// + /// + /// A for whether or not the has surface. + /// + public bool HasSurface() + { + return _size.x > 0.0f || _size.y > 0.0f || _size.z > 0.0f; + } + + /// + /// Returns if the has + /// area, and if the + /// is linear, empty, or has a negative . + /// See also . + /// + /// + /// A for whether or not the has volume. + /// + public bool HasVolume() + { + return _size.x > 0.0f && _size.y > 0.0f && _size.z > 0.0f; + } + /// /// Returns the intersection of this and . /// 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 } /// - /// Returns if the is flat or empty, - /// or otherwise. + /// Returns if the has + /// area, and if the + /// is linear, empty, or has a negative . + /// See also . /// /// /// A for whether or not the has area. /// - public bool HasNoArea() + public bool HasArea() { - return _size.x <= 0 || _size.y <= 0; + return _size.x > 0.0f && _size.y > 0.0f; } /// 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 } /// - /// Returns if the is flat or empty, - /// or otherwise. + /// Returns if the has + /// area, and if the + /// is linear, empty, or has a negative . + /// See also . /// /// /// A for whether or not the has area. /// - public bool HasNoArea() + public bool HasArea() { - return _size.x <= 0 || _size.y <= 0; + return _size.x > 0 && _size.y > 0; } /// -- cgit v1.2.3