0% found this document useful (0 votes)
96 views

Link Less Oc Tree

This document presents a novel data structure called a linkless octree that implements uniform spatial partitioning without storing explicit parent-to-child pointers. It encodes the storage locations of subdivided nodes using perfect hashing while retaining properties of standard octrees like hierarchical representation, efficient storage usage, and random accessibility. The linkless octree is useful for compactly representing high-dimensional binary bitmap volumes, such as free configuration spaces. It demonstrates examples in 3, 4 and 5 dimensions.

Uploaded by

Kristine
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
96 views

Link Less Oc Tree

This document presents a novel data structure called a linkless octree that implements uniform spatial partitioning without storing explicit parent-to-child pointers. It encodes the storage locations of subdivided nodes using perfect hashing while retaining properties of standard octrees like hierarchical representation, efficient storage usage, and random accessibility. The linkless octree is useful for compactly representing high-dimensional binary bitmap volumes, such as free configuration spaces. It demonstrates examples in 3, 4 and 5 dimensions.

Uploaded by

Kristine
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Pacific Graphics 2009 Volume 28 (2009), Number 7

S. Lee, D. Lischinski, and Y. Yu


(Guest Editors)

Linkless Octree Using Multi-Level Perfect Hashing

Myung Geol Choi1 and Eunjung Ju1 and Jung-Woo Chang2 and Jehee Lee1 and Young J. Kim3

1 SeoulNational University, Korea


2 University
of Hong Kong, Hong Kong
3 Ewha Womans University, Korea

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—

1. Introduction quadtrees and octrees memory efficiently. A linear quadtree


converts a hierarchical structure into a one-dimensional ar-
Uniform spatial partitioning data structures such as ray by traversing the tree in depth-first order [Gar82, OW83,
quadtrees and octrees are widespread in a variety of graph- Woo84]. The linear quadtree is memory efficient because it
ics applications including spatial indexing, image/volume does not maintain parent-to-child pointers. The disadvantage
encoding and compression, collision detection, visibility of the linear depth-first traversal encoding is its inefficiency
culling and path planning. These spatial partitioning struc- in random access to tree nodes. Accessing an arbitrary node
tures often allow large spatial data sets to be maintained effi- necessitates sequential scanning of the array for tree traver-
ciently in terms of storage requirements and random acces- sal. Many of linear quadtree variants exhibit a trade-off be-
sibility, in particular, when strong spatial coherence exists in tween storage requirements and efficient random accessibil-
the data sets. ity.
The standard C/C++ implementation of a spatial partitioning
data structure subdivides each spatial cell into child cells re- In this work, we present a novel data structure that imple-
cursively and maintains parent-to-child pointer links. Some- ments uniform spatial partitioning without storing explicit
times, the memory overhead for storing parent-to-child links parent-to-child pointers. Our linkless tree maintains non-leaf
is significant with respect to the amount of actual data in nodes at small extra storage by layering multiple hashing
each cell. For example, a uniform spatial partitioning tree functions. Without storing explicit links, it retains several
encoding a d-dimensional binary volume maintains a single important properties of uniform spatial partitioning trees,
bit (either zero or one) of data in each cell together with 2d such as coarse-to-fine hierarchical representation, efficient
pointers. In a 32-bit addressing machine, the memory over- storage usage, and efficient random accessibility.
head for each non-leaf node is 32 ∗ 2d (bits), which is several
orders of magnitude larger than the actual amount of data in Our linkless tree is particularly useful for compactly repre-
the node. senting high-dimensional binary bitmap volumes. Modeling
free configuration space for path planning often generates
A number of techniques have been studied for storing such data sets. The free space map is a d-dimensional bi-

submitted to Pacific Graphics (2009)


2 Myung Geol Choi & Eunjung Ju & Jung-Woo Chang & Jehee Lee & Young J. Kim / Linkless Octree Using Multi-Level Perfect Hashing

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-

submitted to Pacific Graphics (2009)


Myung Geol Choi & Eunjung Ju & Jung-Woo Chang & Jehee Lee & Young J. Kim / Linkless Octree Using Multi-Level Perfect Hashing 3

small extra storage. Though our structure is called a linkless

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

The linkless octree consists of a pyramid of coarse-to-fine


sh
in

bitmaps. Each cell in the bitmap (except the bitmap at the


g

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

in its bitmap region. The non-leaf cell requires a subsequent


di

Bk+1
b
su

subdivision to achieve higher resolution. The other bit marks


level k+1
the cell as either all-zero or all-one if the cell is leaf node.
ha

The finest level in the hierarchy has a one-bit binary bitmap


sh
in

because the leaf/non-leaf flag is not necessary any more.


g

Algorithm 1: Linkless octree construction

Figure 2: Subdivision and hashing. input : A binary bitmap volume V of size nd .


output: Bitmap volumes Bk and offset tables Φk .
1 G ←SpatialGrids([0, n] × · · · × [0, n]) ;
lisions. Spatial hashing techniques have also been used to 2 b ← 1; /* the size of spatial grids */
encode quadtrees/octrees exploiting the coherency in spatial 3 for k ← 0 to dlg ne do
data. Warren [WS93] presented a hashed octree that assigns 4 b ← 2b ;
unique keys to all (leaf and non-leaf) nodes and indexes them 5 subG ← SubdivideGrids(G, b) ;
in a hash table. To improve search time, Castro [CLL∗ 08] 6 m ← CountNonLeafCells(subG, V ) ;
proposed a statistical model that selects the most frequenlty 7 if m = 0 then
accessed level instead of the first level, as a starting point 8 Bk ← ConstructOneBitVolume(subG,V ) ;
of the search. Bastos [BF08] similarly mapped octree nodes /* generate the bitmap at the finest level and*/
into a perfect hash table and accessed random nodes using /* terminate the algorithm */
octree level and point location indexes. The hash table store 9 break ;
data associated with a sparse subset of the domain. If the
10 else if dm1/d e < b then
indexing key does not correspond to a valid point in the do- /* the bitmap is not generated if its size is not */
main, the hash function leads to arbitrary data in the table. /* smaller than the bitmap of the previous level */
Lefebvre and Hoppe [LH06] discussed several strategies for
sparsity encoding, such as storing an extra binary bitmap 11 Bk ← ConstructTwoBitVolume (subG,V ) ;
over the domain to mark valid cells and augmenting position 12 Φk ← ConstructOffsetTable(Bk ) ;
tags in the data fields. Whatever strategy is taken, sparsity 13 G ← CollectNonLeafCells(subG,hk , Φk ) ;
encoding adds an extra burden for compact octree encoding. 14 b ← dm1/d e ;
Our octree representation based on multi-level perfect hash-
ing does not require extra storage for sparsity encoding be-
cause it retains the hierarchical structure of an octree. Invalid The bitmap volume at level (k + 1) consists of non-leaf cells
locations are automatically detected while tracing down the at its previous level k, which are compactly packed and then
hierarchy. uniformly subdivided to produce finer grids (see Figure 2
and Algorithm 1). The hash function at each level maps a
non-leaf parent cell to its child cells at the subsequent level.
3. Multi-Level Hashing
Perfect spatial hashing establishes conflict-free mapping be-
Our linkless octree employs a perfect spatial hashing tech- tween levels resorting on auxiliary offset tables. More pre-
nique [LH06] to maintain references to child nodes with cisely, let Bk be a d-dimensional bitmap at level k and its size

submitted to Pacific Graphics (2009)


4 Myung Geol Choi & Eunjung Ju & Jung-Woo Chang & Jehee Lee & Young J. Kim / Linkless Octree Using Multi-Level Perfect Hashing

14 X 14 Binary bitmap of leaf/non-leaf flags


Non-leaf nodes
23 X 23
36 X 36 Leaf nodes
56 X 56
73 X 73
75 X 75

RGB(24bits) Color Image


1024 X 1024 124 X 124 150 X 150
43 X 43 85 X 85
27 X 27
16 X 16
11 X 11
Compactly packed leaf nodes with RGB color value

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.

3.2. Octree with Long Data Fields


4.1. Free Configuration Space Modeling
The binary linkless octree can be generalized to deal with
The major advantages of our linkless octrees are efficient
multi-bytes data by simply expanding the data field at each
memory usage and random accessibility. To demonstrate
cell. However, the storage requirements can further be re-
the usefulness of the techniques, we modeled massive free
duced if we store data only at leaf nodes. The data fields at
configuration spaces using octrees. Animating and Planning
non-leaf nodes are useful in some applications. For example,
character motions in a complex virtual environment require
the non-leaf node of an image quadtree usually stores the av-
frequent interference-checking between characters and ob-
erage color value of its descendants nodes. Progressive trans-
stacles. Precomputation of free space maps and efficient
mission of an image can benefit from the average value, be-
random accessibility allow us to detect collisions very ef-
cause progressively refining images can be viewed while the
ficiently at runtime. Free space maps of 4D and 5D con-
image is being transmitted. However, there are many other
figuration spaces are too big to be accommodated in main
applications in which non-leaf data fields are useless and
memory. Therefore, compression is crucial. We constructed
thus wasted. A number of geometric applications make use
octree models of 3D/4D/5D free space maps approximately
of octrees for spatial querying. Each octree cell maintains a
at a finite resolution.
set of assorted geometric primitives. Such an octree does not
have meaningful values for non-leaf data fields. The precomputation time for free space construction varies

submitted to Pacific Graphics (2009)


Myung Geol Choi & Eunjung Ju & Jung-Woo Chang & Jehee Lee & Young J. Kim / Linkless Octree Using Multi-Level Perfect Hashing 5

significantly depending on its dimension, size and the com-


plexity of geometry. It ranges from several minutes on a per-
sonal computer to several hours on a super computer. The
largest 5-dimensional free space map was computed on a su-
per computer with 484 nodes (5.6 Tflops performance). The
computation time has nothing to do with octree construc-
tion. The collision detection between characters and obsta-
cles was the bottleneck in computation. Collision checking y
was performed using V-COLLIDE, which is a collision de-
tection library for large polygonal objects based on bounding θ x
volume hierarchies [HLC∗ 97].
Figure 4: Path planning of a planar rigid mover through
3D free space map. We consider the interference between static obstacles. The free configuration space can be mod-
a planar rigid mover and static obstacles (see Figure 4). The eled as a three-dimensional binary volume on the left.
configuration of the mover can be described with three pa-
rameters (x, y, θ), where (x, y) is the position of the mover
on the horizontal plane and θ is the rotation of the mover
penguin, and pig). Each character has 32 poses for anima-
about the vertical axis with respect to the reference sys-
tion. We built a five-dimensional free space map of 1285
tem. We built a free configuration space map having a
resolution. Its size in memory is about 150 Mbytes. The
1024 × 1024 × 1024 resolution of grids. The size of raw bi-
goblin example in Figure 5(top, right) features a thousand
nary bitmap data is 10243 /8 = 128 (Mbyte), which can be
goblins animated by using a motion graph with 512 poses.
compressed to 5.6 Mbyte using our linkless octree (see Fig-
The skin deformation at each pose was precomputed and
ure 5 for details). The compression rate is about 95.6%. The
stored as polygon data. The goblin example used a five-
top-down construction of the free space map requires the
dimensional free space map of 64 × 64 × 64 spatial reso-
ability to check whether a cell is interference-free, partially-
lution and 512 × 512 animation resolution. The size of the
occupied, or completely-occupied without exhaustively ex-
map is about 320 Mbytes. Each goblin character consists of
amining all configurations in the range of the cell. This range
ten thousand polygons. Given the free space map, interfer-
query capability can save the tree construction time. Our sys-
ence between a thousand animated goblins can be checked
tem employs a range query method presented by Zhang et
at interactive rate.
al. [ZKVM06], which can examine whether two convex ob-
jects overlap (or disjoint) for every configuration (translation
and rotation) in a given spatial range. A concave object need 4.2. Performance Comparison
to be decomposed into a collection of convex objects.
We used 2D images to compare our linkless quadtrees with
4D free space map. The goblin in Figure 5(top, left) is an- existing techniques because conducting comparison tests
imated using 256 frames of motion data. We built a sim- with higher-dimensional data is too difficult and timecon-
ple hand-crafted motion graph that allows transitioning be- suming. The standard implementation of some existing tech-
tween motion frames [LCR∗ 02]. The relative configuration niques does not easily generalize to cope with higherdimen-
(x, y, θ, i) of the animated character with respect to a static sional data.
obstacle is four-dimensional, where (x, y) is the relative
translation, θ is the relative rotation, and i is the frame in- Binary Image. Though our octrees are not meant to com-
dex of the motion graph. The garden in the figure includes press 2D binary images, the comparison tests give a good
14 different kinds of polygon trees and flowers. A four- sense how it performs in comparison with well-known loss-
dimensional free space map was precomputed for the gob- less compression methods, such as pointer-based quadtree,
lin and each individual object. We constructed 14 free space ZIP, run-length encoding, and CCITT. CCITT Group3 and
maps of 256 × 256 × 256 × 256 resolution. The size of each Group4 are industry standards for compressing bitonal im-
map ranges from 4 Mbytes to 30 Mbyte depending on the age data and used by most facsimile machines. Group3 com-
size and complexity of geometry. Since a raw bitmap vol- pression is a one dimensional algorithm that encodes im-
ume requires 2564 /8 = 512 (MByte) memory, the compres- age data scanline-by-scanline. Group4 compression encodes
sion rate ranges from 93.9% to 99.2%. each scanline with reference to the previous scanlines to
improve compression ratios. The comparison tests are con-
5D free space map. The free space map of two ani- ducted with two test images (see Figure 6). The face image
mated characters has five-dimensional configuration space has large all-black and all-white regions and the boundary
(x, y, θ, i, j). The characters’ poses are described by i and between black and white regions is relatively clean. The text
j, respectively. We demonstrate two five-dimensional exam- image, on the other hand, has a lot of details and thus do
ples. The animal example in Figure 5(top, center) features not compress well using octrees. For both images, the link-
a thousand characters of four different species (bird, frog, less octree is an order of magnitude smaller than the pointer-

submitted to Pacific Graphics (2009)


6 Myung Geol Choi & Eunjung Ju & Jung-Woo Chang & Jehee Lee & Young J. Kim / Linkless Octree Using Multi-Level Perfect Hashing

G{–›ˆ“
j–““š–•Gtˆ— yŒš–“œ›–• sŒŒ“W sŒŒ“X sŒŒ“Y sŒŒ“Z sŒŒ“[ sŒŒ“\ sŒŒ“] sŒŒ“^ sŒŒ“_ sŒŒ“` {–›ˆ“GOr‰P
Ot‰P
Gwˆ› i›”ˆ— T T T GGGGGGGXSWY[ GGGGGGGGG`SWW[ GGGGGGGGGZ[SX_] GGGGGGG_ZSZY_ GGGGGZW_SXX[ GXSW\[SYWW GXS[X]SXZ` GGGGYS`W\S``\
GZk XWY[ŸXWY[ŸXWY[
w“ˆ•••Ž všŒ› T T T GGGGGGG_S_WW GGGGGGGYYS^`Y GGGGGGGGG]XSXW_ GGGGGYW\S[XY GGGGG^^ZSW_[ GXS___SX__ T GGGGYS`\`SZ_[ GGGGG\U]
i›”ˆ— T T GGGGGGGXSWY[ GGGGGGG`S]W[ GGGGGGG_YSZ[[ GGGGGGG][WSWWW GG\SZ[\SZ[[ X[S]YZSYZY
G T T GGYWS^WXS\[_
GjŒ™™ WX
všŒ› T T GGGGGGGYS\WW GGGGGX]SZ_[ GGGGGYWYS\WW GGGGGGG`Z^SWY[ GG`SY\ZS^][ T T T GGXWS[XYSX^Y GGGY`U^
i›”ˆ— T GGGGGGGGG][ GGGGGGGGGGZY[ GGGGGGGYS\WW GGGGGGGX]SZ_[ GGGGGGGXX[SY[[ GGGGG^^^S`Y[ GGGXS_[^SW[Y T T GGGGYS^\_S[_Y
jŒ™™ WY
všŒ› T GGGGXSWY[ GGGGGGGGGGZY[ GGGGGGGYS\WW GGGGGGGX]SZ_[ GGGGGGGXX[SY[[ GGGGG`Z^SWY[ T T T GGGGXSW^XS\WW GGGGGZU^
i›”ˆ— T T GGGGGGGXSWY[ GGGGGGG\SX_[ GGGGGGG[WSWWW GGGGGGG[X`S`W[ GGYS_Y`SXY[ GGG_SYWXSY\W T T GGXXS[`]S[_]
jŒ™™ WZ
všŒ› T T GGGGGGGYS\WW GGGGGGG`S]W[ GGGGGGG\_S\][ GGGGGGG][WSWWW GGZS]`[SW_[ T T T GGGG[S[W[S^\Y GGGX\UY
i›”ˆ— T T GGGGGGGXSWY[ GGGGGGG`S]W[ GGGGGGG_YS`[[ GGGGGGG\YXSY_[ GG[SX`[SZW[ XYS\WWSWWW
G T T GGX^SZW`SX]W
{œ“—šWX
všŒ› T T GGGGGGGXSWY[ GGGGGGG`S]W[ GGGGGX\ZS]][ GGGGXSXX`SZ][ GG]S^X_S[][ T T T GGGG_SWWYSXYW GGGY[UX
i›”ˆ— T T GGGGGGGXSWY[ GGGGGGG`S]W[ GGGGGGG_YS`[[ GGGGGGG][WSWWW GG[S^[ZS]_[ X[S]YZSYZY
G T T GGYWSXWWS[__
{œ“—šWY
všŒ› T T GGGGGGGXSWY[ GGGGGGG`S]W[ GGGGGXX[SY[[ GGGGXSZY^SXW[ GG]S^X_S[][ T T T GGGG_SX^WS[[W GGGY^UW
i›”ˆ— T T GGGGGGGXSWY[ GGGGGGG\SX_[ GGGGGGG\_S\][ GGGGGGG[X`S`W[ GGZSY[WSWWW GGG_S`\[S`XY T T GGXYS]^`S\__
nˆ¡ˆ•ˆWX
všŒ› T T GGGGGGGYS\WW GGGGGGG\SX_[ GGGGGGG_YS`[[ GGGGGGG\YXSY_[ GG[SX`[SZW[ T T T GGGG[S_W]SYX] GGGX]U^
i›”ˆ— T T GGGGGGGXSWY[ GGGGGGG\SX_[ GGGGGGG\_S\][ GGGGGGG[X`S`W[ GGZSY[WSWWW GGG_S`\[S`XY T T GGXYS]^`S\__
nˆ¡ˆ•ˆWY Y\]ŸY\]ŸY\]ŸY\]
G[k všŒ› T T GGGGGGGYS\WW GGGGGGG`S]W[ GGGGGGG_YS`[[ GGGGGGG][WSWWW GG]SWWYS\WW T T T GGGG]S^Z^S\[_ GGGX_U\
nˆ™‹Œ• i›”ˆ— T T GGGGGGGXSWY[ GGGGGGG\SX_[ GGGGGGG\_S\][ GGGGGGG[X`S`W[ GGZSY[WSWWW GGG`S^\`SZ]Y T T GGXZS[_[SWZ_
nˆ¡ˆ•ˆWZ
všŒ› T T GGGGGGGYS\WW GGGGGGG`S]W[ GGGGGXX[SY[[ GGGGGGG`Z^SWY[ GG[S^[ZS]_[ T T T GGGG\S_W^SW\] GGGX_U[
i›”ˆ— T T GGGGGGGXSWY[ GGGGGGG\SX_[ GGGGGGG\_S\][ GGGGGGG[X`S`W[ GGZSY[WSWWW GGG`S^\`SZ]Y T T GGXZS[_[SWZ_
nˆ¡ˆ•ˆW[
všŒ› T T GGGGGGGYS\WW GGGGGGG`S]W[ GGGGGGG_YS`[[ GGGGGGG^^^S`Y[ GG[SX`[SZW[ T T T GGGG\SW]^SY^] GGGX^U^
i›”ˆ— T T GGGGGGGXSWY[ GGGGGGG`S]W[ GGGGGGG\_S\][ GGGGGGG\YXSY_[ GGZS]`[SW_[ XWS]X]S_ZY
G T T GGX[S`WXSZ`Y
j–“ŒœšWX
všŒ› T T GGGGGGGXSWY[ GGGGGY]SY[[ GGGGGXX[SY[[ GGGGXSZY^SXW[ GG]S^X_S[][ T T T GGGG_SX_^SW_W GGGYYUW
i›”ˆ— T T GGGGGGGXSWY[ GGGGGGG`S]W[ GGGGGGG_YS`[[ GGGGGGG][WSWWW GG[SX`[SZW[ XXS\Y`S]WY
G T T GGX]S[\^S[^_
j–“ŒœšWY
všŒ› T T GGGGGGGYS\WW GGGGGGG`S]W[ GGGGGGG_YS`[[ GGGGGGG`Z^SWY[ GG]S^X_S[\[ T T T GGGG^S^\WS\Y] GGGYZUX
i›”ˆ— T T GGGGGGGXSWY[ GGGGGGG`S]W[ GGGGGGG\_S\][ GGGGGGG\YXSY_[ GGZS]`[SW_[ XWS]X]S_ZY
G T T GGX[S`WXSZ`Y
j–“ŒœšWZ
všŒ› T T GGGGGGGXSWY[ GGGGGX]SZ_[ GGGGGGG_YS`[[ GGGGGGG^^^S`Y[ GG[S^[ZS]_[ T T T GGGG\S]YXS`]W GGGX`U]
i›”ˆ— T T GGGGGGGXSWY[ GGGGGGG`S]W[ GGGGGGG_YS`[[ GGGGGGG\YXSY_[ GG[SX`[SZW[ XXS\Y`S]WY
G T T GGX]SZZ_S^]Y
j–“ŒœšW[
všŒ› T T GGGGGGGXSWY[ GGGGGGG`S]W[ GGGGGXX[SY[[ GGGGGGG^^^S`Y[ GG\SZ[\SZ[[ T T T GGGG]SY[_SX[W GGGYXU\
i›”ˆ— T T GGGGGGGXSWY[ GGGGGGG`S]W[ GGGGGGG\_S\][ GGGGGGG\YXSY_[ GGZS]`[SW_[ XWS]X]S_ZY
G T T GGX[S`WXSZ`Y
j–“ŒœšW\
všŒ› T T GGGGGGGXSWY[ GGGGGGG`S]W[ GGGGGGG_YS`[[ GGGGGGG^^^S`Y[ GG[SX`[SZW[ T T T GGGG\SW]\S_WW GGGX`UW
i›”ˆ— T GGGZ`SY[_ GGGG_\`S^[_ ZSW_[S`W]
G XXSY\`SZW_
G GGGZ_S[^ZSW[_ \XSXYYSW]\
G T T T XW[S_Z_SZYZ
G
h•”ˆ“š XY_ŸXY_ŸXY_ŸXY_ŸXY_
všŒ› T ZYYS`]_
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-

submitted to Pacific Graphics (2009)


Myung Geol Choi & Eunjung Ju & Jung-Woo Chang & Jehee Lee & Young J. Kim / Linkless Octree Using Multi-Level Perfect Hashing 7

p”ˆŽŒG™Œš–“œ›–• ZY ][ XY_ Y\] \XY XWY[


OJG–G›–›ˆ“G•–‹ŒšP OY``P O^[ZP OX]\^P OZ\_\P O^ZWZP OX\[W`P
s•’“ŒššG˜œˆ‹›™ŒŒ XX` Y`\ ]WX X\W_ X`]_ ]^Y[

w–•›Œ™T‰ˆšŒ‹G˜œˆ‹›™ŒŒ [^_[ XX___ Y]\XY \^Z]W XX]_[_ Y[]\[[

z‰“•ŽG˜œˆ‹›™ŒŒ XX`] Y`^Y ]]Y_ X[Y[W Y`YXY ]X]Z]

΃ΖΤΠΝΦΥΚΠΟ͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑ hœ›œ”•ˆ“G˜œˆ‹›™ŒŒ ZZ] _Z] X_][ [WZZ _YX] X^ZZ\


ͷΒΔΖ
ͤͣ ͧͥ ͣͩ͢ ͣͦͧ ͦͣ͢ ͣͥ͢͡ Oi ›ŒP
ͽΚΟΜΝΖΤΤ͑΢ΦΒΕΥΣΖΖ ͣͣͣ͟͡ ͥͨ͟͢͡ ͪͦͪ͟͡ ͣͨͧ͟͢ ͥͤͥͪ͟ ͪͣͦͪ͟
΁ΠΚΟΥΖΣ͞ΓΒΤΖΕ͑΢ΦΒΕΥΣΖΖ ͣͥͣ͟͢ ͦͧͥ͟͢ ͣͩͥ͢͟͢ ͣͧͦͩ͟͢ ͦͨͦͣ͟͢ ͣͤͧ͢͢͟͢
΋ΚΡ
΃ΦΟ͞ΝΖΟΘΥΙ
ͣ͟͢͢͡
ͥ͟͡
ͤͧͦ͟͡
ͨ͟͡
ͩͤͪ͟͡
ͦ͢͟
ͪͧͤ͢͟
ͤͥ͟
ͥͩͪ͟
ͨͩ͟
ͣͣͤͧ͢͟
ͧͪ͢͟
Figure 7: Memory overhead comparison. We measured the
ʹʹͺ΅΅͙͑ΘΣΠΦΡ͚ͤ ͥ͟͡ ͧ͟͡ ͪ͟͡ ͩ͢͟ ͤͨ͟ ͨͪ͟ size of pointers and hash tables of four quadtrees. The data
ʹʹͺ΅΅͙͑ΘΣΠΦΡ͚ͥ ͤ͟͡ ͥ͟͡ ͧ͟͡ ͢ ͩ͢͟ ͤͥ͟
(Kbyte) fields are not included in the size.

storage efficiency and the construction time. In our imple-


mentation, the tree construction was considered as a prepro-
΃ΖΤΠΝΦΥΚΠΟ͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑͑
΅ΖΩΥ cessing phase and we were mainly concerned with reducing
ͤͣ ͧͥ ͣͩ͢ ͣͦͧ ͦͣ͢ ͣͥ͢͡
ͽΚΟΜΝΖΤΤ͑΢ΦΒΕΥΣΖΖ ͣͥͦ͟͡ ͩͨ͟͡͡ ͥͣͨ͟͡ ͨͪ͢͢͟͡ ͤͦͪͤͨ͟ ͪͤͧ͢͟͢
΁ΠΚΟΥΖΣ͞ΓΒΤΖΕ͑΢ΦΒΕΥΣΖΖ ͦͨͥ͟͢ ͩͨͨͥ͢͟ ͩͨͩͪ͟͡ ͣͤͩͨͧͨ͟ ͨͨͦͤ͢͟͢ ͪͨ͢͢͟͡͡͡ storage costs while allowing efficient access to data at run-
΋ΚΡ ͣͣͥ͟͡ ͦͦ͟͡͡ ͤͨͨ͢͟ ͥͤͩͪ͟ ͦͩͥͣ͢͟ ͥͤͣ͟͡͡
΃ΦΟ͞ΝΖΟΘΥΙ ͥ͟͡ ͨ͟͡ ͨ͢͟ ͦ͟͡ ͦͩ͢͟ ͥͨ͟͢
time.
ʹʹͺ΅΅͙͑ΘΣΠΦΡ͚ͤ ͥ͟͡ ͨ͟͡ ͨ͢͟ ͥͦ͟ ͦ͢͟͢ ͤͣͪ͟
ʹʹͺ΅΅͙͑ΘΣΠΦΡ͚ͥ ͥ͟͡ ͧ͟͡ ͧ͢͟ ͤͪ͟ ͥͤ͢͟ ͣͨͧ͟
(Kbyte)
Another limitation is the lack of local refineability. Inserting
and deleting a point in a perfect hash table usually lead to re-
Figure 6: 2D image compression performance comparison. building the entire hash table. Therefore, our linkless octree
cannot allow for frequent local updates and thus may not be
adequate for representing dynamically changing data. De-
veloping a dynamically updateable perfect hashing function
ing structure and C is a large constant. For the 1024 × 1024 is an interesting direction for future research.
image with 15,409 octree nodes, the succinct quadtree takes
7, 705 + o(n) (bytes), which is 14.9% larger than our linkless
octree. Acknowledgements
Computation time. We compare our hash-based quadtree We sincerely appreciate the advice of Prof. Srinivasa Rao
and the pointer-based quadtree for the 1024 × 1024 face im- Satti. This work was supported by the Korea Research Foun-
age in Figure 6. The construction of the hash-based quadtree dation Grant funded by the Korean Government (MOEHRD)
takes 0.735 seconds, which is ten times slower than the (KRF-2007-511-D00332) and the grant from the strategic
pointer-based tree construction (0.076 seconds). Evaluating technology development program (Project No. 2008-F-033-
a perfect hash function requires two modulo and one ta- 02) of both the MKE (Ministry of Knowledge Econemy) and
ble lookup operations. Therefore, the random access to the MCST (Ministry of Culture, Sports and Tourism) of Korea.
hash-based quadtree is slower than the random access to
the pointer-based quadtree, which requires only one pointer
indirection. In our experiments, accessing a million ran- References
dom nodes in the hash-based quadtree and the pointer-based [BDM∗ 05] B ENOIT D., D EMAINE E. D., M UNRO J. I., R AMAN
quadtree took 0.625 and 0.095 seconds, respectively. Though R., R AMAN V., R AO S. S.: Representing trees of higher degree.
tree accessing using hash functions is slower than pointer in- Algorithmica 43, 4 (2005), 275–292. 2, 6
direction, it is much more efficient than other compressed [BF08] BASTOS T., F ILHO W. C.: Gpu-accelerated adaptively
linear quadtrees that requires O(n) time for random node ac- sampled distance fields. In Proceedings of IEEE Interna-
cess. tional Conference on Hsape Modeling and Applications (2008),
pp. 171–178. 3
[CLL∗ 08] C ASTRO R., L EWINER T., L OPES H., TAVARES G.,
5. Discussion B ORDIGNON A.: Statistical optimization of octree searches.
Computer Graphics Forum 27, 6 (march 2008), 1557–1566. 3
We have presented a pointerless octree that makes use of [EGS05] E PPSTEIN D., G OODRICH M. T., S UN J. Z.: The skip
multi-level perfect spatial hashing. Our linkless implemen- quadtree: Asimple dynamic data structure for multidimensional
tation would allow octrees to be employed in a wider variety data. In Proceedings of the 21st Annual Symposium on Compu-
of applications. tational Geometry (SoCG’05) (2005), pp. 296–305. 2
[FM86] FABBRINI F., M ONTANI C.: Autumnal quadtrees. The
Our linkless octree has several limitations. The perfect hash- Computer JOURNAL 29, 5 (1986), 472–474. 2, 6
ing functions we employed are near optimal in the sense that [Gar82] G ARGANTINI I.: An effective way to represent
the storage requirement for storing offset tables is small, but quadtrees. Communications of the ACM 25, 12 (1982), 905–910.
may not be optimal. There exists a trade-off between the 1, 2

submitted to Pacific Graphics (2009)


8 Myung Geol Choi & Eunjung Ju & Jung-Woo Chang & Jehee Lee & Young J. Kim / Linkless Octree Using Multi-Level Perfect Hashing

[HLC∗ 97] H UDSON T. C., L IN M. C., C OHEN J.,


G OTTSCHALK S., M ANOCHA D.: V-collide: accelerated
collision detection for vrml. In Proceedings of Symposium on
Virtual Reality Modeling Language (VRML ’97) (1997). 5
[HW91] H UNTER A., W ILLIS P. J.: Classification of quad-
encoding techniques. Computer Graphics Forum 10, 2 (1991),
97–112. 6
[Jac89] JACOBSON G.: Space-efficient static trees and graphs. In
Proceedings of the 30th Annual Symposium on Foundations of
Computer Science (SFCS ’89) (1989), pp. 549–554. 2
[LCR∗ 02] L EE J., C HAI J., R EITSMA P. S. A., H ODGINS J. K.,
P OLLARD N. S.: Interactive control of avatars animated with hu-
man motion data. ACM Transactions on Graphics (SIGGRAPH
2002) 21, 3 (2002), 491–500. 5
[LH06] L EFEBVRE S., H OPPE H.: Perfect spatial hashing. ACM
Transactions on Graphics (SIGGRAPH 2006) 25, 3 (2006), 579–
588. 2, 3, 4
[LH07] L EFEBVRE S., H OPPE H.: Compressed random-access
trees for spatially coherent data. In Proceedings of the Euro-
graphics Symposium on Rendering (2007). 2, 6
[LSK∗ 06] L EFOHN A. E., S ENGUPTA S., K NISS J., S TRZODKA
R., OWENS J. D.: Glift: Generic, efficient, random-access gpu
data structures. ACM Transactions on Graphics 25, 1 (2006),
60–99. 2
[MR97] M UNRO J. I., R AMAN V.: Succinct representation of
balanced parentheses, static trees and planar graphs. In Proceed-
ings of the 38th Annual Symposium on Foundations of Computer
Science (FOCS ’97) (1997), p. 118. 2
[OW83] O LIVER M. A., W ISEMAN N. E.: Operations on
quadtree encoded images. The Computer Journal 26, 1 (1983),
83–91. 1, 2
[PF05] P HARR M., F ERNANDO R.: GPU Gems 2: Program-
ming Techniques for High-Performance Graphics and General-
Purpose Computation (Chapter 1. Octree Textures on the GPU).
Pearson Education, 2005. 2
[Woo84] W OODWARK J.: Compressed quad trees. The Computer
Journal 27, 3 (1984), 225–229. 1, 2
[WS93] WARREN M. S., S ALMON J. K.: A parallel hashed oct-
tree n-body algorithm. In Proceedings of the 1993 ACM/IEEE
conference on Supercomputing (Supercomputing ’93) (1993),
pp. 12–21. 3
[ZHWG08] Z HOU K., H OU Q., WANG R., G UO B.: Real-time
kd-tree construction on graphics hardware. ACM Transactions
on Graphics (SIGGRAPH Asia 2008) 27, 5 (2008), 1–11. 2
[ZKVM06] Z HANG L., K IM Y. J., VARADHAN G., M ANOCHA
D.: Fast c-obstacle query computation for motion planning. In
Proceedings of IEEE International Conference on Robotics and
Automation (ICRA 2006) (2006), pp. 3035–3040. 5

submitted to Pacific Graphics (2009)

You might also like