Exemple #1
0
        /// <summary>
        /// Determines whether the specified <see cref="DoubleConnectedEdgeList.HalfEdge"/> is equal to the current <see cref="T:DoubleConnectedEdgeList.HalfEdge"/>.
        /// </summary>
        /// <param name="other">The <see cref="DoubleConnectedEdgeList.HalfEdge"/> to compare with the current <see cref="T:DoubleConnectedEdgeList.HalfEdge"/>.</param>
        /// <returns><c>true</c> if the specified <see cref="DoubleConnectedEdgeList.HalfEdge"/> is equal to the current
        /// <see cref="T:DoubleConnectedEdgeList.HalfEdge"/>; otherwise, <c>false</c>.</returns>
        public bool Equals(HalfEdge other)
        {
            OriginDestinationComparer edgeComparer = new OriginDestinationComparer();

            Vertex.PositionComparer       vertexComparer = new Vertex.PositionComparer();
            Face.MeshIdxAndNormalComparer faceComparer   = new Face.MeshIdxAndNormalComparer();

            return(
                vertexComparer.Equals(this.Origin, other.Origin) &&
                edgeComparer.Equals(this.Twin, other.Twin) &&
                edgeComparer.Equals(this.Previous, other.Previous) &&
                edgeComparer.Equals(this.Next, other.Next) &&
                faceComparer.Equals(this.IncidentFace, other.IncidentFace)
                );
        }
Exemple #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);
        }