/// <summary> /// Checks whether the two points are spatially equal /// </summary> /// <param name="p1">Point 1</param> /// <param name="p2">Point 2</param> /// <returns>true if the points a spatially equal</returns> public bool Equals(Point3D p1, Point3D p2) { return (p1.X == p2.X && p1.Y == p2.Y && p1.Z == p2.Z); }
/// <summary> /// Comparator used for ordering point first by ascending X, then by ascending Y and then by ascending Z. /// </summary> /// <param name="other"></param> /// <returns></returns> public virtual int CompareTo(Point3D other) { if (X < other.X || X == other.X && Y < other.Y || X == other.X && Y == other.Y && Z < other.Z) return -1; else if (X > other.X || X == other.X && Y > other.Y || X == other.X && Y == other.Y && Z > other.Z) return 1; else // (this.X == other.X && this.Y == other.Y && this.Z == other.Z) return 0; }
/// <summary> /// Checks whether this instance is spatially equal to the Point 'o' /// </summary> /// <param name="p">Point to compare to</param> /// <returns></returns> public bool Equals(Point3D p) { return base.Equals(p) && p.Z == _z; }