Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Analysis.AlgorithmBehavior/MIConvexHull/Triangulation/VoronoiEdge.cs @ 10368

Last change on this file since 10368 was 9730, checked in by ascheibe, 11 years ago

#1886 added a library that calculates convex hulls

File size: 1.9 KB
Line 
1namespace MIConvexHull
2{
3    /// <summary>
4    /// A class representing an (undirected) edge of the Voronoi graph.
5    /// </summary>
6    /// <typeparam name="TVertex"></typeparam>
7    /// <typeparam name="TCell"></typeparam>
8    public class VoronoiEdge<TVertex, TCell>
9        where TVertex : IVertex
10        where TCell : TriangulationCell<TVertex, TCell>
11    {
12        /// <summary>
13        /// Source of the edge.
14        /// </summary>
15        public TCell Source
16        {
17            get;
18            internal set;
19        }
20
21        /// <summary>
22        /// Target of the edge.
23        /// </summary>
24        public TCell Target
25        {
26            get;
27            internal set;
28        }
29
30        /// <summary>
31        /// ...
32        /// </summary>
33        /// <param name="obj"></param>
34        /// <returns></returns>
35        public override bool Equals(object obj)
36        {
37            var other = obj as VoronoiEdge<TVertex, TCell>;
38            if (other == null) return false;
39            if (object.ReferenceEquals(this, other)) return true;
40            return (Source == other.Source && Target == other.Target)
41                || (Source == other.Target && Target == other.Source);
42        }
43
44        /// <summary>
45        /// ...
46        /// </summary>
47        /// <returns></returns>
48        public override int GetHashCode()
49        {
50            int hash = 23;
51            hash = hash * 31 + Source.GetHashCode();
52            return hash * 31 + Target.GetHashCode();
53        }
54
55        /// <summary>
56        /// Create an instance of the edge.
57        /// </summary>
58        public VoronoiEdge()
59        {
60
61        }
62
63        /// <summary>
64        /// Create an instance of the edge.
65        /// </summary>
66        public VoronoiEdge(TCell source, TCell target)
67        {
68            this.Source = source;
69            this.Target = target;
70        }
71    }
72}
Note: See TracBrowser for help on using the repository browser.