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); }
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]); } } }