| 1 |
using System; |
| 2 |
|
| 3 |
namespace Oni.Akira |
| 4 |
{ |
| 5 |
internal class PolygonEdge |
| 6 |
{ |
| 7 |
private static readonly PolygonEdge[] emptyEdges = new PolygonEdge[0]; |
| 8 |
private readonly Polygon polygon; |
| 9 |
private readonly int index; |
| 10 |
private PolygonEdge[] adjacency = emptyEdges; |
| 11 |
|
| 12 |
public PolygonEdge(Polygon polygon, int index) |
| 13 |
{ |
| 14 |
this.polygon = polygon; |
| 15 |
this.index = index; |
| 16 |
} |
| 17 |
|
| 18 |
public Polygon Polygon => polygon; |
| 19 |
|
| 20 |
public int Index => index; |
| 21 |
public int EndIndex => (index + 1) % polygon.Edges.Length; |
| 22 |
|
| 23 |
public int Point0Index => polygon.PointIndices[index]; |
| 24 |
public int Point1Index => polygon.PointIndices[EndIndex]; |
| 25 |
|
| 26 |
public PolygonEdge[] Adjancency |
| 27 |
{ |
| 28 |
get { return adjacency; } |
| 29 |
set { adjacency = value; } |
| 30 |
} |
| 31 |
} |
| 32 |
} |