public static Tree2D <Type> Create <Type>(Type[] values, Tree2D <Type> .GetBox getBox) { Tree2D <Type> tree = new Tree2D <Type>(); tree.m_leaves = new Tree2D <Type> .LeafNode[values.Length]; for (int i = 0; i < values.Length; ++i) { tree.m_leaves[i] = new Tree2D <Type> .LeafNode(getBox, ref values[i]); } tree.m_root = tree.BuildSubtree(tree.m_leaves, 0, values.Length, 0); tree.m_stack = new Stack <Tree2D <Type> .TreeNode>(tree.m_depth); return(tree); }
public int Compare(Tree2D <ValueType> .LeafNode node1, Tree2D <ValueType> .LeafNode node2) { return(Math.Sign(node2.Bounds.Center.X - node1.Bounds.Center.X)); }