-
Notifications
You must be signed in to change notification settings - Fork 31
/
Index3.cs
55 lines (45 loc) · 1.22 KB
/
Index3.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OctoAwesome.Model
{
public struct Index3
{
public int X;
public int Y;
public int Z;
public Index3(int x, int y, int z)
{
X = x;
Y = y;
Z = z;
}
public static Index3 operator +(Index3 i1, Index3 i2)
{
return new Index3(i1.X + i2.X, i1.Y + i2.Y, i1.Z + i2.Z);
}
public static bool operator ==(Index3 i1, Index3 i2)
{
return i1.Equals(i2);
}
public static bool operator !=(Index3 i1, Index3 i2)
{
return !i1.Equals(i2);
}
public override string ToString()
{
return "(" + X.ToString() + "/" + Y.ToString() + "/" + Z.ToString() + ")";
}
public override bool Equals(object obj)
{
if (!(obj is Index3))
return false;
Index3 other = (Index3)obj;
return (
other.X == this.X &&
other.Y == this.Y &&
other.Z == this.Z);
}
}
}