コード例 #1
0
ファイル: SpatialMain.cs プロジェクト: tumcms/QL4BIM
        public void Export()
        {
            var ds      = spatialRepository.MeshByGlobalId("3hXGhYvd59SukMqHINmzDS");
            var dsOuter = overlapOperator.OuterMesh(ds, 0.1);
            var dsinner = overlapOperator.OuterMesh(ds, -0.1);

            x3DExporter.ExportMeshes(@"OutNorm.x3d", new List <TriangleMesh>()
            {
                ds
            });
            x3DExporter.ExportMeshes(@"OutOut.x3d", new List <TriangleMesh>()
            {
                dsOuter
            });
            x3DExporter.ExportMeshes(@"OutInner.x3d", new List <TriangleMesh>()
            {
                dsinner
            });

            var meshes = vectorDirOperator.GetTransMesh("d1");

            x3DExporter.ExportMeshes(@"d1.x3d", meshes);

            meshes = spatialRepository.TriangleMeshes;
            x3DExporter.ExportMeshes(@"dini.x3d", meshes);
        }
コード例 #2
0
        private bool OverlapWithMinusOffset(List <List <ITreeItem> > treeItemListList)
        {
            var listListOut = new List <List <ITreeItem> >();

            if (treeItemListList.Count == 0)
            {
                return(false);
            }

            foreach (var treeItems in treeItemListList)
            {
                var mainItem         = treeItems[0];
                var mainCanSubdivide = mainItem.CanSubdivide;

                var mainItemChildren = MeOrMyChildren(mainItem);

                for (int i = 1; i < treeItems.Count; i++)
                {
                    var testeeCanSubdivide = treeItems[i].CanSubdivide;

                    if (!mainCanSubdivide && !testeeCanSubdivide)
                    {
                        var triA = treeA.GetItem(mainItem.ID);
                        var triB = treeB.GetItem(treeItems[i].ID);

                        var offSetTriA = meshA.CreateOuterTriangle(triA, currentMinusOffset);
                        var offSetTriB = meshB.CreateOuterTriangle(triB, currentMinusOffset);
                        if (triangleIntersector.DoIntersect(offSetTriA, offSetTriB))
                        {
                            exporter.ExportMeshes(@"_TriOri.x3d", new List <TriangleMesh>()
                            {
                                new TriangleMesh(new List <Triangle>()
                                {
                                    triA, triB
                                }, "original", false)
                            });

                            exporter.ExportMeshes(@"_TriInner.x3d", new List <TriangleMesh>()
                            {
                                new TriangleMesh(new List <Triangle>()
                                {
                                    offSetTriA, offSetTriB
                                }, "iinner", false)
                            });

                            return(true);
                        }


                        continue;
                    }

                    var testeeChildren = MeOrMyChildren(treeItems[i]);

                    foreach (var mainChild in mainItemChildren)
                    {
                        var listOut = new List <ITreeItem>();
                        listOut.Add(mainChild);

                        foreach (var testeeChild in testeeChildren)
                        {
                            var isIntersecting = mainChild.Bounds.Intersects(testeeChild.Bounds);
                            if (isIntersecting)
                            {
                                listOut.Add(testeeChild);
                            }
                        }

                        if (listOut.Count > 1)
                        {
                            listListOut.Add(listOut);
                        }
                    }
                }
            }

            return(OverlapWithMinusOffset(listListOut));
        }