feat: added IEquatable interfaces to primitives

This commit is contained in:
2025-10-16 13:59:49 +03:00
parent 28bc022587
commit 69bc6573d1
14 changed files with 53 additions and 14 deletions

View File

@@ -1,7 +1,9 @@
using System;
namespace Engine.Core;
[System.Diagnostics.DebuggerDisplay("A: {A.ToString(), nq}, B: {B.ToString(), nq}, B: {C.ToString(), nq}")]
public readonly struct Triangle(Vector2D A, Vector2D B, Vector2D C)
public readonly struct Triangle(Vector2D A, Vector2D B, Vector2D C) : IEquatable<Triangle>
{
public readonly Vector2D A { get; init; } = A;
public readonly Vector2D B { get; init; } = B;
@@ -54,6 +56,7 @@ public readonly struct Triangle(Vector2D A, Vector2D B, Vector2D C)
/// <param name="obj">The object to compare with the current <see cref="Triangle"/>.</param>
/// <returns><see cref="true"/> if the specified object is equal to the current <see cref="Triangle"/>; otherwise, <see cref="false"/>.</returns>
public override bool Equals(object? obj) => obj is Triangle triangle && this == triangle;
public bool Equals(Triangle other) => this == other;
/// <summary>
/// Generates a hash code for the <see cref="Triangle"/>.