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 static void split_tests(bool bTestBoundary, int N = 100) { System.Console.WriteLine("split_tests() starting"); NTMesh3 mesh = new NTMesh3(TestUtil.MakeCappedCylinder(bTestBoundary)); mesh.CheckValidity(FailMode.DebugAssert); Random r = new Random(31377); 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); } System.Console.WriteLine("splits ok"); }