Files
Dec2017-Script-Dump/Triangle/BadTriQueue.cs
T
2026-06-04 11:42:34 +02:00

144 lines
3.0 KiB
C#

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;
}
}