1 |
namespace 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 |
} |