// Recursively build a tree by separating points at plane boundaries. static KDTree_Stark MakeFromVectorsRecursive(int depth, int stIndex, int enIndex, PointCloudVertices points, int[] inds) { KDTree_Stark root = new KDTree_Stark(); root.axis = depth % numDims; int splitPoint = FindPivotIndex(points, inds, stIndex, enIndex, root.axis); root.pivotIndex = inds[splitPoint]; root.pivot = points[root.pivotIndex]; int leftEndIndex = splitPoint - 1; if (leftEndIndex >= stIndex) { root.innerTrees[0] = MakeFromVectorsRecursive(depth + 1, stIndex, leftEndIndex, points, inds); } int rightStartIndex = splitPoint + 1; if (rightStartIndex <= enIndex) { root.innerTrees[1] = MakeFromVectorsRecursive(depth + 1, rightStartIndex, enIndex, points, inds); } return(root); }
public bool BuildKDTree_Stark(List <Vertex> target) { TimeCalc.ResetTime(); KdTree_Stark = KDTree_Stark.Build(target); TimeCalc.ShowLastTimeSpan("Build Tree Stark"); return(true); }
public bool BuildKDTree_Stark(PointCloudVertices target) { GlobalVariables.ResetTime(); KdTree_Stark = KDTree_Stark.Build(target); GlobalVariables.ShowLastTimeSpan("Build Tree Stark"); return(true); }