C#: Remove GetArea and GetVolume methods

- Remove `GetArea` method in favor of the `Area` property in Rect2{i}.
- Replace `GetVolume` method with a `Volume` property in AABB.
This commit is contained in:
Raul Santos 2023-01-24 20:03:32 +01:00
parent 0f8f0ab126
commit b3af6141a2
No known key found for this signature in database
GPG key ID: B532473AE3A803E4
3 changed files with 16 additions and 34 deletions

View file

@ -49,6 +49,15 @@ namespace Godot
set { _size = value - _position; } set { _size = value - _position; }
} }
/// <summary>
/// The volume of this <see cref="Aabb"/>.
/// See also <see cref="HasVolume"/>.
/// </summary>
public readonly real_t Volume
{
get { return _size.X * _size.Y * _size.Z; }
}
/// <summary> /// <summary>
/// Returns an <see cref="Aabb"/> with equivalent position and size, modified so that /// Returns an <see cref="Aabb"/> with equivalent position and size, modified so that
/// the most-negative corner is the origin and the size is positive. /// the most-negative corner is the origin and the size is positive.
@ -311,15 +320,6 @@ namespace Godot
dir.Z > 0f ? -halfExtents.Z : halfExtents.Z); dir.Z > 0f ? -halfExtents.Z : halfExtents.Z);
} }
/// <summary>
/// Returns the volume of the <see cref="Aabb"/>.
/// </summary>
/// <returns>The volume.</returns>
public readonly real_t GetVolume()
{
return _size.X * _size.Y * _size.Z;
}
/// <summary> /// <summary>
/// Returns a copy of the <see cref="Aabb"/> grown a given amount of units towards all the sides. /// Returns a copy of the <see cref="Aabb"/> grown a given amount of units towards all the sides.
/// </summary> /// </summary>
@ -383,7 +383,7 @@ namespace Godot
/// Returns <see langword="true"/> if the <see cref="Aabb"/> has /// Returns <see langword="true"/> if the <see cref="Aabb"/> has
/// area, and <see langword="false"/> if the <see cref="Aabb"/> /// area, and <see langword="false"/> if the <see cref="Aabb"/>
/// is linear, empty, or has a negative <see cref="Size"/>. /// is linear, empty, or has a negative <see cref="Size"/>.
/// See also <see cref="GetVolume"/>. /// See also <see cref="Volume"/>.
/// </summary> /// </summary>
/// <returns> /// <returns>
/// A <see langword="bool"/> for whether or not the <see cref="Aabb"/> has volume. /// A <see langword="bool"/> for whether or not the <see cref="Aabb"/> has volume.

View file

@ -51,11 +51,11 @@ namespace Godot
/// <summary> /// <summary>
/// The area of this <see cref="Rect2"/>. /// The area of this <see cref="Rect2"/>.
/// See also <see cref="HasArea"/>.
/// </summary> /// </summary>
/// <value>Equivalent to <see cref="GetArea()"/>.</value>
public readonly real_t Area public readonly real_t Area
{ {
get { return GetArea(); } get { return _size.X * _size.Y; }
} }
/// <summary> /// <summary>
@ -160,15 +160,6 @@ namespace Godot
return expanded; return expanded;
} }
/// <summary>
/// Returns the area of the <see cref="Rect2"/>.
/// </summary>
/// <returns>The area.</returns>
public readonly real_t GetArea()
{
return _size.X * _size.Y;
}
/// <summary> /// <summary>
/// Returns the center of the <see cref="Rect2"/>, which is equal /// Returns the center of the <see cref="Rect2"/>, which is equal
/// to <see cref="Position"/> + (<see cref="Size"/> / 2). /// to <see cref="Position"/> + (<see cref="Size"/> / 2).
@ -247,7 +238,7 @@ namespace Godot
/// Returns <see langword="true"/> if the <see cref="Rect2"/> has /// Returns <see langword="true"/> if the <see cref="Rect2"/> has
/// area, and <see langword="false"/> if the <see cref="Rect2"/> /// area, and <see langword="false"/> if the <see cref="Rect2"/>
/// is linear, empty, or has a negative <see cref="Size"/>. /// is linear, empty, or has a negative <see cref="Size"/>.
/// See also <see cref="GetArea"/>. /// See also <see cref="Area"/>.
/// </summary> /// </summary>
/// <returns> /// <returns>
/// A <see langword="bool"/> for whether or not the <see cref="Rect2"/> has area. /// A <see langword="bool"/> for whether or not the <see cref="Rect2"/> has area.

View file

@ -51,11 +51,11 @@ namespace Godot
/// <summary> /// <summary>
/// The area of this <see cref="Rect2I"/>. /// The area of this <see cref="Rect2I"/>.
/// See also <see cref="HasArea"/>.
/// </summary> /// </summary>
/// <value>Equivalent to <see cref="GetArea()"/>.</value>
public readonly int Area public readonly int Area
{ {
get { return GetArea(); } get { return _size.X * _size.Y; }
} }
/// <summary> /// <summary>
@ -150,15 +150,6 @@ namespace Godot
return expanded; return expanded;
} }
/// <summary>
/// Returns the area of the <see cref="Rect2I"/>.
/// </summary>
/// <returns>The area.</returns>
public readonly int GetArea()
{
return _size.X * _size.Y;
}
/// <summary> /// <summary>
/// Returns the center of the <see cref="Rect2I"/>, which is equal /// Returns the center of the <see cref="Rect2I"/>, which is equal
/// to <see cref="Position"/> + (<see cref="Size"/> / 2). /// to <see cref="Position"/> + (<see cref="Size"/> / 2).
@ -239,7 +230,7 @@ namespace Godot
/// Returns <see langword="true"/> if the <see cref="Rect2I"/> has /// Returns <see langword="true"/> if the <see cref="Rect2I"/> has
/// area, and <see langword="false"/> if the <see cref="Rect2I"/> /// area, and <see langword="false"/> if the <see cref="Rect2I"/>
/// is linear, empty, or has a negative <see cref="Size"/>. /// is linear, empty, or has a negative <see cref="Size"/>.
/// See also <see cref="GetArea"/>. /// See also <see cref="Area"/>.
/// </summary> /// </summary>
/// <returns> /// <returns>
/// A <see langword="bool"/> for whether or not the <see cref="Rect2I"/> has area. /// A <see langword="bool"/> for whether or not the <see cref="Rect2I"/> has area.