Link Less Oc Tree
Link Less Oc Tree
Myung Geol Choi1 and Eunjung Ju1 and Jung-Woo Chang2 and Jehee Lee1 and Young J. Kim3
Abstract
The standard C/C++ implementation of a spatial partitioning data structure, such as octree and quadtree, is
often inefficient in terms of storage requirements particularly when the memory overhead for maintaining parent-
to-child pointers is significant with respect to the amount of actual data in each tree node. In this work, we
present a novel data structure that implements uniform spatial partitioning without storing explicit parent-to-
child pointer links. Our linkless tree encodes the storage locations of subdivided nodes using perfect hashing
while retaining important properties of uniform spatial partitioning trees, such as coarse-to-fine hierarchical
representation, efficient storage usage, and efficient random accessibility. We demonstrate the performance of our
linkless trees using image compression and path planning examples.
Categories and Subject Descriptors (according to ACM CCS): Computer Graphics [I.3.6]: Graphics data structures
and data types—
Hash Tables
7X7 12 X 12 18 X 18 27 X 27 38 X 38 50 X 50 116 X 116
1024 x 1024
Original Binary Bitmap 5X5 7X7 14 X 14 17 X 17 23 X 23 28 X 28 35 X 35
Offset Tables
Figure 1: The linkless quadtree of a binary image. Each entry of an offset table is a two-dimensional vector and each of its
components is quantized to 8-bits. Vector values in the tables are color coded using red and green channels. Note that our
algorithm does not generate the first two levels of the hierarchy because the compact packing of non-leaf cells at those levels is
not smaller than the original image.
nary bitmap volume, which represents whether each con- brini [FM86] proposed an autumnal quadtree that stores the
figuration cell is free or occupied. It is impractical to store data of leaf nodes into the pointer fields in their parent nodes.
an uncompressed bitmap volume because its size scales ex- The autumnal tree can be used only when the size of pointers
ponentially with its dimensionality. We will demonstrate is longer than data fields in each node. To avoid this restric-
three examples using three-, four-, and five-dimensional free tion, Lefebvre [LH07] encoded each data value into 7 bits
space maps. The three-dimensional example models a pla- by using vector quantization method. This approach leads to
nar rigid mover and static obstacles. The mover is allowed lossy data compression.
to translate and rotate on a plane. The use of an animated
mover navigating through static obstacles adds an extra di- The theoretical lower bound of the size of a binary tree en-
mension (for parameterizing the pose of the mover) to yield coding is 2n − o(n) bits, where n is the number of nodes.
four-dimensional configuration space. Modeling free config- The theoretical lower bound can be achieved by level-order
urations between two animated characters requires a five- bit stream encoding that encodes leaf (zero) and non-leaf
dimensional binary bitmap, which can be compactly repre- (one) nodes in a breath-first tree traversal order. Given such a
sented by using our linkless spatial partitioning tree. succinct data structure, implementing basic operations such
as finding a parent/child/sibling node is non-trivial. There
have been significant research on compactly representing
2. Previous Work binary trees and augmenting auxiliary indexing structures
to perform basic operations efficiently on succinct binary
Spatial partitioning is a standard technique in computer trees [Jac89,MR97]. Research on trees of higher-degree has
graphics. Though the standard pointer-based implementa- arisen recently. Benoit et al. [BDM∗ 05] encoded a tree of
tion is extremely popular in a variety of graphics applica- degree 2d in ((dde + 2)n + o(n) + O(lg d)) bits and imple-
tions, the variants of quadtrees and octrees have also been mented basic navigational operations in O(1) time and ran-
explored for reducing storage requirements, improving the dom node access in O(lg n) time. On the other hand, several
performance of dynamic updates, and GPU implementa- researchers explored efficient methods for constructing and
tion. Gargantini [Gar82] presented a linear quadtree that dynamically updating quadtrees and octrees. Eppstein and
represents hierarchical tree data without pointers. The lin- his colleagues [EGS05] presented a skiptree data structure
ear quadtree encodes only non-empty nodes with a quater- that allows for fast point insertion and deletion. Quadtrees
nary integer whose digits indicate quadrant subdivision po- and octrees have been implemented on GPUs by exploit-
sition and preserved the integer data in one-dimensional ar- ing the general-purpose programming capability of modern
ray. Oliver and Wiseman [OW83] and Woodwark [Woo84] GPUs [LSK∗ 06, PF05, ZHWG08].
compressed the linear quadtree further by providing sophis-
ticated tree traversal code. Their major concern was deriving Spatial hashing techniques pack sparse spatial data into a
maximum benefit from compressing required storage and, compact table. Lefebvre and Hoppe [LH06] explored the use
therefore, the performance for accessing tree nodes and dy- of perfect hashing in graphics applications and its implemen-
namically updating tree structures was compromised. Fab- tation on GPUs. A hash function is perfect if it has no col-
e
id
iv
Bk-1 “octree”, we actually refer to its d-dimensional generaliza-
bd
su
tion that performs uniform spatial partitioning for all axes.
level k-1 Our implementation allows 2D, 3D, 4D, and 5D volumes
to be stored in an adaptive spatial partitioning structure. We
will first explain the construction of a binary octree in Sec-
ha
sh
tion 3.1. The generalization of the construction algorithm for
in
g
dealing with longer data fields will be discussed later in Sec-
tion 3.2.
de
vi
di
Bk
b
su
3.1. Octree for Binary Data
level k
ha
finest level) has two bits. One bit encodes whether the cell is
leaf node or not. A non-leaf cell includes both ones and zeros
de
vi
Bk+1
b
su
Figure 3: The dual-hashing octree for a RGB color image. At each level, leaf nodes and non-leaf nodes are gathered separately
and compactly packed using two spatial hashing functions. Only leaf nodes store data fields. Offset tables are omitted in the
figure for clear presentation.
is (bk )d containing m non-leaf cells and the remaining leaf Our dual-hashing octree removes the wasted data fields at
cells (line 6). The hash table of dm1/d ed can accommodate non-leaf nodes to achieve better compression rates. Our
m non-leaf cells. Let p be the spatial location in Bk and p0 dual-hashing octree makes use of two hashing functions at
be its corresponding location in the hash table. The perfect each level (see Figure 3). One hashing function is for locat-
hashing function at level k is ing non-leaf child nodes at the next level. Its functionality
is the same as the hashing function for a binary octree. The
only difference is that each cell in the hash tables has only
p0 = h(p) = (p mod bk+1 ) + Φ(p mod rk+1 ), (1) one bit flag and does not have any data fields. The other hash-
ing function is used for compactly packing leaf nodes with
data fields. The dual-hashing octree performs better than the
where bk and rk are the size of bitmap Bk and offset table Φk , single-hashing octree if a larger amount of data is stored at
respectively (line 11-13). The offset table is a d-dimensional each cell.
array of offset vectors. We refer the reader to [LH06] for de-
tails on how to compute the offset table. In practice, the size
of the offset table is insignificant comparing to the memory 4. Experimental Results
overhead of the pointer-based implementation. Then, bitmap
Bk+1 at the subsequent level is the uniform subdivision of the The timing data provided in this section was measured on a
hash table (line 4-5). We repeat this process until no non-leaf 2.4GHz Intel Core2 Duo computer with 4Gbyte main mem-
cells remain in the bitmap. ory and an nVidia GeForce 8800GTX GPU unless otherwise
noted.
G{
jGt y sW sX sY sZ s[ s\ s] s^ s_ s` {GOrP
OtP
Gw i T T T GGGGGGGXSWY[ GGGGGGGGG`SWW[ GGGGGGGGGZ[SX_] GGGGGGG_ZSZY_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S`]_
G GXS`Z_S_ZX [SYXXS`[]
G XYS^_WSZ]`
G GGGZYS]Y_SX_W T T T T GG\XS__YSY`[ GX[`U\
G\k
i GGGGGGY__ GGGG_S_`] GGGGX^ZSWWW YS^\ZS\\Y
G [XS``WS^XY
G Y[ZS]ZWS_YW
G T T T T Y__S\\^SY]_
G
n ][][][\XY\XY
v GGGGGGZ]_ GGGY\S[WW GGGGY`[S\]_ [SZXXS\W[
G [`S`Y]S^YW
G T T T T T GG\[S\\_S\]W GZY^UY
Figure 5: Examples of free configuration space maps. (Up left) Goblins in a garden. A 4D map was precomputed for the goblin
and each individual object in the garden. (Up middle) A thousand animal characters were animated using 256 frames of motion
data. The interference between characters were checked in realtime using a 5D free space map. (Up right) A thousand animated
goblins were animated using 512 frames of motion data. (Down) The size of free space maps.
based octree. The linkless octree performs better than run- rate is directly related to the length of the data field. A higher
length encoding and ZIP for the face image, but not as well compression rate can be achieved for an octree with longer
as CCITT Group3 and Group4. The text image is a partic- data fields.
ularly bad example for octree encoding because not many
internal cells are pruned in the octree hierarchy. In our com- Quadtree Comparison. We encoded the face image in Fig-
parison tests, the linkless quadtree was not the best for com- ure 6 in four quadtrees (pointer-based, sibling [HW91], au-
pressing black-and-white images, but at least adequate for tumnal [FM86] and our linkless tree) and compared the
images with strong spatial coherency. memory overhead for maintaining parent-to-child pointers,
sibling pointers, and auxiliary hash tables (see Figure 7).
Color Image. The color image in figure 3 has a 1024 × 1024 The pointer-based tree has four pointers in every non-leaf
resolution and each pixel has 24 bits for RGB color. The size node and each pointer uses 4 bytes. Therefore, the tree re-
of the raw uncompressed image is 10242 /8 = 3072(Kbyte). quires 16 bytes per node. The sibling tree and autumnal
The size of the pointer-based quadtree is 439.6 Kbytes. Our tree require 4 bytes and 1.125 bytes per node, respectively
single-hashing octree constructed by simply expanding the [LH07]. The size of auxiliary hash tables for our linkless
data field in each cell requires 203.2 Kbytes, which can tree is about one-fourth of the memory overhead of the au-
further be compressed by using dual hashing functions, as tumnal tree, which is much more memory-efficient than the
explained in Section 3.2. Our dual-hashing octree requires other two tree encodings. Succinct k-nary tree by Benoit et
179.4 Kbytes, which achieves a compression rate of 11.7% al. [BDM∗ 05] requires (4n + o(n) + C) bits for storing a
with respect to the single-hashing octree. The compression quadtree, where (o(n) +C) is the size of the auxiliary index-