示例#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
        private static DMesh3 TestFiles(string file1, string file2, MeshBoolean.boolOperation op)
        {
            Console.WriteLine($"Testing {op} on : {file1}, {file2}");
            DMesh3 b1  = TestUtil.LoadTestInputMesh(file1);
            DMesh3 b2  = TestUtil.LoadTestInputMesh(file2);
            var    ret = ComputeBoolean(b1, b2, op, true);

            IsNotNullAndClosed(ret);
            return(ret);
        }