int kd_insert(struct kdtree *tree, const double *pos, void *data) { if (insert_rec(&tree->root, pos, data, 0, tree->dim)) { return -1; } if (tree->rect == 0) { tree->rect = hyperrect_create(tree->dim, pos, pos); } else { hyperrect_extend(tree->rect, pos); } return 0; }
static struct kdhyperrect* hyperrect_duplicate(const struct kdhyperrect *rect) { return hyperrect_create(rect->dim, rect->min, rect->max); }