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,3 +1,5 @@
using System;
namespace Engine.Core;
/// <summary>
@@ -10,7 +12,7 @@ namespace Engine.Core;
/// Initializes a new instance of the <see cref="Vector3D"/> struct with the specified positions.
/// </remarks>
[System.Diagnostics.DebuggerDisplay("{ToString(),nq}, Length: {Magnitude}, LengthSquared: {MagnitudeSquared}, Normalized: {Normalized.ToString(),nq}")]
public readonly struct Vector3D(float x, float y, float z)
public readonly struct Vector3D(float x, float y, float z) : IEquatable<Vector3D>
{
/// <summary>
/// The X coordinate of the <see cref="Vector3D"/>.
@@ -277,6 +279,7 @@ public readonly struct Vector3D(float x, float y, float z)
/// <param name="obj">The object to compare with the current <see cref="Vector3D"/>.</param>
/// <returns><see cref="true"/> if the specified object is equal to the current <see cref="Vector3D"/>; otherwise, <see cref="false"/>.</returns>
public override bool Equals(object? obj) => obj is Vector3D vector3D && this == vector3D;
public bool Equals(Vector3D other) => this == other;
/// <summary>
/// Generates a hash code for the <see cref="Vector3D"/>.