namespace View_by_Distance.FaceRecognitionDotNet; /// /// Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional plane. /// public readonly struct Point : IEquatable { #region Constructors /// /// Initializes a new instance of the structure with the specified coordinates. /// /// The horizontal position of the point. /// The vertical position of the point. public Point(int x, int y) { X = x; Y = y; } internal Point(DlibDotNet.Point point) { X = point.X; Y = point.Y; } #endregion #region Properties /// /// Gets the x-coordinate of this . /// public int X { get; } /// /// Gets the y-coordinate of this . /// public int Y { get; } #endregion #region Methods /// /// Compares two structures for equality. /// /// The point to compare to this instance. /// true if both structures contain the same and values; otherwise, false. public bool Equals(Point other) { return X == other.X && Y == other.Y; } #region overrides /// /// Determines whether the specified is a and whether it contains the same coordinates as this . /// /// The to compare. /// true if is a and contains the same and values as this ; otherwise, false. public override bool Equals(object? obj) => obj is Point point && Equals(point); /// /// Returns the hash code for this . /// /// The hash code for this structure. #pragma warning disable IDE0070 public override int GetHashCode() #pragma warning restore IDE0070 { int hashCode = 1861411795; hashCode = hashCode * -1521134295 + X.GetHashCode(); hashCode = hashCode * -1521134295 + Y.GetHashCode(); return hashCode; } /// /// Compares two structures for equality. /// /// The first structure to compare. /// The second structure to compare. /// true if both the and coordinates of and are equal; otherwise, false. public static bool operator ==(Point point1, Point point2) => point1.Equals(point2); /// /// Compares two structures for inequality. /// /// The first structure to compare. /// The second structure to compare. /// true if and have different or coordinates; false if and have the same and coordinates. public static bool operator !=(Point point1, Point point2) => !(point1 == point2); #endregion #endregion }