1using System.Globalization;
33 public float X {
get;
set; }
39 public float Y {
get;
set; }
45 public float Z {
get;
set; }
51 public static IEqualityComparer<PointXYZ>
Comparer {
get; } =
new PointXYZEqualityComparer();
62 $
"{nameof(X)}: {X.ToString("0.0
", CultureInfo.InvariantCulture)}, " +
63 $
"{nameof(Y)}: {Y.ToString("0.0
", CultureInfo.InvariantCulture)}, " +
64 $
"{nameof(Z)}: {Z.ToString("0.0
", CultureInfo.InvariantCulture)}";
67 private sealed class PointXYZEqualityComparer : IEqualityComparer<PointXYZ>
71 if (ReferenceEquals(x, y))
76 if (ReferenceEquals(x,
null))
81 if (ReferenceEquals(y,
null))
86 return x.
X.Equals(y.
X) && x.
Y.Equals(y.
Y) && x.
Z.Equals(y.
Z);
89 public int GetHashCode(PointXYZ obj)
91 return (obj.X, obj.Y, obj.Z).GetHashCode();
A point consists of x, y and z coordinate.
PointXYZ(float x, float y, float z)
Initializes a new instance of the PointXYZ class with specified coordinates.
float Z
Gets or sets the Z coordinate of the point.
override string ToString()
Returns a string representation of the point.
float X
Gets or sets the X coordinate of the point.
static IEqualityComparer< PointXYZ > Comparer
Gets a default equality comparer for comparing PointXYZ data values.
float Y
Gets or sets the Y coordinate of the point.