public int GetHashCode(HalfEdge obj) { if (obj == null) { return(0); } int hash = 17; hash *= (31 + vertexComparer.GetHashCode(obj.Origin)); hash *= (31 + vertexComparer.GetHashCode(obj.Destination)); return(hash); }
/// <summary> /// Serves as a hash function for a <see cref="T:DoubleConnectedEdgeList.HalfEdge"/> object. /// </summary> /// <returns>A hash code for this instance that is suitable for use in hashing algorithms and data structures such as a /// hash table.</returns> public override int GetHashCode() { OriginDestinationComparer edge = new OriginDestinationComparer(); Vertex.PositionComparer vertex = new Vertex.PositionComparer(); Face.MeshIdxAndNormalComparer face = new Face.MeshIdxAndNormalComparer(); int hash = 17; hash *= (31 + vertex.GetHashCode(Origin)); hash *= (31 + edge.GetHashCode(Twin)); hash *= (31 + edge.GetHashCode(Previous)); hash *= (31 + edge.GetHashCode(Next)); hash *= (31 + face.GetHashCode(IncidentFace)); return(hash); }