3 using System.Collections.Generic;
9 private static bool isIn(List<Vector3> vList, Vector3 vertex,
float threshold) {
10 foreach(Vector3 v
in vList) {
11 if(Vector3.Distance(v, vertex) <= threshold)
20 public static MeshData Weld(
int[] triangles, Vector3[] vertices, Vector3 b0, Vector3 b1) {
21 Vector3[] verts = vertices;
26 List<Vector3> newVerts =
new List<Vector3>();
29 foreach (Vector3 vert
in verts) {
31 if (!vertexTree.FindOrAddVertex(vert, vIndex)) {
37 int[] tris = triangles;
38 for (
int i = 0; i < tris.Length; ++i) {
40 tris[i] = vertexTree.GetIndex(verts[tris[i]]);
44 foreach(
int index
in tris)
49 Debug.Log(
"GenerateMesh::AutoWeld > Number of new vertices in list, and max triangle index in new triangle array.");
50 Debug.Log(newVerts.Count.ToString());
51 Debug.Log(max.ToString());
55 result.
vertices = newVerts.ToArray();
static bool isIn(List< Vector3 > vList, Vector3 vertex, float threshold)
static MeshData Weld(int[] triangles, Vector3[] vertices, Vector3 b0, Vector3 b1)