Пример #1
0
        private static DMesh3 ComputeBoolean(DMesh3 outer, DMesh3 hole, MeshBoolean.boolOperation op, bool full = true)
        {
            if (!outer.IsClosed() || !hole.IsClosed())
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Invalid operand.");
                Console.ResetColor();
                return(null);
            }
            var mBool = new MeshBoolean();

            mBool.Target = outer;
            mBool.Tool   = hole;
            mBool.Compute(op);
            var ret = mBool.Result;

            if (full)
            {
                //PlanarRemesher p = new PlanarRemesher(ret);
                //p.Remesh();

                MergeCoincidentEdges mrg = new MergeCoincidentEdges(ret);
                mrg.ApplyIteratively();
                Debug.Write("Closed: " + mBool.Result.IsClosed());

                MeshRepairOrientation rep = new MeshRepairOrientation(ret);
                rep.OrientComponents();
                rep.SolveGlobalOrientation();
            }
            return(ret);
        }
Пример #2
0
        public static void test_orientation_repair()
        {
            DMesh3 mesh = TestUtil.LoadTestInputMesh("bunny_orientation1.obj");

            MeshRepairOrientation orient = new MeshRepairOrientation(mesh);

            orient.OrientComponents();

            orient.SolveGlobalOrientation();

            TestUtil.WriteTestOutputMesh(mesh, "bunny_oriented.obj");
        }
Пример #3
0
        private void RepairOrientation(DMesh3 mesh,
                                       CancellationToken cancellationToken,
                                       bool bGlobal)
        {
            cancellationToken.ThrowIfCancellationRequested();
            var orient = new MeshRepairOrientation(mesh);

            orient.OrientComponents();

            if (bGlobal)
            {
                cancellationToken.ThrowIfCancellationRequested();
                orient.SolveGlobalOrientation();
            }
        }