コード例 #1
0
        private ConcaveHierarchicalTree Decompose()
        {
            BuildTree();

            List <ShapeDecompositionOutput> convexShapes = new List <ShapeDecompositionOutput>();

            ConcaveHierarchicalTree hTree = new ConcaveHierarchicalTree
            {
                ChildNodes = new List <HierarchicalTree <Vertex3Index, AABB> >()
            };

            BuildHierachicalTree(ref hTree, this);

            return(hTree);
        }
コード例 #2
0
        private void BuildHierachicalTree(
            ref ConcaveHierarchicalTree tree,
            ConvexDecompositionEngine decompositionTree)
        {
            tree.ChildNodes    = new List <HierarchicalTree <Vertex3Index, AABB> >();
            tree.Elements      = new List <Vertex3Index>(decompositionTree.VertexPosition);
            tree.TotalElements = new List <Vertex3Index>(BaseVertexPosition);

            for (int i = 0; i < 8; i++)
            {
                if (decompositionTree.childNode[i] != null)
                {
                    tree.ChildNodes.Add(new ConcaveHierarchicalTree {
                        Parent = tree
                    });
                    var bufTree = (ConcaveHierarchicalTree)tree.ChildNodes[tree.ChildNodes.Count - 1];
                    BuildHierachicalTree(ref bufTree, decompositionTree.childNode[i]);
                }
            }
        }