KDTree.build

giant.ray_tracer.kdtree:

KDTree.build(self, force=True, print_progress=True)

This method performs the branching of the tree down to the maximum depth.

Essentially this method forms the root node from the surfaces provided to the tree at initialization. The split method is then called on the root node, and the subsequent children until the maximum depth is reached or the minimum number of geometry primitives in each node is passed.

The force argument can be used to continue splitting nodes even when there are less than 10 geometry primitives contained in the node. It is passed to the KDNode.split() method.

The maximum depth is controlled through max_depth. Typically this should be set so that the number of geometry primitives in each leaf node is between 10-100.

Parameters:
  • force (bool) – A flag specifying that we should build the tree even when there are less than 10 geometry primitives in the current level of nodes

  • print_progress (bool) – A flag specifying that we should print out the progress in building the tree. This helps you be confident the build is continuing but can slow things down because a lot of text is printed to the screen.