diff --git a/X10D/src/Drawing/Cuboid.cs b/X10D/src/Drawing/Cuboid.cs index 7d38506..cc2ebae 100644 --- a/X10D/src/Drawing/Cuboid.cs +++ b/X10D/src/Drawing/Cuboid.cs @@ -1,4 +1,4 @@ -using System.Numerics; +using System.Numerics; using X10D.Numerics; namespace X10D.Drawing; @@ -257,6 +257,19 @@ public readonly struct Cuboid : IEquatable get => LocalBackBottomRight + Center; } + /// + /// Gets the volume of this cuboid. + /// + /// The volume. + public float Volume + { + get + { + Vector3 size = Size; + return size.X * size.Y * size.Z; + } + } + /// /// Returns a value indicating whether two instances of are not equal. /// diff --git a/X10D/src/Drawing/Sphere.cs b/X10D/src/Drawing/Sphere.cs index 6b977d0..b5d3124 100644 --- a/X10D/src/Drawing/Sphere.cs +++ b/X10D/src/Drawing/Sphere.cs @@ -53,7 +53,16 @@ public readonly struct Sphere : IEquatable, IComparable, ICompar public float Radius { get; } /// - /// Returns a value indicating whether two instances of are equal. + /// Gets the volume of this sphere. + /// + /// The volume. + public float Volume + { + get => (4f / 3f) * MathF.PI * Radius * Radius * Radius; + } + + /// + /// Returns a value indicating whether two instances of are equal. /// /// The first instance. /// The second instance.