コード例 #1
0
            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);
            }
コード例 #2
0
        /// <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);
        }