source: OniSplit/Imaging/Point.cs@ 1194

Last change on this file since 1194 was 1114, checked in by iritscen, 5 years ago

Adding OniSplit source code (v0.9.99.0). Many thanks to Neo for all his work over the years.

File size: 912 bytes
Line 
1namespace Oni.Imaging
2{
3 internal struct Point
4 {
5 public static readonly Point UnitX = new Point(1, 0);
6 public static readonly Point UnitY = new Point(0, 1);
7
8 public int X;
9 public int Y;
10
11 public Point(int x, int y)
12 {
13 X = x;
14 Y = y;
15 }
16
17 public static Point operator +(Point p0, Point p1) => new Point(p0.X + p1.X, p0.Y + p1.Y);
18 public static Point operator -(Point p0, Point p1) => new Point(p0.X - p1.X, p0.Y - p1.Y);
19
20 public static bool operator ==(Point p0, Point p1) => p0.X == p1.X && p0.Y == p1.Y;
21 public static bool operator !=(Point p0, Point p1) => p0.X != p1.X || p0.Y != p1.Y;
22
23 public override bool Equals(object obj) => obj is Point && ((Point)obj) == this;
24
25 public override int GetHashCode() => X.GetHashCode() ^ Y.GetHashCode();
26 }
27}
Note: See TracBrowser for help on using the repository browser.