public static void split_tests_nonmanifold(int N = 100) { System.Console.WriteLine("split_tests_nonmanifold() starting"); Random r = new Random(31337); NTMesh3 mesh = new NTMesh3(); int a = mesh.AppendVertex(Vector3d.Zero); int b = mesh.AppendVertex(Vector3d.AxisZ); for (int k = 0; k < 5; ++k) { int c = mesh.AppendVertex(TestUtil.RandomPoints3(1, r, Vector3d.Zero, 1)[0]); int tid = mesh.AppendTriangle(new Index3i(a, b, c)); Debug.Assert(tid >= 0); } TestUtil.WriteTestOutputMesh(mesh.Deconstruct(), "nonmanifold_split_input.obj"); for (int k = 0; k < N; ++k) { int eid = r.Next() % mesh.EdgeCount; if (!mesh.IsEdge(eid)) { continue; } NTMesh3.EdgeSplitInfo splitInfo; MeshResult result = mesh.SplitEdge(eid, out splitInfo); Debug.Assert(result == MeshResult.Ok); mesh.CheckValidity(FailMode.DebugAssert); } TestUtil.WriteTestOutputMesh(mesh.Deconstruct(), "nonmanifold_split_output.obj"); }
public virtual void MakeMesh(NTMesh3 m) { int nV = vertices.Count; for (int i = 0; i < nV; ++i) { int vID = m.AppendVertex(vertices[i]); Util.gDevAssert(vID == i); } int nT = triangles.Count; if (WantGroups && groups != null && groups.Length == nT) { m.EnableTriangleGroups(); for (int i = 0; i < nT; ++i) { m.AppendTriangle(triangles[i], groups[i]); } } else { for (int i = 0; i < nT; ++i) { m.AppendTriangle(triangles[i]); } } }