From 27108ba8d0c58d93f6cd5e16f97728f5ef208c2c Mon Sep 17 00:00:00 2001
From: Christopher Whitley <103014489+AristurtleDev@users.noreply.github.com>
Date: Wed, 29 May 2024 00:01:26 -0400
Subject: [PATCH] Replace `Size3` with `Vector3` (#872)
---
source/MonoGame.Extended/Math/Point3.cs | 54 +----
source/MonoGame.Extended/Math/Size3.cs | 289 ------------------------
2 files changed, 1 insertion(+), 342 deletions(-)
delete mode 100644 source/MonoGame.Extended/Math/Size3.cs
diff --git a/source/MonoGame.Extended/Math/Point3.cs b/source/MonoGame.Extended/Math/Point3.cs
index cb7b2493..73e060cf 100644
--- a/source/MonoGame.Extended/Math/Point3.cs
+++ b/source/MonoGame.Extended/Math/Point3.cs
@@ -232,58 +232,6 @@ namespace MonoGame.Extended
return vector;
}
- ///
- /// Translates a by a given .
- ///
- /// The point.
- /// The size.
- ///
- /// The result of the operator.
- ///
- public static Point3 operator +(Point3 point, Size3 size)
- {
- return Add(point, size);
- }
-
- ///
- /// Translates a by a given .
- ///
- /// The point.
- /// The size.
- ///
- /// The result of the operator.
- ///
- public static Point3 Add(Point3 point, Size3 size)
- {
- return new Point3(point.X + size.Width, point.Y + size.Height, point.Z + size.Depth);
- }
-
- ///
- /// Translates a by the negative of a given .
- ///
- /// The point.
- /// The size.
- ///
- /// The result of the operator.
- ///
- public static Point3 operator -(Point3 point, Size3 size)
- {
- return Subtract(point, size);
- }
-
- ///
- /// Translates a by the negative of a given .
- ///
- /// The point.
- /// The size.
- ///
- /// The result of the operator.
- ///
- public static Point3 Subtract(Point3 point, Size3 size)
- {
- return new Point3(point.X - size.Width, point.Y - size.Height, point.Z - size.Depth);
- }
-
///
/// Returns a hash code of this suitable for use in hashing algorithms and data
/// structures like a hash table.
@@ -376,4 +324,4 @@ namespace MonoGame.Extended
internal string DebugDisplayString => ToString();
}
-}
\ No newline at end of file
+}
diff --git a/source/MonoGame.Extended/Math/Size3.cs b/source/MonoGame.Extended/Math/Size3.cs
deleted file mode 100644
index 9872aee6..00000000
--- a/source/MonoGame.Extended/Math/Size3.cs
+++ /dev/null
@@ -1,289 +0,0 @@
-using System;
-using Microsoft.Xna.Framework;
-
-namespace MonoGame.Extended
-{
- ///
- /// A three dimensional size defined by two real numbers, a width a height and a depth.
- ///
- ///
- ///
- /// A size is a subspace of three-dimensional space, the area of which is described in terms of a three-dimensional
- /// coordinate system, given by a reference point and three coordinate axes.
- ///
- ///
- ///
- ///
- public struct Size3 : IEquatable, IEquatableByRef
- {
- ///
- /// Returns a with and equal to 0.0f.
- ///
- public static readonly Size3 Empty = new Size3();
-
- ///
- /// The horizontal component of this .
- ///
- public float Width;
-
- ///
- /// The vertical component of this .
- ///
- public float Height;
-
- ///
- /// The vertical component of this .
- ///
- public float Depth;
-
- ///
- /// Gets a value that indicates whether this is empty.
- ///
- // ReSharper disable CompareOfFloatsByEqualityOperator
- public bool IsEmpty => (Width == 0) && (Height == 0) && (Depth == 0);
-
- // ReSharper restore CompareOfFloatsByEqualityOperator
-
- ///
- /// Initializes a new instance of the structure from the specified dimensions.
- ///
- /// The width.
- /// The height.
- /// The depth.
- public Size3(float width, float height, float depth)
- {
- Width = width;
- Height = height;
- Depth = depth;
- }
-
- ///
- /// Compares two structures. The result specifies
- /// whether the values of the and
- /// fields of the two structures are equal.
- ///
- /// The first size.
- /// The second size.
- ///
- /// true if the and
- /// fields of the two structures are equal; otherwise, false.
- ///
- public static bool operator ==(Size3 first, Size3 second)
- {
- return first.Equals(ref second);
- }
-
- ///
- /// Indicates whether this is equal to another .
- ///
- /// The size.
- ///
- /// true if this is equal to the parameter; otherwise,
- /// false.
- ///
- public bool Equals(Size3 size)
- {
- return Equals(ref size);
- }
-
- ///
- /// Indicates whether this is equal to another .
- ///
- /// The size.
- ///
- /// true if this is equal to the ; otherwise,
- /// false.
- ///
- public bool Equals(ref Size3 size)
- {
- // ReSharper disable CompareOfFloatsByEqualityOperator
- return (Width == size.Width) && (Height == size.Height) && (Depth == size.Depth);
- // ReSharper restore CompareOfFloatsByEqualityOperator
- }
-
- ///
- /// Returns a value indicating whether this is equal to a specified object.
- ///
- /// The object to make the comparison with.
- ///
- /// true if this is equal to ; otherwise, false.
- ///
- public override bool Equals(object obj)
- {
- if (obj is Size3)
- return Equals((Size3) obj);
- return false;
- }
-
- ///
- /// Compares two structures. The result specifies
- /// whether the values of the or
- /// fields of the two structures are unequal.
- ///
- /// The first size.
- /// The second size.
- ///
- /// true if the or
- /// fields of the two structures are unequal; otherwise, false.
- ///
- public static bool operator !=(Size3 first, Size3 second)
- {
- return !(first == second);
- }
-
- ///
- /// Calculates the representing the vector addition of two structures as if
- /// they were structures.
- ///
- /// The first size.
- /// The second size.
- ///
- /// The representing the vector addition of two structures as if they
- /// were structures.
- ///
- public static Size3 operator +(Size3 first, Size3 second)
- {
- return Add(first, second);
- }
-
- ///
- /// Calculates the representing the vector addition of two structures.
- ///
- /// The first size.
- /// The second size.
- ///
- /// The representing the vector addition of two structures.
- ///
- public static Size3 Add(Size3 first, Size3 second)
- {
- Size3 size;
- size.Width = first.Width + second.Width;
- size.Height = first.Height + second.Height;
- size.Depth = first.Depth + second.Depth;
- return size;
- }
-
- ///
- /// Calculates the representing the vector subtraction of two structures.
- ///
- /// The first size.
- /// The second size.
- ///
- /// The representing the vector subtraction of two structures.
- ///
- public static Size3 operator -(Size3 first, Size3 second)
- {
- return Subtract(first, second);
- }
-
- public static Size3 operator /(Size3 size, float value)
- {
- return new Size3(size.Width / value, size.Height / value, size.Depth / value);
- }
-
- public static Size3 operator *(Size3 size, float value)
- {
- return new Size3(size.Width * value, size.Height * value, size.Depth * value);
- }
-
- ///
- /// Calculates the representing the vector subtraction of two structures.
- ///
- /// The first size.
- /// The second size.
- ///
- /// The representing the vector subtraction of two structures.
- ///
- public static Size3 Subtract(Size3 first, Size3 second)
- {
- Size3 size;
- size.Width = first.Width - second.Width;
- size.Height = first.Height - second.Height;
- size.Depth = first.Depth - second.Depth;
- return size;
- }
-
- ///
- /// Returns a hash code of this suitable for use in hashing algorithms and data
- /// structures like a hash table.
- ///
- ///
- /// A hash code of this .
- ///
- public override int GetHashCode()
- {
- unchecked
- {
- unchecked
- {
- int hash = 17;
- hash = hash * 23 + Width.GetHashCode();
- hash = hash * 23 + Height.GetHashCode();
- hash = hash * 23 + Depth.GetHashCode();
- return hash;
- }
- }
- }
-
- ///
- /// Performs an implicit conversion from a to a .
- ///
- /// The point.
- ///
- /// The resulting .
- ///
- public static implicit operator Size3(Point3 point)
- {
- return new Size3(point.X, point.Y, point.Z);
- }
-
- ///
- /// Performs an implicit conversion from a to a .
- ///
- /// The size.
- ///
- /// The resulting .
- ///
- public static implicit operator Point3(Size3 size)
- {
- return new Point3(size.Width, size.Height, size.Depth);
- }
-
- ///
- /// Performs an implicit conversion from a to a .
- ///
- /// The size.
- ///
- /// The resulting .
- ///
- public static implicit operator Vector3(Size3 size)
- {
- return new Vector3(size.Width, size.Height, size.Depth);
- }
-
- ///
- /// Performs an implicit conversion from a to a .
- ///
- /// The vector.
- ///
- /// The resulting .
- ///
- public static implicit operator Size3(Vector3 vector)
- {
- return new Size3(vector.X, vector.Y, vector.Z);
- }
-
- ///
- /// Returns a that represents this .
- ///
- ///
- /// A that represents this .
- ///
- public override string ToString()
- {
- return $"Width: {Width}, Height: {Height}, Depth: {Depth}";
- }
-
- internal string DebugDisplayString => ToString();
- }
-}
\ No newline at end of file