There is no need to explicitly recalculate the tree stats when a node
is moved from one place from the into another. As the node is added to
the tree, the stats are being recalculated automatically.
When the node is merely moved within the tree and the tree topology
doesn't change, it is sufficient to only recalculate the tree area
statistics. When some other usage is implemented for the tree
statistics, the need for more accurate statistics might change.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
tree_parent = quadtree_del(node, ops);
node->pos = new_pos;
quadtree_add(tree_parent, node, ops);
- quadtree_recalculate_parent_stats(node, ops);
return tree_parent;
}
/* Move the node into its new location */
node->pos = new_pos;
+ recalculate_parent_area_stats(node);
if (node->children) {
/*
check_for_crossed_subnodes(node, limit, ops);
}
- quadtree_recalculate_parent_stats(node, ops);
return quadtree_find_parent(node);
}