/// <summary> /// Check if the point is coincident with another point. /// </summary> /// <param name="obj">The object with which to compare.</param> /// <param name="tolerance">The tolerance. Default value: 0.0.</param> /// <returns>Result of comparison.</returns> public bool SamePoint(GmshMeshNode obj, double tolerance = 0.0) { for (int i = 0; i < 3; ++i) { if (Math.Abs(obj.GetValue(i) - this.GetValue(i)) > tolerance) { return(false); } } return(true); }
public GmshMeshNode FindNearestNode(Point3D p) { double distance = double.MaxValue; GmshMeshNode nearestNode = _nodes[0]; foreach (var n in _nodes) { double d = (n.Point - p).Length; if (d == 0.0) { // Exact point found return(n); } else if (d < distance) { distance = d; nearestNode = n; } } return(nearestNode); }
/// <summary> /// Check for equality. /// </summary> /// <param name="obj">The object with which to compare.</param> /// <returns>Result of comparison.</returns> public bool Equals(GmshMeshNode obj) { return((obj.ID == this.ID) && (obj.X == this.X) && (obj.Y == this.Y) && (obj.Z == this.Z)); }