Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
QBspTree::QBspTree() : depth(6), visited(0) {}
-void QBspTree::create(int n, int d)
+void QBspTree::create(int n)
{
// simple heuristics to find the best tree depth
- if (d == -1) {
- int c;
- for (c = 0; n; ++c)
- n = n / 10;
- depth = c << 1;
- } else {
- depth = d;
- }
- depth = qMax(depth, uint(1));
+ int c;
+ for (c = 0; n; ++c)
+ n = n / 10;
+ depth = qMax(c << 1, 1);
nodes.resize((1 << depth) - 1); // resize to number of nodes
leaves.resize(1 << depth); // resize to number of leaves
QBspTree();
- void create(int n, int d = -1);
+ void create(int n);
void destroy();
inline void init(const QRect &area, NodeType type) { init(area, depth, type, 0); }