using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
|
namespace RichCreator.Utility.Structs
|
{
|
/// <summary>
|
/// 多边形
|
/// </summary>
|
public class ZTPolygon
|
{
|
|
|
public ZTPolygon()
|
{
|
|
}
|
public ZTPolygon(ZTPoint[] points)
|
{
|
this.Points = points;
|
}
|
|
public ZTPoint[] Points
|
{
|
get;set;
|
}
|
|
public int Length
|
{
|
get { return Points.Length; }
|
}
|
|
public ZTPoint this[int index]
|
{
|
get { return Points[index]; }
|
set { Points[index] = value; }
|
}
|
|
public static bool operator !=(ZTPolygon a, ZTPolygon b)
|
{
|
if (a == b)
|
{
|
return false;
|
}
|
return true;
|
}
|
|
public static bool operator ==(ZTPolygon a, ZTPolygon b)
|
{
|
if (a.Length != b.Length)
|
{
|
return false;
|
}
|
for (int i = 0; i < a.Length; i++)
|
{
|
if (!a[i].Equals(b[i]))
|
{
|
return false;
|
}
|
}
|
return true;
|
}
|
|
public static implicit operator ZTPoint[] (ZTPolygon polygon)
|
{
|
return polygon.Points;
|
}
|
|
public static implicit operator ZTPolygon(ZTPoint[] points)
|
{
|
return new ZTPolygon(points);
|
}
|
|
|
}
|
}
|