using System; using TriangleNet.Data; using TriangleNet.Geometry; namespace TriangleNet.Tools { // Token: 0x0200001A RID: 26 public class Statistic { // Token: 0x1700002F RID: 47 // (get) Token: 0x060000DD RID: 221 RVA: 0x00013E9D File Offset: 0x0001209D public double ShortestEdge { get { return this.minEdge; } } // Token: 0x17000030 RID: 48 // (get) Token: 0x060000DE RID: 222 RVA: 0x00013EA5 File Offset: 0x000120A5 public double LongestEdge { get { return this.maxEdge; } } // Token: 0x17000031 RID: 49 // (get) Token: 0x060000DF RID: 223 RVA: 0x00013EAD File Offset: 0x000120AD public double ShortestAltitude { get { return this.minAspect; } } // Token: 0x17000032 RID: 50 // (get) Token: 0x060000E0 RID: 224 RVA: 0x00013EB5 File Offset: 0x000120B5 public double LargestAspectRatio { get { return this.maxAspect; } } // Token: 0x17000033 RID: 51 // (get) Token: 0x060000E1 RID: 225 RVA: 0x00013EBD File Offset: 0x000120BD public double SmallestArea { get { return this.minArea; } } // Token: 0x17000034 RID: 52 // (get) Token: 0x060000E2 RID: 226 RVA: 0x00013EC5 File Offset: 0x000120C5 public double LargestArea { get { return this.maxArea; } } // Token: 0x17000035 RID: 53 // (get) Token: 0x060000E3 RID: 227 RVA: 0x00013ECD File Offset: 0x000120CD public double SmallestAngle { get { return this.minAngle; } } // Token: 0x17000036 RID: 54 // (get) Token: 0x060000E4 RID: 228 RVA: 0x00013ED5 File Offset: 0x000120D5 public double LargestAngle { get { return this.maxAngle; } } // Token: 0x17000037 RID: 55 // (get) Token: 0x060000E5 RID: 229 RVA: 0x00013EDD File Offset: 0x000120DD public int InputVertices { get { return this.inVetrices; } } // Token: 0x17000038 RID: 56 // (get) Token: 0x060000E6 RID: 230 RVA: 0x00013EE5 File Offset: 0x000120E5 public int InputTriangles { get { return this.inTriangles; } } // Token: 0x17000039 RID: 57 // (get) Token: 0x060000E7 RID: 231 RVA: 0x00013EED File Offset: 0x000120ED public int InputSegments { get { return this.inSegments; } } // Token: 0x1700003A RID: 58 // (get) Token: 0x060000E8 RID: 232 RVA: 0x00013EF5 File Offset: 0x000120F5 public int InputHoles { get { return this.inHoles; } } // Token: 0x1700003B RID: 59 // (get) Token: 0x060000E9 RID: 233 RVA: 0x00013EFD File Offset: 0x000120FD public int Vertices { get { return this.outVertices; } } // Token: 0x1700003C RID: 60 // (get) Token: 0x060000EA RID: 234 RVA: 0x00013F05 File Offset: 0x00012105 public int Triangles { get { return this.outTriangles; } } // Token: 0x1700003D RID: 61 // (get) Token: 0x060000EB RID: 235 RVA: 0x00013F0D File Offset: 0x0001210D public int Edges { get { return this.outEdges; } } // Token: 0x1700003E RID: 62 // (get) Token: 0x060000EC RID: 236 RVA: 0x00013F15 File Offset: 0x00012115 public int BoundaryEdges { get { return this.boundaryEdges; } } // Token: 0x1700003F RID: 63 // (get) Token: 0x060000ED RID: 237 RVA: 0x00013F1D File Offset: 0x0001211D public int InteriorBoundaryEdges { get { return this.intBoundaryEdges; } } // Token: 0x17000040 RID: 64 // (get) Token: 0x060000EE RID: 238 RVA: 0x00013F25 File Offset: 0x00012125 public int ConstrainedEdges { get { return this.constrainedEdges; } } // Token: 0x17000041 RID: 65 // (get) Token: 0x060000EF RID: 239 RVA: 0x00013F2D File Offset: 0x0001212D public int[] AngleHistogram { get { return this.angleTable; } } // Token: 0x17000042 RID: 66 // (get) Token: 0x060000F0 RID: 240 RVA: 0x00013F35 File Offset: 0x00012135 public int[] MinAngleHistogram { get { return this.minAngles; } } // Token: 0x17000043 RID: 67 // (get) Token: 0x060000F1 RID: 241 RVA: 0x00013F3D File Offset: 0x0001213D public int[] MaxAngleHistogram { get { return this.maxAngles; } } // Token: 0x060000F2 RID: 242 RVA: 0x00013F48 File Offset: 0x00012148 private void GetAspectHistogram(Mesh mesh) { int[] array = new int[16]; double[] array2 = new double[] { 1.5, 2.0, 2.5, 3.0, 4.0, 6.0, 10.0, 15.0, 25.0, 50.0, 100.0, 300.0, 1000.0, 10000.0, 100000.0, 0.0 }; Otri otri = default(Otri); Vertex[] array3 = new Vertex[3]; double[] array4 = new double[3]; double[] array5 = new double[3]; double[] array6 = new double[3]; otri.orient = 0; foreach (Triangle triangle in mesh.triangles.Values) { otri.triangle = triangle; array3[0] = otri.Org(); array3[1] = otri.Dest(); array3[2] = otri.Apex(); double num = 0.0; for (int i = 0; i < 3; i++) { int num2 = Statistic.plus1Mod3[i]; int num3 = Statistic.minus1Mod3[i]; array4[i] = array3[num2].x - array3[num3].x; array5[i] = array3[num2].y - array3[num3].y; array6[i] = array4[i] * array4[i] + array5[i] * array5[i]; if (array6[i] > num) { num = array6[i]; } } double num4 = Math.Abs((array3[2].x - array3[0].x) * (array3[1].y - array3[0].y) - (array3[1].x - array3[0].x) * (array3[2].y - array3[0].y)) / 2.0; double num5 = num4 * num4 / num; double num6 = num / num5; int num7 = 0; while (num6 > array2[num7] * array2[num7] && num7 < 15) { num7++; } array[num7]++; } } // Token: 0x060000F3 RID: 243 RVA: 0x00014138 File Offset: 0x00012338 public void Update(Mesh mesh, int sampleDegrees) { this.inVetrices = mesh.invertices; this.inTriangles = mesh.inelements; this.inSegments = mesh.insegments; this.inHoles = mesh.holes.Count; this.outVertices = mesh.vertices.Count - mesh.undeads; this.outTriangles = mesh.triangles.Count; this.outEdges = mesh.edges; this.boundaryEdges = mesh.hullsize; this.intBoundaryEdges = mesh.subsegs.Count - mesh.hullsize; this.constrainedEdges = mesh.subsegs.Count; Point[] array = new Point[3]; sampleDegrees = 60; double[] array2 = new double[sampleDegrees / 2 - 1]; double[] array3 = new double[3]; double[] array4 = new double[3]; double[] array5 = new double[3]; double num = 3.141592653589793 / (double)sampleDegrees; double num2 = 57.29577951308232; this.angleTable = new int[sampleDegrees]; this.minAngles = new int[sampleDegrees]; this.maxAngles = new int[sampleDegrees]; for (int i = 0; i < sampleDegrees / 2 - 1; i++) { array2[i] = Math.Cos(num * (double)(i + 1)); array2[i] *= array2[i]; } for (int j = 0; j < sampleDegrees; j++) { this.angleTable[j] = 0; } this.minAspect = mesh.bounds.Width + mesh.bounds.Height; this.minAspect *= this.minAspect; this.maxAspect = 0.0; this.minEdge = this.minAspect; this.maxEdge = 0.0; this.minArea = this.minAspect; this.maxArea = 0.0; this.minAngle = 0.0; this.maxAngle = 2.0; bool flag = true; bool flag2 = true; foreach (Triangle triangle in mesh.triangles.Values) { double num3 = 0.0; double num4 = 1.0; array[0] = triangle.vertices[0]; array[1] = triangle.vertices[1]; array[2] = triangle.vertices[2]; double num5 = 0.0; for (int k = 0; k < 3; k++) { int num6 = Statistic.plus1Mod3[k]; int num7 = Statistic.minus1Mod3[k]; array3[k] = array[num6].X - array[num7].X; array4[k] = array[num6].Y - array[num7].Y; array5[k] = array3[k] * array3[k] + array4[k] * array4[k]; if (array5[k] > num5) { num5 = array5[k]; } if (array5[k] > this.maxEdge) { this.maxEdge = array5[k]; } if (array5[k] < this.minEdge) { this.minEdge = array5[k]; } } double num8 = Math.Abs((array[2].X - array[0].X) * (array[1].Y - array[0].Y) - (array[1].X - array[0].X) * (array[2].Y - array[0].Y)); if (num8 < this.minArea) { this.minArea = num8; } if (num8 > this.maxArea) { this.maxArea = num8; } double num9 = num8 * num8 / num5; if (num9 < this.minAspect) { this.minAspect = num9; } double num10 = num5 / num9; if (num10 > this.maxAspect) { this.maxAspect = num10; } int num13; for (int l = 0; l < 3; l++) { int num6 = Statistic.plus1Mod3[l]; int num7 = Statistic.minus1Mod3[l]; double num11 = array3[num6] * array3[num7] + array4[num6] * array4[num7]; double num12 = num11 * num11 / (array5[num6] * array5[num7]); num13 = sampleDegrees / 2 - 1; for (int m = num13 - 1; m >= 0; m--) { if (num12 > array2[m]) { num13 = m; } } if (num11 <= 0.0) { this.angleTable[num13]++; if (num12 > this.minAngle) { this.minAngle = num12; } if (flag && num12 < this.maxAngle) { this.maxAngle = num12; } if (num12 > num3) { num3 = num12; } if (flag2 && num12 < num4) { num4 = num12; } } else { this.angleTable[sampleDegrees - num13 - 1]++; if (flag || num12 > this.maxAngle) { this.maxAngle = num12; flag = false; } if (flag2 || num12 > num4) { num4 = num12; flag2 = false; } } } num13 = sampleDegrees / 2 - 1; for (int n = num13 - 1; n >= 0; n--) { if (num3 > array2[n]) { num13 = n; } } this.minAngles[num13]++; num13 = sampleDegrees / 2 - 1; for (int num14 = num13 - 1; num14 >= 0; num14--) { if (num4 > array2[num14]) { num13 = num14; } } if (flag2) { this.maxAngles[num13]++; } else { this.maxAngles[sampleDegrees - num13 - 1]++; } flag2 = true; } this.minEdge = Math.Sqrt(this.minEdge); this.maxEdge = Math.Sqrt(this.maxEdge); this.minAspect = Math.Sqrt(this.minAspect); this.maxAspect = Math.Sqrt(this.maxAspect); this.minArea *= 0.5; this.maxArea *= 0.5; if (this.minAngle >= 1.0) { this.minAngle = 0.0; } else { this.minAngle = num2 * Math.Acos(Math.Sqrt(this.minAngle)); } if (this.maxAngle >= 1.0) { this.maxAngle = 180.0; return; } if (flag) { this.maxAngle = num2 * Math.Acos(Math.Sqrt(this.maxAngle)); return; } this.maxAngle = 180.0 - num2 * Math.Acos(Math.Sqrt(this.maxAngle)); } // Token: 0x060000F5 RID: 245 RVA: 0x000147E0 File Offset: 0x000129E0 // Note: this type is marked as 'beforefieldinit'. static Statistic() { int[] array = new int[3]; array[0] = 1; array[1] = 2; Statistic.plus1Mod3 = array; Statistic.minus1Mod3 = new int[] { 2, 0, 1 }; } // Token: 0x040000A9 RID: 169 public static long InCircleCount = 0L; // Token: 0x040000AA RID: 170 public static long InCircleAdaptCount = 0L; // Token: 0x040000AB RID: 171 public static long CounterClockwiseCount = 0L; // Token: 0x040000AC RID: 172 public static long CounterClockwiseAdaptCount = 0L; // Token: 0x040000AD RID: 173 public static long Orient3dCount = 0L; // Token: 0x040000AE RID: 174 public static long HyperbolaCount = 0L; // Token: 0x040000AF RID: 175 public static long CircumcenterCount = 0L; // Token: 0x040000B0 RID: 176 public static long CircleTopCount = 0L; // Token: 0x040000B1 RID: 177 public static long RelocationCount = 0L; // Token: 0x040000B2 RID: 178 private double minEdge; // Token: 0x040000B3 RID: 179 private double maxEdge; // Token: 0x040000B4 RID: 180 private double minAspect; // Token: 0x040000B5 RID: 181 private double maxAspect; // Token: 0x040000B6 RID: 182 private double minArea; // Token: 0x040000B7 RID: 183 private double maxArea; // Token: 0x040000B8 RID: 184 private double minAngle; // Token: 0x040000B9 RID: 185 private double maxAngle; // Token: 0x040000BA RID: 186 private int inVetrices; // Token: 0x040000BB RID: 187 private int inTriangles; // Token: 0x040000BC RID: 188 private int inSegments; // Token: 0x040000BD RID: 189 private int inHoles; // Token: 0x040000BE RID: 190 private int outVertices; // Token: 0x040000BF RID: 191 private int outTriangles; // Token: 0x040000C0 RID: 192 private int outEdges; // Token: 0x040000C1 RID: 193 private int boundaryEdges; // Token: 0x040000C2 RID: 194 private int intBoundaryEdges; // Token: 0x040000C3 RID: 195 private int constrainedEdges; // Token: 0x040000C4 RID: 196 private int[] angleTable; // Token: 0x040000C5 RID: 197 private int[] minAngles; // Token: 0x040000C6 RID: 198 private int[] maxAngles; // Token: 0x040000C7 RID: 199 private static readonly int[] plus1Mod3; // Token: 0x040000C8 RID: 200 private static readonly int[] minus1Mod3; } }