using System; using System.Collections.Generic; namespace Poly2Tri { // Token: 0x02000006 RID: 6 public class DelaunayTriangle { // Token: 0x17000008 RID: 8 // (get) Token: 0x06000026 RID: 38 RVA: 0x000025DD File Offset: 0x000007DD // (set) Token: 0x06000027 RID: 39 RVA: 0x000025E5 File Offset: 0x000007E5 public bool IsInterior { get; set; } // Token: 0x06000028 RID: 40 RVA: 0x000025EE File Offset: 0x000007EE public DelaunayTriangle(TriangulationPoint p1, TriangulationPoint p2, TriangulationPoint p3) { this.Points[0] = p1; this.Points[1] = p2; this.Points[2] = p3; } // Token: 0x06000029 RID: 41 RVA: 0x0000261D File Offset: 0x0000081D public int IndexOf(TriangulationPoint p) { int num = this.Points.IndexOf(p); if (num == -1) { throw new Exception("Calling index with a point that doesn't exist in triangle"); } return num; } // Token: 0x0600002A RID: 42 RVA: 0x0000263A File Offset: 0x0000083A public int IndexCWFrom(TriangulationPoint p) { return (this.IndexOf(p) + 2) % 3; } // Token: 0x0600002B RID: 43 RVA: 0x00002647 File Offset: 0x00000847 public int IndexCCWFrom(TriangulationPoint p) { return (this.IndexOf(p) + 1) % 3; } // Token: 0x0600002C RID: 44 RVA: 0x00002654 File Offset: 0x00000854 public bool Contains(TriangulationPoint p) { return this.Points.Contains(p); } // Token: 0x0600002D RID: 45 RVA: 0x00002664 File Offset: 0x00000864 private void MarkNeighbor(TriangulationPoint p1, TriangulationPoint p2, DelaunayTriangle t) { int num = this.EdgeIndex(p1, p2); if (num == -1) { throw new Exception("Error marking neighbors -- t doesn't contain edge p1-p2!"); } this.Neighbors[num] = t; } // Token: 0x0600002E RID: 46 RVA: 0x00002698 File Offset: 0x00000898 public void MarkNeighbor(DelaunayTriangle t) { bool flag = t.Contains(this.Points[0]); bool flag2 = t.Contains(this.Points[1]); bool flag3 = t.Contains(this.Points[2]); if (flag2 && flag3) { this.Neighbors[0] = t; t.MarkNeighbor(this.Points[1], this.Points[2], this); return; } if (flag && flag3) { this.Neighbors[1] = t; t.MarkNeighbor(this.Points[0], this.Points[2], this); return; } if (flag && flag2) { this.Neighbors[2] = t; t.MarkNeighbor(this.Points[0], this.Points[1], this); return; } throw new Exception("Failed to mark neighbor, doesn't share an edge!"); } // Token: 0x0600002F RID: 47 RVA: 0x0000277E File Offset: 0x0000097E public TriangulationPoint OppositePoint(DelaunayTriangle t, TriangulationPoint p) { return this.PointCWFrom(t.PointCWFrom(p)); } // Token: 0x06000030 RID: 48 RVA: 0x0000278D File Offset: 0x0000098D public DelaunayTriangle NeighborCWFrom(TriangulationPoint point) { return this.Neighbors[(this.Points.IndexOf(point) + 1) % 3]; } // Token: 0x06000031 RID: 49 RVA: 0x000027AA File Offset: 0x000009AA public DelaunayTriangle NeighborCCWFrom(TriangulationPoint point) { return this.Neighbors[(this.Points.IndexOf(point) + 2) % 3]; } // Token: 0x06000032 RID: 50 RVA: 0x000027C7 File Offset: 0x000009C7 public DelaunayTriangle NeighborAcrossFrom(TriangulationPoint point) { return this.Neighbors[this.Points.IndexOf(point)]; } // Token: 0x06000033 RID: 51 RVA: 0x000027E0 File Offset: 0x000009E0 public TriangulationPoint PointCCWFrom(TriangulationPoint point) { return this.Points[(this.IndexOf(point) + 1) % 3]; } // Token: 0x06000034 RID: 52 RVA: 0x000027F8 File Offset: 0x000009F8 public TriangulationPoint PointCWFrom(TriangulationPoint point) { return this.Points[(this.IndexOf(point) + 2) % 3]; } // Token: 0x06000035 RID: 53 RVA: 0x00002810 File Offset: 0x00000A10 private void RotateCW() { TriangulationPoint triangulationPoint = this.Points[2]; this.Points[2] = this.Points[1]; this.Points[1] = this.Points[0]; this.Points[0] = triangulationPoint; } // Token: 0x06000036 RID: 54 RVA: 0x00002867 File Offset: 0x00000A67 public void Legalize(TriangulationPoint oPoint, TriangulationPoint nPoint) { this.RotateCW(); this.Points[this.IndexCCWFrom(oPoint)] = nPoint; } // Token: 0x06000037 RID: 55 RVA: 0x00002884 File Offset: 0x00000A84 public override string ToString() { return string.Concat(new object[] { this.Points[0], ",", this.Points[1], ",", this.Points[2] }); } // Token: 0x06000038 RID: 56 RVA: 0x000028DC File Offset: 0x00000ADC public void MarkNeighborEdges() { for (int i = 0; i < 3; i++) { if (this.EdgeIsConstrained[i] && this.Neighbors[i] != null) { this.Neighbors[i].MarkConstrainedEdge(this.Points[(i + 1) % 3], this.Points[(i + 2) % 3]); } } } // Token: 0x06000039 RID: 57 RVA: 0x00002944 File Offset: 0x00000B44 public void MarkEdge(DelaunayTriangle triangle) { for (int i = 0; i < 3; i++) { if (this.EdgeIsConstrained[i]) { triangle.MarkConstrainedEdge(this.Points[(i + 1) % 3], this.Points[(i + 2) % 3]); } } } // Token: 0x0600003A RID: 58 RVA: 0x00002994 File Offset: 0x00000B94 public void MarkEdge(List tList) { foreach (DelaunayTriangle delaunayTriangle in tList) { for (int i = 0; i < 3; i++) { if (delaunayTriangle.EdgeIsConstrained[i]) { this.MarkConstrainedEdge(delaunayTriangle.Points[(i + 1) % 3], delaunayTriangle.Points[(i + 2) % 3]); } } } } // Token: 0x0600003B RID: 59 RVA: 0x00002A1C File Offset: 0x00000C1C public void MarkConstrainedEdge(int index) { this.EdgeIsConstrained[index] = true; } // Token: 0x0600003C RID: 60 RVA: 0x00002A2B File Offset: 0x00000C2B public void MarkConstrainedEdge(DTSweepConstraint edge) { this.MarkConstrainedEdge(edge.P, edge.Q); } // Token: 0x0600003D RID: 61 RVA: 0x00002A40 File Offset: 0x00000C40 public void MarkConstrainedEdge(TriangulationPoint p, TriangulationPoint q) { int num = this.EdgeIndex(p, q); if (num != -1) { this.EdgeIsConstrained[num] = true; } } // Token: 0x0600003E RID: 62 RVA: 0x00002A68 File Offset: 0x00000C68 public double Area() { double num = this.Points[0].X - this.Points[1].X; double num2 = this.Points[2].Y - this.Points[1].Y; return Math.Abs(num * num2 * 0.5); } // Token: 0x0600003F RID: 63 RVA: 0x00002AD0 File Offset: 0x00000CD0 public TriangulationPoint Centroid() { double num = (this.Points[0].X + this.Points[1].X + this.Points[2].X) / 3.0; double num2 = (this.Points[0].Y + this.Points[1].Y + this.Points[2].Y) / 3.0; return new TriangulationPoint(num, num2, -1); } // Token: 0x06000040 RID: 64 RVA: 0x00002B64 File Offset: 0x00000D64 public int EdgeIndex(TriangulationPoint p1, TriangulationPoint p2) { int num = this.Points.IndexOf(p1); int num2 = this.Points.IndexOf(p2); bool flag = num == 0 || num2 == 0; bool flag2 = num == 1 || num2 == 1; bool flag3 = num == 2 || num2 == 2; if (flag2 && flag3) { return 0; } if (flag && flag3) { return 1; } if (flag && flag2) { return 2; } return -1; } // Token: 0x06000041 RID: 65 RVA: 0x00002BC2 File Offset: 0x00000DC2 public bool GetConstrainedEdgeCCW(TriangulationPoint p) { return this.EdgeIsConstrained[(this.IndexOf(p) + 2) % 3]; } // Token: 0x06000042 RID: 66 RVA: 0x00002BDA File Offset: 0x00000DDA public bool GetConstrainedEdgeCW(TriangulationPoint p) { return this.EdgeIsConstrained[(this.IndexOf(p) + 1) % 3]; } // Token: 0x06000043 RID: 67 RVA: 0x00002BF2 File Offset: 0x00000DF2 public bool GetConstrainedEdgeAcross(TriangulationPoint p) { return this.EdgeIsConstrained[this.IndexOf(p)]; } // Token: 0x06000044 RID: 68 RVA: 0x00002C06 File Offset: 0x00000E06 public void SetConstrainedEdgeCCW(TriangulationPoint p, bool ce) { this.EdgeIsConstrained[(this.IndexOf(p) + 2) % 3] = ce; } // Token: 0x06000045 RID: 69 RVA: 0x00002C1F File Offset: 0x00000E1F public void SetConstrainedEdgeCW(TriangulationPoint p, bool ce) { this.EdgeIsConstrained[(this.IndexOf(p) + 1) % 3] = ce; } // Token: 0x06000046 RID: 70 RVA: 0x00002C38 File Offset: 0x00000E38 public void SetConstrainedEdgeAcross(TriangulationPoint p, bool ce) { this.EdgeIsConstrained[this.IndexOf(p)] = ce; } // Token: 0x06000047 RID: 71 RVA: 0x00002C4D File Offset: 0x00000E4D public bool GetDelaunayEdgeCCW(TriangulationPoint p) { return this.EdgeIsDelaunay[(this.IndexOf(p) + 2) % 3]; } // Token: 0x06000048 RID: 72 RVA: 0x00002C65 File Offset: 0x00000E65 public bool GetDelaunayEdgeCW(TriangulationPoint p) { return this.EdgeIsDelaunay[(this.IndexOf(p) + 1) % 3]; } // Token: 0x06000049 RID: 73 RVA: 0x00002C7D File Offset: 0x00000E7D public bool GetDelaunayEdgeAcross(TriangulationPoint p) { return this.EdgeIsDelaunay[this.IndexOf(p)]; } // Token: 0x0600004A RID: 74 RVA: 0x00002C91 File Offset: 0x00000E91 public void SetDelaunayEdgeCCW(TriangulationPoint p, bool ce) { this.EdgeIsDelaunay[(this.IndexOf(p) + 2) % 3] = ce; } // Token: 0x0600004B RID: 75 RVA: 0x00002CAA File Offset: 0x00000EAA public void SetDelaunayEdgeCW(TriangulationPoint p, bool ce) { this.EdgeIsDelaunay[(this.IndexOf(p) + 1) % 3] = ce; } // Token: 0x0600004C RID: 76 RVA: 0x00002CC3 File Offset: 0x00000EC3 public void SetDelaunayEdgeAcross(TriangulationPoint p, bool ce) { this.EdgeIsDelaunay[this.IndexOf(p)] = ce; } // Token: 0x0400000A RID: 10 public FixedArray3 Points; // Token: 0x0400000B RID: 11 public FixedArray3 Neighbors; // Token: 0x0400000C RID: 12 public FixedBitArray3 EdgeIsConstrained; // Token: 0x0400000D RID: 13 public FixedBitArray3 EdgeIsDelaunay; } }