o
asmrobot
2019-10-27 c4bd9d8c587bd1401f0fb2f60c34a4964d7afe20
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace RichCreator.Utility.Structs
{
    /// <summary>
    /// 点
    /// </summary>
    public class ZTPoint : IEquatable<ZTPoint>
    {
        public static ZTPoint Empty = default(ZTPoint);
 
        public ZTPoint(Int32 x, Int32 y)
        {
            this.X = x;
            this.Y = y;
        }
 
        
        public Int32 X { get; set; }
 
        public Int32 Y { get; set; }
 
 
 
        public static bool operator ==(ZTPoint a, ZTPoint b)
        {
            if (a.X == b.X && a.Y == b.Y)
            {
                return true;
            }
            return false;
        }
 
        public static bool operator !=(ZTPoint a, ZTPoint b)
        {
            if (a.X != b.X || a.Y != b.Y)
            {
                return true;
            }
            return false;
        }
 
        public static ZTPoint operator +(ZTPoint a, ZTPoint b)
        {
            return new ZTPoint(a.X + b.X, a.Y + b.Y);
        }
 
        public static ZTPoint operator -(ZTPoint a, ZTPoint b)
        {
            return new ZTPoint(a.X - b.X, a.Y - b.Y);
        }
 
        public override string ToString()
        {
            return "(" + this.X.ToString() + "," + this.Y.ToString() + ")";
        }
 
        /// <summary>
        /// x,y坐标加上指定的值
        /// </summary>
        /// <param name="val"></param>
        /// <returns></returns>
        public ZTPoint Add(Int32 val)
        {
            return new ZTPoint(this.X + val, this.Y + val);
        }
 
        /// <summary>
        /// 两个坐标相加
        /// </summary>
        /// <param name="val"></param>
        /// <returns></returns>
        public ZTPoint Add(ZTPoint val)
        {
            return new ZTPoint(this.X + val.X, this.Y + val.Y);
        }
 
        /// <summary>
        /// 两个坐标相减
        /// </summary>
        /// <param name="val"></param>
        /// <returns></returns>
        public ZTPoint Sub(ZTPoint val)
        {
            return new ZTPoint(this.X - val.X, this.Y - val.Y);
        }
 
        #region IEquatable
        public bool Equals(ZTPoint other)
        {
            if (this.X == other.X && this.Y == other.Y)
            {
                return true;
            }
            return false;
        }
        #endregion
    }
}