scripts
This commit is contained in:
@@ -0,0 +1,108 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace ProBuilder2.Common
|
||||
{
|
||||
// Token: 0x0200000F RID: 15
|
||||
public static class EdgeExtensions
|
||||
{
|
||||
// Token: 0x06000079 RID: 121 RVA: 0x0000E57C File Offset: 0x0000C97C
|
||||
public static bool ContainsDuplicate(this List<pb_Edge> edges, pb_Edge edge, Dictionary<int, int> lookup)
|
||||
{
|
||||
int num = 0;
|
||||
for (int i = 0; i < edges.Count; i++)
|
||||
{
|
||||
if (edges[i].Equals(edge, lookup) && ++num > 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Token: 0x0600007A RID: 122 RVA: 0x0000E5C4 File Offset: 0x0000C9C4
|
||||
public static bool Contains(this pb_Edge[] edges, pb_Edge edge)
|
||||
{
|
||||
for (int i = 0; i < edges.Length; i++)
|
||||
{
|
||||
if (edges[i].Equals(edge))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Token: 0x0600007B RID: 123 RVA: 0x0000E5F8 File Offset: 0x0000C9F8
|
||||
public static bool Contains(this pb_Edge[] edges, int x, int y)
|
||||
{
|
||||
for (int i = 0; i < edges.Length; i++)
|
||||
{
|
||||
if ((x == edges[i].x && y == edges[i].y) || (x == edges[i].y && y == edges[i].x))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Token: 0x0600007C RID: 124 RVA: 0x0000E654 File Offset: 0x0000CA54
|
||||
public static IEnumerable<pb_Edge> DistinctCommon(this IEnumerable<pb_Edge> edges, Dictionary<int, int> lookup)
|
||||
{
|
||||
IEnumerable<pb_EdgeLookup> enumerable = edges.Select((pb_Edge x) => new pb_EdgeLookup(new pb_Edge(lookup[x.x], lookup[x.y]), x));
|
||||
enumerable = enumerable.Distinct<pb_EdgeLookup>();
|
||||
return enumerable.Select((pb_EdgeLookup x) => x.local);
|
||||
}
|
||||
|
||||
// Token: 0x0600007D RID: 125 RVA: 0x0000E6AC File Offset: 0x0000CAAC
|
||||
public static int IndexOf(this IList<pb_Edge> edges, pb_Edge edge, Dictionary<int, int> lookup)
|
||||
{
|
||||
for (int i = 0; i < edges.Count; i++)
|
||||
{
|
||||
if (edges[i].Equals(edge, lookup))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Token: 0x0600007E RID: 126 RVA: 0x0000E6E8 File Offset: 0x0000CAE8
|
||||
public static List<int> ToIntList(this List<pb_Edge> edges)
|
||||
{
|
||||
List<int> list = new List<int>();
|
||||
foreach (pb_Edge pb_Edge in edges)
|
||||
{
|
||||
list.Add(pb_Edge.x);
|
||||
list.Add(pb_Edge.y);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
// Token: 0x0600007F RID: 127 RVA: 0x0000E758 File Offset: 0x0000CB58
|
||||
public static int[] AllTriangles(this pb_Edge[] edges)
|
||||
{
|
||||
int[] array = new int[edges.Length * 2];
|
||||
int num = 0;
|
||||
for (int i = 0; i < edges.Length; i++)
|
||||
{
|
||||
array[num++] = edges[i].x;
|
||||
array[num++] = edges[i].y;
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
// Token: 0x06000080 RID: 128 RVA: 0x0000E7A8 File Offset: 0x0000CBA8
|
||||
public static List<int> AllTriangles(this List<pb_Edge> edges)
|
||||
{
|
||||
List<int> list = new List<int>();
|
||||
for (int i = 0; i < edges.Count; i++)
|
||||
{
|
||||
list.Add(edges[i].x);
|
||||
list.Add(edges[i].y);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user