using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace RichCreator.Utility.Structs { /// /// 线 /// public struct ZTLine { public static ZTLine Empty = default(ZTLine); public ZTLine(Int32 x,Int32 y,Int32 length) { this.X = x; this.Y = y; this.Length = length; } public Int32 X { get; set; } public Int32 Y { get; set; } public Int32 Length { get; set; } public static bool operator ==(ZTLine a, ZTLine b) { if ((a.X == b.X && a.Y == b.Y && a.Length == b.Length)) { return true; } return false; } public static bool operator !=(ZTLine a, ZTLine b) { if (a.X != b.X || a.Y != b.Y || a.Length != b.Length) { return true; } return false; } /// /// 是否包含点 /// /// /// /// /// public bool Contain(Int32 x, Int32 y, Orientation orientation) { if (orientation == Orientation.Horizontal) { if (this.Y == y&& x >= this.X && x <= (this.X + this.Length - 1)) { return true; } } else { if (this.X == x&& y >= this.Y && y <= (this.Y + this.Length - 1)) { return true; } } return false; } } }