Implicit K-d Tree
   HOME

TheInfoList



OR:

An implicit ''k''-d tree is a ''k''-d tree defined implicitly above a
rectilinear grid A regular grid is a tessellation of ''n''-dimensional Euclidean space by congruent parallelotopes (e.g. bricks). Its opposite is irregular grid. Grids of this type appear on graph paper and may be used in finite element analysis, finite volume ...
. Its split
plane Plane(s) most often refers to: * Aero- or airplane, a powered, fixed-wing aircraft * Plane (geometry), a flat, 2-dimensional surface Plane or planes may also refer to: Biology * Plane (tree) or ''Platanus'', wetland native plant * Planes (gen ...
s' positions and
orientation Orientation may refer to: Positioning in physical space * Map orientation, the relationship between directions on a map and compass directions * Orientation (housing), the position of a building with respect to the sun, a concept in building de ...
s are not given explicitly but implicitly by some recursive splitting-function defined on the
hyperrectangle In geometry, an orthotopeCoxeter, 1973 (also called a hyperrectangle or a box) is the generalization of a rectangle to higher dimensions. A necessary and sufficient condition is that it is congruent to the Cartesian product of intervals. If all of ...
s belonging to the tree's
node In general, a node is a localized swelling (a "knot") or a point of intersection (a vertex). Node may refer to: In mathematics *Vertex (graph theory), a vertex in a mathematical graph *Vertex (geometry), a point where two or more curves, lines, ...
s. Each inner node's split plane is positioned on a grid plane of the underlying grid, partitioning the node's grid into two subgrids.


Nomenclature and references

The terms " min/max ''k''-d tree" and "implicit ''k''-d tree" are sometimes mixed up. This is because the first publication using the term "implicit ''k''-d tree" did actually use explicit min/max ''k''-d trees but referred to them as "implicit ''k''-d trees" to indicate that they may be used to ray trace implicitly given iso surfaces. Nevertheless, this publication used also slim ''k''-d trees which are a subset of the implicit ''k''-d trees with the restriction that they can only be built over integer hyperrectangles with sidelengths that are powers of two. Implicit ''k''-d trees as defined here have recently been introduced, with applications in computer graphics. As it is possible to assign attributes to implicit ''k''-d tree nodes, one may refer to an implicit ''k''-d tree which has min/max values assigned to its nodes as an "implicit min/max ''k''-d tree".


Construction

Implicit ''k''-d trees are generally not constructed explicitly. When accessing a node, its split plane orientation and position are evaluated using the specific splitting-function defining the tree. Different splitting-functions may result in different trees for the same underlying grid.


Splitting-functions

Splitting-functions may be adapted to special purposes. Underneath two specifications of special splitting-function classes. * Non-degenerated splitting-functions do not allow the creation of degenerated nodes (nodes whose corresponding integer hyperrectangle's volume is equal zero). Their corresponding implicit ''k''-d trees are full binary trees, which have for ''n'' leaf nodes ''n - 1'' inner nodes. Their corresponding implicit ''k''-d trees are non-degenerated implicit ''k''-d trees. * complete splitting-functions are non-degenerated splitting-functions whose corresponding implicit ''k''-d tree's leaf nodes are single grid cells such that they have one inner node less than the amount of gridcells given in the grid. The corresponding implicit ''k''-d trees are complete implicit ''k''-d trees. A complete splitting function is for example the grid median splitting-function. It creates fairly balanced implicit ''k''-d trees by using ''k''-dimensional integer hyperrectangles ''hyprec k]'' belonging to each node of the implicit ''k''-d tree. The hyperrectangles define which gridcells of the rectilinear grid belong to their corresponding node. If the volume of this hyperrectangle equals one, the corresponding node is a single grid cell and is therefore not further subdivided and marked as leaf node. Otherwise the hyperrectangle's longest extent is chosen as orientation ''o''. The corresponding split plane ''p'' is positioned onto the grid plane that is closest to the hyperrectangle's grid median along that orientation. Split plane orientation ''o'': o = min Split plane position ''p'': p = roundDown((hyprec o] + hyprec o]) / 2)


Assigning attributes to implicit ''k''-d tree nodes

An advantage of implicit ''k''-d trees is that their split plane's orientations and positions need not to be stored explicitly. But some applications require besides the split plane's orientations and positions further attributes at the inner tree nodes. These attributes may be for example single bits or single scalar values, defining if the subgrids belonging to the nodes are of interest or not. For complete implicit ''k''-d trees it is possible to pre-allocate a correctly sized array of attributes and to assign each inner node of the tree to a unique element in that allocated array. The amount of gridcells in the grid is equal the volume of the integer hyperrectangle belonging to the grid. As a complete implicit ''k''-d tree has one inner node less than grid cells, it is known in advance how many attributes need to be stored. The relation "''Volume of integer hyperrectangle to inner nodes''" defines together with the complete splitting-function a recursive formula assigning to each split plane a unique element in the allocated array. The corresponding algorithm is given in C-pseudo code underneath. // Assigning attributes to inner nodes of a complete implicit k-d tree // create an integer help hyperrectangle hyprec (its volume vol(hyprec) is equal the amount of leaves) int hyprec k] = ; // allocate once the array of attributes for the entire implicit k-d tree attr *a = new attr olume(hyprec) - 1 attr implicitKdTreeAttributes(int hyprec k], attr *a) It is worth mentioning that this algorithm works for all rectilinear grids. The corresponding integer hyperrectangle does not necessarily have to have sidelengths that are powers of two.


Applications

Implicit min max kd tree, max-''k''-d trees are used for
ray casting Ray casting is the methodological basis for 3D CAD/CAM solid modeling and image rendering. It is essentially the same as ray tracing for computer graphics where virtual light rays are "cast" or "traced" on their path from the focal point of a came ...
isosurfaces/MIP ( maximum intensity projection). The attribute assigned to each inner node is the maximal scalar value given in the subgrid belonging to the node. Nodes are not traversed if their scalar values are smaller than the searched iso-value/current maximum intensity along the ray. The low storage requirements of the implicit max ''k''d-tree and the favorable visualization complexity of ray casting allow to ray cast (and even change the isosurface for) very large scalar fields at interactive framerates on commodity PCs. Similarly an implicit
min/max kd-tree A min/max ''k''d-tree is a ''k''-d tree with two scalar values - a minimum and a maximum - assigned to its nodes. The minimum/maximum of an inner node is equal to the minimum/maximum of its children's minima/maxima. Construction Min/max ''k''d-tr ...
may be used to efficiently evaluate queries such as terrain line of sight.Bernardt Duvenhage "Using An Implicit Min/Max KD-Tree for Doing Efficient Terrain Line of Sight Calculations" in "Proceedings of the 6th International Conference on Computer Graphics, Virtual Reality, Visualisation and Interaction in Africa", 2009.


Complexity

Given an implicit ''k''-d tree spanned over an ''k''-dimensional grid with ''n'' gridcells. * Assigning attributes to the nodes of the tree takes \mathrm(kn)'' time. * Storing attributes to the nodes takes \mathrm(n) memory. * Ray casting iso-surfaces/MIP an underlying scalar field using the corresponding implicit max ''k''-d tree takes roughly \mathrm(\log(n)) time.


See also

* ''k''-d tree * min/max ''k''-d tree


References

{{DEFAULTSORT:Implicit Kd-Tree Computer graphics data structures Trees (data structures)