This commit is contained in:
niko
2026-06-04 11:42:34 +02:00
parent f39ba70a9f
commit e720b98cd1
7488 changed files with 2493818 additions and 0 deletions
+569
View File
@@ -0,0 +1,569 @@
using System;
using TriangleNet.Data;
using TriangleNet.Log;
namespace TriangleNet.Algorithm
{
// Token: 0x0200003C RID: 60
internal class Dwyer
{
// Token: 0x06000221 RID: 545 RVA: 0x00019578 File Offset: 0x00017778
private void VertexSort(int left, int right)
{
int num = left;
int num2 = right;
if (right - left + 1 < 32)
{
for (int i = left + 1; i <= right; i++)
{
Vertex vertex = this.sortarray[i];
int num3 = i - 1;
while (num3 >= left && (this.sortarray[num3].x > vertex.x || (this.sortarray[num3].x == vertex.x && this.sortarray[num3].y > vertex.y)))
{
this.sortarray[num3 + 1] = this.sortarray[num3];
num3--;
}
this.sortarray[num3 + 1] = vertex;
}
return;
}
int num4 = Dwyer.rand.Next(left, right);
double x = this.sortarray[num4].x;
double y = this.sortarray[num4].y;
left--;
right++;
while (left < right)
{
do
{
left++;
}
while (left <= right && (this.sortarray[left].x < x || (this.sortarray[left].x == x && this.sortarray[left].y < y)));
do
{
right--;
}
while (left <= right && (this.sortarray[right].x > x || (this.sortarray[right].x == x && this.sortarray[right].y > y)));
if (left < right)
{
Vertex vertex2 = this.sortarray[left];
this.sortarray[left] = this.sortarray[right];
this.sortarray[right] = vertex2;
}
}
if (left > num)
{
this.VertexSort(num, left);
}
if (num2 > right + 1)
{
this.VertexSort(right + 1, num2);
}
}
// Token: 0x06000222 RID: 546 RVA: 0x0001972C File Offset: 0x0001792C
private void VertexMedian(int left, int right, int median, int axis)
{
int num = right - left + 1;
int num2 = left;
int num3 = right;
if (num == 2)
{
if (this.sortarray[left][axis] > this.sortarray[right][axis] || (this.sortarray[left][axis] == this.sortarray[right][axis] && this.sortarray[left][1 - axis] > this.sortarray[right][1 - axis]))
{
Vertex vertex = this.sortarray[right];
this.sortarray[right] = this.sortarray[left];
this.sortarray[left] = vertex;
}
return;
}
int num4 = Dwyer.rand.Next(left, right);
double num5 = this.sortarray[num4][axis];
double num6 = this.sortarray[num4][1 - axis];
left--;
right++;
while (left < right)
{
do
{
left++;
}
while (left <= right && (this.sortarray[left][axis] < num5 || (this.sortarray[left][axis] == num5 && this.sortarray[left][1 - axis] < num6)));
do
{
right--;
}
while (left <= right && (this.sortarray[right][axis] > num5 || (this.sortarray[right][axis] == num5 && this.sortarray[right][1 - axis] > num6)));
if (left < right)
{
Vertex vertex = this.sortarray[left];
this.sortarray[left] = this.sortarray[right];
this.sortarray[right] = vertex;
}
}
if (left > median)
{
this.VertexMedian(num2, left - 1, median, axis);
}
if (right < median - 1)
{
this.VertexMedian(right + 1, num3, median, axis);
}
}
// Token: 0x06000223 RID: 547 RVA: 0x000198E8 File Offset: 0x00017AE8
private void AlternateAxes(int left, int right, int axis)
{
int num = right - left + 1;
int num2 = num >> 1;
if (num <= 3)
{
axis = 0;
}
this.VertexMedian(left, right, left + num2, axis);
if (num - num2 >= 2)
{
if (num2 >= 2)
{
this.AlternateAxes(left, left + num2 - 1, 1 - axis);
}
this.AlternateAxes(left + num2, right, 1 - axis);
}
}
// Token: 0x06000224 RID: 548 RVA: 0x00019938 File Offset: 0x00017B38
private void MergeHulls(ref Otri farleft, ref Otri innerleft, ref Otri innerright, ref Otri farright, int axis)
{
Otri otri = default(Otri);
Otri otri2 = default(Otri);
Otri otri3 = default(Otri);
Otri otri4 = default(Otri);
Otri otri5 = default(Otri);
Otri otri6 = default(Otri);
Otri otri7 = default(Otri);
Otri otri8 = default(Otri);
Vertex vertex = innerleft.Dest();
Vertex vertex2 = innerleft.Apex();
Vertex vertex3 = innerright.Org();
Vertex vertex4 = innerright.Apex();
Vertex vertex5;
Vertex vertex7;
if (this.useDwyer && axis == 1)
{
vertex5 = farleft.Org();
Vertex vertex6 = farleft.Apex();
vertex7 = farright.Dest();
Vertex vertex8 = farright.Apex();
while (vertex6.y < vertex5.y)
{
farleft.LnextSelf();
farleft.SymSelf();
vertex5 = vertex6;
vertex6 = farleft.Apex();
}
innerleft.Sym(ref otri7);
Vertex vertex9 = otri7.Apex();
while (vertex9.y > vertex.y)
{
otri7.Lnext(ref innerleft);
vertex2 = vertex;
vertex = vertex9;
innerleft.Sym(ref otri7);
vertex9 = otri7.Apex();
}
while (vertex4.y < vertex3.y)
{
innerright.LnextSelf();
innerright.SymSelf();
vertex3 = vertex4;
vertex4 = innerright.Apex();
}
farright.Sym(ref otri7);
vertex9 = otri7.Apex();
while (vertex9.y > vertex7.y)
{
otri7.Lnext(ref farright);
vertex7 = vertex9;
farright.Sym(ref otri7);
vertex9 = otri7.Apex();
}
}
bool flag;
do
{
flag = false;
if (Primitives.CounterClockwise(vertex, vertex2, vertex3) > 0.0)
{
innerleft.LprevSelf();
innerleft.SymSelf();
vertex = vertex2;
vertex2 = innerleft.Apex();
flag = true;
}
if (Primitives.CounterClockwise(vertex4, vertex3, vertex) > 0.0)
{
innerright.LnextSelf();
innerright.SymSelf();
vertex3 = vertex4;
vertex4 = innerright.Apex();
flag = true;
}
}
while (flag);
innerleft.Sym(ref otri);
innerright.Sym(ref otri2);
this.mesh.MakeTriangle(ref otri8);
otri8.Bond(ref innerleft);
otri8.LnextSelf();
otri8.Bond(ref innerright);
otri8.LnextSelf();
otri8.SetOrg(vertex3);
otri8.SetDest(vertex);
vertex5 = farleft.Org();
if (vertex == vertex5)
{
otri8.Lnext(ref farleft);
}
vertex7 = farright.Dest();
if (vertex3 == vertex7)
{
otri8.Lprev(ref farright);
}
Vertex vertex10 = vertex;
Vertex vertex11 = vertex3;
Vertex vertex12 = otri.Apex();
Vertex vertex13 = otri2.Apex();
for (;;)
{
bool flag2 = Primitives.CounterClockwise(vertex12, vertex10, vertex11) <= 0.0;
bool flag3 = Primitives.CounterClockwise(vertex13, vertex10, vertex11) <= 0.0;
if (flag2 && flag3)
{
break;
}
if (!flag2)
{
otri.Lprev(ref otri3);
otri3.SymSelf();
Vertex vertex14 = otri3.Apex();
if (vertex14 != null)
{
bool flag4 = Primitives.InCircle(vertex10, vertex11, vertex12, vertex14) > 0.0;
while (flag4)
{
otri3.LnextSelf();
otri3.Sym(ref otri5);
otri3.LnextSelf();
otri3.Sym(ref otri4);
otri3.Bond(ref otri5);
otri.Bond(ref otri4);
otri.LnextSelf();
otri.Sym(ref otri6);
otri3.LprevSelf();
otri3.Bond(ref otri6);
otri.SetOrg(vertex10);
otri.SetDest(null);
otri.SetApex(vertex14);
otri3.SetOrg(null);
otri3.SetDest(vertex12);
otri3.SetApex(vertex14);
vertex12 = vertex14;
otri4.Copy(ref otri3);
vertex14 = otri3.Apex();
flag4 = vertex14 != null && Primitives.InCircle(vertex10, vertex11, vertex12, vertex14) > 0.0;
}
}
}
if (!flag3)
{
otri2.Lnext(ref otri3);
otri3.SymSelf();
Vertex vertex14 = otri3.Apex();
if (vertex14 != null)
{
bool flag4 = Primitives.InCircle(vertex10, vertex11, vertex13, vertex14) > 0.0;
while (flag4)
{
otri3.LprevSelf();
otri3.Sym(ref otri5);
otri3.LprevSelf();
otri3.Sym(ref otri4);
otri3.Bond(ref otri5);
otri2.Bond(ref otri4);
otri2.LprevSelf();
otri2.Sym(ref otri6);
otri3.LnextSelf();
otri3.Bond(ref otri6);
otri2.SetOrg(null);
otri2.SetDest(vertex11);
otri2.SetApex(vertex14);
otri3.SetOrg(vertex13);
otri3.SetDest(null);
otri3.SetApex(vertex14);
vertex13 = vertex14;
otri4.Copy(ref otri3);
vertex14 = otri3.Apex();
flag4 = vertex14 != null && Primitives.InCircle(vertex10, vertex11, vertex13, vertex14) > 0.0;
}
}
}
if (flag2 || (!flag3 && Primitives.InCircle(vertex12, vertex10, vertex11, vertex13) > 0.0))
{
otri8.Bond(ref otri2);
otri2.Lprev(ref otri8);
otri8.SetDest(vertex10);
vertex11 = vertex13;
otri8.Sym(ref otri2);
vertex13 = otri2.Apex();
}
else
{
otri8.Bond(ref otri);
otri.Lnext(ref otri8);
otri8.SetOrg(vertex11);
vertex10 = vertex12;
otri8.Sym(ref otri);
vertex12 = otri.Apex();
}
}
this.mesh.MakeTriangle(ref otri3);
otri3.SetOrg(vertex10);
otri3.SetDest(vertex11);
otri3.Bond(ref otri8);
otri3.LnextSelf();
otri3.Bond(ref otri2);
otri3.LnextSelf();
otri3.Bond(ref otri);
if (this.useDwyer && axis == 1)
{
vertex5 = farleft.Org();
Vertex vertex6 = farleft.Apex();
vertex7 = farright.Dest();
Vertex vertex8 = farright.Apex();
farleft.Sym(ref otri7);
Vertex vertex9 = otri7.Apex();
while (vertex9.x < vertex5.x)
{
otri7.Lprev(ref farleft);
vertex5 = vertex9;
farleft.Sym(ref otri7);
vertex9 = otri7.Apex();
}
while (vertex8.x > vertex7.x)
{
farright.LprevSelf();
farright.SymSelf();
vertex7 = vertex8;
vertex8 = farright.Apex();
}
}
}
// Token: 0x06000225 RID: 549 RVA: 0x00019FAC File Offset: 0x000181AC
private void DivconqRecurse(int left, int right, int axis, ref Otri farleft, ref Otri farright)
{
Otri otri = default(Otri);
Otri otri2 = default(Otri);
Otri otri3 = default(Otri);
Otri otri4 = default(Otri);
Otri otri5 = default(Otri);
Otri otri6 = default(Otri);
int num = right - left + 1;
if (num == 2)
{
this.mesh.MakeTriangle(ref farleft);
farleft.SetOrg(this.sortarray[left]);
farleft.SetDest(this.sortarray[left + 1]);
this.mesh.MakeTriangle(ref farright);
farright.SetOrg(this.sortarray[left + 1]);
farright.SetDest(this.sortarray[left]);
farleft.Bond(ref farright);
farleft.LprevSelf();
farright.LnextSelf();
farleft.Bond(ref farright);
farleft.LprevSelf();
farright.LnextSelf();
farleft.Bond(ref farright);
farright.Lprev(ref farleft);
return;
}
if (num != 3)
{
int num2 = num >> 1;
this.DivconqRecurse(left, left + num2 - 1, 1 - axis, ref farleft, ref otri5);
this.DivconqRecurse(left + num2, right, 1 - axis, ref otri6, ref farright);
this.MergeHulls(ref farleft, ref otri5, ref otri6, ref farright, axis);
return;
}
this.mesh.MakeTriangle(ref otri);
this.mesh.MakeTriangle(ref otri2);
this.mesh.MakeTriangle(ref otri3);
this.mesh.MakeTriangle(ref otri4);
double num3 = Primitives.CounterClockwise(this.sortarray[left], this.sortarray[left + 1], this.sortarray[left + 2]);
if (num3 == 0.0)
{
otri.SetOrg(this.sortarray[left]);
otri.SetDest(this.sortarray[left + 1]);
otri2.SetOrg(this.sortarray[left + 1]);
otri2.SetDest(this.sortarray[left]);
otri3.SetOrg(this.sortarray[left + 2]);
otri3.SetDest(this.sortarray[left + 1]);
otri4.SetOrg(this.sortarray[left + 1]);
otri4.SetDest(this.sortarray[left + 2]);
otri.Bond(ref otri2);
otri3.Bond(ref otri4);
otri.LnextSelf();
otri2.LprevSelf();
otri3.LnextSelf();
otri4.LprevSelf();
otri.Bond(ref otri4);
otri2.Bond(ref otri3);
otri.LnextSelf();
otri2.LprevSelf();
otri3.LnextSelf();
otri4.LprevSelf();
otri.Bond(ref otri2);
otri3.Bond(ref otri4);
otri2.Copy(ref farleft);
otri3.Copy(ref farright);
return;
}
otri.SetOrg(this.sortarray[left]);
otri2.SetDest(this.sortarray[left]);
otri4.SetOrg(this.sortarray[left]);
if (num3 > 0.0)
{
otri.SetDest(this.sortarray[left + 1]);
otri2.SetOrg(this.sortarray[left + 1]);
otri3.SetDest(this.sortarray[left + 1]);
otri.SetApex(this.sortarray[left + 2]);
otri3.SetOrg(this.sortarray[left + 2]);
otri4.SetDest(this.sortarray[left + 2]);
}
else
{
otri.SetDest(this.sortarray[left + 2]);
otri2.SetOrg(this.sortarray[left + 2]);
otri3.SetDest(this.sortarray[left + 2]);
otri.SetApex(this.sortarray[left + 1]);
otri3.SetOrg(this.sortarray[left + 1]);
otri4.SetDest(this.sortarray[left + 1]);
}
otri.Bond(ref otri2);
otri.LnextSelf();
otri.Bond(ref otri3);
otri.LnextSelf();
otri.Bond(ref otri4);
otri2.LprevSelf();
otri3.LnextSelf();
otri2.Bond(ref otri3);
otri2.LprevSelf();
otri4.LprevSelf();
otri2.Bond(ref otri4);
otri3.LnextSelf();
otri4.LprevSelf();
otri3.Bond(ref otri4);
otri2.Copy(ref farleft);
if (num3 > 0.0)
{
otri3.Copy(ref farright);
return;
}
farleft.Lnext(ref farright);
}
// Token: 0x06000226 RID: 550 RVA: 0x0001A3E4 File Offset: 0x000185E4
private int RemoveGhosts(ref Otri startghost)
{
Otri otri = default(Otri);
Otri otri2 = default(Otri);
Otri otri3 = default(Otri);
bool flag = !this.mesh.behavior.Poly;
startghost.Lprev(ref otri);
otri.SymSelf();
Mesh.dummytri.neighbors[0] = otri;
startghost.Copy(ref otri2);
int num = 0;
do
{
num++;
otri2.Lnext(ref otri3);
otri2.LprevSelf();
otri2.SymSelf();
if (flag && otri2.triangle != Mesh.dummytri)
{
Vertex vertex = otri2.Org();
if (vertex.mark == 0)
{
vertex.mark = 1;
}
}
otri2.Dissolve();
otri3.Sym(ref otri2);
this.mesh.TriangleDealloc(otri3.triangle);
}
while (!otri2.Equal(startghost));
return num;
}
// Token: 0x06000227 RID: 551 RVA: 0x0001A4C0 File Offset: 0x000186C0
public int Triangulate(Mesh m)
{
Otri otri = default(Otri);
Otri otri2 = default(Otri);
this.mesh = m;
this.sortarray = new Vertex[m.invertices];
int num = 0;
foreach (Vertex vertex in m.vertices.Values)
{
this.sortarray[num++] = vertex;
}
this.VertexSort(0, m.invertices - 1);
num = 0;
for (int i = 1; i < m.invertices; i++)
{
if (this.sortarray[num].x == this.sortarray[i].x && this.sortarray[num].y == this.sortarray[i].y)
{
if (Behavior.Verbose)
{
SimpleLog.Instance.Warning(string.Format("A duplicate vertex appeared and was ignored (ID {0}).", this.sortarray[i].hash), "DivConquer.DivconqDelaunay()");
}
this.sortarray[i].type = VertexType.UndeadVertex;
m.undeads++;
}
else
{
num++;
this.sortarray[num] = this.sortarray[i];
}
}
num++;
if (this.useDwyer)
{
int num2 = num >> 1;
if (num - num2 >= 2)
{
if (num2 >= 2)
{
this.AlternateAxes(0, num2 - 1, 1);
}
this.AlternateAxes(num2, num - 1, 1);
}
}
this.DivconqRecurse(0, num - 1, 0, ref otri, ref otri2);
return this.RemoveGhosts(ref otri);
}
// Token: 0x0400012C RID: 300
private static Random rand = new Random(DateTime.Now.Millisecond);
// Token: 0x0400012D RID: 301
private bool useDwyer = true;
// Token: 0x0400012E RID: 302
private Vertex[] sortarray;
// Token: 0x0400012F RID: 303
private Mesh mesh;
}
}
+11
View File
@@ -0,0 +1,11 @@
using System;
namespace TriangleNet.Algorithm
{
// Token: 0x0200003B RID: 59
public interface ITriangulator
{
// Token: 0x06000220 RID: 544
int Triangulate(Mesh mesh);
}
}
+114
View File
@@ -0,0 +1,114 @@
using System;
using TriangleNet.Data;
using TriangleNet.Geometry;
using TriangleNet.Log;
namespace TriangleNet.Algorithm
{
// Token: 0x0200003D RID: 61
internal class Incremental
{
// Token: 0x0600022A RID: 554 RVA: 0x0001A694 File Offset: 0x00018894
private void GetBoundingBox()
{
Otri otri = default(Otri);
BoundingBox bounds = this.mesh.bounds;
double num = bounds.Width;
if (bounds.Height > num)
{
num = bounds.Height;
}
if (num == 0.0)
{
num = 1.0;
}
this.mesh.infvertex1 = new Vertex(bounds.MinX - 50.0 * num, bounds.MinY - 40.0 * num);
this.mesh.infvertex2 = new Vertex(bounds.MaxX + 50.0 * num, bounds.MinY - 40.0 * num);
this.mesh.infvertex3 = new Vertex(0.5 * (bounds.MinX + bounds.MaxX), bounds.MaxY + 60.0 * num);
this.mesh.MakeTriangle(ref otri);
otri.SetOrg(this.mesh.infvertex1);
otri.SetDest(this.mesh.infvertex2);
otri.SetApex(this.mesh.infvertex3);
Mesh.dummytri.neighbors[0] = otri;
}
// Token: 0x0600022B RID: 555 RVA: 0x0001A7D8 File Offset: 0x000189D8
private int RemoveBox()
{
Otri otri = default(Otri);
Otri otri2 = default(Otri);
Otri otri3 = default(Otri);
Otri otri4 = default(Otri);
Otri otri5 = default(Otri);
Otri otri6 = default(Otri);
bool flag = !this.mesh.behavior.Poly;
otri4.triangle = Mesh.dummytri;
otri4.orient = 0;
otri4.SymSelf();
otri4.Lprev(ref otri5);
otri4.LnextSelf();
otri4.SymSelf();
otri4.Lprev(ref otri2);
otri2.SymSelf();
otri4.Lnext(ref otri3);
otri3.SymSelf();
if (otri3.triangle == Mesh.dummytri)
{
otri2.LprevSelf();
otri2.SymSelf();
}
Mesh.dummytri.neighbors[0] = otri2;
int num = -2;
while (!otri4.Equal(otri5))
{
num++;
otri4.Lprev(ref otri6);
otri6.SymSelf();
if (flag && otri6.triangle != Mesh.dummytri)
{
Vertex vertex = otri6.Org();
if (vertex.mark == 0)
{
vertex.mark = 1;
}
}
otri6.Dissolve();
otri4.Lnext(ref otri);
otri.Sym(ref otri4);
this.mesh.TriangleDealloc(otri.triangle);
if (otri4.triangle == Mesh.dummytri)
{
otri6.Copy(ref otri4);
}
}
this.mesh.TriangleDealloc(otri5.triangle);
return num;
}
// Token: 0x0600022C RID: 556 RVA: 0x0001A958 File Offset: 0x00018B58
public int Triangulate(Mesh mesh)
{
this.mesh = mesh;
Otri otri = default(Otri);
this.GetBoundingBox();
foreach (Vertex vertex in mesh.vertices.Values)
{
otri.triangle = Mesh.dummytri;
Osub osub = default(Osub);
if (mesh.InsertVertex(vertex, ref otri, ref osub, false, false) == InsertVertexResult.Duplicate)
{
if (Behavior.Verbose)
{
SimpleLog.Instance.Warning("A duplicate vertex appeared and was ignored.", "Incremental.IncrementalDelaunay()");
}
vertex.type = VertexType.UndeadVertex;
mesh.undeads++;
}
}
return this.RemoveBox();
}
// Token: 0x04000130 RID: 304
private Mesh mesh;
}
}
+651
View File
@@ -0,0 +1,651 @@
using System;
using System.Collections.Generic;
using TriangleNet.Data;
using TriangleNet.Geometry;
using TriangleNet.Log;
using TriangleNet.Tools;
namespace TriangleNet.Algorithm
{
// Token: 0x0200003E RID: 62
internal class SweepLine
{
// Token: 0x0600022E RID: 558 RVA: 0x0001AA18 File Offset: 0x00018C18
private int randomnation(int choices)
{
SweepLine.randomseed = (SweepLine.randomseed * 1366 + 150889) % 714025;
return SweepLine.randomseed / (714025 / choices + 1);
}
// Token: 0x0600022F RID: 559 RVA: 0x0001AA48 File Offset: 0x00018C48
private void HeapInsert(SweepLine.SweepEvent[] heap, int heapsize, SweepLine.SweepEvent newevent)
{
double xkey = newevent.xkey;
double ykey = newevent.ykey;
int num = heapsize;
bool flag = num > 0;
while (flag)
{
int num2 = num - 1 >> 1;
if (heap[num2].ykey < ykey || (heap[num2].ykey == ykey && heap[num2].xkey <= xkey))
{
flag = false;
}
else
{
heap[num] = heap[num2];
heap[num].heapposition = num;
num = num2;
flag = num > 0;
}
}
heap[num] = newevent;
newevent.heapposition = num;
}
// Token: 0x06000230 RID: 560 RVA: 0x0001AAC0 File Offset: 0x00018CC0
private void Heapify(SweepLine.SweepEvent[] heap, int heapsize, int eventnum)
{
SweepLine.SweepEvent sweepEvent = heap[eventnum];
double xkey = sweepEvent.xkey;
double ykey = sweepEvent.ykey;
int num = 2 * eventnum + 1;
bool flag = num < heapsize;
while (flag)
{
int num2;
if (heap[num].ykey < ykey || (heap[num].ykey == ykey && heap[num].xkey < xkey))
{
num2 = num;
}
else
{
num2 = eventnum;
}
int num3 = num + 1;
if (num3 < heapsize && (heap[num3].ykey < heap[num2].ykey || (heap[num3].ykey == heap[num2].ykey && heap[num3].xkey < heap[num2].xkey)))
{
num2 = num3;
}
if (num2 == eventnum)
{
flag = false;
}
else
{
heap[eventnum] = heap[num2];
heap[eventnum].heapposition = eventnum;
heap[num2] = sweepEvent;
sweepEvent.heapposition = num2;
eventnum = num2;
num = 2 * eventnum + 1;
flag = num < heapsize;
}
}
}
// Token: 0x06000231 RID: 561 RVA: 0x0001ABA4 File Offset: 0x00018DA4
private void HeapDelete(SweepLine.SweepEvent[] heap, int heapsize, int eventnum)
{
SweepLine.SweepEvent sweepEvent = heap[heapsize - 1];
if (eventnum > 0)
{
double xkey = sweepEvent.xkey;
double ykey = sweepEvent.ykey;
bool flag;
do
{
int num = eventnum - 1 >> 1;
if (heap[num].ykey < ykey || (heap[num].ykey == ykey && heap[num].xkey <= xkey))
{
flag = false;
}
else
{
heap[eventnum] = heap[num];
heap[eventnum].heapposition = eventnum;
eventnum = num;
flag = eventnum > 0;
}
}
while (flag);
}
heap[eventnum] = sweepEvent;
sweepEvent.heapposition = eventnum;
this.Heapify(heap, heapsize - 1, eventnum);
}
// Token: 0x06000232 RID: 562 RVA: 0x0001AC28 File Offset: 0x00018E28
private void CreateHeap(out SweepLine.SweepEvent[] eventheap)
{
int num = 3 * this.mesh.invertices / 2;
eventheap = new SweepLine.SweepEvent[num];
int num2 = 0;
foreach (Vertex vertex in this.mesh.vertices.Values)
{
SweepLine.SweepEvent sweepEvent = new SweepLine.SweepEvent();
sweepEvent.vertexEvent = vertex;
sweepEvent.xkey = vertex.x;
sweepEvent.ykey = vertex.y;
this.HeapInsert(eventheap, num2++, sweepEvent);
}
}
// Token: 0x06000233 RID: 563 RVA: 0x0001ACCC File Offset: 0x00018ECC
private SweepLine.SplayNode Splay(SweepLine.SplayNode splaytree, Point searchpoint, ref Otri searchtri)
{
if (splaytree == null)
{
return null;
}
if (splaytree.keyedge.Dest() == splaytree.keydest)
{
bool flag = this.RightOfHyperbola(ref splaytree.keyedge, searchpoint);
SweepLine.SplayNode splayNode;
if (flag)
{
splaytree.keyedge.Copy(ref searchtri);
splayNode = splaytree.rchild;
}
else
{
splayNode = splaytree.lchild;
}
if (splayNode == null)
{
return splaytree;
}
if (splayNode.keyedge.Dest() != splayNode.keydest)
{
splayNode = this.Splay(splayNode, searchpoint, ref searchtri);
if (splayNode == null)
{
if (flag)
{
splaytree.rchild = null;
}
else
{
splaytree.lchild = null;
}
return splaytree;
}
}
bool flag2 = this.RightOfHyperbola(ref splayNode.keyedge, searchpoint);
SweepLine.SplayNode splayNode2;
if (flag2)
{
splayNode.keyedge.Copy(ref searchtri);
splayNode2 = this.Splay(splayNode.rchild, searchpoint, ref searchtri);
splayNode.rchild = splayNode2;
}
else
{
splayNode2 = this.Splay(splayNode.lchild, searchpoint, ref searchtri);
splayNode.lchild = splayNode2;
}
if (splayNode2 == null)
{
if (flag)
{
splaytree.rchild = splayNode.lchild;
splayNode.lchild = splaytree;
}
else
{
splaytree.lchild = splayNode.rchild;
splayNode.rchild = splaytree;
}
return splayNode;
}
if (flag2)
{
if (flag)
{
splaytree.rchild = splayNode.lchild;
splayNode.lchild = splaytree;
}
else
{
splaytree.lchild = splayNode2.rchild;
splayNode2.rchild = splaytree;
}
splayNode.rchild = splayNode2.lchild;
splayNode2.lchild = splayNode;
}
else
{
if (flag)
{
splaytree.rchild = splayNode2.lchild;
splayNode2.lchild = splaytree;
}
else
{
splaytree.lchild = splayNode.rchild;
splayNode.rchild = splaytree;
}
splayNode.lchild = splayNode2.rchild;
splayNode2.rchild = splayNode;
}
return splayNode2;
}
else
{
SweepLine.SplayNode splayNode3 = this.Splay(splaytree.lchild, searchpoint, ref searchtri);
SweepLine.SplayNode splayNode4 = this.Splay(splaytree.rchild, searchpoint, ref searchtri);
this.splaynodes.Remove(splaytree);
if (splayNode3 == null)
{
return splayNode4;
}
if (splayNode4 == null)
{
return splayNode3;
}
if (splayNode3.rchild == null)
{
splayNode3.rchild = splayNode4.lchild;
splayNode4.lchild = splayNode3;
return splayNode4;
}
if (splayNode4.lchild == null)
{
splayNode4.lchild = splayNode3.rchild;
splayNode3.rchild = splayNode4;
return splayNode3;
}
SweepLine.SplayNode splayNode5 = splayNode3.rchild;
while (splayNode5.rchild != null)
{
splayNode5 = splayNode5.rchild;
}
splayNode5.rchild = splayNode4;
return splayNode3;
}
}
// Token: 0x06000234 RID: 564 RVA: 0x0001AF00 File Offset: 0x00019100
private SweepLine.SplayNode SplayInsert(SweepLine.SplayNode splayroot, Otri newkey, Point searchpoint)
{
SweepLine.SplayNode splayNode = new SweepLine.SplayNode();
this.splaynodes.Add(splayNode);
newkey.Copy(ref splayNode.keyedge);
splayNode.keydest = newkey.Dest();
if (splayroot == null)
{
splayNode.lchild = null;
splayNode.rchild = null;
}
else if (this.RightOfHyperbola(ref splayroot.keyedge, searchpoint))
{
splayNode.lchild = splayroot;
splayNode.rchild = splayroot.rchild;
splayroot.rchild = null;
}
else
{
splayNode.lchild = splayroot.lchild;
splayNode.rchild = splayroot;
splayroot.lchild = null;
}
return splayNode;
}
// Token: 0x06000235 RID: 565 RVA: 0x0001AF94 File Offset: 0x00019194
private SweepLine.SplayNode FrontLocate(SweepLine.SplayNode splayroot, Otri bottommost, Vertex searchvertex, ref Otri searchtri, ref bool farright)
{
bottommost.Copy(ref searchtri);
splayroot = this.Splay(splayroot, searchvertex, ref searchtri);
bool flag = false;
while (!flag && this.RightOfHyperbola(ref searchtri, searchvertex))
{
searchtri.OnextSelf();
flag = searchtri.Equal(bottommost);
}
farright = flag;
return splayroot;
}
// Token: 0x06000236 RID: 566 RVA: 0x0001AFE0 File Offset: 0x000191E0
private SweepLine.SplayNode CircleTopInsert(SweepLine.SplayNode splayroot, Otri newkey, Vertex pa, Vertex pb, Vertex pc, double topy)
{
Point point = new Point();
Otri otri = default(Otri);
double num = Primitives.CounterClockwise(pa, pb, pc);
double num2 = pa.x - pc.x;
double num3 = pa.y - pc.y;
double num4 = pb.x - pc.x;
double num5 = pb.y - pc.y;
double num6 = num2 * num2 + num3 * num3;
double num7 = num4 * num4 + num5 * num5;
point.x = pc.x - (num3 * num7 - num5 * num6) / (2.0 * num);
point.y = topy;
return this.SplayInsert(this.Splay(splayroot, point, ref otri), newkey, point);
}
// Token: 0x06000237 RID: 567 RVA: 0x0001B098 File Offset: 0x00019298
private bool RightOfHyperbola(ref Otri fronttri, Point newsite)
{
Statistic.HyperbolaCount += 1L;
Vertex vertex = fronttri.Dest();
Vertex vertex2 = fronttri.Apex();
if (vertex.y < vertex2.y || (vertex.y == vertex2.y && vertex.x < vertex2.x))
{
if (newsite.x >= vertex2.x)
{
return true;
}
}
else if (newsite.x <= vertex.x)
{
return false;
}
double num = vertex.x - newsite.x;
double num2 = vertex.y - newsite.y;
double num3 = vertex2.x - newsite.x;
double num4 = vertex2.y - newsite.y;
return num2 * (num3 * num3 + num4 * num4) > num4 * (num * num + num2 * num2);
}
// Token: 0x06000238 RID: 568 RVA: 0x0001B160 File Offset: 0x00019360
private double CircleTop(Vertex pa, Vertex pb, Vertex pc, double ccwabc)
{
Statistic.CircleTopCount += 1L;
double num = pa.x - pc.x;
double num2 = pa.y - pc.y;
double num3 = pb.x - pc.x;
double num4 = pb.y - pc.y;
double num5 = pa.x - pb.x;
double num6 = pa.y - pb.y;
double num7 = num * num + num2 * num2;
double num8 = num3 * num3 + num4 * num4;
double num9 = num5 * num5 + num6 * num6;
return pc.y + (num * num8 - num3 * num7 + Math.Sqrt(num7 * num8 * num9)) / (2.0 * ccwabc);
}
// Token: 0x06000239 RID: 569 RVA: 0x0001B218 File Offset: 0x00019418
private void Check4DeadEvent(ref Otri checktri, SweepLine.SweepEvent[] eventheap, ref int heapsize)
{
SweepLine.SweepEventVertex sweepEventVertex = checktri.Org() as SweepLine.SweepEventVertex;
if (sweepEventVertex != null)
{
int heapposition = sweepEventVertex.evt.heapposition;
this.HeapDelete(eventheap, heapsize, heapposition);
heapsize--;
checktri.SetOrg(null);
}
}
// Token: 0x0600023A RID: 570 RVA: 0x0001B260 File Offset: 0x00019460
private int RemoveGhosts(ref Otri startghost)
{
Otri otri = default(Otri);
Otri otri2 = default(Otri);
Otri otri3 = default(Otri);
bool flag = !this.mesh.behavior.Poly;
startghost.Lprev(ref otri);
otri.SymSelf();
Mesh.dummytri.neighbors[0] = otri;
startghost.Copy(ref otri2);
int num = 0;
do
{
num++;
otri2.Lnext(ref otri3);
otri2.LprevSelf();
otri2.SymSelf();
if (flag && otri2.triangle != Mesh.dummytri)
{
Vertex vertex = otri2.Org();
if (vertex.mark == 0)
{
vertex.mark = 1;
}
}
otri2.Dissolve();
otri3.Sym(ref otri2);
this.mesh.TriangleDealloc(otri3.triangle);
}
while (!otri2.Equal(startghost));
return num;
}
// Token: 0x0600023B RID: 571 RVA: 0x0001B33C File Offset: 0x0001953C
public int Triangulate(Mesh mesh)
{
this.mesh = mesh;
this.xminextreme = 10.0 * mesh.bounds.MinX - 9.0 * mesh.bounds.MaxX;
Otri otri = default(Otri);
Otri otri2 = default(Otri);
Otri otri3 = default(Otri);
Otri otri4 = default(Otri);
Otri otri5 = default(Otri);
Otri otri6 = default(Otri);
Otri otri7 = default(Otri);
bool flag = false;
this.splaynodes = new List<SweepLine.SplayNode>();
SweepLine.SplayNode splayNode = null;
SweepLine.SweepEvent[] array;
this.CreateHeap(out array);
int i = mesh.invertices;
mesh.MakeTriangle(ref otri3);
mesh.MakeTriangle(ref otri4);
otri3.Bond(ref otri4);
otri3.LnextSelf();
otri4.LprevSelf();
otri3.Bond(ref otri4);
otri3.LnextSelf();
otri4.LprevSelf();
otri3.Bond(ref otri4);
Vertex vertexEvent = array[0].vertexEvent;
this.HeapDelete(array, i, 0);
i--;
while (i != 0)
{
Vertex vertexEvent2 = array[0].vertexEvent;
this.HeapDelete(array, i, 0);
i--;
if (vertexEvent.x == vertexEvent2.x && vertexEvent.y == vertexEvent2.y)
{
if (Behavior.Verbose)
{
SimpleLog.Instance.Warning("A duplicate vertex appeared and was ignored (ID " + vertexEvent2.id + ").", "SweepLine.Triangulate().1");
}
vertexEvent2.type = VertexType.UndeadVertex;
mesh.undeads++;
}
if (vertexEvent.x != vertexEvent2.x || vertexEvent.y != vertexEvent2.y)
{
otri3.SetOrg(vertexEvent);
otri3.SetDest(vertexEvent2);
otri4.SetOrg(vertexEvent2);
otri4.SetDest(vertexEvent);
otri3.Lprev(ref otri);
Vertex vertex = vertexEvent2;
while (i > 0)
{
SweepLine.SweepEvent sweepEvent = array[0];
this.HeapDelete(array, i, 0);
i--;
bool flag2 = true;
if (sweepEvent.xkey < mesh.bounds.MinX)
{
Otri otriEvent = sweepEvent.otriEvent;
otriEvent.Oprev(ref otri5);
this.Check4DeadEvent(ref otri5, array, ref i);
otriEvent.Onext(ref otri6);
this.Check4DeadEvent(ref otri6, array, ref i);
if (otri5.Equal(otri))
{
otriEvent.Lprev(ref otri);
}
mesh.Flip(ref otriEvent);
otriEvent.SetApex(null);
otriEvent.Lprev(ref otri3);
otriEvent.Lnext(ref otri4);
otri3.Sym(ref otri5);
if (this.randomnation(SweepLine.SAMPLERATE) == 0)
{
otriEvent.SymSelf();
Vertex vertex2 = otriEvent.Dest();
Vertex vertex3 = otriEvent.Apex();
Vertex vertex4 = otriEvent.Org();
splayNode = this.CircleTopInsert(splayNode, otri3, vertex2, vertex3, vertex4, sweepEvent.ykey);
}
}
else
{
Vertex vertexEvent3 = sweepEvent.vertexEvent;
if (vertexEvent3.x == vertex.x && vertexEvent3.y == vertex.y)
{
if (Behavior.Verbose)
{
SimpleLog.Instance.Warning("A duplicate vertex appeared and was ignored (ID " + vertexEvent3.id + ").", "SweepLine.Triangulate().2");
}
vertexEvent3.type = VertexType.UndeadVertex;
mesh.undeads++;
flag2 = false;
}
else
{
vertex = vertexEvent3;
splayNode = this.FrontLocate(splayNode, otri, vertexEvent3, ref otri2, ref flag);
this.Check4DeadEvent(ref otri2, array, ref i);
otri2.Copy(ref otri6);
otri2.Sym(ref otri5);
mesh.MakeTriangle(ref otri3);
mesh.MakeTriangle(ref otri4);
Vertex vertex5 = otri6.Dest();
otri3.SetOrg(vertex5);
otri3.SetDest(vertexEvent3);
otri4.SetOrg(vertexEvent3);
otri4.SetDest(vertex5);
otri3.Bond(ref otri4);
otri3.LnextSelf();
otri4.LprevSelf();
otri3.Bond(ref otri4);
otri3.LnextSelf();
otri4.LprevSelf();
otri3.Bond(ref otri5);
otri4.Bond(ref otri6);
if (!flag && otri6.Equal(otri))
{
otri3.Copy(ref otri);
}
if (this.randomnation(SweepLine.SAMPLERATE) == 0)
{
splayNode = this.SplayInsert(splayNode, otri3, vertexEvent3);
}
else if (this.randomnation(SweepLine.SAMPLERATE) == 0)
{
otri4.Lnext(ref otri7);
splayNode = this.SplayInsert(splayNode, otri7, vertexEvent3);
}
}
}
if (flag2)
{
Vertex vertex2 = otri5.Apex();
Vertex vertex3 = otri3.Dest();
Vertex vertex4 = otri3.Apex();
double num = Primitives.CounterClockwise(vertex2, vertex3, vertex4);
if (num > 0.0)
{
SweepLine.SweepEvent sweepEvent2 = new SweepLine.SweepEvent();
sweepEvent2.xkey = this.xminextreme;
sweepEvent2.ykey = this.CircleTop(vertex2, vertex3, vertex4, num);
sweepEvent2.otriEvent = otri3;
this.HeapInsert(array, i, sweepEvent2);
i++;
otri3.SetOrg(new SweepLine.SweepEventVertex(sweepEvent2));
}
vertex2 = otri4.Apex();
vertex3 = otri4.Org();
vertex4 = otri6.Apex();
double num2 = Primitives.CounterClockwise(vertex2, vertex3, vertex4);
if (num2 > 0.0)
{
SweepLine.SweepEvent sweepEvent2 = new SweepLine.SweepEvent();
sweepEvent2.xkey = this.xminextreme;
sweepEvent2.ykey = this.CircleTop(vertex2, vertex3, vertex4, num2);
sweepEvent2.otriEvent = otri6;
this.HeapInsert(array, i, sweepEvent2);
i++;
otri6.SetOrg(new SweepLine.SweepEventVertex(sweepEvent2));
}
}
}
this.splaynodes.Clear();
otri.LprevSelf();
return this.RemoveGhosts(ref otri);
}
}
SimpleLog.Instance.Error("Input vertices are all identical.", "SweepLine.Triangulate()");
throw new Exception("Input vertices are all identical.");
}
// Token: 0x04000131 RID: 305
private static int randomseed = 1;
// Token: 0x04000132 RID: 306
private static int SAMPLERATE = 10;
// Token: 0x04000133 RID: 307
private Mesh mesh;
// Token: 0x04000134 RID: 308
private double xminextreme;
// Token: 0x04000135 RID: 309
private List<SweepLine.SplayNode> splaynodes;
// Token: 0x02000046 RID: 70
private class SweepEvent
{
// Token: 0x0400014C RID: 332
public double xkey;
// Token: 0x0400014D RID: 333
public double ykey;
// Token: 0x0400014E RID: 334
public Vertex vertexEvent;
// Token: 0x0400014F RID: 335
public Otri otriEvent;
// Token: 0x04000150 RID: 336
public int heapposition;
}
// Token: 0x02000047 RID: 71
private class SweepEventVertex : Vertex
{
// Token: 0x06000258 RID: 600 RVA: 0x0001BE5D File Offset: 0x0001A05D
public SweepEventVertex(SweepLine.SweepEvent e)
{
this.evt = e;
}
// Token: 0x04000151 RID: 337
public SweepLine.SweepEvent evt;
}
// Token: 0x02000048 RID: 72
private class SplayNode
{
// Token: 0x04000152 RID: 338
public Otri keyedge;
// Token: 0x04000153 RID: 339
public Vertex keydest;
// Token: 0x04000154 RID: 340
public SweepLine.SplayNode lchild;
// Token: 0x04000155 RID: 341
public SweepLine.SplayNode rchild;
}
}
}
+143
View File
@@ -0,0 +1,143 @@
using System;
using TriangleNet.Data;
namespace TriangleNet
{
// Token: 0x02000002 RID: 2
internal class BadTriQueue
{
// Token: 0x17000001 RID: 1
// (get) Token: 0x06000001 RID: 1 RVA: 0x00002050 File Offset: 0x00000250
public int Count
{
get
{
return this.count;
}
}
// Token: 0x06000002 RID: 2 RVA: 0x00002058 File Offset: 0x00000258
public BadTriQueue()
{
this.queuefront = new BadTriangle[4096];
this.queuetail = new BadTriangle[4096];
this.nextnonemptyq = new int[4096];
this.firstnonemptyq = -1;
this.count = 0;
}
// Token: 0x06000003 RID: 3 RVA: 0x000020AC File Offset: 0x000002AC
public void Enqueue(BadTriangle badtri)
{
this.count++;
double num;
int num2;
if (badtri.key >= 1.0)
{
num = badtri.key;
num2 = 1;
}
else
{
num = 1.0 / badtri.key;
num2 = 0;
}
int num3 = 0;
while (num > 2.0)
{
int num4 = 1;
double num5 = 0.5;
while (num * num5 * num5 > 1.0)
{
num4 *= 2;
num5 *= num5;
}
num3 += num4;
num *= num5;
}
num3 = 2 * num3 + ((num > BadTriQueue.SQRT2) ? 1 : 0);
int num6;
if (num2 > 0)
{
num6 = 2047 - num3;
}
else
{
num6 = 2048 + num3;
}
if (this.queuefront[num6] == null)
{
if (num6 > this.firstnonemptyq)
{
this.nextnonemptyq[num6] = this.firstnonemptyq;
this.firstnonemptyq = num6;
}
else
{
int num7 = num6 + 1;
while (this.queuefront[num7] == null)
{
num7++;
}
this.nextnonemptyq[num6] = this.nextnonemptyq[num7];
this.nextnonemptyq[num7] = num6;
}
this.queuefront[num6] = badtri;
}
else
{
this.queuetail[num6].nexttriang = badtri;
}
this.queuetail[num6] = badtri;
badtri.nexttriang = null;
}
// Token: 0x06000004 RID: 4 RVA: 0x000021F0 File Offset: 0x000003F0
public void Enqueue(ref Otri enqtri, double minedge, Vertex enqapex, Vertex enqorg, Vertex enqdest)
{
this.Enqueue(new BadTriangle
{
poortri = enqtri,
key = minedge,
triangapex = enqapex,
triangorg = enqorg,
triangdest = enqdest
});
}
// Token: 0x06000005 RID: 5 RVA: 0x00002234 File Offset: 0x00000434
public BadTriangle Dequeue()
{
if (this.firstnonemptyq < 0)
{
return null;
}
this.count--;
BadTriangle badTriangle = this.queuefront[this.firstnonemptyq];
this.queuefront[this.firstnonemptyq] = badTriangle.nexttriang;
if (badTriangle == this.queuetail[this.firstnonemptyq])
{
this.firstnonemptyq = this.nextnonemptyq[this.firstnonemptyq];
}
return badTriangle;
}
// Token: 0x04000001 RID: 1
private static readonly double SQRT2 = 1.4142135623730951;
// Token: 0x04000002 RID: 2
private BadTriangle[] queuefront;
// Token: 0x04000003 RID: 3
private BadTriangle[] queuetail;
// Token: 0x04000004 RID: 4
private int[] nextnonemptyq;
// Token: 0x04000005 RID: 5
private int firstnonemptyq;
// Token: 0x04000006 RID: 6
private int count;
}
}
+366
View File
@@ -0,0 +1,366 @@
using System;
using TriangleNet.Geometry;
using TriangleNet.Log;
namespace TriangleNet
{
// Token: 0x02000003 RID: 3
public class Behavior
{
// Token: 0x06000007 RID: 7 RVA: 0x000022B0 File Offset: 0x000004B0
public Behavior(bool quality, double minAngle)
{
if (quality)
{
this.quality = true;
this.minAngle = minAngle;
this.Update();
}
}
// Token: 0x06000008 RID: 8 RVA: 0x000022FE File Offset: 0x000004FE
public Behavior()
: this(false, 20.0)
{
}
// Token: 0x06000009 RID: 9 RVA: 0x00002310 File Offset: 0x00000510
private void Update()
{
this.quality = true;
if (this.minAngle < 0.0 || this.minAngle > 60.0)
{
this.minAngle = 0.0;
this.quality = false;
SimpleLog.Instance.Warning("Invalid quality option (minimum angle).", "Mesh.Behavior");
}
if ((this.maxAngle != 0.0 && this.maxAngle < 90.0) || this.maxAngle > 180.0)
{
this.maxAngle = 0.0;
this.quality = false;
SimpleLog.Instance.Warning("Invalid quality option (maximum angle).", "Mesh.Behavior");
}
this.useSegments = this.Poly || this.Quality || this.Convex;
this.goodAngle = Math.Cos(this.MinAngle * 3.141592653589793 / 180.0);
this.maxGoodAngle = Math.Cos(this.MaxAngle * 3.141592653589793 / 180.0);
if (this.goodAngle == 1.0)
{
this.offconstant = 0.0;
}
else
{
this.offconstant = 0.475 * Math.Sqrt((1.0 + this.goodAngle) / (1.0 - this.goodAngle));
}
this.goodAngle *= this.goodAngle;
}
// Token: 0x17000002 RID: 2
// (get) Token: 0x0600000A RID: 10 RVA: 0x000024A1 File Offset: 0x000006A1
// (set) Token: 0x0600000B RID: 11 RVA: 0x000024A8 File Offset: 0x000006A8
public static bool NoExact { get; set; }
// Token: 0x17000003 RID: 3
// (get) Token: 0x0600000C RID: 12 RVA: 0x000024B0 File Offset: 0x000006B0
// (set) Token: 0x0600000D RID: 13 RVA: 0x000024B7 File Offset: 0x000006B7
public static bool Verbose { get; set; }
// Token: 0x17000004 RID: 4
// (get) Token: 0x0600000E RID: 14 RVA: 0x000024BF File Offset: 0x000006BF
// (set) Token: 0x0600000F RID: 15 RVA: 0x000024C7 File Offset: 0x000006C7
public bool Quality
{
get
{
return this.quality;
}
set
{
this.quality = value;
if (this.quality)
{
this.Update();
}
}
}
// Token: 0x17000005 RID: 5
// (get) Token: 0x06000010 RID: 16 RVA: 0x000024DE File Offset: 0x000006DE
// (set) Token: 0x06000011 RID: 17 RVA: 0x000024E6 File Offset: 0x000006E6
public double MinAngle
{
get
{
return this.minAngle;
}
set
{
this.minAngle = value;
this.Update();
}
}
// Token: 0x17000006 RID: 6
// (get) Token: 0x06000012 RID: 18 RVA: 0x000024F5 File Offset: 0x000006F5
// (set) Token: 0x06000013 RID: 19 RVA: 0x000024FD File Offset: 0x000006FD
public double MaxAngle
{
get
{
return this.maxAngle;
}
set
{
this.maxAngle = value;
this.Update();
}
}
// Token: 0x17000007 RID: 7
// (get) Token: 0x06000014 RID: 20 RVA: 0x0000250C File Offset: 0x0000070C
// (set) Token: 0x06000015 RID: 21 RVA: 0x00002514 File Offset: 0x00000714
public double MaxArea
{
get
{
return this.maxArea;
}
set
{
this.maxArea = value;
this.fixedArea = value > 0.0;
}
}
// Token: 0x17000008 RID: 8
// (get) Token: 0x06000016 RID: 22 RVA: 0x0000252F File Offset: 0x0000072F
// (set) Token: 0x06000017 RID: 23 RVA: 0x00002537 File Offset: 0x00000737
public bool VarArea
{
get
{
return this.varArea;
}
set
{
this.varArea = value;
}
}
// Token: 0x17000009 RID: 9
// (get) Token: 0x06000018 RID: 24 RVA: 0x00002540 File Offset: 0x00000740
// (set) Token: 0x06000019 RID: 25 RVA: 0x00002548 File Offset: 0x00000748
public bool Poly
{
get
{
return this.poly;
}
set
{
this.poly = value;
}
}
// Token: 0x1700000A RID: 10
// (get) Token: 0x0600001A RID: 26 RVA: 0x00002551 File Offset: 0x00000751
// (set) Token: 0x0600001B RID: 27 RVA: 0x00002559 File Offset: 0x00000759
public Func<ITriangle, double, bool> UserTest
{
get
{
return this.usertest;
}
set
{
this.usertest = value;
}
}
// Token: 0x1700000B RID: 11
// (get) Token: 0x0600001C RID: 28 RVA: 0x00002562 File Offset: 0x00000762
// (set) Token: 0x0600001D RID: 29 RVA: 0x0000256A File Offset: 0x0000076A
public bool Convex
{
get
{
return this.convex;
}
set
{
this.convex = value;
}
}
// Token: 0x1700000C RID: 12
// (get) Token: 0x0600001E RID: 30 RVA: 0x00002573 File Offset: 0x00000773
// (set) Token: 0x0600001F RID: 31 RVA: 0x0000257B File Offset: 0x0000077B
public bool ConformingDelaunay
{
get
{
return this.conformDel;
}
set
{
this.conformDel = value;
}
}
// Token: 0x1700000D RID: 13
// (get) Token: 0x06000020 RID: 32 RVA: 0x00002584 File Offset: 0x00000784
// (set) Token: 0x06000021 RID: 33 RVA: 0x0000258C File Offset: 0x0000078C
public TriangulationAlgorithm Algorithm
{
get
{
return this.algorithm;
}
set
{
this.algorithm = value;
}
}
// Token: 0x1700000E RID: 14
// (get) Token: 0x06000022 RID: 34 RVA: 0x00002595 File Offset: 0x00000795
// (set) Token: 0x06000023 RID: 35 RVA: 0x0000259D File Offset: 0x0000079D
public int NoBisect
{
get
{
return this.noBisect;
}
set
{
this.noBisect = value;
if (this.noBisect < 0 || this.noBisect > 2)
{
this.noBisect = 0;
}
}
}
// Token: 0x1700000F RID: 15
// (get) Token: 0x06000024 RID: 36 RVA: 0x000025BF File Offset: 0x000007BF
// (set) Token: 0x06000025 RID: 37 RVA: 0x000025C7 File Offset: 0x000007C7
public int SteinerPoints
{
get
{
return this.steiner;
}
set
{
this.steiner = value;
}
}
// Token: 0x17000010 RID: 16
// (get) Token: 0x06000026 RID: 38 RVA: 0x000025D0 File Offset: 0x000007D0
// (set) Token: 0x06000027 RID: 39 RVA: 0x000025D8 File Offset: 0x000007D8
public bool UseBoundaryMarkers
{
get
{
return this.boundaryMarkers;
}
set
{
this.boundaryMarkers = value;
}
}
// Token: 0x17000011 RID: 17
// (get) Token: 0x06000028 RID: 40 RVA: 0x000025E1 File Offset: 0x000007E1
// (set) Token: 0x06000029 RID: 41 RVA: 0x000025E9 File Offset: 0x000007E9
public bool NoHoles
{
get
{
return this.noHoles;
}
set
{
this.noHoles = value;
}
}
// Token: 0x17000012 RID: 18
// (get) Token: 0x0600002A RID: 42 RVA: 0x000025F2 File Offset: 0x000007F2
// (set) Token: 0x0600002B RID: 43 RVA: 0x000025FA File Offset: 0x000007FA
public bool Jettison
{
get
{
return this.jettison;
}
set
{
this.jettison = value;
}
}
// Token: 0x04000007 RID: 7
private bool poly;
// Token: 0x04000008 RID: 8
private bool quality;
// Token: 0x04000009 RID: 9
private bool varArea;
// Token: 0x0400000A RID: 10
private bool convex;
// Token: 0x0400000B RID: 11
private bool jettison;
// Token: 0x0400000C RID: 12
private bool boundaryMarkers = true;
// Token: 0x0400000D RID: 13
private bool noHoles;
// Token: 0x0400000E RID: 14
private bool conformDel;
// Token: 0x0400000F RID: 15
private TriangulationAlgorithm algorithm;
// Token: 0x04000010 RID: 16
private Func<ITriangle, double, bool> usertest;
// Token: 0x04000011 RID: 17
private int noBisect;
// Token: 0x04000012 RID: 18
private int steiner = -1;
// Token: 0x04000013 RID: 19
private double minAngle;
// Token: 0x04000014 RID: 20
private double maxAngle;
// Token: 0x04000015 RID: 21
private double maxArea = -1.0;
// Token: 0x04000016 RID: 22
internal bool fixedArea;
// Token: 0x04000017 RID: 23
internal bool useSegments = true;
// Token: 0x04000018 RID: 24
internal bool useRegions;
// Token: 0x04000019 RID: 25
internal double goodAngle;
// Token: 0x0400001A RID: 26
internal double maxGoodAngle;
// Token: 0x0400001B RID: 27
internal double offconstant;
}
}
+699
View File
@@ -0,0 +1,699 @@
using System;
using System.Collections.Generic;
using TriangleNet.Data;
using TriangleNet.Geometry;
using TriangleNet.Log;
using TriangleNet.Tools;
namespace TriangleNet
{
// Token: 0x02000004 RID: 4
internal class ConstraintMesher
{
// Token: 0x0600002C RID: 44 RVA: 0x00002603 File Offset: 0x00000803
public ConstraintMesher(Mesh mesh)
{
this.mesh = mesh;
this.behavior = mesh.behavior;
this.locator = mesh.locator;
this.viri = new List<Triangle>();
this.logger = SimpleLog.Instance;
}
// Token: 0x0600002D RID: 45 RVA: 0x00002640 File Offset: 0x00000840
public void CarveHoles()
{
Otri otri = default(Otri);
Triangle[] array = null;
if (!this.mesh.behavior.Convex)
{
this.InfectHull();
}
if (!this.mesh.behavior.NoHoles)
{
foreach (Point point in this.mesh.holes)
{
if (this.mesh.bounds.Contains(point))
{
otri.triangle = Mesh.dummytri;
otri.orient = 0;
otri.SymSelf();
Point point2 = otri.Org();
Vertex vertex = otri.Dest();
if (Primitives.CounterClockwise(point2, vertex, point) > 0.0 && this.mesh.locator.Locate(point, ref otri) != LocateResult.Outside && !otri.IsInfected())
{
otri.Infect();
this.viri.Add(otri.triangle);
}
}
}
}
if (this.mesh.regions.Count > 0)
{
int num = 0;
array = new Triangle[this.mesh.regions.Count];
foreach (RegionPointer regionPointer in this.mesh.regions)
{
array[num] = Mesh.dummytri;
if (this.mesh.bounds.Contains(regionPointer.point))
{
otri.triangle = Mesh.dummytri;
otri.orient = 0;
otri.SymSelf();
Point point3 = otri.Org();
Vertex vertex = otri.Dest();
if (Primitives.CounterClockwise(point3, vertex, regionPointer.point) > 0.0 && this.mesh.locator.Locate(regionPointer.point, ref otri) != LocateResult.Outside && !otri.IsInfected())
{
array[num] = otri.triangle;
array[num].region = regionPointer.id;
}
}
num++;
}
}
if (this.viri.Count > 0)
{
this.Plague();
}
if (array != null)
{
RegionIterator regionIterator = new RegionIterator(this.mesh);
for (int i = 0; i < array.Length; i++)
{
if (array[i] != Mesh.dummytri && !Otri.IsDead(array[i]))
{
regionIterator.Process(array[i]);
}
}
}
this.viri.Clear();
}
// Token: 0x0600002E RID: 46 RVA: 0x000028E0 File Offset: 0x00000AE0
public void FormSkeleton(InputGeometry input)
{
this.mesh.insegments = 0;
if (this.behavior.Poly)
{
if (this.mesh.triangles.Count == 0)
{
return;
}
if (input.HasSegments)
{
this.mesh.MakeVertexMap();
}
foreach (Edge edge in input.segments)
{
this.mesh.insegments++;
int p = edge.P0;
int p2 = edge.P1;
int boundary = edge.Boundary;
if (p < 0 || p >= this.mesh.invertices)
{
if (Behavior.Verbose)
{
this.logger.Warning("Invalid first endpoint of segment.", "Mesh.FormSkeleton().1");
}
}
else if (p2 < 0 || p2 >= this.mesh.invertices)
{
if (Behavior.Verbose)
{
this.logger.Warning("Invalid second endpoint of segment.", "Mesh.FormSkeleton().2");
}
}
else
{
Vertex vertex = this.mesh.vertices[p];
Vertex vertex2 = this.mesh.vertices[p2];
if (vertex.x == vertex2.x && vertex.y == vertex2.y)
{
if (Behavior.Verbose)
{
this.logger.Warning(string.Concat(new object[] { "Endpoints of segment (IDs ", p, "/", p2, ") are coincident." }), "Mesh.FormSkeleton()");
}
}
else
{
this.InsertSegment(vertex, vertex2, boundary);
}
}
}
}
if (this.behavior.Convex || !this.behavior.Poly)
{
this.MarkHull();
}
}
// Token: 0x0600002F RID: 47 RVA: 0x00002AD0 File Offset: 0x00000CD0
private void InfectHull()
{
Otri otri = default(Otri);
Otri otri2 = default(Otri);
Otri otri3 = default(Otri);
Osub osub = default(Osub);
otri.triangle = Mesh.dummytri;
otri.orient = 0;
otri.SymSelf();
otri.Copy(ref otri3);
do
{
if (!otri.IsInfected())
{
otri.SegPivot(ref osub);
if (osub.seg == Mesh.dummysub)
{
if (!otri.IsInfected())
{
otri.Infect();
this.viri.Add(otri.triangle);
}
}
else if (osub.seg.boundary == 0)
{
osub.seg.boundary = 1;
Vertex vertex = otri.Org();
Vertex vertex2 = otri.Dest();
if (vertex.mark == 0)
{
vertex.mark = 1;
}
if (vertex2.mark == 0)
{
vertex2.mark = 1;
}
}
}
otri.LnextSelf();
otri.Oprev(ref otri2);
while (otri2.triangle != Mesh.dummytri)
{
otri2.Copy(ref otri);
otri.Oprev(ref otri2);
}
}
while (!otri.Equal(otri3));
}
// Token: 0x06000030 RID: 48 RVA: 0x00002BF4 File Offset: 0x00000DF4
private void Plague()
{
Otri otri = default(Otri);
Otri otri2 = default(Otri);
Osub osub = default(Osub);
for (int i = 0; i < this.viri.Count; i++)
{
otri.triangle = this.viri[i];
otri.Uninfect();
otri.orient = 0;
while (otri.orient < 3)
{
otri.Sym(ref otri2);
otri.SegPivot(ref osub);
if (otri2.triangle == Mesh.dummytri || otri2.IsInfected())
{
if (osub.seg != Mesh.dummysub)
{
this.mesh.SubsegDealloc(osub.seg);
if (otri2.triangle != Mesh.dummytri)
{
otri2.Uninfect();
otri2.SegDissolve();
otri2.Infect();
}
}
}
else if (osub.seg == Mesh.dummysub)
{
otri2.Infect();
this.viri.Add(otri2.triangle);
}
else
{
osub.TriDissolve();
if (osub.seg.boundary == 0)
{
osub.seg.boundary = 1;
}
Vertex vertex = otri2.Org();
Vertex vertex2 = otri2.Dest();
if (vertex.mark == 0)
{
vertex.mark = 1;
}
if (vertex2.mark == 0)
{
vertex2.mark = 1;
}
}
otri.orient++;
}
otri.Infect();
}
foreach (Triangle triangle in this.viri)
{
otri.triangle = triangle;
otri.orient = 0;
while (otri.orient < 3)
{
Vertex vertex3 = otri.Org();
if (vertex3 != null)
{
bool flag = true;
otri.SetOrg(null);
otri.Onext(ref otri2);
while (otri2.triangle != Mesh.dummytri && !otri2.Equal(otri))
{
if (otri2.IsInfected())
{
otri2.SetOrg(null);
}
else
{
flag = false;
}
otri2.OnextSelf();
}
if (otri2.triangle == Mesh.dummytri)
{
otri.Oprev(ref otri2);
while (otri2.triangle != Mesh.dummytri)
{
if (otri2.IsInfected())
{
otri2.SetOrg(null);
}
else
{
flag = false;
}
otri2.OprevSelf();
}
}
if (flag)
{
vertex3.type = VertexType.UndeadVertex;
this.mesh.undeads++;
}
}
otri.orient++;
}
otri.orient = 0;
while (otri.orient < 3)
{
otri.Sym(ref otri2);
if (otri2.triangle == Mesh.dummytri)
{
this.mesh.hullsize--;
}
else
{
otri2.Dissolve();
this.mesh.hullsize++;
}
otri.orient++;
}
this.mesh.TriangleDealloc(otri.triangle);
}
this.viri.Clear();
}
// Token: 0x06000031 RID: 49 RVA: 0x00002F2C File Offset: 0x0000112C
private FindDirectionResult FindDirection(ref Otri searchtri, Vertex searchpoint)
{
Otri otri = default(Otri);
Vertex vertex = searchtri.Org();
Vertex vertex2 = searchtri.Dest();
Vertex vertex3 = searchtri.Apex();
double num = Primitives.CounterClockwise(searchpoint, vertex, vertex3);
bool flag = num > 0.0;
double num2 = Primitives.CounterClockwise(vertex, searchpoint, vertex2);
bool flag2 = num2 > 0.0;
if (flag && flag2)
{
searchtri.Onext(ref otri);
if (otri.triangle == Mesh.dummytri)
{
flag = false;
}
else
{
flag2 = false;
}
}
while (flag)
{
searchtri.OnextSelf();
if (searchtri.triangle == Mesh.dummytri)
{
this.logger.Error("Unable to find a triangle on path.", "Mesh.FindDirection().1");
throw new Exception("Unable to find a triangle on path.");
}
vertex3 = searchtri.Apex();
num2 = num;
num = Primitives.CounterClockwise(searchpoint, vertex, vertex3);
flag = num > 0.0;
}
while (flag2)
{
searchtri.OprevSelf();
if (searchtri.triangle == Mesh.dummytri)
{
this.logger.Error("Unable to find a triangle on path.", "Mesh.FindDirection().2");
throw new Exception("Unable to find a triangle on path.");
}
vertex2 = searchtri.Dest();
num = num2;
num2 = Primitives.CounterClockwise(vertex, searchpoint, vertex2);
flag2 = num2 > 0.0;
}
if (num == 0.0)
{
return FindDirectionResult.Leftcollinear;
}
if (num2 == 0.0)
{
return FindDirectionResult.Rightcollinear;
}
return FindDirectionResult.Within;
}
// Token: 0x06000032 RID: 50 RVA: 0x00003088 File Offset: 0x00001288
private void SegmentIntersection(ref Otri splittri, ref Osub splitsubseg, Vertex endpoint2)
{
Osub osub = default(Osub);
Vertex vertex = splittri.Apex();
Vertex vertex2 = splittri.Org();
Vertex vertex3 = splittri.Dest();
double num = vertex3.x - vertex2.x;
double num2 = vertex3.y - vertex2.y;
double num3 = endpoint2.x - vertex.x;
double num4 = endpoint2.y - vertex.y;
double num5 = vertex2.x - endpoint2.x;
double num6 = vertex2.y - endpoint2.y;
double num7 = num2 * num3 - num * num4;
if (num7 == 0.0)
{
this.logger.Error("Attempt to find intersection of parallel segments.", "Mesh.SegmentIntersection()");
throw new Exception("Attempt to find intersection of parallel segments.");
}
double num8 = (num4 * num5 - num3 * num6) / num7;
Vertex vertex4 = new Vertex(vertex2.x + num8 * (vertex3.x - vertex2.x), vertex2.y + num8 * (vertex3.y - vertex2.y), splitsubseg.seg.boundary, this.mesh.nextras);
Vertex vertex5 = vertex4;
Mesh mesh = this.mesh;
int hash_vtx = mesh.hash_vtx;
mesh.hash_vtx = hash_vtx + 1;
vertex5.hash = hash_vtx;
vertex4.id = vertex4.hash;
for (int i = 0; i < this.mesh.nextras; i++)
{
vertex4.attributes[i] = vertex2.attributes[i] + num8 * (vertex3.attributes[i] - vertex2.attributes[i]);
}
this.mesh.vertices.Add(vertex4.hash, vertex4);
if (this.mesh.InsertVertex(vertex4, ref splittri, ref splitsubseg, false, false) != InsertVertexResult.Successful)
{
this.logger.Error("Failure to split a segment.", "Mesh.SegmentIntersection()");
throw new Exception("Failure to split a segment.");
}
vertex4.tri = splittri;
if (this.mesh.steinerleft > 0)
{
this.mesh.steinerleft--;
}
splitsubseg.SymSelf();
splitsubseg.Pivot(ref osub);
splitsubseg.Dissolve();
osub.Dissolve();
do
{
splitsubseg.SetSegOrg(vertex4);
splitsubseg.NextSelf();
}
while (splitsubseg.seg != Mesh.dummysub);
do
{
osub.SetSegOrg(vertex4);
osub.NextSelf();
}
while (osub.seg != Mesh.dummysub);
this.FindDirection(ref splittri, vertex);
Vertex vertex6 = splittri.Dest();
Vertex vertex7 = splittri.Apex();
if (vertex7.x == vertex.x && vertex7.y == vertex.y)
{
splittri.OnextSelf();
return;
}
if (vertex6.x != vertex.x || vertex6.y != vertex.y)
{
this.logger.Error("Topological inconsistency after splitting a segment.", "Mesh.SegmentIntersection()");
throw new Exception("Topological inconsistency after splitting a segment.");
}
}
// Token: 0x06000033 RID: 51 RVA: 0x00003358 File Offset: 0x00001558
private bool ScoutSegment(ref Otri searchtri, Vertex endpoint2, int newmark)
{
Otri otri = default(Otri);
Osub osub = default(Osub);
FindDirectionResult findDirectionResult = this.FindDirection(ref searchtri, endpoint2);
Vertex vertex = searchtri.Dest();
Vertex vertex2 = searchtri.Apex();
if ((vertex2.x == endpoint2.x && vertex2.y == endpoint2.y) || (vertex.x == endpoint2.x && vertex.y == endpoint2.y))
{
if (vertex2.x == endpoint2.x && vertex2.y == endpoint2.y)
{
searchtri.LprevSelf();
}
this.mesh.InsertSubseg(ref searchtri, newmark);
return true;
}
if (findDirectionResult == FindDirectionResult.Leftcollinear)
{
searchtri.LprevSelf();
this.mesh.InsertSubseg(ref searchtri, newmark);
return this.ScoutSegment(ref searchtri, endpoint2, newmark);
}
if (findDirectionResult == FindDirectionResult.Rightcollinear)
{
this.mesh.InsertSubseg(ref searchtri, newmark);
searchtri.LnextSelf();
return this.ScoutSegment(ref searchtri, endpoint2, newmark);
}
searchtri.Lnext(ref otri);
otri.SegPivot(ref osub);
if (osub.seg == Mesh.dummysub)
{
return false;
}
this.SegmentIntersection(ref otri, ref osub, endpoint2);
otri.Copy(ref searchtri);
this.mesh.InsertSubseg(ref searchtri, newmark);
return this.ScoutSegment(ref searchtri, endpoint2, newmark);
}
// Token: 0x06000034 RID: 52 RVA: 0x00003484 File Offset: 0x00001684
private void DelaunayFixup(ref Otri fixuptri, bool leftside)
{
Otri otri = default(Otri);
Otri otri2 = default(Otri);
Osub osub = default(Osub);
fixuptri.Lnext(ref otri);
otri.Sym(ref otri2);
if (otri2.triangle == Mesh.dummytri)
{
return;
}
otri.SegPivot(ref osub);
if (osub.seg != Mesh.dummysub)
{
return;
}
Vertex vertex = otri.Apex();
Vertex vertex2 = otri.Org();
Vertex vertex3 = otri.Dest();
Vertex vertex4 = otri2.Apex();
if (leftside)
{
if (Primitives.CounterClockwise(vertex, vertex2, vertex4) <= 0.0)
{
return;
}
}
else if (Primitives.CounterClockwise(vertex4, vertex3, vertex) <= 0.0)
{
return;
}
if (Primitives.CounterClockwise(vertex3, vertex2, vertex4) > 0.0 && Primitives.InCircle(vertex2, vertex4, vertex3, vertex) <= 0.0)
{
return;
}
this.mesh.Flip(ref otri);
fixuptri.LprevSelf();
this.DelaunayFixup(ref fixuptri, leftside);
this.DelaunayFixup(ref otri2, leftside);
}
// Token: 0x06000035 RID: 53 RVA: 0x00003584 File Offset: 0x00001784
private void ConstrainedEdge(ref Otri starttri, Vertex endpoint2, int newmark)
{
Otri otri = default(Otri);
Otri otri2 = default(Otri);
Osub osub = default(Osub);
Vertex vertex = starttri.Org();
starttri.Lnext(ref otri);
this.mesh.Flip(ref otri);
bool flag = false;
bool flag2 = false;
do
{
Vertex vertex2 = otri.Org();
if (vertex2.x == endpoint2.x && vertex2.y == endpoint2.y)
{
otri.Oprev(ref otri2);
this.DelaunayFixup(ref otri, false);
this.DelaunayFixup(ref otri2, true);
flag2 = true;
}
else
{
double num = Primitives.CounterClockwise(vertex, endpoint2, vertex2);
if (num == 0.0)
{
flag = true;
otri.Oprev(ref otri2);
this.DelaunayFixup(ref otri, false);
this.DelaunayFixup(ref otri2, true);
flag2 = true;
}
else
{
if (num > 0.0)
{
otri.Oprev(ref otri2);
this.DelaunayFixup(ref otri2, true);
otri.LprevSelf();
}
else
{
this.DelaunayFixup(ref otri, false);
otri.OprevSelf();
}
otri.SegPivot(ref osub);
if (osub.seg == Mesh.dummysub)
{
this.mesh.Flip(ref otri);
}
else
{
flag = true;
this.SegmentIntersection(ref otri, ref osub, endpoint2);
flag2 = true;
}
}
}
}
while (!flag2);
this.mesh.InsertSubseg(ref otri, newmark);
if (flag && !this.ScoutSegment(ref otri, endpoint2, newmark))
{
this.ConstrainedEdge(ref otri, endpoint2, newmark);
}
}
// Token: 0x06000036 RID: 54 RVA: 0x000036F0 File Offset: 0x000018F0
private void InsertSegment(Vertex endpoint1, Vertex endpoint2, int newmark)
{
Otri otri = default(Otri);
Otri otri2 = default(Otri);
Vertex vertex = null;
otri = endpoint1.tri;
if (otri.triangle != null)
{
vertex = otri.Org();
}
if (vertex != endpoint1)
{
otri.triangle = Mesh.dummytri;
otri.orient = 0;
otri.SymSelf();
if (this.locator.Locate(endpoint1, ref otri) != LocateResult.OnVertex)
{
this.logger.Error("Unable to locate PSLG vertex in triangulation.", "Mesh.InsertSegment().1");
throw new Exception("Unable to locate PSLG vertex in triangulation.");
}
}
this.locator.Update(ref otri);
if (this.ScoutSegment(ref otri, endpoint2, newmark))
{
return;
}
endpoint1 = otri.Org();
vertex = null;
otri2 = endpoint2.tri;
if (otri2.triangle != null)
{
vertex = otri2.Org();
}
if (vertex != endpoint2)
{
otri2.triangle = Mesh.dummytri;
otri2.orient = 0;
otri2.SymSelf();
if (this.locator.Locate(endpoint2, ref otri2) != LocateResult.OnVertex)
{
this.logger.Error("Unable to locate PSLG vertex in triangulation.", "Mesh.InsertSegment().2");
throw new Exception("Unable to locate PSLG vertex in triangulation.");
}
}
this.locator.Update(ref otri2);
if (this.ScoutSegment(ref otri2, endpoint1, newmark))
{
return;
}
endpoint2 = otri2.Org();
this.ConstrainedEdge(ref otri, endpoint2, newmark);
}
// Token: 0x06000037 RID: 55 RVA: 0x0000383C File Offset: 0x00001A3C
private void MarkHull()
{
Otri otri = default(Otri);
Otri otri2 = default(Otri);
Otri otri3 = default(Otri);
otri.triangle = Mesh.dummytri;
otri.orient = 0;
otri.SymSelf();
otri.Copy(ref otri3);
do
{
this.mesh.InsertSubseg(ref otri, 1);
otri.LnextSelf();
otri.Oprev(ref otri2);
while (otri2.triangle != Mesh.dummytri)
{
otri2.Copy(ref otri);
otri.Oprev(ref otri2);
}
}
while (!otri.Equal(otri3));
}
// Token: 0x0400001E RID: 30
private Mesh mesh;
// Token: 0x0400001F RID: 31
private Behavior behavior;
// Token: 0x04000020 RID: 32
private TriangleLocator locator;
// Token: 0x04000021 RID: 33
private List<Triangle> viri;
// Token: 0x04000022 RID: 34
private ILog<SimpleLogItem> logger;
}
}
+41
View File
@@ -0,0 +1,41 @@
using System;
namespace TriangleNet.Data
{
// Token: 0x02000034 RID: 52
internal class BadSubseg
{
// Token: 0x060001BA RID: 442 RVA: 0x0001852B File Offset: 0x0001672B
public BadSubseg()
{
this.Hash = BadSubseg.hashSeed++;
}
// Token: 0x060001BB RID: 443 RVA: 0x00018546 File Offset: 0x00016746
public override int GetHashCode()
{
return this.Hash;
}
// Token: 0x060001BC RID: 444 RVA: 0x0001854E File Offset: 0x0001674E
public override string ToString()
{
return string.Format("B-SID {0}", this.encsubseg.seg.hash);
}
// Token: 0x04000109 RID: 265
private static int hashSeed;
// Token: 0x0400010A RID: 266
internal int Hash;
// Token: 0x0400010B RID: 267
public Osub encsubseg;
// Token: 0x0400010C RID: 268
public Vertex subsegorg;
// Token: 0x0400010D RID: 269
public Vertex subsegdest;
}
}
+44
View File
@@ -0,0 +1,44 @@
using System;
namespace TriangleNet.Data
{
// Token: 0x02000035 RID: 53
internal class BadTriangle
{
// Token: 0x060001BE RID: 446 RVA: 0x00018571 File Offset: 0x00016771
public BadTriangle()
{
this.ID = BadTriangle.OTID++;
}
// Token: 0x060001BF RID: 447 RVA: 0x0001858C File Offset: 0x0001678C
public override string ToString()
{
return string.Format("B-TID {0}", this.poortri.triangle.hash);
}
// Token: 0x0400010E RID: 270
public static int OTID;
// Token: 0x0400010F RID: 271
public int ID;
// Token: 0x04000110 RID: 272
public Otri poortri;
// Token: 0x04000111 RID: 273
public double key;
// Token: 0x04000112 RID: 274
public Vertex triangorg;
// Token: 0x04000113 RID: 275
public Vertex triangdest;
// Token: 0x04000114 RID: 276
public Vertex triangapex;
// Token: 0x04000115 RID: 277
public BadTriangle nexttriang;
}
}
+172
View File
@@ -0,0 +1,172 @@
using System;
namespace TriangleNet.Data
{
// Token: 0x02000036 RID: 54
internal struct Osub
{
// Token: 0x060001C1 RID: 449 RVA: 0x000185AD File Offset: 0x000167AD
public override string ToString()
{
if (this.seg == null)
{
return "O-TID [null]";
}
return string.Format("O-SID {0}", this.seg.hash);
}
// Token: 0x060001C2 RID: 450 RVA: 0x000185D7 File Offset: 0x000167D7
public void Sym(ref Osub o2)
{
o2.seg = this.seg;
o2.orient = 1 - this.orient;
}
// Token: 0x060001C3 RID: 451 RVA: 0x000185F3 File Offset: 0x000167F3
public void SymSelf()
{
this.orient = 1 - this.orient;
}
// Token: 0x060001C4 RID: 452 RVA: 0x00018603 File Offset: 0x00016803
public void Pivot(ref Osub o2)
{
o2 = this.seg.subsegs[this.orient];
}
// Token: 0x060001C5 RID: 453 RVA: 0x00018621 File Offset: 0x00016821
public void PivotSelf()
{
this = this.seg.subsegs[this.orient];
}
// Token: 0x060001C6 RID: 454 RVA: 0x0001863F File Offset: 0x0001683F
public void Next(ref Osub o2)
{
o2 = this.seg.subsegs[1 - this.orient];
}
// Token: 0x060001C7 RID: 455 RVA: 0x0001865F File Offset: 0x0001685F
public void NextSelf()
{
this = this.seg.subsegs[1 - this.orient];
}
// Token: 0x060001C8 RID: 456 RVA: 0x0001867F File Offset: 0x0001687F
public Vertex Org()
{
return this.seg.vertices[this.orient];
}
// Token: 0x060001C9 RID: 457 RVA: 0x00018693 File Offset: 0x00016893
public Vertex Dest()
{
return this.seg.vertices[1 - this.orient];
}
// Token: 0x060001CA RID: 458 RVA: 0x000186A9 File Offset: 0x000168A9
public void SetOrg(Vertex ptr)
{
this.seg.vertices[this.orient] = ptr;
}
// Token: 0x060001CB RID: 459 RVA: 0x000186BE File Offset: 0x000168BE
public void SetDest(Vertex ptr)
{
this.seg.vertices[1 - this.orient] = ptr;
}
// Token: 0x060001CC RID: 460 RVA: 0x000186D5 File Offset: 0x000168D5
public Vertex SegOrg()
{
return this.seg.vertices[2 + this.orient];
}
// Token: 0x060001CD RID: 461 RVA: 0x000186EB File Offset: 0x000168EB
public Vertex SegDest()
{
return this.seg.vertices[3 - this.orient];
}
// Token: 0x060001CE RID: 462 RVA: 0x00018701 File Offset: 0x00016901
public void SetSegOrg(Vertex ptr)
{
this.seg.vertices[2 + this.orient] = ptr;
}
// Token: 0x060001CF RID: 463 RVA: 0x00018718 File Offset: 0x00016918
public void SetSegDest(Vertex ptr)
{
this.seg.vertices[3 - this.orient] = ptr;
}
// Token: 0x060001D0 RID: 464 RVA: 0x0001872F File Offset: 0x0001692F
public int Mark()
{
return this.seg.boundary;
}
// Token: 0x060001D1 RID: 465 RVA: 0x0001873C File Offset: 0x0001693C
public void SetMark(int value)
{
this.seg.boundary = value;
}
// Token: 0x060001D2 RID: 466 RVA: 0x0001874A File Offset: 0x0001694A
public void Bond(ref Osub o2)
{
this.seg.subsegs[this.orient] = o2;
o2.seg.subsegs[o2.orient] = this;
}
// Token: 0x060001D3 RID: 467 RVA: 0x00018784 File Offset: 0x00016984
public void Dissolve()
{
this.seg.subsegs[this.orient].seg = Mesh.dummysub;
}
// Token: 0x060001D4 RID: 468 RVA: 0x000187A6 File Offset: 0x000169A6
public void Copy(ref Osub o2)
{
o2.seg = this.seg;
o2.orient = this.orient;
}
// Token: 0x060001D5 RID: 469 RVA: 0x000187C0 File Offset: 0x000169C0
public bool Equal(Osub o2)
{
return this.seg == o2.seg && this.orient == o2.orient;
}
// Token: 0x060001D6 RID: 470 RVA: 0x000187E0 File Offset: 0x000169E0
public static bool IsDead(Segment sub)
{
return sub.subsegs[0].seg == null;
}
// Token: 0x060001D7 RID: 471 RVA: 0x000187F6 File Offset: 0x000169F6
public static void Kill(Segment sub)
{
sub.subsegs[0].seg = null;
sub.subsegs[1].seg = null;
}
// Token: 0x060001D8 RID: 472 RVA: 0x0001881C File Offset: 0x00016A1C
public void TriPivot(ref Otri ot)
{
ot = this.seg.triangles[this.orient];
}
// Token: 0x060001D9 RID: 473 RVA: 0x0001883A File Offset: 0x00016A3A
public void TriDissolve()
{
this.seg.triangles[this.orient].triangle = Mesh.dummytri;
}
// Token: 0x04000116 RID: 278
public Segment seg;
// Token: 0x04000117 RID: 279
public int orient;
}
}
+315
View File
@@ -0,0 +1,315 @@
using System;
namespace TriangleNet.Data
{
// Token: 0x02000037 RID: 55
internal struct Otri
{
// Token: 0x060001DA RID: 474 RVA: 0x0001885C File Offset: 0x00016A5C
public override string ToString()
{
if (this.triangle == null)
{
return "O-TID [null]";
}
return string.Format("O-TID {0}", this.triangle.hash);
}
// Token: 0x060001DB RID: 475 RVA: 0x00018888 File Offset: 0x00016A88
public void Sym(ref Otri o2)
{
o2.triangle = this.triangle.neighbors[this.orient].triangle;
o2.orient = this.triangle.neighbors[this.orient].orient;
}
// Token: 0x060001DC RID: 476 RVA: 0x000188D8 File Offset: 0x00016AD8
public void SymSelf()
{
int num = this.orient;
this.orient = this.triangle.neighbors[num].orient;
this.triangle = this.triangle.neighbors[num].triangle;
}
// Token: 0x060001DD RID: 477 RVA: 0x00018924 File Offset: 0x00016B24
public void Lnext(ref Otri o2)
{
o2.triangle = this.triangle;
o2.orient = Otri.plus1Mod3[this.orient];
}
// Token: 0x060001DE RID: 478 RVA: 0x00018944 File Offset: 0x00016B44
public void LnextSelf()
{
this.orient = Otri.plus1Mod3[this.orient];
}
// Token: 0x060001DF RID: 479 RVA: 0x00018958 File Offset: 0x00016B58
public void Lprev(ref Otri o2)
{
o2.triangle = this.triangle;
o2.orient = Otri.minus1Mod3[this.orient];
}
// Token: 0x060001E0 RID: 480 RVA: 0x00018978 File Offset: 0x00016B78
public void LprevSelf()
{
this.orient = Otri.minus1Mod3[this.orient];
}
// Token: 0x060001E1 RID: 481 RVA: 0x0001898C File Offset: 0x00016B8C
public void Onext(ref Otri o2)
{
o2.triangle = this.triangle;
o2.orient = Otri.minus1Mod3[this.orient];
int num = o2.orient;
o2.orient = o2.triangle.neighbors[num].orient;
o2.triangle = o2.triangle.neighbors[num].triangle;
}
// Token: 0x060001E2 RID: 482 RVA: 0x000189F8 File Offset: 0x00016BF8
public void OnextSelf()
{
this.orient = Otri.minus1Mod3[this.orient];
int num = this.orient;
this.orient = this.triangle.neighbors[num].orient;
this.triangle = this.triangle.neighbors[num].triangle;
}
// Token: 0x060001E3 RID: 483 RVA: 0x00018A58 File Offset: 0x00016C58
public void Oprev(ref Otri o2)
{
o2.triangle = this.triangle.neighbors[this.orient].triangle;
o2.orient = this.triangle.neighbors[this.orient].orient;
o2.orient = Otri.plus1Mod3[o2.orient];
}
// Token: 0x060001E4 RID: 484 RVA: 0x00018ABC File Offset: 0x00016CBC
public void OprevSelf()
{
int num = this.orient;
this.orient = this.triangle.neighbors[num].orient;
this.triangle = this.triangle.neighbors[num].triangle;
this.orient = Otri.plus1Mod3[this.orient];
}
// Token: 0x060001E5 RID: 485 RVA: 0x00018B1C File Offset: 0x00016D1C
public void Dnext(ref Otri o2)
{
o2.triangle = this.triangle.neighbors[this.orient].triangle;
o2.orient = this.triangle.neighbors[this.orient].orient;
o2.orient = Otri.minus1Mod3[o2.orient];
}
// Token: 0x060001E6 RID: 486 RVA: 0x00018B80 File Offset: 0x00016D80
public void DnextSelf()
{
int num = this.orient;
this.orient = this.triangle.neighbors[num].orient;
this.triangle = this.triangle.neighbors[num].triangle;
this.orient = Otri.minus1Mod3[this.orient];
}
// Token: 0x060001E7 RID: 487 RVA: 0x00018BE0 File Offset: 0x00016DE0
public void Dprev(ref Otri o2)
{
o2.triangle = this.triangle;
o2.orient = Otri.plus1Mod3[this.orient];
int num = o2.orient;
o2.orient = o2.triangle.neighbors[num].orient;
o2.triangle = o2.triangle.neighbors[num].triangle;
}
// Token: 0x060001E8 RID: 488 RVA: 0x00018C4C File Offset: 0x00016E4C
public void DprevSelf()
{
this.orient = Otri.plus1Mod3[this.orient];
int num = this.orient;
this.orient = this.triangle.neighbors[num].orient;
this.triangle = this.triangle.neighbors[num].triangle;
}
// Token: 0x060001E9 RID: 489 RVA: 0x00018CAC File Offset: 0x00016EAC
public void Rnext(ref Otri o2)
{
o2.triangle = this.triangle.neighbors[this.orient].triangle;
o2.orient = this.triangle.neighbors[this.orient].orient;
o2.orient = Otri.plus1Mod3[o2.orient];
int num = o2.orient;
o2.orient = o2.triangle.neighbors[num].orient;
o2.triangle = o2.triangle.neighbors[num].triangle;
}
// Token: 0x060001EA RID: 490 RVA: 0x00018D4C File Offset: 0x00016F4C
public void RnextSelf()
{
int num = this.orient;
this.orient = this.triangle.neighbors[num].orient;
this.triangle = this.triangle.neighbors[num].triangle;
this.orient = Otri.plus1Mod3[this.orient];
num = this.orient;
this.orient = this.triangle.neighbors[num].orient;
this.triangle = this.triangle.neighbors[num].triangle;
}
// Token: 0x060001EB RID: 491 RVA: 0x00018DEC File Offset: 0x00016FEC
public void Rprev(ref Otri o2)
{
o2.triangle = this.triangle.neighbors[this.orient].triangle;
o2.orient = this.triangle.neighbors[this.orient].orient;
o2.orient = Otri.minus1Mod3[o2.orient];
int num = o2.orient;
o2.orient = o2.triangle.neighbors[num].orient;
o2.triangle = o2.triangle.neighbors[num].triangle;
}
// Token: 0x060001EC RID: 492 RVA: 0x00018E8C File Offset: 0x0001708C
public void RprevSelf()
{
int num = this.orient;
this.orient = this.triangle.neighbors[num].orient;
this.triangle = this.triangle.neighbors[num].triangle;
this.orient = Otri.minus1Mod3[this.orient];
num = this.orient;
this.orient = this.triangle.neighbors[num].orient;
this.triangle = this.triangle.neighbors[num].triangle;
}
// Token: 0x060001ED RID: 493 RVA: 0x00018F29 File Offset: 0x00017129
public Vertex Org()
{
return this.triangle.vertices[Otri.plus1Mod3[this.orient]];
}
// Token: 0x060001EE RID: 494 RVA: 0x00018F43 File Offset: 0x00017143
public Vertex Dest()
{
return this.triangle.vertices[Otri.minus1Mod3[this.orient]];
}
// Token: 0x060001EF RID: 495 RVA: 0x00018F5D File Offset: 0x0001715D
public Vertex Apex()
{
return this.triangle.vertices[this.orient];
}
// Token: 0x060001F0 RID: 496 RVA: 0x00018F71 File Offset: 0x00017171
public void SetOrg(Vertex ptr)
{
this.triangle.vertices[Otri.plus1Mod3[this.orient]] = ptr;
}
// Token: 0x060001F1 RID: 497 RVA: 0x00018F8C File Offset: 0x0001718C
public void SetDest(Vertex ptr)
{
this.triangle.vertices[Otri.minus1Mod3[this.orient]] = ptr;
}
// Token: 0x060001F2 RID: 498 RVA: 0x00018FA7 File Offset: 0x000171A7
public void SetApex(Vertex ptr)
{
this.triangle.vertices[this.orient] = ptr;
}
// Token: 0x060001F3 RID: 499 RVA: 0x00018FBC File Offset: 0x000171BC
public void Bond(ref Otri o2)
{
this.triangle.neighbors[this.orient].triangle = o2.triangle;
this.triangle.neighbors[this.orient].orient = o2.orient;
o2.triangle.neighbors[o2.orient].triangle = this.triangle;
o2.triangle.neighbors[o2.orient].orient = this.orient;
}
// Token: 0x060001F4 RID: 500 RVA: 0x0001904D File Offset: 0x0001724D
public void Dissolve()
{
this.triangle.neighbors[this.orient].triangle = Mesh.dummytri;
this.triangle.neighbors[this.orient].orient = 0;
}
// Token: 0x060001F5 RID: 501 RVA: 0x0001908B File Offset: 0x0001728B
public void Copy(ref Otri o2)
{
o2.triangle = this.triangle;
o2.orient = this.orient;
}
// Token: 0x060001F6 RID: 502 RVA: 0x000190A5 File Offset: 0x000172A5
public bool Equal(Otri o2)
{
return this.triangle == o2.triangle && this.orient == o2.orient;
}
// Token: 0x060001F7 RID: 503 RVA: 0x000190C5 File Offset: 0x000172C5
public void Infect()
{
this.triangle.infected = true;
}
// Token: 0x060001F8 RID: 504 RVA: 0x000190D3 File Offset: 0x000172D3
public void Uninfect()
{
this.triangle.infected = false;
}
// Token: 0x060001F9 RID: 505 RVA: 0x000190E1 File Offset: 0x000172E1
public bool IsInfected()
{
return this.triangle.infected;
}
// Token: 0x060001FA RID: 506 RVA: 0x000190EE File Offset: 0x000172EE
public static bool IsDead(Triangle tria)
{
return tria.neighbors[0].triangle == null;
}
// Token: 0x060001FB RID: 507 RVA: 0x00019104 File Offset: 0x00017304
public static void Kill(Triangle tria)
{
tria.neighbors[0].triangle = null;
tria.neighbors[2].triangle = null;
}
// Token: 0x060001FC RID: 508 RVA: 0x0001912A File Offset: 0x0001732A
public void SegPivot(ref Osub os)
{
os = this.triangle.subsegs[this.orient];
}
// Token: 0x060001FD RID: 509 RVA: 0x00019148 File Offset: 0x00017348
public void SegBond(ref Osub os)
{
this.triangle.subsegs[this.orient] = os;
os.seg.triangles[os.orient] = this;
}
// Token: 0x060001FE RID: 510 RVA: 0x00019182 File Offset: 0x00017382
public void SegDissolve()
{
this.triangle.subsegs[this.orient].seg = Mesh.dummysub;
}
// Token: 0x060001FF RID: 511 RVA: 0x000191A4 File Offset: 0x000173A4
// Note: this type is marked as 'beforefieldinit'.
static Otri()
{
int[] array = new int[3];
array[0] = 1;
array[1] = 2;
Otri.plus1Mod3 = array;
Otri.minus1Mod3 = new int[] { 2, 0, 1 };
}
// Token: 0x04000118 RID: 280
public Triangle triangle;
// Token: 0x04000119 RID: 281
public int orient;
// Token: 0x0400011A RID: 282
private static readonly int[] plus1Mod3;
// Token: 0x0400011B RID: 283
private static readonly int[] minus1Mod3;
}
}
+95
View File
@@ -0,0 +1,95 @@
using System;
using TriangleNet.Geometry;
namespace TriangleNet.Data
{
// Token: 0x02000038 RID: 56
public class Segment : ISegment
{
// Token: 0x06000200 RID: 512 RVA: 0x000191CC File Offset: 0x000173CC
public Segment()
{
this.subsegs = new Osub[2];
this.subsegs[0].seg = Mesh.dummysub;
this.subsegs[1].seg = Mesh.dummysub;
this.vertices = new Vertex[4];
this.triangles = new Otri[2];
this.triangles[0].triangle = Mesh.dummytri;
this.triangles[1].triangle = Mesh.dummytri;
this.boundary = 0;
}
// Token: 0x17000086 RID: 134
// (get) Token: 0x06000201 RID: 513 RVA: 0x00019262 File Offset: 0x00017462
public int P0
{
get
{
return this.vertices[0].id;
}
}
// Token: 0x17000087 RID: 135
// (get) Token: 0x06000202 RID: 514 RVA: 0x00019271 File Offset: 0x00017471
public int P1
{
get
{
return this.vertices[1].id;
}
}
// Token: 0x17000088 RID: 136
// (get) Token: 0x06000203 RID: 515 RVA: 0x00019280 File Offset: 0x00017480
public int Boundary
{
get
{
return this.boundary;
}
}
// Token: 0x06000204 RID: 516 RVA: 0x00019288 File Offset: 0x00017488
public Vertex GetVertex(int index)
{
return this.vertices[index];
}
// Token: 0x06000205 RID: 517 RVA: 0x00019292 File Offset: 0x00017492
public ITriangle GetTriangle(int index)
{
if (this.triangles[index].triangle != Mesh.dummytri)
{
return this.triangles[index].triangle;
}
return null;
}
// Token: 0x06000206 RID: 518 RVA: 0x000192BF File Offset: 0x000174BF
public override int GetHashCode()
{
return this.hash;
}
// Token: 0x06000207 RID: 519 RVA: 0x000192C7 File Offset: 0x000174C7
public override string ToString()
{
return string.Format("SID {0}", this.hash);
}
// Token: 0x0400011C RID: 284
internal int hash;
// Token: 0x0400011D RID: 285
internal Osub[] subsegs;
// Token: 0x0400011E RID: 286
internal Vertex[] vertices;
// Token: 0x0400011F RID: 287
internal Otri[] triangles;
// Token: 0x04000120 RID: 288
internal int boundary;
}
}
+202
View File
@@ -0,0 +1,202 @@
using System;
using TriangleNet.Geometry;
namespace TriangleNet.Data
{
// Token: 0x02000039 RID: 57
public class Triangle : ITriangle
{
// Token: 0x06000208 RID: 520 RVA: 0x000192E0 File Offset: 0x000174E0
public Triangle()
{
this.neighbors = new Otri[3];
this.neighbors[0].triangle = Mesh.dummytri;
this.neighbors[1].triangle = Mesh.dummytri;
this.neighbors[2].triangle = Mesh.dummytri;
this.vertices = new Vertex[3];
this.subsegs = new Osub[3];
this.subsegs[0].seg = Mesh.dummysub;
this.subsegs[1].seg = Mesh.dummysub;
this.subsegs[2].seg = Mesh.dummysub;
}
// Token: 0x17000089 RID: 137
// (get) Token: 0x06000209 RID: 521 RVA: 0x0001939B File Offset: 0x0001759B
public int ID
{
get
{
return this.id;
}
}
// Token: 0x1700008A RID: 138
// (get) Token: 0x0600020A RID: 522 RVA: 0x000193A3 File Offset: 0x000175A3
public int P0
{
get
{
if (!(this.vertices[0] == null))
{
return this.vertices[0].id;
}
return -1;
}
}
// Token: 0x1700008B RID: 139
// (get) Token: 0x0600020B RID: 523 RVA: 0x000193C4 File Offset: 0x000175C4
public int P1
{
get
{
if (!(this.vertices[1] == null))
{
return this.vertices[1].id;
}
return -1;
}
}
// Token: 0x0600020C RID: 524 RVA: 0x000193E5 File Offset: 0x000175E5
public Vertex GetVertex(int index)
{
return this.vertices[index];
}
// Token: 0x1700008C RID: 140
// (get) Token: 0x0600020D RID: 525 RVA: 0x000193EF File Offset: 0x000175EF
public int P2
{
get
{
if (!(this.vertices[2] == null))
{
return this.vertices[2].id;
}
return -1;
}
}
// Token: 0x1700008D RID: 141
// (get) Token: 0x0600020E RID: 526 RVA: 0x00019410 File Offset: 0x00017610
public bool SupportsNeighbors
{
get
{
return true;
}
}
// Token: 0x1700008E RID: 142
// (get) Token: 0x0600020F RID: 527 RVA: 0x00019413 File Offset: 0x00017613
public int N0
{
get
{
return this.neighbors[0].triangle.id;
}
}
// Token: 0x1700008F RID: 143
// (get) Token: 0x06000210 RID: 528 RVA: 0x0001942B File Offset: 0x0001762B
public int N1
{
get
{
return this.neighbors[1].triangle.id;
}
}
// Token: 0x17000090 RID: 144
// (get) Token: 0x06000211 RID: 529 RVA: 0x00019443 File Offset: 0x00017643
public int N2
{
get
{
return this.neighbors[2].triangle.id;
}
}
// Token: 0x06000212 RID: 530 RVA: 0x0001945B File Offset: 0x0001765B
public ITriangle GetNeighbor(int index)
{
if (this.neighbors[index].triangle != Mesh.dummytri)
{
return this.neighbors[index].triangle;
}
return null;
}
// Token: 0x06000213 RID: 531 RVA: 0x00019488 File Offset: 0x00017688
public ISegment GetSegment(int index)
{
if (this.subsegs[index].seg != Mesh.dummysub)
{
return this.subsegs[index].seg;
}
return null;
}
// Token: 0x17000091 RID: 145
// (get) Token: 0x06000214 RID: 532 RVA: 0x000194B5 File Offset: 0x000176B5
// (set) Token: 0x06000215 RID: 533 RVA: 0x000194BD File Offset: 0x000176BD
public double Area
{
get
{
return this.area;
}
set
{
this.area = value;
}
}
// Token: 0x17000092 RID: 146
// (get) Token: 0x06000216 RID: 534 RVA: 0x000194C6 File Offset: 0x000176C6
public int Region
{
get
{
return this.region;
}
}
// Token: 0x06000217 RID: 535 RVA: 0x000194CE File Offset: 0x000176CE
public override int GetHashCode()
{
return this.hash;
}
// Token: 0x06000218 RID: 536 RVA: 0x000194D6 File Offset: 0x000176D6
public override string ToString()
{
return string.Format("TID {0}", this.hash);
}
// Token: 0x04000121 RID: 289
internal int hash;
// Token: 0x04000122 RID: 290
internal int id;
// Token: 0x04000123 RID: 291
internal Otri[] neighbors;
// Token: 0x04000124 RID: 292
internal Vertex[] vertices;
// Token: 0x04000125 RID: 293
internal Osub[] subsegs;
// Token: 0x04000126 RID: 294
internal int region;
// Token: 0x04000127 RID: 295
internal double area;
// Token: 0x04000128 RID: 296
internal bool infected;
}
}
+80
View File
@@ -0,0 +1,80 @@
using System;
using TriangleNet.Geometry;
namespace TriangleNet.Data
{
// Token: 0x0200003A RID: 58
public class Vertex : Point
{
// Token: 0x06000219 RID: 537 RVA: 0x000194ED File Offset: 0x000176ED
public Vertex()
: this(0.0, 0.0, 0, 0)
{
}
// Token: 0x0600021A RID: 538 RVA: 0x00019509 File Offset: 0x00017709
public Vertex(double x, double y)
: this(x, y, 0, 0)
{
}
// Token: 0x0600021B RID: 539 RVA: 0x00019515 File Offset: 0x00017715
public Vertex(double x, double y, int mark)
: this(x, y, mark, 0)
{
}
// Token: 0x0600021C RID: 540 RVA: 0x00019521 File Offset: 0x00017721
public Vertex(double x, double y, int mark, int attribs)
: base(x, y, mark)
{
this.type = VertexType.InputVertex;
if (attribs > 0)
{
this.attributes = new double[attribs];
}
}
// Token: 0x17000093 RID: 147
// (get) Token: 0x0600021D RID: 541 RVA: 0x00019545 File Offset: 0x00017745
public VertexType Type
{
get
{
return this.type;
}
}
// Token: 0x17000094 RID: 148
public double this[int i]
{
get
{
if (i == 0)
{
return this.x;
}
if (i == 1)
{
return this.y;
}
throw new ArgumentOutOfRangeException("Index must be 0 or 1.");
}
}
// Token: 0x0600021F RID: 543 RVA: 0x0001956E File Offset: 0x0001776E
public override int GetHashCode()
{
return this.hash;
}
// Token: 0x04000129 RID: 297
internal int hash;
// Token: 0x0400012A RID: 298
internal VertexType type;
// Token: 0x0400012B RID: 299
internal Otri tri;
}
}
+15
View File
@@ -0,0 +1,15 @@
using System;
namespace TriangleNet
{
// Token: 0x0200000B RID: 11
internal enum FindDirectionResult
{
// Token: 0x04000046 RID: 70
Within,
// Token: 0x04000047 RID: 71
Leftcollinear,
// Token: 0x04000048 RID: 72
Rightcollinear
}
}
+146
View File
@@ -0,0 +1,146 @@
using System;
namespace TriangleNet.Geometry
{
// Token: 0x0200002C RID: 44
public class BoundingBox
{
// Token: 0x06000167 RID: 359 RVA: 0x00017C6D File Offset: 0x00015E6D
public BoundingBox()
: this(double.MaxValue, double.MaxValue, double.MinValue, double.MinValue)
{
}
// Token: 0x06000168 RID: 360 RVA: 0x00017C99 File Offset: 0x00015E99
public BoundingBox(BoundingBox other)
: this(other.MinX, other.MinY, other.MaxX, other.MaxY)
{
}
// Token: 0x06000169 RID: 361 RVA: 0x00017CB9 File Offset: 0x00015EB9
public BoundingBox(double xmin, double ymin, double xmax, double ymax)
{
this.xmin = xmin;
this.xmax = xmax;
this.ymin = ymin;
this.ymax = ymax;
}
// Token: 0x17000062 RID: 98
// (get) Token: 0x0600016A RID: 362 RVA: 0x00017CDE File Offset: 0x00015EDE
public double MinX
{
get
{
return this.xmin;
}
}
// Token: 0x17000063 RID: 99
// (get) Token: 0x0600016B RID: 363 RVA: 0x00017CE6 File Offset: 0x00015EE6
public double MaxX
{
get
{
return this.xmax;
}
}
// Token: 0x17000064 RID: 100
// (get) Token: 0x0600016C RID: 364 RVA: 0x00017CEE File Offset: 0x00015EEE
public double MinY
{
get
{
return this.ymin;
}
}
// Token: 0x17000065 RID: 101
// (get) Token: 0x0600016D RID: 365 RVA: 0x00017CF6 File Offset: 0x00015EF6
public double MaxY
{
get
{
return this.ymax;
}
}
// Token: 0x17000066 RID: 102
// (get) Token: 0x0600016E RID: 366 RVA: 0x00017CFE File Offset: 0x00015EFE
public double Width
{
get
{
return this.xmax - this.xmin;
}
}
// Token: 0x17000067 RID: 103
// (get) Token: 0x0600016F RID: 367 RVA: 0x00017D0D File Offset: 0x00015F0D
public double Height
{
get
{
return this.ymax - this.ymin;
}
}
// Token: 0x06000170 RID: 368 RVA: 0x00017D1C File Offset: 0x00015F1C
public void Resize(double dx, double dy)
{
this.xmin -= dx;
this.xmax += dx;
this.ymin -= dy;
this.ymax += dy;
}
// Token: 0x06000171 RID: 369 RVA: 0x00017D58 File Offset: 0x00015F58
public void Expand(double x, double y)
{
this.xmin = Math.Min(this.xmin, x);
this.ymin = Math.Min(this.ymin, y);
this.xmax = Math.Max(this.xmax, x);
this.ymax = Math.Max(this.ymax, y);
}
// Token: 0x06000172 RID: 370 RVA: 0x00017DB0 File Offset: 0x00015FB0
public void Expand(BoundingBox other)
{
this.xmin = Math.Min(this.xmin, other.xmin);
this.ymin = Math.Min(this.ymin, other.ymin);
this.xmax = Math.Max(this.xmax, other.xmax);
this.ymax = Math.Max(this.ymax, other.ymax);
}
// Token: 0x06000173 RID: 371 RVA: 0x00017E19 File Offset: 0x00016019
public bool Contains(Point pt)
{
return pt.x >= this.xmin && pt.x <= this.xmax && pt.y >= this.ymin && pt.y <= this.ymax;
}
// Token: 0x06000174 RID: 372 RVA: 0x00017E58 File Offset: 0x00016058
public bool Contains(BoundingBox other)
{
return this.xmin <= other.MinX && other.MaxX <= this.xmax && this.ymin <= other.MinY && other.MaxY <= this.ymax;
}
// Token: 0x06000175 RID: 373 RVA: 0x00017E97 File Offset: 0x00016097
public bool Intersects(BoundingBox other)
{
return other.MinX < this.xmax && this.xmin < other.MaxX && other.MinY < this.ymax && this.ymin < other.MaxY;
}
// Token: 0x040000EE RID: 238
private double xmin;
// Token: 0x040000EF RID: 239
private double ymin;
// Token: 0x040000F0 RID: 240
private double xmax;
// Token: 0x040000F1 RID: 241
private double ymax;
}
}
+37
View File
@@ -0,0 +1,37 @@
using System;
namespace TriangleNet.Geometry
{
// Token: 0x0200002D RID: 45
public class Edge
{
// Token: 0x17000068 RID: 104
// (get) Token: 0x06000176 RID: 374 RVA: 0x00017ED3 File Offset: 0x000160D3
// (set) Token: 0x06000177 RID: 375 RVA: 0x00017EDB File Offset: 0x000160DB
public int P0 { get; private set; }
// Token: 0x17000069 RID: 105
// (get) Token: 0x06000178 RID: 376 RVA: 0x00017EE4 File Offset: 0x000160E4
// (set) Token: 0x06000179 RID: 377 RVA: 0x00017EEC File Offset: 0x000160EC
public int P1 { get; private set; }
// Token: 0x1700006A RID: 106
// (get) Token: 0x0600017A RID: 378 RVA: 0x00017EF5 File Offset: 0x000160F5
// (set) Token: 0x0600017B RID: 379 RVA: 0x00017EFD File Offset: 0x000160FD
public int Boundary { get; private set; }
// Token: 0x0600017C RID: 380 RVA: 0x00017F06 File Offset: 0x00016106
public Edge(int p0, int p1)
: this(p0, p1, 0)
{
}
// Token: 0x0600017D RID: 381 RVA: 0x00017F11 File Offset: 0x00016111
public Edge(int p0, int p1, int boundary)
{
this.P0 = p0;
this.P1 = p1;
this.Boundary = boundary;
}
}
}
+105
View File
@@ -0,0 +1,105 @@
using System;
using System.Collections;
using System.Collections.Generic;
using TriangleNet.Data;
namespace TriangleNet.Geometry
{
// Token: 0x0200002E RID: 46
public class EdgeEnumerator : IEnumerator<Edge>, IDisposable, IEnumerator
{
// Token: 0x0600017E RID: 382 RVA: 0x00017F30 File Offset: 0x00016130
public EdgeEnumerator(Mesh mesh)
{
this.triangles = mesh.triangles.Values.GetEnumerator();
this.triangles.MoveNext();
this.tri.triangle = this.triangles.Current;
this.tri.orient = 0;
}
// Token: 0x1700006B RID: 107
// (get) Token: 0x0600017F RID: 383 RVA: 0x00017F8C File Offset: 0x0001618C
public Edge Current
{
get
{
return this.current;
}
}
// Token: 0x06000180 RID: 384 RVA: 0x00017F94 File Offset: 0x00016194
public void Dispose()
{
this.triangles.Dispose();
}
// Token: 0x1700006C RID: 108
// (get) Token: 0x06000181 RID: 385 RVA: 0x00017F8C File Offset: 0x0001618C
object IEnumerator.Current
{
get
{
return this.current;
}
}
// Token: 0x06000182 RID: 386 RVA: 0x00017FA4 File Offset: 0x000161A4
public bool MoveNext()
{
if (this.tri.triangle == null)
{
return false;
}
this.current = null;
while (this.current == null)
{
if (this.tri.orient == 3)
{
if (!this.triangles.MoveNext())
{
return false;
}
this.tri.triangle = this.triangles.Current;
this.tri.orient = 0;
}
this.tri.Sym(ref this.neighbor);
if (this.tri.triangle.id < this.neighbor.triangle.id || this.neighbor.triangle == Mesh.dummytri)
{
this.p1 = this.tri.Org();
this.p2 = this.tri.Dest();
this.tri.SegPivot(ref this.sub);
this.current = new Edge(this.p1.id, this.p2.id, this.sub.seg.boundary);
}
this.tri.orient = this.tri.orient + 1;
}
return true;
}
// Token: 0x06000183 RID: 387 RVA: 0x000180D2 File Offset: 0x000162D2
public void Reset()
{
this.triangles.Reset();
}
// Token: 0x040000F5 RID: 245
private IEnumerator<Triangle> triangles;
// Token: 0x040000F6 RID: 246
private Otri tri;
// Token: 0x040000F7 RID: 247
private Otri neighbor;
// Token: 0x040000F8 RID: 248
private Osub sub;
// Token: 0x040000F9 RID: 249
private Edge current;
// Token: 0x040000FA RID: 250
private Vertex p1;
// Token: 0x040000FB RID: 251
private Vertex p2;
}
}
+27
View File
@@ -0,0 +1,27 @@
using System;
using TriangleNet.Data;
namespace TriangleNet.Geometry
{
// Token: 0x02000033 RID: 51
public interface ISegment
{
// Token: 0x17000083 RID: 131
// (get) Token: 0x060001B5 RID: 437
int P0 { get; }
// Token: 0x17000084 RID: 132
// (get) Token: 0x060001B6 RID: 438
int P1 { get; }
// Token: 0x17000085 RID: 133
// (get) Token: 0x060001B7 RID: 439
int Boundary { get; }
// Token: 0x060001B8 RID: 440
Vertex GetVertex(int index);
// Token: 0x060001B9 RID: 441
ITriangle GetTriangle(int index);
}
}
+59
View File
@@ -0,0 +1,59 @@
using System;
using TriangleNet.Data;
namespace TriangleNet.Geometry
{
// Token: 0x02000030 RID: 48
public interface ITriangle
{
// Token: 0x17000074 RID: 116
// (get) Token: 0x06000197 RID: 407
int ID { get; }
// Token: 0x17000075 RID: 117
// (get) Token: 0x06000198 RID: 408
int P0 { get; }
// Token: 0x17000076 RID: 118
// (get) Token: 0x06000199 RID: 409
int P1 { get; }
// Token: 0x17000077 RID: 119
// (get) Token: 0x0600019A RID: 410
int P2 { get; }
// Token: 0x0600019B RID: 411
Vertex GetVertex(int index);
// Token: 0x17000078 RID: 120
// (get) Token: 0x0600019C RID: 412
bool SupportsNeighbors { get; }
// Token: 0x17000079 RID: 121
// (get) Token: 0x0600019D RID: 413
int N0 { get; }
// Token: 0x1700007A RID: 122
// (get) Token: 0x0600019E RID: 414
int N1 { get; }
// Token: 0x1700007B RID: 123
// (get) Token: 0x0600019F RID: 415
int N2 { get; }
// Token: 0x060001A0 RID: 416
ITriangle GetNeighbor(int index);
// Token: 0x060001A1 RID: 417
ISegment GetSegment(int index);
// Token: 0x1700007C RID: 124
// (get) Token: 0x060001A2 RID: 418
// (set) Token: 0x060001A3 RID: 419
double Area { get; set; }
// Token: 0x1700007D RID: 125
// (get) Token: 0x060001A4 RID: 420
int Region { get; }
}
}
+221
View File
@@ -0,0 +1,221 @@
using System;
using System.Collections.Generic;
using System.Linq;
using TriangleNet.Data;
namespace TriangleNet.Geometry
{
// Token: 0x0200002F RID: 47
public class InputGeometry
{
// Token: 0x06000184 RID: 388 RVA: 0x000180DF File Offset: 0x000162DF
public InputGeometry()
: this(3)
{
}
// Token: 0x06000185 RID: 389 RVA: 0x000180E8 File Offset: 0x000162E8
public InputGeometry(int capacity)
{
this.points = new List<Vertex>(capacity);
this.segments = new List<Edge>();
this.holes = new List<Point>();
this.regions = new List<RegionPointer>();
this.bounds = new BoundingBox();
this.pointAttributes = -1;
}
// Token: 0x1700006D RID: 109
// (get) Token: 0x06000186 RID: 390 RVA: 0x00018141 File Offset: 0x00016341
public BoundingBox Bounds
{
get
{
return this.bounds;
}
}
// Token: 0x1700006E RID: 110
// (get) Token: 0x06000187 RID: 391 RVA: 0x00018149 File Offset: 0x00016349
public bool HasSegments
{
get
{
return this.segments.Count > 0;
}
}
// Token: 0x1700006F RID: 111
// (get) Token: 0x06000188 RID: 392 RVA: 0x00018159 File Offset: 0x00016359
public int Count
{
get
{
return this.points.Count;
}
}
// Token: 0x17000070 RID: 112
// (get) Token: 0x06000189 RID: 393 RVA: 0x00018166 File Offset: 0x00016366
public IEnumerable<Point> Points
{
get
{
return this.points.Select((Vertex v) => v);
}
}
// Token: 0x17000071 RID: 113
// (get) Token: 0x0600018A RID: 394 RVA: 0x00018192 File Offset: 0x00016392
public ICollection<Edge> Segments
{
get
{
return this.segments;
}
}
// Token: 0x17000072 RID: 114
// (get) Token: 0x0600018B RID: 395 RVA: 0x0001819A File Offset: 0x0001639A
public ICollection<Point> Holes
{
get
{
return this.holes;
}
}
// Token: 0x17000073 RID: 115
// (get) Token: 0x0600018C RID: 396 RVA: 0x000181A2 File Offset: 0x000163A2
public ICollection<RegionPointer> Regions
{
get
{
return this.regions;
}
}
// Token: 0x0600018D RID: 397 RVA: 0x000181AA File Offset: 0x000163AA
public void Clear()
{
this.points.Clear();
this.segments.Clear();
this.holes.Clear();
this.regions.Clear();
this.pointAttributes = -1;
}
// Token: 0x0600018E RID: 398 RVA: 0x000181DF File Offset: 0x000163DF
public void AddPoint(double x, double y)
{
this.AddPoint(x, y, 0);
}
// Token: 0x0600018F RID: 399 RVA: 0x000181EA File Offset: 0x000163EA
public void AddPoint(double x, double y, int boundary)
{
this.points.Add(new Vertex(x, y, boundary));
this.bounds.Expand(x, y);
}
// Token: 0x06000190 RID: 400 RVA: 0x0001820C File Offset: 0x0001640C
public void AddPoint(double x, double y, int boundary, double attribute)
{
this.AddPoint(x, y, 0, new double[] { attribute });
}
// Token: 0x06000191 RID: 401 RVA: 0x00018224 File Offset: 0x00016424
public void AddPoint(double x, double y, int boundary, double[] attribs)
{
if (this.pointAttributes < 0)
{
this.pointAttributes = ((attribs == null) ? 0 : attribs.Length);
}
else
{
if (attribs == null && this.pointAttributes > 0)
{
throw new ArgumentException("Inconsitent use of point attributes.");
}
if (attribs != null && this.pointAttributes != attribs.Length)
{
throw new ArgumentException("Inconsitent use of point attributes.");
}
}
this.points.Add(new Vertex(x, y, boundary)
{
attributes = attribs
});
this.bounds.Expand(x, y);
}
// Token: 0x06000192 RID: 402 RVA: 0x000182A8 File Offset: 0x000164A8
public void AddPoint(Vertex v)
{
double[] attributes = v.attributes;
if (this.pointAttributes < 0)
{
this.pointAttributes = ((attributes == null) ? 0 : attributes.Length);
}
else
{
if (attributes == null && this.pointAttributes > 0)
{
throw new ArgumentException("Inconsitent use of point attributes.");
}
if (attributes != null && this.pointAttributes != attributes.Length)
{
throw new ArgumentException("Inconsitent use of point attributes.");
}
}
this.points.Add(v);
this.bounds.Expand(v.x, v.y);
}
// Token: 0x06000193 RID: 403 RVA: 0x00018329 File Offset: 0x00016529
public void AddHole(double x, double y)
{
this.holes.Add(new Point(x, y));
}
// Token: 0x06000194 RID: 404 RVA: 0x0001833D File Offset: 0x0001653D
public void AddRegion(double x, double y, int id)
{
this.regions.Add(new RegionPointer(x, y, id));
}
// Token: 0x06000195 RID: 405 RVA: 0x00018352 File Offset: 0x00016552
public void AddSegment(int p0, int p1)
{
this.AddSegment(p0, p1, 0);
}
// Token: 0x06000196 RID: 406 RVA: 0x0001835D File Offset: 0x0001655D
public void AddSegment(int p0, int p1, int boundary)
{
if (p0 == p1 || p0 < 0 || p1 < 0)
{
throw new NotSupportedException("Invalid endpoints.");
}
this.segments.Add(new Edge(p0, p1, boundary));
}
// Token: 0x040000FC RID: 252
internal List<Vertex> points;
// Token: 0x040000FD RID: 253
internal List<Edge> segments;
// Token: 0x040000FE RID: 254
internal List<Point> holes;
// Token: 0x040000FF RID: 255
internal List<RegionPointer> regions;
// Token: 0x04000100 RID: 256
private BoundingBox bounds;
// Token: 0x04000101 RID: 257
private int pointAttributes = -1;
}
}
+148
View File
@@ -0,0 +1,148 @@
using System;
namespace TriangleNet.Geometry
{
// Token: 0x02000031 RID: 49
public class Point : IComparable<Point>, IEquatable<Point>
{
// Token: 0x060001A5 RID: 421 RVA: 0x00018389 File Offset: 0x00016589
public Point()
: this(0.0, 0.0, 0)
{
}
// Token: 0x060001A6 RID: 422 RVA: 0x000183A4 File Offset: 0x000165A4
public Point(double x, double y)
: this(x, y, 0)
{
}
// Token: 0x060001A7 RID: 423 RVA: 0x000183AF File Offset: 0x000165AF
public Point(double x, double y, int mark)
{
this.x = x;
this.y = y;
this.mark = mark;
}
// Token: 0x1700007E RID: 126
// (get) Token: 0x060001A8 RID: 424 RVA: 0x000183CC File Offset: 0x000165CC
public int ID
{
get
{
return this.id;
}
}
// Token: 0x1700007F RID: 127
// (get) Token: 0x060001A9 RID: 425 RVA: 0x000183D4 File Offset: 0x000165D4
public double X
{
get
{
return this.x;
}
}
// Token: 0x17000080 RID: 128
// (get) Token: 0x060001AA RID: 426 RVA: 0x000183DC File Offset: 0x000165DC
public double Y
{
get
{
return this.y;
}
}
// Token: 0x17000081 RID: 129
// (get) Token: 0x060001AB RID: 427 RVA: 0x000183E4 File Offset: 0x000165E4
public int Boundary
{
get
{
return this.mark;
}
}
// Token: 0x17000082 RID: 130
// (get) Token: 0x060001AC RID: 428 RVA: 0x000183EC File Offset: 0x000165EC
public double[] Attributes
{
get
{
return this.attributes;
}
}
// Token: 0x060001AD RID: 429 RVA: 0x000183F4 File Offset: 0x000165F4
public static bool operator ==(Point a, Point b)
{
return a == b || (a != null && b != null && a.Equals(b));
}
// Token: 0x060001AE RID: 430 RVA: 0x0001840B File Offset: 0x0001660B
public static bool operator !=(Point a, Point b)
{
return !(a == b);
}
// Token: 0x060001AF RID: 431 RVA: 0x00018418 File Offset: 0x00016618
public override bool Equals(object obj)
{
if (obj == null)
{
return false;
}
Point point = obj as Point;
return point != null && this.x == point.x && this.y == point.y;
}
// Token: 0x060001B0 RID: 432 RVA: 0x00018454 File Offset: 0x00016654
public bool Equals(Point p)
{
return p != null && this.x == p.x && this.y == p.y;
}
// Token: 0x060001B1 RID: 433 RVA: 0x0001847C File Offset: 0x0001667C
public int CompareTo(Point other)
{
if (this.x == other.x && this.y == other.y)
{
return 0;
}
if (this.x >= other.x && (this.x != other.x || this.y >= other.y))
{
return 1;
}
return -1;
}
// Token: 0x060001B2 RID: 434 RVA: 0x000184D4 File Offset: 0x000166D4
public override int GetHashCode()
{
return this.x.GetHashCode() ^ this.y.GetHashCode();
}
// Token: 0x060001B3 RID: 435 RVA: 0x000184ED File Offset: 0x000166ED
public override string ToString()
{
return string.Format("[{0},{1}]", this.x, this.y);
}
// Token: 0x04000102 RID: 258
internal int id;
// Token: 0x04000103 RID: 259
internal double x;
// Token: 0x04000104 RID: 260
internal double y;
// Token: 0x04000105 RID: 261
internal int mark;
// Token: 0x04000106 RID: 262
internal double[] attributes;
}
}
+21
View File
@@ -0,0 +1,21 @@
using System;
namespace TriangleNet.Geometry
{
// Token: 0x02000032 RID: 50
public class RegionPointer
{
// Token: 0x060001B4 RID: 436 RVA: 0x0001850F File Offset: 0x0001670F
public RegionPointer(double x, double y, int id)
{
this.point = new Point(x, y);
this.id = id;
}
// Token: 0x04000107 RID: 263
internal Point point;
// Token: 0x04000108 RID: 264
internal int id;
}
}
+192
View File
@@ -0,0 +1,192 @@
using System;
using System.Collections.Generic;
using TriangleNet.Data;
using TriangleNet.Geometry;
using TriangleNet.Log;
namespace TriangleNet.IO
{
// Token: 0x02000024 RID: 36
internal static class DataReader
{
// Token: 0x06000128 RID: 296 RVA: 0x00015400 File Offset: 0x00013600
public static int Reconstruct(Mesh mesh, InputGeometry input, ITriangle[] triangles)
{
int num = 0;
Otri otri = default(Otri);
Otri otri2 = default(Otri);
Otri otri3 = default(Otri);
Otri otri4 = default(Otri);
Otri otri5 = default(Otri);
Osub osub = default(Osub);
int[] array = new int[3];
int[] array2 = new int[2];
int num2 = ((triangles == null) ? 0 : triangles.Length);
int count = input.segments.Count;
mesh.inelements = num2;
mesh.regions.AddRange(input.regions);
int i;
for (i = 0; i < mesh.inelements; i++)
{
mesh.MakeTriangle(ref otri);
}
if (mesh.behavior.Poly)
{
mesh.insegments = count;
for (i = 0; i < mesh.insegments; i++)
{
mesh.MakeSegment(ref osub);
}
}
List<Otri>[] array3 = new List<Otri>[mesh.vertices.Count];
for (i = 0; i < mesh.vertices.Count; i++)
{
Otri otri6 = default(Otri);
otri6.triangle = Mesh.dummytri;
array3[i] = new List<Otri>(3);
array3[i].Add(otri6);
}
i = 0;
foreach (Triangle triangle in mesh.triangles.Values)
{
otri.triangle = triangle;
array[0] = triangles[i].P0;
array[1] = triangles[i].P1;
array[2] = triangles[i].P2;
for (int j = 0; j < 3; j++)
{
if (array[j] < 0 || array[j] >= mesh.invertices)
{
SimpleLog.Instance.Error("Triangle has an invalid vertex index.", "MeshReader.Reconstruct()");
throw new Exception("Triangle has an invalid vertex index.");
}
}
otri.triangle.region = triangles[i].Region;
if (mesh.behavior.VarArea)
{
otri.triangle.area = triangles[i].Area;
}
otri.orient = 0;
otri.SetOrg(mesh.vertices[array[0]]);
otri.SetDest(mesh.vertices[array[1]]);
otri.SetApex(mesh.vertices[array[2]]);
otri.orient = 0;
while (otri.orient < 3)
{
int num3 = array[otri.orient];
int num4 = array3[num3].Count - 1;
Otri otri7 = array3[num3][num4];
array3[num3].Add(otri);
otri3 = otri7;
if (otri3.triangle != Mesh.dummytri)
{
Vertex vertex = otri.Dest();
Vertex vertex2 = otri.Apex();
do
{
Vertex vertex3 = otri3.Dest();
Vertex vertex4 = otri3.Apex();
if (vertex2 == vertex3)
{
otri.Lprev(ref otri2);
otri2.Bond(ref otri3);
}
if (vertex == vertex4)
{
otri3.Lprev(ref otri4);
otri.Bond(ref otri4);
}
num4--;
otri7 = array3[num3][num4];
otri3 = otri7;
}
while (otri3.triangle != Mesh.dummytri);
}
otri.orient++;
}
i++;
}
num = 0;
if (mesh.behavior.Poly)
{
i = 0;
foreach (Segment segment in mesh.subsegs.Values)
{
osub.seg = segment;
array2[0] = input.segments[i].P0;
array2[1] = input.segments[i].P1;
int boundary = input.segments[i].Boundary;
for (int k = 0; k < 2; k++)
{
if (array2[k] < 0 || array2[k] >= mesh.invertices)
{
SimpleLog.Instance.Error("Segment has an invalid vertex index.", "MeshReader.Reconstruct()");
throw new Exception("Segment has an invalid vertex index.");
}
}
osub.orient = 0;
Vertex vertex5 = mesh.vertices[array2[0]];
Vertex vertex6 = mesh.vertices[array2[1]];
osub.SetOrg(vertex5);
osub.SetDest(vertex6);
osub.SetSegOrg(vertex5);
osub.SetSegDest(vertex6);
osub.seg.boundary = boundary;
osub.orient = 0;
while (osub.orient < 2)
{
int num3 = array2[1 - osub.orient];
int num5 = array3[num3].Count - 1;
Otri otri8 = array3[num3][num5];
Otri otri7 = array3[num3][num5];
otri3 = otri7;
Vertex vertex7 = osub.Org();
bool flag = true;
while (flag && otri3.triangle != Mesh.dummytri)
{
Vertex vertex3 = otri3.Dest();
if (vertex7 == vertex3)
{
array3[num3].Remove(otri8);
otri3.SegBond(ref osub);
otri3.Sym(ref otri5);
if (otri5.triangle == Mesh.dummytri)
{
mesh.InsertSubseg(ref otri3, 1);
num++;
}
flag = false;
}
num5--;
otri8 = array3[num3][num5];
otri7 = array3[num3][num5];
otri3 = otri7;
}
osub.orient++;
}
i++;
}
}
for (i = 0; i < mesh.vertices.Count; i++)
{
int num6 = array3[i].Count - 1;
Otri otri7 = array3[i][num6];
otri3 = otri7;
while (otri3.triangle != Mesh.dummytri)
{
num6--;
otri7 = array3[i][num6];
otri3.SegDissolve();
otri3.Sym(ref otri5);
if (otri5.triangle == Mesh.dummytri)
{
mesh.InsertSubseg(ref otri3, 1);
num++;
}
otri3 = otri7;
}
}
return num;
}
}
}
+240
View File
@@ -0,0 +1,240 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Text;
using TriangleNet.Data;
using TriangleNet.Geometry;
namespace TriangleNet.IO
{
// Token: 0x02000025 RID: 37
internal class DebugWriter
{
// Token: 0x0600012A RID: 298 RVA: 0x00013025 File Offset: 0x00011225
private DebugWriter()
{
}
// Token: 0x17000057 RID: 87
// (get) Token: 0x0600012B RID: 299 RVA: 0x00015A67 File Offset: 0x00013C67
public static DebugWriter Session
{
get
{
return DebugWriter.instance;
}
}
// Token: 0x0600012C RID: 300 RVA: 0x00015A6E File Offset: 0x00013C6E
public void Start(string session)
{
this.iteration = 0;
this.session = session;
if (this.stream != null)
{
throw new Exception("A session is active. Finish before starting a new.");
}
this.tmpFile = Path.GetTempFileName();
this.stream = new StreamWriter(this.tmpFile);
}
// Token: 0x0600012D RID: 301 RVA: 0x00015AAD File Offset: 0x00013CAD
public void Write(Mesh mesh, bool skip)
{
this.WriteMesh(mesh, skip);
this.triangles = mesh.Triangles.Count;
}
// Token: 0x0600012E RID: 302 RVA: 0x00015AC8 File Offset: 0x00013CC8
public void Write(Mesh mesh)
{
this.Write(mesh, false);
}
// Token: 0x0600012F RID: 303 RVA: 0x00015AD2 File Offset: 0x00013CD2
public void Finish()
{
this.Finish(this.session + ".mshx");
}
// Token: 0x06000130 RID: 304 RVA: 0x00015AEC File Offset: 0x00013CEC
private void Finish(string path)
{
if (this.stream != null)
{
this.stream.Flush();
this.stream.Dispose();
this.stream = null;
string text = "#!N" + this.iteration + Environment.NewLine;
using (FileStream fileStream = new FileStream(path, FileMode.Create))
{
using (GZipStream gzipStream = new GZipStream(fileStream, CompressionMode.Compress, false))
{
byte[] array = Encoding.UTF8.GetBytes(text);
gzipStream.Write(array, 0, array.Length);
array = File.ReadAllBytes(this.tmpFile);
gzipStream.Write(array, 0, array.Length);
}
}
File.Delete(this.tmpFile);
}
}
// Token: 0x06000131 RID: 305 RVA: 0x00015BB8 File Offset: 0x00013DB8
private void WriteGeometry(InputGeometry geometry)
{
TextWriter textWriter = this.stream;
string text = "#!G{0}";
int num = this.iteration;
this.iteration = num + 1;
textWriter.WriteLine(text, num);
}
// Token: 0x06000132 RID: 306 RVA: 0x00015BEC File Offset: 0x00013DEC
private void WriteMesh(Mesh mesh, bool skip)
{
if (this.triangles == mesh.triangles.Count && skip)
{
return;
}
TextWriter textWriter = this.stream;
string text = "#!M{0}";
int num = this.iteration;
this.iteration = num + 1;
textWriter.WriteLine(text, num);
if (this.VerticesChanged(mesh))
{
this.HashVertices(mesh);
this.stream.WriteLine("{0}", mesh.vertices.Count);
using (Dictionary<int, Vertex>.ValueCollection.Enumerator enumerator = mesh.vertices.Values.GetEnumerator())
{
while (enumerator.MoveNext())
{
Vertex vertex = enumerator.Current;
this.stream.WriteLine("{0} {1} {2} {3}", new object[]
{
vertex.hash,
vertex.x.ToString(DebugWriter.nfi),
vertex.y.ToString(DebugWriter.nfi),
vertex.mark
});
}
goto IL_116;
}
}
this.stream.WriteLine("0");
IL_116:
this.stream.WriteLine("{0}", mesh.subsegs.Count);
Osub osub = default(Osub);
osub.orient = 0;
foreach (Segment segment in mesh.subsegs.Values)
{
if (segment.hash > 0)
{
osub.seg = segment;
Vertex vertex2 = osub.Org();
Vertex vertex3 = osub.Dest();
this.stream.WriteLine("{0} {1} {2} {3}", new object[]
{
osub.seg.hash,
vertex2.hash,
vertex3.hash,
osub.seg.boundary
});
}
}
Otri otri = default(Otri);
Otri otri2 = default(Otri);
otri.orient = 0;
this.stream.WriteLine("{0}", mesh.triangles.Count);
foreach (Triangle triangle in mesh.triangles.Values)
{
otri.triangle = triangle;
Vertex vertex2 = otri.Org();
Vertex vertex3 = otri.Dest();
Vertex vertex4 = otri.Apex();
int num2 = ((vertex2 == null) ? (-1) : vertex2.hash);
int num3 = ((vertex3 == null) ? (-1) : vertex3.hash);
int num4 = ((vertex4 == null) ? (-1) : vertex4.hash);
this.stream.Write("{0} {1} {2} {3}", new object[]
{
otri.triangle.hash,
num2,
num3,
num4
});
otri.orient = 1;
otri.Sym(ref otri2);
int hash = otri2.triangle.hash;
otri.orient = 2;
otri.Sym(ref otri2);
int hash2 = otri2.triangle.hash;
otri.orient = 0;
otri.Sym(ref otri2);
int hash3 = otri2.triangle.hash;
this.stream.WriteLine(" {0} {1} {2}", hash, hash2, hash3);
}
}
// Token: 0x06000133 RID: 307 RVA: 0x00015FE0 File Offset: 0x000141E0
private bool VerticesChanged(Mesh mesh)
{
if (this.vertices == null || mesh.Vertices.Count != this.vertices.Length)
{
return true;
}
int num = 0;
using (IEnumerator<Vertex> enumerator = mesh.Vertices.GetEnumerator())
{
while (enumerator.MoveNext())
{
if (enumerator.Current.id != this.vertices[num++])
{
return true;
}
}
}
return false;
}
// Token: 0x06000134 RID: 308 RVA: 0x00016060 File Offset: 0x00014260
private void HashVertices(Mesh mesh)
{
if (this.vertices == null || mesh.Vertices.Count != this.vertices.Length)
{
this.vertices = new int[mesh.Vertices.Count];
}
int num = 0;
foreach (Vertex vertex in mesh.Vertices)
{
this.vertices[num++] = vertex.id;
}
}
// Token: 0x040000E0 RID: 224
private static NumberFormatInfo nfi = CultureInfo.InvariantCulture.NumberFormat;
// Token: 0x040000E1 RID: 225
private int iteration;
// Token: 0x040000E2 RID: 226
private string session;
// Token: 0x040000E3 RID: 227
private StreamWriter stream;
// Token: 0x040000E4 RID: 228
private string tmpFile;
// Token: 0x040000E5 RID: 229
private int[] vertices;
// Token: 0x040000E6 RID: 230
private int triangles;
// Token: 0x040000E7 RID: 231
private static readonly DebugWriter instance = new DebugWriter();
}
}
+486
View File
@@ -0,0 +1,486 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using TriangleNet.Geometry;
using TriangleNet.Log;
namespace TriangleNet.IO
{
// Token: 0x0200002A RID: 42
public static class FileReader
{
// Token: 0x06000154 RID: 340 RVA: 0x000171D4 File Offset: 0x000153D4
private static bool TryReadLine(StreamReader reader, out string[] token)
{
token = null;
if (reader.EndOfStream)
{
return false;
}
string text = reader.ReadLine().Trim();
while (string.IsNullOrEmpty(text.Trim()) || text.StartsWith("#"))
{
if (reader.EndOfStream)
{
return false;
}
text = reader.ReadLine().Trim();
}
token = text.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
return true;
}
// Token: 0x06000155 RID: 341 RVA: 0x00017248 File Offset: 0x00015448
private static void ReadVertex(InputGeometry data, int index, string[] line, int attributes, int marks)
{
double num = double.Parse(line[1], FileReader.nfi);
double num2 = double.Parse(line[2], FileReader.nfi);
int num3 = 0;
double[] array = ((attributes == 0) ? null : new double[attributes]);
for (int i = 0; i < attributes; i++)
{
if (line.Length > 3 + i)
{
array[i] = double.Parse(line[3 + i], FileReader.nfi);
}
}
if (marks > 0 && line.Length > 3 + attributes)
{
num3 = int.Parse(line[3 + attributes]);
}
data.AddPoint(num, num2, num3, array);
}
// Token: 0x06000156 RID: 342 RVA: 0x000172D0 File Offset: 0x000154D0
public static void Read(string filename, out InputGeometry geometry)
{
geometry = null;
string text = Path.ChangeExtension(filename, ".poly");
if (File.Exists(text))
{
geometry = FileReader.ReadPolyFile(text);
return;
}
text = Path.ChangeExtension(filename, ".node");
geometry = FileReader.ReadNodeFile(text);
}
// Token: 0x06000157 RID: 343 RVA: 0x00017314 File Offset: 0x00015514
public static void Read(string filename, out InputGeometry geometry, out List<ITriangle> triangles)
{
triangles = null;
FileReader.Read(filename, out geometry);
string text = Path.ChangeExtension(filename, ".ele");
if (File.Exists(text) && geometry != null)
{
triangles = FileReader.ReadEleFile(text);
}
}
// Token: 0x06000158 RID: 344 RVA: 0x0001734C File Offset: 0x0001554C
public static InputGeometry Read(string filename)
{
InputGeometry inputGeometry = null;
FileReader.Read(filename, out inputGeometry);
return inputGeometry;
}
// Token: 0x06000159 RID: 345 RVA: 0x00017364 File Offset: 0x00015564
public static InputGeometry ReadNodeFile(string nodefilename)
{
return FileReader.ReadNodeFile(nodefilename, false);
}
// Token: 0x0600015A RID: 346 RVA: 0x00017370 File Offset: 0x00015570
public static InputGeometry ReadNodeFile(string nodefilename, bool readElements)
{
FileReader.startIndex = 0;
int num = 0;
int num2 = 0;
InputGeometry inputGeometry;
using (StreamReader streamReader = new StreamReader(nodefilename))
{
string[] array;
if (!FileReader.TryReadLine(streamReader, out array))
{
throw new Exception("Can't read input file.");
}
int num3 = int.Parse(array[0]);
if (num3 < 3)
{
throw new Exception("Input must have at least three input vertices.");
}
if (array.Length > 1 && int.Parse(array[1]) != 2)
{
throw new Exception("Triangle only works with two-dimensional meshes.");
}
if (array.Length > 2)
{
num = int.Parse(array[2]);
}
if (array.Length > 3)
{
num2 = int.Parse(array[3]);
}
inputGeometry = new InputGeometry(num3);
if (num3 > 0)
{
for (int i = 0; i < num3; i++)
{
if (!FileReader.TryReadLine(streamReader, out array))
{
throw new Exception("Can't read input file (vertices).");
}
if (array.Length < 3)
{
throw new Exception("Invalid vertex.");
}
if (i == 0)
{
FileReader.startIndex = int.Parse(array[0], FileReader.nfi);
}
FileReader.ReadVertex(inputGeometry, i, array, num, num2);
}
}
}
if (readElements)
{
string text = Path.ChangeExtension(nodefilename, ".ele");
if (File.Exists(text))
{
FileReader.ReadEleFile(text, true);
}
}
return inputGeometry;
}
// Token: 0x0600015B RID: 347 RVA: 0x000174A0 File Offset: 0x000156A0
public static InputGeometry ReadPolyFile(string polyfilename)
{
return FileReader.ReadPolyFile(polyfilename, false, false);
}
// Token: 0x0600015C RID: 348 RVA: 0x000174AA File Offset: 0x000156AA
public static InputGeometry ReadPolyFile(string polyfilename, bool readElements)
{
return FileReader.ReadPolyFile(polyfilename, readElements, false);
}
// Token: 0x0600015D RID: 349 RVA: 0x000174B4 File Offset: 0x000156B4
public static InputGeometry ReadPolyFile(string polyfilename, bool readElements, bool readArea)
{
FileReader.startIndex = 0;
int num = 0;
int num2 = 0;
InputGeometry inputGeometry;
using (StreamReader streamReader = new StreamReader(polyfilename))
{
string[] array;
if (!FileReader.TryReadLine(streamReader, out array))
{
throw new Exception("Can't read input file.");
}
int num3 = int.Parse(array[0]);
if (array.Length > 1 && int.Parse(array[1]) != 2)
{
throw new Exception("Triangle only works with two-dimensional meshes.");
}
if (array.Length > 2)
{
num = int.Parse(array[2]);
}
if (array.Length > 3)
{
num2 = int.Parse(array[3]);
}
if (num3 > 0)
{
inputGeometry = new InputGeometry(num3);
for (int i = 0; i < num3; i++)
{
if (!FileReader.TryReadLine(streamReader, out array))
{
throw new Exception("Can't read input file (vertices).");
}
if (array.Length < 3)
{
throw new Exception("Invalid vertex.");
}
if (i == 0)
{
FileReader.startIndex = int.Parse(array[0], FileReader.nfi);
}
FileReader.ReadVertex(inputGeometry, i, array, num, num2);
}
}
else
{
inputGeometry = FileReader.ReadNodeFile(Path.ChangeExtension(polyfilename, ".node"));
num3 = inputGeometry.Count;
}
if (inputGeometry.Points == null)
{
throw new Exception("No nodes available.");
}
if (!FileReader.TryReadLine(streamReader, out array))
{
throw new Exception("Can't read input file (segments).");
}
int num4 = int.Parse(array[0]);
int num5 = 0;
if (array.Length > 1)
{
num5 = int.Parse(array[1]);
}
for (int j = 0; j < num4; j++)
{
if (!FileReader.TryReadLine(streamReader, out array))
{
throw new Exception("Can't read input file (segments).");
}
if (array.Length < 3)
{
throw new Exception("Segment has no endpoints.");
}
int num6 = int.Parse(array[1]) - FileReader.startIndex;
int num7 = int.Parse(array[2]) - FileReader.startIndex;
int num8 = 0;
if (num5 > 0 && array.Length > 3)
{
num8 = int.Parse(array[3]);
}
if (num6 < 0 || num6 >= num3)
{
if (Behavior.Verbose)
{
SimpleLog.Instance.Warning("Invalid first endpoint of segment.", "MeshReader.ReadPolyfile()");
}
}
else if (num7 < 0 || num7 >= num3)
{
if (Behavior.Verbose)
{
SimpleLog.Instance.Warning("Invalid second endpoint of segment.", "MeshReader.ReadPolyfile()");
}
}
else
{
inputGeometry.AddSegment(num6, num7, num8);
}
}
if (!FileReader.TryReadLine(streamReader, out array))
{
throw new Exception("Can't read input file (holes).");
}
int num9 = int.Parse(array[0]);
if (num9 > 0)
{
for (int k = 0; k < num9; k++)
{
if (!FileReader.TryReadLine(streamReader, out array))
{
throw new Exception("Can't read input file (holes).");
}
if (array.Length < 3)
{
throw new Exception("Invalid hole.");
}
inputGeometry.AddHole(double.Parse(array[1], FileReader.nfi), double.Parse(array[2], FileReader.nfi));
}
}
if (FileReader.TryReadLine(streamReader, out array))
{
int num10 = int.Parse(array[0]);
if (num10 > 0)
{
for (int l = 0; l < num10; l++)
{
if (!FileReader.TryReadLine(streamReader, out array))
{
throw new Exception("Can't read input file (region).");
}
if (array.Length < 4)
{
throw new Exception("Invalid region attributes.");
}
inputGeometry.AddRegion(double.Parse(array[1], FileReader.nfi), double.Parse(array[2], FileReader.nfi), int.Parse(array[3]));
}
}
}
}
if (readElements)
{
string text = Path.ChangeExtension(polyfilename, ".ele");
if (File.Exists(text))
{
FileReader.ReadEleFile(text, readArea);
}
}
return inputGeometry;
}
// Token: 0x0600015E RID: 350 RVA: 0x00017808 File Offset: 0x00015A08
public static List<ITriangle> ReadEleFile(string elefilename)
{
return FileReader.ReadEleFile(elefilename, false);
}
// Token: 0x0600015F RID: 351 RVA: 0x00017814 File Offset: 0x00015A14
private static List<ITriangle> ReadEleFile(string elefilename, bool readArea)
{
int num = 0;
List<ITriangle> list;
using (StreamReader streamReader = new StreamReader(elefilename))
{
bool flag = false;
string[] array;
if (!FileReader.TryReadLine(streamReader, out array))
{
throw new Exception("Can't read input file (elements).");
}
num = int.Parse(array[0]);
int num2 = 0;
if (array.Length > 2)
{
num2 = int.Parse(array[2]);
flag = true;
}
if (num2 > 1)
{
SimpleLog.Instance.Warning("Triangle attributes not supported.", "FileReader.Read");
}
list = new List<ITriangle>(num);
for (int i = 0; i < num; i++)
{
if (!FileReader.TryReadLine(streamReader, out array))
{
throw new Exception("Can't read input file (elements).");
}
if (array.Length < 4)
{
throw new Exception("Triangle has no nodes.");
}
InputTriangle inputTriangle = new InputTriangle(int.Parse(array[1]) - FileReader.startIndex, int.Parse(array[2]) - FileReader.startIndex, int.Parse(array[3]) - FileReader.startIndex);
if (num2 > 0 && flag)
{
int num3 = 0;
flag = int.TryParse(array[4], out num3);
inputTriangle.region = num3;
}
list.Add(inputTriangle);
}
}
if (readArea)
{
string text = Path.ChangeExtension(elefilename, ".area");
if (File.Exists(text))
{
FileReader.ReadAreaFile(text, num);
}
}
return list;
}
// Token: 0x06000160 RID: 352 RVA: 0x00017960 File Offset: 0x00015B60
private static double[] ReadAreaFile(string areafilename, int intriangles)
{
double[] array = null;
using (StreamReader streamReader = new StreamReader(areafilename))
{
string[] array2;
if (!FileReader.TryReadLine(streamReader, out array2))
{
throw new Exception("Can't read input file (area).");
}
if (int.Parse(array2[0]) != intriangles)
{
SimpleLog.Instance.Warning("Number of area constraints doesn't match number of triangles.", "ReadAreaFile()");
return null;
}
array = new double[intriangles];
for (int i = 0; i < intriangles; i++)
{
if (!FileReader.TryReadLine(streamReader, out array2))
{
throw new Exception("Can't read input file (area).");
}
if (array2.Length != 2)
{
throw new Exception("Triangle has no nodes.");
}
array[i] = double.Parse(array2[1], FileReader.nfi);
}
}
return array;
}
// Token: 0x06000161 RID: 353 RVA: 0x00017A1C File Offset: 0x00015C1C
public static List<Edge> ReadEdgeFile(string edgeFile, int invertices)
{
List<Edge> list = null;
FileReader.startIndex = 0;
using (StreamReader streamReader = new StreamReader(edgeFile))
{
string[] array;
if (!FileReader.TryReadLine(streamReader, out array))
{
throw new Exception("Can't read input file (segments).");
}
int num = int.Parse(array[0]);
int num2 = 0;
if (array.Length > 1)
{
num2 = int.Parse(array[1]);
}
if (num > 0)
{
list = new List<Edge>(num);
}
for (int i = 0; i < num; i++)
{
if (!FileReader.TryReadLine(streamReader, out array))
{
throw new Exception("Can't read input file (segments).");
}
if (array.Length < 3)
{
throw new Exception("Segment has no endpoints.");
}
int num3 = int.Parse(array[1]) - FileReader.startIndex;
int num4 = int.Parse(array[2]) - FileReader.startIndex;
int num5 = 0;
if (num2 > 0 && array.Length > 3)
{
num5 = int.Parse(array[3]);
}
if (num3 < 0 || num3 >= invertices)
{
if (Behavior.Verbose)
{
SimpleLog.Instance.Warning("Invalid first endpoint of segment.", "MeshReader.ReadPolyfile()");
}
}
else if (num4 < 0 || num4 >= invertices)
{
if (Behavior.Verbose)
{
SimpleLog.Instance.Warning("Invalid second endpoint of segment.", "MeshReader.ReadPolyfile()");
}
}
else
{
list.Add(new Edge(num3, num4, num5));
}
}
}
return list;
}
// Token: 0x040000EC RID: 236
private static NumberFormatInfo nfi = CultureInfo.InvariantCulture.NumberFormat;
// Token: 0x040000ED RID: 237
private static int startIndex = 0;
}
}
+385
View File
@@ -0,0 +1,385 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using TriangleNet.Data;
using TriangleNet.Geometry;
namespace TriangleNet.IO
{
// Token: 0x02000026 RID: 38
public static class FileWriter
{
// Token: 0x06000135 RID: 309 RVA: 0x000160F0 File Offset: 0x000142F0
public static void Write(Mesh mesh, string filename)
{
FileWriter.WritePoly(mesh, Path.ChangeExtension(filename, ".poly"));
FileWriter.WriteElements(mesh, Path.ChangeExtension(filename, ".ele"));
}
// Token: 0x06000136 RID: 310 RVA: 0x00016114 File Offset: 0x00014314
public static void WriteNodes(Mesh mesh, string filename)
{
using (StreamWriter streamWriter = new StreamWriter(filename))
{
FileWriter.WriteNodes(streamWriter, mesh);
}
}
// Token: 0x06000137 RID: 311 RVA: 0x0001614C File Offset: 0x0001434C
private static void WriteNodes(StreamWriter writer, Mesh mesh)
{
int num = mesh.vertices.Count;
Behavior behavior = mesh.behavior;
if (behavior.Jettison)
{
num = mesh.vertices.Count - mesh.undeads;
}
if (writer != null)
{
writer.WriteLine("{0} {1} {2} {3}", new object[]
{
num,
mesh.mesh_dim,
mesh.nextras,
behavior.UseBoundaryMarkers ? "1" : "0"
});
if (mesh.numbering == NodeNumbering.None)
{
mesh.Renumber();
}
if (mesh.numbering == NodeNumbering.Linear)
{
FileWriter.WriteNodes(writer, mesh.vertices.Values, behavior.UseBoundaryMarkers, mesh.nextras, behavior.Jettison);
return;
}
Vertex[] array = new Vertex[mesh.vertices.Count];
foreach (Vertex vertex in mesh.vertices.Values)
{
array[vertex.id] = vertex;
}
FileWriter.WriteNodes(writer, array, behavior.UseBoundaryMarkers, mesh.nextras, behavior.Jettison);
}
}
// Token: 0x06000138 RID: 312 RVA: 0x00016290 File Offset: 0x00014490
private static void WriteNodes(StreamWriter writer, IEnumerable<Vertex> nodes, bool markers, int attribs, bool jettison)
{
int num = 0;
foreach (Vertex vertex in nodes)
{
if (!jettison || vertex.type != VertexType.UndeadVertex)
{
writer.Write("{0} {1} {2}", num, vertex.x.ToString(FileWriter.nfi), vertex.y.ToString(FileWriter.nfi));
for (int i = 0; i < attribs; i++)
{
writer.Write(" {0}", vertex.attributes[i].ToString(FileWriter.nfi));
}
if (markers)
{
writer.Write(" {0}", vertex.mark);
}
writer.WriteLine();
num++;
}
}
}
// Token: 0x06000139 RID: 313 RVA: 0x0001636C File Offset: 0x0001456C
public static void WriteElements(Mesh mesh, string filename)
{
Otri otri = default(Otri);
bool useRegions = mesh.behavior.useRegions;
int num = 0;
otri.orient = 0;
using (StreamWriter streamWriter = new StreamWriter(filename))
{
streamWriter.WriteLine("{0} 3 {1}", mesh.triangles.Count, useRegions ? 1 : 0);
foreach (Triangle triangle in mesh.triangles.Values)
{
otri.triangle = triangle;
Vertex vertex = otri.Org();
Vertex vertex2 = otri.Dest();
Vertex vertex3 = otri.Apex();
streamWriter.Write("{0} {1} {2} {3}", new object[] { num, vertex.id, vertex2.id, vertex3.id });
if (useRegions)
{
streamWriter.Write(" {0}", otri.triangle.region);
}
streamWriter.WriteLine();
triangle.id = num++;
}
}
}
// Token: 0x0600013A RID: 314 RVA: 0x000164E4 File Offset: 0x000146E4
public static void WritePoly(Mesh mesh, string filename)
{
FileWriter.WritePoly(mesh, filename, true);
}
// Token: 0x0600013B RID: 315 RVA: 0x000164F0 File Offset: 0x000146F0
public static void WritePoly(Mesh mesh, string filename, bool writeNodes)
{
Osub osub = default(Osub);
bool useBoundaryMarkers = mesh.behavior.UseBoundaryMarkers;
using (StreamWriter streamWriter = new StreamWriter(filename))
{
if (writeNodes)
{
FileWriter.WriteNodes(streamWriter, mesh);
}
else
{
streamWriter.WriteLine("0 {0} {1} {2}", mesh.mesh_dim, mesh.nextras, useBoundaryMarkers ? "1" : "0");
}
streamWriter.WriteLine("{0} {1}", mesh.subsegs.Count, useBoundaryMarkers ? "1" : "0");
osub.orient = 0;
int num = 0;
foreach (Segment segment in mesh.subsegs.Values)
{
osub.seg = segment;
Vertex vertex = osub.Org();
Vertex vertex2 = osub.Dest();
if (useBoundaryMarkers)
{
streamWriter.WriteLine("{0} {1} {2} {3}", new object[]
{
num,
vertex.id,
vertex2.id,
osub.seg.boundary
});
}
else
{
streamWriter.WriteLine("{0} {1} {2}", num, vertex.id, vertex2.id);
}
num++;
}
num = 0;
streamWriter.WriteLine("{0}", mesh.holes.Count);
foreach (Point point in mesh.holes)
{
streamWriter.WriteLine("{0} {1} {2}", num++, point.X.ToString(FileWriter.nfi), point.Y.ToString(FileWriter.nfi));
}
if (mesh.regions.Count > 0)
{
num = 0;
streamWriter.WriteLine("{0}", mesh.regions.Count);
foreach (RegionPointer regionPointer in mesh.regions)
{
streamWriter.WriteLine("{0} {1} {2} {3}", new object[]
{
num,
regionPointer.point.X.ToString(FileWriter.nfi),
regionPointer.point.Y.ToString(FileWriter.nfi),
regionPointer.id
});
num++;
}
}
}
}
// Token: 0x0600013C RID: 316 RVA: 0x00016834 File Offset: 0x00014A34
public static void WriteEdges(Mesh mesh, string filename)
{
Otri otri = default(Otri);
Otri otri2 = default(Otri);
Osub osub = default(Osub);
Behavior behavior = mesh.behavior;
using (StreamWriter streamWriter = new StreamWriter(filename))
{
streamWriter.WriteLine("{0} {1}", mesh.edges, behavior.UseBoundaryMarkers ? "1" : "0");
long num = 0L;
foreach (Triangle triangle in mesh.triangles.Values)
{
otri.triangle = triangle;
otri.orient = 0;
while (otri.orient < 3)
{
otri.Sym(ref otri2);
if (otri.triangle.id < otri2.triangle.id || otri2.triangle == Mesh.dummytri)
{
Vertex vertex = otri.Org();
Vertex vertex2 = otri.Dest();
if (behavior.UseBoundaryMarkers)
{
if (behavior.useSegments)
{
otri.SegPivot(ref osub);
if (osub.seg == Mesh.dummysub)
{
streamWriter.WriteLine("{0} {1} {2} {3}", new object[] { num, vertex.id, vertex2.id, 0 });
}
else
{
streamWriter.WriteLine("{0} {1} {2} {3}", new object[]
{
num,
vertex.id,
vertex2.id,
osub.seg.boundary
});
}
}
else
{
streamWriter.WriteLine("{0} {1} {2} {3}", new object[]
{
num,
vertex.id,
vertex2.id,
(otri2.triangle == Mesh.dummytri) ? "1" : "0"
});
}
}
else
{
streamWriter.WriteLine("{0} {1} {2}", num, vertex.id, vertex2.id);
}
num += 1L;
}
otri.orient++;
}
}
}
}
// Token: 0x0600013D RID: 317 RVA: 0x00016AD4 File Offset: 0x00014CD4
public static void WriteNeighbors(Mesh mesh, string filename)
{
Otri otri = default(Otri);
Otri otri2 = default(Otri);
int num = 0;
using (StreamWriter streamWriter = new StreamWriter(filename))
{
streamWriter.WriteLine("{0} 3", mesh.triangles.Count);
Mesh.dummytri.id = -1;
foreach (Triangle triangle in mesh.triangles.Values)
{
otri.triangle = triangle;
otri.orient = 1;
otri.Sym(ref otri2);
int id = otri2.triangle.id;
otri.orient = 2;
otri.Sym(ref otri2);
int id2 = otri2.triangle.id;
otri.orient = 0;
otri.Sym(ref otri2);
int id3 = otri2.triangle.id;
streamWriter.WriteLine("{0} {1} {2} {3}", new object[]
{
num++,
id,
id2,
id3
});
}
}
}
// Token: 0x0600013E RID: 318 RVA: 0x00016C40 File Offset: 0x00014E40
public static void WriteVoronoi(Mesh mesh, string filename)
{
Otri otri = default(Otri);
Otri otri2 = default(Otri);
double num = 0.0;
double num2 = 0.0;
int num3 = 0;
otri.orient = 0;
using (StreamWriter streamWriter = new StreamWriter(filename))
{
streamWriter.WriteLine("{0} 2 {1} 0", mesh.triangles.Count, mesh.nextras);
foreach (Triangle triangle in mesh.triangles.Values)
{
otri.triangle = triangle;
Vertex vertex = otri.Org();
Vertex vertex2 = otri.Dest();
Vertex vertex3 = otri.Apex();
Point point = Primitives.FindCircumcenter(vertex, vertex2, vertex3, ref num, ref num2);
streamWriter.Write("{0} {1} {2}", num3, point.X.ToString(FileWriter.nfi), point.Y.ToString(FileWriter.nfi));
for (int i = 0; i < mesh.nextras; i++)
{
streamWriter.Write(" 0");
}
streamWriter.WriteLine();
otri.triangle.id = num3++;
}
streamWriter.WriteLine("{0} 0", mesh.edges);
num3 = 0;
foreach (Triangle triangle2 in mesh.triangles.Values)
{
otri.triangle = triangle2;
otri.orient = 0;
while (otri.orient < 3)
{
otri.Sym(ref otri2);
if (otri.triangle.id < otri2.triangle.id || otri2.triangle == Mesh.dummytri)
{
int id = otri.triangle.id;
if (otri2.triangle == Mesh.dummytri)
{
Vertex vertex = otri.Org();
Vertex vertex2 = otri.Dest();
streamWriter.WriteLine("{0} {1} -1 {2} {3}", new object[]
{
num3,
id,
(vertex2[1] - vertex[1]).ToString(FileWriter.nfi),
(vertex[0] - vertex2[0]).ToString(FileWriter.nfi)
});
}
else
{
int id2 = otri2.triangle.id;
streamWriter.WriteLine("{0} {1} {2}", num3, id, id2);
}
num3++;
}
otri.orient++;
}
}
}
}
// Token: 0x0600013F RID: 319 RVA: 0x00016F64 File Offset: 0x00015164
public static void WriteOffFile(Mesh mesh, string filename)
{
long num = (long)mesh.vertices.Count;
if (mesh.behavior.Jettison)
{
num = (long)(mesh.vertices.Count - mesh.undeads);
}
int num2 = 0;
using (StreamWriter streamWriter = new StreamWriter(filename))
{
streamWriter.WriteLine("OFF");
streamWriter.WriteLine("{0} {1} {2}", num, mesh.triangles.Count, mesh.edges);
foreach (Vertex vertex in mesh.vertices.Values)
{
Vertex vertex;
if (!mesh.behavior.Jettison || vertex.type != VertexType.UndeadVertex)
{
streamWriter.WriteLine(" {0} {1} 0.0", vertex[0].ToString(FileWriter.nfi), vertex[1].ToString(FileWriter.nfi));
vertex.id = num2++;
}
}
Otri otri;
otri.orient = 0;
foreach (Triangle triangle in mesh.triangles.Values)
{
otri.triangle = triangle;
Vertex vertex = otri.Org();
Vertex vertex2 = otri.Dest();
Vertex vertex3 = otri.Apex();
streamWriter.WriteLine(" 3 {0} {1} {2}", vertex.id, vertex2.id, vertex3.id);
}
}
}
// Token: 0x040000E8 RID: 232
private static NumberFormatInfo nfi = CultureInfo.InvariantCulture.NumberFormat;
}
}
+12
View File
@@ -0,0 +1,12 @@
using System;
using TriangleNet.Geometry;
namespace TriangleNet.IO
{
// Token: 0x02000027 RID: 39
public interface IGeometryFormat
{
// Token: 0x06000141 RID: 321
InputGeometry Read(string filename);
}
}
+14
View File
@@ -0,0 +1,14 @@
using System;
namespace TriangleNet.IO
{
// Token: 0x02000028 RID: 40
public interface IMeshFormat
{
// Token: 0x06000142 RID: 322
Mesh Import(string filename);
// Token: 0x06000143 RID: 323
void Write(Mesh mesh, string filename);
}
}
+153
View File
@@ -0,0 +1,153 @@
using System;
using TriangleNet.Data;
using TriangleNet.Geometry;
namespace TriangleNet.IO
{
// Token: 0x02000029 RID: 41
public class InputTriangle : ITriangle
{
// Token: 0x06000144 RID: 324 RVA: 0x00017169 File Offset: 0x00015369
public InputTriangle(int p0, int p1, int p2)
{
this.vertices = new int[] { p0, p1, p2 };
}
// Token: 0x17000058 RID: 88
// (get) Token: 0x06000145 RID: 325 RVA: 0x00017189 File Offset: 0x00015389
public int ID
{
get
{
return 0;
}
}
// Token: 0x17000059 RID: 89
// (get) Token: 0x06000146 RID: 326 RVA: 0x0001718C File Offset: 0x0001538C
public int P0
{
get
{
return this.vertices[0];
}
}
// Token: 0x1700005A RID: 90
// (get) Token: 0x06000147 RID: 327 RVA: 0x00017196 File Offset: 0x00015396
public int P1
{
get
{
return this.vertices[1];
}
}
// Token: 0x1700005B RID: 91
// (get) Token: 0x06000148 RID: 328 RVA: 0x000171A0 File Offset: 0x000153A0
public int P2
{
get
{
return this.vertices[2];
}
}
// Token: 0x06000149 RID: 329 RVA: 0x000171AA File Offset: 0x000153AA
public Vertex GetVertex(int index)
{
return null;
}
// Token: 0x1700005C RID: 92
// (get) Token: 0x0600014A RID: 330 RVA: 0x00017189 File Offset: 0x00015389
public bool SupportsNeighbors
{
get
{
return false;
}
}
// Token: 0x1700005D RID: 93
// (get) Token: 0x0600014B RID: 331 RVA: 0x000171AD File Offset: 0x000153AD
public int N0
{
get
{
return -1;
}
}
// Token: 0x1700005E RID: 94
// (get) Token: 0x0600014C RID: 332 RVA: 0x000171AD File Offset: 0x000153AD
public int N1
{
get
{
return -1;
}
}
// Token: 0x1700005F RID: 95
// (get) Token: 0x0600014D RID: 333 RVA: 0x000171AD File Offset: 0x000153AD
public int N2
{
get
{
return -1;
}
}
// Token: 0x0600014E RID: 334 RVA: 0x000171AA File Offset: 0x000153AA
public ITriangle GetNeighbor(int index)
{
return null;
}
// Token: 0x0600014F RID: 335 RVA: 0x000171AA File Offset: 0x000153AA
public ISegment GetSegment(int index)
{
return null;
}
// Token: 0x17000060 RID: 96
// (get) Token: 0x06000150 RID: 336 RVA: 0x000171B0 File Offset: 0x000153B0
// (set) Token: 0x06000151 RID: 337 RVA: 0x000171B8 File Offset: 0x000153B8
public double Area
{
get
{
return this.area;
}
set
{
this.area = value;
}
}
// Token: 0x17000061 RID: 97
// (get) Token: 0x06000152 RID: 338 RVA: 0x000171C1 File Offset: 0x000153C1
// (set) Token: 0x06000153 RID: 339 RVA: 0x000171C9 File Offset: 0x000153C9
public int Region
{
get
{
return this.region;
}
set
{
this.region = value;
}
}
// Token: 0x040000E9 RID: 233
internal int[] vertices;
// Token: 0x040000EA RID: 234
internal int region;
// Token: 0x040000EB RID: 235
internal double area;
}
}
+52
View File
@@ -0,0 +1,52 @@
using System;
using System.Collections.Generic;
using System.IO;
using TriangleNet.Geometry;
namespace TriangleNet.IO
{
// Token: 0x0200002B RID: 43
public class TriangleFormat : IGeometryFormat, IMeshFormat
{
// Token: 0x06000163 RID: 355 RVA: 0x00017B88 File Offset: 0x00015D88
public Mesh Import(string filename)
{
string extension = Path.GetExtension(filename);
if (extension == ".node" || extension == ".poly" || extension == ".ele")
{
InputGeometry inputGeometry;
List<ITriangle> list;
FileReader.Read(filename, out inputGeometry, out list);
if (inputGeometry != null && list != null)
{
Mesh mesh = new Mesh();
mesh.Load(inputGeometry, list);
return mesh;
}
}
throw new NotSupportedException("Could not load '" + filename + "' file.");
}
// Token: 0x06000164 RID: 356 RVA: 0x00017BF6 File Offset: 0x00015DF6
public void Write(Mesh mesh, string filename)
{
FileWriter.WritePoly(mesh, Path.ChangeExtension(filename, ".poly"));
FileWriter.WriteElements(mesh, Path.ChangeExtension(filename, ".ele"));
}
// Token: 0x06000165 RID: 357 RVA: 0x00017C1C File Offset: 0x00015E1C
public InputGeometry Read(string filename)
{
string extension = Path.GetExtension(filename);
if (extension == ".node")
{
return FileReader.ReadNodeFile(filename);
}
if (extension == ".poly")
{
return FileReader.ReadPolyFile(filename);
}
throw new NotSupportedException("File format '" + extension + "' not supported.");
}
}
}
+17
View File
@@ -0,0 +1,17 @@
using System;
namespace TriangleNet
{
// Token: 0x0200000A RID: 10
internal enum InsertVertexResult
{
// Token: 0x04000041 RID: 65
Successful,
// Token: 0x04000042 RID: 66
Encroaching,
// Token: 0x04000043 RID: 67
Violating,
// Token: 0x04000044 RID: 68
Duplicate
}
}
+17
View File
@@ -0,0 +1,17 @@
using System;
namespace TriangleNet
{
// Token: 0x02000009 RID: 9
internal enum LocateResult
{
// Token: 0x0400003C RID: 60
InTriangle,
// Token: 0x0400003D RID: 61
OnEdge,
// Token: 0x0400003E RID: 62
OnVertex,
// Token: 0x0400003F RID: 63
Outside
}
}
+32
View File
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
namespace TriangleNet.Log
{
// Token: 0x02000020 RID: 32
public interface ILog<T> where T : ILogItem
{
// Token: 0x0600010D RID: 269
void Add(T item);
// Token: 0x0600010E RID: 270
void Clear();
// Token: 0x0600010F RID: 271
void Info(string message);
// Token: 0x06000110 RID: 272
void Error(string message, string info);
// Token: 0x06000111 RID: 273
void Warning(string message, string info);
// Token: 0x1700004A RID: 74
// (get) Token: 0x06000112 RID: 274
IList<T> Data { get; }
// Token: 0x1700004B RID: 75
// (get) Token: 0x06000113 RID: 275
LogLevel Level { get; }
}
}
+24
View File
@@ -0,0 +1,24 @@
using System;
namespace TriangleNet.Log
{
// Token: 0x02000021 RID: 33
public interface ILogItem
{
// Token: 0x1700004C RID: 76
// (get) Token: 0x06000114 RID: 276
DateTime Time { get; }
// Token: 0x1700004D RID: 77
// (get) Token: 0x06000115 RID: 277
LogLevel Level { get; }
// Token: 0x1700004E RID: 78
// (get) Token: 0x06000116 RID: 278
string Message { get; }
// Token: 0x1700004F RID: 79
// (get) Token: 0x06000117 RID: 279
string Info { get; }
}
}
+15
View File
@@ -0,0 +1,15 @@
using System;
namespace TriangleNet.Log
{
// Token: 0x0200001F RID: 31
public enum LogLevel
{
// Token: 0x040000D6 RID: 214
Info,
// Token: 0x040000D7 RID: 215
Warning,
// Token: 0x040000D8 RID: 216
Error
}
}
+83
View File
@@ -0,0 +1,83 @@
using System;
using System.Collections.Generic;
namespace TriangleNet.Log
{
// Token: 0x02000022 RID: 34
public sealed class SimpleLog : ILog<SimpleLogItem>
{
// Token: 0x06000119 RID: 281 RVA: 0x00015324 File Offset: 0x00013524
private SimpleLog()
{
}
// Token: 0x17000050 RID: 80
// (get) Token: 0x0600011A RID: 282 RVA: 0x00015337 File Offset: 0x00013537
public static ILog<SimpleLogItem> Instance
{
get
{
return SimpleLog.instance;
}
}
// Token: 0x0600011B RID: 283 RVA: 0x0001533E File Offset: 0x0001353E
public void Add(SimpleLogItem item)
{
this.log.Add(item);
}
// Token: 0x0600011C RID: 284 RVA: 0x0001534C File Offset: 0x0001354C
public void Clear()
{
this.log.Clear();
}
// Token: 0x0600011D RID: 285 RVA: 0x00015359 File Offset: 0x00013559
public void Info(string message)
{
this.log.Add(new SimpleLogItem(LogLevel.Info, message));
}
// Token: 0x0600011E RID: 286 RVA: 0x0001536D File Offset: 0x0001356D
public void Warning(string message, string location)
{
this.log.Add(new SimpleLogItem(LogLevel.Warning, message, location));
}
// Token: 0x0600011F RID: 287 RVA: 0x00015382 File Offset: 0x00013582
public void Error(string message, string location)
{
this.log.Add(new SimpleLogItem(LogLevel.Error, message, location));
}
// Token: 0x17000051 RID: 81
// (get) Token: 0x06000120 RID: 288 RVA: 0x00015397 File Offset: 0x00013597
public IList<SimpleLogItem> Data
{
get
{
return this.log;
}
}
// Token: 0x17000052 RID: 82
// (get) Token: 0x06000121 RID: 289 RVA: 0x0001539F File Offset: 0x0001359F
public LogLevel Level
{
get
{
return this.level;
}
}
// Token: 0x040000D9 RID: 217
private List<SimpleLogItem> log = new List<SimpleLogItem>();
// Token: 0x040000DA RID: 218
private LogLevel level;
// Token: 0x040000DB RID: 219
private static readonly SimpleLog instance = new SimpleLog();
}
}
+75
View File
@@ -0,0 +1,75 @@
using System;
namespace TriangleNet.Log
{
// Token: 0x02000023 RID: 35
public class SimpleLogItem : ILogItem
{
// Token: 0x17000053 RID: 83
// (get) Token: 0x06000122 RID: 290 RVA: 0x000153A7 File Offset: 0x000135A7
public DateTime Time
{
get
{
return this.time;
}
}
// Token: 0x17000054 RID: 84
// (get) Token: 0x06000123 RID: 291 RVA: 0x000153AF File Offset: 0x000135AF
public LogLevel Level
{
get
{
return this.level;
}
}
// Token: 0x17000055 RID: 85
// (get) Token: 0x06000124 RID: 292 RVA: 0x000153B7 File Offset: 0x000135B7
public string Message
{
get
{
return this.message;
}
}
// Token: 0x17000056 RID: 86
// (get) Token: 0x06000125 RID: 293 RVA: 0x000153BF File Offset: 0x000135BF
public string Info
{
get
{
return this.info;
}
}
// Token: 0x06000126 RID: 294 RVA: 0x000153C7 File Offset: 0x000135C7
public SimpleLogItem(LogLevel level, string message)
: this(level, message, "")
{
}
// Token: 0x06000127 RID: 295 RVA: 0x000153D6 File Offset: 0x000135D6
public SimpleLogItem(LogLevel level, string message, string info)
{
this.time = DateTime.Now;
this.level = level;
this.message = message;
this.info = info;
}
// Token: 0x040000DC RID: 220
private DateTime time;
// Token: 0x040000DD RID: 221
private LogLevel level;
// Token: 0x040000DE RID: 222
private string message;
// Token: 0x040000DF RID: 223
private string info;
}
}
+1376
View File
@@ -0,0 +1,1376 @@
using System;
using System.Collections.Generic;
using TriangleNet.Algorithm;
using TriangleNet.Data;
using TriangleNet.Geometry;
using TriangleNet.IO;
using TriangleNet.Log;
using TriangleNet.Smoothing;
using TriangleNet.Tools;
namespace TriangleNet
{
// Token: 0x0200000E RID: 14
public class Mesh
{
// Token: 0x17000013 RID: 19
// (get) Token: 0x0600005C RID: 92 RVA: 0x0000B456 File Offset: 0x00009656
public Behavior Behavior
{
get
{
return this.behavior;
}
}
// Token: 0x17000014 RID: 20
// (get) Token: 0x0600005D RID: 93 RVA: 0x0000B45E File Offset: 0x0000965E
public BoundingBox Bounds
{
get
{
return this.bounds;
}
}
// Token: 0x17000015 RID: 21
// (get) Token: 0x0600005E RID: 94 RVA: 0x0000B466 File Offset: 0x00009666
public ICollection<Vertex> Vertices
{
get
{
return this.vertices.Values;
}
}
// Token: 0x17000016 RID: 22
// (get) Token: 0x0600005F RID: 95 RVA: 0x0000B473 File Offset: 0x00009673
public IList<Point> Holes
{
get
{
return this.holes;
}
}
// Token: 0x17000017 RID: 23
// (get) Token: 0x06000060 RID: 96 RVA: 0x0000B47B File Offset: 0x0000967B
public ICollection<Triangle> Triangles
{
get
{
return this.triangles.Values;
}
}
// Token: 0x17000018 RID: 24
// (get) Token: 0x06000061 RID: 97 RVA: 0x0000B488 File Offset: 0x00009688
public ICollection<Segment> Segments
{
get
{
return this.subsegs.Values;
}
}
// Token: 0x17000019 RID: 25
// (get) Token: 0x06000062 RID: 98 RVA: 0x0000B495 File Offset: 0x00009695
public IEnumerable<Edge> Edges
{
get
{
EdgeEnumerator e = new EdgeEnumerator(this);
while (e.MoveNext())
{
Edge edge = e.Current;
yield return edge;
}
yield break;
}
}
// Token: 0x1700001A RID: 26
// (get) Token: 0x06000063 RID: 99 RVA: 0x0000B4A5 File Offset: 0x000096A5
public int NumberOfInputPoints
{
get
{
return this.invertices;
}
}
// Token: 0x1700001B RID: 27
// (get) Token: 0x06000064 RID: 100 RVA: 0x0000B4AD File Offset: 0x000096AD
public int NumberOfEdges
{
get
{
return this.edges;
}
}
// Token: 0x1700001C RID: 28
// (get) Token: 0x06000065 RID: 101 RVA: 0x0000B4B5 File Offset: 0x000096B5
public bool IsPolygon
{
get
{
return this.insegments > 0;
}
}
// Token: 0x1700001D RID: 29
// (get) Token: 0x06000066 RID: 102 RVA: 0x0000B4C0 File Offset: 0x000096C0
public NodeNumbering CurrentNumbering
{
get
{
return this.numbering;
}
}
// Token: 0x06000067 RID: 103 RVA: 0x0000B4C8 File Offset: 0x000096C8
public Mesh()
: this(new Behavior())
{
}
// Token: 0x06000068 RID: 104 RVA: 0x0000B4D8 File Offset: 0x000096D8
public Mesh(Behavior behavior)
{
this.behavior = behavior;
this.logger = SimpleLog.Instance;
this.vertices = new Dictionary<int, Vertex>();
this.triangles = new Dictionary<int, Triangle>();
this.subsegs = new Dictionary<int, Segment>();
this.flipstack = new Stack<Otri>();
this.holes = new List<Point>();
this.regions = new List<RegionPointer>();
this.quality = new QualityMesher(this);
this.locator = new TriangleLocator(this);
Primitives.ExactInit();
if (Mesh.dummytri == null)
{
this.DummyInit();
}
}
// Token: 0x06000069 RID: 105 RVA: 0x0000B56C File Offset: 0x0000976C
public void Load(string filename)
{
InputGeometry inputGeometry;
List<ITriangle> list;
FileReader.Read(filename, out inputGeometry, out list);
if (inputGeometry != null && list != null)
{
this.Load(inputGeometry, list);
}
}
// Token: 0x0600006A RID: 106 RVA: 0x0000B594 File Offset: 0x00009794
public void Load(InputGeometry input, List<ITriangle> triangles)
{
if (input == null || triangles == null)
{
throw new ArgumentException("Invalid input (argument is null).");
}
this.ResetData();
if (input.HasSegments)
{
this.behavior.Poly = true;
this.holes.AddRange(input.Holes);
}
if (!this.behavior.Poly)
{
this.behavior.VarArea = false;
this.behavior.useRegions = false;
}
this.behavior.useRegions = input.Regions.Count > 0;
this.TransferNodes(input);
this.hullsize = DataReader.Reconstruct(this, input, triangles.ToArray());
this.edges = (3 * triangles.Count + this.hullsize) / 2;
}
// Token: 0x0600006B RID: 107 RVA: 0x0000B64C File Offset: 0x0000984C
public void Triangulate(string inputFile)
{
InputGeometry inputGeometry = FileReader.Read(inputFile);
this.Triangulate(inputGeometry);
}
// Token: 0x0600006C RID: 108 RVA: 0x0000B668 File Offset: 0x00009868
public void Triangulate(InputGeometry input)
{
this.ResetData();
this.behavior.Poly = input.HasSegments;
if (!this.behavior.Poly)
{
this.behavior.VarArea = false;
this.behavior.useRegions = false;
}
this.behavior.useRegions = input.Regions.Count > 0;
this.steinerleft = this.behavior.SteinerPoints;
this.TransferNodes(input);
this.hullsize = this.Delaunay();
this.infvertex1 = null;
this.infvertex2 = null;
this.infvertex3 = null;
ConstraintMesher constraintMesher = new ConstraintMesher(this);
if (this.behavior.useSegments)
{
this.checksegments = true;
constraintMesher.FormSkeleton(input);
}
if (this.behavior.Poly && this.triangles.Count > 0)
{
foreach (Point point in input.holes)
{
this.holes.Add(point);
}
foreach (RegionPointer regionPointer in input.regions)
{
this.regions.Add(regionPointer);
}
constraintMesher.CarveHoles();
}
else
{
this.holes.Clear();
this.regions.Clear();
}
if ((this.behavior.Quality || this.behavior.ConformingDelaunay) && this.triangles.Count > 0)
{
this.quality.EnforceQuality();
}
this.edges = (3 * this.triangles.Count + this.hullsize) / 2;
}
// Token: 0x0600006D RID: 109 RVA: 0x0000B848 File Offset: 0x00009A48
public void Refine(bool halfArea)
{
if (halfArea)
{
double num = 0.0;
foreach (Triangle triangle in this.triangles.Values)
{
double num2 = (triangle.vertices[2].x - triangle.vertices[0].x) * (triangle.vertices[1].y - triangle.vertices[0].y) - (triangle.vertices[1].x - triangle.vertices[0].x) * (triangle.vertices[2].y - triangle.vertices[0].y);
num2 = Math.Abs(num2) / 2.0;
if (num2 > num)
{
num = num2;
}
}
this.Refine(num / 2.0);
return;
}
this.Refine();
}
// Token: 0x0600006E RID: 110 RVA: 0x0000B950 File Offset: 0x00009B50
public void Refine(double areaConstraint)
{
this.behavior.fixedArea = true;
this.behavior.MaxArea = areaConstraint;
this.Refine();
this.behavior.fixedArea = false;
this.behavior.MaxArea = -1.0;
}
// Token: 0x0600006F RID: 111 RVA: 0x0000B990 File Offset: 0x00009B90
public void Refine()
{
this.inelements = this.triangles.Count;
this.invertices = this.vertices.Count;
if (this.behavior.Poly)
{
if (this.behavior.useSegments)
{
this.insegments = this.subsegs.Count;
}
else
{
this.insegments = this.hullsize;
}
}
this.Reset();
this.steinerleft = this.behavior.SteinerPoints;
this.infvertex1 = null;
this.infvertex2 = null;
this.infvertex3 = null;
if (this.behavior.useSegments)
{
this.checksegments = true;
}
if (this.triangles.Count > 0)
{
this.quality.EnforceQuality();
}
this.edges = (3 * this.triangles.Count + this.hullsize) / 2;
}
// Token: 0x06000070 RID: 112 RVA: 0x0000BA6D File Offset: 0x00009C6D
public void Smooth()
{
this.numbering = NodeNumbering.None;
((ISmoother)new SimpleSmoother(this)).Smooth();
}
// Token: 0x06000071 RID: 113 RVA: 0x0000BA81 File Offset: 0x00009C81
public void Renumber()
{
this.Renumber(NodeNumbering.Linear);
}
// Token: 0x06000072 RID: 114 RVA: 0x0000BA8C File Offset: 0x00009C8C
public void Renumber(NodeNumbering num)
{
if (num == this.numbering)
{
return;
}
int num2;
if (num == NodeNumbering.Linear)
{
num2 = 0;
using (Dictionary<int, Vertex>.ValueCollection.Enumerator enumerator = this.vertices.Values.GetEnumerator())
{
while (enumerator.MoveNext())
{
Vertex vertex = enumerator.Current;
vertex.id = num2++;
}
goto IL_9F;
}
}
if (num == NodeNumbering.CuthillMcKee)
{
int[] array = new CuthillMcKee().Renumber(this);
foreach (Vertex vertex2 in this.vertices.Values)
{
vertex2.id = array[vertex2.id];
}
}
IL_9F:
this.numbering = num;
num2 = 0;
foreach (Triangle triangle in this.triangles.Values)
{
triangle.id = num2++;
}
}
// Token: 0x06000073 RID: 115 RVA: 0x0000BBA8 File Offset: 0x00009DA8
private int Delaunay()
{
int num;
if (this.behavior.Algorithm == TriangulationAlgorithm.Dwyer)
{
num = new Dwyer().Triangulate(this);
}
else if (this.behavior.Algorithm == TriangulationAlgorithm.SweepLine)
{
num = new SweepLine().Triangulate(this);
}
else
{
num = new Incremental().Triangulate(this);
}
if (this.triangles.Count != 0)
{
return num;
}
return 0;
}
// Token: 0x06000074 RID: 116 RVA: 0x0000BC0C File Offset: 0x00009E0C
private void ResetData()
{
this.vertices.Clear();
this.triangles.Clear();
this.subsegs.Clear();
this.holes.Clear();
this.regions.Clear();
this.hash_vtx = 0;
this.hash_seg = 0;
this.hash_tri = 0;
this.flipstack.Clear();
this.hullsize = 0;
this.edges = 0;
this.Reset();
this.locator.Reset();
}
// Token: 0x06000075 RID: 117 RVA: 0x0000BC90 File Offset: 0x00009E90
private void Reset()
{
this.numbering = NodeNumbering.None;
this.undeads = 0;
this.checksegments = false;
this.checkquality = false;
Statistic.InCircleCount = 0L;
Statistic.CounterClockwiseCount = 0L;
Statistic.InCircleAdaptCount = 0L;
Statistic.CounterClockwiseAdaptCount = 0L;
Statistic.Orient3dCount = 0L;
Statistic.HyperbolaCount = 0L;
Statistic.CircleTopCount = 0L;
Statistic.CircumcenterCount = 0L;
}
// Token: 0x06000076 RID: 118 RVA: 0x0000BCF4 File Offset: 0x00009EF4
private void DummyInit()
{
Mesh.dummytri = new Triangle();
Mesh.dummytri.hash = -1;
Mesh.dummytri.id = -1;
Mesh.dummytri.neighbors[0].triangle = Mesh.dummytri;
Mesh.dummytri.neighbors[1].triangle = Mesh.dummytri;
Mesh.dummytri.neighbors[2].triangle = Mesh.dummytri;
if (this.behavior.useSegments)
{
Mesh.dummysub = new Segment();
Mesh.dummysub.hash = -1;
Mesh.dummysub.subsegs[0].seg = Mesh.dummysub;
Mesh.dummysub.subsegs[1].seg = Mesh.dummysub;
Mesh.dummytri.subsegs[0].seg = Mesh.dummysub;
Mesh.dummytri.subsegs[1].seg = Mesh.dummysub;
Mesh.dummytri.subsegs[2].seg = Mesh.dummysub;
}
}
// Token: 0x06000077 RID: 119 RVA: 0x0000BE18 File Offset: 0x0000A018
private void TransferNodes(InputGeometry data)
{
List<Vertex> points = data.points;
this.invertices = points.Count;
this.mesh_dim = 2;
if (this.invertices < 3)
{
this.logger.Error("Input must have at least three input vertices.", "MeshReader.TransferNodes()");
throw new Exception("Input must have at least three input vertices.");
}
this.nextras = ((points[0].attributes == null) ? 0 : points[0].attributes.Length);
foreach (Vertex vertex in points)
{
Vertex vertex2 = vertex;
int num = this.hash_vtx;
this.hash_vtx = num + 1;
vertex2.hash = num;
vertex.id = vertex.hash;
this.vertices.Add(vertex.hash, vertex);
}
this.bounds = data.Bounds;
}
// Token: 0x06000078 RID: 120 RVA: 0x0000BF08 File Offset: 0x0000A108
internal void MakeVertexMap()
{
Otri otri = default(Otri);
foreach (Triangle triangle in this.triangles.Values)
{
otri.triangle = triangle;
otri.orient = 0;
while (otri.orient < 3)
{
otri.Org().tri = otri;
otri.orient++;
}
}
}
// Token: 0x06000079 RID: 121 RVA: 0x0000BF98 File Offset: 0x0000A198
internal void MakeTriangle(ref Otri newotri)
{
Triangle triangle = new Triangle();
Triangle triangle2 = triangle;
int num = this.hash_tri;
this.hash_tri = num + 1;
triangle2.hash = num;
triangle.id = triangle.hash;
newotri.triangle = triangle;
newotri.orient = 0;
this.triangles.Add(triangle.hash, triangle);
}
// Token: 0x0600007A RID: 122 RVA: 0x0000BFF0 File Offset: 0x0000A1F0
internal void MakeSegment(ref Osub newsubseg)
{
Segment segment = new Segment();
Segment segment2 = segment;
int num = this.hash_seg;
this.hash_seg = num + 1;
segment2.hash = num;
newsubseg.seg = segment;
newsubseg.orient = 0;
this.subsegs.Add(segment.hash, segment);
}
// Token: 0x0600007B RID: 123 RVA: 0x0000C03C File Offset: 0x0000A23C
internal InsertVertexResult InsertVertex(Vertex newvertex, ref Otri searchtri, ref Osub splitseg, bool segmentflaws, bool triflaws)
{
Otri otri = default(Otri);
Otri otri2 = default(Otri);
Otri otri3 = default(Otri);
Otri otri4 = default(Otri);
Otri otri5 = default(Otri);
Otri otri6 = default(Otri);
Otri otri7 = default(Otri);
Otri otri8 = default(Otri);
Otri otri9 = default(Otri);
Otri otri10 = default(Otri);
Otri otri11 = default(Otri);
Otri otri12 = default(Otri);
Otri otri13 = default(Otri);
Otri otri14 = default(Otri);
Osub osub = default(Osub);
Osub osub2 = default(Osub);
Osub osub3 = default(Osub);
Osub osub4 = default(Osub);
Osub osub5 = default(Osub);
Osub osub6 = default(Osub);
Osub osub7 = default(Osub);
Osub osub8 = default(Osub);
LocateResult locateResult;
if (splitseg.seg == null)
{
if (searchtri.triangle == Mesh.dummytri)
{
otri.triangle = Mesh.dummytri;
otri.orient = 0;
otri.SymSelf();
locateResult = this.locator.Locate(newvertex, ref otri);
}
else
{
searchtri.Copy(ref otri);
locateResult = this.locator.PreciseLocate(newvertex, ref otri, true);
}
}
else
{
searchtri.Copy(ref otri);
locateResult = LocateResult.OnEdge;
}
if (locateResult == LocateResult.OnVertex)
{
otri.Copy(ref searchtri);
this.locator.Update(ref otri);
return InsertVertexResult.Duplicate;
}
Vertex vertex;
Vertex vertex2;
if (locateResult == LocateResult.OnEdge || locateResult == LocateResult.Outside)
{
if (this.checksegments && splitseg.seg == null)
{
otri.SegPivot(ref osub5);
if (osub5.seg != Mesh.dummysub)
{
if (segmentflaws)
{
bool flag = this.behavior.NoBisect != 2;
if (flag && this.behavior.NoBisect == 1)
{
otri.Sym(ref otri14);
flag = otri14.triangle != Mesh.dummytri;
}
if (flag)
{
BadSubseg badSubseg = new BadSubseg();
badSubseg.encsubseg = osub5;
badSubseg.subsegorg = osub5.Org();
badSubseg.subsegdest = osub5.Dest();
this.quality.AddBadSubseg(badSubseg);
}
}
otri.Copy(ref searchtri);
this.locator.Update(ref otri);
return InsertVertexResult.Violating;
}
}
otri.Lprev(ref otri4);
otri4.Sym(ref otri11);
otri.Sym(ref otri6);
bool flag2 = otri6.triangle != Mesh.dummytri;
if (flag2)
{
otri6.LnextSelf();
otri6.Sym(ref otri13);
this.MakeTriangle(ref otri9);
}
else
{
this.hullsize++;
}
this.MakeTriangle(ref otri8);
vertex = otri.Org();
vertex2 = otri.Dest();
Vertex vertex3 = otri.Apex();
otri8.SetOrg(vertex3);
otri8.SetDest(vertex);
otri8.SetApex(newvertex);
otri.SetOrg(newvertex);
otri8.triangle.region = otri4.triangle.region;
if (this.behavior.VarArea)
{
otri8.triangle.area = otri4.triangle.area;
}
if (flag2)
{
Vertex vertex4 = otri6.Dest();
otri9.SetOrg(vertex);
otri9.SetDest(vertex4);
otri9.SetApex(newvertex);
otri6.SetOrg(newvertex);
otri9.triangle.region = otri6.triangle.region;
if (this.behavior.VarArea)
{
otri9.triangle.area = otri6.triangle.area;
}
}
if (this.checksegments)
{
otri4.SegPivot(ref osub2);
if (osub2.seg != Mesh.dummysub)
{
otri4.SegDissolve();
otri8.SegBond(ref osub2);
}
if (flag2)
{
otri6.SegPivot(ref osub4);
if (osub4.seg != Mesh.dummysub)
{
otri6.SegDissolve();
otri9.SegBond(ref osub4);
}
}
}
otri8.Bond(ref otri11);
otri8.LprevSelf();
otri8.Bond(ref otri4);
otri8.LprevSelf();
if (flag2)
{
otri9.Bond(ref otri13);
otri9.LnextSelf();
otri9.Bond(ref otri6);
otri9.LnextSelf();
otri9.Bond(ref otri8);
}
if (splitseg.seg != null)
{
splitseg.SetDest(newvertex);
Vertex vertex5 = splitseg.SegOrg();
Vertex vertex6 = splitseg.SegDest();
splitseg.SymSelf();
splitseg.Pivot(ref osub7);
this.InsertSubseg(ref otri8, splitseg.seg.boundary);
otri8.SegPivot(ref osub8);
osub8.SetSegOrg(vertex5);
osub8.SetSegDest(vertex6);
splitseg.Bond(ref osub8);
osub8.SymSelf();
osub8.Bond(ref osub7);
splitseg.SymSelf();
if (newvertex.mark == 0)
{
newvertex.mark = splitseg.seg.boundary;
}
}
if (this.checkquality)
{
this.flipstack.Clear();
this.flipstack.Push(default(Otri));
this.flipstack.Push(otri);
}
otri.LnextSelf();
}
else
{
otri.Lnext(ref otri3);
otri.Lprev(ref otri4);
otri3.Sym(ref otri10);
otri4.Sym(ref otri11);
this.MakeTriangle(ref otri7);
this.MakeTriangle(ref otri8);
vertex = otri.Org();
vertex2 = otri.Dest();
Vertex vertex3 = otri.Apex();
otri7.SetOrg(vertex2);
otri7.SetDest(vertex3);
otri7.SetApex(newvertex);
otri8.SetOrg(vertex3);
otri8.SetDest(vertex);
otri8.SetApex(newvertex);
otri.SetApex(newvertex);
otri7.triangle.region = otri.triangle.region;
otri8.triangle.region = otri.triangle.region;
if (this.behavior.VarArea)
{
double num = otri.triangle.area;
otri7.triangle.area = num;
otri8.triangle.area = num;
}
if (this.checksegments)
{
otri3.SegPivot(ref osub);
if (osub.seg != Mesh.dummysub)
{
otri3.SegDissolve();
otri7.SegBond(ref osub);
}
otri4.SegPivot(ref osub2);
if (osub2.seg != Mesh.dummysub)
{
otri4.SegDissolve();
otri8.SegBond(ref osub2);
}
}
otri7.Bond(ref otri10);
otri8.Bond(ref otri11);
otri7.LnextSelf();
otri8.LprevSelf();
otri7.Bond(ref otri8);
otri7.LnextSelf();
otri3.Bond(ref otri7);
otri8.LprevSelf();
otri4.Bond(ref otri8);
if (this.checkquality)
{
this.flipstack.Clear();
this.flipstack.Push(otri);
}
}
InsertVertexResult insertVertexResult = InsertVertexResult.Successful;
Vertex vertex7 = otri.Org();
vertex = vertex7;
vertex2 = otri.Dest();
for (;;)
{
bool flag3 = true;
if (this.checksegments)
{
otri.SegPivot(ref osub6);
if (osub6.seg != Mesh.dummysub)
{
flag3 = false;
if (segmentflaws && this.quality.CheckSeg4Encroach(ref osub6) > 0)
{
insertVertexResult = InsertVertexResult.Encroaching;
}
}
}
if (flag3)
{
otri.Sym(ref otri2);
if (otri2.triangle == Mesh.dummytri)
{
flag3 = false;
}
else
{
Vertex vertex8 = otri2.Apex();
if (vertex2 == this.infvertex1 || vertex2 == this.infvertex2 || vertex2 == this.infvertex3)
{
flag3 = Primitives.CounterClockwise(newvertex, vertex, vertex8) > 0.0;
}
else if (vertex == this.infvertex1 || vertex == this.infvertex2 || vertex == this.infvertex3)
{
flag3 = Primitives.CounterClockwise(vertex8, vertex2, newvertex) > 0.0;
}
else
{
flag3 = !(vertex8 == this.infvertex1) && !(vertex8 == this.infvertex2) && !(vertex8 == this.infvertex3) && Primitives.InCircle(vertex2, newvertex, vertex, vertex8) > 0.0;
}
if (flag3)
{
otri2.Lprev(ref otri5);
otri5.Sym(ref otri12);
otri2.Lnext(ref otri6);
otri6.Sym(ref otri13);
otri.Lnext(ref otri3);
otri3.Sym(ref otri10);
otri.Lprev(ref otri4);
otri4.Sym(ref otri11);
otri5.Bond(ref otri10);
otri3.Bond(ref otri11);
otri4.Bond(ref otri13);
otri6.Bond(ref otri12);
if (this.checksegments)
{
otri5.SegPivot(ref osub3);
otri3.SegPivot(ref osub);
otri4.SegPivot(ref osub2);
otri6.SegPivot(ref osub4);
if (osub3.seg == Mesh.dummysub)
{
otri6.SegDissolve();
}
else
{
otri6.SegBond(ref osub3);
}
if (osub.seg == Mesh.dummysub)
{
otri5.SegDissolve();
}
else
{
otri5.SegBond(ref osub);
}
if (osub2.seg == Mesh.dummysub)
{
otri3.SegDissolve();
}
else
{
otri3.SegBond(ref osub2);
}
if (osub4.seg == Mesh.dummysub)
{
otri4.SegDissolve();
}
else
{
otri4.SegBond(ref osub4);
}
}
otri.SetOrg(vertex8);
otri.SetDest(newvertex);
otri.SetApex(vertex);
otri2.SetOrg(newvertex);
otri2.SetDest(vertex8);
otri2.SetApex(vertex2);
int num2 = Math.Min(otri2.triangle.region, otri.triangle.region);
otri2.triangle.region = num2;
otri.triangle.region = num2;
if (this.behavior.VarArea)
{
double num;
if (otri2.triangle.area <= 0.0 || otri.triangle.area <= 0.0)
{
num = -1.0;
}
else
{
num = 0.5 * (otri2.triangle.area + otri.triangle.area);
}
otri2.triangle.area = num;
otri.triangle.area = num;
}
if (this.checkquality)
{
this.flipstack.Push(otri);
}
otri.LprevSelf();
vertex2 = vertex8;
}
}
}
if (!flag3)
{
if (triflaws)
{
this.quality.TestTriangle(ref otri);
}
otri.LnextSelf();
otri.Sym(ref otri14);
if (vertex2 == vertex7 || otri14.triangle == Mesh.dummytri)
{
break;
}
otri14.Lnext(ref otri);
vertex = vertex2;
vertex2 = otri.Dest();
}
}
otri.Lnext(ref searchtri);
Otri otri15 = default(Otri);
otri.Lnext(ref otri15);
this.locator.Update(ref otri15);
return insertVertexResult;
}
// Token: 0x0600007C RID: 124 RVA: 0x0000CAD4 File Offset: 0x0000ACD4
internal void InsertSubseg(ref Otri tri, int subsegmark)
{
Otri otri = default(Otri);
Osub osub = default(Osub);
Vertex vertex = tri.Org();
Vertex vertex2 = tri.Dest();
if (vertex.mark == 0)
{
vertex.mark = subsegmark;
}
if (vertex2.mark == 0)
{
vertex2.mark = subsegmark;
}
tri.SegPivot(ref osub);
if (osub.seg == Mesh.dummysub)
{
this.MakeSegment(ref osub);
osub.SetOrg(vertex2);
osub.SetDest(vertex);
osub.SetSegOrg(vertex2);
osub.SetSegDest(vertex);
tri.SegBond(ref osub);
tri.Sym(ref otri);
osub.SymSelf();
otri.SegBond(ref osub);
osub.seg.boundary = subsegmark;
return;
}
if (osub.seg.boundary == 0)
{
osub.seg.boundary = subsegmark;
}
}
// Token: 0x0600007D RID: 125 RVA: 0x0000CBA0 File Offset: 0x0000ADA0
internal void Flip(ref Otri flipedge)
{
Otri otri = default(Otri);
Otri otri2 = default(Otri);
Otri otri3 = default(Otri);
Otri otri4 = default(Otri);
Otri otri5 = default(Otri);
Otri otri6 = default(Otri);
Otri otri7 = default(Otri);
Otri otri8 = default(Otri);
Otri otri9 = default(Otri);
Osub osub = default(Osub);
Osub osub2 = default(Osub);
Osub osub3 = default(Osub);
Osub osub4 = default(Osub);
Vertex vertex = flipedge.Org();
Vertex vertex2 = flipedge.Dest();
Vertex vertex3 = flipedge.Apex();
flipedge.Sym(ref otri5);
Vertex vertex4 = otri5.Apex();
otri5.Lprev(ref otri3);
otri3.Sym(ref otri8);
otri5.Lnext(ref otri4);
otri4.Sym(ref otri9);
flipedge.Lnext(ref otri);
otri.Sym(ref otri6);
flipedge.Lprev(ref otri2);
otri2.Sym(ref otri7);
otri3.Bond(ref otri6);
otri.Bond(ref otri7);
otri2.Bond(ref otri9);
otri4.Bond(ref otri8);
if (this.checksegments)
{
otri3.SegPivot(ref osub3);
otri.SegPivot(ref osub);
otri2.SegPivot(ref osub2);
otri4.SegPivot(ref osub4);
if (osub3.seg == Mesh.dummysub)
{
otri4.SegDissolve();
}
else
{
otri4.SegBond(ref osub3);
}
if (osub.seg == Mesh.dummysub)
{
otri3.SegDissolve();
}
else
{
otri3.SegBond(ref osub);
}
if (osub2.seg == Mesh.dummysub)
{
otri.SegDissolve();
}
else
{
otri.SegBond(ref osub2);
}
if (osub4.seg == Mesh.dummysub)
{
otri2.SegDissolve();
}
else
{
otri2.SegBond(ref osub4);
}
}
flipedge.SetOrg(vertex4);
flipedge.SetDest(vertex3);
flipedge.SetApex(vertex);
otri5.SetOrg(vertex3);
otri5.SetDest(vertex4);
otri5.SetApex(vertex2);
}
// Token: 0x0600007E RID: 126 RVA: 0x0000CD8C File Offset: 0x0000AF8C
internal void Unflip(ref Otri flipedge)
{
Otri otri = default(Otri);
Otri otri2 = default(Otri);
Otri otri3 = default(Otri);
Otri otri4 = default(Otri);
Otri otri5 = default(Otri);
Otri otri6 = default(Otri);
Otri otri7 = default(Otri);
Otri otri8 = default(Otri);
Otri otri9 = default(Otri);
Osub osub = default(Osub);
Osub osub2 = default(Osub);
Osub osub3 = default(Osub);
Osub osub4 = default(Osub);
Vertex vertex = flipedge.Org();
Vertex vertex2 = flipedge.Dest();
Vertex vertex3 = flipedge.Apex();
flipedge.Sym(ref otri5);
Vertex vertex4 = otri5.Apex();
otri5.Lprev(ref otri3);
otri3.Sym(ref otri8);
otri5.Lnext(ref otri4);
otri4.Sym(ref otri9);
flipedge.Lnext(ref otri);
otri.Sym(ref otri6);
flipedge.Lprev(ref otri2);
otri2.Sym(ref otri7);
otri3.Bond(ref otri9);
otri.Bond(ref otri8);
otri2.Bond(ref otri6);
otri4.Bond(ref otri7);
if (this.checksegments)
{
otri3.SegPivot(ref osub3);
otri.SegPivot(ref osub);
otri2.SegPivot(ref osub2);
otri4.SegPivot(ref osub4);
if (osub3.seg == Mesh.dummysub)
{
otri.SegDissolve();
}
else
{
otri.SegBond(ref osub3);
}
if (osub.seg == Mesh.dummysub)
{
otri2.SegDissolve();
}
else
{
otri2.SegBond(ref osub);
}
if (osub2.seg == Mesh.dummysub)
{
otri4.SegDissolve();
}
else
{
otri4.SegBond(ref osub2);
}
if (osub4.seg == Mesh.dummysub)
{
otri3.SegDissolve();
}
else
{
otri3.SegBond(ref osub4);
}
}
flipedge.SetOrg(vertex3);
flipedge.SetDest(vertex4);
flipedge.SetApex(vertex2);
otri5.SetOrg(vertex4);
otri5.SetDest(vertex3);
otri5.SetApex(vertex);
}
// Token: 0x0600007F RID: 127 RVA: 0x0000CF78 File Offset: 0x0000B178
private void TriangulatePolygon(Otri firstedge, Otri lastedge, int edgecount, bool doflip, bool triflaws)
{
Otri otri = default(Otri);
Otri otri2 = default(Otri);
Otri otri3 = default(Otri);
int num = 1;
Vertex vertex = lastedge.Apex();
Vertex vertex2 = firstedge.Dest();
firstedge.Onext(ref otri2);
Vertex vertex3 = otri2.Dest();
otri2.Copy(ref otri);
for (int i = 2; i <= edgecount - 2; i++)
{
otri.OnextSelf();
Vertex vertex4 = otri.Dest();
if (Primitives.InCircle(vertex, vertex2, vertex3, vertex4) > 0.0)
{
otri.Copy(ref otri2);
vertex3 = vertex4;
num = i;
}
}
if (num > 1)
{
otri2.Oprev(ref otri3);
this.TriangulatePolygon(firstedge, otri3, num + 1, true, triflaws);
}
if (num < edgecount - 2)
{
otri2.Sym(ref otri3);
this.TriangulatePolygon(otri2, lastedge, edgecount - num, true, triflaws);
otri3.Sym(ref otri2);
}
if (doflip)
{
this.Flip(ref otri2);
if (triflaws)
{
otri2.Sym(ref otri);
this.quality.TestTriangle(ref otri);
}
}
otri2.Copy(ref lastedge);
}
// Token: 0x06000080 RID: 128 RVA: 0x0000D08C File Offset: 0x0000B28C
internal void DeleteVertex(ref Otri deltri)
{
Otri otri = default(Otri);
Otri otri2 = default(Otri);
Otri otri3 = default(Otri);
Otri otri4 = default(Otri);
Otri otri5 = default(Otri);
Otri otri6 = default(Otri);
Otri otri7 = default(Otri);
Otri otri8 = default(Otri);
Osub osub = default(Osub);
Osub osub2 = default(Osub);
Vertex vertex = deltri.Org();
this.VertexDealloc(vertex);
deltri.Onext(ref otri);
int num = 1;
while (!deltri.Equal(otri))
{
num++;
otri.OnextSelf();
}
if (num > 3)
{
deltri.Onext(ref otri2);
deltri.Oprev(ref otri3);
this.TriangulatePolygon(otri2, otri3, num, false, this.behavior.NoBisect == 0);
}
deltri.Lprev(ref otri4);
deltri.Dnext(ref otri5);
otri5.Sym(ref otri7);
otri4.Oprev(ref otri6);
otri6.Sym(ref otri8);
deltri.Bond(ref otri7);
otri4.Bond(ref otri8);
otri5.SegPivot(ref osub);
if (osub.seg != Mesh.dummysub)
{
deltri.SegBond(ref osub);
}
otri6.SegPivot(ref osub2);
if (osub2.seg != Mesh.dummysub)
{
otri4.SegBond(ref osub2);
}
Vertex vertex2 = otri5.Org();
deltri.SetOrg(vertex2);
if (this.behavior.NoBisect == 0)
{
this.quality.TestTriangle(ref deltri);
}
this.TriangleDealloc(otri5.triangle);
this.TriangleDealloc(otri6.triangle);
}
// Token: 0x06000081 RID: 129 RVA: 0x0000D20C File Offset: 0x0000B40C
internal void UndoVertex()
{
Otri otri = default(Otri);
Otri otri2 = default(Otri);
Otri otri3 = default(Otri);
Otri otri4 = default(Otri);
Otri otri5 = default(Otri);
Otri otri6 = default(Otri);
Otri otri7 = default(Otri);
Osub osub = default(Osub);
Osub osub2 = default(Osub);
Osub osub3 = default(Osub);
while (this.flipstack.Count > 0)
{
Otri otri8 = this.flipstack.Pop();
if (this.flipstack.Count == 0)
{
otri8.Dprev(ref otri);
otri.LnextSelf();
otri8.Onext(ref otri2);
otri2.LprevSelf();
otri.Sym(ref otri4);
otri2.Sym(ref otri5);
Vertex vertex = otri.Dest();
otri8.SetApex(vertex);
otri8.LnextSelf();
otri8.Bond(ref otri4);
otri.SegPivot(ref osub);
otri8.SegBond(ref osub);
otri8.LnextSelf();
otri8.Bond(ref otri5);
otri2.SegPivot(ref osub2);
otri8.SegBond(ref osub2);
this.TriangleDealloc(otri.triangle);
this.TriangleDealloc(otri2.triangle);
}
else if (this.flipstack.Peek().triangle == null)
{
otri8.Lprev(ref otri7);
otri7.Sym(ref otri2);
otri2.LnextSelf();
otri2.Sym(ref otri5);
Vertex vertex2 = otri2.Dest();
otri8.SetOrg(vertex2);
otri7.Bond(ref otri5);
otri2.SegPivot(ref osub2);
otri7.SegBond(ref osub2);
this.TriangleDealloc(otri2.triangle);
otri8.Sym(ref otri7);
if (otri7.triangle != Mesh.dummytri)
{
otri7.LnextSelf();
otri7.Dnext(ref otri3);
otri3.Sym(ref otri6);
otri7.SetOrg(vertex2);
otri7.Bond(ref otri6);
otri3.SegPivot(ref osub3);
otri7.SegBond(ref osub3);
this.TriangleDealloc(otri3.triangle);
}
this.flipstack.Clear();
}
else
{
this.Unflip(ref otri8);
}
}
}
// Token: 0x06000082 RID: 130 RVA: 0x0000D425 File Offset: 0x0000B625
internal void TriangleDealloc(Triangle dyingtriangle)
{
Otri.Kill(dyingtriangle);
this.triangles.Remove(dyingtriangle.hash);
}
// Token: 0x06000083 RID: 131 RVA: 0x0000D43F File Offset: 0x0000B63F
internal void VertexDealloc(Vertex dyingvertex)
{
dyingvertex.type = VertexType.DeadVertex;
this.vertices.Remove(dyingvertex.hash);
}
// Token: 0x06000084 RID: 132 RVA: 0x0000D45A File Offset: 0x0000B65A
internal void SubsegDealloc(Segment dyingsubseg)
{
Osub.Kill(dyingsubseg);
this.subsegs.Remove(dyingsubseg.hash);
}
// Token: 0x04000053 RID: 83
private ILog<SimpleLogItem> logger;
// Token: 0x04000054 RID: 84
private QualityMesher quality;
// Token: 0x04000055 RID: 85
private Stack<Otri> flipstack;
// Token: 0x04000056 RID: 86
internal Dictionary<int, Triangle> triangles;
// Token: 0x04000057 RID: 87
internal Dictionary<int, Segment> subsegs;
// Token: 0x04000058 RID: 88
internal Dictionary<int, Vertex> vertices;
// Token: 0x04000059 RID: 89
internal int hash_vtx;
// Token: 0x0400005A RID: 90
internal int hash_seg;
// Token: 0x0400005B RID: 91
internal int hash_tri;
// Token: 0x0400005C RID: 92
internal List<Point> holes;
// Token: 0x0400005D RID: 93
internal List<RegionPointer> regions;
// Token: 0x0400005E RID: 94
internal BoundingBox bounds;
// Token: 0x0400005F RID: 95
internal int invertices;
// Token: 0x04000060 RID: 96
internal int inelements;
// Token: 0x04000061 RID: 97
internal int insegments;
// Token: 0x04000062 RID: 98
internal int undeads;
// Token: 0x04000063 RID: 99
internal int edges;
// Token: 0x04000064 RID: 100
internal int mesh_dim;
// Token: 0x04000065 RID: 101
internal int nextras;
// Token: 0x04000066 RID: 102
internal int hullsize;
// Token: 0x04000067 RID: 103
internal int steinerleft;
// Token: 0x04000068 RID: 104
internal bool checksegments;
// Token: 0x04000069 RID: 105
internal bool checkquality;
// Token: 0x0400006A RID: 106
internal Vertex infvertex1;
// Token: 0x0400006B RID: 107
internal Vertex infvertex2;
// Token: 0x0400006C RID: 108
internal Vertex infvertex3;
// Token: 0x0400006D RID: 109
internal static Triangle dummytri;
// Token: 0x0400006E RID: 110
internal static Segment dummysub;
// Token: 0x0400006F RID: 111
internal TriangleLocator locator;
// Token: 0x04000070 RID: 112
internal Behavior behavior;
// Token: 0x04000071 RID: 113
internal NodeNumbering numbering;
}
}
+138
View File
@@ -0,0 +1,138 @@
using System;
using TriangleNet.Data;
using TriangleNet.Log;
namespace TriangleNet
{
// Token: 0x02000005 RID: 5
public static class MeshValidator
{
// Token: 0x06000038 RID: 56 RVA: 0x000038D0 File Offset: 0x00001AD0
public static bool IsConsistent(Mesh mesh)
{
Otri otri = default(Otri);
Otri otri2 = default(Otri);
Otri otri3 = default(Otri);
ILog<SimpleLogItem> instance = SimpleLog.Instance;
bool noExact = Behavior.NoExact;
Behavior.NoExact = false;
int num = 0;
foreach (Triangle triangle in mesh.triangles.Values)
{
otri.triangle = triangle;
otri.orient = 0;
while (otri.orient < 3)
{
Vertex vertex = otri.Org();
Vertex vertex2 = otri.Dest();
if (otri.orient == 0)
{
Vertex vertex3 = otri.Apex();
if (Primitives.CounterClockwise(vertex, vertex2, vertex3) <= 0.0)
{
if (Behavior.Verbose)
{
instance.Warning("Triangle is flat or inverted.", "Quality.CheckMesh()");
}
num++;
}
}
otri.Sym(ref otri2);
if (otri2.triangle != Mesh.dummytri)
{
otri2.Sym(ref otri3);
if (otri.triangle != otri3.triangle || otri.orient != otri3.orient)
{
if (otri.triangle == otri3.triangle && Behavior.Verbose)
{
instance.Warning("Asymmetric triangle-triangle bond: (Right triangle, wrong orientation)", "Quality.CheckMesh()");
}
num++;
}
Vertex vertex4 = otri2.Org();
Vertex vertex5 = otri2.Dest();
if (vertex != vertex5 || vertex2 != vertex4)
{
if (Behavior.Verbose)
{
instance.Warning("Mismatched edge coordinates between two triangles.", "Quality.CheckMesh()");
}
num++;
}
}
otri.orient++;
}
}
mesh.MakeVertexMap();
foreach (Vertex vertex6 in mesh.vertices.Values)
{
if (vertex6.tri.triangle == null && Behavior.Verbose)
{
instance.Warning("Vertex (ID " + vertex6.id + ") not connected to mesh (duplicate input vertex?)", "Quality.CheckMesh()");
}
}
Behavior.NoExact = noExact;
return num == 0;
}
// Token: 0x06000039 RID: 57 RVA: 0x00003B34 File Offset: 0x00001D34
public static bool IsDelaunay(Mesh mesh)
{
return MeshValidator.IsDelaunay(mesh, false);
}
// Token: 0x0600003A RID: 58 RVA: 0x00003B3D File Offset: 0x00001D3D
public static bool IsConstrainedDelaunay(Mesh mesh)
{
return MeshValidator.IsDelaunay(mesh, true);
}
// Token: 0x0600003B RID: 59 RVA: 0x00003B48 File Offset: 0x00001D48
private static bool IsDelaunay(Mesh mesh, bool constrained)
{
Otri otri = default(Otri);
Otri otri2 = default(Otri);
Osub osub = default(Osub);
ILog<SimpleLogItem> instance = SimpleLog.Instance;
bool noExact = Behavior.NoExact;
Behavior.NoExact = false;
int num = 0;
Vertex infvertex = mesh.infvertex1;
Vertex infvertex2 = mesh.infvertex2;
Vertex infvertex3 = mesh.infvertex3;
foreach (Triangle triangle in mesh.triangles.Values)
{
otri.triangle = triangle;
otri.orient = 0;
while (otri.orient < 3)
{
Vertex vertex = otri.Org();
Vertex vertex2 = otri.Dest();
Vertex vertex3 = otri.Apex();
otri.Sym(ref otri2);
Vertex vertex4 = otri2.Apex();
bool flag = otri.triangle.id < otri2.triangle.id && !Otri.IsDead(otri2.triangle) && otri2.triangle != Mesh.dummytri && vertex != infvertex && vertex != infvertex2 && vertex != infvertex3 && vertex2 != infvertex && vertex2 != infvertex2 && vertex2 != infvertex3 && vertex3 != infvertex && vertex3 != infvertex2 && vertex3 != infvertex3 && vertex4 != infvertex && vertex4 != infvertex2 && vertex4 != infvertex3;
if (constrained && mesh.checksegments && flag)
{
otri.SegPivot(ref osub);
if (osub.seg != Mesh.dummysub)
{
flag = false;
}
}
if (flag && Primitives.NonRegular(vertex, vertex2, vertex3, vertex4) > 0.0)
{
if (Behavior.Verbose)
{
instance.Warning(string.Format("Non-regular pair of triangles found (IDs {0}/{1}).", otri.triangle.id, otri2.triangle.id), "Quality.CheckDelaunay()");
}
num++;
}
otri.orient++;
}
}
Behavior.NoExact = noExact;
return num == 0;
}
}
}
+2550
View File
@@ -0,0 +1,2550 @@
using System;
using TriangleNet.Data;
using TriangleNet.Geometry;
using TriangleNet.Log;
using TriangleNet.Tools;
namespace TriangleNet
{
// Token: 0x02000006 RID: 6
internal class NewLocation
{
// Token: 0x0600003C RID: 60 RVA: 0x00003DA4 File Offset: 0x00001FA4
public NewLocation(Mesh mesh)
{
this.mesh = mesh;
this.behavior = mesh.behavior;
}
// Token: 0x0600003D RID: 61 RVA: 0x00003E67 File Offset: 0x00002067
public Point FindLocation(Vertex torg, Vertex tdest, Vertex tapex, ref double xi, ref double eta, bool offcenter, Otri badotri)
{
if (this.behavior.MaxAngle == 0.0)
{
return this.FindNewLocationWithoutMaxAngle(torg, tdest, tapex, ref xi, ref eta, true, badotri);
}
return this.FindNewLocation(torg, tdest, tapex, ref xi, ref eta, true, badotri);
}
// Token: 0x0600003E RID: 62 RVA: 0x00003EA0 File Offset: 0x000020A0
private Point FindNewLocationWithoutMaxAngle(Vertex torg, Vertex tdest, Vertex tapex, ref double xi, ref double eta, bool offcenter, Otri badotri)
{
double offconstant = this.behavior.offconstant;
int num = 0;
Otri otri = default(Otri);
double[] array = new double[2];
double num2 = 0.0;
double num3 = 0.0;
double[] array2 = new double[5];
double[] array3 = new double[4];
double num4 = 0.06;
double num5 = 1.0;
double num6 = 1.0;
int num7 = 0;
double[] array4 = new double[2];
double num8 = 0.0;
double num9 = 0.0;
Statistic.CircumcenterCount += 1L;
double num10 = tdest.x - torg.x;
double num11 = tdest.y - torg.y;
double num12 = tapex.x - torg.x;
double num13 = tapex.y - torg.y;
double num14 = tapex.x - tdest.x;
double num15 = tapex.y - tdest.y;
double num16 = num10 * num10 + num11 * num11;
double num17 = num12 * num12 + num13 * num13;
double num18 = (tdest.x - tapex.x) * (tdest.x - tapex.x) + (tdest.y - tapex.y) * (tdest.y - tapex.y);
double num19;
if (Behavior.NoExact)
{
num19 = 0.5 / (num10 * num13 - num12 * num11);
}
else
{
num19 = 0.5 / Primitives.CounterClockwise(tdest, tapex, torg);
Statistic.CounterClockwiseCount -= 1L;
}
double num20 = (num13 * num16 - num11 * num17) * num19;
double num21 = (num10 * num17 - num12 * num16) * num19;
Point point = new Point(torg.x + num20, torg.y + num21);
Otri otri2 = badotri;
int num22 = this.LongestShortestEdge(num17, num18, num16);
double num23;
double num24;
double num25;
double num26;
double num27;
Point point2;
Point point3;
Point point4;
if (num22 <= 213)
{
if (num22 == 123)
{
num23 = num12;
num24 = num13;
num25 = num17;
num26 = num18;
num27 = num16;
point2 = tdest;
point3 = torg;
point4 = tapex;
goto IL_2F9;
}
if (num22 == 132)
{
num23 = num12;
num24 = num13;
num25 = num17;
num26 = num16;
num27 = num18;
point2 = tdest;
point3 = tapex;
point4 = torg;
goto IL_2F9;
}
if (num22 == 213)
{
num23 = num14;
num24 = num15;
num25 = num18;
num26 = num17;
num27 = num16;
point2 = torg;
point3 = tdest;
point4 = tapex;
goto IL_2F9;
}
}
else
{
if (num22 == 231)
{
num23 = num14;
num24 = num15;
num25 = num18;
num26 = num16;
num27 = num17;
point2 = torg;
point3 = tapex;
point4 = tdest;
goto IL_2F9;
}
if (num22 == 312)
{
num23 = num10;
num24 = num11;
num25 = num16;
num26 = num17;
num27 = num18;
point2 = tapex;
point3 = tdest;
point4 = torg;
goto IL_2F9;
}
if (num22 != 321)
{
}
}
num23 = num10;
num24 = num11;
num25 = num16;
num26 = num18;
num27 = num17;
point2 = tapex;
point3 = torg;
point4 = tdest;
IL_2F9:
if (offcenter && offconstant > 0.0)
{
if (num22 == 213 || num22 == 231)
{
double num28 = 0.5 * num23 - offconstant * num24;
double num29 = 0.5 * num24 + offconstant * num23;
if (num28 * num28 + num29 * num29 < (num20 - num10) * (num20 - num10) + (num21 - num11) * (num21 - num11))
{
num20 = num10 + num28;
num21 = num11 + num29;
}
else
{
num = 1;
}
}
else if (num22 == 123 || num22 == 132)
{
double num28 = 0.5 * num23 + offconstant * num24;
double num29 = 0.5 * num24 - offconstant * num23;
if (num28 * num28 + num29 * num29 < num20 * num20 + num21 * num21)
{
num20 = num28;
num21 = num29;
}
else
{
num = 1;
}
}
else
{
double num28 = 0.5 * num23 - offconstant * num24;
double num29 = 0.5 * num24 + offconstant * num23;
if (num28 * num28 + num29 * num29 < num20 * num20 + num21 * num21)
{
num20 = num28;
num21 = num29;
}
else
{
num = 1;
}
}
}
if (num == 1)
{
double num30 = (num26 + num25 - num27) / (2.0 * Math.Sqrt(num26) * Math.Sqrt(num25));
bool flag = num30 < 0.0 || Math.Abs(num30 - 0.0) <= 1E-50;
num7 = this.DoSmoothing(otri2, torg, tdest, tapex, ref array4);
if (num7 > 0)
{
Statistic.RelocationCount += 1L;
num20 = array4[0] - torg.x;
num21 = array4[1] - torg.y;
num8 = torg.x;
num9 = torg.y;
switch (num7)
{
case 1:
this.mesh.DeleteVertex(ref otri2);
break;
case 2:
otri2.LnextSelf();
this.mesh.DeleteVertex(ref otri2);
break;
case 3:
otri2.LprevSelf();
this.mesh.DeleteVertex(ref otri2);
break;
}
}
else
{
double num31 = Math.Sqrt(num25) / (2.0 * Math.Sin(this.behavior.MinAngle * 3.141592653589793 / 180.0));
double num32 = (point3.x + point4.x) / 2.0;
double num33 = (point3.y + point4.y) / 2.0;
double num34 = num32 + Math.Sqrt(num31 * num31 - num25 / 4.0) * (point3.y - point4.y) / Math.Sqrt(num25);
double num35 = num33 + Math.Sqrt(num31 * num31 - num25 / 4.0) * (point4.x - point3.x) / Math.Sqrt(num25);
double num36 = num32 - Math.Sqrt(num31 * num31 - num25 / 4.0) * (point3.y - point4.y) / Math.Sqrt(num25);
double num37 = num33 - Math.Sqrt(num31 * num31 - num25 / 4.0) * (point4.x - point3.x) / Math.Sqrt(num25);
double num38 = (num34 - point2.x) * (num34 - point2.x);
double num39 = (num35 - point2.y) * (num35 - point2.y);
double num40 = (num36 - point2.x) * (num36 - point2.x);
double num41 = (num37 - point2.y) * (num37 - point2.y);
double num42;
double num43;
if (num38 + num39 <= num40 + num41)
{
num42 = num34;
num43 = num35;
}
else
{
num42 = num36;
num43 = num37;
}
bool neighborsVertex = this.GetNeighborsVertex(badotri, point3.x, point3.y, point2.x, point2.y, ref array, ref otri);
double num44 = num20;
double num45 = num21;
if (!neighborsVertex)
{
Point point5 = otri.Org();
Vertex vertex = otri.Dest();
Vertex vertex2 = otri.Apex();
Point point6 = Primitives.FindCircumcenter(point5, vertex, vertex2, ref num2, ref num3);
double num46 = point3.y - point2.y;
double num47 = point2.x - point3.x;
num46 = point.x + num46;
num47 = point.y + num47;
this.CircleLineIntersection(point.x, point.y, num46, num47, num42, num43, num31, ref array2);
double num48 = (point3.x + point2.x) / 2.0;
double num49 = (point3.y + point2.y) / 2.0;
double num50;
double num51;
if (this.ChooseCorrectPoint(num48, num49, array2[3], array2[4], point.x, point.y, flag))
{
num50 = array2[3];
num51 = array2[4];
}
else
{
num50 = array2[1];
num51 = array2[2];
}
this.PointBetweenPoints(num50, num51, point.x, point.y, point6.x, point6.y, ref array3);
if (array2[0] > 0.0)
{
if (Math.Abs(array3[0] - 1.0) <= 1E-50)
{
if (this.IsBadTriangleAngle(point3.x, point3.y, point4.x, point4.y, point6.x, point6.y))
{
num44 = num20;
num45 = num21;
}
else
{
num44 = array3[2] - torg.x;
num45 = array3[3] - torg.y;
}
}
else if (this.IsBadTriangleAngle(point4.x, point4.y, point3.x, point3.y, num50, num51))
{
double num52 = Math.Sqrt((num50 - point.x) * (num50 - point.x) + (num51 - point.y) * (num51 - point.y));
double num53 = point.x - num50;
double num54 = point.y - num51;
num53 /= num52;
num54 /= num52;
num50 += num53 * num4 * Math.Sqrt(num25);
num51 += num54 * num4 * Math.Sqrt(num25);
if (this.IsBadTriangleAngle(point3.x, point3.y, point4.x, point4.y, num50, num51))
{
num44 = num20;
num45 = num21;
}
else
{
num44 = num50 - torg.x;
num45 = num51 - torg.y;
}
}
else
{
num44 = num50 - torg.x;
num45 = num51 - torg.y;
}
if ((point2.x - point.x) * (point2.x - point.x) + (point2.y - point.y) * (point2.y - point.y) > num5 * ((point2.x - (num44 + torg.x)) * (point2.x - (num44 + torg.x)) + (point2.y - (num45 + torg.y)) * (point2.y - (num45 + torg.y))))
{
num44 = num20;
num45 = num21;
}
}
}
bool neighborsVertex2 = this.GetNeighborsVertex(badotri, point4.x, point4.y, point2.x, point2.y, ref array, ref otri);
double num55 = num20;
double num56 = num21;
if (!neighborsVertex2)
{
Point point7 = otri.Org();
Vertex vertex = otri.Dest();
Vertex vertex2 = otri.Apex();
Point point6 = Primitives.FindCircumcenter(point7, vertex, vertex2, ref num2, ref num3);
double num46 = point4.y - point2.y;
double num47 = point2.x - point4.x;
num46 = point.x + num46;
num47 = point.y + num47;
this.CircleLineIntersection(point.x, point.y, num46, num47, num42, num43, num31, ref array2);
double num57 = (point4.x + point2.x) / 2.0;
double num58 = (point4.y + point2.y) / 2.0;
double num50;
double num51;
if (this.ChooseCorrectPoint(num57, num58, array2[3], array2[4], point.x, point.y, false))
{
num50 = array2[3];
num51 = array2[4];
}
else
{
num50 = array2[1];
num51 = array2[2];
}
this.PointBetweenPoints(num50, num51, point.x, point.y, point6.x, point6.y, ref array3);
if (array2[0] > 0.0)
{
if (Math.Abs(array3[0] - 1.0) <= 1E-50)
{
if (this.IsBadTriangleAngle(point3.x, point3.y, point4.x, point4.y, point6.x, point6.y))
{
num55 = num20;
num56 = num21;
}
else
{
num55 = array3[2] - torg.x;
num56 = array3[3] - torg.y;
}
}
else if (this.IsBadTriangleAngle(point3.x, point3.y, point4.x, point4.y, num50, num51))
{
double num52 = Math.Sqrt((num50 - point.x) * (num50 - point.x) + (num51 - point.y) * (num51 - point.y));
double num53 = point.x - num50;
double num54 = point.y - num51;
num53 /= num52;
num54 /= num52;
num50 += num53 * num4 * Math.Sqrt(num25);
num51 += num54 * num4 * Math.Sqrt(num25);
if (this.IsBadTriangleAngle(point3.x, point3.y, point4.x, point4.y, num50, num51))
{
num55 = num20;
num56 = num21;
}
else
{
num55 = num50 - torg.x;
num56 = num51 - torg.y;
}
}
else
{
num55 = num50 - torg.x;
num56 = num51 - torg.y;
}
if ((point2.x - point.x) * (point2.x - point.x) + (point2.y - point.y) * (point2.y - point.y) > num5 * ((point2.x - (num55 + torg.x)) * (point2.x - (num55 + torg.x)) + (point2.y - (num56 + torg.y)) * (point2.y - (num56 + torg.y))))
{
num55 = num20;
num56 = num21;
}
}
}
if (flag)
{
num20 = num44;
num21 = num45;
}
else if (num6 * ((point2.x - (num55 + torg.x)) * (point2.x - (num55 + torg.x)) + (point2.y - (num56 + torg.y)) * (point2.y - (num56 + torg.y))) > (point2.x - (num44 + torg.x)) * (point2.x - (num44 + torg.x)) + (point2.y - (num45 + torg.y)) * (point2.y - (num45 + torg.y)))
{
num20 = num55;
num21 = num56;
}
else
{
num20 = num44;
num21 = num45;
}
}
}
Point point8 = new Point();
if (num7 <= 0)
{
point8.x = torg.x + num20;
point8.y = torg.y + num21;
}
else
{
point8.x = num8 + num20;
point8.y = num9 + num21;
}
xi = (num13 * num20 - num12 * num21) * (2.0 * num19);
eta = (num10 * num21 - num11 * num20) * (2.0 * num19);
return point8;
}
// Token: 0x0600003F RID: 63 RVA: 0x00004DB8 File Offset: 0x00002FB8
private Point FindNewLocation(Vertex torg, Vertex tdest, Vertex tapex, ref double xi, ref double eta, bool offcenter, Otri badotri)
{
double offconstant = this.behavior.offconstant;
int num = 0;
Otri otri = default(Otri);
double[] array = new double[2];
double num2 = 0.0;
double num3 = 0.0;
double[] array2 = new double[5];
double[] array3 = new double[4];
double num4 = 0.06;
double num5 = 1.0;
double num6 = 1.0;
int num7 = 0;
double[] array4 = new double[2];
double num8 = 0.0;
double num9 = 0.0;
double num10 = 0.0;
double num11 = 0.0;
double[] array5 = new double[3];
double[] array6 = new double[4];
Statistic.CircumcenterCount += 1L;
double num12 = tdest.x - torg.x;
double num13 = tdest.y - torg.y;
double num14 = tapex.x - torg.x;
double num15 = tapex.y - torg.y;
double num16 = tapex.x - tdest.x;
double num17 = tapex.y - tdest.y;
double num18 = num12 * num12 + num13 * num13;
double num19 = num14 * num14 + num15 * num15;
double num20 = (tdest.x - tapex.x) * (tdest.x - tapex.x) + (tdest.y - tapex.y) * (tdest.y - tapex.y);
double num21;
if (Behavior.NoExact)
{
num21 = 0.5 / (num12 * num15 - num14 * num13);
}
else
{
num21 = 0.5 / Primitives.CounterClockwise(tdest, tapex, torg);
Statistic.CounterClockwiseCount -= 1L;
}
double num22 = (num15 * num18 - num13 * num19) * num21;
double num23 = (num12 * num19 - num14 * num18) * num21;
Point point = new Point(torg.x + num22, torg.y + num23);
Otri otri2 = badotri;
int num24 = this.LongestShortestEdge(num19, num20, num18);
double num25;
double num26;
double num27;
double num28;
double num29;
Point point2;
Point point3;
Point point4;
if (num24 <= 213)
{
if (num24 == 123)
{
num25 = num14;
num26 = num15;
num27 = num19;
num28 = num20;
num29 = num18;
point2 = tdest;
point3 = torg;
point4 = tapex;
goto IL_31F;
}
if (num24 == 132)
{
num25 = num14;
num26 = num15;
num27 = num19;
num28 = num18;
num29 = num20;
point2 = tdest;
point3 = tapex;
point4 = torg;
goto IL_31F;
}
if (num24 == 213)
{
num25 = num16;
num26 = num17;
num27 = num20;
num28 = num19;
num29 = num18;
point2 = torg;
point3 = tdest;
point4 = tapex;
goto IL_31F;
}
}
else
{
if (num24 == 231)
{
num25 = num16;
num26 = num17;
num27 = num20;
num28 = num18;
num29 = num19;
point2 = torg;
point3 = tapex;
point4 = tdest;
goto IL_31F;
}
if (num24 == 312)
{
num25 = num12;
num26 = num13;
num27 = num18;
num28 = num19;
num29 = num20;
point2 = tapex;
point3 = tdest;
point4 = torg;
goto IL_31F;
}
if (num24 != 321)
{
}
}
num25 = num12;
num26 = num13;
num27 = num18;
num28 = num20;
num29 = num19;
point2 = tapex;
point3 = torg;
point4 = tdest;
IL_31F:
if (offcenter && offconstant > 0.0)
{
if (num24 == 213 || num24 == 231)
{
double num30 = 0.5 * num25 - offconstant * num26;
double num31 = 0.5 * num26 + offconstant * num25;
if (num30 * num30 + num31 * num31 < (num22 - num12) * (num22 - num12) + (num23 - num13) * (num23 - num13))
{
num22 = num12 + num30;
num23 = num13 + num31;
}
else
{
num = 1;
}
}
else if (num24 == 123 || num24 == 132)
{
double num30 = 0.5 * num25 + offconstant * num26;
double num31 = 0.5 * num26 - offconstant * num25;
if (num30 * num30 + num31 * num31 < num22 * num22 + num23 * num23)
{
num22 = num30;
num23 = num31;
}
else
{
num = 1;
}
}
else
{
double num30 = 0.5 * num25 - offconstant * num26;
double num31 = 0.5 * num26 + offconstant * num25;
if (num30 * num30 + num31 * num31 < num22 * num22 + num23 * num23)
{
num22 = num30;
num23 = num31;
}
else
{
num = 1;
}
}
}
if (num == 1)
{
double num32 = (num28 + num27 - num29) / (2.0 * Math.Sqrt(num28) * Math.Sqrt(num27));
bool flag = num32 < 0.0 || Math.Abs(num32 - 0.0) <= 1E-50;
num7 = this.DoSmoothing(otri2, torg, tdest, tapex, ref array4);
if (num7 > 0)
{
Statistic.RelocationCount += 1L;
num22 = array4[0] - torg.x;
num23 = array4[1] - torg.y;
num8 = torg.x;
num9 = torg.y;
switch (num7)
{
case 1:
this.mesh.DeleteVertex(ref otri2);
break;
case 2:
otri2.LnextSelf();
this.mesh.DeleteVertex(ref otri2);
break;
case 3:
otri2.LprevSelf();
this.mesh.DeleteVertex(ref otri2);
break;
}
}
else
{
double num33 = Math.Acos((num28 + num29 - num27) / (2.0 * Math.Sqrt(num28) * Math.Sqrt(num29))) * 180.0 / 3.141592653589793;
if (this.behavior.MinAngle > num33)
{
num33 = this.behavior.MinAngle;
}
else
{
num33 += 0.5;
}
double num34 = Math.Sqrt(num27) / (2.0 * Math.Sin(num33 * 3.141592653589793 / 180.0));
double num35 = (point3.x + point4.x) / 2.0;
double num36 = (point3.y + point4.y) / 2.0;
double num37 = num35 + Math.Sqrt(num34 * num34 - num27 / 4.0) * (point3.y - point4.y) / Math.Sqrt(num27);
double num38 = num36 + Math.Sqrt(num34 * num34 - num27 / 4.0) * (point4.x - point3.x) / Math.Sqrt(num27);
double num39 = num35 - Math.Sqrt(num34 * num34 - num27 / 4.0) * (point3.y - point4.y) / Math.Sqrt(num27);
double num40 = num36 - Math.Sqrt(num34 * num34 - num27 / 4.0) * (point4.x - point3.x) / Math.Sqrt(num27);
double num41 = (num37 - point2.x) * (num37 - point2.x);
double num42 = (num38 - point2.y) * (num38 - point2.y);
double num43 = (num39 - point2.x) * (num39 - point2.x);
double num44 = (num40 - point2.y) * (num40 - point2.y);
double num45;
double num46;
if (num41 + num42 <= num43 + num44)
{
num45 = num37;
num46 = num38;
}
else
{
num45 = num39;
num46 = num40;
}
bool neighborsVertex = this.GetNeighborsVertex(badotri, point3.x, point3.y, point2.x, point2.y, ref array, ref otri);
double num47 = num22;
double num48 = num23;
double num49 = Math.Sqrt((num45 - num35) * (num45 - num35) + (num46 - num36) * (num46 - num36));
double num50 = (num45 - num35) / num49;
double num51 = (num46 - num36) / num49;
double num52 = num45 + num50 * num34;
double num53 = num46 + num51 * num34;
double num54 = (2.0 * this.behavior.MaxAngle + num33 - 180.0) * 3.141592653589793 / 180.0;
double num55 = num52 * Math.Cos(num54) + num53 * Math.Sin(num54) + num45 - num45 * Math.Cos(num54) - num46 * Math.Sin(num54);
double num56 = -num52 * Math.Sin(num54) + num53 * Math.Cos(num54) + num46 + num45 * Math.Sin(num54) - num46 * Math.Cos(num54);
double num57 = num52 * Math.Cos(num54) - num53 * Math.Sin(num54) + num45 - num45 * Math.Cos(num54) + num46 * Math.Sin(num54);
double num58 = num52 * Math.Sin(num54) + num53 * Math.Cos(num54) + num46 - num45 * Math.Sin(num54) - num46 * Math.Cos(num54);
double num59;
double num60;
double num61;
double num62;
if (this.ChooseCorrectPoint(num57, num58, point3.x, point3.y, num55, num56, true))
{
num59 = num55;
num60 = num56;
num61 = num57;
num62 = num58;
}
else
{
num59 = num57;
num60 = num58;
num61 = num55;
num62 = num56;
}
double num63 = (point3.x + point2.x) / 2.0;
double num64 = (point3.y + point2.y) / 2.0;
if (!neighborsVertex)
{
Point point5 = otri.Org();
Vertex vertex = otri.Dest();
Vertex vertex2 = otri.Apex();
Point point6 = Primitives.FindCircumcenter(point5, vertex, vertex2, ref num2, ref num3);
double num65 = point3.y - point2.y;
double num66 = point2.x - point3.x;
num65 = point.x + num65;
num66 = point.y + num66;
this.CircleLineIntersection(point.x, point.y, num65, num66, num45, num46, num34, ref array2);
double num67;
double num68;
if (this.ChooseCorrectPoint(num63, num64, array2[3], array2[4], point.x, point.y, flag))
{
num67 = array2[3];
num68 = array2[4];
}
else
{
num67 = array2[1];
num68 = array2[2];
}
double num69 = point3.x;
double num70 = point3.y;
num50 = point4.x - point3.x;
num51 = point4.y - point3.y;
double num71 = num59;
double num72 = num60;
this.LineLineIntersection(point.x, point.y, num65, num66, num69, num70, num71, num72, ref array5);
if (array5[0] > 0.0)
{
num10 = array5[1];
num11 = array5[2];
}
this.PointBetweenPoints(num67, num68, point.x, point.y, point6.x, point6.y, ref array3);
if (array2[0] > 0.0)
{
if (Math.Abs(array3[0] - 1.0) <= 1E-50)
{
this.PointBetweenPoints(array3[2], array3[3], point.x, point.y, num10, num11, ref array6);
if (Math.Abs(array6[0] - 1.0) <= 1E-50 && array5[0] > 0.0)
{
if ((point2.x - num59) * (point2.x - num59) + (point2.y - num60) * (point2.y - num60) > num5 * ((point2.x - num10) * (point2.x - num10) + (point2.y - num11) * (point2.y - num11)) && this.IsBadTriangleAngle(point3.x, point3.y, point4.x, point4.y, num59, num60) && this.MinDistanceToNeighbor(num59, num60, ref otri) > this.MinDistanceToNeighbor(num10, num11, ref otri))
{
num47 = num59 - torg.x;
num48 = num60 - torg.y;
}
else if (this.IsBadTriangleAngle(point3.x, point3.y, point4.x, point4.y, num10, num11))
{
double num73 = Math.Sqrt((num10 - point.x) * (num10 - point.x) + (num11 - point.y) * (num11 - point.y));
double num74 = point.x - num10;
double num75 = point.y - num11;
num74 /= num73;
num75 /= num73;
num10 += num74 * num4 * Math.Sqrt(num27);
num11 += num75 * num4 * Math.Sqrt(num27);
if (this.IsBadTriangleAngle(point3.x, point3.y, point4.x, point4.y, num10, num11))
{
num47 = num22;
num48 = num23;
}
else
{
num47 = num10 - torg.x;
num48 = num11 - torg.y;
}
}
else
{
num47 = array6[2] - torg.x;
num48 = array6[3] - torg.y;
}
}
else if (this.IsBadTriangleAngle(point3.x, point3.y, point4.x, point4.y, point6.x, point6.y))
{
num47 = num22;
num48 = num23;
}
else
{
num47 = array3[2] - torg.x;
num48 = array3[3] - torg.y;
}
}
else
{
this.PointBetweenPoints(num67, num68, point.x, point.y, num10, num11, ref array6);
if (Math.Abs(array6[0] - 1.0) <= 1E-50 && array5[0] > 0.0)
{
if ((point2.x - num59) * (point2.x - num59) + (point2.y - num60) * (point2.y - num60) > num5 * ((point2.x - num10) * (point2.x - num10) + (point2.y - num11) * (point2.y - num11)) && this.IsBadTriangleAngle(point3.x, point3.y, point4.x, point4.y, num59, num60) && this.MinDistanceToNeighbor(num59, num60, ref otri) > this.MinDistanceToNeighbor(num10, num11, ref otri))
{
num47 = num59 - torg.x;
num48 = num60 - torg.y;
}
else if (this.IsBadTriangleAngle(point4.x, point4.y, point3.x, point3.y, num10, num11))
{
double num73 = Math.Sqrt((num10 - point.x) * (num10 - point.x) + (num11 - point.y) * (num11 - point.y));
double num74 = point.x - num10;
double num75 = point.y - num11;
num74 /= num73;
num75 /= num73;
num10 += num74 * num4 * Math.Sqrt(num27);
num11 += num75 * num4 * Math.Sqrt(num27);
if (this.IsBadTriangleAngle(point3.x, point3.y, point4.x, point4.y, num10, num11))
{
num47 = num22;
num48 = num23;
}
else
{
num47 = num10 - torg.x;
num48 = num11 - torg.y;
}
}
else
{
num47 = array6[2] - torg.x;
num48 = array6[3] - torg.y;
}
}
else if (this.IsBadTriangleAngle(point4.x, point4.y, point3.x, point3.y, num67, num68))
{
double num73 = Math.Sqrt((num67 - point.x) * (num67 - point.x) + (num68 - point.y) * (num68 - point.y));
double num74 = point.x - num67;
double num75 = point.y - num68;
num74 /= num73;
num75 /= num73;
num67 += num74 * num4 * Math.Sqrt(num27);
num68 += num75 * num4 * Math.Sqrt(num27);
if (this.IsBadTriangleAngle(point3.x, point3.y, point4.x, point4.y, num67, num68))
{
num47 = num22;
num48 = num23;
}
else
{
num47 = num67 - torg.x;
num48 = num68 - torg.y;
}
}
else
{
num47 = num67 - torg.x;
num48 = num68 - torg.y;
}
}
if ((point2.x - point.x) * (point2.x - point.x) + (point2.y - point.y) * (point2.y - point.y) > num5 * ((point2.x - (num47 + torg.x)) * (point2.x - (num47 + torg.x)) + (point2.y - (num48 + torg.y)) * (point2.y - (num48 + torg.y))))
{
num47 = num22;
num48 = num23;
}
}
}
bool neighborsVertex2 = this.GetNeighborsVertex(badotri, point4.x, point4.y, point2.x, point2.y, ref array, ref otri);
double num76 = num22;
double num77 = num23;
double num78 = (point4.x + point2.x) / 2.0;
double num79 = (point4.y + point2.y) / 2.0;
if (!neighborsVertex2)
{
Point point7 = otri.Org();
Vertex vertex = otri.Dest();
Vertex vertex2 = otri.Apex();
Point point6 = Primitives.FindCircumcenter(point7, vertex, vertex2, ref num2, ref num3);
double num65 = point4.y - point2.y;
double num66 = point2.x - point4.x;
num65 = point.x + num65;
num66 = point.y + num66;
this.CircleLineIntersection(point.x, point.y, num65, num66, num45, num46, num34, ref array2);
double num67;
double num68;
if (this.ChooseCorrectPoint(num78, num79, array2[3], array2[4], point.x, point.y, false))
{
num67 = array2[3];
num68 = array2[4];
}
else
{
num67 = array2[1];
num68 = array2[2];
}
double num69 = point4.x;
double num70 = point4.y;
num50 = point3.x - point4.x;
num51 = point3.y - point4.y;
double num71 = num61;
double num72 = num62;
this.LineLineIntersection(point.x, point.y, num65, num66, num69, num70, num71, num72, ref array5);
if (array5[0] > 0.0)
{
num10 = array5[1];
num11 = array5[2];
}
this.PointBetweenPoints(num67, num68, point.x, point.y, point6.x, point6.y, ref array3);
if (array2[0] > 0.0)
{
if (Math.Abs(array3[0] - 1.0) <= 1E-50)
{
this.PointBetweenPoints(array3[2], array3[3], point.x, point.y, num10, num11, ref array6);
if (Math.Abs(array6[0] - 1.0) <= 1E-50 && array5[0] > 0.0)
{
if ((point2.x - num61) * (point2.x - num61) + (point2.y - num62) * (point2.y - num62) > num5 * ((point2.x - num10) * (point2.x - num10) + (point2.y - num11) * (point2.y - num11)) && this.IsBadTriangleAngle(point3.x, point3.y, point4.x, point4.y, num61, num62) && this.MinDistanceToNeighbor(num61, num62, ref otri) > this.MinDistanceToNeighbor(num10, num11, ref otri))
{
num76 = num61 - torg.x;
num77 = num62 - torg.y;
}
else if (this.IsBadTriangleAngle(point3.x, point3.y, point4.x, point4.y, num10, num11))
{
double num73 = Math.Sqrt((num10 - point.x) * (num10 - point.x) + (num11 - point.y) * (num11 - point.y));
double num74 = point.x - num10;
double num75 = point.y - num11;
num74 /= num73;
num75 /= num73;
num10 += num74 * num4 * Math.Sqrt(num27);
num11 += num75 * num4 * Math.Sqrt(num27);
if (this.IsBadTriangleAngle(point3.x, point3.y, point4.x, point4.y, num10, num11))
{
num76 = num22;
num77 = num23;
}
else
{
num76 = num10 - torg.x;
num77 = num11 - torg.y;
}
}
else
{
num76 = array6[2] - torg.x;
num77 = array6[3] - torg.y;
}
}
else if (this.IsBadTriangleAngle(point3.x, point3.y, point4.x, point4.y, point6.x, point6.y))
{
num76 = num22;
num77 = num23;
}
else
{
num76 = array3[2] - torg.x;
num77 = array3[3] - torg.y;
}
}
else
{
this.PointBetweenPoints(num67, num68, point.x, point.y, num10, num11, ref array6);
if (Math.Abs(array6[0] - 1.0) <= 1E-50 && array5[0] > 0.0)
{
if ((point2.x - num61) * (point2.x - num61) + (point2.y - num62) * (point2.y - num62) > num5 * ((point2.x - num10) * (point2.x - num10) + (point2.y - num11) * (point2.y - num11)) && this.IsBadTriangleAngle(point3.x, point3.y, point4.x, point4.y, num61, num62) && this.MinDistanceToNeighbor(num61, num62, ref otri) > this.MinDistanceToNeighbor(num10, num11, ref otri))
{
num76 = num61 - torg.x;
num77 = num62 - torg.y;
}
else if (this.IsBadTriangleAngle(point4.x, point4.y, point3.x, point3.y, num10, num11))
{
double num73 = Math.Sqrt((num10 - point.x) * (num10 - point.x) + (num11 - point.y) * (num11 - point.y));
double num74 = point.x - num10;
double num75 = point.y - num11;
num74 /= num73;
num75 /= num73;
num10 += num74 * num4 * Math.Sqrt(num27);
num11 += num75 * num4 * Math.Sqrt(num27);
if (this.IsBadTriangleAngle(point3.x, point3.y, point4.x, point4.y, num10, num11))
{
num76 = num22;
num77 = num23;
}
else
{
num76 = num10 - torg.x;
num77 = num11 - torg.y;
}
}
else
{
num76 = array6[2] - torg.x;
num77 = array6[3] - torg.y;
}
}
else if (this.IsBadTriangleAngle(point3.x, point3.y, point4.x, point4.y, num67, num68))
{
double num73 = Math.Sqrt((num67 - point.x) * (num67 - point.x) + (num68 - point.y) * (num68 - point.y));
double num74 = point.x - num67;
double num75 = point.y - num68;
num74 /= num73;
num75 /= num73;
num67 += num74 * num4 * Math.Sqrt(num27);
num68 += num75 * num4 * Math.Sqrt(num27);
if (this.IsBadTriangleAngle(point3.x, point3.y, point4.x, point4.y, num67, num68))
{
num76 = num22;
num77 = num23;
}
else
{
num76 = num67 - torg.x;
num77 = num68 - torg.y;
}
}
else
{
num76 = num67 - torg.x;
num77 = num68 - torg.y;
}
}
if ((point2.x - point.x) * (point2.x - point.x) + (point2.y - point.y) * (point2.y - point.y) > num5 * ((point2.x - (num76 + torg.x)) * (point2.x - (num76 + torg.x)) + (point2.y - (num77 + torg.y)) * (point2.y - (num77 + torg.y))))
{
num76 = num22;
num77 = num23;
}
}
}
if (flag)
{
if (neighborsVertex && neighborsVertex2)
{
if (num6 * ((point2.x - num78) * (point2.x - num78) + (point2.y - num79) * (point2.y - num79)) > (point2.x - num63) * (point2.x - num63) + (point2.y - num64) * (point2.y - num64))
{
num22 = num76;
num23 = num77;
}
else
{
num22 = num47;
num23 = num48;
}
}
else if (neighborsVertex)
{
if (num6 * ((point2.x - (num76 + torg.x)) * (point2.x - (num76 + torg.x)) + (point2.y - (num77 + torg.y)) * (point2.y - (num77 + torg.y))) > (point2.x - num63) * (point2.x - num63) + (point2.y - num64) * (point2.y - num64))
{
num22 = num76;
num23 = num77;
}
else
{
num22 = num47;
num23 = num48;
}
}
else if (neighborsVertex2)
{
if (num6 * ((point2.x - num78) * (point2.x - num78) + (point2.y - num79) * (point2.y - num79)) > (point2.x - (num47 + torg.x)) * (point2.x - (num47 + torg.x)) + (point2.y - (num48 + torg.y)) * (point2.y - (num48 + torg.y)))
{
num22 = num76;
num23 = num77;
}
else
{
num22 = num47;
num23 = num48;
}
}
else if (num6 * ((point2.x - (num76 + torg.x)) * (point2.x - (num76 + torg.x)) + (point2.y - (num77 + torg.y)) * (point2.y - (num77 + torg.y))) > (point2.x - (num47 + torg.x)) * (point2.x - (num47 + torg.x)) + (point2.y - (num48 + torg.y)) * (point2.y - (num48 + torg.y)))
{
num22 = num76;
num23 = num77;
}
else
{
num22 = num47;
num23 = num48;
}
}
else if (neighborsVertex && neighborsVertex2)
{
if (num6 * ((point2.x - num78) * (point2.x - num78) + (point2.y - num79) * (point2.y - num79)) > (point2.x - num63) * (point2.x - num63) + (point2.y - num64) * (point2.y - num64))
{
num22 = num76;
num23 = num77;
}
else
{
num22 = num47;
num23 = num48;
}
}
else if (neighborsVertex)
{
if (num6 * ((point2.x - (num76 + torg.x)) * (point2.x - (num76 + torg.x)) + (point2.y - (num77 + torg.y)) * (point2.y - (num77 + torg.y))) > (point2.x - num63) * (point2.x - num63) + (point2.y - num64) * (point2.y - num64))
{
num22 = num76;
num23 = num77;
}
else
{
num22 = num47;
num23 = num48;
}
}
else if (neighborsVertex2)
{
if (num6 * ((point2.x - num78) * (point2.x - num78) + (point2.y - num79) * (point2.y - num79)) > (point2.x - (num47 + torg.x)) * (point2.x - (num47 + torg.x)) + (point2.y - (num48 + torg.y)) * (point2.y - (num48 + torg.y)))
{
num22 = num76;
num23 = num77;
}
else
{
num22 = num47;
num23 = num48;
}
}
else if (num6 * ((point2.x - (num76 + torg.x)) * (point2.x - (num76 + torg.x)) + (point2.y - (num77 + torg.y)) * (point2.y - (num77 + torg.y))) > (point2.x - (num47 + torg.x)) * (point2.x - (num47 + torg.x)) + (point2.y - (num48 + torg.y)) * (point2.y - (num48 + torg.y)))
{
num22 = num76;
num23 = num77;
}
else
{
num22 = num47;
num23 = num48;
}
}
}
Point point8 = new Point();
if (num7 <= 0)
{
point8.x = torg.x + num22;
point8.y = torg.y + num23;
}
else
{
point8.x = num8 + num22;
point8.y = num9 + num23;
}
xi = (num15 * num22 - num14 * num23) * (2.0 * num21);
eta = (num12 * num23 - num13 * num22) * (2.0 * num21);
return point8;
}
// Token: 0x06000040 RID: 64 RVA: 0x00006C54 File Offset: 0x00004E54
private int LongestShortestEdge(double aodist, double dadist, double dodist)
{
int num;
int num2;
int num3;
if (dodist < aodist && dodist < dadist)
{
num = 3;
if (aodist < dadist)
{
num2 = 2;
num3 = 1;
}
else
{
num2 = 1;
num3 = 2;
}
}
else if (aodist < dadist)
{
num = 1;
if (dodist < dadist)
{
num2 = 2;
num3 = 3;
}
else
{
num2 = 3;
num3 = 2;
}
}
else
{
num = 2;
if (aodist < dodist)
{
num2 = 3;
num3 = 1;
}
else
{
num2 = 1;
num3 = 3;
}
}
return num * 100 + num3 * 10 + num2;
}
// Token: 0x06000041 RID: 65 RVA: 0x00006CB4 File Offset: 0x00004EB4
private int DoSmoothing(Otri badotri, Vertex torg, Vertex tdest, Vertex tapex, ref double[] newloc)
{
double[] array = new double[6];
int num = 0;
int num2 = 0;
int num3 = 0;
int num4 = 0;
int starPoints = this.GetStarPoints(badotri, torg, tdest, tapex, 1, ref this.points_p);
if (torg.type == VertexType.FreeVertex && starPoints != 0 && this.ValidPolygonAngles(starPoints, this.points_p))
{
bool flag;
if (this.behavior.MaxAngle == 0.0)
{
flag = this.GetWedgeIntersectionWithoutMaxAngle(starPoints, this.points_p, ref newloc);
}
else
{
flag = this.GetWedgeIntersection(starPoints, this.points_p, ref newloc);
}
if (flag)
{
array[0] = newloc[0];
array[1] = newloc[1];
num++;
num2 = 1;
}
}
int starPoints2 = this.GetStarPoints(badotri, torg, tdest, tapex, 2, ref this.points_q);
if (tdest.type == VertexType.FreeVertex && starPoints2 != 0 && this.ValidPolygonAngles(starPoints2, this.points_q))
{
bool flag;
if (this.behavior.MaxAngle == 0.0)
{
flag = this.GetWedgeIntersectionWithoutMaxAngle(starPoints2, this.points_q, ref newloc);
}
else
{
flag = this.GetWedgeIntersection(starPoints2, this.points_q, ref newloc);
}
if (flag)
{
array[2] = newloc[0];
array[3] = newloc[1];
num++;
num3 = 2;
}
}
int starPoints3 = this.GetStarPoints(badotri, torg, tdest, tapex, 3, ref this.points_r);
if (tapex.type == VertexType.FreeVertex && starPoints3 != 0 && this.ValidPolygonAngles(starPoints3, this.points_r))
{
bool flag;
if (this.behavior.MaxAngle == 0.0)
{
flag = this.GetWedgeIntersectionWithoutMaxAngle(starPoints3, this.points_r, ref newloc);
}
else
{
flag = this.GetWedgeIntersection(starPoints3, this.points_r, ref newloc);
}
if (flag)
{
array[4] = newloc[0];
array[5] = newloc[1];
num++;
num4 = 3;
}
}
if (num > 0)
{
if (num2 > 0)
{
newloc[0] = array[0];
newloc[1] = array[1];
return num2;
}
if (num3 > 0)
{
newloc[0] = array[2];
newloc[1] = array[3];
return num3;
}
if (num4 > 0)
{
newloc[0] = array[4];
newloc[1] = array[5];
return num4;
}
}
return 0;
}
// Token: 0x06000042 RID: 66 RVA: 0x00006EBC File Offset: 0x000050BC
private int GetStarPoints(Otri badotri, Vertex p, Vertex q, Vertex r, int whichPoint, ref double[] points)
{
Otri otri = default(Otri);
double num = 0.0;
double num2 = 0.0;
double num3 = 0.0;
double num4 = 0.0;
double num5 = 0.0;
double num6 = 0.0;
double[] array = new double[2];
int num7 = 0;
switch (whichPoint)
{
case 1:
num = p.x;
num2 = p.y;
num3 = r.x;
num4 = r.y;
num5 = q.x;
num6 = q.y;
break;
case 2:
num = q.x;
num2 = q.y;
num3 = p.x;
num4 = p.y;
num5 = r.x;
num6 = r.y;
break;
case 3:
num = r.x;
num2 = r.y;
num3 = q.x;
num4 = q.y;
num5 = p.x;
num6 = p.y;
break;
}
Otri otri2 = badotri;
points[num7] = num3;
num7++;
points[num7] = num4;
num7++;
array[0] = num3;
array[1] = num4;
while (!this.GetNeighborsVertex(otri2, num, num2, num3, num4, ref array, ref otri))
{
otri2 = otri;
num3 = array[0];
num4 = array[1];
points[num7] = array[0];
num7++;
points[num7] = array[1];
num7++;
if (Math.Abs(array[0] - num5) <= 1E-50 && Math.Abs(array[1] - num6) <= 1E-50)
{
IL_1A1:
return num7 / 2;
}
}
num7 = 0;
goto IL_1A1;
}
// Token: 0x06000043 RID: 67 RVA: 0x00007070 File Offset: 0x00005270
private bool GetNeighborsVertex(Otri badotri, double first_x, double first_y, double second_x, double second_y, ref double[] thirdpoint, ref Otri neighotri)
{
Otri otri = default(Otri);
bool flag = false;
Vertex vertex = null;
Vertex vertex2 = null;
Vertex vertex3 = null;
int num = 0;
int num2 = 0;
badotri.orient = 0;
while (badotri.orient < 3)
{
badotri.Sym(ref otri);
if (otri.triangle != Mesh.dummytri)
{
vertex = otri.Org();
vertex2 = otri.Dest();
vertex3 = otri.Apex();
if ((vertex.x != vertex2.x || vertex.y != vertex2.y) && (vertex2.x != vertex3.x || vertex2.y != vertex3.y) && (vertex.x != vertex3.x || vertex.y != vertex3.y))
{
num = 0;
if (Math.Abs(first_x - vertex.x) < 1E-50 && Math.Abs(first_y - vertex.y) < 1E-50)
{
num = 11;
}
else if (Math.Abs(first_x - vertex2.x) < 1E-50 && Math.Abs(first_y - vertex2.y) < 1E-50)
{
num = 12;
}
else if (Math.Abs(first_x - vertex3.x) < 1E-50 && Math.Abs(first_y - vertex3.y) < 1E-50)
{
num = 13;
}
num2 = 0;
if (Math.Abs(second_x - vertex.x) < 1E-50 && Math.Abs(second_y - vertex.y) < 1E-50)
{
num2 = 21;
}
else if (Math.Abs(second_x - vertex2.x) < 1E-50 && Math.Abs(second_y - vertex2.y) < 1E-50)
{
num2 = 22;
}
else if (Math.Abs(second_x - vertex3.x) < 1E-50 && Math.Abs(second_y - vertex3.y) < 1E-50)
{
num2 = 23;
}
}
}
if ((num == 11 && (num2 == 22 || num2 == 23)) || (num == 12 && (num2 == 21 || num2 == 23)) || (num == 13 && (num2 == 21 || num2 == 22)))
{
break;
}
badotri.orient++;
}
if (num != 0)
{
switch (num)
{
case 11:
if (num2 == 22)
{
thirdpoint[0] = vertex3.x;
thirdpoint[1] = vertex3.y;
}
else if (num2 == 23)
{
thirdpoint[0] = vertex2.x;
thirdpoint[1] = vertex2.y;
}
else
{
flag = true;
}
break;
case 12:
if (num2 == 21)
{
thirdpoint[0] = vertex3.x;
thirdpoint[1] = vertex3.y;
}
else if (num2 == 23)
{
thirdpoint[0] = vertex.x;
thirdpoint[1] = vertex.y;
}
else
{
flag = true;
}
break;
case 13:
if (num2 == 21)
{
thirdpoint[0] = vertex2.x;
thirdpoint[1] = vertex2.y;
}
else if (num2 == 22)
{
thirdpoint[0] = vertex.x;
thirdpoint[1] = vertex.y;
}
else
{
flag = true;
}
break;
default:
if (num2 == 0)
{
flag = true;
}
break;
}
}
else
{
flag = true;
}
neighotri = otri;
return flag;
}
// Token: 0x06000044 RID: 68 RVA: 0x000073D4 File Offset: 0x000055D4
private bool GetWedgeIntersectionWithoutMaxAngle(int numpoints, double[] points, ref double[] newloc)
{
if (2 * numpoints > this.petalx.Length)
{
this.petalx = new double[2 * numpoints];
this.petaly = new double[2 * numpoints];
this.petalr = new double[2 * numpoints];
this.wedges = new double[2 * numpoints * 16 + 36];
if (Behavior.Verbose)
{
SimpleLog.Instance.Info("NewLocation: resized work arrays (" + 2 * numpoints + ")");
}
}
double[] array = new double[3];
int num = 0;
double num2 = points[2 * numpoints - 4];
double num3 = points[2 * numpoints - 3];
double num4 = points[2 * numpoints - 2];
double num5 = points[2 * numpoints - 1];
double num6 = this.behavior.MinAngle * 3.141592653589793 / 180.0;
double num7;
double num8;
if (this.behavior.goodAngle == 1.0)
{
num7 = 0.0;
num8 = 0.0;
}
else
{
num7 = 0.5 / Math.Tan(num6);
num8 = 0.5 / Math.Sin(num6);
}
for (int i = 0; i < numpoints * 2; i += 2)
{
double num9 = points[i];
double num10 = points[i + 1];
double num11 = num4 - num2;
double num12 = num5 - num3;
double num13 = Math.Sqrt(num11 * num11 + num12 * num12);
this.petalx[i / 2] = num2 + 0.5 * num11 - num7 * num12;
this.petaly[i / 2] = num3 + 0.5 * num12 + num7 * num11;
this.petalr[i / 2] = num8 * num13;
this.petalx[numpoints + i / 2] = this.petalx[i / 2];
this.petaly[numpoints + i / 2] = this.petaly[i / 2];
this.petalr[numpoints + i / 2] = this.petalr[i / 2];
double num14 = (num2 + num4) / 2.0;
double num15 = (num3 + num5) / 2.0;
double num16 = Math.Sqrt((this.petalx[i / 2] - num14) * (this.petalx[i / 2] - num14) + (this.petaly[i / 2] - num15) * (this.petaly[i / 2] - num15));
double num17 = (this.petalx[i / 2] - num14) / num16;
double num18 = (this.petaly[i / 2] - num15) / num16;
double num19 = this.petalx[i / 2] + num17 * this.petalr[i / 2];
double num20 = this.petaly[i / 2] + num18 * this.petalr[i / 2];
num17 = num4 - num2;
num18 = num5 - num3;
double num21 = num4 * Math.Cos(num6) - num5 * Math.Sin(num6) + num2 - num2 * Math.Cos(num6) + num3 * Math.Sin(num6);
double num22 = num4 * Math.Sin(num6) + num5 * Math.Cos(num6) + num3 - num2 * Math.Sin(num6) - num3 * Math.Cos(num6);
this.wedges[i * 16] = num2;
this.wedges[i * 16 + 1] = num3;
this.wedges[i * 16 + 2] = num21;
this.wedges[i * 16 + 3] = num22;
num17 = num2 - num4;
num18 = num3 - num5;
double num23 = num2 * Math.Cos(num6) + num3 * Math.Sin(num6) + num4 - num4 * Math.Cos(num6) - num5 * Math.Sin(num6);
double num24 = -num2 * Math.Sin(num6) + num3 * Math.Cos(num6) + num5 + num4 * Math.Sin(num6) - num5 * Math.Cos(num6);
this.wedges[i * 16 + 4] = num23;
this.wedges[i * 16 + 5] = num24;
this.wedges[i * 16 + 6] = num4;
this.wedges[i * 16 + 7] = num5;
num17 = num19 - this.petalx[i / 2];
num18 = num20 - this.petaly[i / 2];
double num25 = num19;
double num26 = num20;
for (int j = 1; j < 4; j++)
{
double num27 = num19 * Math.Cos((1.0471975511965976 - num6) * (double)j) + num20 * Math.Sin((1.0471975511965976 - num6) * (double)j) + this.petalx[i / 2] - this.petalx[i / 2] * Math.Cos((1.0471975511965976 - num6) * (double)j) - this.petaly[i / 2] * Math.Sin((1.0471975511965976 - num6) * (double)j);
double num28 = -num19 * Math.Sin((1.0471975511965976 - num6) * (double)j) + num20 * Math.Cos((1.0471975511965976 - num6) * (double)j) + this.petaly[i / 2] + this.petalx[i / 2] * Math.Sin((1.0471975511965976 - num6) * (double)j) - this.petaly[i / 2] * Math.Cos((1.0471975511965976 - num6) * (double)j);
this.wedges[i * 16 + 8 + 4 * (j - 1)] = num27;
this.wedges[i * 16 + 9 + 4 * (j - 1)] = num28;
this.wedges[i * 16 + 10 + 4 * (j - 1)] = num25;
this.wedges[i * 16 + 11 + 4 * (j - 1)] = num26;
num25 = num27;
num26 = num28;
}
num25 = num19;
num26 = num20;
for (int j = 1; j < 4; j++)
{
double num29 = num19 * Math.Cos((1.0471975511965976 - num6) * (double)j) - num20 * Math.Sin((1.0471975511965976 - num6) * (double)j) + this.petalx[i / 2] - this.petalx[i / 2] * Math.Cos((1.0471975511965976 - num6) * (double)j) + this.petaly[i / 2] * Math.Sin((1.0471975511965976 - num6) * (double)j);
double num30 = num19 * Math.Sin((1.0471975511965976 - num6) * (double)j) + num20 * Math.Cos((1.0471975511965976 - num6) * (double)j) + this.petaly[i / 2] - this.petalx[i / 2] * Math.Sin((1.0471975511965976 - num6) * (double)j) - this.petaly[i / 2] * Math.Cos((1.0471975511965976 - num6) * (double)j);
this.wedges[i * 16 + 20 + 4 * (j - 1)] = num25;
this.wedges[i * 16 + 21 + 4 * (j - 1)] = num26;
this.wedges[i * 16 + 22 + 4 * (j - 1)] = num29;
this.wedges[i * 16 + 23 + 4 * (j - 1)] = num30;
num25 = num29;
num26 = num30;
}
if (i == 0)
{
this.LineLineIntersection(num2, num3, num21, num22, num4, num5, num23, num24, ref array);
if (array[0] == 1.0)
{
this.initialConvexPoly[0] = array[1];
this.initialConvexPoly[1] = array[2];
this.initialConvexPoly[2] = this.wedges[i * 16 + 16];
this.initialConvexPoly[3] = this.wedges[i * 16 + 17];
this.initialConvexPoly[4] = this.wedges[i * 16 + 12];
this.initialConvexPoly[5] = this.wedges[i * 16 + 13];
this.initialConvexPoly[6] = this.wedges[i * 16 + 8];
this.initialConvexPoly[7] = this.wedges[i * 16 + 9];
this.initialConvexPoly[8] = num19;
this.initialConvexPoly[9] = num20;
this.initialConvexPoly[10] = this.wedges[i * 16 + 22];
this.initialConvexPoly[11] = this.wedges[i * 16 + 23];
this.initialConvexPoly[12] = this.wedges[i * 16 + 26];
this.initialConvexPoly[13] = this.wedges[i * 16 + 27];
this.initialConvexPoly[14] = this.wedges[i * 16 + 30];
this.initialConvexPoly[15] = this.wedges[i * 16 + 31];
}
}
num2 = num4;
num3 = num5;
num4 = num9;
num5 = num10;
}
if (numpoints != 0)
{
int num31 = (numpoints - 1) / 2 + 1;
int num32 = 0;
int k = 0;
int i = 1;
int num33 = 8;
for (int j = 0; j < 32; j += 4)
{
num = this.HalfPlaneIntersection(num33, ref this.initialConvexPoly, this.wedges[32 * num31 + j], this.wedges[32 * num31 + 1 + j], this.wedges[32 * num31 + 2 + j], this.wedges[32 * num31 + 3 + j]);
if (num == 0)
{
return false;
}
num33 = num;
}
for (k++; k < numpoints - 1; k++)
{
for (int j = 0; j < 32; j += 4)
{
num = this.HalfPlaneIntersection(num33, ref this.initialConvexPoly, this.wedges[32 * (i + num31 * num32) + j], this.wedges[32 * (i + num31 * num32) + 1 + j], this.wedges[32 * (i + num31 * num32) + 2 + j], this.wedges[32 * (i + num31 * num32) + 3 + j]);
if (num == 0)
{
return false;
}
num33 = num;
}
i += num32;
num32 = (num32 + 1) % 2;
}
this.FindPolyCentroid(num, this.initialConvexPoly, ref newloc);
if (!this.behavior.fixedArea)
{
return true;
}
}
return false;
}
// Token: 0x06000045 RID: 69 RVA: 0x00007DD0 File Offset: 0x00005FD0
private bool GetWedgeIntersection(int numpoints, double[] points, ref double[] newloc)
{
if (2 * numpoints > this.petalx.Length)
{
this.petalx = new double[2 * numpoints];
this.petaly = new double[2 * numpoints];
this.petalr = new double[2 * numpoints];
this.wedges = new double[2 * numpoints * 20 + 40];
if (Behavior.Verbose)
{
SimpleLog.Instance.Info("NewLocation: resized work arrays (" + 2 * numpoints + ")");
}
}
double[] array = new double[3];
double[] array2 = new double[3];
double[] array3 = new double[3];
double[] array4 = new double[3];
int num = 0;
int num2 = 0;
double num3 = points[2 * numpoints - 4];
double num4 = points[2 * numpoints - 3];
double num5 = points[2 * numpoints - 2];
double num6 = points[2 * numpoints - 1];
double num7 = this.behavior.MinAngle * 3.141592653589793 / 180.0;
double num8 = Math.Sin(num7);
double num9 = Math.Cos(num7);
double num10 = this.behavior.MaxAngle * 3.141592653589793 / 180.0;
double num11 = Math.Sin(num10);
double num12 = Math.Cos(num10);
double num13;
double num14;
if (this.behavior.goodAngle == 1.0)
{
num13 = 0.0;
num14 = 0.0;
}
else
{
num13 = 0.5 / Math.Tan(num7);
num14 = 0.5 / Math.Sin(num7);
}
for (int i = 0; i < numpoints * 2; i += 2)
{
double num15 = points[i];
double num16 = points[i + 1];
double num17 = num5 - num3;
double num18 = num6 - num4;
double num19 = Math.Sqrt(num17 * num17 + num18 * num18);
this.petalx[i / 2] = num3 + 0.5 * num17 - num13 * num18;
this.petaly[i / 2] = num4 + 0.5 * num18 + num13 * num17;
this.petalr[i / 2] = num14 * num19;
this.petalx[numpoints + i / 2] = this.petalx[i / 2];
this.petaly[numpoints + i / 2] = this.petaly[i / 2];
this.petalr[numpoints + i / 2] = this.petalr[i / 2];
double num20 = (num3 + num5) / 2.0;
double num21 = (num4 + num6) / 2.0;
double num22 = Math.Sqrt((this.petalx[i / 2] - num20) * (this.petalx[i / 2] - num20) + (this.petaly[i / 2] - num21) * (this.petaly[i / 2] - num21));
double num23 = (this.petalx[i / 2] - num20) / num22;
double num24 = (this.petaly[i / 2] - num21) / num22;
double num25 = this.petalx[i / 2] + num23 * this.petalr[i / 2];
double num26 = this.petaly[i / 2] + num24 * this.petalr[i / 2];
num23 = num5 - num3;
num24 = num6 - num4;
double num27 = num5 * num9 - num6 * num8 + num3 - num3 * num9 + num4 * num8;
double num28 = num5 * num8 + num6 * num9 + num4 - num3 * num8 - num4 * num9;
this.wedges[i * 20] = num3;
this.wedges[i * 20 + 1] = num4;
this.wedges[i * 20 + 2] = num27;
this.wedges[i * 20 + 3] = num28;
num23 = num3 - num5;
num24 = num4 - num6;
double num29 = num3 * num9 + num4 * num8 + num5 - num5 * num9 - num6 * num8;
double num30 = -num3 * num8 + num4 * num9 + num6 + num5 * num8 - num6 * num9;
this.wedges[i * 20 + 4] = num29;
this.wedges[i * 20 + 5] = num30;
this.wedges[i * 20 + 6] = num5;
this.wedges[i * 20 + 7] = num6;
num23 = num25 - this.petalx[i / 2];
num24 = num26 - this.petaly[i / 2];
double num31 = num25;
double num32 = num26;
num7 = 2.0 * this.behavior.MaxAngle + this.behavior.MinAngle - 180.0;
double num33;
double num34;
if (num7 <= 0.0)
{
num2 = 4;
num33 = 1.0;
num34 = 1.0;
}
else if (num7 <= 5.0)
{
num2 = 6;
num33 = 2.0;
num34 = 2.0;
}
else if (num7 <= 10.0)
{
num2 = 8;
num33 = 3.0;
num34 = 3.0;
}
else
{
num2 = 10;
num33 = 4.0;
num34 = 4.0;
}
num7 = num7 * 3.141592653589793 / 180.0;
int j = 1;
while ((double)j < num33)
{
if (num33 != 1.0)
{
double num35 = num25 * Math.Cos(num7 / (num33 - 1.0) * (double)j) + num26 * Math.Sin(num7 / (num33 - 1.0) * (double)j) + this.petalx[i / 2] - this.petalx[i / 2] * Math.Cos(num7 / (num33 - 1.0) * (double)j) - this.petaly[i / 2] * Math.Sin(num7 / (num33 - 1.0) * (double)j);
double num36 = -num25 * Math.Sin(num7 / (num33 - 1.0) * (double)j) + num26 * Math.Cos(num7 / (num33 - 1.0) * (double)j) + this.petaly[i / 2] + this.petalx[i / 2] * Math.Sin(num7 / (num33 - 1.0) * (double)j) - this.petaly[i / 2] * Math.Cos(num7 / (num33 - 1.0) * (double)j);
this.wedges[i * 20 + 8 + 4 * (j - 1)] = num35;
this.wedges[i * 20 + 9 + 4 * (j - 1)] = num36;
this.wedges[i * 20 + 10 + 4 * (j - 1)] = num31;
this.wedges[i * 20 + 11 + 4 * (j - 1)] = num32;
num31 = num35;
num32 = num36;
}
j++;
}
num23 = num3 - num5;
num24 = num4 - num6;
double num37 = num3 * num12 + num4 * num11 + num5 - num5 * num12 - num6 * num11;
double num38 = -num3 * num11 + num4 * num12 + num6 + num5 * num11 - num6 * num12;
this.wedges[i * 20 + 20] = num5;
this.wedges[i * 20 + 21] = num6;
this.wedges[i * 20 + 22] = num37;
this.wedges[i * 20 + 23] = num38;
num31 = num25;
num32 = num26;
j = 1;
while ((double)j < num34)
{
if (num34 != 1.0)
{
double num39 = num25 * Math.Cos(num7 / (num34 - 1.0) * (double)j) - num26 * Math.Sin(num7 / (num34 - 1.0) * (double)j) + this.petalx[i / 2] - this.petalx[i / 2] * Math.Cos(num7 / (num34 - 1.0) * (double)j) + this.petaly[i / 2] * Math.Sin(num7 / (num34 - 1.0) * (double)j);
double num40 = num25 * Math.Sin(num7 / (num34 - 1.0) * (double)j) + num26 * Math.Cos(num7 / (num34 - 1.0) * (double)j) + this.petaly[i / 2] - this.petalx[i / 2] * Math.Sin(num7 / (num34 - 1.0) * (double)j) - this.petaly[i / 2] * Math.Cos(num7 / (num34 - 1.0) * (double)j);
this.wedges[i * 20 + 24 + 4 * (j - 1)] = num31;
this.wedges[i * 20 + 25 + 4 * (j - 1)] = num32;
this.wedges[i * 20 + 26 + 4 * (j - 1)] = num39;
this.wedges[i * 20 + 27 + 4 * (j - 1)] = num40;
num31 = num39;
num32 = num40;
}
j++;
}
num23 = num5 - num3;
num24 = num6 - num4;
double num41 = num5 * num12 - num6 * num11 + num3 - num3 * num12 + num4 * num11;
double num42 = num5 * num11 + num6 * num12 + num4 - num3 * num11 - num4 * num12;
this.wedges[i * 20 + 36] = num41;
this.wedges[i * 20 + 37] = num42;
this.wedges[i * 20 + 38] = num3;
this.wedges[i * 20 + 39] = num4;
if (i == 0)
{
switch (num2)
{
case 4:
this.LineLineIntersection(num3, num4, num27, num28, num5, num6, num29, num30, ref array);
this.LineLineIntersection(num3, num4, num27, num28, num5, num6, num37, num38, ref array2);
this.LineLineIntersection(num3, num4, num41, num42, num5, num6, num37, num38, ref array3);
this.LineLineIntersection(num3, num4, num41, num42, num5, num6, num29, num30, ref array4);
if (array[0] == 1.0 && array2[0] == 1.0 && array3[0] == 1.0 && array4[0] == 1.0)
{
this.initialConvexPoly[0] = array[1];
this.initialConvexPoly[1] = array[2];
this.initialConvexPoly[2] = array2[1];
this.initialConvexPoly[3] = array2[2];
this.initialConvexPoly[4] = array3[1];
this.initialConvexPoly[5] = array3[2];
this.initialConvexPoly[6] = array4[1];
this.initialConvexPoly[7] = array4[2];
}
break;
case 6:
this.LineLineIntersection(num3, num4, num27, num28, num5, num6, num29, num30, ref array);
this.LineLineIntersection(num3, num4, num27, num28, num5, num6, num37, num38, ref array2);
this.LineLineIntersection(num3, num4, num41, num42, num5, num6, num29, num30, ref array3);
if (array[0] == 1.0 && array2[0] == 1.0 && array3[0] == 1.0)
{
this.initialConvexPoly[0] = array[1];
this.initialConvexPoly[1] = array[2];
this.initialConvexPoly[2] = array2[1];
this.initialConvexPoly[3] = array2[2];
this.initialConvexPoly[4] = this.wedges[i * 20 + 8];
this.initialConvexPoly[5] = this.wedges[i * 20 + 9];
this.initialConvexPoly[6] = num25;
this.initialConvexPoly[7] = num26;
this.initialConvexPoly[8] = this.wedges[i * 20 + 26];
this.initialConvexPoly[9] = this.wedges[i * 20 + 27];
this.initialConvexPoly[10] = array3[1];
this.initialConvexPoly[11] = array3[2];
}
break;
case 8:
this.LineLineIntersection(num3, num4, num27, num28, num5, num6, num29, num30, ref array);
this.LineLineIntersection(num3, num4, num27, num28, num5, num6, num37, num38, ref array2);
this.LineLineIntersection(num3, num4, num41, num42, num5, num6, num29, num30, ref array3);
if (array[0] == 1.0 && array2[0] == 1.0 && array3[0] == 1.0)
{
this.initialConvexPoly[0] = array[1];
this.initialConvexPoly[1] = array[2];
this.initialConvexPoly[2] = array2[1];
this.initialConvexPoly[3] = array2[2];
this.initialConvexPoly[4] = this.wedges[i * 20 + 12];
this.initialConvexPoly[5] = this.wedges[i * 20 + 13];
this.initialConvexPoly[6] = this.wedges[i * 20 + 8];
this.initialConvexPoly[7] = this.wedges[i * 20 + 9];
this.initialConvexPoly[8] = num25;
this.initialConvexPoly[9] = num26;
this.initialConvexPoly[10] = this.wedges[i * 20 + 26];
this.initialConvexPoly[11] = this.wedges[i * 20 + 27];
this.initialConvexPoly[12] = this.wedges[i * 20 + 30];
this.initialConvexPoly[13] = this.wedges[i * 20 + 31];
this.initialConvexPoly[14] = array3[1];
this.initialConvexPoly[15] = array3[2];
}
break;
case 10:
this.LineLineIntersection(num3, num4, num27, num28, num5, num6, num29, num30, ref array);
this.LineLineIntersection(num3, num4, num27, num28, num5, num6, num37, num38, ref array2);
this.LineLineIntersection(num3, num4, num41, num42, num5, num6, num29, num30, ref array3);
if (array[0] == 1.0 && array2[0] == 1.0 && array3[0] == 1.0)
{
this.initialConvexPoly[0] = array[1];
this.initialConvexPoly[1] = array[2];
this.initialConvexPoly[2] = array2[1];
this.initialConvexPoly[3] = array2[2];
this.initialConvexPoly[4] = this.wedges[i * 20 + 16];
this.initialConvexPoly[5] = this.wedges[i * 20 + 17];
this.initialConvexPoly[6] = this.wedges[i * 20 + 12];
this.initialConvexPoly[7] = this.wedges[i * 20 + 13];
this.initialConvexPoly[8] = this.wedges[i * 20 + 8];
this.initialConvexPoly[9] = this.wedges[i * 20 + 9];
this.initialConvexPoly[10] = num25;
this.initialConvexPoly[11] = num26;
this.initialConvexPoly[12] = this.wedges[i * 20 + 28];
this.initialConvexPoly[13] = this.wedges[i * 20 + 29];
this.initialConvexPoly[14] = this.wedges[i * 20 + 32];
this.initialConvexPoly[15] = this.wedges[i * 20 + 33];
this.initialConvexPoly[16] = this.wedges[i * 20 + 34];
this.initialConvexPoly[17] = this.wedges[i * 20 + 35];
this.initialConvexPoly[18] = array3[1];
this.initialConvexPoly[19] = array3[2];
}
break;
}
}
num3 = num5;
num4 = num6;
num5 = num15;
num6 = num16;
}
if (numpoints != 0)
{
int num43 = (numpoints - 1) / 2 + 1;
int num44 = 0;
int k = 0;
int i = 1;
int num45 = num2;
for (int j = 0; j < 40; j += 4)
{
if ((num2 != 4 || (j != 8 && j != 12 && j != 16 && j != 24 && j != 28 && j != 32)) && (num2 != 6 || (j != 12 && j != 16 && j != 28 && j != 32)) && (num2 != 8 || (j != 16 && j != 32)))
{
num = this.HalfPlaneIntersection(num45, ref this.initialConvexPoly, this.wedges[40 * num43 + j], this.wedges[40 * num43 + 1 + j], this.wedges[40 * num43 + 2 + j], this.wedges[40 * num43 + 3 + j]);
if (num == 0)
{
return false;
}
num45 = num;
}
}
for (k++; k < numpoints - 1; k++)
{
for (int j = 0; j < 40; j += 4)
{
if ((num2 != 4 || (j != 8 && j != 12 && j != 16 && j != 24 && j != 28 && j != 32)) && (num2 != 6 || (j != 12 && j != 16 && j != 28 && j != 32)) && (num2 != 8 || (j != 16 && j != 32)))
{
num = this.HalfPlaneIntersection(num45, ref this.initialConvexPoly, this.wedges[40 * (i + num43 * num44) + j], this.wedges[40 * (i + num43 * num44) + 1 + j], this.wedges[40 * (i + num43 * num44) + 2 + j], this.wedges[40 * (i + num43 * num44) + 3 + j]);
if (num == 0)
{
return false;
}
num45 = num;
}
}
i += num44;
num44 = (num44 + 1) % 2;
}
this.FindPolyCentroid(num, this.initialConvexPoly, ref newloc);
if (this.behavior.MaxAngle == 0.0)
{
return true;
}
int num46 = 0;
for (int j = 0; j < numpoints * 2 - 2; j += 2)
{
if (this.IsBadTriangleAngle(newloc[0], newloc[1], points[j], points[j + 1], points[j + 2], points[j + 3]))
{
num46++;
}
}
if (this.IsBadTriangleAngle(newloc[0], newloc[1], points[0], points[1], points[numpoints * 2 - 2], points[numpoints * 2 - 1]))
{
num46++;
}
if (num46 == 0)
{
return true;
}
int num47 = ((numpoints <= 2) ? 20 : 30);
for (int l = 0; l < 2 * numpoints; l += 2)
{
for (int m = 1; m < num47; m++)
{
newloc[0] = 0.0;
newloc[1] = 0.0;
for (i = 0; i < 2 * numpoints; i += 2)
{
double num48 = 1.0 / (double)numpoints;
if (i == l)
{
newloc[0] = newloc[0] + 0.1 * (double)m * num48 * points[i];
newloc[1] = newloc[1] + 0.1 * (double)m * num48 * points[i + 1];
}
else
{
num48 = (1.0 - 0.1 * (double)m * num48) / ((double)numpoints - 1.0);
newloc[0] = newloc[0] + num48 * points[i];
newloc[1] = newloc[1] + num48 * points[i + 1];
}
}
num46 = 0;
for (int j = 0; j < numpoints * 2 - 2; j += 2)
{
if (this.IsBadTriangleAngle(newloc[0], newloc[1], points[j], points[j + 1], points[j + 2], points[j + 3]))
{
num46++;
}
}
if (this.IsBadTriangleAngle(newloc[0], newloc[1], points[0], points[1], points[numpoints * 2 - 2], points[numpoints * 2 - 1]))
{
num46++;
}
if (num46 == 0)
{
return true;
}
}
}
}
return false;
}
// Token: 0x06000046 RID: 70 RVA: 0x00009160 File Offset: 0x00007360
private bool ValidPolygonAngles(int numpoints, double[] points)
{
for (int i = 0; i < numpoints; i++)
{
if (i == numpoints - 1)
{
if (this.IsBadPolygonAngle(points[i * 2], points[i * 2 + 1], points[0], points[1], points[2], points[3]))
{
return false;
}
}
else if (i == numpoints - 2)
{
if (this.IsBadPolygonAngle(points[i * 2], points[i * 2 + 1], points[(i + 1) * 2], points[(i + 1) * 2 + 1], points[0], points[1]))
{
return false;
}
}
else if (this.IsBadPolygonAngle(points[i * 2], points[i * 2 + 1], points[(i + 1) * 2], points[(i + 1) * 2 + 1], points[(i + 2) * 2], points[(i + 2) * 2 + 1]))
{
return false;
}
}
return true;
}
// Token: 0x06000047 RID: 71 RVA: 0x00009210 File Offset: 0x00007410
private bool IsBadPolygonAngle(double x1, double y1, double x2, double y2, double x3, double y3)
{
double num = x1 - x2;
double num2 = y1 - y2;
double num3 = x2 - x3;
double num4 = y2 - y3;
double num5 = x3 - x1;
double num6 = y3 - y1;
double num7 = num * num + num2 * num2;
double num8 = num3 * num3 + num4 * num4;
double num9 = num5 * num5 + num6 * num6;
return Math.Acos((num7 + num8 - num9) / (2.0 * Math.Sqrt(num7) * Math.Sqrt(num8))) < 2.0 * Math.Acos(Math.Sqrt(this.behavior.goodAngle));
}
// Token: 0x06000048 RID: 72 RVA: 0x000092A4 File Offset: 0x000074A4
private void LineLineIntersection(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4, ref double[] p)
{
double num = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);
double num2 = (x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3);
double num3 = (x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3);
if (Math.Abs(num - 0.0) < 1E-50 && Math.Abs(num3 - 0.0) < 1E-50 && Math.Abs(num2 - 0.0) < 1E-50)
{
p[0] = 0.0;
return;
}
if (Math.Abs(num - 0.0) < 1E-50)
{
p[0] = 0.0;
return;
}
p[0] = 1.0;
num2 /= num;
num3 /= num;
p[1] = x1 + num2 * (x2 - x1);
p[2] = y1 + num2 * (y2 - y1);
}
// Token: 0x06000049 RID: 73 RVA: 0x000093A8 File Offset: 0x000075A8
private int HalfPlaneIntersection(int numvertices, ref double[] convexPoly, double x1, double y1, double x2, double y2)
{
double[] array = null;
int num = 0;
int num2 = 0;
double num3 = x2 - x1;
double num4 = y2 - y1;
int num5 = this.SplitConvexPolygon(numvertices, convexPoly, x1, y1, x2, y2, ref this.polys);
if (num5 == 3)
{
num = numvertices;
}
else
{
for (int i = 0; i < num5; i++)
{
double num6 = 1E+17;
double num7 = -1E+17;
int num8 = 1;
double num9;
while ((double)num8 <= 2.0 * this.polys[i][0] - 1.0)
{
num9 = num3 * (this.polys[i][num8 + 1] - y1) - num4 * (this.polys[i][num8] - x1);
num6 = ((num9 < num6) ? num9 : num6);
num7 = ((num9 > num7) ? num9 : num7);
num8 += 2;
}
num9 = ((Math.Abs(num6) > Math.Abs(num7)) ? num6 : num7);
if (num9 > 0.0)
{
array = this.polys[i];
num2 = 1;
break;
}
}
if (num2 == 1)
{
while ((double)num < array[0])
{
convexPoly[2 * num] = array[2 * num + 1];
convexPoly[2 * num + 1] = array[2 * num + 2];
num++;
}
}
}
return num;
}
// Token: 0x0600004A RID: 74 RVA: 0x000094F0 File Offset: 0x000076F0
private int SplitConvexPolygon(int numvertices, double[] convexPoly, double x1, double y1, double x2, double y2, ref double[][] polys)
{
int num = 0;
double[] array = new double[3];
int num2 = 0;
int num3 = 0;
double num4 = 1E-12;
int num5 = 0;
int num6 = 0;
int num7 = 0;
int num8 = 0;
int num9 = 0;
int num10 = 0;
int num11 = 0;
int num12 = 0;
for (int i = 0; i < 2 * numvertices; i += 2)
{
int num13 = ((i + 2 >= 2 * numvertices) ? 0 : (i + 2));
this.LineLineSegmentIntersection(x1, y1, x2, y2, convexPoly[i], convexPoly[i + 1], convexPoly[num13], convexPoly[num13 + 1], ref array);
if (Math.Abs(array[0] - 0.0) <= num4)
{
if (num == 1)
{
num3++;
this.poly2[2 * num3 - 1] = convexPoly[num13];
this.poly2[2 * num3] = convexPoly[num13 + 1];
}
else
{
num2++;
this.poly1[2 * num2 - 1] = convexPoly[num13];
this.poly1[2 * num2] = convexPoly[num13 + 1];
}
num5++;
}
else if (Math.Abs(array[0] - 2.0) <= num4)
{
num2++;
this.poly1[2 * num2 - 1] = convexPoly[num13];
this.poly1[2 * num2] = convexPoly[num13 + 1];
num6++;
}
else
{
num7++;
if (Math.Abs(array[1] - convexPoly[num13]) <= num4 && Math.Abs(array[2] - convexPoly[num13 + 1]) <= num4)
{
num8++;
if (num == 1)
{
num3++;
this.poly2[2 * num3 - 1] = convexPoly[num13];
this.poly2[2 * num3] = convexPoly[num13 + 1];
num2++;
this.poly1[2 * num2 - 1] = convexPoly[num13];
this.poly1[2 * num2] = convexPoly[num13 + 1];
num++;
}
else if (num == 0)
{
num11++;
num2++;
this.poly1[2 * num2 - 1] = convexPoly[num13];
this.poly1[2 * num2] = convexPoly[num13 + 1];
if (i + 4 < 2 * numvertices)
{
int num14 = this.LinePointLocation(x1, y1, x2, y2, convexPoly[i], convexPoly[i + 1]);
int num15 = this.LinePointLocation(x1, y1, x2, y2, convexPoly[i + 4], convexPoly[i + 5]);
if (num14 != num15 && num14 != 0 && num15 != 0)
{
num12++;
num3++;
this.poly2[2 * num3 - 1] = convexPoly[num13];
this.poly2[2 * num3] = convexPoly[num13 + 1];
num++;
}
}
}
}
else if (Math.Abs(array[1] - convexPoly[i]) > num4 || Math.Abs(array[2] - convexPoly[i + 1]) > num4)
{
num9++;
num2++;
this.poly1[2 * num2 - 1] = array[1];
this.poly1[2 * num2] = array[2];
num3++;
this.poly2[2 * num3 - 1] = array[1];
this.poly2[2 * num3] = array[2];
if (num == 1)
{
num2++;
this.poly1[2 * num2 - 1] = convexPoly[num13];
this.poly1[2 * num2] = convexPoly[num13 + 1];
}
else if (num == 0)
{
num3++;
this.poly2[2 * num3 - 1] = convexPoly[num13];
this.poly2[2 * num3] = convexPoly[num13 + 1];
}
num++;
}
else
{
num10++;
if (num == 1)
{
num3++;
this.poly2[2 * num3 - 1] = convexPoly[num13];
this.poly2[2 * num3] = convexPoly[num13 + 1];
}
else
{
num2++;
this.poly1[2 * num2 - 1] = convexPoly[num13];
this.poly1[2 * num2] = convexPoly[num13 + 1];
}
}
}
}
int num16;
if (num != 0 && num != 2)
{
num16 = 3;
}
else
{
num16 = ((num == 0) ? 1 : 2);
this.poly1[0] = (double)num2;
this.poly2[0] = (double)num3;
polys[0] = this.poly1;
if (num == 2)
{
polys[1] = this.poly2;
}
}
return num16;
}
// Token: 0x0600004B RID: 75 RVA: 0x000098D0 File Offset: 0x00007AD0
private int LinePointLocation(double x1, double y1, double x2, double y2, double x, double y)
{
if (Math.Atan((y2 - y1) / (x2 - x1)) * 180.0 / 3.141592653589793 == 90.0)
{
if (Math.Abs(x1 - x) <= 1E-11)
{
return 0;
}
}
else if (Math.Abs(y1 + (y2 - y1) * (x - x1) / (x2 - x1) - y) <= 1E-50)
{
return 0;
}
double num = (x2 - x1) * (y - y1) - (y2 - y1) * (x - x1);
if (Math.Abs(num - 0.0) <= 1E-11)
{
return 0;
}
if (num > 0.0)
{
return 1;
}
return 2;
}
// Token: 0x0600004C RID: 76 RVA: 0x00009984 File Offset: 0x00007B84
private void LineLineSegmentIntersection(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4, ref double[] p)
{
double num = 1E-13;
double num2 = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);
double num3 = (x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3);
double num4 = (x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3);
if (Math.Abs(num2 - 0.0) < num)
{
if (Math.Abs(num4 - 0.0) < num && Math.Abs(num3 - 0.0) < num)
{
p[0] = 2.0;
return;
}
p[0] = 0.0;
return;
}
else
{
num4 /= num2;
num3 /= num2;
if (num4 < -num || num4 > 1.0 + num)
{
p[0] = 0.0;
return;
}
p[0] = 1.0;
p[1] = x1 + num3 * (x2 - x1);
p[2] = y1 + num3 * (y2 - y1);
return;
}
}
// Token: 0x0600004D RID: 77 RVA: 0x00009A84 File Offset: 0x00007C84
private void FindPolyCentroid(int numpoints, double[] points, ref double[] centroid)
{
centroid[0] = 0.0;
centroid[1] = 0.0;
for (int i = 0; i < 2 * numpoints; i += 2)
{
centroid[0] = centroid[0] + points[i];
centroid[1] = centroid[1] + points[i + 1];
}
centroid[0] = centroid[0] / (double)numpoints;
centroid[1] = centroid[1] / (double)numpoints;
}
// Token: 0x0600004E RID: 78 RVA: 0x00009AEC File Offset: 0x00007CEC
private void CircleLineIntersection(double x1, double y1, double x2, double y2, double x3, double y3, double r, ref double[] p)
{
double num = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);
double num2 = 2.0 * ((x2 - x1) * (x1 - x3) + (y2 - y1) * (y1 - y3));
double num3 = x3 * x3 + y3 * y3 + x1 * x1 + y1 * y1 - 2.0 * (x3 * x1 + y3 * y1) - r * r;
double num4 = num2 * num2 - 4.0 * num * num3;
if (num4 < 0.0)
{
p[0] = 0.0;
return;
}
if (Math.Abs(num4 - 0.0) < 1E-50)
{
p[0] = 1.0;
double num5 = -num2 / (2.0 * num);
p[1] = x1 + num5 * (x2 - x1);
p[2] = y1 + num5 * (y2 - y1);
return;
}
if (num4 > 0.0 && Math.Abs(num - 0.0) >= 1E-50)
{
p[0] = 2.0;
double num5 = (-num2 + Math.Sqrt(num4)) / (2.0 * num);
p[1] = x1 + num5 * (x2 - x1);
p[2] = y1 + num5 * (y2 - y1);
num5 = (-num2 - Math.Sqrt(num4)) / (2.0 * num);
p[3] = x1 + num5 * (x2 - x1);
p[4] = y1 + num5 * (y2 - y1);
return;
}
p[0] = 0.0;
}
// Token: 0x0600004F RID: 79 RVA: 0x00009C80 File Offset: 0x00007E80
private bool ChooseCorrectPoint(double x1, double y1, double x2, double y2, double x3, double y3, bool isObtuse)
{
double num = (x2 - x3) * (x2 - x3) + (y2 - y3) * (y2 - y3);
double num2 = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);
bool flag;
if (isObtuse)
{
flag = num2 >= num;
}
else
{
flag = num2 < num;
}
return flag;
}
// Token: 0x06000050 RID: 80 RVA: 0x00009CD0 File Offset: 0x00007ED0
private void PointBetweenPoints(double x1, double y1, double x2, double y2, double x, double y, ref double[] p)
{
if ((x2 - x) * (x2 - x) + (y2 - y) * (y2 - y) < (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1))
{
p[0] = 1.0;
p[1] = (x - x2) * (x - x2) + (y - y2) * (y - y2);
p[2] = x;
p[3] = y;
return;
}
p[0] = 0.0;
p[1] = 0.0;
p[2] = 0.0;
p[3] = 0.0;
}
// Token: 0x06000051 RID: 81 RVA: 0x00009D74 File Offset: 0x00007F74
private bool IsBadTriangleAngle(double x1, double y1, double x2, double y2, double x3, double y3)
{
double num = x1 - x2;
double num2 = y1 - y2;
double num3 = x2 - x3;
double num4 = y2 - y3;
double num5 = x3 - x1;
double num6 = y3 - y1;
double num7 = num * num;
double num8 = num2 * num2;
double num9 = num3 * num3;
double num10 = num4 * num4;
double num11 = num5 * num5;
double num12 = num6 * num6;
double num13 = num7 + num8;
double num14 = num9 + num10;
double num15 = num11 + num12;
double num16;
if (num13 < num14 && num13 < num15)
{
num16 = num3 * num5 + num4 * num6;
num16 = num16 * num16 / (num14 * num15);
}
else if (num14 < num15)
{
num16 = num * num5 + num2 * num6;
num16 = num16 * num16 / (num13 * num15);
}
else
{
num16 = num * num3 + num2 * num4;
num16 = num16 * num16 / (num13 * num14);
}
double num17;
if (num13 > num14 && num13 > num15)
{
num17 = (num14 + num15 - num13) / (2.0 * Math.Sqrt(num14 * num15));
}
else if (num14 > num15)
{
num17 = (num13 + num15 - num14) / (2.0 * Math.Sqrt(num13 * num15));
}
else
{
num17 = (num13 + num14 - num15) / (2.0 * Math.Sqrt(num13 * num14));
}
return num16 > this.behavior.goodAngle || (this.behavior.MaxAngle != 0.0 && num17 < this.behavior.maxGoodAngle);
}
// Token: 0x06000052 RID: 82 RVA: 0x00009EDC File Offset: 0x000080DC
private double MinDistanceToNeighbor(double newlocX, double newlocY, ref Otri searchtri)
{
Otri otri = default(Otri);
LocateResult locateResult = LocateResult.Outside;
Point point = new Point(newlocX, newlocY);
Vertex vertex = searchtri.Org();
Vertex vertex2 = searchtri.Dest();
if (vertex.x == point.x && vertex.y == point.y)
{
locateResult = LocateResult.OnVertex;
searchtri.Copy(ref otri);
}
else if (vertex2.x == point.x && vertex2.y == point.y)
{
searchtri.LnextSelf();
locateResult = LocateResult.OnVertex;
searchtri.Copy(ref otri);
}
else
{
double num = Primitives.CounterClockwise(vertex, vertex2, point);
if (num < 0.0)
{
searchtri.SymSelf();
searchtri.Copy(ref otri);
locateResult = this.mesh.locator.PreciseLocate(point, ref otri, false);
}
else if (num == 0.0)
{
if (vertex.x < point.x == point.x < vertex2.x && vertex.y < point.y == point.y < vertex2.y)
{
locateResult = LocateResult.OnEdge;
searchtri.Copy(ref otri);
}
}
else
{
searchtri.Copy(ref otri);
locateResult = this.mesh.locator.PreciseLocate(point, ref otri, false);
}
}
if (locateResult == LocateResult.OnVertex || locateResult == LocateResult.Outside)
{
return 0.0;
}
Vertex vertex3 = otri.Org();
Vertex vertex4 = otri.Dest();
Vertex vertex5 = otri.Apex();
double num2 = (vertex3.x - point.x) * (vertex3.x - point.x) + (vertex3.y - point.y) * (vertex3.y - point.y);
double num3 = (vertex4.x - point.x) * (vertex4.x - point.x) + (vertex4.y - point.y) * (vertex4.y - point.y);
double num4 = (vertex5.x - point.x) * (vertex5.x - point.x) + (vertex5.y - point.y) * (vertex5.y - point.y);
if (num2 <= num3 && num2 <= num4)
{
return num2;
}
if (num3 <= num4)
{
return num3;
}
return num4;
}
// Token: 0x04000023 RID: 35
private const double EPS = 1E-50;
// Token: 0x04000024 RID: 36
private Mesh mesh;
// Token: 0x04000025 RID: 37
private Behavior behavior;
// Token: 0x04000026 RID: 38
private double[] petalx = new double[20];
// Token: 0x04000027 RID: 39
private double[] petaly = new double[20];
// Token: 0x04000028 RID: 40
private double[] petalr = new double[20];
// Token: 0x04000029 RID: 41
private double[] wedges = new double[500];
// Token: 0x0400002A RID: 42
private double[] initialConvexPoly = new double[500];
// Token: 0x0400002B RID: 43
private double[] points_p = new double[500];
// Token: 0x0400002C RID: 44
private double[] points_q = new double[500];
// Token: 0x0400002D RID: 45
private double[] points_r = new double[500];
// Token: 0x0400002E RID: 46
private double[] poly1 = new double[100];
// Token: 0x0400002F RID: 47
private double[] poly2 = new double[100];
// Token: 0x04000030 RID: 48
private double[][] polys = new double[3][];
}
}
+15
View File
@@ -0,0 +1,15 @@
using System;
namespace TriangleNet
{
// Token: 0x0200000D RID: 13
public enum NodeNumbering
{
// Token: 0x04000050 RID: 80
None,
// Token: 0x04000051 RID: 81
Linear,
// Token: 0x04000052 RID: 82
CuthillMcKee
}
}
+1815
View File
@@ -0,0 +1,1815 @@
using System;
using TriangleNet.Geometry;
using TriangleNet.Tools;
namespace TriangleNet
{
// Token: 0x0200000F RID: 15
public static class Primitives
{
// Token: 0x06000085 RID: 133 RVA: 0x0000D474 File Offset: 0x0000B674
public static void ExactInit()
{
bool flag = true;
double num = 0.5;
Primitives.epsilon = 1.0;
Primitives.splitter = 1.0;
double num2 = 1.0;
double num3;
do
{
num3 = num2;
Primitives.epsilon *= num;
if (flag)
{
Primitives.splitter *= 2.0;
}
flag = !flag;
num2 = 1.0 + Primitives.epsilon;
}
while (num2 != 1.0 && num2 != num3);
Primitives.splitter += 1.0;
Primitives.resulterrbound = (3.0 + 8.0 * Primitives.epsilon) * Primitives.epsilon;
Primitives.ccwerrboundA = (3.0 + 16.0 * Primitives.epsilon) * Primitives.epsilon;
Primitives.ccwerrboundB = (2.0 + 12.0 * Primitives.epsilon) * Primitives.epsilon;
Primitives.ccwerrboundC = (9.0 + 64.0 * Primitives.epsilon) * Primitives.epsilon * Primitives.epsilon;
Primitives.iccerrboundA = (10.0 + 96.0 * Primitives.epsilon) * Primitives.epsilon;
Primitives.iccerrboundB = (4.0 + 48.0 * Primitives.epsilon) * Primitives.epsilon;
Primitives.iccerrboundC = (44.0 + 576.0 * Primitives.epsilon) * Primitives.epsilon * Primitives.epsilon;
Primitives.o3derrboundA = (7.0 + 56.0 * Primitives.epsilon) * Primitives.epsilon;
Primitives.o3derrboundB = (3.0 + 28.0 * Primitives.epsilon) * Primitives.epsilon;
Primitives.o3derrboundC = (26.0 + 288.0 * Primitives.epsilon) * Primitives.epsilon * Primitives.epsilon;
}
// Token: 0x06000086 RID: 134 RVA: 0x0000D68C File Offset: 0x0000B88C
public static double CounterClockwise(Point pa, Point pb, Point pc)
{
Statistic.CounterClockwiseCount += 1L;
double num = (pa.x - pc.x) * (pb.y - pc.y);
double num2 = (pa.y - pc.y) * (pb.x - pc.x);
double num3 = num - num2;
if (Behavior.NoExact)
{
return num3;
}
double num4;
if (num > 0.0)
{
if (num2 <= 0.0)
{
return num3;
}
num4 = num + num2;
}
else
{
if (num >= 0.0)
{
return num3;
}
if (num2 >= 0.0)
{
return num3;
}
num4 = -num - num2;
}
double num5 = Primitives.ccwerrboundA * num4;
if (num3 >= num5 || -num3 >= num5)
{
return num3;
}
Statistic.CounterClockwiseAdaptCount += 1L;
return Primitives.CounterClockwiseAdapt(pa, pb, pc, num4);
}
// Token: 0x06000087 RID: 135 RVA: 0x0000D75C File Offset: 0x0000B95C
public static double InCircle(Point pa, Point pb, Point pc, Point pd)
{
Statistic.InCircleCount += 1L;
double num = pa.x - pd.x;
double num2 = pb.x - pd.x;
double num3 = pc.x - pd.x;
double num4 = pa.y - pd.y;
double num5 = pb.y - pd.y;
double num6 = pc.y - pd.y;
double num7 = num2 * num6;
double num8 = num3 * num5;
double num9 = num * num + num4 * num4;
double num10 = num3 * num4;
double num11 = num * num6;
double num12 = num2 * num2 + num5 * num5;
double num13 = num * num5;
double num14 = num2 * num4;
double num15 = num3 * num3 + num6 * num6;
double num16 = num9 * (num7 - num8) + num12 * (num10 - num11) + num15 * (num13 - num14);
if (Behavior.NoExact)
{
return num16;
}
double num17 = (Math.Abs(num7) + Math.Abs(num8)) * num9 + (Math.Abs(num10) + Math.Abs(num11)) * num12 + (Math.Abs(num13) + Math.Abs(num14)) * num15;
double num18 = Primitives.iccerrboundA * num17;
if (num16 > num18 || -num16 > num18)
{
return num16;
}
Statistic.InCircleAdaptCount += 1L;
return Primitives.InCircleAdapt(pa, pb, pc, pd, num17);
}
// Token: 0x06000088 RID: 136 RVA: 0x0000D898 File Offset: 0x0000BA98
public static double NonRegular(Point pa, Point pb, Point pc, Point pd)
{
return Primitives.InCircle(pa, pb, pc, pd);
}
// Token: 0x06000089 RID: 137 RVA: 0x0000D8A4 File Offset: 0x0000BAA4
public static Point FindCircumcenter(Point torg, Point tdest, Point tapex, ref double xi, ref double eta, double offconstant)
{
Statistic.CircumcenterCount += 1L;
double num = tdest.x - torg.x;
double num2 = tdest.y - torg.y;
double num3 = tapex.x - torg.x;
double num4 = tapex.y - torg.y;
double num5 = num * num + num2 * num2;
double num6 = num3 * num3 + num4 * num4;
double num7 = (tdest.x - tapex.x) * (tdest.x - tapex.x) + (tdest.y - tapex.y) * (tdest.y - tapex.y);
double num8;
if (Behavior.NoExact)
{
num8 = 0.5 / (num * num4 - num3 * num2);
}
else
{
num8 = 0.5 / Primitives.CounterClockwise(tdest, tapex, torg);
Statistic.CounterClockwiseCount -= 1L;
}
double num9 = (num4 * num5 - num2 * num6) * num8;
double num10 = (num * num6 - num3 * num5) * num8;
if (num5 < num6 && num5 < num7)
{
if (offconstant > 0.0)
{
double num11 = 0.5 * num - offconstant * num2;
double num12 = 0.5 * num2 + offconstant * num;
if (num11 * num11 + num12 * num12 < num9 * num9 + num10 * num10)
{
num9 = num11;
num10 = num12;
}
}
}
else if (num6 < num7)
{
if (offconstant > 0.0)
{
double num11 = 0.5 * num3 + offconstant * num4;
double num12 = 0.5 * num4 - offconstant * num3;
if (num11 * num11 + num12 * num12 < num9 * num9 + num10 * num10)
{
num9 = num11;
num10 = num12;
}
}
}
else if (offconstant > 0.0)
{
double num11 = 0.5 * (tapex.x - tdest.x) - offconstant * (tapex.y - tdest.y);
double num12 = 0.5 * (tapex.y - tdest.y) + offconstant * (tapex.x - tdest.x);
if (num11 * num11 + num12 * num12 < (num9 - num) * (num9 - num) + (num10 - num2) * (num10 - num2))
{
num9 = num + num11;
num10 = num2 + num12;
}
}
xi = (num4 * num9 - num3 * num10) * (2.0 * num8);
eta = (num * num10 - num2 * num9) * (2.0 * num8);
return new Point(torg.x + num9, torg.y + num10);
}
// Token: 0x0600008A RID: 138 RVA: 0x0000DB3C File Offset: 0x0000BD3C
public static Point FindCircumcenter(Point torg, Point tdest, Point tapex, ref double xi, ref double eta)
{
Statistic.CircumcenterCount += 1L;
double num = tdest.x - torg.x;
double num2 = tdest.y - torg.y;
double num3 = tapex.x - torg.x;
double num4 = tapex.y - torg.y;
double num5 = num * num + num2 * num2;
double num6 = num3 * num3 + num4 * num4;
double num7;
if (Behavior.NoExact)
{
num7 = 0.5 / (num * num4 - num3 * num2);
}
else
{
num7 = 0.5 / Primitives.CounterClockwise(tdest, tapex, torg);
Statistic.CounterClockwiseCount -= 1L;
}
double num8 = (num4 * num5 - num2 * num6) * num7;
double num9 = (num * num6 - num3 * num5) * num7;
xi = (num4 * num8 - num3 * num9) * (2.0 * num7);
eta = (num * num9 - num2 * num8) * (2.0 * num7);
return new Point(torg.x + num8, torg.y + num9);
}
// Token: 0x0600008B RID: 139 RVA: 0x0000DC44 File Offset: 0x0000BE44
private static int FastExpansionSumZeroElim(int elen, double[] e, int flen, double[] f, double[] h)
{
double num = e[0];
double num2 = f[0];
int j;
int i = (j = 0);
double num3;
if (num2 > num == num2 > -num)
{
num3 = num;
num = e[++j];
}
else
{
num3 = num2;
num2 = f[++i];
}
int num4 = 0;
if (j < elen && i < flen)
{
double num5;
double num7;
if (num2 > num == num2 > -num)
{
num5 = num + num3;
double num6 = num5 - num;
num7 = num3 - num6;
num = e[++j];
}
else
{
num5 = num2 + num3;
double num6 = num5 - num2;
num7 = num3 - num6;
num2 = f[++i];
}
num3 = num5;
if (num7 != 0.0)
{
h[num4++] = num7;
}
while (j < elen)
{
if (i >= flen)
{
break;
}
if (num2 > num == num2 > -num)
{
num5 = num3 + num;
double num6 = num5 - num3;
double num8 = num5 - num6;
double num9 = num - num6;
num7 = num3 - num8 + num9;
num = e[++j];
}
else
{
num5 = num3 + num2;
double num6 = num5 - num3;
double num8 = num5 - num6;
double num9 = num2 - num6;
num7 = num3 - num8 + num9;
num2 = f[++i];
}
num3 = num5;
if (num7 != 0.0)
{
h[num4++] = num7;
}
}
}
while (j < elen)
{
double num5 = num3 + num;
double num6 = num5 - num3;
double num8 = num5 - num6;
double num9 = num - num6;
double num7 = num3 - num8 + num9;
num = e[++j];
num3 = num5;
if (num7 != 0.0)
{
h[num4++] = num7;
}
}
while (i < flen)
{
double num5 = num3 + num2;
double num6 = num5 - num3;
double num8 = num5 - num6;
double num9 = num2 - num6;
double num7 = num3 - num8 + num9;
num2 = f[++i];
num3 = num5;
if (num7 != 0.0)
{
h[num4++] = num7;
}
}
if (num3 != 0.0 || num4 == 0)
{
h[num4++] = num3;
}
return num4;
}
// Token: 0x0600008C RID: 140 RVA: 0x0000DE3C File Offset: 0x0000C03C
private static int ScaleExpansionZeroElim(int elen, double[] e, double b, double[] h)
{
double num = Primitives.splitter * b;
double num2 = num - b;
double num3 = num - num2;
double num4 = b - num3;
double num5 = e[0] * b;
double num6 = Primitives.splitter * e[0];
num2 = num6 - e[0];
double num7 = num6 - num2;
double num8 = e[0] - num7;
double num9 = num5 - num7 * num3 - num8 * num3 - num7 * num4;
double num10 = num8 * num4 - num9;
int num11 = 0;
if (num10 != 0.0)
{
h[num11++] = num10;
}
for (int i = 1; i < elen; i++)
{
double num12 = e[i];
double num13 = num12 * b;
double num14 = Primitives.splitter * num12;
num2 = num14 - num12;
num7 = num14 - num2;
num8 = num12 - num7;
num9 = num13 - num7 * num3 - num8 * num3 - num7 * num4;
double num15 = num8 * num4 - num9;
double num16 = num5 + num15;
double num17 = num16 - num5;
double num18 = num16 - num17;
double num19 = num15 - num17;
num10 = num5 - num18 + num19;
if (num10 != 0.0)
{
h[num11++] = num10;
}
num5 = num13 + num16;
num17 = num5 - num13;
num10 = num16 - num17;
if (num10 != 0.0)
{
h[num11++] = num10;
}
}
if (num5 != 0.0 || num11 == 0)
{
h[num11++] = num5;
}
return num11;
}
// Token: 0x0600008D RID: 141 RVA: 0x0000DF94 File Offset: 0x0000C194
private static double Estimate(int elen, double[] e)
{
double num = e[0];
for (int i = 1; i < elen; i++)
{
num += e[i];
}
return num;
}
// Token: 0x0600008E RID: 142 RVA: 0x0000DFB8 File Offset: 0x0000C1B8
private static double CounterClockwiseAdapt(Point pa, Point pb, Point pc, double detsum)
{
double[] array = new double[5];
double[] array2 = new double[5];
double[] array3 = new double[8];
double[] array4 = new double[12];
double[] array5 = new double[16];
double num = pa.X - pc.X;
double num2 = pb.X - pc.X;
double num3 = pa.Y - pc.Y;
double num4 = pb.Y - pc.Y;
double num5 = num * num4;
double num6 = Primitives.splitter * num;
double num7 = num6 - num;
double num8 = num6 - num7;
double num9 = num - num8;
double num10 = Primitives.splitter * num4;
num7 = num10 - num4;
double num11 = num10 - num7;
double num12 = num4 - num11;
double num13 = num5 - num8 * num11 - num9 * num11 - num8 * num12;
double num14 = num9 * num12 - num13;
double num15 = num3 * num2;
double num16 = Primitives.splitter * num3;
num7 = num16 - num3;
num8 = num16 - num7;
num9 = num3 - num8;
double num17 = Primitives.splitter * num2;
num7 = num17 - num2;
num11 = num17 - num7;
num12 = num2 - num11;
num13 = num15 - num8 * num11 - num9 * num11 - num8 * num12;
double num18 = num9 * num12 - num13;
double num19 = num14 - num18;
double num20 = num14 - num19;
double num21 = num19 + num20;
double num22 = num20 - num18;
double num23 = num14 - num21;
array[0] = num23 + num22;
double num24 = num5 + num19;
num20 = num24 - num5;
num21 = num24 - num20;
num22 = num19 - num20;
num23 = num5 - num21;
double num25 = num23 + num22;
num19 = num25 - num15;
num20 = num25 - num19;
num21 = num19 + num20;
num22 = num20 - num15;
num23 = num25 - num21;
array[1] = num23 + num22;
double num26 = num24 + num19;
num20 = num26 - num24;
num21 = num26 - num20;
num22 = num19 - num20;
num23 = num24 - num21;
array[2] = num23 + num22;
array[3] = num26;
double num27 = Primitives.Estimate(4, array);
double num28 = Primitives.ccwerrboundB * detsum;
if (num27 >= num28 || -num27 >= num28)
{
return num27;
}
num20 = pa.X - num;
num21 = num + num20;
num22 = num20 - pc.X;
num23 = pa.X - num21;
double num29 = num23 + num22;
num20 = pb.X - num2;
num21 = num2 + num20;
num22 = num20 - pc.X;
num23 = pb.X - num21;
double num30 = num23 + num22;
num20 = pa.Y - num3;
num21 = num3 + num20;
num22 = num20 - pc.Y;
num23 = pa.Y - num21;
double num31 = num23 + num22;
num20 = pb.Y - num4;
num21 = num4 + num20;
num22 = num20 - pc.Y;
num23 = pb.Y - num21;
double num32 = num23 + num22;
if (num29 == 0.0 && num31 == 0.0 && num30 == 0.0 && num32 == 0.0)
{
return num27;
}
num28 = Primitives.ccwerrboundC * detsum + Primitives.resulterrbound * ((num27 >= 0.0) ? num27 : (-num27));
num27 += num * num32 + num4 * num29 - (num3 * num30 + num2 * num31);
if (num27 >= num28 || -num27 >= num28)
{
return num27;
}
double num33 = num29 * num4;
double num34 = Primitives.splitter * num29;
num7 = num34 - num29;
num8 = num34 - num7;
num9 = num29 - num8;
double num35 = Primitives.splitter * num4;
num7 = num35 - num4;
num11 = num35 - num7;
num12 = num4 - num11;
num13 = num33 - num8 * num11 - num9 * num11 - num8 * num12;
double num36 = num9 * num12 - num13;
double num37 = num31 * num2;
double num38 = Primitives.splitter * num31;
num7 = num38 - num31;
num8 = num38 - num7;
num9 = num31 - num8;
double num39 = Primitives.splitter * num2;
num7 = num39 - num2;
num11 = num39 - num7;
num12 = num2 - num11;
num13 = num37 - num8 * num11 - num9 * num11 - num8 * num12;
double num40 = num9 * num12 - num13;
num19 = num36 - num40;
num20 = num36 - num19;
num21 = num19 + num20;
num22 = num20 - num40;
num23 = num36 - num21;
array2[0] = num23 + num22;
num24 = num33 + num19;
num20 = num24 - num33;
num21 = num24 - num20;
num22 = num19 - num20;
num23 = num33 - num21;
double num41 = num23 + num22;
num19 = num41 - num37;
num20 = num41 - num19;
num21 = num19 + num20;
num22 = num20 - num37;
num23 = num41 - num21;
array2[1] = num23 + num22;
double num42 = num24 + num19;
num20 = num42 - num24;
num21 = num42 - num20;
num22 = num19 - num20;
num23 = num24 - num21;
array2[2] = num23 + num22;
array2[3] = num42;
int num43 = Primitives.FastExpansionSumZeroElim(4, array, 4, array2, array3);
num33 = num * num32;
double num44 = Primitives.splitter * num;
num7 = num44 - num;
num8 = num44 - num7;
num9 = num - num8;
double num45 = Primitives.splitter * num32;
num7 = num45 - num32;
num11 = num45 - num7;
num12 = num32 - num11;
num13 = num33 - num8 * num11 - num9 * num11 - num8 * num12;
double num46 = num9 * num12 - num13;
num37 = num3 * num30;
double num47 = Primitives.splitter * num3;
num7 = num47 - num3;
num8 = num47 - num7;
num9 = num3 - num8;
double num48 = Primitives.splitter * num30;
num7 = num48 - num30;
num11 = num48 - num7;
num12 = num30 - num11;
num13 = num37 - num8 * num11 - num9 * num11 - num8 * num12;
num40 = num9 * num12 - num13;
num19 = num46 - num40;
num20 = num46 - num19;
num21 = num19 + num20;
num22 = num20 - num40;
num23 = num46 - num21;
array2[0] = num23 + num22;
num24 = num33 + num19;
num20 = num24 - num33;
num21 = num24 - num20;
num22 = num19 - num20;
num23 = num33 - num21;
double num49 = num23 + num22;
num19 = num49 - num37;
num20 = num49 - num19;
num21 = num19 + num20;
num22 = num20 - num37;
num23 = num49 - num21;
array2[1] = num23 + num22;
num42 = num24 + num19;
num20 = num42 - num24;
num21 = num42 - num20;
num22 = num19 - num20;
num23 = num24 - num21;
array2[2] = num23 + num22;
array2[3] = num42;
int num50 = Primitives.FastExpansionSumZeroElim(num43, array3, 4, array2, array4);
num33 = num29 * num32;
double num51 = Primitives.splitter * num29;
num7 = num51 - num29;
num8 = num51 - num7;
num9 = num29 - num8;
double num52 = Primitives.splitter * num32;
num7 = num52 - num32;
num11 = num52 - num7;
num12 = num32 - num11;
num13 = num33 - num8 * num11 - num9 * num11 - num8 * num12;
double num53 = num9 * num12 - num13;
num37 = num31 * num30;
double num54 = Primitives.splitter * num31;
num7 = num54 - num31;
num8 = num54 - num7;
num9 = num31 - num8;
double num55 = Primitives.splitter * num30;
num7 = num55 - num30;
num11 = num55 - num7;
num12 = num30 - num11;
num13 = num37 - num8 * num11 - num9 * num11 - num8 * num12;
num40 = num9 * num12 - num13;
num19 = num53 - num40;
num20 = num53 - num19;
num21 = num19 + num20;
num22 = num20 - num40;
num23 = num53 - num21;
array2[0] = num23 + num22;
num24 = num33 + num19;
num20 = num24 - num33;
num21 = num24 - num20;
num22 = num19 - num20;
num23 = num33 - num21;
double num56 = num23 + num22;
num19 = num56 - num37;
num20 = num56 - num19;
num21 = num19 + num20;
num22 = num20 - num37;
num23 = num56 - num21;
array2[1] = num23 + num22;
num42 = num24 + num19;
num20 = num42 - num24;
num21 = num42 - num20;
num22 = num19 - num20;
num23 = num24 - num21;
array2[2] = num23 + num22;
array2[3] = num42;
int num57 = Primitives.FastExpansionSumZeroElim(num50, array4, 4, array2, array5);
return array5[num57 - 1];
}
// Token: 0x0600008F RID: 143 RVA: 0x0000E758 File Offset: 0x0000C958
private static double InCircleAdapt(Point pa, Point pb, Point pc, Point pd, double permanent)
{
double[] array = new double[4];
double[] array2 = new double[4];
double[] array3 = new double[4];
double[] array4 = new double[8];
double[] array5 = new double[16];
double[] array6 = new double[8];
double[] array7 = new double[16];
double[] array8 = new double[32];
double[] array9 = new double[8];
double[] array10 = new double[16];
double[] array11 = new double[8];
double[] array12 = new double[16];
double[] array13 = new double[32];
double[] array14 = new double[8];
double[] array15 = new double[16];
double[] array16 = new double[8];
double[] array17 = new double[16];
double[] array18 = new double[32];
double[] array19 = new double[64];
double[] array20 = new double[1152];
double[] array21 = new double[1152];
double[] array22 = new double[4];
double[] array23 = new double[4];
double[] array24 = new double[4];
double[] array25 = new double[5];
double[] array26 = new double[5];
double[] array27 = new double[8];
double[] array28 = new double[16];
double[] array29 = new double[16];
double[] array30 = new double[16];
double[] array31 = new double[32];
double[] array32 = new double[32];
double[] array33 = new double[48];
double[] array34 = new double[64];
double[] array35 = new double[8];
double[] array36 = new double[8];
double[] array37 = new double[8];
double[] array38 = new double[8];
double[] array39 = new double[8];
double[] array40 = new double[8];
double[] array41 = new double[8];
double[] array42 = new double[8];
double[] array43 = new double[8];
double[] array44 = new double[8];
double[] array45 = new double[8];
double[] array46 = new double[8];
double[] array47 = new double[8];
double[] array48 = new double[8];
double[] array49 = new double[8];
double[] array50 = new double[8];
double[] array51 = new double[8];
double[] array52 = new double[8];
int num = 0;
int num2 = 0;
int num3 = 0;
int num4 = 0;
int num5 = 0;
int num6 = 0;
double[] array53 = new double[16];
double[] array54 = new double[16];
double[] array55 = new double[16];
double[] array56 = new double[16];
double[] array57 = new double[16];
double[] array58 = new double[16];
double[] array59 = new double[8];
double[] array60 = new double[8];
double[] array61 = new double[8];
double[] array62 = new double[8];
double[] array63 = new double[8];
double[] array64 = new double[8];
double[] array65 = new double[8];
double[] array66 = new double[8];
double[] array67 = new double[8];
double[] array68 = new double[4];
double[] array69 = new double[4];
double[] array70 = new double[4];
double num7 = pa.X - pd.X;
double num8 = pb.X - pd.X;
double num9 = pc.X - pd.X;
double num10 = pa.Y - pd.Y;
double num11 = pb.Y - pd.Y;
double num12 = pc.Y - pd.Y;
num7 = pa.X - pd.X;
num8 = pb.X - pd.X;
num9 = pc.X - pd.X;
num10 = pa.Y - pd.Y;
num11 = pb.Y - pd.Y;
num12 = pc.Y - pd.Y;
double num13 = num8 * num12;
double num14 = Primitives.splitter * num8;
double num15 = num14 - num8;
double num16 = num14 - num15;
double num17 = num8 - num16;
double num18 = Primitives.splitter * num12;
num15 = num18 - num12;
double num19 = num18 - num15;
double num20 = num12 - num19;
double num21 = num13 - num16 * num19 - num17 * num19 - num16 * num20;
double num22 = num17 * num20 - num21;
double num23 = num9 * num11;
double num24 = Primitives.splitter * num9;
num15 = num24 - num9;
num16 = num24 - num15;
num17 = num9 - num16;
double num25 = Primitives.splitter * num11;
num15 = num25 - num11;
num19 = num25 - num15;
num20 = num11 - num19;
num21 = num23 - num16 * num19 - num17 * num19 - num16 * num20;
double num26 = num17 * num20 - num21;
double num27 = num22 - num26;
double num28 = num22 - num27;
double num29 = num27 + num28;
double num30 = num28 - num26;
double num31 = num22 - num29;
array[0] = num31 + num30;
double num32 = num13 + num27;
num28 = num32 - num13;
num29 = num32 - num28;
num30 = num27 - num28;
num31 = num13 - num29;
double num33 = num31 + num30;
num27 = num33 - num23;
num28 = num33 - num27;
num29 = num27 + num28;
num30 = num28 - num23;
num31 = num33 - num29;
array[1] = num31 + num30;
double num34 = num32 + num27;
num28 = num34 - num32;
num29 = num34 - num28;
num30 = num27 - num28;
num31 = num32 - num29;
array[2] = num31 + num30;
array[3] = num34;
int num35 = Primitives.ScaleExpansionZeroElim(Primitives.ScaleExpansionZeroElim(4, array, num7, array4), array4, num7, array5);
int num36 = Primitives.ScaleExpansionZeroElim(Primitives.ScaleExpansionZeroElim(4, array, num10, array6), array6, num10, array7);
int num37 = Primitives.FastExpansionSumZeroElim(num35, array5, num36, array7, array8);
double num38 = num9 * num10;
double num39 = Primitives.splitter * num9;
num15 = num39 - num9;
num16 = num39 - num15;
num17 = num9 - num16;
double num40 = Primitives.splitter * num10;
num15 = num40 - num10;
num19 = num40 - num15;
num20 = num10 - num19;
num21 = num38 - num16 * num19 - num17 * num19 - num16 * num20;
double num41 = num17 * num20 - num21;
double num42 = num7 * num12;
double num43 = Primitives.splitter * num7;
num15 = num43 - num7;
num16 = num43 - num15;
num17 = num7 - num16;
double num44 = Primitives.splitter * num12;
num15 = num44 - num12;
num19 = num44 - num15;
num20 = num12 - num19;
num21 = num42 - num16 * num19 - num17 * num19 - num16 * num20;
double num45 = num17 * num20 - num21;
num27 = num41 - num45;
num28 = num41 - num27;
num29 = num27 + num28;
num30 = num28 - num45;
num31 = num41 - num29;
array2[0] = num31 + num30;
num32 = num38 + num27;
num28 = num32 - num38;
num29 = num32 - num28;
num30 = num27 - num28;
num31 = num38 - num29;
num33 = num31 + num30;
num27 = num33 - num42;
num28 = num33 - num27;
num29 = num27 + num28;
num30 = num28 - num42;
num31 = num33 - num29;
array2[1] = num31 + num30;
double num46 = num32 + num27;
num28 = num46 - num32;
num29 = num46 - num28;
num30 = num27 - num28;
num31 = num32 - num29;
array2[2] = num31 + num30;
array2[3] = num46;
int num47 = Primitives.ScaleExpansionZeroElim(Primitives.ScaleExpansionZeroElim(4, array2, num8, array9), array9, num8, array10);
int num48 = Primitives.ScaleExpansionZeroElim(Primitives.ScaleExpansionZeroElim(4, array2, num11, array11), array11, num11, array12);
int num49 = Primitives.FastExpansionSumZeroElim(num47, array10, num48, array12, array13);
double num50 = num7 * num11;
double num51 = Primitives.splitter * num7;
num15 = num51 - num7;
num16 = num51 - num15;
num17 = num7 - num16;
double num52 = Primitives.splitter * num11;
num15 = num52 - num11;
num19 = num52 - num15;
num20 = num11 - num19;
num21 = num50 - num16 * num19 - num17 * num19 - num16 * num20;
double num53 = num17 * num20 - num21;
double num54 = num8 * num10;
double num55 = Primitives.splitter * num8;
num15 = num55 - num8;
num16 = num55 - num15;
num17 = num8 - num16;
double num56 = Primitives.splitter * num10;
num15 = num56 - num10;
num19 = num56 - num15;
num20 = num10 - num19;
num21 = num54 - num16 * num19 - num17 * num19 - num16 * num20;
double num57 = num17 * num20 - num21;
num27 = num53 - num57;
num28 = num53 - num27;
num29 = num27 + num28;
num30 = num28 - num57;
num31 = num53 - num29;
array3[0] = num31 + num30;
num32 = num50 + num27;
num28 = num32 - num50;
num29 = num32 - num28;
num30 = num27 - num28;
num31 = num50 - num29;
num33 = num31 + num30;
num27 = num33 - num54;
num28 = num33 - num27;
num29 = num27 + num28;
num30 = num28 - num54;
num31 = num33 - num29;
array3[1] = num31 + num30;
double num58 = num32 + num27;
num28 = num58 - num32;
num29 = num58 - num28;
num30 = num27 - num28;
num31 = num32 - num29;
array3[2] = num31 + num30;
array3[3] = num58;
int num59 = Primitives.ScaleExpansionZeroElim(Primitives.ScaleExpansionZeroElim(4, array3, num9, array14), array14, num9, array15);
int num60 = Primitives.ScaleExpansionZeroElim(Primitives.ScaleExpansionZeroElim(4, array3, num12, array16), array16, num12, array17);
int num61 = Primitives.FastExpansionSumZeroElim(num59, array15, num60, array17, array18);
int num62 = Primitives.FastExpansionSumZeroElim(Primitives.FastExpansionSumZeroElim(num37, array8, num49, array13, array19), array19, num61, array18, array20);
double num63 = Primitives.Estimate(num62, array20);
double num64 = Primitives.iccerrboundB * permanent;
if (num63 >= num64 || -num63 >= num64)
{
return num63;
}
num28 = pa.X - num7;
num29 = num7 + num28;
num30 = num28 - pd.X;
num31 = pa.X - num29;
double num65 = num31 + num30;
num28 = pa.Y - num10;
num29 = num10 + num28;
num30 = num28 - pd.Y;
num31 = pa.Y - num29;
double num66 = num31 + num30;
num28 = pb.X - num8;
num29 = num8 + num28;
num30 = num28 - pd.X;
num31 = pb.X - num29;
double num67 = num31 + num30;
num28 = pb.Y - num11;
num29 = num11 + num28;
num30 = num28 - pd.Y;
num31 = pb.Y - num29;
double num68 = num31 + num30;
num28 = pc.X - num9;
num29 = num9 + num28;
num30 = num28 - pd.X;
num31 = pc.X - num29;
double num69 = num31 + num30;
num28 = pc.Y - num12;
num29 = num12 + num28;
num30 = num28 - pd.Y;
num31 = pc.Y - num29;
double num70 = num31 + num30;
if (num65 == 0.0 && num67 == 0.0 && num69 == 0.0 && num66 == 0.0 && num68 == 0.0 && num70 == 0.0)
{
return num63;
}
num64 = Primitives.iccerrboundC * permanent + Primitives.resulterrbound * ((num63 >= 0.0) ? num63 : (-num63));
num63 += (num7 * num7 + num10 * num10) * (num8 * num70 + num12 * num67 - (num11 * num69 + num9 * num68)) + 2.0 * (num7 * num65 + num10 * num66) * (num8 * num12 - num11 * num9) + ((num8 * num8 + num11 * num11) * (num9 * num66 + num10 * num69 - (num12 * num65 + num7 * num70)) + 2.0 * (num8 * num67 + num11 * num68) * (num9 * num10 - num12 * num7)) + ((num9 * num9 + num12 * num12) * (num7 * num68 + num11 * num65 - (num10 * num67 + num8 * num66)) + 2.0 * (num9 * num69 + num12 * num70) * (num7 * num11 - num10 * num8));
if (num63 >= num64 || -num63 >= num64)
{
return num63;
}
double[] array71 = array20;
double[] array72 = array21;
if (num67 != 0.0 || num68 != 0.0 || num69 != 0.0 || num70 != 0.0)
{
double num71 = num7 * num7;
double num72 = Primitives.splitter * num7;
num15 = num72 - num7;
num16 = num72 - num15;
num17 = num7 - num16;
num21 = num71 - num16 * num16 - (num16 + num16) * num17;
double num73 = num17 * num17 - num21;
double num74 = num10 * num10;
double num75 = Primitives.splitter * num10;
num15 = num75 - num10;
num16 = num75 - num15;
num17 = num10 - num16;
num21 = num74 - num16 * num16 - (num16 + num16) * num17;
double num76 = num17 * num17 - num21;
num27 = num73 + num76;
num28 = num27 - num73;
num29 = num27 - num28;
num30 = num76 - num28;
num31 = num73 - num29;
array22[0] = num31 + num30;
num32 = num71 + num27;
num28 = num32 - num71;
num29 = num32 - num28;
num30 = num27 - num28;
num31 = num71 - num29;
num33 = num31 + num30;
num27 = num33 + num74;
num28 = num27 - num33;
num29 = num27 - num28;
num30 = num74 - num28;
num31 = num33 - num29;
array22[1] = num31 + num30;
double num77 = num32 + num27;
num28 = num77 - num32;
num29 = num77 - num28;
num30 = num27 - num28;
num31 = num32 - num29;
array22[2] = num31 + num30;
array22[3] = num77;
}
if (num69 != 0.0 || num70 != 0.0 || num65 != 0.0 || num66 != 0.0)
{
double num78 = num8 * num8;
double num79 = Primitives.splitter * num8;
num15 = num79 - num8;
num16 = num79 - num15;
num17 = num8 - num16;
num21 = num78 - num16 * num16 - (num16 + num16) * num17;
double num80 = num17 * num17 - num21;
double num81 = num11 * num11;
double num82 = Primitives.splitter * num11;
num15 = num82 - num11;
num16 = num82 - num15;
num17 = num11 - num16;
num21 = num81 - num16 * num16 - (num16 + num16) * num17;
double num83 = num17 * num17 - num21;
num27 = num80 + num83;
num28 = num27 - num80;
num29 = num27 - num28;
num30 = num83 - num28;
num31 = num80 - num29;
array23[0] = num31 + num30;
num32 = num78 + num27;
num28 = num32 - num78;
num29 = num32 - num28;
num30 = num27 - num28;
num31 = num78 - num29;
num33 = num31 + num30;
num27 = num33 + num81;
num28 = num27 - num33;
num29 = num27 - num28;
num30 = num81 - num28;
num31 = num33 - num29;
array23[1] = num31 + num30;
double num84 = num32 + num27;
num28 = num84 - num32;
num29 = num84 - num28;
num30 = num27 - num28;
num31 = num32 - num29;
array23[2] = num31 + num30;
array23[3] = num84;
}
if (num65 != 0.0 || num66 != 0.0 || num67 != 0.0 || num68 != 0.0)
{
double num85 = num9 * num9;
double num86 = Primitives.splitter * num9;
num15 = num86 - num9;
num16 = num86 - num15;
num17 = num9 - num16;
num21 = num85 - num16 * num16 - (num16 + num16) * num17;
double num87 = num17 * num17 - num21;
double num88 = num12 * num12;
double num89 = Primitives.splitter * num12;
num15 = num89 - num12;
num16 = num89 - num15;
num17 = num12 - num16;
num21 = num88 - num16 * num16 - (num16 + num16) * num17;
double num90 = num17 * num17 - num21;
num27 = num87 + num90;
num28 = num27 - num87;
num29 = num27 - num28;
num30 = num90 - num28;
num31 = num87 - num29;
array24[0] = num31 + num30;
num32 = num85 + num27;
num28 = num32 - num85;
num29 = num32 - num28;
num30 = num27 - num28;
num31 = num85 - num29;
num33 = num31 + num30;
num27 = num33 + num88;
num28 = num27 - num33;
num29 = num27 - num28;
num30 = num88 - num28;
num31 = num33 - num29;
array24[1] = num31 + num30;
double num91 = num32 + num27;
num28 = num91 - num32;
num29 = num91 - num28;
num30 = num27 - num28;
num31 = num32 - num29;
array24[2] = num31 + num30;
array24[3] = num91;
}
if (num65 != 0.0)
{
num = Primitives.ScaleExpansionZeroElim(4, array, num65, array47);
int num92 = Primitives.ScaleExpansionZeroElim(num, array47, 2.0 * num7, array28);
int num93 = Primitives.ScaleExpansionZeroElim(Primitives.ScaleExpansionZeroElim(4, array24, num65, array36), array36, num11, array29);
int num94 = Primitives.ScaleExpansionZeroElim(Primitives.ScaleExpansionZeroElim(4, array23, num65, array35), array35, -num12, array30);
int num95 = Primitives.FastExpansionSumZeroElim(num92, array28, num93, array29, array31);
int num96 = Primitives.FastExpansionSumZeroElim(num94, array30, num95, array31, array33);
num62 = Primitives.FastExpansionSumZeroElim(num62, array71, num96, array33, array72);
double[] array73 = array71;
array71 = array72;
array72 = array73;
}
if (num66 != 0.0)
{
num2 = Primitives.ScaleExpansionZeroElim(4, array, num66, array48);
int num92 = Primitives.ScaleExpansionZeroElim(num2, array48, 2.0 * num10, array28);
int num93 = Primitives.ScaleExpansionZeroElim(Primitives.ScaleExpansionZeroElim(4, array23, num66, array37), array37, num9, array29);
int num97 = Primitives.ScaleExpansionZeroElim(Primitives.ScaleExpansionZeroElim(4, array24, num66, array38), array38, -num8, array30);
int num95 = Primitives.FastExpansionSumZeroElim(num92, array28, num93, array29, array31);
int num96 = Primitives.FastExpansionSumZeroElim(num97, array30, num95, array31, array33);
num62 = Primitives.FastExpansionSumZeroElim(num62, array71, num96, array33, array72);
double[] array74 = array71;
array71 = array72;
array72 = array74;
}
if (num67 != 0.0)
{
num3 = Primitives.ScaleExpansionZeroElim(4, array2, num67, array49);
int num92 = Primitives.ScaleExpansionZeroElim(num3, array49, 2.0 * num8, array28);
int num93 = Primitives.ScaleExpansionZeroElim(Primitives.ScaleExpansionZeroElim(4, array22, num67, array39), array39, num12, array29);
int num98 = Primitives.ScaleExpansionZeroElim(Primitives.ScaleExpansionZeroElim(4, array24, num67, array40), array40, -num10, array30);
int num95 = Primitives.FastExpansionSumZeroElim(num92, array28, num93, array29, array31);
int num96 = Primitives.FastExpansionSumZeroElim(num98, array30, num95, array31, array33);
num62 = Primitives.FastExpansionSumZeroElim(num62, array71, num96, array33, array72);
double[] array75 = array71;
array71 = array72;
array72 = array75;
}
if (num68 != 0.0)
{
num4 = Primitives.ScaleExpansionZeroElim(4, array2, num68, array50);
int num92 = Primitives.ScaleExpansionZeroElim(num4, array50, 2.0 * num11, array28);
int num93 = Primitives.ScaleExpansionZeroElim(Primitives.ScaleExpansionZeroElim(4, array24, num68, array42), array42, num7, array29);
int num99 = Primitives.ScaleExpansionZeroElim(Primitives.ScaleExpansionZeroElim(4, array22, num68, array41), array41, -num9, array30);
int num95 = Primitives.FastExpansionSumZeroElim(num92, array28, num93, array29, array31);
int num96 = Primitives.FastExpansionSumZeroElim(num99, array30, num95, array31, array33);
num62 = Primitives.FastExpansionSumZeroElim(num62, array71, num96, array33, array72);
double[] array76 = array71;
array71 = array72;
array72 = array76;
}
if (num69 != 0.0)
{
num5 = Primitives.ScaleExpansionZeroElim(4, array3, num69, array51);
int num92 = Primitives.ScaleExpansionZeroElim(num5, array51, 2.0 * num9, array28);
int num93 = Primitives.ScaleExpansionZeroElim(Primitives.ScaleExpansionZeroElim(4, array23, num69, array44), array44, num10, array29);
int num100 = Primitives.ScaleExpansionZeroElim(Primitives.ScaleExpansionZeroElim(4, array22, num69, array43), array43, -num11, array30);
int num95 = Primitives.FastExpansionSumZeroElim(num92, array28, num93, array29, array31);
int num96 = Primitives.FastExpansionSumZeroElim(num100, array30, num95, array31, array33);
num62 = Primitives.FastExpansionSumZeroElim(num62, array71, num96, array33, array72);
double[] array77 = array71;
array71 = array72;
array72 = array77;
}
if (num70 != 0.0)
{
num6 = Primitives.ScaleExpansionZeroElim(4, array3, num70, array52);
int num92 = Primitives.ScaleExpansionZeroElim(num6, array52, 2.0 * num12, array28);
int num93 = Primitives.ScaleExpansionZeroElim(Primitives.ScaleExpansionZeroElim(4, array22, num70, array45), array45, num8, array29);
int num101 = Primitives.ScaleExpansionZeroElim(Primitives.ScaleExpansionZeroElim(4, array23, num70, array46), array46, -num7, array30);
int num95 = Primitives.FastExpansionSumZeroElim(num92, array28, num93, array29, array31);
int num96 = Primitives.FastExpansionSumZeroElim(num101, array30, num95, array31, array33);
num62 = Primitives.FastExpansionSumZeroElim(num62, array71, num96, array33, array72);
double[] array78 = array71;
array71 = array72;
array72 = array78;
}
if (num65 != 0.0 || num66 != 0.0)
{
int num117;
int num123;
if (num67 != 0.0 || num68 != 0.0 || num69 != 0.0 || num70 != 0.0)
{
double num102 = num67 * num12;
double num103 = Primitives.splitter * num67;
num15 = num103 - num67;
num16 = num103 - num15;
num17 = num67 - num16;
double num104 = Primitives.splitter * num12;
num15 = num104 - num12;
num19 = num104 - num15;
num20 = num12 - num19;
num21 = num102 - num16 * num19 - num17 * num19 - num16 * num20;
double num105 = num17 * num20 - num21;
double num106 = num8 * num70;
double num107 = Primitives.splitter * num8;
num15 = num107 - num8;
num16 = num107 - num15;
num17 = num8 - num16;
double num108 = Primitives.splitter * num70;
num15 = num108 - num70;
num19 = num108 - num15;
num20 = num70 - num19;
num21 = num106 - num16 * num19 - num17 * num19 - num16 * num20;
double num109 = num17 * num20 - num21;
num27 = num105 + num109;
num28 = num27 - num105;
num29 = num27 - num28;
num30 = num109 - num28;
num31 = num105 - num29;
array25[0] = num31 + num30;
num32 = num102 + num27;
num28 = num32 - num102;
num29 = num32 - num28;
num30 = num27 - num28;
num31 = num102 - num29;
num33 = num31 + num30;
num27 = num33 + num106;
num28 = num27 - num33;
num29 = num27 - num28;
num30 = num106 - num28;
num31 = num33 - num29;
array25[1] = num31 + num30;
double num110 = num32 + num27;
num28 = num110 - num32;
num29 = num110 - num28;
num30 = num27 - num28;
num31 = num32 - num29;
array25[2] = num31 + num30;
array25[3] = num110;
double num111 = -num11;
num102 = num69 * num111;
double num112 = Primitives.splitter * num69;
num15 = num112 - num69;
num16 = num112 - num15;
num17 = num69 - num16;
double num113 = Primitives.splitter * num111;
num15 = num113 - num111;
num19 = num113 - num15;
num20 = num111 - num19;
num21 = num102 - num16 * num19 - num17 * num19 - num16 * num20;
num105 = num17 * num20 - num21;
num111 = -num68;
num106 = num9 * num111;
double num114 = Primitives.splitter * num9;
num15 = num114 - num9;
num16 = num114 - num15;
num17 = num9 - num16;
double num115 = Primitives.splitter * num111;
num15 = num115 - num111;
num19 = num115 - num15;
num20 = num111 - num19;
num21 = num106 - num16 * num19 - num17 * num19 - num16 * num20;
num109 = num17 * num20 - num21;
num27 = num105 + num109;
num28 = num27 - num105;
num29 = num27 - num28;
num30 = num109 - num28;
num31 = num105 - num29;
array26[0] = num31 + num30;
num32 = num102 + num27;
num28 = num32 - num102;
num29 = num32 - num28;
num30 = num27 - num28;
num31 = num102 - num29;
num33 = num31 + num30;
num27 = num33 + num106;
num28 = num27 - num33;
num29 = num27 - num28;
num30 = num106 - num28;
num31 = num33 - num29;
array26[1] = num31 + num30;
double num116 = num32 + num27;
num28 = num116 - num32;
num29 = num116 - num28;
num30 = num27 - num28;
num31 = num32 - num29;
array26[2] = num31 + num30;
array26[3] = num116;
num117 = Primitives.FastExpansionSumZeroElim(4, array25, 4, array26, array66);
num102 = num67 * num70;
double num118 = Primitives.splitter * num67;
num15 = num118 - num67;
num16 = num118 - num15;
num17 = num67 - num16;
double num119 = Primitives.splitter * num70;
num15 = num119 - num70;
num19 = num119 - num15;
num20 = num70 - num19;
num21 = num102 - num16 * num19 - num17 * num19 - num16 * num20;
num105 = num17 * num20 - num21;
num106 = num69 * num68;
double num120 = Primitives.splitter * num69;
num15 = num120 - num69;
num16 = num120 - num15;
num17 = num69 - num16;
double num121 = Primitives.splitter * num68;
num15 = num121 - num68;
num19 = num121 - num15;
num20 = num68 - num19;
num21 = num106 - num16 * num19 - num17 * num19 - num16 * num20;
num109 = num17 * num20 - num21;
num27 = num105 - num109;
num28 = num105 - num27;
num29 = num27 + num28;
num30 = num28 - num109;
num31 = num105 - num29;
array69[0] = num31 + num30;
num32 = num102 + num27;
num28 = num32 - num102;
num29 = num32 - num28;
num30 = num27 - num28;
num31 = num102 - num29;
num33 = num31 + num30;
num27 = num33 - num106;
num28 = num33 - num27;
num29 = num27 + num28;
num30 = num28 - num106;
num31 = num33 - num29;
array69[1] = num31 + num30;
double num122 = num32 + num27;
num28 = num122 - num32;
num29 = num122 - num28;
num30 = num27 - num28;
num31 = num32 - num29;
array69[2] = num31 + num30;
array69[3] = num122;
num123 = 4;
}
else
{
array66[0] = 0.0;
num117 = 1;
array69[0] = 0.0;
num123 = 1;
}
if (num65 != 0.0)
{
int num92 = Primitives.ScaleExpansionZeroElim(num, array47, num65, array28);
int num124 = Primitives.ScaleExpansionZeroElim(num117, array66, num65, array53);
int num95 = Primitives.ScaleExpansionZeroElim(num124, array53, 2.0 * num7, array31);
int num96 = Primitives.FastExpansionSumZeroElim(num92, array28, num95, array31, array33);
num62 = Primitives.FastExpansionSumZeroElim(num62, array71, num96, array33, array72);
double[] array79 = array71;
array71 = array72;
array72 = array79;
if (num68 != 0.0)
{
num92 = Primitives.ScaleExpansionZeroElim(Primitives.ScaleExpansionZeroElim(4, array24, num65, array27), array27, num68, array28);
num62 = Primitives.FastExpansionSumZeroElim(num62, array71, num92, array28, array72);
double[] array80 = array71;
array71 = array72;
array72 = array80;
}
if (num70 != 0.0)
{
num92 = Primitives.ScaleExpansionZeroElim(Primitives.ScaleExpansionZeroElim(4, array23, -num65, array27), array27, num70, array28);
num62 = Primitives.FastExpansionSumZeroElim(num62, array71, num92, array28, array72);
double[] array81 = array71;
array71 = array72;
array72 = array81;
}
num95 = Primitives.ScaleExpansionZeroElim(num124, array53, num65, array31);
int num125 = Primitives.ScaleExpansionZeroElim(num123, array69, num65, array59);
num92 = Primitives.ScaleExpansionZeroElim(num125, array59, 2.0 * num7, array28);
int num93 = Primitives.ScaleExpansionZeroElim(num125, array59, num65, array29);
int num126 = Primitives.FastExpansionSumZeroElim(num92, array28, num93, array29, array32);
int num127 = Primitives.FastExpansionSumZeroElim(num95, array31, num126, array32, array34);
num62 = Primitives.FastExpansionSumZeroElim(num62, array71, num127, array34, array72);
double[] array82 = array71;
array71 = array72;
array72 = array82;
}
if (num66 != 0.0)
{
int num92 = Primitives.ScaleExpansionZeroElim(num2, array48, num66, array28);
int num128 = Primitives.ScaleExpansionZeroElim(num117, array66, num66, array54);
int num95 = Primitives.ScaleExpansionZeroElim(num128, array54, 2.0 * num10, array31);
int num96 = Primitives.FastExpansionSumZeroElim(num92, array28, num95, array31, array33);
num62 = Primitives.FastExpansionSumZeroElim(num62, array71, num96, array33, array72);
double[] array83 = array71;
array71 = array72;
array72 = array83;
num95 = Primitives.ScaleExpansionZeroElim(num128, array54, num66, array31);
int num129 = Primitives.ScaleExpansionZeroElim(num123, array69, num66, array60);
num92 = Primitives.ScaleExpansionZeroElim(num129, array60, 2.0 * num10, array28);
int num93 = Primitives.ScaleExpansionZeroElim(num129, array60, num66, array29);
int num126 = Primitives.FastExpansionSumZeroElim(num92, array28, num93, array29, array32);
int num127 = Primitives.FastExpansionSumZeroElim(num95, array31, num126, array32, array34);
num62 = Primitives.FastExpansionSumZeroElim(num62, array71, num127, array34, array72);
double[] array84 = array71;
array71 = array72;
array72 = array84;
}
}
if (num67 != 0.0 || num68 != 0.0)
{
int num138;
int num144;
if (num69 != 0.0 || num70 != 0.0 || num65 != 0.0 || num66 != 0.0)
{
double num102 = num69 * num10;
double num130 = Primitives.splitter * num69;
num15 = num130 - num69;
num16 = num130 - num15;
num17 = num69 - num16;
double num131 = Primitives.splitter * num10;
num15 = num131 - num10;
num19 = num131 - num15;
num20 = num10 - num19;
num21 = num102 - num16 * num19 - num17 * num19 - num16 * num20;
double num105 = num17 * num20 - num21;
double num106 = num9 * num66;
double num132 = Primitives.splitter * num9;
num15 = num132 - num9;
num16 = num132 - num15;
num17 = num9 - num16;
double num133 = Primitives.splitter * num66;
num15 = num133 - num66;
num19 = num133 - num15;
num20 = num66 - num19;
num21 = num106 - num16 * num19 - num17 * num19 - num16 * num20;
double num109 = num17 * num20 - num21;
num27 = num105 + num109;
num28 = num27 - num105;
num29 = num27 - num28;
num30 = num109 - num28;
num31 = num105 - num29;
array25[0] = num31 + num30;
num32 = num102 + num27;
num28 = num32 - num102;
num29 = num32 - num28;
num30 = num27 - num28;
num31 = num102 - num29;
num33 = num31 + num30;
num27 = num33 + num106;
num28 = num27 - num33;
num29 = num27 - num28;
num30 = num106 - num28;
num31 = num33 - num29;
array25[1] = num31 + num30;
double num110 = num32 + num27;
num28 = num110 - num32;
num29 = num110 - num28;
num30 = num27 - num28;
num31 = num32 - num29;
array25[2] = num31 + num30;
array25[3] = num110;
double num111 = -num12;
num102 = num65 * num111;
double num134 = Primitives.splitter * num65;
num15 = num134 - num65;
num16 = num134 - num15;
num17 = num65 - num16;
double num135 = Primitives.splitter * num111;
num15 = num135 - num111;
num19 = num135 - num15;
num20 = num111 - num19;
num21 = num102 - num16 * num19 - num17 * num19 - num16 * num20;
num105 = num17 * num20 - num21;
num111 = -num70;
num106 = num7 * num111;
double num136 = Primitives.splitter * num7;
num15 = num136 - num7;
num16 = num136 - num15;
num17 = num7 - num16;
double num137 = Primitives.splitter * num111;
num15 = num137 - num111;
num19 = num137 - num15;
num20 = num111 - num19;
num21 = num106 - num16 * num19 - num17 * num19 - num16 * num20;
num109 = num17 * num20 - num21;
num27 = num105 + num109;
num28 = num27 - num105;
num29 = num27 - num28;
num30 = num109 - num28;
num31 = num105 - num29;
array26[0] = num31 + num30;
num32 = num102 + num27;
num28 = num32 - num102;
num29 = num32 - num28;
num30 = num27 - num28;
num31 = num102 - num29;
num33 = num31 + num30;
num27 = num33 + num106;
num28 = num27 - num33;
num29 = num27 - num28;
num30 = num106 - num28;
num31 = num33 - num29;
array26[1] = num31 + num30;
double num116 = num32 + num27;
num28 = num116 - num32;
num29 = num116 - num28;
num30 = num27 - num28;
num31 = num32 - num29;
array26[2] = num31 + num30;
array26[3] = num116;
num138 = Primitives.FastExpansionSumZeroElim(4, array25, 4, array26, array67);
num102 = num69 * num66;
double num139 = Primitives.splitter * num69;
num15 = num139 - num69;
num16 = num139 - num15;
num17 = num69 - num16;
double num140 = Primitives.splitter * num66;
num15 = num140 - num66;
num19 = num140 - num15;
num20 = num66 - num19;
num21 = num102 - num16 * num19 - num17 * num19 - num16 * num20;
num105 = num17 * num20 - num21;
num106 = num65 * num70;
double num141 = Primitives.splitter * num65;
num15 = num141 - num65;
num16 = num141 - num15;
num17 = num65 - num16;
double num142 = Primitives.splitter * num70;
num15 = num142 - num70;
num19 = num142 - num15;
num20 = num70 - num19;
num21 = num106 - num16 * num19 - num17 * num19 - num16 * num20;
num109 = num17 * num20 - num21;
num27 = num105 - num109;
num28 = num105 - num27;
num29 = num27 + num28;
num30 = num28 - num109;
num31 = num105 - num29;
array70[0] = num31 + num30;
num32 = num102 + num27;
num28 = num32 - num102;
num29 = num32 - num28;
num30 = num27 - num28;
num31 = num102 - num29;
num33 = num31 + num30;
num27 = num33 - num106;
num28 = num33 - num27;
num29 = num27 + num28;
num30 = num28 - num106;
num31 = num33 - num29;
array70[1] = num31 + num30;
double num143 = num32 + num27;
num28 = num143 - num32;
num29 = num143 - num28;
num30 = num27 - num28;
num31 = num32 - num29;
array70[2] = num31 + num30;
array70[3] = num143;
num144 = 4;
}
else
{
array67[0] = 0.0;
num138 = 1;
array70[0] = 0.0;
num144 = 1;
}
if (num67 != 0.0)
{
int num92 = Primitives.ScaleExpansionZeroElim(num3, array49, num67, array28);
int num145 = Primitives.ScaleExpansionZeroElim(num138, array67, num67, array55);
int num95 = Primitives.ScaleExpansionZeroElim(num145, array55, 2.0 * num8, array31);
int num96 = Primitives.FastExpansionSumZeroElim(num92, array28, num95, array31, array33);
num62 = Primitives.FastExpansionSumZeroElim(num62, array71, num96, array33, array72);
double[] array85 = array71;
array71 = array72;
array72 = array85;
if (num70 != 0.0)
{
num92 = Primitives.ScaleExpansionZeroElim(Primitives.ScaleExpansionZeroElim(4, array22, num67, array27), array27, num70, array28);
num62 = Primitives.FastExpansionSumZeroElim(num62, array71, num92, array28, array72);
double[] array86 = array71;
array71 = array72;
array72 = array86;
}
if (num66 != 0.0)
{
num92 = Primitives.ScaleExpansionZeroElim(Primitives.ScaleExpansionZeroElim(4, array24, -num67, array27), array27, num66, array28);
num62 = Primitives.FastExpansionSumZeroElim(num62, array71, num92, array28, array72);
double[] array87 = array71;
array71 = array72;
array72 = array87;
}
num95 = Primitives.ScaleExpansionZeroElim(num145, array55, num67, array31);
int num146 = Primitives.ScaleExpansionZeroElim(num144, array70, num67, array61);
num92 = Primitives.ScaleExpansionZeroElim(num146, array61, 2.0 * num8, array28);
int num93 = Primitives.ScaleExpansionZeroElim(num146, array61, num67, array29);
int num126 = Primitives.FastExpansionSumZeroElim(num92, array28, num93, array29, array32);
int num127 = Primitives.FastExpansionSumZeroElim(num95, array31, num126, array32, array34);
num62 = Primitives.FastExpansionSumZeroElim(num62, array71, num127, array34, array72);
double[] array88 = array71;
array71 = array72;
array72 = array88;
}
if (num68 != 0.0)
{
int num92 = Primitives.ScaleExpansionZeroElim(num4, array50, num68, array28);
int num147 = Primitives.ScaleExpansionZeroElim(num138, array67, num68, array56);
int num95 = Primitives.ScaleExpansionZeroElim(num147, array56, 2.0 * num11, array31);
int num96 = Primitives.FastExpansionSumZeroElim(num92, array28, num95, array31, array33);
num62 = Primitives.FastExpansionSumZeroElim(num62, array71, num96, array33, array72);
double[] array89 = array71;
array71 = array72;
array72 = array89;
num95 = Primitives.ScaleExpansionZeroElim(num147, array56, num68, array31);
int num148 = Primitives.ScaleExpansionZeroElim(num144, array70, num68, array62);
num92 = Primitives.ScaleExpansionZeroElim(num148, array62, 2.0 * num11, array28);
int num93 = Primitives.ScaleExpansionZeroElim(num148, array62, num68, array29);
int num126 = Primitives.FastExpansionSumZeroElim(num92, array28, num93, array29, array32);
int num127 = Primitives.FastExpansionSumZeroElim(num95, array31, num126, array32, array34);
num62 = Primitives.FastExpansionSumZeroElim(num62, array71, num127, array34, array72);
double[] array90 = array71;
array71 = array72;
array72 = array90;
}
}
if (num69 != 0.0 || num70 != 0.0)
{
int num157;
int num163;
if (num65 != 0.0 || num66 != 0.0 || num67 != 0.0 || num68 != 0.0)
{
double num102 = num65 * num11;
double num149 = Primitives.splitter * num65;
num15 = num149 - num65;
num16 = num149 - num15;
num17 = num65 - num16;
double num150 = Primitives.splitter * num11;
num15 = num150 - num11;
num19 = num150 - num15;
num20 = num11 - num19;
num21 = num102 - num16 * num19 - num17 * num19 - num16 * num20;
double num105 = num17 * num20 - num21;
double num106 = num7 * num68;
double num151 = Primitives.splitter * num7;
num15 = num151 - num7;
num16 = num151 - num15;
num17 = num7 - num16;
double num152 = Primitives.splitter * num68;
num15 = num152 - num68;
num19 = num152 - num15;
num20 = num68 - num19;
num21 = num106 - num16 * num19 - num17 * num19 - num16 * num20;
double num109 = num17 * num20 - num21;
num27 = num105 + num109;
num28 = num27 - num105;
num29 = num27 - num28;
num30 = num109 - num28;
num31 = num105 - num29;
array25[0] = num31 + num30;
num32 = num102 + num27;
num28 = num32 - num102;
num29 = num32 - num28;
num30 = num27 - num28;
num31 = num102 - num29;
num33 = num31 + num30;
num27 = num33 + num106;
num28 = num27 - num33;
num29 = num27 - num28;
num30 = num106 - num28;
num31 = num33 - num29;
array25[1] = num31 + num30;
double num110 = num32 + num27;
num28 = num110 - num32;
num29 = num110 - num28;
num30 = num27 - num28;
num31 = num32 - num29;
array25[2] = num31 + num30;
array25[3] = num110;
double num111 = -num10;
num102 = num67 * num111;
double num153 = Primitives.splitter * num67;
num15 = num153 - num67;
num16 = num153 - num15;
num17 = num67 - num16;
double num154 = Primitives.splitter * num111;
num15 = num154 - num111;
num19 = num154 - num15;
num20 = num111 - num19;
num21 = num102 - num16 * num19 - num17 * num19 - num16 * num20;
num105 = num17 * num20 - num21;
num111 = -num66;
num106 = num8 * num111;
double num155 = Primitives.splitter * num8;
num15 = num155 - num8;
num16 = num155 - num15;
num17 = num8 - num16;
double num156 = Primitives.splitter * num111;
num15 = num156 - num111;
num19 = num156 - num15;
num20 = num111 - num19;
num21 = num106 - num16 * num19 - num17 * num19 - num16 * num20;
num109 = num17 * num20 - num21;
num27 = num105 + num109;
num28 = num27 - num105;
num29 = num27 - num28;
num30 = num109 - num28;
num31 = num105 - num29;
array26[0] = num31 + num30;
num32 = num102 + num27;
num28 = num32 - num102;
num29 = num32 - num28;
num30 = num27 - num28;
num31 = num102 - num29;
num33 = num31 + num30;
num27 = num33 + num106;
num28 = num27 - num33;
num29 = num27 - num28;
num30 = num106 - num28;
num31 = num33 - num29;
array26[1] = num31 + num30;
double num116 = num32 + num27;
num28 = num116 - num32;
num29 = num116 - num28;
num30 = num27 - num28;
num31 = num32 - num29;
array26[2] = num31 + num30;
array26[3] = num116;
num157 = Primitives.FastExpansionSumZeroElim(4, array25, 4, array26, array65);
num102 = num65 * num68;
double num158 = Primitives.splitter * num65;
num15 = num158 - num65;
num16 = num158 - num15;
num17 = num65 - num16;
double num159 = Primitives.splitter * num68;
num15 = num159 - num68;
num19 = num159 - num15;
num20 = num68 - num19;
num21 = num102 - num16 * num19 - num17 * num19 - num16 * num20;
num105 = num17 * num20 - num21;
num106 = num67 * num66;
double num160 = Primitives.splitter * num67;
num15 = num160 - num67;
num16 = num160 - num15;
num17 = num67 - num16;
double num161 = Primitives.splitter * num66;
num15 = num161 - num66;
num19 = num161 - num15;
num20 = num66 - num19;
num21 = num106 - num16 * num19 - num17 * num19 - num16 * num20;
num109 = num17 * num20 - num21;
num27 = num105 - num109;
num28 = num105 - num27;
num29 = num27 + num28;
num30 = num28 - num109;
num31 = num105 - num29;
array68[0] = num31 + num30;
num32 = num102 + num27;
num28 = num32 - num102;
num29 = num32 - num28;
num30 = num27 - num28;
num31 = num102 - num29;
num33 = num31 + num30;
num27 = num33 - num106;
num28 = num33 - num27;
num29 = num27 + num28;
num30 = num28 - num106;
num31 = num33 - num29;
array68[1] = num31 + num30;
double num162 = num32 + num27;
num28 = num162 - num32;
num29 = num162 - num28;
num30 = num27 - num28;
num31 = num32 - num29;
array68[2] = num31 + num30;
array68[3] = num162;
num163 = 4;
}
else
{
array65[0] = 0.0;
num157 = 1;
array68[0] = 0.0;
num163 = 1;
}
if (num69 != 0.0)
{
int num92 = Primitives.ScaleExpansionZeroElim(num5, array51, num69, array28);
int num164 = Primitives.ScaleExpansionZeroElim(num157, array65, num69, array57);
int num95 = Primitives.ScaleExpansionZeroElim(num164, array57, 2.0 * num9, array31);
int num96 = Primitives.FastExpansionSumZeroElim(num92, array28, num95, array31, array33);
num62 = Primitives.FastExpansionSumZeroElim(num62, array71, num96, array33, array72);
double[] array91 = array71;
array71 = array72;
array72 = array91;
if (num66 != 0.0)
{
num92 = Primitives.ScaleExpansionZeroElim(Primitives.ScaleExpansionZeroElim(4, array23, num69, array27), array27, num66, array28);
num62 = Primitives.FastExpansionSumZeroElim(num62, array71, num92, array28, array72);
double[] array92 = array71;
array71 = array72;
array72 = array92;
}
if (num68 != 0.0)
{
num92 = Primitives.ScaleExpansionZeroElim(Primitives.ScaleExpansionZeroElim(4, array22, -num69, array27), array27, num68, array28);
num62 = Primitives.FastExpansionSumZeroElim(num62, array71, num92, array28, array72);
double[] array93 = array71;
array71 = array72;
array72 = array93;
}
num95 = Primitives.ScaleExpansionZeroElim(num164, array57, num69, array31);
int num165 = Primitives.ScaleExpansionZeroElim(num163, array68, num69, array63);
num92 = Primitives.ScaleExpansionZeroElim(num165, array63, 2.0 * num9, array28);
int num93 = Primitives.ScaleExpansionZeroElim(num165, array63, num69, array29);
int num126 = Primitives.FastExpansionSumZeroElim(num92, array28, num93, array29, array32);
int num127 = Primitives.FastExpansionSumZeroElim(num95, array31, num126, array32, array34);
num62 = Primitives.FastExpansionSumZeroElim(num62, array71, num127, array34, array72);
double[] array94 = array71;
array71 = array72;
array72 = array94;
}
if (num70 != 0.0)
{
int num92 = Primitives.ScaleExpansionZeroElim(num6, array52, num70, array28);
int num166 = Primitives.ScaleExpansionZeroElim(num157, array65, num70, array58);
int num95 = Primitives.ScaleExpansionZeroElim(num166, array58, 2.0 * num12, array31);
int num96 = Primitives.FastExpansionSumZeroElim(num92, array28, num95, array31, array33);
num62 = Primitives.FastExpansionSumZeroElim(num62, array71, num96, array33, array72);
double[] array95 = array71;
array71 = array72;
array72 = array95;
num95 = Primitives.ScaleExpansionZeroElim(num166, array58, num70, array31);
int num167 = Primitives.ScaleExpansionZeroElim(num163, array68, num70, array64);
num92 = Primitives.ScaleExpansionZeroElim(num167, array64, 2.0 * num12, array28);
int num93 = Primitives.ScaleExpansionZeroElim(num167, array64, num70, array29);
int num126 = Primitives.FastExpansionSumZeroElim(num92, array28, num93, array29, array32);
int num127 = Primitives.FastExpansionSumZeroElim(num95, array31, num126, array32, array34);
num62 = Primitives.FastExpansionSumZeroElim(num62, array71, num127, array34, array72);
array71 = array72;
}
}
return array71[num62 - 1];
}
// Token: 0x04000072 RID: 114
private static double epsilon;
// Token: 0x04000073 RID: 115
private static double splitter;
// Token: 0x04000074 RID: 116
private static double resulterrbound;
// Token: 0x04000075 RID: 117
private static double ccwerrboundA;
// Token: 0x04000076 RID: 118
private static double ccwerrboundB;
// Token: 0x04000077 RID: 119
private static double ccwerrboundC;
// Token: 0x04000078 RID: 120
private static double iccerrboundA;
// Token: 0x04000079 RID: 121
private static double iccerrboundB;
// Token: 0x0400007A RID: 122
private static double iccerrboundC;
// Token: 0x0400007B RID: 123
private static double o3derrboundA;
// Token: 0x0400007C RID: 124
private static double o3derrboundB;
// Token: 0x0400007D RID: 125
private static double o3derrboundC;
}
}
+17
View File
@@ -0,0 +1,17 @@
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyTitle("Triangle")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Triangle")]
[assembly: AssemblyCopyright("Copyright © 2012")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("96a540d0-1772-4bed-8d25-ef5fa23cd1bc")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+489
View File
@@ -0,0 +1,489 @@
using System;
using System.Collections.Generic;
using TriangleNet.Data;
using TriangleNet.Geometry;
using TriangleNet.Log;
namespace TriangleNet
{
// Token: 0x02000007 RID: 7
internal class QualityMesher
{
// Token: 0x06000053 RID: 83 RVA: 0x0000A12C File Offset: 0x0000832C
public QualityMesher(Mesh mesh)
{
this.logger = SimpleLog.Instance;
this.badsubsegs = new Queue<BadSubseg>();
this.queue = new BadTriQueue();
this.mesh = mesh;
this.behavior = mesh.behavior;
this.newLocation = new NewLocation(mesh);
}
// Token: 0x06000054 RID: 84 RVA: 0x0000A17F File Offset: 0x0000837F
public void AddBadSubseg(BadSubseg badseg)
{
this.badsubsegs.Enqueue(badseg);
}
// Token: 0x06000055 RID: 85 RVA: 0x0000A190 File Offset: 0x00008390
public int CheckSeg4Encroach(ref Osub testsubseg)
{
Otri otri = default(Otri);
Osub osub = default(Osub);
int num = 0;
int num2 = 0;
Vertex vertex = testsubseg.Org();
Vertex vertex2 = testsubseg.Dest();
testsubseg.TriPivot(ref otri);
if (otri.triangle != Mesh.dummytri)
{
num2++;
Vertex vertex3 = otri.Apex();
double num3 = (vertex.x - vertex3.x) * (vertex2.x - vertex3.x) + (vertex.y - vertex3.y) * (vertex2.y - vertex3.y);
if (num3 < 0.0 && (this.behavior.ConformingDelaunay || num3 * num3 >= (2.0 * this.behavior.goodAngle - 1.0) * (2.0 * this.behavior.goodAngle - 1.0) * ((vertex.x - vertex3.x) * (vertex.x - vertex3.x) + (vertex.y - vertex3.y) * (vertex.y - vertex3.y)) * ((vertex2.x - vertex3.x) * (vertex2.x - vertex3.x) + (vertex2.y - vertex3.y) * (vertex2.y - vertex3.y))))
{
num = 1;
}
}
testsubseg.Sym(ref osub);
osub.TriPivot(ref otri);
if (otri.triangle != Mesh.dummytri)
{
num2++;
Vertex vertex3 = otri.Apex();
double num3 = (vertex.x - vertex3.x) * (vertex2.x - vertex3.x) + (vertex.y - vertex3.y) * (vertex2.y - vertex3.y);
if (num3 < 0.0 && (this.behavior.ConformingDelaunay || num3 * num3 >= (2.0 * this.behavior.goodAngle - 1.0) * (2.0 * this.behavior.goodAngle - 1.0) * ((vertex.x - vertex3.x) * (vertex.x - vertex3.x) + (vertex.y - vertex3.y) * (vertex.y - vertex3.y)) * ((vertex2.x - vertex3.x) * (vertex2.x - vertex3.x) + (vertex2.y - vertex3.y) * (vertex2.y - vertex3.y))))
{
num += 2;
}
}
if (num > 0 && (this.behavior.NoBisect == 0 || (this.behavior.NoBisect == 1 && num2 == 2)))
{
BadSubseg badSubseg = new BadSubseg();
if (num == 1)
{
badSubseg.encsubseg = testsubseg;
badSubseg.subsegorg = vertex;
badSubseg.subsegdest = vertex2;
}
else
{
badSubseg.encsubseg = osub;
badSubseg.subsegorg = vertex2;
badSubseg.subsegdest = vertex;
}
this.badsubsegs.Enqueue(badSubseg);
}
return num;
}
// Token: 0x06000056 RID: 86 RVA: 0x0000A4DC File Offset: 0x000086DC
public void TestTriangle(ref Otri testtri)
{
Otri otri = default(Otri);
Otri otri2 = default(Otri);
Osub osub = default(Osub);
Vertex vertex = testtri.Org();
Vertex vertex2 = testtri.Dest();
Vertex vertex3 = testtri.Apex();
double num = vertex.x - vertex2.x;
double num2 = vertex.y - vertex2.y;
double num3 = vertex2.x - vertex3.x;
double num4 = vertex2.y - vertex3.y;
double num5 = vertex3.x - vertex.x;
double num6 = vertex3.y - vertex.y;
double num7 = num * num;
double num8 = num2 * num2;
double num9 = num3 * num3;
double num10 = num4 * num4;
double num11 = num5 * num5;
double num12 = num6 * num6;
double num13 = num7 + num8;
double num14 = num9 + num10;
double num15 = num11 + num12;
double num16;
double num17;
Vertex vertex4;
Vertex vertex5;
if (num13 < num14 && num13 < num15)
{
num16 = num13;
num17 = num3 * num5 + num4 * num6;
num17 = num17 * num17 / (num14 * num15);
vertex4 = vertex;
vertex5 = vertex2;
testtri.Copy(ref otri);
}
else if (num14 < num15)
{
num16 = num14;
num17 = num * num5 + num2 * num6;
num17 = num17 * num17 / (num13 * num15);
vertex4 = vertex2;
vertex5 = vertex3;
testtri.Lnext(ref otri);
}
else
{
num16 = num15;
num17 = num * num3 + num2 * num4;
num17 = num17 * num17 / (num13 * num14);
vertex4 = vertex3;
vertex5 = vertex;
testtri.Lprev(ref otri);
}
if (this.behavior.VarArea || this.behavior.fixedArea || this.behavior.UserTest != null)
{
double num18 = 0.5 * (num * num4 - num2 * num3);
if (this.behavior.fixedArea && num18 > this.behavior.MaxArea)
{
this.queue.Enqueue(ref testtri, num16, vertex3, vertex, vertex2);
return;
}
if (this.behavior.VarArea && num18 > testtri.triangle.area && testtri.triangle.area > 0.0)
{
this.queue.Enqueue(ref testtri, num16, vertex3, vertex, vertex2);
return;
}
if (this.behavior.UserTest != null && this.behavior.UserTest(testtri.triangle, num18))
{
this.queue.Enqueue(ref testtri, num16, vertex3, vertex, vertex2);
return;
}
}
double num19;
if (num13 > num14 && num13 > num15)
{
num19 = (num14 + num15 - num13) / (2.0 * Math.Sqrt(num14 * num15));
}
else if (num14 > num15)
{
num19 = (num13 + num15 - num14) / (2.0 * Math.Sqrt(num13 * num15));
}
else
{
num19 = (num13 + num14 - num15) / (2.0 * Math.Sqrt(num13 * num14));
}
if (num17 > this.behavior.goodAngle || (num19 < this.behavior.maxGoodAngle && this.behavior.MaxAngle != 0.0))
{
if (vertex4.type == VertexType.SegmentVertex && vertex5.type == VertexType.SegmentVertex)
{
otri.SegPivot(ref osub);
if (osub.seg == Mesh.dummysub)
{
otri.Copy(ref otri2);
do
{
otri.OprevSelf();
otri.SegPivot(ref osub);
}
while (osub.seg == Mesh.dummysub);
Vertex vertex6 = osub.SegOrg();
Vertex vertex7 = osub.SegDest();
do
{
otri2.DnextSelf();
otri2.SegPivot(ref osub);
}
while (osub.seg == Mesh.dummysub);
Vertex vertex8 = osub.SegOrg();
Vertex vertex9 = osub.SegDest();
Vertex vertex10 = null;
if (vertex7.x == vertex8.x && vertex7.y == vertex8.y)
{
vertex10 = vertex7;
}
else if (vertex6.x == vertex9.x && vertex6.y == vertex9.y)
{
vertex10 = vertex6;
}
if (vertex10 != null)
{
double num20 = (vertex4.x - vertex10.x) * (vertex4.x - vertex10.x) + (vertex4.y - vertex10.y) * (vertex4.y - vertex10.y);
double num21 = (vertex5.x - vertex10.x) * (vertex5.x - vertex10.x) + (vertex5.y - vertex10.y) * (vertex5.y - vertex10.y);
if (num20 < 1.001 * num21 && num20 > 0.999 * num21)
{
return;
}
}
}
}
this.queue.Enqueue(ref testtri, num16, vertex3, vertex, vertex2);
}
}
// Token: 0x06000057 RID: 87 RVA: 0x0000A99C File Offset: 0x00008B9C
private void TallyEncs()
{
Osub osub = default(Osub);
osub.orient = 0;
foreach (Segment segment in this.mesh.subsegs.Values)
{
osub.seg = segment;
this.CheckSeg4Encroach(ref osub);
}
}
// Token: 0x06000058 RID: 88 RVA: 0x0000AA14 File Offset: 0x00008C14
private void SplitEncSegs(bool triflaws)
{
Otri otri = default(Otri);
Otri otri2 = default(Otri);
Osub osub = default(Osub);
Osub osub2 = default(Osub);
while (this.badsubsegs.Count > 0 && this.mesh.steinerleft != 0)
{
BadSubseg badSubseg = this.badsubsegs.Dequeue();
osub2 = badSubseg.encsubseg;
Vertex vertex = osub2.Org();
Vertex vertex2 = osub2.Dest();
if (!Osub.IsDead(osub2.seg) && vertex == badSubseg.subsegorg && vertex2 == badSubseg.subsegdest)
{
osub2.TriPivot(ref otri);
otri.Lnext(ref otri2);
otri2.SegPivot(ref osub);
bool flag = osub.seg != Mesh.dummysub;
otri2.LnextSelf();
otri2.SegPivot(ref osub);
bool flag2 = osub.seg != Mesh.dummysub;
if (!this.behavior.ConformingDelaunay && !flag && !flag2)
{
Vertex vertex3 = otri.Apex();
while (vertex3.type == VertexType.FreeVertex && (vertex.x - vertex3.x) * (vertex2.x - vertex3.x) + (vertex.y - vertex3.y) * (vertex2.y - vertex3.y) < 0.0)
{
this.mesh.DeleteVertex(ref otri2);
osub2.TriPivot(ref otri);
vertex3 = otri.Apex();
otri.Lprev(ref otri2);
}
}
otri.Sym(ref otri2);
if (otri2.triangle != Mesh.dummytri)
{
otri2.LnextSelf();
otri2.SegPivot(ref osub);
bool flag3 = osub.seg != Mesh.dummysub;
flag2 = flag2 || flag3;
otri2.LnextSelf();
otri2.SegPivot(ref osub);
bool flag4 = osub.seg != Mesh.dummysub;
flag = flag || flag4;
if (!this.behavior.ConformingDelaunay && !flag4 && !flag3)
{
Vertex vertex3 = otri2.Org();
while (vertex3.type == VertexType.FreeVertex && (vertex.x - vertex3.x) * (vertex2.x - vertex3.x) + (vertex.y - vertex3.y) * (vertex2.y - vertex3.y) < 0.0)
{
this.mesh.DeleteVertex(ref otri2);
otri.Sym(ref otri2);
vertex3 = otri2.Apex();
otri2.LprevSelf();
}
}
}
double num3;
if (flag || flag2)
{
double num = Math.Sqrt((vertex2.x - vertex.x) * (vertex2.x - vertex.x) + (vertex2.y - vertex.y) * (vertex2.y - vertex.y));
double num2 = 1.0;
while (num > 3.0 * num2)
{
num2 *= 2.0;
}
while (num < 1.5 * num2)
{
num2 *= 0.5;
}
num3 = num2 / num;
if (flag2)
{
num3 = 1.0 - num3;
}
}
else
{
num3 = 0.5;
}
Vertex vertex4 = new Vertex(vertex.x + num3 * (vertex2.x - vertex.x), vertex.y + num3 * (vertex2.y - vertex.y), osub2.Mark(), this.mesh.nextras);
vertex4.type = VertexType.SegmentVertex;
Vertex vertex5 = vertex4;
Mesh mesh = this.mesh;
int hash_vtx = mesh.hash_vtx;
mesh.hash_vtx = hash_vtx + 1;
vertex5.hash = hash_vtx;
vertex4.id = vertex4.hash;
this.mesh.vertices.Add(vertex4.hash, vertex4);
for (int i = 0; i < this.mesh.nextras; i++)
{
vertex4.attributes[i] = vertex.attributes[i] + num3 * (vertex2.attributes[i] - vertex.attributes[i]);
}
if (!Behavior.NoExact)
{
double num4 = Primitives.CounterClockwise(vertex, vertex2, vertex4);
double num5 = (vertex.x - vertex2.x) * (vertex.x - vertex2.x) + (vertex.y - vertex2.y) * (vertex.y - vertex2.y);
if (num4 != 0.0 && num5 != 0.0)
{
num4 /= num5;
if (!double.IsNaN(num4))
{
vertex4.x += num4 * (vertex2.y - vertex.y);
vertex4.y += num4 * (vertex.x - vertex2.x);
}
}
}
if ((vertex4.x == vertex.x && vertex4.y == vertex.y) || (vertex4.x == vertex2.x && vertex4.y == vertex2.y))
{
this.logger.Error("Ran out of precision: I attempted to split a segment to a smaller size than can be accommodated by the finite precision of floating point arithmetic.", "Quality.SplitEncSegs()");
throw new Exception("Ran out of precision");
}
InsertVertexResult insertVertexResult = this.mesh.InsertVertex(vertex4, ref otri, ref osub2, true, triflaws);
if (insertVertexResult != InsertVertexResult.Successful && insertVertexResult != InsertVertexResult.Encroaching)
{
this.logger.Error("Failure to split a segment.", "Quality.SplitEncSegs()");
throw new Exception("Failure to split a segment.");
}
if (this.mesh.steinerleft > 0)
{
this.mesh.steinerleft--;
}
this.CheckSeg4Encroach(ref osub2);
osub2.NextSelf();
this.CheckSeg4Encroach(ref osub2);
}
badSubseg.subsegorg = null;
}
}
// Token: 0x06000059 RID: 89 RVA: 0x0000B00C File Offset: 0x0000920C
private void TallyFaces()
{
Otri otri = default(Otri);
otri.orient = 0;
foreach (Triangle triangle in this.mesh.triangles.Values)
{
otri.triangle = triangle;
this.TestTriangle(ref otri);
}
}
// Token: 0x0600005A RID: 90 RVA: 0x0000B084 File Offset: 0x00009284
private void SplitTriangle(BadTriangle badtri)
{
Otri otri = default(Otri);
double num = 0.0;
double num2 = 0.0;
otri = badtri.poortri;
Vertex vertex = otri.Org();
Vertex vertex2 = otri.Dest();
Vertex vertex3 = otri.Apex();
if (!Otri.IsDead(otri.triangle) && vertex == badtri.triangorg && vertex2 == badtri.triangdest && vertex3 == badtri.triangapex)
{
bool flag = false;
Point point;
if (this.behavior.fixedArea || this.behavior.VarArea)
{
point = Primitives.FindCircumcenter(vertex, vertex2, vertex3, ref num, ref num2, this.behavior.offconstant);
}
else
{
point = this.newLocation.FindLocation(vertex, vertex2, vertex3, ref num, ref num2, true, otri);
}
if ((point.x == vertex.x && point.y == vertex.y) || (point.x == vertex2.x && point.y == vertex2.y) || (point.x == vertex3.x && point.y == vertex3.y))
{
if (Behavior.Verbose)
{
this.logger.Warning("New vertex falls on existing vertex.", "Quality.SplitTriangle()");
flag = true;
}
}
else
{
Vertex vertex4 = new Vertex(point.x, point.y, 0, this.mesh.nextras);
vertex4.type = VertexType.FreeVertex;
for (int i = 0; i < this.mesh.nextras; i++)
{
vertex4.attributes[i] = vertex.attributes[i] + num * (vertex2.attributes[i] - vertex.attributes[i]) + num2 * (vertex3.attributes[i] - vertex.attributes[i]);
}
if (num2 < num)
{
otri.LprevSelf();
}
Osub osub = default(Osub);
InsertVertexResult insertVertexResult = this.mesh.InsertVertex(vertex4, ref otri, ref osub, true, true);
if (insertVertexResult == InsertVertexResult.Successful)
{
Vertex vertex5 = vertex4;
Mesh mesh = this.mesh;
int hash_vtx = mesh.hash_vtx;
mesh.hash_vtx = hash_vtx + 1;
vertex5.hash = hash_vtx;
vertex4.id = vertex4.hash;
this.mesh.vertices.Add(vertex4.hash, vertex4);
if (this.mesh.steinerleft > 0)
{
this.mesh.steinerleft--;
}
}
else if (insertVertexResult == InsertVertexResult.Encroaching)
{
this.mesh.UndoVertex();
}
else if (insertVertexResult != InsertVertexResult.Violating && Behavior.Verbose)
{
this.logger.Warning("New vertex falls on existing vertex.", "Quality.SplitTriangle()");
flag = true;
}
}
if (flag)
{
this.logger.Error("The new vertex is at the circumcenter of triangle: This probably means that I am trying to refine triangles to a smaller size than can be accommodated by the finite precision of floating point arithmetic.", "Quality.SplitTriangle()");
throw new Exception("The new vertex is at the circumcenter of triangle.");
}
}
}
// Token: 0x0600005B RID: 91 RVA: 0x0000B358 File Offset: 0x00009558
public void EnforceQuality()
{
this.TallyEncs();
this.SplitEncSegs(false);
if (this.behavior.MinAngle > 0.0 || this.behavior.VarArea || this.behavior.fixedArea || this.behavior.UserTest != null)
{
this.TallyFaces();
this.mesh.checkquality = true;
while (this.queue.Count > 0 && this.mesh.steinerleft != 0)
{
BadTriangle badTriangle = this.queue.Dequeue();
this.SplitTriangle(badTriangle);
if (this.badsubsegs.Count > 0)
{
this.queue.Enqueue(badTriangle);
this.SplitEncSegs(true);
}
}
}
if (Behavior.Verbose && this.behavior.ConformingDelaunay && this.badsubsegs.Count > 0 && this.mesh.steinerleft == 0)
{
this.logger.Warning("I ran out of Steiner points, but the mesh has encroached subsegments, and therefore might not be truly Delaunay. If the Delaunay property is important to you, try increasing the number of Steiner points.", "Quality.EnforceQuality()");
}
}
// Token: 0x04000031 RID: 49
private Queue<BadSubseg> badsubsegs;
// Token: 0x04000032 RID: 50
private BadTriQueue queue;
// Token: 0x04000033 RID: 51
private Mesh mesh;
// Token: 0x04000034 RID: 52
private Behavior behavior;
// Token: 0x04000035 RID: 53
private NewLocation newLocation;
// Token: 0x04000036 RID: 54
private ILog<SimpleLogItem> logger;
}
}
+74
View File
@@ -0,0 +1,74 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace TriangleNet
{
// Token: 0x02000010 RID: 16
internal class Sampler
{
// Token: 0x06000090 RID: 144 RVA: 0x00010FFA File Offset: 0x0000F1FA
public void Reset()
{
this.samples = 1;
this.triangleCount = 0;
}
// Token: 0x06000091 RID: 145 RVA: 0x0001100A File Offset: 0x0000F20A
public void Update(Mesh mesh)
{
this.Update(mesh, false);
}
// Token: 0x06000092 RID: 146 RVA: 0x00011014 File Offset: 0x0000F214
public void Update(Mesh mesh, bool forceUpdate)
{
int count = mesh.triangles.Count;
if (this.triangleCount != count || forceUpdate)
{
this.triangleCount = count;
while (Sampler.samplefactor * this.samples * this.samples * this.samples < count)
{
this.samples++;
}
this.keys = mesh.triangles.Keys.ToArray<int>();
}
}
// Token: 0x06000093 RID: 147 RVA: 0x00011088 File Offset: 0x0000F288
public int[] GetSamples(Mesh mesh)
{
List<int> list = new List<int>(this.samples);
int num = this.triangleCount / this.samples;
for (int i = 0; i < this.samples; i++)
{
int num2 = Sampler.rand.Next(i * num, (i + 1) * num - 1);
if (!mesh.triangles.Keys.Contains(this.keys[num2]))
{
this.Update(mesh, true);
i--;
}
else
{
list.Add(this.keys[num2]);
}
}
return list.ToArray();
}
// Token: 0x0400007E RID: 126
private static Random rand = new Random(DateTime.Now.Millisecond);
// Token: 0x0400007F RID: 127
private int samples = 1;
// Token: 0x04000080 RID: 128
private int triangleCount;
// Token: 0x04000081 RID: 129
private static int samplefactor = 11;
// Token: 0x04000082 RID: 130
private int[] keys;
}
}
+11
View File
@@ -0,0 +1,11 @@
using System;
namespace TriangleNet.Smoothing
{
// Token: 0x0200001D RID: 29
public interface ISmoother
{
// Token: 0x06000108 RID: 264
void Smooth();
}
}
+73
View File
@@ -0,0 +1,73 @@
using System;
using TriangleNet.Data;
using TriangleNet.Geometry;
using TriangleNet.Tools;
namespace TriangleNet.Smoothing
{
// Token: 0x0200001E RID: 30
public class SimpleSmoother : ISmoother
{
// Token: 0x06000109 RID: 265 RVA: 0x00015047 File Offset: 0x00013247
public SimpleSmoother(Mesh mesh)
{
this.mesh = mesh;
}
// Token: 0x0600010A RID: 266 RVA: 0x00015058 File Offset: 0x00013258
public void Smooth()
{
this.mesh.behavior.Quality = false;
for (int i = 0; i < 5; i++)
{
this.Step();
this.mesh.Triangulate(this.Rebuild());
}
}
// Token: 0x0600010B RID: 267 RVA: 0x0001509C File Offset: 0x0001329C
private void Step()
{
foreach (VoronoiRegion voronoiRegion in new BoundedVoronoi(this.mesh, false).Regions)
{
int num = 0;
double num3;
double num2 = (num3 = 0.0);
foreach (Point point in voronoiRegion.Vertices)
{
num++;
num3 += point.x;
num2 += point.y;
}
voronoiRegion.Generator.x = num3 / (double)num;
voronoiRegion.Generator.y = num2 / (double)num;
}
}
// Token: 0x0600010C RID: 268 RVA: 0x00015174 File Offset: 0x00013374
private InputGeometry Rebuild()
{
InputGeometry inputGeometry = new InputGeometry(this.mesh.vertices.Count);
foreach (Vertex vertex in this.mesh.vertices.Values)
{
inputGeometry.AddPoint(vertex.x, vertex.y, vertex.mark);
}
foreach (Segment segment in this.mesh.subsegs.Values)
{
inputGeometry.AddSegment(segment.P0, segment.P1, segment.Boundary);
}
foreach (Point point in this.mesh.holes)
{
inputGeometry.AddHole(point.x, point.y);
}
foreach (RegionPointer regionPointer in this.mesh.regions)
{
inputGeometry.AddRegion(regionPointer.point.x, regionPointer.point.y, regionPointer.id);
}
return inputGeometry;
}
// Token: 0x040000D4 RID: 212
private Mesh mesh;
}
}
+224
View File
@@ -0,0 +1,224 @@
using System;
using TriangleNet.Data;
namespace TriangleNet.Tools
{
// Token: 0x02000012 RID: 18
public class AdjacencyMatrix
{
// Token: 0x1700001E RID: 30
// (get) Token: 0x0600009B RID: 155 RVA: 0x0001158A File Offset: 0x0000F78A
public int[] AdjacencyRow
{
get
{
return this.adj_row;
}
}
// Token: 0x1700001F RID: 31
// (get) Token: 0x0600009C RID: 156 RVA: 0x00011592 File Offset: 0x0000F792
public int[] Adjacency
{
get
{
return this.adj;
}
}
// Token: 0x0600009D RID: 157 RVA: 0x0001159C File Offset: 0x0000F79C
public AdjacencyMatrix(Mesh mesh)
{
this.node_num = mesh.vertices.Count;
this.adj_row = this.AdjacencyCount(mesh);
this.adj_num = this.adj_row[this.node_num] - 1;
this.adj = this.AdjacencySet(mesh, this.adj_row);
}
// Token: 0x0600009E RID: 158 RVA: 0x000115F8 File Offset: 0x0000F7F8
public int Bandwidth()
{
int num = 0;
int num2 = 0;
for (int i = 0; i < this.node_num; i++)
{
for (int j = this.adj_row[i]; j <= this.adj_row[i + 1] - 1; j++)
{
int num3 = this.adj[j - 1];
num = Math.Max(num, i - num3);
num2 = Math.Max(num2, num3 - i);
}
}
return num + 1 + num2;
}
// Token: 0x0600009F RID: 159 RVA: 0x00011664 File Offset: 0x0000F864
private int[] AdjacencyCount(Mesh mesh)
{
int[] array = new int[this.node_num + 1];
int i;
for (i = 0; i < this.node_num; i++)
{
array[i] = 1;
}
foreach (Triangle triangle in mesh.triangles.Values)
{
int id = triangle.id;
int id2 = triangle.vertices[0].id;
int id3 = triangle.vertices[1].id;
int id4 = triangle.vertices[2].id;
int num = triangle.neighbors[2].triangle.id;
if (num < 0 || id < num)
{
array[id2]++;
array[id3]++;
}
num = triangle.neighbors[0].triangle.id;
if (num < 0 || id < num)
{
array[id3]++;
array[id4]++;
}
num = triangle.neighbors[1].triangle.id;
if (num < 0 || id < num)
{
array[id4]++;
array[id2]++;
}
}
i = this.node_num;
while (1 <= i)
{
array[i] = array[i - 1];
i--;
}
array[0] = 1;
for (int j = 1; j <= this.node_num; j++)
{
array[j] = array[j - 1] + array[j];
}
return array;
}
// Token: 0x060000A0 RID: 160 RVA: 0x0001181C File Offset: 0x0000FA1C
private int[] AdjacencySet(Mesh mesh, int[] rows)
{
int[] array = new int[this.node_num];
Array.Copy(rows, array, this.node_num);
int num = rows[this.node_num] - 1;
int[] array2 = new int[num];
for (int i = 0; i < num; i++)
{
array2[i] = -1;
}
for (int i = 0; i < this.node_num; i++)
{
array2[array[i] - 1] = i;
array[i]++;
}
foreach (Triangle triangle in mesh.triangles.Values)
{
int id = triangle.id;
int id2 = triangle.vertices[0].id;
int id3 = triangle.vertices[1].id;
int id4 = triangle.vertices[2].id;
int num2 = triangle.neighbors[2].triangle.id;
if (num2 < 0 || id < num2)
{
array2[array[id2] - 1] = id3;
array[id2]++;
array2[array[id3] - 1] = id2;
array[id3]++;
}
num2 = triangle.neighbors[0].triangle.id;
if (num2 < 0 || id < num2)
{
array2[array[id3] - 1] = id4;
array[id3]++;
array2[array[id4] - 1] = id3;
array[id4]++;
}
num2 = triangle.neighbors[1].triangle.id;
if (num2 < 0 || id < num2)
{
array2[array[id2] - 1] = id4;
array[id2]++;
array2[array[id4] - 1] = id2;
array[id4]++;
}
}
for (int i = 0; i < this.node_num; i++)
{
int num3 = rows[i];
int num4 = rows[i + 1] - 1;
this.HeapSort(array2, num3 - 1, num4 + 1 - num3);
}
return array2;
}
// Token: 0x060000A1 RID: 161 RVA: 0x00011A38 File Offset: 0x0000FC38
private void CreateHeap(int[] a, int offset, int size)
{
int num = size / 2 - 1;
while (0 <= num)
{
int num2 = a[offset + num];
int num3 = num;
for (;;)
{
int num4 = 2 * num3 + 1;
if (size <= num4)
{
break;
}
if (num4 + 1 < size && a[offset + num4] < a[offset + num4 + 1])
{
num4++;
}
if (num2 >= a[offset + num4])
{
break;
}
a[offset + num3] = a[offset + num4];
num3 = num4;
}
a[offset + num3] = num2;
num--;
}
}
// Token: 0x060000A2 RID: 162 RVA: 0x00011A9C File Offset: 0x0000FC9C
private void HeapSort(int[] a, int offset, int size)
{
if (size <= 1)
{
return;
}
this.CreateHeap(a, offset, size);
int num = a[offset];
a[offset] = a[offset + size - 1];
a[offset + size - 1] = num;
int num2 = size - 1;
while (2 <= num2)
{
this.CreateHeap(a, offset, num2);
num = a[offset];
a[offset] = a[offset + num2 - 1];
a[offset + num2 - 1] = num;
num2--;
}
}
// Token: 0x04000086 RID: 134
private int node_num;
// Token: 0x04000087 RID: 135
private int adj_num;
// Token: 0x04000088 RID: 136
private int[] adj_row;
// Token: 0x04000089 RID: 137
private int[] adj;
}
}
+503
View File
@@ -0,0 +1,503 @@
using System;
using System.Collections.Generic;
using TriangleNet.Data;
using TriangleNet.Geometry;
namespace TriangleNet.Tools
{
// Token: 0x02000013 RID: 19
public class BoundedVoronoi : IVoronoi
{
// Token: 0x060000A3 RID: 163 RVA: 0x00011AFA File Offset: 0x0000FCFA
public BoundedVoronoi(Mesh mesh)
: this(mesh, true)
{
}
// Token: 0x060000A4 RID: 164 RVA: 0x00011B04 File Offset: 0x0000FD04
public BoundedVoronoi(Mesh mesh, bool includeBoundary)
{
this.mesh = mesh;
this.includeBoundary = includeBoundary;
this.Generate();
}
// Token: 0x17000020 RID: 32
// (get) Token: 0x060000A5 RID: 165 RVA: 0x00011B27 File Offset: 0x0000FD27
public Point[] Points
{
get
{
return this.points;
}
}
// Token: 0x17000021 RID: 33
// (get) Token: 0x060000A6 RID: 166 RVA: 0x00011B2F File Offset: 0x0000FD2F
public ICollection<VoronoiRegion> Regions
{
get
{
return this.regions;
}
}
// Token: 0x060000A7 RID: 167 RVA: 0x00011B38 File Offset: 0x0000FD38
private void Generate()
{
this.mesh.Renumber();
this.mesh.MakeVertexMap();
this.regions = new List<VoronoiRegion>(this.mesh.vertices.Count);
this.points = new Point[this.mesh.triangles.Count];
this.segPoints = new List<Point>(this.mesh.subsegs.Count * 4);
this.ComputeCircumCenters();
this.TagBlindTriangles();
foreach (Vertex vertex in this.mesh.vertices.Values)
{
if (vertex.type == VertexType.FreeVertex || vertex.Boundary == 0)
{
this.ConstructCell(vertex);
}
else if (this.includeBoundary)
{
this.ConstructBoundaryCell(vertex);
}
}
int num = this.points.Length;
Array.Resize<Point>(ref this.points, num + this.segPoints.Count);
for (int i = 0; i < this.segPoints.Count; i++)
{
this.points[num + i] = this.segPoints[i];
}
this.segPoints.Clear();
this.segPoints = null;
}
// Token: 0x060000A8 RID: 168 RVA: 0x00011C8C File Offset: 0x0000FE8C
private void ComputeCircumCenters()
{
Otri otri = default(Otri);
double num = 0.0;
double num2 = 0.0;
foreach (Triangle triangle in this.mesh.triangles.Values)
{
otri.triangle = triangle;
Point point = Primitives.FindCircumcenter(otri.Org(), otri.Dest(), otri.Apex(), ref num, ref num2);
point.id = triangle.id;
this.points[triangle.id] = point;
}
}
// Token: 0x060000A9 RID: 169 RVA: 0x00011D44 File Offset: 0x0000FF44
private void TagBlindTriangles()
{
int num = 0;
this.subsegMap = new Dictionary<int, Segment>();
Otri otri = default(Otri);
Otri otri2 = default(Otri);
Osub osub = default(Osub);
Osub osub2 = default(Osub);
foreach (Triangle triangle in this.mesh.triangles.Values)
{
triangle.infected = false;
}
foreach (Segment segment in this.mesh.subsegs.Values)
{
Stack<Triangle> stack = new Stack<Triangle>();
osub.seg = segment;
osub.orient = 0;
osub.TriPivot(ref otri);
if (otri.triangle != Mesh.dummytri && !otri.triangle.infected)
{
stack.Push(otri.triangle);
}
osub.SymSelf();
osub.TriPivot(ref otri);
if (otri.triangle != Mesh.dummytri && !otri.triangle.infected)
{
stack.Push(otri.triangle);
}
while (stack.Count > 0)
{
otri.triangle = stack.Pop();
otri.orient = 0;
if (this.TriangleIsBlinded(ref otri, ref osub))
{
otri.triangle.infected = true;
num++;
this.subsegMap.Add(otri.triangle.hash, osub.seg);
otri.orient = 0;
while (otri.orient < 3)
{
otri.Sym(ref otri2);
otri2.SegPivot(ref osub2);
if (otri2.triangle != Mesh.dummytri && !otri2.triangle.infected && osub2.seg == Mesh.dummysub)
{
stack.Push(otri2.triangle);
}
otri.orient++;
}
}
}
}
num = 0;
}
// Token: 0x060000AA RID: 170 RVA: 0x00011F80 File Offset: 0x00010180
private bool TriangleIsBlinded(ref Otri tri, ref Osub seg)
{
Vertex vertex = tri.Org();
Vertex vertex2 = tri.Dest();
Vertex vertex3 = tri.Apex();
Vertex vertex4 = seg.Org();
Vertex vertex5 = seg.Dest();
Point point = this.points[tri.triangle.id];
Point point2;
return this.SegmentsIntersect(vertex4, vertex5, point, vertex, out point2, true) || this.SegmentsIntersect(vertex4, vertex5, point, vertex2, out point2, true) || this.SegmentsIntersect(vertex4, vertex5, point, vertex3, out point2, true);
}
// Token: 0x060000AB RID: 171 RVA: 0x00012004 File Offset: 0x00010204
private void ConstructCell(Vertex vertex)
{
VoronoiRegion voronoiRegion = new VoronoiRegion(vertex);
this.regions.Add(voronoiRegion);
Otri otri = default(Otri);
Otri otri2 = default(Otri);
Otri otri3 = default(Otri);
Osub osub = default(Osub);
Osub osub2 = default(Osub);
int count = this.mesh.triangles.Count;
List<Point> list = new List<Point>();
vertex.tri.Copy(ref otri2);
if (otri2.Org() != vertex)
{
throw new Exception("ConstructBvdCell: inconsistent topology.");
}
otri2.Copy(ref otri);
otri2.Onext(ref otri3);
do
{
Point point = this.points[otri.triangle.id];
Point point2 = this.points[otri3.triangle.id];
if (!otri.triangle.infected)
{
list.Add(point);
if (otri3.triangle.infected)
{
osub2.seg = this.subsegMap[otri3.triangle.hash];
Point point3;
if (this.SegmentsIntersect(osub2.SegOrg(), osub2.SegDest(), point, point2, out point3, true))
{
Point point4 = point3;
int num = count;
int num2 = this.segIndex;
this.segIndex = num2 + 1;
point4.id = num + num2;
this.segPoints.Add(point3);
list.Add(point3);
}
}
}
else
{
osub.seg = this.subsegMap[otri.triangle.hash];
if (!otri3.triangle.infected)
{
Point point3;
if (this.SegmentsIntersect(osub.SegOrg(), osub.SegDest(), point, point2, out point3, true))
{
Point point5 = point3;
int num3 = count;
int num2 = this.segIndex;
this.segIndex = num2 + 1;
point5.id = num3 + num2;
this.segPoints.Add(point3);
list.Add(point3);
}
}
else
{
osub2.seg = this.subsegMap[otri3.triangle.hash];
if (!osub.Equal(osub2))
{
Point point3;
if (this.SegmentsIntersect(osub.SegOrg(), osub.SegDest(), point, point2, out point3, true))
{
Point point6 = point3;
int num4 = count;
int num2 = this.segIndex;
this.segIndex = num2 + 1;
point6.id = num4 + num2;
this.segPoints.Add(point3);
list.Add(point3);
}
if (this.SegmentsIntersect(osub2.SegOrg(), osub2.SegDest(), point, point2, out point3, true))
{
Point point7 = point3;
int num5 = count;
int num2 = this.segIndex;
this.segIndex = num2 + 1;
point7.id = num5 + num2;
this.segPoints.Add(point3);
list.Add(point3);
}
}
}
}
otri3.Copy(ref otri);
otri3.OnextSelf();
}
while (!otri.Equal(otri2));
voronoiRegion.Add(list);
}
// Token: 0x060000AC RID: 172 RVA: 0x000122DC File Offset: 0x000104DC
private void ConstructBoundaryCell(Vertex vertex)
{
VoronoiRegion voronoiRegion = new VoronoiRegion(vertex);
this.regions.Add(voronoiRegion);
Otri otri = default(Otri);
Otri otri2 = default(Otri);
Otri otri3 = default(Otri);
Otri otri4 = default(Otri);
Osub osub = default(Osub);
Osub osub2 = default(Osub);
int count = this.mesh.triangles.Count;
List<Point> list = new List<Point>();
vertex.tri.Copy(ref otri2);
if (otri2.Org() != vertex)
{
throw new Exception("ConstructBoundaryBvdCell: inconsistent topology.");
}
otri2.Copy(ref otri);
otri2.Onext(ref otri3);
otri2.Oprev(ref otri4);
if (otri4.triangle != Mesh.dummytri)
{
while (otri4.triangle != Mesh.dummytri && !otri4.Equal(otri2))
{
otri4.Copy(ref otri);
otri4.OprevSelf();
}
otri.Copy(ref otri2);
otri.Onext(ref otri3);
}
Point point;
int num2;
if (otri4.triangle == Mesh.dummytri)
{
point = new Point(vertex.x, vertex.y);
Point point2 = point;
int num = count;
num2 = this.segIndex;
this.segIndex = num2 + 1;
point2.id = num + num2;
this.segPoints.Add(point);
list.Add(point);
}
Vertex vertex2 = otri.Org();
Vertex vertex3 = otri.Dest();
point = new Point((vertex2.X + vertex3.X) / 2.0, (vertex2.Y + vertex3.Y) / 2.0);
Point point3 = point;
int num3 = count;
num2 = this.segIndex;
this.segIndex = num2 + 1;
point3.id = num3 + num2;
this.segPoints.Add(point);
list.Add(point);
Point point4;
Vertex vertex6;
for (;;)
{
point4 = this.points[otri.triangle.id];
if (otri3.triangle == Mesh.dummytri)
{
break;
}
Point point5 = this.points[otri3.triangle.id];
if (!otri.triangle.infected)
{
list.Add(point4);
if (otri3.triangle.infected)
{
osub2.seg = this.subsegMap[otri3.triangle.hash];
if (this.SegmentsIntersect(osub2.SegOrg(), osub2.SegDest(), point4, point5, out point, true))
{
Point point6 = point;
int num4 = count;
num2 = this.segIndex;
this.segIndex = num2 + 1;
point6.id = num4 + num2;
this.segPoints.Add(point);
list.Add(point);
}
}
}
else
{
osub.seg = this.subsegMap[otri.triangle.hash];
Vertex vertex4 = osub.SegOrg();
Vertex vertex5 = osub.SegDest();
if (!otri3.triangle.infected)
{
vertex3 = otri.Dest();
vertex6 = otri.Apex();
Point point7 = new Point((vertex3.X + vertex6.X) / 2.0, (vertex3.Y + vertex6.Y) / 2.0);
if (this.SegmentsIntersect(vertex4, vertex5, point7, point4, out point, false))
{
Point point8 = point;
int num5 = count;
num2 = this.segIndex;
this.segIndex = num2 + 1;
point8.id = num5 + num2;
this.segPoints.Add(point);
list.Add(point);
}
if (this.SegmentsIntersect(vertex4, vertex5, point4, point5, out point, true))
{
Point point9 = point;
int num6 = count;
num2 = this.segIndex;
this.segIndex = num2 + 1;
point9.id = num6 + num2;
this.segPoints.Add(point);
list.Add(point);
}
}
else
{
osub2.seg = this.subsegMap[otri3.triangle.hash];
if (!osub.Equal(osub2))
{
if (this.SegmentsIntersect(vertex4, vertex5, point4, point5, out point, true))
{
Point point10 = point;
int num7 = count;
num2 = this.segIndex;
this.segIndex = num2 + 1;
point10.id = num7 + num2;
this.segPoints.Add(point);
list.Add(point);
}
if (this.SegmentsIntersect(osub2.SegOrg(), osub2.SegDest(), point4, point5, out point, true))
{
Point point11 = point;
int num8 = count;
num2 = this.segIndex;
this.segIndex = num2 + 1;
point11.id = num8 + num2;
this.segPoints.Add(point);
list.Add(point);
}
}
else
{
Point point12 = new Point((vertex2.X + vertex3.X) / 2.0, (vertex2.Y + vertex3.Y) / 2.0);
if (this.SegmentsIntersect(vertex4, vertex5, point12, point5, out point, false))
{
Point point13 = point;
int num9 = count;
num2 = this.segIndex;
this.segIndex = num2 + 1;
point13.id = num9 + num2;
this.segPoints.Add(point);
list.Add(point);
}
}
}
}
otri3.Copy(ref otri);
otri3.OnextSelf();
if (otri.Equal(otri2))
{
goto IL_5B5;
}
}
if (!otri.triangle.infected)
{
list.Add(point4);
}
vertex2 = otri.Org();
vertex6 = otri.Apex();
point = new Point((vertex2.X + vertex6.X) / 2.0, (vertex2.Y + vertex6.Y) / 2.0);
Point point14 = point;
int num10 = count;
num2 = this.segIndex;
this.segIndex = num2 + 1;
point14.id = num10 + num2;
this.segPoints.Add(point);
list.Add(point);
IL_5B5:
voronoiRegion.Add(list);
}
// Token: 0x060000AD RID: 173 RVA: 0x000128A8 File Offset: 0x00010AA8
private bool SegmentsIntersect(Point p1, Point p2, Point p3, Point p4, out Point p, bool strictIntersect)
{
p = null;
double x = p1.X;
double y = p1.Y;
double num = p2.X;
double num2 = p2.Y;
double num3 = p3.X;
double num4 = p3.Y;
double num5 = p4.X;
double num6 = p4.Y;
if ((x == num && y == num2) || (num3 == num5 && num4 == num6))
{
return false;
}
if ((x == num3 && y == num4) || (num == num3 && num2 == num4) || (x == num5 && y == num6) || (num == num5 && num2 == num6))
{
return false;
}
num -= x;
num2 -= y;
num3 -= x;
num4 -= y;
num5 -= x;
num6 -= y;
double num7 = Math.Sqrt(num * num + num2 * num2);
double num8 = num / num7;
double num9 = num2 / num7;
double num10 = num3 * num8 + num4 * num9;
num4 = num4 * num8 - num3 * num9;
num3 = num10;
double num11 = num5 * num8 + num6 * num9;
num6 = num6 * num8 - num5 * num9;
num5 = num11;
if ((num4 < 0.0 && num6 < 0.0) || (num4 >= 0.0 && num6 >= 0.0 && strictIntersect))
{
return false;
}
double num12 = num5 + (num3 - num5) * num6 / (num6 - num4);
if (num12 < 0.0 || (num12 > num7 && strictIntersect))
{
return false;
}
p = new Point(x + num12 * num8, y + num12 * num9);
return true;
}
// Token: 0x0400008A RID: 138
private Mesh mesh;
// Token: 0x0400008B RID: 139
private Point[] points;
// Token: 0x0400008C RID: 140
private List<VoronoiRegion> regions;
// Token: 0x0400008D RID: 141
private List<Point> segPoints;
// Token: 0x0400008E RID: 142
private int segIndex;
// Token: 0x0400008F RID: 143
private Dictionary<int, Segment> subsegMap;
// Token: 0x04000090 RID: 144
private bool includeBoundary = true;
}
}
+299
View File
@@ -0,0 +1,299 @@
using System;
using TriangleNet.Log;
namespace TriangleNet.Tools
{
// Token: 0x02000014 RID: 20
public class CuthillMcKee
{
// Token: 0x060000AE RID: 174 RVA: 0x00012A2C File Offset: 0x00010C2C
public int[] Renumber(Mesh mesh)
{
this.node_num = mesh.vertices.Count;
mesh.Renumber(NodeNumbering.Linear);
this.matrix = new AdjacencyMatrix(mesh);
int num = this.matrix.Bandwidth();
int[] array = this.GenerateRcm();
int[] array2 = this.PermInverse(this.node_num, array);
int num2 = this.PermBandwidth(array, array2);
if (Behavior.Verbose)
{
SimpleLog.Instance.Info(string.Format("Reverse Cuthill-McKee (Bandwidth: {0} > {1})", num, num2));
}
return array2;
}
// Token: 0x060000AF RID: 175 RVA: 0x00012AB0 File Offset: 0x00010CB0
private int PermBandwidth(int[] perm, int[] perm_inv)
{
int[] adjacencyRow = this.matrix.AdjacencyRow;
int[] adjacency = this.matrix.Adjacency;
int num = 0;
int num2 = 0;
for (int i = 0; i < this.node_num; i++)
{
for (int j = adjacencyRow[perm[i]]; j <= adjacencyRow[perm[i] + 1] - 1; j++)
{
int num3 = perm_inv[adjacency[j - 1]];
num = Math.Max(num, i - num3);
num2 = Math.Max(num2, num3 - i);
}
}
return num + 1 + num2;
}
// Token: 0x060000B0 RID: 176 RVA: 0x00012B30 File Offset: 0x00010D30
private int[] GenerateRcm()
{
int[] array = new int[this.node_num];
int num = 0;
int num2 = 0;
int[] array2 = new int[this.node_num + 1];
int[] array3 = new int[this.node_num];
for (int i = 0; i < this.node_num; i++)
{
array3[i] = 1;
}
int num3 = 1;
for (int i = 0; i < this.node_num; i++)
{
if (array3[i] != 0)
{
int num4 = i;
this.FindRoot(ref num4, array3, ref num2, array2, array, num3 - 1);
this.Rcm(num4, array3, array, num3 - 1, ref num);
num3 += num;
if (this.node_num < num3)
{
return array;
}
}
}
return array;
}
// Token: 0x060000B1 RID: 177 RVA: 0x00012BD0 File Offset: 0x00010DD0
private void Rcm(int root, int[] mask, int[] perm, int offset, ref int iccsze)
{
int[] adjacencyRow = this.matrix.AdjacencyRow;
int[] adjacency = this.matrix.Adjacency;
int[] array = new int[this.node_num];
this.Degree(root, mask, array, ref iccsze, perm, offset);
mask[root] = 0;
if (iccsze <= 1)
{
return;
}
int i = 0;
int num = 1;
while (i < num)
{
int num2 = i + 1;
i = num;
for (int j = num2; j <= i; j++)
{
int num3 = perm[offset + j - 1];
int num4 = adjacencyRow[num3];
int num5 = adjacencyRow[num3 + 1] - 1;
int k = num + 1;
for (int l = num4; l <= num5; l++)
{
int num6 = adjacency[l - 1];
if (mask[num6] != 0)
{
num++;
mask[num6] = 0;
perm[offset + num - 1] = num6;
}
}
if (num > k)
{
int m = k;
while (m < num)
{
int num7 = m;
m++;
int num6 = perm[offset + m - 1];
while (k < num7)
{
int num8 = perm[offset + num7 - 1];
if (array[num8 - 1] <= array[num6 - 1])
{
break;
}
perm[offset + num7] = num8;
num7--;
}
perm[offset + num7] = num6;
}
}
}
}
this.ReverseVector(perm, offset, iccsze);
}
// Token: 0x060000B2 RID: 178 RVA: 0x00012D0C File Offset: 0x00010F0C
private void FindRoot(ref int root, int[] mask, ref int level_num, int[] level_row, int[] level, int offset)
{
int[] adjacencyRow = this.matrix.AdjacencyRow;
int[] adjacency = this.matrix.Adjacency;
int num = 0;
this.GetLevelSet(ref root, mask, ref level_num, level_row, level, offset);
int num2 = level_row[level_num] - 1;
if (level_num == 1 || level_num == num2)
{
return;
}
do
{
int num3 = num2;
int num4 = level_row[level_num - 1];
root = level[offset + num4 - 1];
if (num4 < num2)
{
for (int i = num4; i <= num2; i++)
{
int num5 = level[offset + i - 1];
int num6 = 0;
int num7 = adjacencyRow[num5 - 1];
int num8 = adjacencyRow[num5] - 1;
for (int j = num7; j <= num8; j++)
{
int num9 = adjacency[j - 1];
if (mask[num9] > 0)
{
num6++;
}
}
if (num6 < num3)
{
root = num5;
num3 = num6;
}
}
}
this.GetLevelSet(ref root, mask, ref num, level_row, level, offset);
if (num <= level_num)
{
break;
}
level_num = num;
}
while (num2 > level_num);
}
// Token: 0x060000B3 RID: 179 RVA: 0x00012DF8 File Offset: 0x00010FF8
private void GetLevelSet(ref int root, int[] mask, ref int level_num, int[] level_row, int[] level, int offset)
{
int[] adjacencyRow = this.matrix.AdjacencyRow;
int[] adjacency = this.matrix.Adjacency;
mask[root] = 0;
level[offset] = root;
level_num = 0;
int num = 0;
int num2 = 1;
do
{
int num3 = num + 1;
num = num2;
level_num++;
level_row[level_num - 1] = num3;
for (int i = num3; i <= num; i++)
{
int num4 = level[offset + i - 1];
int num5 = adjacencyRow[num4];
int num6 = adjacencyRow[num4 + 1] - 1;
for (int j = num5; j <= num6; j++)
{
int num7 = adjacency[j - 1];
if (mask[num7] != 0)
{
num2++;
level[offset + num2 - 1] = num7;
mask[num7] = 0;
}
}
}
}
while (num2 - num > 0);
level_row[level_num] = num + 1;
for (int i = 0; i < num2; i++)
{
mask[level[offset + i]] = 1;
}
}
// Token: 0x060000B4 RID: 180 RVA: 0x00012ECC File Offset: 0x000110CC
private void Degree(int root, int[] mask, int[] deg, ref int iccsze, int[] ls, int offset)
{
int[] adjacencyRow = this.matrix.AdjacencyRow;
int[] adjacency = this.matrix.Adjacency;
int i = 1;
ls[offset] = root;
adjacencyRow[root] = -adjacencyRow[root];
int num = 0;
iccsze = 1;
while (i > 0)
{
int num2 = num + 1;
num = iccsze;
for (int j = num2; j <= num; j++)
{
int num3 = ls[offset + j - 1];
int num4 = -adjacencyRow[num3];
int num5 = Math.Abs(adjacencyRow[num3 + 1]) - 1;
int num6 = 0;
for (int k = num4; k <= num5; k++)
{
int num7 = adjacency[k - 1];
if (mask[num7] != 0)
{
num6++;
if (0 <= adjacencyRow[num7])
{
adjacencyRow[num7] = -adjacencyRow[num7];
iccsze++;
ls[offset + iccsze - 1] = num7;
}
}
}
deg[num3] = num6;
}
i = iccsze - num;
}
for (int j = 0; j < iccsze; j++)
{
int num3 = ls[offset + j];
adjacencyRow[num3] = -adjacencyRow[num3];
}
}
// Token: 0x060000B5 RID: 181 RVA: 0x00012FC0 File Offset: 0x000111C0
private int[] PermInverse(int n, int[] perm)
{
int[] array = new int[this.node_num];
for (int i = 0; i < n; i++)
{
array[perm[i]] = i;
}
return array;
}
// Token: 0x060000B6 RID: 182 RVA: 0x00012FEC File Offset: 0x000111EC
private void ReverseVector(int[] a, int offset, int size)
{
for (int i = 0; i < size / 2; i++)
{
int num = a[offset + i];
a[offset + i] = a[offset + size - 1 - i];
a[offset + size - 1 - i] = num;
}
}
// Token: 0x04000091 RID: 145
private int node_num;
// Token: 0x04000092 RID: 146
private AdjacencyMatrix matrix;
}
}
+18
View File
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using TriangleNet.Geometry;
namespace TriangleNet.Tools
{
// Token: 0x02000015 RID: 21
public interface IVoronoi
{
// Token: 0x17000022 RID: 34
// (get) Token: 0x060000B8 RID: 184
Point[] Points { get; }
// Token: 0x17000023 RID: 35
// (get) Token: 0x060000B9 RID: 185
ICollection<VoronoiRegion> Regions { get; }
}
}
+272
View File
@@ -0,0 +1,272 @@
using System;
using System.Collections.Generic;
using TriangleNet.Geometry;
namespace TriangleNet.Tools
{
// Token: 0x02000017 RID: 23
internal class QuadNode
{
// Token: 0x060000BF RID: 191 RVA: 0x0001322D File Offset: 0x0001142D
public QuadNode(BoundingBox box, QuadTree tree)
: this(box, tree, false)
{
}
// Token: 0x060000C0 RID: 192 RVA: 0x00013238 File Offset: 0x00011438
public QuadNode(BoundingBox box, QuadTree tree, bool init)
{
this.tree = tree;
this.bounds = new BoundingBox(box.MinX, box.MinY, box.MaxX, box.MaxY);
this.pivot = new Point((box.MinX + box.MaxX) / 2.0, (box.MinY + box.MaxY) / 2.0);
this.bitRegions = 0;
this.regions = new QuadNode[4];
this.triangles = new List<int>();
if (init)
{
int num = tree.triangles.Length;
this.triangles.Capacity = num;
for (int i = 0; i < num; i++)
{
this.triangles.Add(i);
}
}
}
// Token: 0x060000C1 RID: 193 RVA: 0x000132FC File Offset: 0x000114FC
public List<int> FindTriangles(Point searchPoint)
{
int num = this.FindRegion(searchPoint);
if (this.regions[num] == null)
{
return this.triangles;
}
return this.regions[num].FindTriangles(searchPoint);
}
// Token: 0x060000C2 RID: 194 RVA: 0x00013330 File Offset: 0x00011530
public void CreateSubRegion(int currentDepth)
{
BoundingBox boundingBox = new BoundingBox(this.bounds.MinX, this.bounds.MinY, this.pivot.X, this.pivot.Y);
this.regions[0] = new QuadNode(boundingBox, this.tree);
boundingBox = new BoundingBox(this.pivot.X, this.bounds.MinY, this.bounds.MaxX, this.pivot.Y);
this.regions[1] = new QuadNode(boundingBox, this.tree);
boundingBox = new BoundingBox(this.bounds.MinX, this.pivot.Y, this.pivot.X, this.bounds.MaxY);
this.regions[2] = new QuadNode(boundingBox, this.tree);
boundingBox = new BoundingBox(this.pivot.X, this.pivot.Y, this.bounds.MaxX, this.bounds.MaxY);
this.regions[3] = new QuadNode(boundingBox, this.tree);
Point[] array = new Point[3];
foreach (int num in this.triangles)
{
ITriangle triangle = this.tree.triangles[num];
array[0] = triangle.GetVertex(0);
array[1] = triangle.GetVertex(1);
array[2] = triangle.GetVertex(2);
this.AddTriangleToRegion(array, num);
}
for (int i = 0; i < 4; i++)
{
if (this.regions[i].triangles.Count > this.tree.sizeBound && currentDepth < this.tree.maxDepth)
{
this.regions[i].CreateSubRegion(currentDepth + 1);
}
}
}
// Token: 0x060000C3 RID: 195 RVA: 0x00013524 File Offset: 0x00011724
private void AddTriangleToRegion(Point[] triangle, int index)
{
this.bitRegions = 0;
if (QuadTree.IsPointInTriangle(this.pivot, triangle[0], triangle[1], triangle[2]))
{
this.AddToRegion(index, 0);
this.AddToRegion(index, 1);
this.AddToRegion(index, 2);
this.AddToRegion(index, 3);
return;
}
this.FindTriangleIntersections(triangle, index);
if (this.bitRegions == 0)
{
int num = this.FindRegion(triangle[0]);
this.regions[num].triangles.Add(index);
}
}
// Token: 0x060000C4 RID: 196 RVA: 0x0001359C File Offset: 0x0001179C
private void FindTriangleIntersections(Point[] triangle, int index)
{
int num = 2;
int i = 0;
while (i < 3)
{
double num2 = triangle[i].X - triangle[num].X;
double num3 = triangle[i].Y - triangle[num].Y;
if (num2 != 0.0)
{
this.FindIntersectionsWithX(num2, num3, triangle, index, num);
}
if (num3 != 0.0)
{
this.FindIntersectionsWithY(num2, num3, triangle, index, num);
}
num = i++;
}
}
// Token: 0x060000C5 RID: 197 RVA: 0x0001360C File Offset: 0x0001180C
private void FindIntersectionsWithX(double dx, double dy, Point[] triangle, int index, int k)
{
double num = (this.pivot.X - triangle[k].X) / dx;
if (num < 1.000001 && num > -1E-06)
{
double num2 = triangle[k].Y + num * dy;
if (num2 < this.pivot.Y && num2 >= this.bounds.MinY)
{
this.AddToRegion(index, 0);
this.AddToRegion(index, 1);
}
else if (num2 <= this.bounds.MaxY)
{
this.AddToRegion(index, 2);
this.AddToRegion(index, 3);
}
}
num = (this.bounds.MinX - triangle[k].X) / dx;
if (num < 1.000001 && num > -1E-06)
{
double num3 = triangle[k].Y + num * dy;
if (num3 < this.pivot.Y && num3 >= this.bounds.MinY)
{
this.AddToRegion(index, 0);
}
else if (num3 <= this.bounds.MaxY)
{
this.AddToRegion(index, 2);
}
}
num = (this.bounds.MaxX - triangle[k].X) / dx;
if (num < 1.000001 && num > -1E-06)
{
double num4 = triangle[k].Y + num * dy;
if (num4 < this.pivot.Y && num4 >= this.bounds.MinY)
{
this.AddToRegion(index, 1);
return;
}
if (num4 <= this.bounds.MaxY)
{
this.AddToRegion(index, 3);
}
}
}
// Token: 0x060000C6 RID: 198 RVA: 0x000137A0 File Offset: 0x000119A0
private void FindIntersectionsWithY(double dx, double dy, Point[] triangle, int index, int k)
{
double num = (this.pivot.Y - triangle[k].Y) / dy;
if (num < 1.000001 && num > -1E-06)
{
double num2 = triangle[k].X + num * dx;
if (num2 > this.pivot.X && num2 <= this.bounds.MaxX)
{
this.AddToRegion(index, 1);
this.AddToRegion(index, 3);
}
else if (num2 >= this.bounds.MinX)
{
this.AddToRegion(index, 0);
this.AddToRegion(index, 2);
}
}
num = (this.bounds.MinY - triangle[k].Y) / dy;
if (num < 1.000001 && num > -1E-06)
{
double num2 = triangle[k].X + num * dx;
if (num2 > this.pivot.X && num2 <= this.bounds.MaxX)
{
this.AddToRegion(index, 1);
}
else if (num2 >= this.bounds.MinX)
{
this.AddToRegion(index, 0);
}
}
num = (this.bounds.MaxY - triangle[k].Y) / dy;
if (num < 1.000001 && num > -1E-06)
{
double num2 = triangle[k].X + num * dx;
if (num2 > this.pivot.X && num2 <= this.bounds.MaxX)
{
this.AddToRegion(index, 3);
return;
}
if (num2 >= this.bounds.MinX)
{
this.AddToRegion(index, 2);
}
}
}
// Token: 0x060000C7 RID: 199 RVA: 0x00013934 File Offset: 0x00011B34
private int FindRegion(Point point)
{
int num = 2;
if (point.Y < this.pivot.Y)
{
num = 0;
}
if (point.X > this.pivot.X)
{
num++;
}
return num;
}
// Token: 0x060000C8 RID: 200 RVA: 0x00013970 File Offset: 0x00011B70
private void AddToRegion(int index, int region)
{
if ((this.bitRegions & QuadNode.BITVECTOR[region]) == 0)
{
this.regions[region].triangles.Add(index);
this.bitRegions |= QuadNode.BITVECTOR[region];
}
}
// Token: 0x04000097 RID: 151
private const int SW = 0;
// Token: 0x04000098 RID: 152
private const int SE = 1;
// Token: 0x04000099 RID: 153
private const int NW = 2;
// Token: 0x0400009A RID: 154
private const int NE = 3;
// Token: 0x0400009B RID: 155
private const double EPS = 1E-06;
// Token: 0x0400009C RID: 156
private static readonly byte[] BITVECTOR = new byte[] { 1, 2, 4, 8 };
// Token: 0x0400009D RID: 157
private BoundingBox bounds;
// Token: 0x0400009E RID: 158
private Point pivot;
// Token: 0x0400009F RID: 159
private QuadTree tree;
// Token: 0x040000A0 RID: 160
private QuadNode[] regions;
// Token: 0x040000A1 RID: 161
private List<int> triangles;
// Token: 0x040000A2 RID: 162
private byte bitRegions;
}
}
+78
View File
@@ -0,0 +1,78 @@
using System;
using System.Collections.Generic;
using System.Linq;
using TriangleNet.Data;
using TriangleNet.Geometry;
namespace TriangleNet.Tools
{
// Token: 0x02000016 RID: 22
public class QuadTree
{
// Token: 0x060000BA RID: 186 RVA: 0x00013030 File Offset: 0x00011230
public QuadTree(Mesh mesh, int maxDepth, int sizeBound)
{
this.maxDepth = maxDepth;
this.sizeBound = sizeBound;
this.triangles = mesh.Triangles.ToArray<Triangle>();
int num = 0;
this.root = new QuadNode(mesh.Bounds, this, true);
this.root.CreateSubRegion(num + 1);
}
// Token: 0x060000BB RID: 187 RVA: 0x00013087 File Offset: 0x00011287
public QuadTree(Mesh mesh)
: this(mesh, 10, 10)
{
}
// Token: 0x060000BC RID: 188 RVA: 0x00013094 File Offset: 0x00011294
public ITriangle Query(double x, double y)
{
Point point = new Point(x, y);
List<int> list = this.root.FindTriangles(point);
List<ITriangle> list2 = new List<ITriangle>();
foreach (int num in list)
{
ITriangle triangle = this.triangles[num];
if (QuadTree.IsPointInTriangle(point, triangle.GetVertex(0), triangle.GetVertex(1), triangle.GetVertex(2)))
{
list2.Add(triangle);
break;
}
}
return list2.FirstOrDefault<ITriangle>();
}
// Token: 0x060000BD RID: 189 RVA: 0x00013130 File Offset: 0x00011330
internal static bool IsPointInTriangle(Point p, Point t0, Point t1, Point t2)
{
Point point = new Point(t1.X - t0.X, t1.Y - t0.Y);
Point point2 = new Point(t2.X - t0.X, t2.Y - t0.Y);
Point point3 = new Point(p.X - t0.X, p.Y - t0.Y);
Point point4 = new Point(-point.Y, point.X);
Point point5 = new Point(-point2.Y, point2.X);
double num = QuadTree.DotProduct(point3, point5) / QuadTree.DotProduct(point, point5);
double num2 = QuadTree.DotProduct(point3, point4) / QuadTree.DotProduct(point2, point4);
return num >= 0.0 && num2 >= 0.0 && num + num2 <= 1.0;
}
// Token: 0x060000BE RID: 190 RVA: 0x00013210 File Offset: 0x00011410
internal static double DotProduct(Point p, Point q)
{
return p.X * q.X + p.Y * q.Y;
}
// Token: 0x04000093 RID: 147
private QuadNode root;
// Token: 0x04000094 RID: 148
internal ITriangle[] triangles;
// Token: 0x04000095 RID: 149
internal int sizeBound;
// Token: 0x04000096 RID: 150
internal int maxDepth;
}
}
+408
View File
@@ -0,0 +1,408 @@
using System;
using TriangleNet.Data;
using TriangleNet.Geometry;
namespace TriangleNet.Tools
{
// Token: 0x02000018 RID: 24
public class QualityMeasure
{
// Token: 0x060000CA RID: 202 RVA: 0x000139C2 File Offset: 0x00011BC2
public QualityMeasure()
{
this.areaMeasure = new QualityMeasure.AreaMeasure();
this.alphaMeasure = new QualityMeasure.AlphaMeasure();
this.qMeasure = new QualityMeasure.Q_Measure();
}
// Token: 0x17000024 RID: 36
// (get) Token: 0x060000CB RID: 203 RVA: 0x000139EB File Offset: 0x00011BEB
public double AreaMinimum
{
get
{
return this.areaMeasure.area_min;
}
}
// Token: 0x17000025 RID: 37
// (get) Token: 0x060000CC RID: 204 RVA: 0x000139F8 File Offset: 0x00011BF8
public double AreaMaximum
{
get
{
return this.areaMeasure.area_max;
}
}
// Token: 0x17000026 RID: 38
// (get) Token: 0x060000CD RID: 205 RVA: 0x00013A05 File Offset: 0x00011C05
public double AreaRatio
{
get
{
return this.areaMeasure.area_max / this.areaMeasure.area_min;
}
}
// Token: 0x17000027 RID: 39
// (get) Token: 0x060000CE RID: 206 RVA: 0x00013A1E File Offset: 0x00011C1E
public double AlphaMinimum
{
get
{
return this.alphaMeasure.alpha_min;
}
}
// Token: 0x17000028 RID: 40
// (get) Token: 0x060000CF RID: 207 RVA: 0x00013A2B File Offset: 0x00011C2B
public double AlphaMaximum
{
get
{
return this.alphaMeasure.alpha_max;
}
}
// Token: 0x17000029 RID: 41
// (get) Token: 0x060000D0 RID: 208 RVA: 0x00013A38 File Offset: 0x00011C38
public double AlphaAverage
{
get
{
return this.alphaMeasure.alpha_ave;
}
}
// Token: 0x1700002A RID: 42
// (get) Token: 0x060000D1 RID: 209 RVA: 0x00013A45 File Offset: 0x00011C45
public double AlphaArea
{
get
{
return this.alphaMeasure.alpha_area;
}
}
// Token: 0x1700002B RID: 43
// (get) Token: 0x060000D2 RID: 210 RVA: 0x00013A52 File Offset: 0x00011C52
public double Q_Minimum
{
get
{
return this.qMeasure.q_min;
}
}
// Token: 0x1700002C RID: 44
// (get) Token: 0x060000D3 RID: 211 RVA: 0x00013A5F File Offset: 0x00011C5F
public double Q_Maximum
{
get
{
return this.qMeasure.q_max;
}
}
// Token: 0x1700002D RID: 45
// (get) Token: 0x060000D4 RID: 212 RVA: 0x00013A6C File Offset: 0x00011C6C
public double Q_Average
{
get
{
return this.qMeasure.q_ave;
}
}
// Token: 0x1700002E RID: 46
// (get) Token: 0x060000D5 RID: 213 RVA: 0x00013A79 File Offset: 0x00011C79
public double Q_Area
{
get
{
return this.qMeasure.q_area;
}
}
// Token: 0x060000D6 RID: 214 RVA: 0x00013A86 File Offset: 0x00011C86
public void Update(Mesh mesh)
{
this.mesh = mesh;
this.areaMeasure.Reset();
this.alphaMeasure.Reset();
this.qMeasure.Reset();
this.Compute();
}
// Token: 0x060000D7 RID: 215 RVA: 0x00013AB8 File Offset: 0x00011CB8
private void Compute()
{
int num = 0;
foreach (Triangle triangle in this.mesh.triangles.Values)
{
num++;
Point point = triangle.vertices[0];
Point point2 = triangle.vertices[1];
Point point3 = triangle.vertices[2];
double num2 = point.x - point2.x;
double num3 = point.y - point2.y;
double num4 = Math.Sqrt(num2 * num2 + num3 * num3);
double num5 = point2.x - point3.x;
num3 = point2.y - point3.y;
double num6 = Math.Sqrt(num5 * num5 + num3 * num3);
double num7 = point3.x - point.x;
num3 = point3.y - point.y;
double num8 = Math.Sqrt(num7 * num7 + num3 * num3);
double num9 = this.areaMeasure.Measure(point, point2, point3);
this.alphaMeasure.Measure(num4, num6, num8, num9);
this.qMeasure.Measure(num4, num6, num8, num9);
}
this.alphaMeasure.Normalize(num, this.areaMeasure.area_total);
this.qMeasure.Normalize(num, this.areaMeasure.area_total);
}
// Token: 0x060000D8 RID: 216 RVA: 0x00013C20 File Offset: 0x00011E20
public int Bandwidth()
{
if (this.mesh == null)
{
return 0;
}
int num = 0;
int num2 = 0;
foreach (Triangle triangle in this.mesh.triangles.Values)
{
for (int i = 0; i < 3; i++)
{
int id = triangle.GetVertex(i).id;
for (int j = 0; j < 3; j++)
{
int id2 = triangle.GetVertex(j).id;
num2 = Math.Max(num2, id2 - id);
num = Math.Max(num, id - id2);
}
}
}
return num + 1 + num2;
}
// Token: 0x040000A3 RID: 163
private QualityMeasure.AreaMeasure areaMeasure;
// Token: 0x040000A4 RID: 164
private QualityMeasure.AlphaMeasure alphaMeasure;
// Token: 0x040000A5 RID: 165
private QualityMeasure.Q_Measure qMeasure;
// Token: 0x040000A6 RID: 166
private Mesh mesh;
// Token: 0x02000041 RID: 65
private class AreaMeasure
{
// Token: 0x06000246 RID: 582 RVA: 0x0001B9BC File Offset: 0x00019BBC
public void Reset()
{
this.area_min = double.MaxValue;
this.area_max = double.MinValue;
this.area_total = 0.0;
this.area_zero = 0;
}
// Token: 0x06000247 RID: 583 RVA: 0x0001B9F4 File Offset: 0x00019BF4
public double Measure(Point a, Point b, Point c)
{
double num = 0.5 * Math.Abs(a.x * (b.y - c.y) + b.x * (c.y - a.y) + c.x * (a.y - b.y));
this.area_min = Math.Min(this.area_min, num);
this.area_max = Math.Max(this.area_max, num);
this.area_total += num;
if (num == 0.0)
{
this.area_zero++;
}
return num;
}
// Token: 0x0400013D RID: 317
public double area_min = double.MaxValue;
// Token: 0x0400013E RID: 318
public double area_max = double.MinValue;
// Token: 0x0400013F RID: 319
public double area_total;
// Token: 0x04000140 RID: 320
public int area_zero;
}
// Token: 0x02000042 RID: 66
private class AlphaMeasure
{
// Token: 0x06000249 RID: 585 RVA: 0x0001BAC2 File Offset: 0x00019CC2
public void Reset()
{
this.alpha_min = double.MaxValue;
this.alpha_max = double.MinValue;
this.alpha_ave = 0.0;
this.alpha_area = 0.0;
}
// Token: 0x0600024A RID: 586 RVA: 0x0001BB00 File Offset: 0x00019D00
private double acos(double c)
{
if (c <= -1.0)
{
return 3.141592653589793;
}
if (1.0 <= c)
{
return 0.0;
}
return Math.Acos(c);
}
// Token: 0x0600024B RID: 587 RVA: 0x0001BB34 File Offset: 0x00019D34
public double Measure(double ab, double bc, double ca, double area)
{
double num = double.MaxValue;
double num2 = ab * ab;
double num3 = bc * bc;
double num4 = ca * ca;
double num5;
double num6;
double num7;
if (ab == 0.0 && bc == 0.0 && ca == 0.0)
{
num5 = 2.0943951023931953;
num6 = 2.0943951023931953;
num7 = 2.0943951023931953;
}
else
{
if (ca == 0.0 || ab == 0.0)
{
num5 = 3.141592653589793;
}
else
{
num5 = this.acos((num4 + num2 - num3) / (2.0 * ca * ab));
}
if (ab == 0.0 || bc == 0.0)
{
num6 = 3.141592653589793;
}
else
{
num6 = this.acos((num2 + num3 - num4) / (2.0 * ab * bc));
}
if (bc == 0.0 || ca == 0.0)
{
num7 = 3.141592653589793;
}
else
{
num7 = this.acos((num3 + num4 - num2) / (2.0 * bc * ca));
}
}
num = Math.Min(num, num5);
num = Math.Min(num, num6);
num = Math.Min(num, num7);
num = num * 3.0 / 3.141592653589793;
this.alpha_ave += num;
this.alpha_area += area * num;
this.alpha_min = Math.Min(num, this.alpha_min);
this.alpha_max = Math.Max(num, this.alpha_max);
return num;
}
// Token: 0x0600024C RID: 588 RVA: 0x0001BCD8 File Offset: 0x00019ED8
public void Normalize(int n, double area_total)
{
if (n > 0)
{
this.alpha_ave /= (double)n;
}
else
{
this.alpha_ave = 0.0;
}
if (0.0 < area_total)
{
this.alpha_area /= area_total;
return;
}
this.alpha_area = 0.0;
}
// Token: 0x04000141 RID: 321
public double alpha_min;
// Token: 0x04000142 RID: 322
public double alpha_max;
// Token: 0x04000143 RID: 323
public double alpha_ave;
// Token: 0x04000144 RID: 324
public double alpha_area;
}
// Token: 0x02000043 RID: 67
private class Q_Measure
{
// Token: 0x0600024E RID: 590 RVA: 0x0001BD33 File Offset: 0x00019F33
public void Reset()
{
this.q_min = double.MaxValue;
this.q_max = double.MinValue;
this.q_ave = 0.0;
this.q_area = 0.0;
}
// Token: 0x0600024F RID: 591 RVA: 0x0001BD74 File Offset: 0x00019F74
public double Measure(double ab, double bc, double ca, double area)
{
double num = (bc + ca - ab) * (ca + ab - bc) * (ab + bc - ca) / (ab * bc * ca);
this.q_min = Math.Min(this.q_min, num);
this.q_max = Math.Max(this.q_max, num);
this.q_ave += num;
this.q_area += num * area;
return num;
}
// Token: 0x06000250 RID: 592 RVA: 0x0001BDE0 File Offset: 0x00019FE0
public void Normalize(int n, double area_total)
{
if (n > 0)
{
this.q_ave /= (double)n;
}
else
{
this.q_ave = 0.0;
}
if (area_total > 0.0)
{
this.q_area /= area_total;
return;
}
this.q_area = 0.0;
}
// Token: 0x04000145 RID: 325
public double q_min;
// Token: 0x04000146 RID: 326
public double q_max;
// Token: 0x04000147 RID: 327
public double q_ave;
// Token: 0x04000148 RID: 328
public double q_area;
}
}
}
+77
View File
@@ -0,0 +1,77 @@
using System;
using System.Collections.Generic;
using TriangleNet.Data;
namespace TriangleNet.Tools
{
// Token: 0x02000019 RID: 25
public class RegionIterator
{
// Token: 0x060000D9 RID: 217 RVA: 0x00013CE0 File Offset: 0x00011EE0
public RegionIterator(Mesh mesh)
{
this.mesh = mesh;
this.viri = new List<Triangle>();
}
// Token: 0x060000DA RID: 218 RVA: 0x00013CFC File Offset: 0x00011EFC
private void ProcessRegion(Action<Triangle> func)
{
Otri otri = default(Otri);
Otri otri2 = default(Otri);
Osub osub = default(Osub);
Behavior behavior = this.mesh.behavior;
for (int i = 0; i < this.viri.Count; i++)
{
otri.triangle = this.viri[i];
otri.Uninfect();
func(otri.triangle);
otri.orient = 0;
while (otri.orient < 3)
{
otri.Sym(ref otri2);
otri.SegPivot(ref osub);
if (otri2.triangle != Mesh.dummytri && !otri2.IsInfected() && osub.seg == Mesh.dummysub)
{
otri2.Infect();
this.viri.Add(otri2.triangle);
}
otri.orient++;
}
otri.Infect();
}
foreach (Triangle triangle in this.viri)
{
triangle.infected = false;
}
this.viri.Clear();
}
// Token: 0x060000DB RID: 219 RVA: 0x00013E34 File Offset: 0x00012034
public void Process(Triangle triangle)
{
this.Process(triangle, delegate(Triangle tri)
{
tri.region = triangle.region;
});
}
// Token: 0x060000DC RID: 220 RVA: 0x00013E66 File Offset: 0x00012066
public void Process(Triangle triangle, Action<Triangle> func)
{
if (triangle != Mesh.dummytri && !Otri.IsDead(triangle))
{
triangle.infected = true;
this.viri.Add(triangle);
this.ProcessRegion(func);
}
this.viri.Clear();
}
// Token: 0x040000A7 RID: 167
private Mesh mesh;
// Token: 0x040000A8 RID: 168
private List<Triangle> viri;
}
}
+568
View File
@@ -0,0 +1,568 @@
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;
}
}
+242
View File
@@ -0,0 +1,242 @@
using System;
using System.Collections.Generic;
using TriangleNet.Data;
using TriangleNet.Geometry;
namespace TriangleNet.Tools
{
// Token: 0x0200001B RID: 27
public class Voronoi : IVoronoi
{
// Token: 0x060000F6 RID: 246 RVA: 0x00014852 File Offset: 0x00012A52
public Voronoi(Mesh mesh)
{
this.mesh = mesh;
this.Generate();
}
// Token: 0x17000044 RID: 68
// (get) Token: 0x060000F7 RID: 247 RVA: 0x00014867 File Offset: 0x00012A67
public Point[] Points
{
get
{
return this.points;
}
}
// Token: 0x17000045 RID: 69
// (get) Token: 0x060000F8 RID: 248 RVA: 0x0001486F File Offset: 0x00012A6F
public ICollection<VoronoiRegion> Regions
{
get
{
return this.regions.Values;
}
}
// Token: 0x060000F9 RID: 249 RVA: 0x0001487C File Offset: 0x00012A7C
private void Generate()
{
this.mesh.Renumber();
this.mesh.MakeVertexMap();
this.points = new Point[this.mesh.triangles.Count + this.mesh.hullsize];
this.regions = new Dictionary<int, VoronoiRegion>(this.mesh.vertices.Count);
this.rayPoints = new Dictionary<int, Point>();
this.rayIndex = 0;
this.bounds = new BoundingBox();
this.ComputeCircumCenters();
foreach (Vertex vertex in this.mesh.vertices.Values)
{
this.regions.Add(vertex.id, new VoronoiRegion(vertex));
}
foreach (VoronoiRegion voronoiRegion in this.regions.Values)
{
this.ConstructVoronoiRegion(voronoiRegion);
}
}
// Token: 0x060000FA RID: 250 RVA: 0x000149AC File Offset: 0x00012BAC
private void ComputeCircumCenters()
{
Otri otri = default(Otri);
double num = 0.0;
double num2 = 0.0;
foreach (Triangle triangle in this.mesh.triangles.Values)
{
otri.triangle = triangle;
Point point = Primitives.FindCircumcenter(otri.Org(), otri.Dest(), otri.Apex(), ref num, ref num2);
point.id = triangle.id;
this.points[triangle.id] = point;
this.bounds.Expand(point.x, point.y);
}
double num3 = Math.Max(this.bounds.Width, this.bounds.Height);
this.bounds.Resize(num3, num3);
}
// Token: 0x060000FB RID: 251 RVA: 0x00014AA8 File Offset: 0x00012CA8
private void ConstructVoronoiRegion(VoronoiRegion region)
{
Vertex vertex = region.Generator as Vertex;
List<Point> list = new List<Point>();
Otri otri = default(Otri);
Otri otri2 = default(Otri);
Otri otri3 = default(Otri);
Otri otri4 = default(Otri);
Osub osub = default(Osub);
vertex.tri.Copy(ref otri2);
otri2.Copy(ref otri);
otri2.Onext(ref otri3);
if (otri3.triangle == Mesh.dummytri)
{
otri2.Oprev(ref otri4);
if (otri4.triangle != Mesh.dummytri)
{
otri2.Copy(ref otri3);
otri2.OprevSelf();
otri2.Copy(ref otri);
}
}
while (otri3.triangle != Mesh.dummytri)
{
list.Add(this.points[otri.triangle.id]);
region.AddNeighbor(otri.triangle.id, this.regions[otri.Apex().id]);
if (otri3.Equal(otri2))
{
region.Add(list);
return;
}
otri3.Copy(ref otri);
otri3.OnextSelf();
}
region.Bounded = false;
int count = this.mesh.triangles.Count;
otri.Lprev(ref otri3);
otri3.SegPivot(ref osub);
int num = osub.seg.hash;
list.Add(this.points[otri.triangle.id]);
region.AddNeighbor(otri.triangle.id, this.regions[otri.Apex().id]);
Point point;
if (!this.rayPoints.TryGetValue(num, out point))
{
Vertex vertex2 = otri.Org();
Vertex vertex3 = otri.Apex();
this.BoxRayIntersection(this.points[otri.triangle.id], vertex2.y - vertex3.y, vertex3.x - vertex2.x, out point);
point.id = count + this.rayIndex;
this.points[count + this.rayIndex] = point;
this.rayIndex++;
this.rayPoints.Add(num, point);
}
list.Add(point);
list.Reverse();
otri2.Copy(ref otri);
otri.Oprev(ref otri4);
while (otri4.triangle != Mesh.dummytri)
{
list.Add(this.points[otri4.triangle.id]);
region.AddNeighbor(otri4.triangle.id, this.regions[otri4.Apex().id]);
otri4.Copy(ref otri);
otri4.OprevSelf();
}
otri.SegPivot(ref osub);
num = osub.seg.hash;
if (!this.rayPoints.TryGetValue(num, out point))
{
Vertex vertex2 = otri.Org();
Vertex vertex4 = otri.Dest();
this.BoxRayIntersection(this.points[otri.triangle.id], vertex4.y - vertex2.y, vertex2.x - vertex4.x, out point);
point.id = count + this.rayIndex;
this.rayPoints.Add(num, point);
this.points[count + this.rayIndex] = point;
this.rayIndex++;
}
list.Add(point);
region.AddNeighbor(point.id, this.regions[otri.Dest().id]);
list.Reverse();
region.Add(list);
}
// Token: 0x060000FC RID: 252 RVA: 0x00014E44 File Offset: 0x00013044
private bool BoxRayIntersection(Point pt, double dx, double dy, out Point intersect)
{
double x = pt.X;
double y = pt.Y;
double minX = this.bounds.MinX;
double maxX = this.bounds.MaxX;
double minY = this.bounds.MinY;
double maxY = this.bounds.MaxY;
if (x < minX || x > maxX || y < minY || y > maxY)
{
intersect = null;
return false;
}
double num;
double num2;
double num3;
if (dx < 0.0)
{
num = (minX - x) / dx;
num2 = minX;
num3 = y + num * dy;
}
else if (dx > 0.0)
{
num = (maxX - x) / dx;
num2 = maxX;
num3 = y + num * dy;
}
else
{
num = double.MaxValue;
num3 = (num2 = 0.0);
}
double num4;
double num5;
double num6;
if (dy < 0.0)
{
num4 = (minY - y) / dy;
num5 = x + num4 * dx;
num6 = minY;
}
else if (dy > 0.0)
{
num4 = (maxY - y) / dy;
num5 = x + num4 * dx;
num6 = maxY;
}
else
{
num4 = double.MaxValue;
num6 = (num5 = 0.0);
}
if (num < num4)
{
intersect = new Point(num2, num3);
}
else
{
intersect = new Point(num5, num6);
}
return true;
}
// Token: 0x040000C9 RID: 201
private Mesh mesh;
// Token: 0x040000CA RID: 202
private Point[] points;
// Token: 0x040000CB RID: 203
private Dictionary<int, VoronoiRegion> regions;
// Token: 0x040000CC RID: 204
private Dictionary<int, Point> rayPoints;
// Token: 0x040000CD RID: 205
private int rayIndex;
// Token: 0x040000CE RID: 206
private BoundingBox bounds;
}
}
+116
View File
@@ -0,0 +1,116 @@
using System;
using System.Collections.Generic;
using TriangleNet.Data;
using TriangleNet.Geometry;
namespace TriangleNet.Tools
{
// Token: 0x0200001C RID: 28
public class VoronoiRegion
{
// Token: 0x17000046 RID: 70
// (get) Token: 0x060000FD RID: 253 RVA: 0x00014F7E File Offset: 0x0001317E
public int ID
{
get
{
return this.id;
}
}
// Token: 0x17000047 RID: 71
// (get) Token: 0x060000FE RID: 254 RVA: 0x00014F86 File Offset: 0x00013186
public Point Generator
{
get
{
return this.generator;
}
}
// Token: 0x17000048 RID: 72
// (get) Token: 0x060000FF RID: 255 RVA: 0x00014F8E File Offset: 0x0001318E
public ICollection<Point> Vertices
{
get
{
return this.vertices;
}
}
// Token: 0x17000049 RID: 73
// (get) Token: 0x06000100 RID: 256 RVA: 0x00014F96 File Offset: 0x00013196
// (set) Token: 0x06000101 RID: 257 RVA: 0x00014F9E File Offset: 0x0001319E
public bool Bounded
{
get
{
return this.bounded;
}
set
{
this.bounded = value;
}
}
// Token: 0x06000102 RID: 258 RVA: 0x00014FA7 File Offset: 0x000131A7
public VoronoiRegion(Vertex generator)
{
this.id = generator.id;
this.generator = generator;
this.vertices = new List<Point>();
this.bounded = true;
this.neighbors = new Dictionary<int, VoronoiRegion>();
}
// Token: 0x06000103 RID: 259 RVA: 0x00014FDF File Offset: 0x000131DF
public void Add(Point point)
{
this.vertices.Add(point);
}
// Token: 0x06000104 RID: 260 RVA: 0x00014FED File Offset: 0x000131ED
public void Add(List<Point> points)
{
this.vertices.AddRange(points);
}
// Token: 0x06000105 RID: 261 RVA: 0x00014FFC File Offset: 0x000131FC
public VoronoiRegion GetNeighbor(Point p)
{
VoronoiRegion voronoiRegion;
if (this.neighbors.TryGetValue(p.id, out voronoiRegion))
{
return voronoiRegion;
}
return null;
}
// Token: 0x06000106 RID: 262 RVA: 0x00015021 File Offset: 0x00013221
internal void AddNeighbor(int id, VoronoiRegion neighbor)
{
this.neighbors.Add(id, neighbor);
}
// Token: 0x06000107 RID: 263 RVA: 0x00015030 File Offset: 0x00013230
public override string ToString()
{
return string.Format("R-ID {0}", this.id);
}
// Token: 0x040000CF RID: 207
private int id;
// Token: 0x040000D0 RID: 208
private Point generator;
// Token: 0x040000D1 RID: 209
private List<Point> vertices;
// Token: 0x040000D2 RID: 210
private bool bounded;
// Token: 0x040000D3 RID: 211
private Dictionary<int, VoronoiRegion> neighbors;
}
}
+118
View File
@@ -0,0 +1,118 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{99604A24-13D0-4C83-A3AA-9A315339FA57}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>TriangleNet</RootNamespace>
<AssemblyName>Triangle</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoStdLib>true</NoStdLib>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoStdLib>true</NoStdLib>
</PropertyGroup>
<ItemGroup />
<ItemGroup>
<AppDesigner Include="Properties\" />
</ItemGroup>
<ItemGroup>
<Compile Include="Algorithm\Dwyer.cs" />
<Compile Include="Algorithm\Incremental.cs" />
<Compile Include="Algorithm\ITriangulator.cs" />
<Compile Include="Algorithm\SweepLine.cs" />
<Compile Include="BadTriQueue.cs" />
<Compile Include="Behavior.cs" />
<Compile Include="ConstraintMesher.cs" />
<Compile Include="Data\BadSubseg.cs" />
<Compile Include="Data\BadTriangle.cs" />
<Compile Include="Data\Osub.cs" />
<Compile Include="Data\Otri.cs" />
<Compile Include="Data\Segment.cs" />
<Compile Include="Data\Triangle.cs" />
<Compile Include="Data\Vertex.cs" />
<Compile Include="FindDirectionResult.cs" />
<Compile Include="Geometry\BoundingBox.cs" />
<Compile Include="Geometry\Edge.cs" />
<Compile Include="Geometry\EdgeEnumerator.cs" />
<Compile Include="Geometry\InputGeometry.cs" />
<Compile Include="Geometry\ISegment.cs" />
<Compile Include="Geometry\ITriangle.cs" />
<Compile Include="Geometry\Point.cs" />
<Compile Include="Geometry\RegionPointer.cs" />
<Compile Include="InsertVertexResult.cs" />
<Compile Include="IO\DataReader.cs" />
<Compile Include="IO\DebugWriter.cs" />
<Compile Include="IO\FileReader.cs" />
<Compile Include="IO\FileWriter.cs" />
<Compile Include="IO\IGeometryFormat.cs" />
<Compile Include="IO\IMeshFormat.cs" />
<Compile Include="IO\InputTriangle.cs" />
<Compile Include="IO\TriangleFormat.cs" />
<Compile Include="LocateResult.cs" />
<Compile Include="Log\ILog.cs" />
<Compile Include="Log\ILogItem.cs" />
<Compile Include="Log\LogLevel.cs" />
<Compile Include="Log\SimpleLog.cs" />
<Compile Include="Log\SimpleLogItem.cs" />
<Compile Include="Mesh.cs" />
<Compile Include="MeshValidator.cs" />
<Compile Include="NewLocation.cs" />
<Compile Include="NodeNumbering.cs" />
<Compile Include="Primitives.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="QualityMesher.cs" />
<Compile Include="Sampler.cs" />
<Compile Include="Smoothing\ISmoother.cs" />
<Compile Include="Smoothing\SimpleSmoother.cs" />
<Compile Include="Tools\AdjacencyMatrix.cs" />
<Compile Include="Tools\BoundedVoronoi.cs" />
<Compile Include="Tools\CuthillMcKee.cs" />
<Compile Include="Tools\IVoronoi.cs" />
<Compile Include="Tools\QuadNode.cs" />
<Compile Include="Tools\QuadTree.cs" />
<Compile Include="Tools\QualityMeasure.cs" />
<Compile Include="Tools\RegionIterator.cs" />
<Compile Include="Tools\Statistic.cs" />
<Compile Include="Tools\Voronoi.cs" />
<Compile Include="Tools\VoronoiRegion.cs" />
<Compile Include="TriangleLocator.cs" />
<Compile Include="TriangulationAlgorithm.cs" />
<Compile Include="VertexType.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\mscorlib\mscorlib.csproj">
<Project>{99604a24-13d0-4c83-a3aa-9a315339fa4c}</Project>
<Name>mscorlib</Name>
</ProjectReference>
<ProjectReference Include="..\System.Core\System.Core.csproj">
<Project>{99604a24-13d0-4c83-a3aa-9a315339fa55}</Project>
<Name>System.Core</Name>
</ProjectReference>
<ProjectReference Include="..\System\System.csproj">
<Project>{99604a24-13d0-4c83-a3aa-9a315339fa56}</Project>
<Name>System</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
+163
View File
@@ -0,0 +1,163 @@
using System;
using TriangleNet.Data;
using TriangleNet.Geometry;
namespace TriangleNet
{
// Token: 0x02000011 RID: 17
internal class TriangleLocator
{
// Token: 0x06000096 RID: 150 RVA: 0x0001114B File Offset: 0x0000F34B
public TriangleLocator(Mesh mesh)
{
this.mesh = mesh;
this.sampler = new Sampler();
}
// Token: 0x06000097 RID: 151 RVA: 0x00011165 File Offset: 0x0000F365
public void Update(ref Otri otri)
{
otri.Copy(ref this.recenttri);
}
// Token: 0x06000098 RID: 152 RVA: 0x00011173 File Offset: 0x0000F373
public void Reset()
{
this.recenttri.triangle = null;
}
// Token: 0x06000099 RID: 153 RVA: 0x00011184 File Offset: 0x0000F384
public LocateResult PreciseLocate(Point searchpoint, ref Otri searchtri, bool stopatsubsegment)
{
Otri otri = default(Otri);
Osub osub = default(Osub);
Vertex vertex = searchtri.Org();
Vertex vertex2 = searchtri.Dest();
Vertex vertex3 = searchtri.Apex();
while (vertex3.x != searchpoint.X || vertex3.y != searchpoint.Y)
{
double num = Primitives.CounterClockwise(vertex, vertex3, searchpoint);
double num2 = Primitives.CounterClockwise(vertex3, vertex2, searchpoint);
bool flag;
if (num > 0.0)
{
flag = num2 <= 0.0 || (vertex3.x - searchpoint.X) * (vertex2.x - vertex.x) + (vertex3.y - searchpoint.Y) * (vertex2.y - vertex.y) > 0.0;
}
else if (num2 > 0.0)
{
flag = false;
}
else
{
if (num == 0.0)
{
searchtri.LprevSelf();
return LocateResult.OnEdge;
}
if (num2 == 0.0)
{
searchtri.LnextSelf();
return LocateResult.OnEdge;
}
return LocateResult.InTriangle;
}
if (flag)
{
searchtri.Lprev(ref otri);
vertex2 = vertex3;
}
else
{
searchtri.Lnext(ref otri);
vertex = vertex3;
}
otri.Sym(ref searchtri);
if (this.mesh.checksegments && stopatsubsegment)
{
otri.SegPivot(ref osub);
if (osub.seg != Mesh.dummysub)
{
otri.Copy(ref searchtri);
return LocateResult.Outside;
}
}
if (searchtri.triangle == Mesh.dummytri)
{
otri.Copy(ref searchtri);
return LocateResult.Outside;
}
vertex3 = searchtri.Apex();
}
searchtri.LprevSelf();
return LocateResult.OnVertex;
}
// Token: 0x0600009A RID: 154 RVA: 0x00011310 File Offset: 0x0000F510
public LocateResult Locate(Point searchpoint, ref Otri searchtri)
{
Otri otri = default(Otri);
Vertex vertex = searchtri.Org();
double num = (searchpoint.X - vertex.x) * (searchpoint.X - vertex.x) + (searchpoint.Y - vertex.y) * (searchpoint.Y - vertex.y);
if (this.recenttri.triangle != null && !Otri.IsDead(this.recenttri.triangle))
{
vertex = this.recenttri.Org();
if (vertex.x == searchpoint.X && vertex.y == searchpoint.Y)
{
this.recenttri.Copy(ref searchtri);
return LocateResult.OnVertex;
}
double num2 = (searchpoint.X - vertex.x) * (searchpoint.X - vertex.x) + (searchpoint.Y - vertex.y) * (searchpoint.Y - vertex.y);
if (num2 < num)
{
this.recenttri.Copy(ref searchtri);
num = num2;
}
}
this.sampler.Update(this.mesh);
foreach (int num3 in this.sampler.GetSamples(this.mesh))
{
otri.triangle = this.mesh.triangles[num3];
if (!Otri.IsDead(otri.triangle))
{
vertex = otri.Org();
double num2 = (searchpoint.X - vertex.x) * (searchpoint.X - vertex.x) + (searchpoint.Y - vertex.y) * (searchpoint.Y - vertex.y);
if (num2 < num)
{
otri.Copy(ref searchtri);
num = num2;
}
}
}
vertex = searchtri.Org();
Vertex vertex2 = searchtri.Dest();
if (vertex.x == searchpoint.X && vertex.y == searchpoint.Y)
{
return LocateResult.OnVertex;
}
if (vertex2.x == searchpoint.X && vertex2.y == searchpoint.Y)
{
searchtri.LnextSelf();
return LocateResult.OnVertex;
}
double num4 = Primitives.CounterClockwise(vertex, vertex2, searchpoint);
if (num4 < 0.0)
{
searchtri.SymSelf();
}
else if (num4 == 0.0 && vertex.x < searchpoint.X == searchpoint.X < vertex2.x && vertex.y < searchpoint.Y == searchpoint.Y < vertex2.y)
{
return LocateResult.OnEdge;
}
return this.PreciseLocate(searchpoint, ref searchtri, false);
}
// Token: 0x04000083 RID: 131
private Sampler sampler;
// Token: 0x04000084 RID: 132
private Mesh mesh;
// Token: 0x04000085 RID: 133
internal Otri recenttri;
}
}
+15
View File
@@ -0,0 +1,15 @@
using System;
namespace TriangleNet
{
// Token: 0x02000008 RID: 8
public enum TriangulationAlgorithm
{
// Token: 0x04000038 RID: 56
Dwyer,
// Token: 0x04000039 RID: 57
Incremental,
// Token: 0x0400003A RID: 58
SweepLine
}
}
+19
View File
@@ -0,0 +1,19 @@
using System;
namespace TriangleNet
{
// Token: 0x0200000C RID: 12
public enum VertexType
{
// Token: 0x0400004A RID: 74
InputVertex,
// Token: 0x0400004B RID: 75
SegmentVertex,
// Token: 0x0400004C RID: 76
FreeVertex,
// Token: 0x0400004D RID: 77
DeadVertex,
// Token: 0x0400004E RID: 78
UndeadVertex
}
}