using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
|
namespace RichCreator.Utility.Structs
|
{
|
/// <summary>
|
/// 线
|
/// </summary>
|
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;
|
|
public Int32 Y;
|
|
public Int32 Length;
|
|
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;
|
}
|
|
/// <summary>
|
/// 是否包含点
|
/// </summary>
|
/// <param name="x"></param>
|
/// <param name="y"></param>
|
/// <param name="orientation"></param>
|
/// <returns></returns>
|
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;
|
}
|
|
}
|
}
|