feat: added IEquatable interfaces to primitives
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
using System;
|
||||
|
||||
namespace Engine.Core;
|
||||
|
||||
/// <summary>
|
||||
@@ -5,7 +7,7 @@ namespace Engine.Core;
|
||||
/// </summary>
|
||||
/// <param name="Origin">The <see cref="Vector2D"/> in 2D space where the ray starts from.</param>
|
||||
/// <param name="Direction">Normalized <see cref="Vector2D"/> indicating the ray's is direction.</param>
|
||||
public readonly struct Ray2D(Vector2D Origin, Vector2D Direction)
|
||||
public readonly struct Ray2D(Vector2D Origin, Vector2D Direction) : IEquatable<Ray2D>
|
||||
{
|
||||
/// <summary>
|
||||
/// The starting point of the <see cref="Ray2D"/>.
|
||||
@@ -72,6 +74,7 @@ public readonly struct Ray2D(Vector2D Origin, Vector2D Direction)
|
||||
/// <param name="obj">The object to compare with the current <see cref="Ray2D"/>.</param>
|
||||
/// <returns><see cref="true"/> if the specified object is equal to the current <see cref="Ray2D"/>; otherwise, <see cref="false"/>.</returns>
|
||||
public override bool Equals(object? obj) => obj is Ray2D ray2D && this == ray2D;
|
||||
public bool Equals(Ray2D other) => this == other;
|
||||
|
||||
/// <summary>
|
||||
/// Generates a hash code for the <see cref="Ray2D"/>.
|
||||
|
Reference in New Issue
Block a user