Free cookie consent management tool by TermsFeed Policy Generator

source: branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/Utilities/PointD.cs @ 9793

Last change on this file since 9793 was 8516, checked in by spimming, 12 years ago

#1894:

  • solution restructured
  • removed obsolete and outdated parts
File size: 1.1 KB
Line 
1
2using System.Drawing;
3
4namespace HeuristicLab.Problems.RoutePlanning.Utilities {
5  public struct PointD {
6    public double X;
7    public double Y;
8
9    #region Constructors
10
11    public PointD(double x, double y) {
12      this.X = x;
13      this.Y = y;
14    }
15
16    public PointD(PointD p) {
17      this.X = p.X;
18      this.Y = p.Y;
19    }
20
21    #endregion
22
23    #region Operators
24
25    public static bool operator !=(PointD left, PointD right) {
26      return left.X != right.X || left.Y != right.Y;
27    }
28
29    public static bool operator ==(PointD left, PointD right) {
30      return left.X == right.X && left.Y == right.Y;
31    }
32
33    public static explicit operator PointF(PointD p) {
34      return new PointF((float)p.X, (float)p.Y);
35    }
36
37    #endregion
38
39    #region Overridden Methods
40
41    public override bool Equals(object obj) {
42      if (obj is PointD) {
43        PointD p = (PointD)obj;
44        return (this.X == p.X && this.Y == p.Y);
45      }
46      return false;
47    }
48
49    public override int GetHashCode() {
50      return ((PointF)this).GetHashCode();
51    }
52
53    #endregion
54  }
55}
Note: See TracBrowser for help on using the repository browser.