Exemplo n.º 1
0
        // Return a new CSG solid representing space both this solid and in the
        // solid `csg`. Neither this solid nor the solid `csg` are modified.
        public static List <Mesh> Intersect(CSGNode _nodeAIn, CSGNode _nodeBIn, CSGMeshingSettings _meshSettings)
        {
            List <Mesh> resultantMeshes = new List <Mesh>();

            CSGNode nodeA = _nodeAIn.Clone();
            CSGNode nodeB = _nodeBIn.Clone();

            nodeA.Invert();
            nodeB.ClipTo(nodeA);
            nodeB.Invert();
            nodeA.ClipTo(nodeB);
            nodeB.ClipTo(nodeA);
            nodeA.Build(nodeB.AllPolygons());
            nodeA.Invert();

            CSGModel resultModel = new CSGModel(nodeA.AllPolygons());

            if (resultModel.SubDivideMesh(_meshSettings))
            {
                for (int subMeshIter = 0; subMeshIter < resultModel.m_subModels.Count; subMeshIter++)
                {
                    resultantMeshes.Add(resultModel.m_subModels[subMeshIter].ToMesh());
                }
            }
            else
            {
                resultantMeshes.Add(resultModel.ToMesh());
            }

            return(resultantMeshes);
        }
Exemplo n.º 2
0
        // Return a new CSG solid representing space in this solid but not in the
        // solid `csg`. Neither this solid nor the solid `csg` are modified.
        public static List <Mesh> HVSubtract(CSGNode _nodeAIn, CSGNode _nodeBIn, CSGMeshingSettings _meshSettings)
        {
            List <Mesh> resultantMeshes = new List <Mesh>();

            CSGNode nodeA = _nodeAIn.Clone();
            CSGNode nodeB = _nodeBIn.Clone();

            nodeA.ClipTo(nodeB);

            CSGModel resultantModels = new CSGModel(nodeA.AllPolygons());

            resultantModels.SubDivideMesh(_meshSettings);
            resultantMeshes.Add(resultantModels.ToMesh());
            return(resultantMeshes);
        }
Exemplo n.º 3
0
        // Return a new CSG solid representing space in either this solid or in the
        // solid `csg`. Neither this solid nor the solid `csg` are modified.
        public static List <Mesh> NVUnion(CSGNode _nodeAIn, CSGNode _nodeBIn, CSGMeshingSettings _meshSettings)
        {
            List <Mesh> resultantMeshes = new List <Mesh>();

            CSGNode nodeA = _nodeAIn.Clone();
            CSGNode nodeB = _nodeBIn.Clone();

            nodeA.Build(nodeB.AllPolygons());

            CSGModel resultantModel = new CSGModel(nodeA.AllPolygons());

            resultantModel.SubDivideMesh(_meshSettings);
            resultantMeshes.Add(resultantModel.ToMesh());

            return(resultantMeshes);
        }
Exemplo n.º 4
0
        // Return a new CSG solid representing space both this solid and in the
        // solid `csg`. Neither this solid nor the solid `csg` are modified.
        public static List <Mesh> NVIntersect(CSGNode _nodeAIn, CSGNode _nodeBIn, CSGNode _nodeCIn,
                                              CSGNode _nodeDIn, CSGNode _nodeEIn, CSGNode _nodeFIn, CSGMeshingSettings _meshSettings)
        {
            List <Mesh> resultantMeshes = new List <Mesh>();

            CSGNode nodeA = _nodeAIn.Clone();
            CSGNode nodeB = _nodeBIn.Clone();
            CSGNode nodeC = _nodeCIn.Clone();
            CSGNode nodeD = _nodeDIn.Clone();
            CSGNode nodeE = _nodeEIn.Clone();
            CSGNode nodeF = _nodeFIn.Clone();

            nodeA.ClipTo(nodeB);
            nodeA.ClipTo(nodeC);
            nodeA.ClipTo(nodeD);
            nodeA.ClipTo(nodeE);
            nodeA.ClipTo(nodeF);

            CSGModel resultantModels = new CSGModel(nodeA.AllPolygons());

            resultantModels.SubDivideMesh(_meshSettings);
            resultantMeshes.Add(resultantModels.ToMesh());
            return(resultantMeshes);
        }