feat: added IEquatable interfaces to primitives
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Engine.Core;
|
||||
@@ -11,7 +12,7 @@ namespace Engine.Core;
|
||||
/// Initializes a new instance of the <see cref="Circle"/> struct with the specified center and radius.
|
||||
/// </remarks>
|
||||
[DebuggerDisplay("Center: {Center.ToString(),nq}, Radius: {Radius}")]
|
||||
public readonly struct Circle(Vector2D center, float radius)
|
||||
public readonly struct Circle(Vector2D center, float radius) : IEquatable<Circle>
|
||||
{
|
||||
/// <summary>
|
||||
/// The center of the circle.
|
||||
@@ -87,6 +88,7 @@ public readonly struct Circle(Vector2D center, float radius)
|
||||
/// <param name="obj">The object to compare with the current <see cref="Circle"/>.</param>
|
||||
/// <returns><see cref="true"/> if the specified object is equal to the current <see cref="Circle"/>; otherwise, <see cref="false"/>.</returns>
|
||||
public override bool Equals(object? obj) => obj is Circle circle && this == circle;
|
||||
public bool Equals(Circle other) => this == other;
|
||||
|
||||
/// <summary>
|
||||
/// Generates a hash code for the <see cref="Circle"/>.
|
||||
|
Reference in New Issue
Block a user