diff --git a/Engine.Core/Primitives/Projection1D.cs b/Engine.Core/Primitives/Projection1D.cs
index 3a664b4..d144125 100644
--- a/Engine.Core/Primitives/Projection1D.cs
+++ b/Engine.Core/Primitives/Projection1D.cs
@@ -71,6 +71,16 @@ public readonly struct Projection1D(float min, float max)
return false;
}
+ ///
+ /// Checks if two s are approximately equal within a specified epsilon range.
+ ///
+ /// The first .
+ /// The second .
+ /// The epsilon range.
+ /// if the s are approximately equal; otherwise, .
+ public static bool ApproximatelyEquals(Projection1D left, Projection1D right, float epsilon = float.Epsilon)
+ => left.Min.ApproximatelyEquals(right.Min, epsilon) && left.Max.ApproximatelyEquals(right.Max, epsilon);
+
///
/// Determines whether the specified object is equal to the current .
///
@@ -101,4 +111,7 @@ public static class Projection1DExtensions
///
public static bool Overlaps(this Projection1D left, Projection1D right, out float depth) => Projection1D.Overlaps(left, right, out depth);
+
+ ///
+ public static bool ApproximatelyEquals(this Projection1D left, Projection1D right, float epsilon = float.Epsilon) => Projection1D.ApproximatelyEquals(left, right, epsilon);
}
diff --git a/Engine.Core/Primitives/Ray2D.cs b/Engine.Core/Primitives/Ray2D.cs
index 721dfdd..ed57996 100644
--- a/Engine.Core/Primitives/Ray2D.cs
+++ b/Engine.Core/Primitives/Ray2D.cs
@@ -56,6 +56,16 @@ public readonly struct Ray2D(Vector2D Origin, Vector2D Direction)
return ray.Origin + ray.Direction * dot;
}
+ ///
+ /// Checks if two s are approximately equal within a specified epsilon range.
+ ///
+ /// The first .
+ /// The second .
+ /// The epsilon range.
+ /// if the s are approximately equal; otherwise, .
+ public static bool ApproximatelyEquals(Ray2D left, Ray2D right, float epsilon = float.Epsilon)
+ => left.Origin.ApproximatelyEquals(right.Origin, epsilon) && left.Direction.ApproximatelyEquals(right.Direction, epsilon);
+
///
/// Determines whether the specified object is equal to the current .
///
@@ -89,4 +99,7 @@ public static class Ray2DExtensions
///
+ public static bool ApproximatelyEquals(this Ray2D left, Ray2D right, float epsilon = float.Epsilon) => Ray2D.ApproximatelyEquals(left, right, epsilon);
}