Splitting rules

Back to Point kd-tree

When a node of a kd-tree is subdivided, the position and orientation of the splitting plane is decided based on a splitting rule. The splitting rule gets as input the aligned bounding box of the node as well as the contained points. As output it is expected to return the orientation and position of the splitting plane. Since the orientation is restricted to one of standard basis axes, it is given by an integer. The position is given by a real number.

The splitting rule has just one requirement: it must produce a split where points end up on both sides of the splitting plane. This guarantees that the recursive refinement always terminates and gives an O(n) upper bound to the number of nodes in the resulting tree. For example, always splitting on the midpoint of the node on some axis would not be an acceptable splitting rule.

Whenever points are exactly on the splitting plane, the PointKdTree distributes the points evenly to both sides of the plane. In case there an odd number of such points, the pairless point is placed to that side of the plane which has less points.

The chosen splitting rule has an effect on the performance of the kd-tree on nearest neighbor searching as well as on range searching. In this page we shall describe the available splitting rules in Pastel. Unless you have a good reason to do otherwise, you should use either the sliding midpoint rule or the modified sliding midpoint rule.

Learn more