## Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

∗

Gabriel Zachmann & Elmar Langetepe

Informatik II/I

University of Bonn, Germany

email: {zach,langetep}@cs.uni-bonn.de

http://web.cs.uni-bonn.de/~zach

http://web.cs.uni-bonn.de/I/staff/langetepe.html

13th August 2003

Course Description

In recent years, methods from computational geometry have been widely adopted by the computer

graphics community yielding elegant and efﬁcient algorithms. This course aims at familiarizing practi-

tioners in the computer graphics ﬁeld with a wide range of data structures from computational geometry.

It will enable attendees to recognize geometrical problems and select the most suitable data structure

when developing computer graphics algorithms.

The course will focus on algorithms and data structures that have proven to be versatile, efﬁcient,

fundamental and easy to implement. Thus practitioners and researchers will beneﬁt immediately from

this course for their everyday work.

∗

You can ﬁnd the slides and the multimedia material for this tu-

torial at http://cg.cs.uni-bonn.de/course/

2 Zachmann/Langetepe: Geometric Data Structures for CG

Prerequisites

Participants of this course should be familiar with the basic principles of computer graphics and the type

of problems in the area. Familiarity with computer programming is not required.

The intended audience are practitioners working in 3D computer graphics (VR, CAD/CAM, entertain-

ment, animation, etc.) and students from both computer graphics and computational geometry, possibly

working on a master or PhD thesis.

Syllabus

Our goal is to familiarize practitioners and researchers in computer graphics with some very versatile and

ubiquitous geometric data structures, enable them to readily recognize geometric problems during their

work, modify the algorithms to their needs, and hopefully make them curious about further powerful

treasures to be discovered in the area of computational geometry.

In order to achieve these goals in an engaging yet sound manner, the general concept throughout the

course is to present each geometric data structure in the following way: ﬁrst, the data strucure will be

deﬁned and described in detail; then, some of its fundamental properties will be highlighted; after that,

one or more computational geometry algorithms based on the data structure will be presented; and ﬁnally,

a number of recent, representative and practically relevant algorithms from computer graphics will be

described in detail, showing the utilization of the data structure in a creative and enlightening way.

We have arranged the topics in roughly increasing degree of difﬁculty. The hierarchical data structures

are ordered by increasing ﬂexibility, while the non-hierarchical topics build on each other. Finally, the last

topic presents a generic technique for dynamizing geometric data structures.

Detailed informations about the topics discussed and the corresponding presenters are given in the

schedule below.

Component 1. Introduction

Introduction – Zachmann/Langetepe.

Component 2. Quadtree/Octree

Construction, complexity, balancing, navigation – Langetepe.

Terrain visualization, iso-surface generation – Zachmann.

Component 3. Bounding volume hierarchies

Deﬁnition, construction, hierarchical collision detection – Zachmann.

Component 4. Voronoi diagrams / Delaunay triangulations

Deﬁnition, construction, generalizations, applications – Langetepe.

NURBS tesselation, texture synthesis – Zachmann.

Component 5. Distance ﬁelds

Deﬁnition, modelling, morphing – Zachmann.

Component 6. Dynamization of geometric data structures

Deﬁnition, amortized Insert and Delete – Langetepe.

Siggraph 2003 Tutorial 16

Zachmann/Langetepe: Geometric Data Structures for CG 3

Contents

1 Introduction 5

2 Quadtrees and K-d-Trees 5

2.1 Quadtrees and Octrees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

2.1.1 Deﬁnition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

2.1.2 Complexity and Construction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

2.1.3 Neighbor Finding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

2.2 K-d-Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

2.3 Height Field Visualization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

2.4 Isosurface Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

2.5 Ray Shooting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

2.5.1 3D Octree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

2.5.2 5D Octree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

3 BSP Trees 15

3.1 Rendering Without a Z-Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

3.2 Representing Objects with BSPs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

3.3 Boolean Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

3.4 Construction Heuristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

3.4.1 Convex objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

3.4.2 Cost driven heuristic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

3.4.3 Non-uniform queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

3.4.4 Deferred, self-organizing BSPs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

4 Bounding Volume Hierarchies 22

4.1 Construction of BV Hierarchies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

4.1.1 Bottom-up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

4.1.2 Insertion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

4.1.3 Top-down . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

4.1.4 Construction criteria . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

4.1.5 The criterion for collision detection . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

4.2 Collision Detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

5 Voronoi Diagrams 28

5.1 Deﬁnitions and Elementary Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

5.1.1 Voronoi Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

5.1.2 Delaunay Triangulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

5.2 Computation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

5.3 Generalization of the Voronoi Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

5.3.1 Voronoi Diagram and Delaunay Triangulation in 3D . . . . . . . . . . . . . . . . . 32

5.3.2 Constrained Voronoi diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

5.3.3 Other Types of Generalizations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

5.4 Applications of the Voronoi Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

5.4.1 Nearest Neighbor or Post Ofﬁce Problem . . . . . . . . . . . . . . . . . . . . . . . 34

5.4.2 Motion planning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

5.4.3 Other Applications of the Voronoi Diagram in 2D . . . . . . . . . . . . . . . . . . . 36

5.5 Texture Synthesis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

5.6 Shape Matching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

Siggraph 2003 Tutorial 16

4 Zachmann/Langetepe: Geometric Data Structures for CG

6 Distance Fields 39

6.1 Computation and representation of DFs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

6.1.1 Propagation method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

6.1.2 Projection of distance functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

6.2 Applications of DFs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

6.2.1 Morphing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

6.2.2 Modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

7 Dynamization of Geometric Data Structures 44

7.1 Model of the Dynamization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

7.2 Amortized Insert and Delete . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46

7.2.1 Amortized Insert: Binary Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . 46

7.2.2 Amortized Delete: Occasional Reconstruction . . . . . . . . . . . . . . . . . . . . . 47

7.2.3 Amortized Insert and Amortized Delete . . . . . . . . . . . . . . . . . . . . . . . . 48

7.3 Worst-Case sensitive Insert and Delete . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48

7.4 A Simple Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

Siggraph 2003 Tutorial 16

Zachmann/Langetepe: Geometric Data Structures for CG 5

1 Introduction

In recent years, methods from computational ge-

ometry have been widely adopted by the computer

graphics community. Many solutions draw their

elegance and efﬁciency from the mutually enrich-

ing combination of such geometrical data structures

with computer graphics algorithms.

This course imparts a working knowledge of a

number of essential geometric data structures and

explains their elegant use in several representative,

diverse, and current areas of research in computer

graphics such as terrain visualization, texture syn-

thesis, modelling, and tesselation. Our selection

of data structures and algorithms consists of well-

known concepts, which are both powerful and easy

to implement, ranging from quadtrees to BSP trees

and bounding volume trees. We do not try to pro-

vide an exhaustive survey of the topics touched

upon here — this would be far beyond the scope

of this course. Neither do we try to present leading

edge algorithms because we feel that for practical

purposes a good trade-off between simplicity and

efﬁciency is important.

Participants will learn to recognize geometric prob-

lems and develop a thorough understanding of suit-

able algorithms. As a prerequisite, they should al-

ready be familiar with the basic principles of com-

puter graphics and the type of problems in the area.

The general concept throughout the course is to

present each geometric data structure in the follow-

ing way: ﬁrst, the data strucure will be deﬁned and

described in detail; then, some of its fundamen-

tal properties will be highlighted; after that, one

or more computational geometry algorithms based

on the data structure will be presented; and ﬁnally,

a number of recent, representative and practically

relevant algorithms from computer graphics will be

described in detail, showing the utilization of the

data structure in a creative and enlightening way.

2 Quadtrees and K-d-Trees

Within this section we will present some funda-

mental geometric data structures.

In Section 2.1, we introduce the quadtree struc-

ture. Its deﬁnition and complexity, the recursive

construction scheme and a standard application are

presented. Quadtrees and octrees have applications

in mesh generation as shown in Section 2.3, 2.4, 2.5.

A natural generalization of the one-dimenional

search tree to k dimensions is shown in Section 2.2.

The k-d-tree is efﬁcient for axis-parallel rectangu-

lar range queries.

The quadtree description was adapted fromde Berg

et al.

23

and the k-d-tree introduction was taken

from Klein.

55

2.1 Quadtrees and Octrees

2.1.1 Deﬁnition

A quadtree is a rooted tree so that every internal

node has four children. Every node in the tree cor-

responds to a square. If a node v has children, their

corresponding squares are the four quadrants, as

shown in Figure 1.

SE SW NW NE

Figure 1: An example of a quadtree.

Quadtrees can store many kinds of data. We will

describe the variant that stores a set of points and

suggest a recursive deﬁnition. A simple recursive

splitting of squares is continued until there is only

one point in a square. Let P be a set of points.

The deﬁnition of a quadtree for a set of points

in a square Q = [x1

Q

: x2

Q

] [y1

Q

: y2

Q

] is as

follows:

• If [P[ ≤ 1 then the quadtree is a single leaf

where Q and P are stored.

• Otherwise let Q

NE

, Q

NW

, Q

SW

and Q

SE

denote

the four quadrants. Let x

mid

:= (x1

Q

+ x2

Q

)/2

and y

mid

:= (y1

Q

+y2

Q

)/2, and deﬁne

P

NE

:= ¦p ∈ P : p

x

> x

mid

∧ p

y

> y

mid

¦,

P

NW

:= ¦p ∈ P : p

x

≤ x

mid

∧ p

y

> y

mid

¦,

P

SW

:= ¦p ∈ P : p

x

≤ x

mid

∧ p

y

≤ y

mid

¦,

P

SE

:= ¦p ∈ P : p

x

> x

mid

∧ p

y

≤ y

mid

¦.

The quadtree consists of a root node v, Q is

stored at v. In the following, let Q(v) denote

the square stored at v. Furthermore v has four

children: The X-child is the root of the quadtree

of the set P

X

, where X is an element of the set

¦NE, NW, SW, SE¦.

Siggraph 2003 Tutorial 16

6 Zachmann/Langetepe: Geometric Data Structures for CG

2.1.2 Complexity and Construction

The recursive deﬁnition implies a recursive con-

struction algorithm. Only the starting square has

to be chosen adequately. If the split operation can-

not be performed well, the quadtree is unbalanced.

Despite this effect, the depth of the tree is related

to the distance between the points.

Theorem 1 The depth of a quadtree for a set P of

points in the plane is at most log(

s

/c) +

3

2

, where c

is the smallest distance between any two points in

P and s is the side length of the initial square.

The cost of the recursive construction and the

complexity of the quadtree depends on the depth

of the tree.

Theorem 2 A quadtree of depth d, which stores a

set of n points, has O((d + 1)n) nodes and can be

constructed in O((d + 1)n) time.

Due to the degree 4 of internal nodes, the total

number of leaves is one plus three times the num-

ber of internal nodes. Hence it sufﬁces to bound the

number of internal nodes.

Any internal node v has one or more points in-

side Q(v). The squares of the node of a single depth

cover the initial square. Therefore, at every depth

we have at most n internal nodes that gives the

node bound.

The most time-consuming task in one step of the

recursive approach is the distribution of the points.

The amount of time spent is only linear in the

number of points and the O((d + 1)n) time bound

holds.

The 3D equivalent of quadtrees are octrees. The

quadtree construction can be easily extended to oc-

trees in 3D. The internal nodes of octrees have eight

sons and the sons correspond to boxes instead of

squares.

2.1.3 Neighbor Finding

A simple application of the quadtree of a point set

is neighbor ﬁnding, that is, given a node v and a

direction, north, east, south or west, ﬁnd a node v

/

so that Q(v) is adjacent to Q(v

/

). Normally, v is

a leaf and v

/

should be a leaf as well. The task is

equivalent to ﬁnding an adjacent square of a given

square in the quadtree subdivision.

Obviously, one square may have many such neigh-

bors, as shown in Figure 2.

q

Figure 2: The square q has many west neighbors.

For convenience, we extend the neighbor search.

The given node can also be internal, that is, v and

v

/

should be adjacent corresponding to the given

direction and should also have the same depth. If

there is no such node, we want to ﬁnd the deepest

node whose square is adjacent.

The algorithm works as follows. Suppose we

want to ﬁnd the north neighbor of v. If v happens

to be the SE- or SW-child of its parent, then its

north neighbor is easy to ﬁnd, it is the NE- or NW-

child of its parent, respectively. If v itself is the NE-

or NW-child of its parent, then we proceed as fol-

lows. Recursively ﬁnd the north neighbor of µ of

the parent of v. If µ is an internal node, then the

north neighbor of v is a child of µ; if µ is a leaf, the

north neighbor we seek for is µ itself.

This simple procedure runs in time O(d + 1).

Theorem 3 Let T be quadtree of depth d. The

neighbor of a given node v in T a given direction,

as deﬁned above, can be found in O(d + 1) time.

Furthermore, there is also a simple procedure

that constructs a balanced quadtree out of a given

quadtree T. This can be done in time O(d + 1)m

and O(m) space if T has m nodes. For details

see Berg et al.

23

Similar results hold for octrees as well.

2.2 K-d-Trees

The k-d-tree is a natural generalization of the one-

dimenional search tree.

Let D be a set of n points in R

k

. For conve-

nience let k = 2 and let us assume that all X- and

Y-coordinates are different. First, we search for a

Siggraph 2003 Tutorial 16

Zachmann/Langetepe: Geometric Data Structures for CG 7

Y

X

10 5

5

a

b

c

d

i

j

h

f

e

k

g

x=5

y=5 y=4

5<x x<5

x=7 x=8

5<y y<5

y<3

x=3 x=2

4<y

y=3

3<y

y<4

x<2 2<x

x<3

3<x

x<8 8<x

x<7

y<6

y=6

7<x

6<y y<2

y=2

2<y

a

e c

b d

h f

j g

k i

Figure 3: A k-d-tree for k = 2 and a rectangular

range query. The nodes correspond to split lines.

split-value s of the X-coordinates. Then we split D

by the split-line X = s into subsets:

D

<s

= ¦(x, y) ∈ D; x < s¦ = D∩ ¦X < s¦

D

>s

= ¦(x, y) ∈ D; x > s¦ = D∩ ¦X > s¦.

For both sets we proceed with the Y-coordinate

and split-lines Y = t

1

and Y = t

2

. We repeat

the process recursively with the constructed sub-

sets. Thus, we obtain a binary tree, namely the 2-d-

tree of the point set D, as shown in Figure 3. Each

internal node of the tree corresponds to a split-line.

For every node v of the 2-d-tree we deﬁne the rect-

angle R(v), which is the intersection of halfplanes

corresponding to the path from the root to v. For

the root r, R(r) is the plane itself; for the sons

of r, say le f t and right, we produce to halfplanes

R(le f t) and R(right) and so on. The set of rectan-

gles ¦R(l) : l is a leaf¦ gives a partition of the plane

into rectangles. Every R(l) has exactly one point of

D inside.

This structure supports range queries of axis-

parallel rectangles. For example, if Q is an axis-

parallel rectangle, the set of sites v ∈ D with v ∈ Q

can be computed efﬁciently. We simply have to

compute all nodes v with:

R(v) ∩ Q = ∅.

Additionally we have to test whether the points

inside the subtree of v are inside Q.

The efﬁciency of the k-d-tree with respect to

range queries depends on the depth of the tree. A

balanced k-d-tree can be easily constructed. We

sort the X- and Y-coordinates. With this order

we recursively split the set into subsets of equal

size in time O(log n). The construction runs in

time O(n log n). Altogether the following theorem

holds:

Theorem 4 A balanced k-d-tree for n points in

the plane can be constructed in O(n log n) and

needs O(n) space. A range query with an axis-

parallel rectangle can be answered in time O(

√

n +

a), where a denotes the size of the answer.

2.3 Height Field Visualization

A special area in 3D visualization is the rendering

of large terrains, or, more generally, of height ﬁelds.

A height ﬁeld is usually given as a uniformly-

gridded square array h : [0, N −1]

2

→ R, N ∈ I,

of height values, where N is typically in the order

of 16,384 or more (see Figure 4). In practice, such

a raw height ﬁeld is often stored in some image ﬁle

format, such as GIF. A regular grid is, for instance,

one of the standard forms in which the US Geo-

logical Survey publishes their data, known as the

Digital Elevation Model (DEM).

32

Alternatively, height ﬁelds can be stored as tri-

angular irregular networks (TINs) (see Figure 5).

They can adapt much better to the detail and fea-

tures (or lack thereof) in the height ﬁeld, so they

can approximate any surface at any desired level of

accuracy with fewer polygons than any other rep-

resentation.

64

However, due to their much more

complex structure, TINs do not lend themselves as

well as more regular representations to interactive

visualization.

The problemin terrain visualization is a lowview-

point directed at the horizon: then, there are a few

parts of the terrain that are very close, while the

majority of the visible terrain is at a larger distance.

Close parts of the terrain should be rendered with

high detail, while distant parts should be rendered

Siggraph 2003 Tutorial 16

8 Zachmann/Langetepe: Geometric Data Structures for CG

Figure 4: A height ﬁeld approximated by a grid.

15

Figure 5: The same height ﬁeld approximated by

a TIN.

T-vertices!

4

8

Figure 6: In order to use quadtrees for deﬁning a

height ﬁeld mesh, it should be balanced.

Figure 7: A quadtree deﬁnes a recursive subdivi-

sion scheme yielding a 4-8 mesh. The dots denote

the newly added vertices. Some vertices have de-

gree 4, some 8 (hence the name).

with very little detail in order to maintain a high

frame rate.

In order to solve this problem, a data structure is

needed that allows to quickly determine the desired

level of detail in each part of the terrain. Quadtrees

are such a data structure, in particular, since they

seem to be a good compromise between the sim-

plicity of non-hierarchical grids and the good adap-

tivity of TINs. The general idea is to construct

a quadtree over the grid, and then traverse this

quadtree top-down in order to render it. At each

node, we decide whether the detail offered by ren-

dering it is enough, or if we have to go down fur-

ther.

One problem with quadtrees (and quadrangle-

based data structures in general) is that nodes are

not quite independent of each other. Assume we

have constructed a quadtree over some terrain as

depicted in Figure 6. If we render that as-is, then

there will be a gap (a.k.a. crack) between the top

left square and the ﬁne detail squares inside the top

right square. The vertices causing this problem are

called T-vertices. Triangulating them would help in

theory, but in practice this leads to long and thin

triangles which have problems on their own. The

solution is, of course, to triangulate each node.

Thus, a quadtree offers a recursive subdivision

scheme to deﬁne a triangulated regular grid (see

Figure 7): start with a square subdivided into two

right-angle triangles; with each recursion step, sub-

divide the longest side of all triangles (the hy-

pothenuse) yielding two new right-angle triangles

each (hence this scheme is sometimes referred to

as “longest edge bisection”).

65

This yields a mesh

where all vertices have degree 4 or 8 (except the

Siggraph 2003 Tutorial 16

Zachmann/Langetepe: Geometric Data Structures for CG 9

0 1 2 3 4

blue

level

red

red

blue

Figure 8: The 4-8 subdivision can be generated

by two interleaved quadtrees. The solid lines con-

nect siblings that share a common father.

Figure 9: The red quadtree can be stored in the

unused “ghost” nodes of the blue quadtree.

border vertices), which is why such a mesh is often

called a 4-8 mesh.

This subdivision scheme induces a directed acyclic

graph (DAG) on the set of vertices: vertex j is a

child of i if it is created by a split of a right angle

at vertex i. This will be denoted by an edge (i, j).

Note that almost all vertices are created twice (see

Figure 7), so all nodes in the graph have 4 children

and 2 parents (except the border vertices).

During rendering, we will choose cells of the sub-

division at different levels. Let M

0

be the fully

subdivided mesh (which corresponds to the origi-

nal grid) and M be the current, incompletely subdi-

vided mesh. M corresponds to a subset of the DAG

of M

0

. The condition of being crack-free can be re-

formulated in terms of the DAGs associated with

M

0

and M:

M is crack-free ⇔

M does not have any T-vertices ⇔

∀(i, j) ∈ M : (i

/

, j) ∈ M, where parent(j) = ¦i, i

/

¦

(1)

In other words: you cannot subdivide one trian-

gle alone, you also have to subdivide the one on

the other side. During rendering, this means that if

you render a vertex, then you also have to render

all its ancestors (remember: a vertex has 2 parents).

Rendering such a mesh generates (conceptually)

a single, long list of vertices that are then fed into

the graphics pipeline as a single triangle strip. The

pseudo-code for the algorithm looks like this (sim-

pliﬁed):

submesh(i,j)

if error(i) < τ then

return

end if

if B

i

outside viewing frustum then

return

end if

submesh( j, c

l

)

V += p

i

submesh( j, c

r

)

where error(i) is some error measure for vertex i,

and B

i

is the sphere around vertex i that completely

encloses all descendant triangles.

Note that this algorithm can produce the same

vertex multiple times consecutively; this is easy

to check, of course. In order to produce one strip,

the algorithm has to copy older vertices to the cur-

rent front of the list at places where it makes a

“turn”; again, this is easy to detect, and the inter-

ested reader is referred to.

65

One can speed up the culling a bit by noticing

that if B

i

is completely inside the frustum, then we

do not need to test the child vertices any more.

We still need to think about the way we store our

terrain subdivision mesh. Eventually, we will want

to store it as a single linear array for two reasons:

1. The tree is complete, so it really would not make

sense to store it using pointers.

2. We want to map the ﬁle that holds the tree into

memory as-is (for instance, with Unix’ mmap

function), so pointers would not work at all.

We should keep in mind, however, that with cur-

rent architectures, every memory access that can

Siggraph 2003 Tutorial 16

10 Zachmann/Langetepe: Geometric Data Structures for CG

physical

space

space

cell

node

computational

⊕

⊕

⊕

⊕

⊕

⊕ ⊕

⊕ ⊕

?

Figure 10: A scalar ﬁeld is often given in the form

of a curvilinear grid. By doing all calculations in

computational space, we can usually save a lot of

computational effort.

Figure 11: Cells straddling the isosurface are tri-

angulated according to a lookup table. In some

cases, several triangulations are possible, which

must be resolved by heuristics.

not be satisﬁed by the cache is extremely expensive

(this is even more so with disk accesses, of course).

The simplest way to organize the terrain vertices

is a matrix layout. The disadvantage is that there

is no cache locality at all across the major index.

In order to improve this, people often introduce

some kind of blocking, where each block is stored

in matrix and all blocks are arranged in matrix or-

der, too. Unfortunately, Lindstrom and Pascucci

65

report that this is, at least for terrain visualization,

worse than the simple matrix layout by a factor 10!

Enter quadtrees. They offer the advantage that

vertices on the same level are stored fairly close

in memory. The 4-8 subdivision scheme can be

viewed as two quadtrees which are interleaved (see

Figure 8): we start with the ﬁrst level of the “red”

quadtree that contains just the one vertex in the

middle of the grid, which is the one that is gen-

erated by the 4-8 subdivision with the ﬁrst step.

Next comes the ﬁrst level of the “blue” quadtree

that contains 4 vertices, which are the vertices gen-

erated by the second step of the 4-8 subdivision

scheme. This process repeats logically. Note that

the blue quadtree is exactly like the red one, except

it is rotated by 45°. When you overlay the red and

the blue quadtree you get exactly the 4-8 mesh.

Notice that the blue quadtree contains nodes that

are outside the terrain grid; we will call these nodes

“ghost nodes”. The nice thing about them is that

we can store the red quadtree in place of these ghost

nodes (see Figure 9). This reduces the number

of unused elements in the ﬁnal linear array down

to 33%.

During rendering we need to calculate the indices

of the child vertices, given the three vertices of a

triangle. It turns out that by cleverly choosing the

indices of the top-level vertices this can be done as

efﬁciently as with a matrix layout.

The interested reader can ﬁnd more about this

topic in Lindstrom et al.,

64

Lindstrom and Pas-

cucci,

65

Balmelli et al.,

8

Balmelli et al.,

7

and many

others.

2.4 Isosurface Generation

One technique (among many others) of visualizing

a 3-dimenional volume is to extract isosurfaces and

render those as a regular polygonal surface. It can

be used to extract the surfaces of bones or organs in

medical scans, such as MRI or CT.

Assume for the moment that we are given a

scalar ﬁeld f : R

3

→ R. Then the task of ﬁnding

an isosurface would “just” be to ﬁnd all solutions

(i.e., all roots) of the equation f (x) = t.

Since we live in a discrete world (at least in com-

puter graphics), the scalar ﬁeld is usually given in

the form of a curvilinear grid: the vertices of the

cells are called nodes, and we have one scalar and a

3D point stored at each node (see Figure 10). Such

a curvilinear grid is usually stored as a 3D array,

which can be conceived as a regular 3D grid (here,

the cells are often called voxels).

The task of ﬁnding an isosurface for a given value

t in a curvilinear grid amounts to ﬁnding all cells of

which at least one node (i.e., corner) has a value

less than t and one node has a value greater than

Siggraph 2003 Tutorial 16

Zachmann/Langetepe: Geometric Data Structures for CG 11

x

y

x=0 m 0 m 0

y=0 1

Figure 12: Octrees offer a simple way to compute

isosurfaces efﬁciently.

Figure 13: Volume data layout should match the

order of traversal of the octree.

t. Such cells are then triangulated according to a

lookup table (see Figure 11). So, a simple algorithm

works as follows:

66

compute the sign for all nodes

(⊕ > t , < t); then consider each cell in

turn, use the eight signs as an index into the lookup

table, and triangulate it (if at all).

Notice that in this algorithm we have only used

the 3D array — we have not made use at all of the

information exactly where in space the nodes are

(except when actually producing the triangles). We

have, in fact, made a transition from computational

space (i.e., the curvilinear grid) to computational

space (i.e., the 3D array). So in the following, we

can, without loss of generality, restrict ourselves to

consider only regular grids, that is, 3D arrays.

The question is, how can we improve the exhaus-

tive algorithm. One problem is that we must not

miss any little part of the isosurface. So we need a

data structure that allows us to discard large parts

of the volume where the isosurface is guaranteed to

not be. This calls for octrees.

The idea is to construct a complete octree over the

cells of the grid

96

(for the sake of simplicity, we will

assume that the grid’s size is a power of two). The

leaves point to the lower left node of their associ-

ated cell (see Figure 12). Each leaf ν stores the min-

imum ν

min

and the maximum ν

max

of the 8 nodes

of the cell. Similarly, each inner node of the octree

stores the min/max of its 8 children.

Observe that an isosurface intersects the volume

associated with a node ν (inner or leaf node) if and

only if ν

min

≤ t ≤ ν

max

. This already suggests

how the algorithm works: start with the root and

visit recursively all the children where the condi-

tion holds. At the leaves, construct the triangles as

usual.

This can be accelerated further by noticing that

if the isosurface crosses an edge of a cell, then that

edge will be visited exactly four times during the

complete procedure. Therefore, when we visit an

edge for the ﬁrst time, we compute the vertex of the

isosurface on that edge, and store the edge together

with the vertex in a hash table. So whenever we

need a vertex on an edge, we ﬁrst try to look up

that edge in the hash table. Our observation also

allows us to keep the size of the hash table fairly

low: when an edge has been visited for the fourth

time, then we know that it cannot be visited any

more; therefore, we remove it from the hash table.

2.5 Ray Shooting

Ray shooting is an elementary task that frequently

arises in ray tracing, volume visualization, and in

games for collision detection or terrain following.

The task is, basically, to ﬁnd the earliest hit of a

given ray when following that ray through a scene

composed of polygons or other objects.

A simple idea to avoid checking the ray against

all objects is to partition the universe into a regular

grid (see Figure 14). With each cell we store a list

of objects that occupy that cell (at least partially).

Then, we just walk along the ray from cell to cell,

and check the ray against all those objects that are

stored with that cell.

In this scheme (and others), we need a technique

called mailboxes that prevents us fromchecking the

ray twice against the same object:

38

every ray gets

a unique ID (we just increment a global variable

holding that ID whenever we start with a new ray);

during traversal, we store the ray’s ID with the ob-

ject whenever we have performed an intersection

test with it. But before doing an intersection test

with an object, we look into its mailbox whether or

not the current ray’s ID is already there; if so, then

Siggraph 2003 Tutorial 16

12 Zachmann/Langetepe: Geometric Data Structures for CG

Figure 14: Ray shooting can be implemented ef-

ﬁciently with an octree.

Figure 15: The same scenario utilizing an octree.

we know that we have already performed the inter-

section test in an earlier cell.

In the following, we will present two methods

that both utilize octrees to further reduce the num-

ber of objects considered.

2.5.1 3D Octree

A canonical way to improve any grid-based method

is to construct an octree (see Figure 15). Here, the

octree leaves store lists of objects (or, rather, point-

ers to objects). Since we are dealing now with poly-

gons and other graphical objects, the leaf rule for

the octree construction process must be changed

slightly:

1. maximum depth reached; or,

2. only one polygon/object occupies the cell.

We can try to better approximate the geometry of

the scene by changing the rule to stop only when

there are no objects in the cell (or the maximum

depth is reached).

How do we traverse an octree along a given ray?

Like in the case of a grid, we have to make “hori-

zontal” steps, which actually advance along the ray.

With octrees, though, we also need to make “verti-

cal” steps, which traverse the octree up or down.

All algorithms for ray shooting with octrees can

be classiﬁed into two classes:

• Bottom-up: this method starts at that leaf in the

octree that contains the origin of the ray; from

there it tries to ﬁnd that neighbor cell that is

stabbed next by the ray, etc.

• Top-down: this method starts at the root of the

octree, and tries to recurse down into exactly

those nodes and leaves that are stabbed by the

ray.

Here, we will describe a top-down method.

79

The

idea is to work only with the ray parameter in order

to decide which children of a node must be visited.

Let the ray be given by

x = p +t

d

and a voxel v by

[x

l

, x

h

] [y

l

, y

h

] [z

l

, z

h

]

In the following, we will describe the algorithm as-

suming that all d

i

> 0; later, we will show that the

algorithm works also for all other cases.

First of all, observe that if we already have the

line parameters of the intersection of the ray with

the borders of a cell, then it is trivial to compute the

line intervals half-way in between (see Figure 16):

t

m

α

=

1

2

(t

l

α

+t

h

α

) , α ∈ ¦x, y, z¦ (2)

So, for 8 children of a cell, we need to compute only

three new line parameters. Clearly, the line inter-

sects a cell if and only if max¦t

l

i

¦ < min¦t

h

j

¦.

The algorithm can be outlined as follows:

traverse( v, t

l

, t

h

)

compute t

m

determine order in which sub-cells are hit by the ray

for all sub-cells v

i

that are hit do

traverse( v

i

, t

l

[t

m

, t

m

[t

h

)

end for

where t

l

[t

m

means that we construct the lower bound-

ary for the respective cell by passing the appropri-

ate components from t

l

and t

m

.

Siggraph 2003 Tutorial 16

Zachmann/Langetepe: Geometric Data Structures for CG 13

t

h

x

t

l

x

t

l

y

t

m

x

t

m

y

t

h

y

t

m

y

> t

l

x

t

m

y

< t

l

x

Figure 16: Line parameters are trivial to compute

for children of a node.

Figure 17: The sub-cell that must be traversed ﬁrst

can be found by simple comparisons. Here, only

the case t

l

x

> t

l

y

is depicted.

In order to determine the order in which sub-

cells should be traversed, we ﬁrst need to determine

which sub-cell is being hit ﬁrst by the ray. In 2D,

this is accomplished by two comparisons (see Fig-

ure 17). Then, the comparison of t

m

x

with t

m

y

tells

us which cell is next.

In 3D, this takes a little bit more work, but is es-

sentially the same. First, we determine on which

side the ray has been entering the current cell by

Table 1.

Next, we determine the ﬁrst sub-cell to be vis-

ited by Table 2 (see Figure 18 for the numbering

scheme). The ﬁrst column is the entering side de-

termined in the ﬁrst step. The third column yields

the index of the ﬁrst sub-cell to be visited: start

with an index of zero; if one or both of the con-

ditions of the second column hold, then the corre-

sponding bit in the index as indicated by the third

column should be set.

Finally, we can traverse all sub-cells according to

Table 3, where “ex.” means the exit side of the ray

for the current sub-cell.

If the ray direction contains a negative compo-

nent(s), then we just have to mirror all tables along

the respective axis (axes) conceptually. This can be

implemented efﬁciently by an XOR operation.

2.5.2 5D Octree

In the previous, simple algorithm, we still walk

along a ray every time we shoot it into the scene.

However, rays are essentially static objects, just like

the geometry of the scene! This is the basic obser-

vation behind the following algorithm.

3,6

Again, it

0 4

6

3 7

5

2

x

y

z

Figure 18: Sub-cells are numbered according to

this scheme.

makes use of octrees to adaptively decompose the

problem.

The underlying technique is a discretization of

rays, which are 5-dimenional objects. Consider a

cube enclosing the unit sphere of all directions. We

can identify any ray’s direction with a point on

that cube, hence it is called direction cube (see Fig-

ure 19). The nice thing about it is that we can now

perform any hierarchical partitioning scheme that

works in the plane, such as an octree: we just apply

the scheme individually on each side.

Using the direction cube, we can establish a one-

to-one mapping between direction vectors and points

on all 6 sides of the cube, i.e.,

S

2

↔ [−1, +1]

2

¦+x, −x, +y, −y, +z, −z¦

We will denote the coordinates on the cube’s side

by u and v.

Siggraph 2003 Tutorial 16

14 Zachmann/Langetepe: Geometric Data Structures for CG

max¦t

l

i

¦ Side

t

l

x

YZ

t

l

y

XZ

t

l

z

XY

Side condition index bits

XY

t

m

z

< t

l

x

0

t

m

y

< t

l

x

1

XZ

t

m

x

< t

l

y

0

t

m

z

< t

l

y

2

YZ

t

m

y

< t

l

x

1

t

m

z

< t

l

x

2

current exit side

sub-cell YZ XZ XY

0 4 2 1

1 5 3 ex

2 6 ex 3

3 7 ex ex

4 ex 6 5

5 ex 7 ex

6 ex ex 7

7 ex ex ex

Table 1: Determines the enter-

ing side.

Table 2: Determines the ﬁrst

sub-cell.

Table 3: Determines the traver-

sal order of the sub-cells.

u

v

u

v

d

= +

Figure 19: With the direction cube, we can dis-

cretize directions, and organize them with any hi-

erarchical partitioning scheme.

Figure 20: A uv interval on the direction cube

plus a xyz interval in 3-space yield a beam.

Within a given universe B = [0, 1]

3

(we assume

it is a box), we can represent all possibly occurring

rays by points in

R = B [−1, +1]

2

¦+x, −x, +y, −y, +z, −z¦

(3)

which can be implemented conveniently by 6 copies

of 5-dimenional boxes.

Returning to our goal, we nowbuild six 5-dimen-

sional octrees as follows. Associate (conceptually)

all objects with the root. Partition a node in the

octree, if

1. there are too many objects associated with it;

and

2. the node’s cell is too large.

If a node is partitioned, we must also partition its

set of objects and assign each subset to one of the

children.

Observe that each node in the 5D octree deﬁnes a

beam in 3-space: the xyz-interval of the ﬁrst three

coordinates of the cell deﬁne a box in 3-space, and

the remaining two uv-intervals deﬁne a cone in 3-

space. Together (more precisely, their Minkowski

sum) they deﬁne a beam in 3-space that starts at

the cell’s box and extends in the general direction

of the cone (see Figure 20).

Since we have now deﬁned what a 5D cell of

the octree represents, it is almost trivial to deﬁne

how objects are assigned to sub-cells: we just com-

pare the bounding volume of each object against the

sub-cells 3D beam. Note that an object can be as-

signed to several sub-cells (just like in regular 3D

octrees). The test whether or not an object inter-

sects a beam could be simpliﬁed further by enclos-

ing a beam with a cone, and then checking the ob-

jects bounding sphere against that cone. This just

increases the number of false positives a little bit.

Having computed the six 5D octrees for a given

scene, ray tracing through that octree is almost

trivial: map the ray onto a 5D point via the direc-

tion cube; start with the root of that octree which

is associated to the side of the direction cube onto

which the ray was mapped; ﬁnd the leaf in that oc-

Siggraph 2003 Tutorial 16

Zachmann/Langetepe: Geometric Data Structures for CG 15

tree that contains the 5D point (i.e., the ray); check

the ray against all objects associated with that leaf.

By locating a leaf in one of the six 5D octrees,

we have discarded all objects that do not lie in the

general direction of the ray. But we can optimize

the algorithm even further.

First of all, we sort all objects associated with a

leaf along the dominant axis of the beam by their

minimum (see Figure 21). If the minimum coordi-

nate of an object along the dominant axis is greater

than the current intersection point, then we can

stop — all other possible intersection points are far-

ther away.

Second, we can utilize ray coherence as follows.

We maintain a cache for each level in the ray tree

that stores the leaves of the 5D octrees that were

visited last time. When following a new ray, we

ﬁrst look into the octree leaf in the cache whether

it is contained therein, before we start searching for

it from the root.

Another trick (that works with other ray acceler-

ation schemes as well) is to exploit the fact that we

do not need to know the ﬁrst occluder between a

point on a surface and a light source. Any occluder

sufﬁces to assert that the point is in shadow. So

we also keep a cache with each light source which

stores that object (or a small set) which has been an

occluder last time.

Finally, we would like to mention a memory op-

timization technique for 5D octrees, because they

can occupy a lot of memory. It is based on the ob-

servation that within a beam deﬁned by a leaf of the

octree the objects at the back (almost) never inter-

sect with a ray emanating from that cell (see Fig-

ure 22). So we store objects with a cell only if they

are within a certain distance. Should a ray not hit

any object, then we start a new intersection query

with another ray that has the same direction and a

starting point just behind that maximum distance.

Obviously, we have to make a trade-off between

space and speed here, but when chosen properly,

the cut-off distance should not reduce performance

too much while still saving a signiﬁcant amount of

memory.

3 BSP Trees

BSP trees (short for binary space partitioning trees)

can be viewed as a generalization of k-d trees. like

k-d trees, BSP trees are binary trees, but now the

orientation and position of a splitting plane can be

chosen arbitrarily. To get a feeling for a BSP tree,

Figure 23 shows an example for a set of objects.

The deﬁnition of a BSP (short for BSP tree) is

fairly straight-forward. Here, we will present a re-

cursive deﬁnition. Let h denote a plane in R

d

, h

+

and h

−

denote the positive and negative half-space,

resp.

Deﬁnition 1 (BSP tree)

Let S be a set of objects (points, polygons, groups

of polygons, or other spatial objects), and let S(ν)

denote the set of objects associated with a node ν.

Then the BSP T(S) is deﬁned by

1. If [S[ ≤ 1, then T is a leaf ν which stores S(ν) :=

S.

2. If [S[ > 1, then the root of T is a node ν; ν stores

a plane h

ν

and a set S(ν) := ¦x ∈ S[x ⊆ h

ν

¦

(this is the set of objects that lie completely

inside h

ν

; in 3D, these can only be polygons,

edges, or points). ν also has two children T

−

and T

+

; T

−

is the BSP for the set of objects

S

−

:= ¦x ∩ h

−

ν

[x ∈ S¦, and T

+

is the BSP for

the set of objects S

+

:= ¦x ∩ h

+

ν

[x ∈ S¦.

This can readily be turned into a general algorithm

for constructing BSPs. Note that a splitting step

(i.e., the construction of an inner node) requires us

to split each object into two disjoint fragments if it

straddles the splitting plane of that node. In some

applications though (such as ray shooting), this is

not really necessary; instead, we can just put those

objects into both subsets.

Note that with each node of the BSP a convex

cell is associated (which is possibly unbounded): the

“cell” associated with the root is the whole space,

which is convex; splitting a convex region into two

parts yields two convex regions. In Figure 23, the

convex region of one of the leaves has been high-

lighted as an example.

With BSPs, we have much more freedom to place

the splitting planes than with k-d trees. However,

this also makes that decision much harder (as al-

most always in life). If our input is a set of poly-

gons, then a very common approach is to choose

one of the polygons from the input set and use

this as the splitting plane. This is called an auto-

partition (see Figure 24).

While an auto-partition can have Ω(n

2

) frag-

ments, it is possible to showthe following in 2D.

23,75

Siggraph 2003 Tutorial 16

16 Zachmann/Langetepe: Geometric Data Structures for CG

1 2 3 4

Figure 21: By sorting objects with in each 5Dleaf,

we can often stop checking ray intersection quite

early.

Figure 22: By truncating the beam (or rather, the

list of objects) we can save a lot of memory usage

of a 5D octree, while reducing performance only

insigniﬁcantly.

h

3

h

4

h

2

h

1

h

4

h

2

h

1

h

3

Figure 23: An example BSP tree for a set of ob-

jects.

Figure 24: Left: an auto-partition. Right: an ex-

ample conﬁguration of which any auto-partition

must have quadratic size.

Lemma 1

Given a set S of n line segments in the plane, the

expected number of fragments in an auto-partition

T(S) is in O(n log n); it can be constructed in time

O(n

2

log n).

In higher dimensions, it is not possible to show

a similar result. In fact, one can construct sets of

polygons such that any BSP (not just auto-partitions)

must have Ω(n

2

) many fragments (see Figure 24

for a “bad” example for auto-partitions).

near

polygons

far

polygons

Figure 25: BSP trees are an efﬁcient data structure

encoding visibility order of a set of polygons.

However, all of these examples producing quadratic

BSPs violate the principle of locality: polygons are

small compared to the extent of the whole set. In

practice, no BSPs have been observed that exhibit

the worst-case quadratic behavior.

69

3.1 Rendering Without a Z-Buffer

BSP trees were introduced to computer graphics

by Fuchs et al.

36

At the time, hidden-surface re-

moval was still a major obstacle towards interactive

computer graphics, because a z-buffer was just too

costly in terms of memory.

In this section, we will describe how to solve this

problem, not so much because the application itself

is relevant today, but because it nicely exhibits one

of the fundamental “features” of BSP trees: they

Siggraph 2003 Tutorial 16

Zachmann/Langetepe: Geometric Data Structures for CG 17

enable efﬁcient enumeration of all polygons in vis-

ibility order from any point in any direction.

1

A simple algorithm to render a set of polygons

with correct hidden-surface removal, and without

a z-buffer, is the painter’s algorithm: render the

scene from back to front as seen from the current

viewpoint. Front polygons will just overwrite the

contents of the frame buffer, thus effectively hid-

ing the polygons in the back. There are polygon

conﬁgurations where this kind of sorting is not al-

ways possible, but we will deal with that later.

How can we efﬁciently obtain such a visibility or-

der of all polygons? Using BSP trees, this is al-

most trivial: starting from the root, ﬁrst traverse

the branch that does not contain the viewpoint,

then render the polygon stored with the node, then

traverse the other branch containing the viewpoint

(see Figure 25).

For sake of completeness, we would like to men-

tion a few strategies to optimize this algorithm.

First of all, we should make use of the viewing

direction by skipping BSP branches that lie com-

pletely behind the viewpoint.

Furthermore, we can perform back-face culling

as usual (which does not cause any extra costs). We

can also perform view-frustum culling by testing

all vertices of the frustum against the plane of a

BSP node.

Another problem with the simple algorithm is

that a pixel is potentially written to many times

(this is exactly the pixel complexity), although only

the last write “survives”. To remedy this, we must

traverse the BSP from front to back. But in order to

actually save work, we also need to maintain a 2D

BSP for the screen that allows us to quickly discard

those parts of a polygon that fall onto a screen area

that is already occupied. In that 2D screen BSP, we

mark all cells either “free” or “occupied”. Initially,

it consists only of a “free” root node. When a new

polygon is to be rendered, it is ﬁrst run through

the screen BSP, splitting it into smaller and smaller

convex parts until it reaches the leaves. If a part

reaches a leaf that is already occupied, nothing hap-

pens; if it reaches a free leaf, then it is inserted be-

neath that leaf, and this part is drawn on the screen.

1

Actually, the ﬁrst version of Doom used exactly this algorithm

to achieve its fantastic frame rate (at the time) on PCs even with-

out any graphics accelerator.

3

out

out

out

out

out

in

in

6

7

4

2

1 in

5

2 3

1

6

in out

out

5 4

7

in out out

in out

Figure 26: Each leaf cell of BSP representation

of an object is completely inside or completely

outside.

A B

∩

∪

`

Figure 27: Using BSPs, we can efﬁciently com-

pute these boolean operations on solids.

3.2 Representing Objects with BSPs

BSPs offer a nice way to represent volumetric polyg-

onal objects, which are objects consisting of poly-

gons that are closed, i.e., they have an “inside” and

an “outside”. Such a BSP representation of an ob-

ject is just like an ordinary BSP for the set of poly-

gons (we can, for instance, build an auto-partition),

except that here we stop the construction process

(see Deﬁnition 1) only when the set is empty. These

leaves represent homogeneous convex cells of the

space partition, i.e., they are completely “in” our

“out”.

Figure 26 shows an example for such a BSP rep-

resentation. In this section, we will follow the con-

vention that normals point to the “outside”, and

that the right child of a BSP node lies in the positive

half-space and the left child in the negative half-

space. So, in a real implementation that adheres to

these conventions, we can still stop the construction

when only one polygon is left, because we know

that the left child of such a pseudo-leaf will be “in”

and the right one will be “out”.

Given such a representation, it is very easy and

efﬁcient, for instance, to determine whether or not

a given a point is inside an object. In the next sec-

tion, we will describe an algorithm for solving a

slightly more difﬁcult problem.

Siggraph 2003 Tutorial 16

18 Zachmann/Langetepe: Geometric Data Structures for CG

T

H

Figure 28: The fundamental step of the construc-

tion is this simple operation, which merges a BSP

and a plane.

R(T)

"leaf"

H

T

p

T

"anti-parallel on"

p

T

"pos./pos."

H

T

P

H

T

"mixed"

H

H

H

Figure 29: The main building block of the algo-

rithm consists of these four cases (plus analogous

ones).

+ → →

Figure 30: Computation of boolean operations is

based on a general merge operation.

3.3 Boolean Operations

In solid modeling, a very frequent task is to com-

pute the intersection or union of a pair of objects.

More generally, given two objects A and B, we want

to compute C := A op B, where op ∈ ¦∪, ∩, `, ¦

(see Figure 27). This can be computed efﬁciently

using the BSP representation of objects.

68,69

Fur-

thermore, the algorithm is almost the same for all

of these operations: only the elementary step that

processes two leaves of the BSPs is different.

We will present the algorithm for boolean oper-

ations bottom-up in three steps. The ﬁrst step is

a sub-procedure for computing the following sim-

ple operation: given a BSP T and a plane H, con-

struct a new BSP

ˆ

T whose root is H, such that

ˆ

T

−

T ∩ H

−

,

ˆ

T

+

T ∩ H

+

(see Figure 28).

This basically splits a BSP tree by a plane and then

puts that plane at the root of the two halves. Since

we will not need the new tree

ˆ

T explicitly, we will

describe only the splitting procedure (which is the

bulk of the work anyway).

First, we need to deﬁne some nomenclature:

T

−

, T

+

= left and right child of T, resp.

R(T) = region of the cell of node T (which is convex)

T

⊕

, T

**=portion of T on the posi-
**

tive/negative side of H, resp.

Finally, we would like to deﬁne a node T by the

tuple (H

T

, p

T

, T

−

, T

+

), where H is the splitting

plane, p is the polygon associated with T (with

p ⊂ H).

The pseudo-code below is organized into 8 cases,

of which the code details 4 (see Figure 29):

split-tree( T, H, P ) → (T

, T

⊕

)

¦P = H ∩ R(T)¦

case T is a leaf :

return (T

, T

⊕

) ← (T, T)

case “anti-parallel” and “on” :

return (T

, T

⊕

) ← (T

+

, T

−

)

case “pos./pos.” :

(T

+

, T

+⊕

) ← split-tree(T

+

, H)

T

← (H

T

, p

T

, T

−

, T

+

)

T

⊕

← T

+⊕

case “mixed” :

(T

+

, T

+⊕

) ← split-tree(T

+

, H, P ∩ R(T

+

))

(T

−

, T

−⊕

) ← split-tree(T

−

, H, P ∩ R(T

−

))

T

← (H

T

, p

T

∩ H

−

, T

−

, T

+

)

T

⊕

← (H

T

, p

T

∩ H

+

, T

−⊕

, T

+⊕

)

return (T

, T

⊕

)

end case

This might look a little bit confusing at ﬁrst sight,

but it is really pretty simple. A few notes might be

in order.

The polygon P is only needed in order to ﬁnd

the case applying at each recursion. Computing

P ∩ R(T

+

) might seem very expensive. However,

it can be computed quite efﬁciently by computing

P∩ H

+

T

, which basically amounts to ﬁnding the two

edges that intersect with H

T

. Please see Chin

18

for

more details on how to detect the correct case.

It seems surprising at ﬁrst sight that function

split-tree does almost no work — it just tra-

verses the BSP tree, classiﬁes the case found at each

recursion, and computes p ∩ H

+

and p ∩ H

−

.

The previous algorithmis already the main build-

ing block of the overall boolean operation algo-

rithm. The next step towards that end is an al-

gorithm that performs a so-called merge operation

on two BSP trees T

1

and T

2

. Let (

i

denote the set

of elementary cells of a BSP, i.e., all regions R(L

j

)

Siggraph 2003 Tutorial 16

Zachmann/Langetepe: Geometric Data Structures for CG 19

split

merge merge

combine

Figure 31: A graphical depiction of the merge step in the algorithm for boolean operations on objects

represented by BSP trees.

of tree T

i

where L

j

are all the leaves. Then the

merge of T

1

, T

2

yields a new BSP tree T

3

such that

(

3

= ¦c

1

∩ c

2

[c

1

∈ (

1

, c

2

∈ (

2

, c

1

∩ c

2

= ∅¦ (see

Figure 30).

The merge operation consists of two cases. The

ﬁrst, almost trivial, case occurs when one of the two

operands is a leaf: then at least one of the two re-

gions is homogenous, i.e., completely inside or out-

side. In the other case, both trees are inhomoge-

nous over the same region of space: then, we just

split one of the two with the splitting plane from

the root of the other, and we obtain two pairs of

BPSs, that are smaller, and still cover the same re-

gions in space; those two pairs can be merged recur-

sively (see Figure 31). The following pseudo-code

describes this recursive procedure more formally:

merge( T

1

, T

2

) → T

3

if T

1

or T

2

is a leaf then

perform the cell-op as required by the boolean op-

eration to be constructed (see below)

else

(T

2

, T

⊕

2

) ← split-tree(T

2

, H

1

, . . .)

T

−

3

← merge(T

−

1

, T

2

)

T

+

3

← merge(T

+

1

, T

⊕

2

)

T

3

← (H

1

, T

−

3

, T

+

3

)

end if

The function cell-op is the only place where the

semantic of the general merge operation is special-

ized. When we have reached that point, then we

know that one of the two cells is homogeneous, so

we can just replace it by the other node’s sub-tree

suitably modiﬁed according to the boolean opera-

tion. The following table lists the details of this

function (assuming that T

1

is the leaf):

Operation T

1

Result

∪

in T

1

out T

2

∩

in T

2

out T

1

`

in T

c

2

out T

1

in T

c

2

out T

2

Furthermore, we would like to point out that the

merge function is symmetric: it does not matter

whether we partition T

2

with H

1

or, the other way

round, T

1

with H

2

— the result will be the same.

3.4 Construction Heuristics

One can prove that in general, auto-partitions have

the same complexity as other partitionings.

23,75

In

addition, it has been proven that “fat” objects (i.e.,

objects with bounded aspect ration) and “unclut-

tered” scenes admit a BSP with linear size.

21,22

However, for practical applications, the “hidden”

constants do matter. So, the construction strategy

should produce “good” BSPs. Depending on the ap-

plication itself, however, the deﬁnition of exactly

what a “good” BSP tree is can be quite different.

Basically, there are two kinds of applications:

• Classiﬁcation: These are applications where the

BSP is used to determine the inside/outside sta-

tus of a point, or whether or not a line intersects

with an object.

Siggraph 2003 Tutorial 16

20 Zachmann/Langetepe: Geometric Data Structures for CG

In this case, we try to optimize the balancedness

of the BSP.

• Visibility: These are applications where the BSP

is used to sort the polygons in “visibility order”

such as rendering without z-buffer.

Consequently, we try to minimize the number

of splits, i.e., the size of the BSP.

3.4.1 Convex objects

As an example, consider an convex object. In that

caese, an auto-partition has size O(n), takes time

O(n

2

) to construct, and is a linear tree. This does

not seem to be a very smart BSP (although it is per-

fectly suitable for visibility ordering).

If we allow arbitrary splitting planes, then we

can balance the BSP much better. The construction

time will be

T(n) = n + 2T(

n

2

+ αn) ∈ O(n

1+δ

) , 0 < α <

n

2

where α is the fraction of polygons that are split

at each node. The following table shows the actual

complexities for some values of α:

α 0.05 0.2 0.4

n

1.15

n

2

n

7

As mentioned above, the question now is how to

choose the splitting planes. We propose the fol-

lowing simple heuristic:

2

Compute a representative

vertex for each polygon (barycenter, bbox center,

etc.). Determine a plane, such that on both sides

are about the same number of points, and such that

all points are far away from the plane (obviously,

this is an optimization).

3.4.2 Cost driven heuristic

In order to derive construction criteria, obviously,

one needs to deﬁne the quality of a BSP. An abstract

measure is the cost of a BSP T

C(T) = 1 + P(T

−

)C(T

−

) + P(T

+

)C(T

+

) (4)

where P(T

−

) is the probability that the left subtree

T

−

will be visited under the condition that the tree

2

For the case of convex objects, a heuristic has already been pro-

posed by.

87

However, we believe that their heuristic has some

ﬂaws.

T has been visited (dito for P(T

+

)). This probabil-

ity depends, of course, on the application the BSP

is going to be used for. For instance, in the case of

inside/outside queries

P(T

−

) =

Vol(T

−

)

Vol(T)

Obviously, trying to optimize Equation 4 globally

is prohibitively expensive. Therefore, a local heuris-

tic must be employed to guide the splitting process.

A simple heuristic is the following:

69

estimate the

cost of the subtrees by the number of polygons, and

add a penalty for polygons that are split by the cur-

rent node, so that

C(T) = 1 +[S

−

[

α

+[S

+

[

α

+ βs (5)

where S is the set of polygons associated with a

node, s the set of polygons split by a node, and

α, β are two parameters that can be used to make

the BSP more balanced or smaller. (

69

reports that

α = 0.8, . . . , 0.95 and β =

1

4

, . . . ,

3

4

are usually

good values to start from.) Again, this is yields an

optimization process, but now it only a local pro-

cess.

If the BSP is to be an auto-partition, then a very

quick approximization of the local optimum yields

very good results: just sort the polygons according

to their size and evaluate Equation 5 for the ﬁrst k

polygons. Then, choose the one that produces the

least costly BSP (subtree), the rationale being that

the probability that a polygon gets split is propor-

tional to its size, so we try to get rid of them as

early as possible.

An even simpler heuristic was proposed by.

36

Randomly choose k polygons from S and select the

one that produces the least number of splits. They

report that k = 5 yielded near-optimal BSPs (for

visibility ordering).

3.4.3 Non-uniform queries

In the previous section, we assumed that all queries

are uniformly distributed over a certain domain.

This is a valid assumption if nothing is known

about the distribution. On the other hand, if we

know more about it, then we should make use

of this and construct the BSP such that frequent

queries can be answered most quickly.

3

3

The same principle is underlying the Huffman encoding scheme.

Siggraph 2003 Tutorial 16

Zachmann/Langetepe: Geometric Data Structures for CG 21

Indeed, quite often we knowmore about the queries.

For instance, in ray tracing, the starting points are

usually not uniformly distributed in space; for in-

stance, they usually do not emanate from the inte-

rior of objects. Also, the prominent polygons of an

object are hit more frequently than those that are

within cavities or completely inside.

According to,

1

we can estimate the costs of a

query by

C(query) = # nodes visited

≤ depth(BSP) # stabbed leaf cells

So, according to this, we should minimize the num-

ber of stabbed leaf cells before a polygon hit occurs.

The factors inﬂuencing the probability that a ray

hits a polygon are

1. If the angle between a ray and a polygon is large,

then the probability is large.

2. If the polygon is large (relative to the total size

of the object/universe), then the probability is

large.

3. . . .

Let ω(l) denote the density of all rays l over some

domain D; this could be measured, or it could be

derived fromthe geometry. Let S be the set of poly-

gons over which the BSP is to be built. Assign to

each polygon p a score

score(p) =

D

w(S, p, l)ω(l)dl

where the weight w is deﬁned as

w(S, p, l) = sin

2

(n

p

, r

l

)

Area(p)

Area(S)

and n

p

is the normal of p and r

l

is the direction of

l.

So the algorithm for constructing a BSP adapted

to a given distribution is the following random-

ized greedy strategy: sort all polygons according to

score(p); choose randomly one out of the “top k“

and split the set S. Thus, polygons with a higher

probability of getting hit by the ray tend to end up

higher in the tree.

The BSP thus constructed has been named cus-

tomized BSP by.

1

The authors report that it usu-

ally has about 2 as many polygons as its “obliv-

ious” version, but the queries have to visit only

2 −−10 less polygons.

3.4.4 Deferred, self-organizing BSPs

Now, what should we do if we just don’t know the

query distribution, or if it is too expensive to mea-

sure it by experiments? The answer is, of course,

to defer the complete construction of the BSP, in

other words, we only build as much of the BSP that

is absolutely necessary. In addition, we keep a his-

tory (in some form) of all the queries we have seen

so far, so whenever we have to build a new part of

the BSP we base the construction on that history

(as a best guess of the probability distribution of all

queries to come).

2

As an example, let us consider the problem of de-

tecting intersections between a 3-dim. line segment

and a set of polygons.

4

Since a BSP is now no longer completely con-

structed before we use it, the nodes must store ad-

ditional information:

1. the polygon P deﬁning the splitting plane; or, if

it is a preliminary leaf,

2. a list L ⊆ S of polygons associated with it, for

which the subtree has not been built yet.

The algorithm for answering queries with a ray R

now also triggers the construction of the BSP:

testray(R,ν)

if ν is a leaf then

for all P ∈ L

ν

do

if R intersects P then

return hit

end if

end for

else

ν

1

←child of ν that contains startpoint of R

ν

2

←other child

testray(R,ν

1

)

if no hit in ν

1

then

testray(R,ν

2

)

end if

end if

Since the line segment is ﬁnite (in particular, if it is

short), this algorithmcan usually stop much earlier,

but the details have been omitted here.

The initial BPS is just one node (the root) with

L = S, i.e., all polygons of the object or scene.

Now we need to ﬁll in the open issues, namely:

4

Sometimes, this is also called “collision detection”, in particular

in the game programming industry, because we are only inter-

ested in a yes/no answer, while in ray tracing we want to deter-

mine the earliest intersection.

Siggraph 2003 Tutorial 16

22 Zachmann/Langetepe: Geometric Data Structures for CG

1. when do we split a preliminary leaf? (and which

one?)

2. how do we split?

For the “when” question: we keep an access counter

per node, which gets incremented every time that

node is traversed during a query. Whenever one

of the counters is over a certain threshold, then we

split that node (leaf). The threshold can be an abso-

lute value or relative to the sum of all counters.

For the “how” question: we keep a counter per

polygon P ∈ L

ν

, which is incremented every time

an intersection with P is found. We sort L

ν

accord-

ing to this counter; this can be done incrementally

whenever one of the counters changes. If a split is

to be performed for ν, then we use the ﬁrst polygon

from L

ν

as the splitting plane.

It turns out that many polygons are never hit by

a line segment. Therefore, with this algorithm, a

BSP subtree will never be “wasted” on these poly-

gons, and they will be stored at the end of the lists

at the leaves.

There are other ways to organize the polygon

lists at the leaves: move the polygon currently be-

ing hit to the front of the list; or, swap it with the

one in front of it. However, according to,

2

the strat-

egy that sorts the list seemed to work best.

According to,

2

the performance gain in their ex-

periments was a factor of about 2–20.

4 Bounding Volume

Hierarchies

Like the previous hierarchical data structures, bound-

ing volume hierarchies (BVHs) are mostly used to

prevent performing an operation exhaustively on

all objects. Like with previously discussed hier-

archical data structures, one can improve a huge

range of applications and queries using BVHs, such

as ray shooting, point location queries, nearest-

neighbor search, viewfrustumand occlusion culling,

geographical data bases, and collision detection (the

latter will be discussed in more detail below).

Often times, bounding volume (BV) hierarchies

are described as the opposite of spatial partitioning

schemes, such as quadtrees or BSP trees: instead of

partitioning space, the idea is to partition the set

of objects recursively until some leaf criterion is

convex hull

AABB sphere

DOP OBB

spherical shell

prism cylinder intersection

of other BVs

Figure 32: Some of the most commonly used BVs,

and some less often used ones.

met.

5

Here, objects can be anything from points

to complete graphical objects. With BV hierarchies,

almost all queries, which can be implemented with

space partitioning schemes, can also be answered,

too. Example queries and operations are ray shoot-

ing, frustum culling, occlusion culling, point loca-

tion, nearest neighbor, collision detection.

Deﬁnition 2 (BV hierarchy)

Let O = ¦o

1

, . . . , o

n

¦ be a set of elementary objects.

A bounding volume hierarchy for O, BVH(O), is

deﬁned by

1. If [O[ = e, then BVH(O) := a leaf node that

stores O and a BV of O;

2. If [O[ > e, then BVH(O) := a node ν with

n(ν) children ν

1

, . . . , ν

n

, where each child ν

i

is a

BV hierarchy BVH(O

i

) over a subset O

i

⊂ O,

such that

¸

O

i

= O. In addition, ν stores a BV

of O.

The deﬁnition mentions two parameters. The

threshold e is often set to 1, but depending on the

application, the optimal e can be much larger. Just

like sorting, when the set of objects is small, it is

often cheaper to perform the operation on all of

them, because recursive algorithms always incur

some overhead.

Another parameter in the deﬁnition is the arity.

Mostly, BV hierarchies are constructed as binary

trees, but again, the optimum can be larger. And

what is more, as the deﬁnition suggests, the out-

degree of nodes in a BV hierarchy does not neces-

sarily have to be constant, although this often sim-

pliﬁes implementations considerably.

Effectively, these two parameters, e and n(ν),

control the balance between linear search/operation

5

However, we will argue at the end that BV hierarchies are just at

the other end of a whole spectrumof hierarchical data structures.

Siggraph 2003 Tutorial 16

Zachmann/Langetepe: Geometric Data Structures for CG 23

(which is exhaustive), and a maximally recursive

algorithm.

There are more design choices possible according

to the deﬁnition. For inner nodes, it only requires

that

¸

O

i

= O; this means, that the same object

o ∈ O could be associated with several children.

Depending on the application, the type of BVs, and

the construction process, this may not always be

avoidable. But if possible, you should always split

the set of objects into disjoint subsets.

Finally, there is, at least, one more design choice:

the type of BV used at each node. Again, this

does not necessarily mean that each node uses the

same type of BV. Figure 32 shows a number of the

most commonly used BVs. The difference between

OBBs

6

and AABBs is that OBBs can be oriented ar-

bitrarily (hence “oriented bounding boxes”).

DOPs

53,57,99

are a generalization of AABBs: basi-

cally, they are the intersection of k slabs. Prisms

and cylinders have been proposed by Barequet et

al.

9

and Weghorst et al.,

94

but they seem to be too

expensive computationally. A spherical shell is the

intersection of a shell and a cone (the cone’s apex

coincides with the sphere’s center), and a shell is

the space between two concentric spheres. Finally,

one can always take the intersection of two or more

different types of BVs.

52

There are three characteristic properties of BVs:

• tightness,

• memory usage,

• number of operations needed to test the query

object against a BV.

Often, one has to make a trade-off between these

properties: generally, the type of BV that offers

better tightness also requires more operations per

query and more memory.

Regarding the tightness, one can establish a the-

oretical advantage of OBBs. But ﬁrst, we need to

deﬁne tightness.

40

Deﬁnition 3 (Tightness by Hausdorff distance)

Let B be a BV, G some geometry bounded by B, i.e.,

g ⊂ B. Let

h(B, G) = max

b∈B

min

g∈G

d(b, g)

be the directed Hausdorff distance, i.e., the maxi-

mum distance of B to the nearest point in G. (Here,

d is any metric, very often just the Euclidean dis-

tance.) Let

diam(G) = max

g, f ∈G

d(g, f )

be the diameter of G.

Then we can deﬁne tightness

τ :=

h(B, G)

diam(G)

.

See Figure 33 for an illustration.

Since the Hausdorff distance is very sensitive to

outliers, one could also think of other deﬁnitions

such as the following one:

Deﬁnition 4 (Tightness by volume)

Let C(ν) b the set of children of a node ν of the

BV hierarchy. Let Vol(ν) be the volume of the BV

stored with ν.

Then, we can deﬁne the tightness as

τ :=

Vol(ν)

∑

ν

/

∈C(ν)

Vol(ν

/

)

.

Alternatively, we can deﬁne it as

τ :=

Vol(ν)

∑

ν

/

∈L(ν)

Vol(ν

/

)

,

where L(ν) is the set of leaves beneath ν.

Getting back to the tightness deﬁnition based on

the Hausdorff distance, we observe a fundamental

difference between AABBs and OBBs:

40

• The tightness of AABBs depends on the orien-

tation of the enclosed geometry. What is worse

is that the tightness of the children of an AABB

enclosing a surface of small curvature is almost

the same as that of the father.

The worst case is depicted in Figure 34. The

tightness of the father is τ =

h

/d, while the

tightness of a child is τ

/

=

h

/

d/2

=

h/2

d/2

= τ.

• The tightness of OBBs does not depend on the

orientation of the enclosed geometry. Instead,

it depends on its curvature, and it decreases ap-

proximately linearly with the depth in the hier-

archy.

Figure 35 depicts the situation for a sphere. The

Hausdorff distance from an OBB to an enclosed

Siggraph 2003 Tutorial 16

24 Zachmann/Langetepe: Geometric Data Structures for CG

diam(G)

B

G

h(B, G)

d

h

h

/

φ

Œ

/2

h

d

Figure 33: One way to de-

ﬁne tightness is via the directed

Hausdorff distance.

Figure 34: The tightness of an

AABB remains more or less

constant throughout the levels

of a AABB hierarchy for surfaces

of small curvature.

Figure 35: The tightness of an

OBB decreases for deeper lev-

els in a OBB hierarchy for small

curvature surfaces.

spherical arc is h = r(1 − cos φ), while the di-

ameter of the arc is d = 2r sin φ. Thus, the

tightness for an OBB bounding a spherical arc

of degree φ is τ =

1−cos φ

2 sin φ

, which approaches 0

linearly as φ → 0.

This makes OBBs seem much more attractive

than AABBs. The price of the much improved

tightness is, of course, the higher computational ef-

fort needed for most queries per node when travers-

ing an OBB tree with a query.

4.1 Construction of BV Hierarchies

Essentially, there are 3 strategies to build BV trees:

• bottom-up,

• top-down,

• insertion

From a theoretical point of view, one could pursue

a simple top-down strategy, which just splits the

set of objects into two equally sized parts, where

the objects are assigned randomly to either subset.

Asymptotically, this usually yields the same query

time as any other strategy. However, in practice,

the query times offered by such a BV hierarchy are

by a large factor worse.

During construction of a BV hierarchy, it is con-

venient to forget about the graphical objects or

primitives, and instead deal with their BVs and

consider those as the atoms. Sometimes, another

simpliﬁcation is to just approximate each object by

its center (baryenter or bounding box center), and

then deal only with sets of points during the con-

struction. Of course, when the BVs are ﬁnally com-

puted for the nodes, then the true extents of the

objects must be considered.

In the following we will describe algorithms for

each construction strategy.

4.1.1 Bottom-up

In this class, we will actually describe two algo-

rithms.

Let B be the set of BVs on the top-most level of

the BVhierarchy that has been constructed so far.

80

For each b

i

∈ B ﬁnd the nearest neighbor b

/

i

∈ B;

let d

i

be the distance between b

i

and b

/

i

. Sort B with

respect to d

i

. Then, combine the ﬁrst k nodes in B

under a common father; do the same with the next

k elements from B, etc. This yields a new set B

/

,

and the process is repeated.

Note that this strategy does not necessarily pro-

duce BVs with a small “dead space”: in Figure 36,

the strategy would choose to combine the left pair

(distance = 0), while choosing the right pair would

result in much less dead space.

The second strategy is less greedy in that it com-

putes a tiling for each level. We will describe it

ﬁrst in 2D.

62

Again, let B be the set of BVs on the

top-most level so far constructed, with [B[ = n.

Siggraph 2003 Tutorial 16

Zachmann/Langetepe: Geometric Data Structures for CG 25

Figure 36: A simple greedy strategy can produce

much “dead space”.

Figure 37: A less greedy strategy combines BVs

by computing a “tiling”.

The algorithm ﬁrst computes the center c

i

for each

b

i

∈ B. Then, it sorts B along the x-axis with re-

spect to c

i

x

. Now, the set B is split into

√

n

/k vertical

“slices” (again with respect to c

i

x

). Now, each slice

is sorted according to c

i

y

and subsequently split into

√

n

/k “tiles”, so that we end up with k tiles (see

Figure 37). Finally, all nodes in a tile are combined

under one common father, its BV is combined, and

the process repeats with a new set B

/

.

In R

d

it works quite similarly: we just split each

slice repeatedly by

d

√

n

/k along all coordinate axes.

4.1.2 Insertion

This construction scheme starts with an empty tree.

Let B be the set of elementary BVs. The following

pseudo-code describes the general procedure:

1: while [B[ > 0 do

2: choose next b ∈ B

3: ν := root

4: while ν = leaf do

5: choose child ν

/

,

so that insertion of b into ν

/

causes minimal

increase in the costs of the total tree

6: ν := ν

/

7: end while

8: end while

All insertion algorithms only vary step 2 and/or 5.

Step 2 is important because a “bad” choice in the

beginning can probably never be made right after-

wards. Step 5 depends on the type of query that is

to be performed on the BV tree. See below for a few

criteria.

Usually, algorithms in this class have complexity

O(n log n).

4.1.3 Top-down

This scheme is the most popular one. It seems to

produce very good hierarchies while still being very

efﬁcient, and usually it can be implemented easily.

The general idea is to start with the complete set

of elementary BVs, split that into k parts, and cre-

ate a BV tree for each part recursively. The splitting

is guided by some heuristic or criterion that (hope-

fully) produces good hierarchies.

4.1.4 Construction criteria

In the literature, there is a vast number of crite-

ria for guiding the splitting, insertion, or merging,

during BV tree construction. (Often, the authors

endow the thus constructed BV hierarchy with a

new name, even though the BVs utilized are well

known.) Obviously, the criterion depends on the

application for which the BV tree is to be used. In

the following, we will present a few of these crite-

ria.

For ray tracing, if we can estimate the probabil-

ity that a ray will hit a child box when it has hit the

father box, then we know how likely it is, that we

need to visit the child node when we have visited

the father node. Let us assume that all rays em-

anate from the same origin (see Figure 38). Then,

Siggraph 2003 Tutorial 16

26 Zachmann/Langetepe: Geometric Data Structures for CG

ν

ν

/

θ

ν

/

θ

ν

Figure 38: The probability of a ray hitting a child

box can be extimated by the surface area.

we can observe that the probability that a ray s hits

a child box ν

/

under the condition that it has hit the

father box ν is

P(s hits ν

/

[s hits ν) =

θ

ν

/

θ

ν

≈

Area(ν

/

)

Area(ν)

(6)

where Area denotes the surface area of the BV, and

θ denotes the solid angle subtended by the BV. This

is because for a convex object, the solid angle sub-

tended by it, when seen from large distances, is ap-

proximately proportional to its surface area.

39

So, a

simple strategy is to just minimize the surface area

of the BVs of the children that are produced by a

split.

6

A more elaborate criterion tries to establish a cost

function for a split and minimize that. For ray trac-

ing, this cost function can be approximated by

C(ν

1

, ν

2

) =

Area(ν

1

)

Area(ν)

C(ν

1

) +

Area(ν

2

)

Area(ν)

C(ν

2

)

(7)

where ν

1

, ν

2

are the children of ν. The optimal split

B = B

1

∪ B

2

minimizes this cost function:

C(B

1

, B

2

) = min

B

/

∈{(B)

C(B

/

, B ` B

/

)

where B

1

, B

2

are the subsets of elementary BVs (or

objects) assigned to the children. Here, we have as-

sumed a binary tree, but this can be extended to

other arities analogously.

Of course, such a minimization is too expensive

in practice, in particular, because of the recursive

deﬁnition of the cost function. So, Fussell and Sub-

ramanian,

37

Müller et al.,

67

and Beckmann et al.

10

have proposed the following approximation algo-

rithm:

6

For the insertion scheme, the strategy is to choose that child

node whose area is increased least.

39

for α = x, y, z do

sort B along axis α with respect to the BV centers

ﬁnd

k

α

= min

j=0...n

Area(b

1

, . . . , b

j

)

Area(B)

j +

Area(b

j+1

, . . . , b

n

)

Area(B)

(n − j)

end for

choose the best k

α

where Area(b

1

, . . . , b

j

) denotes the surface area of

the BV enclosing b

1

, . . . , b

j

.

If the query is a point location query (e.g., is a

given point inside or outside the object), then the

volume instead of the surface area should be used.

This is because the probability that a point is con-

tained in a child BV, under the condition that it is

contained in the father BV, is proportional to the

ratio of the two volumes.

For range queries, and for collision detection, the

volume seems to be a good probability estimation,

too.

A quite different splitting algorithm does not

(explicitely) try to estimate any probabilities. It

just approximates each elementary BV/object by

its center point. It then proceeds as follows. For

a given set B of such points, compute its princi-

pal components (the Eigenvectors of the covariance

matrix); choose the largest of them (i.e., the one ex-

hibiting the largest variance); place a plane orthog-

onal to that principal axis and through the barycen-

ter of all points in B; ﬁnally, split B into two sub-

sets according to the side on which the point lies.

(This description is a slightly modiﬁed version of

Gottschalk et al.

40

) Alternatively, one can place the

splitting plane through the median of all points, in-

stead of the barycenter. This would lead to balanced

trees, but not necessarily better ones.

4.1.5 The criterion for collision detection

In the following, we will describe a general cri-

terion that can guide the splitting process of top-

down BV hierarchy construction algorithms, such

that the hierarchy produced is good in the sense of

fast collision detection

100

(see Section 4.2).

Let C(A, B) be the expected costs of a node pair

(A, B) under the condition that we have already de-

termined during collision detection that we need to

traverse the hierarchies further down. Assuming

Siggraph 2003 Tutorial 16

Zachmann/Langetepe: Geometric Data Structures for CG 27

B

1

d

B

A

1

A

possible

locus of

anchor points

d

Figure 39: By estimating the volume of the

Minkowski sum of two BVs, we can derive an es-

timate for the cost of the split of a set of polygons

associated with a node.

binary trees and unit costs for an overlap test, this

can be expressed by

C(A, B) = 4 +

∑

i,j=1,2

P(A

i

, B

j

) C(A

i

, B

j

) (8)

where A

i

, B

j

are the children of A and B, resp., and

P(A

i

, B

j

) is the probability that this pair must be

visited (under the condition that the pair (A, B) has

been visited).

An optimal construction algorithm would need

to expand (8) down to the leaves:

C(A, B) =P(A

1

, B

1

) + P(A

1

, B

1

)P(A

11

, B

11

)

+ P(A

1

, B

1

)P(A

12

, B

11

) + . . . +

P(A

1

, B

2

) + P(A

1

, B

2

)P(A

11

, B

21

)

+ . . .

(9)

and then ﬁnd the minimum. Since we are inter-

ested in ﬁnding a local criterion, we approximate

the cost function by discarding the terms corre-

sponding to lower levels in the hierarchy, which

gives

C(A, B) ≈ 4

1 + P(A

1

, B

1

) + . . .

+ P(A

2

, B

2

)

(10)

Now we will derive an estimate of the probability

P(A

1

, B

1

). For sake of simplicity, we will assume in

the following that AABBs are used as BVs. How-

ever, similar arguments should hold for all other

kinds of convex BVs.

The event of box A intersecting box B is equiva-

lent to the condition that B’s “anchor point” is con-

tained in the Minkowski sum A ⊕ B. This situa-

tion is depicted in Figure 39.

7

Because B

1

is a child

of B, we know that the anchor point of B

1

must

lie somewhere in the Minkowski sum A ⊕ B ⊕ d,

where d = anchor(B

1

) −anchor(B). Since A

1

is

inside A and B

1

inside B, we know that A

1

⊕ B

1

⊂

A ⊕ B ⊕d. So, for arbitrary convex BVs the prob-

ability of overlap is

P(A

1

, B

1

) =

Vol(A

1

⊕ B

1

)

Vol(A ⊕ B ⊕d)

=

Vol(A

1

⊕ B

1

)

Vol(A ⊕ B)

(11)

In the case of AABBs, it is safe to assume that

the aspect ratio of all BVs is bounded by α. Conse-

quently, we can bound the volume of the Minkowski

sum by

Vol(A) + Vol(B) +

2

α

Vol(A) Vol(B) ≤

Vol(A ⊕ B) ≤

Vol(A) + Vol(B) + 2α

Vol(A) Vol(B) (12)

So we can estimate the volume of the Minkowski

sum of two boxes by

Vol(A ⊕ B) ≈ 2(Vol(A) + Vol(B))

yielding

P(A

1

, B

1

) ≈

Vol(A

1

) + Vol(B

1

)

Vol(A) + Vol(B)

(13)

Since Vol(A) + Vol(B) has already been com-

mitted by an earlier step in the recursive construc-

tion, Equation 10 can be minimized only by min-

imizing Vol(A

1

) + Vol(B

1

). This is our criterion

for constructing restricted boxtrees.

Construction algorithm. According to the cri-

terion derived above, each recursion step will try

to split the set of polygons so that the cost func-

tion (10) is minimized. This is done by trying to

ﬁnd a good splitting for each of the three coordinate

7

In the ﬁgure, we have chosen the lower left corner of B as

its anchor point, but this is arbitrary, of course, because the

Minkowski sum is invariant under translation.

Siggraph 2003 Tutorial 16

28 Zachmann/Langetepe: Geometric Data Structures for CG

axes, and then selecting the best one. Along each

axis, we consider three cases: both subsets form

lower boxes with respect to its parent, both are up-

per boxes, or one upper and one lower box.

In each case, we ﬁrst try to ﬁnd a good “seed”

polygon for each of the two subsets, which is as

close as possible to the outer border that is perpen-

dicular to the splitting axis. Then, in a second pass,

we consider each polygon in turn, and assign it to

that subset whose volume is increased least. In or-

der to prevent “creeping greediness”,

8

we run alter-

natingly through the array of polygons. After good

splitting candidates have been obtained for all three

axes, we just pick the one with least total volume of

the subsets.

The algorithmand criterion we propose here could

also be applied to construct hierarchies utilizing

other kinds of BVs, such as OBBs, DOPs, and even

convex hulls. We suspect that the volume of AABBs

would work fairly well as an estimate of the volume

of the respective BVs.

This algorithm has proven to be geometrically

robust, since there is no error propagation. There-

fore, a simple epsilon guard for all comparisons suf-

ﬁces.

It can be shown that this algorithm is, under cer-

tain assumptions,

9

in O(n), where n is the number

of polygons.

100

4.2 Collision Detection

Fast and exact collision detection of polygonal ob-

jects undergoing rigid motions is at the core of

many simulation algorithms in computer graphics.

In particular, all kinds of highly interactive appli-

cations such as virtual prototyping need exact col-

lision detection at interactive speed for very com-

plex, arbitrary “polygon soups”. It is a fundamen-

tal problem of dynamic simulation of rigid bodies,

simulation of natural interaction with objects, and

haptic rendering.

Bounding volume trees seem to be a very efﬁ-

cient data structure to tackle the problem of colli-

sion detection for rigid bodies. All kinds of differ-

ent types of BVs have been explored in the past:

8

This happens, for instance, when the sequence of polygons hap-

pens to be ordered such that each polygon increases one subset’s

volume just a little bit, so that the other subset never gets a

polygon assigned to.

9

These assumption have been valid in all practical cases we have

encountered so far.

sphere,

46,74

OBBs,

40

DOPs,

57,99

AABBs,

58,88,98

and

convex hulls,

31

to name but a few.

Given two hierarchical BV volume data struc-

tures for two objects A and B, almost all hierar-

chical collision detection algorithms implement the

following general algorithm scheme:

traverse(A,B)

if A and B do not overlap then

return

end if

if A and B are leaves then

return intersection of primitives

enclosed by A and B

else

for all children A[i] and B[j] do

traverse(A[i],B[j])

end for

end if

This algorithm quickly “zooms in” on pairs of close

polygons. The characteristics of different hierarchi-

cal collision detection algorithms lie in the type of

BV used, the overlap test for a pair of nodes, and

the algorithm for construction of the BV trees.

The algorithm outlined above is essentially a si-

multaneous traversal of two hierarchies, which in-

duces a so-called recursion tree (see Figure 40).

Each node in this tree denotes a BV overlap test.

Leaves in the recursion tree denote an intersection

test of the enclosed primitives (polygons); whether

or not a BV test is done at the leaves depends on

how expensive it is, compared to the intersection

test of primitives.

During collision detection, the simultaneous traver-

sal will stop at some nodes in the recursion tree. Let

us call the set of nodes, of which some children are

not visited (because their BVs do not overlap), the

“bottom slice” through the recursion tree (see the

dashed lines in Figure 40).

One idea is to save this set for a given pair of ob-

jects.

63

When this pair is to be checked next time,

we can start from this set, going either up or down.

Hopefully, if the objects have moved only a little

relative to each other, the number of nodes that

need to be added or removed from the bottom slice

is small. This scheme is called incremental hierar-

chical collision detection.

5 Voronoi Diagrams

For a given set of sites inside an area the Voronoi

diagram is a partition of the area into regions of

Siggraph 2003 Tutorial 16

Zachmann/Langetepe: Geometric Data Structures for CG 29

F7 G6 G7 F6 E4 D4 D5 E5 E F G D

C B

A

5 6 7 4

2

3

1

D7 D6 G4 G5

A1

B2 B3 C2 C3

F4 F5 E6 E7

Figure 40: The recursion tree is induced by the simultaneous traversal of two BV trees.

B

2

B

1

B

A

A

1

A

2

Figure 41: Hierarchical collision detection can

discard many pairs of polygons with one BV

check. Here, all pairs of polygons in A

1

and B

2

can be discarded.

the same neighborship. The Voronoi diagram and

its dual have been used for solving numerous prob-

lems in many ﬁelds of science.

We will concentrate on its application to geo-

metric problems in 2D and 3D. For an overview

of the Voronoi diagram and its dual in computa-

tional geometry one may consult the surveys by

Aurenhammer,

4

Bernal,

11

Fortune

34

and Auren-

hammer and Klein.

5

Additionally, chapters 5 and 6

of Preparata and Shamos

77

and chapter 13 of Edels-

brunner

29

could be consulted.

We start in Section 5.1 with the simple case of

the Voronoi diagram and the Delaunay triangula-

tion of n points in the plane, under the Euclidean

distance. Additionally we mention some of the ele-

mentary structural properties that follow from the

deﬁnitions.

In Section 5.2 different algorithmic schemes for

computing the structures are mentioned. We present

a simple incremental construction approach which

can be easily generalized to 3D (see Section 5.3.1).

We present generalizations of the Voronoi dia-

gramand the Delaunay Triangulation in Section 5.3.

In Section 5.3.1 transformations to three dimen-

sions are given and in Section 5.3.2 the concept of

constrained Voronoi diagrams is introduced. A col-

lection of other interesting generalizations is pre-

sented in Section 5.3.3.

In Section 5.4 applications of the Voronoi dia-

gram and the Delaunay triangulation in 2D and 3D

are shown. First, in Section 5.4.1 we discuss the

famous post ofﬁce problem. Then a simple appli-

cation of the Voronoi diagram of line segments for

motion planning is presented in Section 5.4.2. Fi-

nally, in Section 5.4.3 a collection of 2D-applications

is shown.

Note, that we can only sketch many of the sub-

jects here. For further details and further literature

see one of the surveys mentioned above. The ﬁg-

ures are taken from Aurenhammer and Klein.

5

5.1 Deﬁnitions and Elementary

Properties

5.1.1 Voronoi Diagram

Let S a set of n ≥ 3 point sites p, q, r, . . . in the

plane. In the following we assume that the points

are in general position, i.e., no four of them lie on

the same circle and no three of them on the same

line.

For points p = (p

1

, p

2

) and x = (x

1

, x

2

) let

d(p, x) denote their Euclidean distance. By pq we

denote the line segment from p to q. The closure of

a set A will be denoted by A.

Siggraph 2003 Tutorial 16

30 Zachmann/Langetepe: Geometric Data Structures for CG

Deﬁnition 5 For p, q ∈ S let

B(p, q) = ¦x [ d(p, x) = d(q, x)¦

be the bisector of p and q. B(p, q) is the perpendic-

ular line through the center of the line segment pq.

It separates the halfplane

D(p, q) = ¦x [ d(p, x) < d(q, x)¦

containing p from the halfplane D(q, p) contain-

ing q. We call

VR(p, S) =

¸

q∈S,q=p

D(p, q)

the Voronoi region of p with respect to S. Finally,

the Voronoi diagram of S is deﬁned by

V(S) =

¸

p,q∈S, p=q

VR(p, S) ∩ VR(q, S).

An illustration is given in Figure 42. It shows

how the plane is decomposed by V(S) into Voronoi

regions. Note that it is convenient to imagine a

simple closed curve Γ around the “interesting” part

of the Voronoi diagram.

Γ

Figure 42: A Voronoi diagram of points in the Eu-

clidean plane.

The common boundary of two Voronoi regions

belongs to V(S) and is called a Voronoi edge, if it

contains more than one point. If the Voronoi edge

e borders the regions of p and q then e ⊂ B(p, q)

holds. Endpoints of Voronoi edges are called Voronoi

vertices; they belong to the common boundary of

three or more Voronoi regions.

There is an intuitive way of looking at the Voronoi

diagram. For any point x in the plane we can ex-

pand the circle C(r) with center x and radius r by

increasing r continuously. We detect three cases de-

pending on which event occurs ﬁrst:

• If C(r) hits one of the n sites, say p, then x ∈

VR(p, S).

• If C(r) hits two sites p and q simultaneously x

belongs to the Voronoi edge of p and q.

• If C(r) hits three sites p, q and r simultaneously

x is the Voronoi vertex of p, q and r.

We will enumerate some of the signiﬁcant prop-

erties of Voronoi diagrams.

1. Each Voronoi region VR(p, S) is the intersec-

tion of at most n −1 open halfplanes containing

the site p. Every VR(p, S) is open and convex.

Different Voronoi regions are disjoint.

2. A point p of S lies on the convex hull of S iff its

Voronoi region VR(p, S) is unbounded.

3. The Voronoi diagramV(S) has O(n) many edges

and vertices. The average number of edges in

the boundary of a Voronoi region is less than 6.

The Voronoi diagram is a simple linear structure

and provides for a partition of the plane into cells

of the same neighborship. We omit the proofs and

refer to the surveys mentioned in the beginning.

Note, that the Voronoi edges and vertices build

a graph. Therefore the diagram normally is repre-

sented by a graph of linear size. For example the

diagram can be represented by a doubly connected

edge list DCEL, see de Berg et al.,

23

or with the help

of an adjacency matrix.

5.1.2 Delaunay Triangulation

We consider the dual graph of the Voronoi diagram,

the so called Delaunay triangulation. In general, a

triangulation of S is a planar graph with vertex set

S and straight line edges, which is maximal in the

sense that no further straight line edge can be added

without crossing other edges. The triangulation of

a point set S has not more than O([S[) triangles.

Siggraph 2003 Tutorial 16

Zachmann/Langetepe: Geometric Data Structures for CG 31

Deﬁnition 6 The Delaunay triangulation DT(S) is

the dual Graph of the Voronoi diagram. The edges

of DT(S) are called Delaunay edges.

Obviously, the Delaunay triangulation DT(S) is

a triangulation of S, an example is shown in Fig-

ure 43.

We present two equivalent deﬁnitions of the De-

launay triangulation. They are applied for the com-

putation of the diagram and give also rise to gener-

alization, for example if the dual of a Voronoi dia-

gram is no longer well-deﬁned.

1. Two points p, q of S give rise to a Delaunay edge

iff a circle C exists that passes through p and q

and does not contain any other site of S in its

interior or boundary.

2. Three points of S give rise to a Delaunay trian-

gle iff their circumcircle does not contain a point

of S in its interior.

DT(S)

V(S)

w

p

s

v

r

q

Figure 43: Voronoi diagram and Delaunay trian-

gulation.

5.2 Computation

The construction of the Voronoi diagram has time

complexity Θ(n log n). The lower bound Ω(n log n)

can be achieved by the following reductions.

• A reduction to the convex hull problem is given

by Shamos.

85

• A reduction to the -closeness problem is given

by Djidjev and Lingas

26

and by Zhu and Mirza-

ian.

101

The well-known computation paradigms

• Incremental construction,

• Divide-and-Conquer and

• Sweep

are convenient for the construction of the Voronoi

diagramor the Delaunay triangulation, respectively.

They can also be generalized to other metrics and

sites other than points, for example line segments

or polygonal chains. The result of the algorithms is

stored in a graph of linear size, see above.

All these approaches run in deterministic time

O(n log n). We explain a simple Incremental con-

struction technique which runs in O(n log n) ex-

pected time and computes the Delaunay triangula-

tion. The presentation is adapted from Klein and

Aurenhammer.

5

The technique can easily be gen-

eralized to the three dimensional case as we will see

in Section 5.3.1.

Simple incremental construction: The inser-

tion process is described as follows: We construct

DT

i

= DT(¦p

1

, . . . , p

i−1

, p

i

¦) by inserting the site

p

i

into DT

i−1

. We follow Guibas and Stolﬁ

41

and

construct DT

i

by exchanging edges, using Law-

son’s

60

original edge ﬂipping procedure, until all

edges invalidated by p

i

have been removed.

It is helpful to extend the notion of triangle to

the unbounded face of the Delaunay triangulation.

If pq is an edge of the convex hull of S we call the

supporting outer halfplane H not containing S an

inﬁnite triangle with edge pq. Its circumcircle is H

itself, the limit of all circles through p and q whose

center tend to inﬁnity within H. As a consequence,

each edge of a Delaunay triangulation is now adja-

cent to two triangles.

Those triangles of DT

i−1

whose circumcircles con-

tain the new site, p

i

, are said to be in conﬂict with

p

i

. According to the (equivalent) deﬁnition of the

DT

i

, they will no longer be Delaunay triangles.

Let qr be an edge of DT

i−1

, and let T(q, r, t) be

the triangle adjacent to qr that lies on the other

side of qr than p

i

; see Figure 44. If its circumcir-

cle C(q, r, t) contains p

i

then each circle through

q, r contains at least one of p

i

, t. Consequently, qr

cannot belong to DT

i

, due to the (equivalent) def-

inition. Instead, p

i

t will be a new Delaunay edge,

because there exists a circle contained in C(q, r, t)

that contains only p

i

and t in its interior or bound-

ary. This process of replacing edge qr by p

i

t is called

an edge ﬂip.

The necessary edge ﬂips can be carried out efﬁ-

ciently if we know the triangle T(q, s, r) of DT

i−1

that contains p

i

, see ﬁg. Figure 45. The line seg-

ments connecting p

i

to q, r, and s will be new De-

launay edges, by the same argument from above.

Siggraph 2003 Tutorial 16

32 Zachmann/Langetepe: Geometric Data Structures for CG

p

i

q

t

r

C(p

i

,t)

C(q,r,t)

Figure 44: If triangle T(q, r, t) is in conﬂict with p

i

then former Delaunay edge qr must be replaced

by p

i

t.

Next, we check if e. g. edge qr must be ﬂipped. If

so, the edges qt and tr are tested, and so on. We

continue until no further edge currently forming

a triangle with, but not containing p

i

, needs to be

ﬂipped, and obtain DT

i

.

Two task have to be considered:

1. Find the triangle of DT

i−1

that is in conﬂict

with p

i

.

2. Perform all ﬂips starting from this triangle.

It can be shown that the second task is bounded

by the degree of p

i

in the new triangulation. If the

triangle of DT

i−1

containing p

i

is known, the struc-

tural work needed for computing DT

i

from DT

i−1

is proportional to the degree d of p

i

in DT

i

.

So we yield an obvious O(n

2

) time algorithm

for constructing the Delaunay triangulation of n

points: we can determine the triangle of DT

i−1

containing p

i

within linear time, by inspecting all

candidates. Moreover, the degree of p

i

is trivially

bounded by n.

The last argument is too crude. There can be sin-

gle vertices in DT

i

that do have a high degree, but

their average degree is bounded by 6.

With a special implementation using a directed

acyclic graph (DAG), also called Delaunay tree due

to Boissonnat and Teillaud,

12

we can detect the tri-

angles of DT

i−1

which are in conﬂict with p

i

in

O(log i) expected time.

Altogether we get the following result:

Theorem 7 The Delaunay triangulation of a set

of n points in the plane can be easily incremen-

tally constructed incrementally in expected time

O(n log n), using expected linear space. The av-

erage is taken over the different orders of inserting

the n sites.

5.3 Generalization of the Voronoi

Diagram

5.3.1 Voronoi Diagram and Delaunay

Triangulation in 3D

We will see that incremental construction is also

appropriate for the 3D case. The following descrip-

tion was adapted from Aurenhammer and Klein.

5

Let S be a set of n point sites in 3D. The bisec-

tor of two sites p, q ∈ S is the perpendicular plane

through the midpoint of the line segment pq. The

region VR(p, S) of a site p ∈ S is the intersec-

tion of halfspaces bounded by bisectors, and thus

is a 3-dimenional convex polyhedron. The bound-

ary of VR(p, S) consists of facets (maximal subsets

within the same bisector), of edges (maximal line

segments in the boundary of facets), and of vertices

(endpoints of edges). The regions, facets, edges, and

vertices of V(S) deﬁne a cell complex in 3D.

This cell complex is face-to-face: if two regions

have a non-empty intersection f , then f is a face

(facet, edge, or vertex) of both regions. As an ap-

propriate data structure for storing a 3-dimenional

cell complex we mention the facet-edge structure in

Dobkin and Laszlo.

27

Complexity: The number of facets of VR(p, S)

is at most n − 1, at most one for each site q ∈

S ` ¦p¦. Hence, by the Eulerian polyhedron for-

mula, the number of edges and vertices of VR(p, S)

is O(n), too. This shows that the total number of

components of the diagram V(S) in 3D is O(n

2

).

In fact, there are conﬁgurations S that force each

pair of regions of V(S) to share a facet, thus achiev-

ing their maximum possible number of

n

2

; see,

e.g., Dewdney and Vranch.

25

This fact sometimes

makes Voronoi diagrams in 3D less useful com-

pared to 2-space. On the other hand, Dwyer

28

showed that the expected size of V(S) in d-space is

only O(n), provided S is drawn uniformly at ran-

domin the unit ball. This result indicates that high-

dimenional Voronoi diagrams will be small in many

practical situations.

In analogy to the 2-dimenional case, the Delau-

nay triangulation DT(S) in 3D is deﬁned as the ge-

ometric dual of V(S). It contains a tetrahedron for

each vertex, a triangle for each edge, and an edge

for each facet, of V(S). Equivalently, DT(S) may

be deﬁned using the empty sphere property, by in-

cluding a tetrahedron spanned by S as Delaunay iff

its circumsphere is empty of sites in S. The circum-

centers of these empty spheres are just the vertices

Siggraph 2003 Tutorial 16

Zachmann/Langetepe: Geometric Data Structures for CG 33

(i)

(ii)

(iii)

SF

s

q

t

r

p

i

F

SF

s

q

t

r

p

i

s

q

t

r

p

i

T

Figure 45: Updating DT

i−1

after inserting the new site p

i

. In (ii) the new

Delaunay edges connecting p

i

to q, r, s have been added, and

edge qr has already been ﬂipped. Two more ﬂips are neces-

sary before the ﬁnal state shown in (iii) is reached.

p

q

p

q

Figure 46: The Voronoi diagram of a point set in

L

1

and L

2

. Note, that there are structural differ-

ences.

Figure 47: An Euclidean Voronoi diagram of line

segments.

of V(S). DT(S) is a partition of the convex hull

of S into tetrahedra, provided S is in general posi-

tion. Note that the edges of DT(S) may form the

complete graph on S.

Simple incremental construction: Among the

various proposed methods for constructing V(S)

in 3D, incremental insertion of sites (compare Sec-

tion 5.2) is most intuitive and easy to implement.

Basically, two different techniques for integrating a

new site p into V(S) have been applied. The more

obvious method ﬁrst determines all facets of the re-

gion of p in the new diagram, V(S ∪¦p¦), and then

deletes the parts of V(S) interior to this region; see

e.g. Watson,

93

Field,

33

and Tanemura et al.

86

In-

agaki et al.

47

describe a robust implementation of

this method.

In the dual environment, this amounts to detect-

ing and removing all tetrahedra of DT(S) whose

circumspheres contain p, and then ﬁlling the ’hole’

with empty-sphere tetrahedra with p as apex, to

obtain DT(S ∪ ¦p¦). An example of an edge ﬂip in

3Dis shown in Figure 48. Joe,

49

Rajan,

78

and Edels-

brunner and Shah

30

follow a different and numeri-

cally more stable approach. Like in the planar case,

after having added a site to the current Delaunay

triangulation, certain ﬂips changing the local tetra-

hedral structure are performed in order to achieve

local “Delaunayhood”. The existence of such a se-

quence of ﬂips is less trivial, however. Joe

48

demon-

strated that no ﬂipping sequence might exist that

turns an arbitrary tetrahedral triangulation for S

into DT(S).

A complete algorithm with run time O(n

2

) can

be found in Shah.

30

Siggraph 2003 Tutorial 16

34 Zachmann/Langetepe: Geometric Data Structures for CG

Figure 48: Two–into–three tetrahedra ﬂip for ﬁve sites.

5.3.2 Constrained Voronoi diagrams

For many applications it is not useful to consider

neighborship relations without any constraints. For

example, a small distance between two cities may

become unimportant if there is a (natural or artiﬁ-

cial) border line between them and the border line

itself should not serve as a new site. To overcome

such problems the concept of constrained Voronoi

diagrams was introduced.

61

Let S be a set of n points in the plane, and let

L be a set of non-crossing line segments spanned

by S, thus we have [L[ ≤ 3n − 6. The segments

in L may be considered as obstacles. The bounded

distance between two points x and y in the plane is

deﬁned as follows:

b(x, y) =

d(x, y) if xy ∩ L = ∅

∞ otherwise

where d stands for the Euclidean distance. In the

resulting constrained Voronoi diagram VD(S, L),

regions of sites that are close but not visible from

each other are separated by segments in L, an ex-

ample is shown in Figure 49.

The exact dual of VD(S, L) may be no longer a

full triangulation of S (even if S is included) but

we can modify VD(S, L) in order to dualize it into

a "near to Delaunay" triangulation DT(S, L) that

also includes L.

For every line segment l we proceed as follows:

All sites of the clipped regions to the left of a seg-

ment l build a special Voronoi diagram to the right

and vice versa. The neighborship within these spe-

cial diagrams lead to additional edges inserted into

the dual of VD(S, L). Note that the endpoints of

the line segments are always neighbors in the new

diagrams and therefore the line segments itself are

inserted (see Figure 49).

Algorithms for computing the constrained Voro-

noi diagram VD(S, L) and the constrained Delau-

nay triangulation DT(S, L) have been proposed in

Lee and Lin,

61

Chew,

16

Wang and Schubert

92

and

Wang.

91

In Seidel

81

and Kao and Mount

51

one

will ﬁnd good implementation schemes. An appli-

cation of DT(S, L) to quality mesh generation can

be found in Chew.

17

5.3.3 Other Types of Generalizations

We simply list some of the generalization schemes

and show examples of some intuitive ones.

• Different metrics

– L

1

, a comparison of L

1

and L

2

is shown in

Figure 46

– L

∞

– Convex distance functions

• Different space

– On trees and graphs

– Higher dimensions

• Weights

• More general sites

– Line segments (see Figure 47).

– Polygonal chains

• Farthest point Voronoi diagram

• K-th order Voronoi digram

• Colored objects

5.4 Applications of the Voronoi

Diagram

5.4.1 Nearest Neighbor or Post Ofﬁce Problem

We consider the well-known post ofﬁce problem.

For a set S of sites in the plane and an arbitrary

query point x we want to compute the point of S

closest to x efﬁciently.

Siggraph 2003 Tutorial 16

Zachmann/Langetepe: Geometric Data Structures for CG 35

Figure 49: The constrained Voronoi diagram VD(S, L) and its dual.

In the ﬁeld of computational geometry there is a

general technique for solving such query problems.

One tries to decompose the query set into classes

so that every class has the same answer. Now for a

single answer we only have to determine its class.

This technique is called locus approach.

The Voronoi diagram represents the locus ap-

proach for the post ofﬁce problem. The classes cor-

respond to the regions of the sites. For a query

point x we want to determine its class/region and

return its owner.

To solve this task a simple technique can be ap-

plied. We draw a horizontal line through every ver-

tex of the diagram and sort the lines in O(n log n)

time, see Figure 50. The lines decompose the di-

agram into slabs. For every slab we sort the set

of crossing edges of the Voronoi diagram in linear

time. Altogether we need O(n

2

) time for the sim-

ple construction.

x

Figure 50: After constructing the slabs, a query

point x can be located quickly.

For a query point x we locate its slab in O(log n)

time and afterwards its region in O(log n) time by

binary search.

Theorem 8 Given a set S of n point sites in the

plane, one can, within O(n

2

) time and storage,

construct a data structure that supports nearest

neighbor queries: for an arbitrary query point x,

its nearest neighbor in S can be found in time

O(log n).

The simple technique can be easily extended to

3D. There are also more efﬁcient approaches, i.e.,

Edelsbrunner

29

constructs a O(log n) search struc-

ture for the Voronoi diagram in linear time and

with linear space.

5.4.2 Motion planning

We present a simple application of Voronoi dia-

grams for computing collision-free paths in polyg-

onal environments. Let us assume that a two di-

mensional environment with polygonal obstacles

is given. For simplicity we assume that a circle-

shaped robot is given and a collision-free path from

s to t should be computed (see Figure 51).

We can solve this problem by computing the

Voronoi diagram VD(S) of the corresponding line

segments. This gives rise to a reasonable solu-

tion. Let us assume that the robot moves between

to obstacle line segments l

1

and l

2

, for safetyness

it should maximize its distance to both segments.

That is, for every position x we want to maximize

[xl

i

[ = min

y∈l

i

[xy[, i = 1, 2 .

This goal is reached if the robot moves along the

biscetor of l

1

and l

2

. Altogether the robot should

try to move along the Voronoi diagram of the line

segments of the polygonal scene. For every seg-

ment of VD(S) we can easily compute whether the

robot ﬁts between the corresponding obstacles.

Siggraph 2003 Tutorial 16

36 Zachmann/Langetepe: Geometric Data Structures for CG

y

t

y

s

l

t'

t

s

s'

Figure 51: Computing a collision-free path from s to t for a circle-shaped robot in

the presence of polygonal obstacles.

Now we can solve our problem as follows:

• Compute the Voronoi diagram VD(S) of the set

of line segments S.

• Consider the Voronoi regions of s and t in VD(S).

• Consider the closest point s

/

∈ VD(S) to s, re-

spectively t

/

∈ VD(S) to s.

• Delete the segments of VD(S) where the robot

does not ﬁt between the obstacles.

• Consider the graph G of the remaining diagram

together with s

/

and t

/

.

• Compute a path from s

/

to t

/

in G by standard

graph algorithms.

Altogether we have the following result:

Theorem 9 There is a collision-free path of a circle-

shaped robot with radius r in a polygonal environ-

ment of a set line segments S if and only if the ra-

dius r is smaller than [ss

/

[ und [tt

/

[ and a collision-

free movement from s

/

to along the segments of

VD(S) exists.

5.4.3 Other Applications of the Voronoi

Diagram in 2D

There are many different geometrical applications

of the Voronoi diagram and its dual. Here we sim-

ply list some of them, together with some perfor-

mance results, provided that the diagram is given:

• Closest Pair of sites, O(n)

• Nearest Neighbor Search

– O(n) for all nearest neighbors of the sites

– O(k log

2

n) expected time for k-th nearest

neighbors of query point x

• Minimum Spanning Tree and

TSP-Heuristic, O(n log n)

• Largest empty circle, O(n)

• Smallest enclosing circle (square with ﬁxed ori-

entation), O(n)

• Smallest color spanning circle (square with ﬁxed

orientation), O(nk), where k is the number of

colors

• Localization problems, see Hamacher

42

• Clustering of objects, see Dehne and Noltemeier

24

All these results stem more or less from the lin-

ear complexity of the diagram. As we have already

mentioned the complexity of the diagrams in three

dimension is also linear in many practical situa-

tions. Thus many of the presented problems can be

solved in three dimensions with almost the same

time bound. We will present some special applica-

tions for 3D.

5.5 Texture Synthesis

Textures are visual detail of the rendered geometry,

which have become very important in the past few

years, because the cost of rendering with texture is

the same as the cost without texture. Virtually all

Siggraph 2003 Tutorial 16

Zachmann/Langetepe: Geometric Data Structures for CG 37

random border

T

p

N(p)

[[ [[

[[ [[

I

p

T

0

[[ [[

T

d

I

0

I

d

N(p) N(p

i

)

pi

Figure 52: The texture synthesis algorithm pro-

ceeds in scan line order through the texture and

considers only the neighborhood around the cur-

rent pixel as shown.

Figure 53: Using an image pyramid, the texture

synthesis process becomes fairly robust against

different scales of detail in the sample images.

Figure 54: Some results of the texture synthesis algorithm.

95

In each pair, the image on the left is the

original one, the one on the right is the (partly) synthesized one.

real-world objects have texture, so it is extremely

important to render them in synthetic worlds, too.

Texture synthesis generally tries to synthesize

new textures, either from given images, from a

mathematical description, or froma physical model.

Mathematical descriptions can be as simple as a

number of sine waves to generate water ripples,

while physical models try to describe the physi-

cal or biological effects and phenomena that lead to

some texture (such as patina or fur). In all of these

“model-based” methods, the knowledge about the

texture is in the model and the algorithm. The

other class of methods starts with one or more

images; then they try to ﬁnd some statistical or

stochastic description (explicitely or implicitely) of

these, and ﬁnally it generates a new texture from

the statistic.

Basically, textures are images with the following

properties:

1. Stationary: if a window with the proper size is

moved about the image, the portion inside the

window always appears the same.

2. Local: each pixel’s color in the image depends

only on a relatively small neighborhood.

Of course, images not satisfying these criteria can

be used as textures as well (such as façades), but if

you want to synthesize such images, then a statis-

tical or stochastic approach is probably not feasible.

In the following, we will describe a stochastic

algorithm that is very simple, very efﬁcient, and

works remarkably well.

95

Given a sample image, it

does not, like most other methods, try to compute

explicitly the stochastic model. Instead, it uses the

sample image itself, which implicitly contains that

model already.

We will use the following terminology:

I = Original (sample) image

T = New texture image

p

i

= Pixel from I

p = Pixel from T to be generated next

N(p) = Neighborhood of p (see Figure 52)

Initially, T is cleared to black. The algorithm

starts by adding a suitably sized border at the left

and the top, ﬁlled with random pixels (this will be

thrown away again at the end). Then, it performs

the following simple loop in scan line order (see

Figure 52):

Siggraph 2003 Tutorial 16

38 Zachmann/Langetepe: Geometric Data Structures for CG

1: for all p ∈ T do

2: ﬁnd the p

i

∈ I that minimizes [N(p) − N(p

i

)[

2

3: p := p

i

4: end for

Well, the search in line 2 is exactly a nearest-neighbor

search! This can be performed efﬁciently with the

algorithm presented in Section 5.4.1: if N(p) con-

tains k pixels, then the points are just 3k-dimen-

ional vectors of RGB values, and the distance is just

the Euclidean distance.

Obviously, all pixels of the new texture are deter-

ministically deﬁned, once the random border has

been ﬁlled. The shape of the neighborhood N(p)

can be chosen arbitrarily, it must just be chosen

such that all but the current pixel are already com-

puted. Likewise, other “scans” of the texture are

possible and sensible (for instance a spiral scan or-

der), they must just match the shape of N(p).

The quality of the texture depends on the size of

the neighborhood N(p). However, the optimal size

itself depends on the “granularity” in the sample

image. In order to make the algorithm indepen-

dent, we can synthesize an image pyramid (see Fig-

ure 53). First, we generate a pyramid I

0

, I

1

, . . . , I

d

for the sample image I

0

. Then, we synthesize the

texture pyramid T

0

, T

1

, . . . , T

d

level by level with

the above algorithm, starting at the coarsest level.

The only difference is that we extend the neigh-

borhood N(p) of a pixel p over k levels as depicted

by Figure 53. Consequently, we have to build a

nearest-neighbor search structure for each level,

because as we proceed downwards in the texture

pyramid, the size of the neighborhood grows.

Of course, nowwe have replaced the parameter of

the best size of the neighborhood by the parameter

of the best size per level and the best number of

levels to consider for the neighborhood. However,

as Wei and Levoy

95

report, a neighborhood of 9

9 (at the ﬁnest level) across 2 levels seems to be

sufﬁcient in almost all cases.

Figure 54 shows two examples of the results that

can be achieved with this method.

5.6 Shape Matching

As the availability of 3D models on the net and in

databases increases, searching for such models be-

comes an interesting problem. Such a functionality

is needed, for instance, in medical image databases,

or CAD databases. One question is how to specify a

query. Usually, most researchers pursue the “query

by content” approach, where a query is speciﬁed by

providing a (possibly crude) shape, for which the

database is to return best matches.

10

The funda-

mental step here is the matching of shapes, i.e., the

calculation of a similarity measure.

Almost all approaches perform the following steps:

1. Deﬁne a transformation function that takes a

shape and computes a so-called feature vector

in some high dimensional space, which (hope-

fully) captures the shape in its essence. Nat-

urally, those transformation functions are pre-

ferred that are invariant under rotation and/or

translation and tessellation.

2. Deﬁne a similarity measure d on the feature

vectors, such that if d( f

1

, f

2

) is large, then the

associated shapes s

1

, s

2

do not look similar. Ob-

viously, this is (partly) a human factors issue. In

almost all algorithms, d is just the Euclidean dis-

tance.

3. Compute a feature vector for each shape in the

database and store them in a data structure that

allows for fast nearest-neighbor search.

4. Given a query, i.e., a shape, compute its feature

vector, and retrieve the nearest neighbor from

the database. Usually, the system also retrieves

all k nearest neighbors. Often times, you are

not interested in the exact k nearest neighbors

but only in approximate nearest neighbors (be-

cause the feature vector is an approximation of

the shape anyway).

The main difference among most shape matching

algorithms is, therefore, the transformation from

shape to feature vector.

So, fast shape retrieval essentially requires a fast

(approximate) nearest neighbor search. We could

stop our discussion of shape matching here, but for

sake of completeness, we will describe a very simple

algorithm (from the plethora of others) to compute

a feature vector.

71

The general idea is to deﬁne some shape func-

tion f (P

1

, . . . , P

n

) →R, which computes some ge-

ometrical property of a number of points, and then

evaluate this function for a large number of ran-

dom points that lie on the surface of the shape. The

resulting distribution of f is called a shape distri-

bution.

10

This idea seems to originate from image database retrieval,

where it was called QBIC = “query by image content”.

Siggraph 2003 Tutorial 16

Zachmann/Langetepe: Geometric Data Structures for CG 39

torus

sphere

pillow

cylinder

cube

distance

d

e

n

s

i

t

y

7 6 5 4 3 2 1 0

10000

8000

6000

4000

2000

0

Figure 55: The shape distribution of a number of

different simple objects.

For the shape function, there are a lot of possi-

bilities (your imagination is the limit). Examples

are:

• f (P

1

, P

2

) = [P

1

− P

2

[;

• f (P

1

) = [P

1

− P

0

[, where P

0

is a ﬁxed point,

such as the bounding box center;

• f (P

1

, P

2

, P

3

) = ∠(P

1

P

2

, P

1

P

3

);

• f (P

1

, P

2

, P

3

, P

4

) = volume of the tetrahedron

between the four points.

Figure 55 shows the shape distributions of a few

simple objects with the distance between two points

as shape function.

6 Distance Fields

Distance ﬁelds can be viewed as a way to represent

surfaces (and solids). They are a very powerful data

structure, because they contain a huge amount of

information (compared to just the surface itself).

This is why they usually take fairly long to com-

pute. Consequently, this computation can usually

be performed only as a preprocessing step. Thus,

they are difﬁcult to adapt for deformable geometry.

Deﬁnition 5 (Distance ﬁeld)

Let S be a surface in R

3

. Then, the distance ﬁeld of

a surface S is a scalar function D

S

: R

3

→ R such

that for all p ∈ R

3

,

D

S

(p) =sgn(p) min

¸

d(p, q)[q ∈ S

¸

, (14)

where

sgn(p) =

−1, if p inside

+1, if p outside

In other words, D

S

tells for any point p the distance

to the closest point on the surface S.

We can augment the DF further to obtain a vec-

tor distance ﬁeld V

S

by storing a vector to the clos-

est point p ∈ S for each point x.

50

So, D

S

(x) =

V

S

(x)

**. This is a vector ﬁeld. Another vector ﬁeld
**

that is often used in the context of DFs is the gradi-

ent of the distance ﬁeld, or just gradient ﬁeld.

Figure 56 shows a distance ﬁeld for a simple poly-

gon in the plane. The distance of a point from the

surface is color-coded (the distance for points inside

the polygon is not shown). Figure 57 shows a vec-

tor distance ﬁeld (for the same surface).

Apparently, distance ﬁelds (DFs) have been “in-

vented” in many different areas, such as computa-

tional physics,

82,84

robotics,

54

GIS (see Figures 58

and 59 for an example), and image processing.

73

Not surprisingly, DFs come under many other names,

such as distance maps and potential ﬁelds. The

process of, or the algorithm for computing a DF is

sometimes called distance transform.

11

Distance ﬁelds have close relationships to isosur-

faces and implicit functions. When regarded as an

implicit function, the isosurface for the iso-value

0 of a DF is exactly the original surface (see Fig-

ure 56). However, the converse is not true in gen-

eral, i.e., the DF of a surface deﬁned by an implicit

function is not necessarily identical to the original

implicit function.

There is another data structure related to distance

ﬁelds, namely Voronoi diagrams (see Section 5).

Given a vector distance ﬁeld for a set of points,

edges, and polygons (not necessarily connected),

then all points in space, whose vectors point to the

same feature (point, edge, or oplygon), are in the

same Voronoi cell (see Figures 56 and 57). (We

could also regard the vector of the DF as a kind of

ID of the respective Voronoi cell.)

6.1 Computation and representation

of DFs

For special surfaces S, we may be able to compute

D

S

analytically. In general, however, we have to

discretize D

S

spatially, i.e., store them in a 3D voxel

grid, octree, or other space partitioning data struc-

ture. Voxel grids and octrees are the most com-

monly used data structures for storing DFs, and

11

Sometimes, this term bears the connotation of producing inac-

curate distance ﬁelds.

Siggraph 2003 Tutorial 16

40 Zachmann/Langetepe: Geometric Data Structures for CG

Figure 56: Example of a distance ﬁeld in the plane

for a simple polygon (thick black lines). The dis-

tance ﬁeld inside the polygon is not shown. The

dashed lines show the Voronoi diagram for the

same polygon. The thin lines show isosurfaces

for various isovalues.

Figure 57: The vector distance ﬁeld for the same

polygon as shown on the left. Only a few vectors

are shown, although (in theory) every point of the

ﬁeld has a vector.

Figure 58: A network of roads described in the

plane by a set of edges.

Figure 59: The distance map of these roads. The

distance of each point in the plane from a road

is color coded. It could be used, for example,

to determine the areas where new houses can be

built.

we will describe algorithms for them in the follow-

ing. More sophisticated representations try to store

more information at each voxel in order to be able

to extract distances quickly from the ﬁeld.

45

Since each cell in a discrete distance ﬁeld stores

one signed distance to the surface for only one

“representative”, the distance of other points must

be interpolated from these values. One simple

method is to store exact distances for the nodes (i.e.,

the corners of the voxels), and generate all other

distances in the interior of voxels by trilinear in-

terpolation. Other interpolation methods could, of

course, be used as well.

The simplest discrete representation of a DF is

the 3D voxel grid. However, for most applications

this is too costly not only in memory utilization but

also in computational efforts. So, usually DFs are

represented using octrees (see Figure 60), because

they are simple to construct and offer fairly good

adaptivity and allow for easy algorithms.

35

This

representation is called an adaptively sampled dis-

tance ﬁeld (ADF). Actually, the kind of hierarchical

Siggraph 2003 Tutorial 16

Zachmann/Langetepe: Geometric Data Structures for CG 41

Figure 60: Representing distance ﬁelds by octrees

has both memory and computational advantages.

space partitioning is a design parameter of the al-

gorithm; for instance, BSPs (see Section 3) proba-

bly offer much more efﬁcient storage at the price of

more complex interpolation.

Constructing ADFs works much like construct-

ing regular octrees for surfaces, except that here,

we subdivide a cell if the distance ﬁeld is not well

approximated by the interpolation function deﬁned

so far by the cell corners.

The following two algorithms for computing DFs

produce only ﬂat representations (i.e., grids), but

they can be turned into an ADF by coalescing cells

in a bottom-up manner if the resulting cell still de-

scribes the DF well enough.

12

6.1.1 Propagation method

This method bears some resemblance to region grow-

ing and ﬂood ﬁlling algorithms and is also called

chamfer method. It can produce only approxima-

tions of the exact DF.

The idea is to start with a binary DF, where all

voxels intersecting the surface are assigned a dis-

tance of 0, and all others are assigned a distance of

∞. Then, we somehow “propagate” these known

values to voxels in the neighborhood, taking advan-

tage of the fact that we already know the distances

between neighboring voxels.

13

Note that these dis-

tances only depend on the local neighborhood con-

stellation, no matter where the “propagation front”

currently is.

12

Usually, it is faster to compute an ADF top-down, though.

13

This idea has been proposed as early as 1984,

13

and maybe even

earlier.

√

8

√

5

√

5

√

8

√

2

√

5

√

5

√

2

√

2

√

5

√

5

√

8

√

5

√

4

√

8

part of matrix

for forward scan

part of matrix

for backward scan

-2 -1

2 1

0

2

2 1 0 1 2

2

1

1

√

2

-2

-1

0

1

2

layer

√

6

√

6

√

5

3

3

3

3

√

6

√

10

√

10

√

6

√

6

√

5

3

3

3

3

√

6

√

10

√

10

√

3

√

2

√

6

√

6

√

3

√

6

√

6

√

5

√

10

3

√

3

√

2

√

6

√

6

√

3

√

6

√

6

√

5

√

10

3

√

2

√

2

1

√

5

√

5

√

5

√

5

2

√

8

√

8

√

2

√

2

1

√

5

√

5

√

5

√

5

2

√

8

√

8

√

3

√

3

√

2

√

6

√

6

√

6

√

6

√

5

√

10

3

√

3

√

3

√

2

√

6

√

6

√

6

√

6

√

5

√

10

3

√

6

√

6

√

5

3

3

3

3

√

6

√

10

√

10

√

6

√

6

√

5

3

3

3

3

√

6

√

10

√

10

Figure 61: By convoluting a “distance matrix”

with an initially binary distance ﬁeld (0 or ∞),

one gets an approximate distance ﬁeld. Here a

5 5 5 example of such a matrix is shown.

More formally speaking, since we want to com-

pute the DF only for a discrete set of points in space,

we can reformulate Equation 14 as follows

˜

D

S

(x, y, z) = min

i,j,k∈Z

3

¸

D(x +i, y + j, z +k)

+d

M

(i, j, k)

¸

(15)

where d

M

is the distance of a node (i, j, k) from

the center node (0, 0, 0). Actually, this is already

a slight approximation of the exact DF.

We can now further approximate this by not con-

sidering the inﬁnite “neighborhood” (i, j, k) ∈ Z

3

,

but instead only a local one I ⊂ Z. Since a prac-

tical computation of

˜

D

S

would compute each node

in some kind of scan order, we choose I such that

it contains only nodes that have already been com-

puted by the respective scan. Thus, d

M

can be pre-

computed and stored conveniently in a 3-dimen-

sional matrix (see Figure 61).

This process looks very similar to conventional

convolution, except that here we perform a mini-

mum operation over a number of sums, while the

conventional convolution performs a sum over a

number of products.

Obviously, a single scan will not assign meaning-

ful distance values to all nodes, no matter what or-

der the scan preforms. Therefore, we need at least

two scans: for instance, ﬁrst, a 3D scanline order

from top to bottom (“forward”), and second, back-

wards from bottom to top. In each pass, only one

half of the 3D matrix d

M

needs to be considered

(see Figure 61). It could still happen, of course, that

there are still nodes with distance ∞ in the respec-

tive part of the chamfer matrix.

Siggraph 2003 Tutorial 16

42 Zachmann/Langetepe: Geometric Data Structures for CG

Figure 62: The distance func-

tion of a point site in the plane

is a cone.

44

Figure 63: More complex sites

have a bit more complex dis-

tance functions.

Figure 64: The distance func-

tion of sites in 3D is different

for the different slices of the

volume.

The time complexity of this method is in O(m),

m = number of voxels. However, the result is only

an approximation of the distance ﬁeld; in fact, the

accuracy of the distance values can be pretty low.

14

In order to further improve accuracy, one can

make a few more passes, not only from top to bot-

tom and back, but also from left to right, etc. An-

other option is to increase the size of d

M

.

Analogously, an approximate vector distance ﬁeld

can be computed.

50

In that case, the matrix d

M

con-

tains vectors instead of scalars. In order to improve

the accuracy, we can proceed in two steps: ﬁrst, for

each voxel in the neighborhood of the surface (usu-

ally just the 3

3

-neighborhood) we compute vec-

tors to the exact closest point on the surface; then,

this shell is propagated by several passes with the

vector-valued matrix d

M

. The time for computing

the exact distance shell can be optimized by utiliz-

ing an octree or BV hierarchy for closest point com-

putation, and initializing each search with the dis-

tance (and vector) to the closest point of a nieghbor

voxel.

6.1.2 Projection of distance functions

The previous method can be applied to all kinds of

surfaces S. However, it can produce only very gross

approximations. In the following, we describe a

method that can produce much better approxima-

tions. However, it can be applied only to polygonal

surfaces S.

14

Furthermore, the distance values are not even an upper bound

on the real distance.

The key technique applied in this approach is to

embed the problem into more dimensions than are

inherent in the input/output itself. This is a very

general technique that often helps to get a better

and simpler view on a complex problem.

The method described in the following was pre-

sented by Hoff et al.,

44

and, from a different point

of view, by Sethian.

83

Let us consider the distance ﬁeld of a single point

in 2D. If we consider this a surface in 3D, then we

get a cone with the apex in that point. In other

words, the distance ﬁeld of a point in a plane is just

the orthogonal projection of suitable cone onto the

plane z = 0.

Now, if there are n point sites in the plane, we

get n cones, so each point in the plane will be “hit”

by n distance values from the projection (see Fig-

ure 62). Obviously, only the smallest one wins

and gets “stored” with that point — and this is ex-

actly what the z-buffer of graphics hardware was

designed for.

These cones are called the distance function for

a point. The distance function for other features

(line segments, polygons, curves) is a little bit more

complicated (see Figure 63).

So, computing a discrete DF for a set of sites in

the plane can be done by rendering all the asso-

ciated distance functions (represented as polygonal

meshes) and reading out the z-buffer (and possibly

the frame buffer if we also want the site IDs, i.e.,

discretized Voronoi regions). If we want to com-

pute a three-dimenional DF, then we proceed slice-

by-slice. One noteworthy catch, though, is that the

distance functions of the sites changes from slice to

slice. For instance, the distance function for a point

Siggraph 2003 Tutorial 16

Zachmann/Langetepe: Geometric Data Structures for CG 43

that lies not in the current slice is a hyperboloid,

with the point site being coincident with the vertex

of the hyperboloid (see Figure 64).

6.2 Applications of DFs

Due to their high information density, distance ﬁelds

have a huge number of applications. Aomng them

are motion planning in robotics,

54,59

collision de-

tection, shape matching,

70

morphing,

19

volumet-

ric modeling,

14,35,97

navigation in virtual environ-

ments,

90

reconstruction,

56

offset surface construc-

tion,

76

and dynamic LODs, to name but a few. In

the following, we will highlight two easy ones of

them.

6.2.1 Morphing

One interesting application of DFs is morphing, i.e.,

the problem of ﬁnding a “smooth” transition from

a shape S ⊂ R

d

to a shape T ⊂ R

d

, i.e., we are

looking for a shape transformation M(t, R

d

), t ∈

[0, 1], such that M(0, S) = S, M(1, S) = T.

Sometimes, there is a bit of confusion about terms:

sometimes, morphing refers to any smooth transi-

tion, sometimes it refers only to those transitions

that are bijective, continuous, and have a continu-

ous inverse. In the latter case, the term morphing

is equivalent to the notion of homeomorphism in

the area of topology, and the term metamorpho-

sis is used to refer to the broader deﬁnition. The

difference between a homeomorphism and a meta-

morphosis is that the former does not allow to cut

or glue the shape during the transition (this would

change the topology).

In the following, we will describe a simple method

for metamorphosis of two shapes given as volumet-

ric models; it was presented by Cohen-Or et al.

20

The nice thing about a volumetric representation is

that it can naturally handle genus changes (i.e., the

number of “holes” in S and T is different).

In the simplest form, we can just interpolate lin-

early between the two DFs of S and T yielding a

new DF

M(t, S) = J(t, S, T) = tD

S

+ (1 −t)D

T

. (16)

In order to obtain a polygonal representation, we

can compute the isosurface for the value 0.

This works quite well, if S and T are “aligned”

with each other (in an intuitive sense). However,

when morphing two sticks that are perpendicular

Figure 65: By specifying correspondences, the

user can identify feature points that should transi-

tion into each other during the morph.

20

to each other, there will be in-between models that

almost vanish.

Therefore, in addition to the DF interpolation, we

usually want to split the morphing into two steps

(for each t): ﬁrst, S is warped by some function

W(t, x) into S

/

, then D

S

/ and D

T

are interpolated,

i.e., M(t, S) = tD

W(t,S)

+ (1 −t)D

T

.

The idea of the warp is that it encodes the ex-

pertise of the user who usually wants a number of

prominent feature points from S to transition onto

other feature points on T. For instance, she wants

the corresponding tips of nose, ﬁngers, and feet of

two different characters transition into each other.

Therefore, the user has to specify a small number

of correspondences (p

0,i

, p

1,i

), where p

0,i

∈ S, and

p

1,i

∈ T (see Figure 65). Then, we determine a

warp function W(t, x) such that W(1, p

0,i

) = p

1,i

.

Since the warp function should distort S as little

as possible (just “align” them), we can assemble it

from a rotation, then a translation, and ﬁnally an

elastic part that is not a linear transformation:

W(t, x) =

(1 −t)I +tE

R(a, tθ)x +tc

(17)

where E is the elastic transformation, R(a, θ) is a

rotation about axis a and angle θ, and c is the trans-

lation.

The rotation and translation of the warp function

can be determined by least-squares ﬁtting, while

the elastic transformation can be formulated as a

Siggraph 2003 Tutorial 16

44 Zachmann/Langetepe: Geometric Data Structures for CG

0

-1

-2

1

2

2

1

0

-1

-2

2

1

0

-1

-2

Figure 66: Example of differ-

ence of two DFs. On the left,

the two DFs for tool and ob-

ject are shown superimposed;

on the right, the result is shown.

Figure 67: Example of a 3D dif-

ference operation.

14

Figure 68: Close-up view show-

ing the adaptivity.

scattered data interpolation problem. One method

that has proven quite robust is the approach using

radial basis functions. The interested reader will

ﬁnd the details in Cohen-Or et al.

20

6.2.2 Modeling

A frequently used modeling paradigm in CAD is

volumetric modeling, which means that objects are,

conceptually, deﬁned by specifying for each point

whether or not it is a member of the object. the ad-

vantage is that it is fairly simple to deﬁne Boolean

operations on such a representation, such as union,

subtraction, and intersection. Examples of vol-

umetric modeling is constructive solid geometry

(CSG) and voxel-based modeling. The advantage

of using distance ﬁelds for volumetric modeling is

that they are much easier to implement than CSG,

but provide much better quality than simple voxel-

based approaches.

Computing the Boolean operation on two DFs

basically amounts to evaluating the appropriate op-

erator on the two ﬁelds. The following tables gives

these operators for a ﬁeld D

O

(for the object) and a

ﬁeld D

T

(for the tool):

Boolean op. operator on DF

Union D

O∪T

= min

D

O

, D

T

Intersection D

O∩T

= max

D

O

, D

T

Difference D

O−T

= max

D

O

, −D

T

**Figure 66 shows an example of the difference oper-
**

ation.

If ADFs are used for representation of the DFs,

then a recursive procedure has to be applied to

the object’s ADF in order to compute the resulting

ADF. It is similar to the generation of ADFs (see

above), except that here the subdivision is governed

by the compliance of new object ADF with the tool

ADF: a cell is further subdivided if it contains cells

from the tool ADF that are smaller, and if the tri-

linear interpolation inside the cell does not approx-

imate well enough the ADF of the tool.

7 Dynamization of Geometric

Data Structures

We present a generic approach for the dynamiza-

tion of an arbitrary static geometric data structure.

Often a simple static data structure is sufﬁcient if

the set of represented geometric objects will have

few changes over time. Once created, the static

structure mostly has to cope with data queries due

to its geometric intention. If the set of objects

varies very much over time, there is need for more

complex dynamic structures which allow efﬁcient

insertion and deletion of objects.

For example a one dimensional sorted array of

a ﬁxed set M is sufﬁcient for x is Element of M

queries. But if the set M has many changes over

time, a dynamic AVL-tree would be more likely.

The AVL-tree implementation is more complex

Siggraph 2003 Tutorial 16

Zachmann/Langetepe: Geometric Data Structures for CG 45

since rotations of the tree has to be considered for

insertion and deletion of objects. Additionally, the

AVL-tree dynamization was invented for the spe-

cial case of the one-dimenional search. We want

to show that it is possible to dynamize a simple

static data structure indirectly but also efﬁciently

in a general setting. Once this generic approach

is implemented it can be used for many static data

structures.

The generic approaches presented here are not

optimal against a dynamization adapted directly to

a single data structure, but they are easy to imple-

ment and efﬁcient for many applications.

In Section 7.1 we formalize the given problem

and deﬁne some requirements. In Section 7.2 we

present methods allowing insertion and deletion in

amortized efﬁcient time. For many applications this

is already efﬁcient enough. Within this section

the dynamization technique is explained in detail

and the amortized cost of the new operations are

shown. Similar ideas for the worst-case sensitive

approach are sketched in Section 7.3. The effort

of the dynamization itself is amortized over time.

For details see Klein

55

or the work of Overmars

72

and van Kreveld.

89

We present a simple example in

Section 7.4.

7.1 Model of the Dynamization

Let us assume that TStat is a static abstract (geo-

metric) data type. Since we have a geometric data

structure, we assume that the essential motivation

of TStat is a query operation on the set of stored

objects D. i.e., for a query object q the answer is

always a subset of D which might be empty.

We want to deﬁne the generic dynamization by a

module that imports the following operations from

TStat:

build(V, D): Build the structure V of type

TStat with all data objects in the

set D.

query(V, q): Gives the answer (objects of D) to

a query to V with query object q.

extract(V, D): Collects all data objects D of V in

a single set an returns a pointer to

this set.

erase(V): Delete the complete data structure

V from the storage.

The dynamization module should export a dy-

namic abstract (geometric) data type TDyn with

the following operations:

Build(W, D): Build the structure W of type

TDyn with data objects in

the set D.

Query(W, q): Gives the answer (objects of D) to

a query to W with query object q.

Extract(W, D): Collects all data objects D of W

in a single set and returns a

pointer this set.

Erase(W): Delete the complete data

structure W from the storage.

Insert(W, d): Insert object d into W.

Delete(W, d): Delete d out of W.

Note, that the new operations Delete and Insert

are necessary since we have a dynamic data type

now.

Additionally, we introduce some cost functions

for the operations of the abstract dynamic and the

abstract static data type. For example let B

V

(n) de-

notes the time function for the operation Build(V, D)

of TStat. The notations are fully presented in Fig-

ure 69. The cost functions depend on the imple-

mentation of TStat. Note, that the cost function of

TDyn will depend on the cost functions of TStat

together with the efﬁciency of the our general dy-

namization.

Modul

Dynamize

Comp.:

B

W

(n)

Q

W

(n)

E

W

(n)

I

W

(n)

D

W

(n)

ADT TDyn

Build(W, D)

Query(W, q)

Extract(W, D)

Insert(W, d)

Delete(W, d)

ADT TStat

build(V, D)

query(V, q)

extract(V, D)

Comp.:

B

V

(n)

Q

V

(n)

E

V

(n)

Space.: S

W

(n) Space: S

V

(n)

u

Import

Export

Figure 69: Dynamization in the generic sense.

In order to guarantee some bounds for the corre-

sponding cost functions of TDyn the cost functions

Siggraph 2003 Tutorial 16

46 Zachmann/Langetepe: Geometric Data Structures for CG

of TStat must not increase arbitrarily. On the other

hand for the proof of some time bounds we need

some kind of monotonic behavior in the functions,

they should not oscillate. Altogether we deﬁne the

following requirements which are fulﬁlled in many

cases:

1. Q

V

(n) and E

V

(n) increase monotonically in n;

examples: 1, log n,

√

n, n, n log n, n

2

, 2

n

.

2.

B

V

(n)

n

and

S

V

(n)

n

increase monotonically in n; ex-

amples n, n log n, n

2

, 2

n

.

3. For all f ∈ ¦Q

V

, B

V

, E

V

, S

V

¦ there is a constant

C ≥ 1, so that f (2n) ≤ C f (n); examples: 1,

√

n, n, n

2

, and also log n with n > 1, as well as

the products of this functions, but not 2

n

.

4. E

V

(n) ≤ 2 B

V

(n).

Moreover, we assume that the that the query op-

eration can be decomposed, i.e., for a decomposition

V = V

1

∪V

2

∪ ∪V

j

of the data set V the results

of the single operations query(V

i

, d) lead to the so-

lution of query(V, d). This is true for many kinds

of range queries.

7.2 Amortized Insert and Delete

7.2.1 Amortized Insert: Binary Structure

The very ﬁrst idea is to implement Insert(W, d)

and Delete(W, d) directly by

Insert(W, d) : Extract(W, D); Build(W, D∪ ¦d¦)

Delete(W, d) : Extract(W, D); Build(W, D` ¦d¦).

This throw-away implementation is not very ef-

ﬁcient. Therefore we distribute the n data objects of

the static structure V among several structures V

i

.

If a new element has to be inserted we hope that

only a single structure V

i

may be concerned. Let

n = a

l

2

l

+a

l−1

2

l−1

+. . . +a

1

2 +a

0

mit a

i

∈ ¦0, 1¦.

Then a

l

a

l−1

. . . a

1

a

0

is the binary representation

of n. For every a

i

= 1 we build a structure V

i

which

has 2

i

elements. The collection of these structures

is a representation of W

n

which is called binary

structure (see Figure 70). To build up the binary

structure W

n

we proceed as follows:

Build(W, D):

Compute binary representation of n = [D[.

Decompose D into sets D

i

with

[D

i

[ = 2

i

w.r.t. the representation of n.

Compute build(V

i

, D

i

) for every D

i

.

In principle, the binary structure W

n

can be con-

structed as quick as the corresponding structure V.

Lemma 10

B

W

(n) ∈ O(B

V

(n)).

Computing the binary representation of n and the

decomposition into D

i

can be done in linear time O(n).

The operation build(V

i

, D

i

) needs B

V

(2

i

) time.

We have i ≤ l = log n| and therefore we con-

clude:

log n|

∑

i=0

B

V

(2

i

) =

log n|

∑

i=0

2

i

B

V

(2

i

)

2

i

≤

log n|

∑

i=0

2

i

B

V

(n)

n

≤ 2

log n

B

V

(n)

n

∈ O(B

V

(n)).

We used the fact that

B

V

(n)

n

increases monotoni-

cally.

Altogether we have

B

W

(n) ∈ O(n + B

V

(n)) = O(B

V

(n))

since B

V

(n) is at least linear.

Similar results hold for some other operations.

We can prove

E

W

(n) ≤ log n E

V

(n)

the results of extraxt(V

i

) for at most log n struc-

tures V

i

.

Additionally,

Q

W

(n) ≤ log n Q

v

(n)

holds if we assume that the query can be decompose

as well, see the requirements.

It is also easy to see that

S

W

(n) ≤

log n|

∑

i=0

S

V

(2

i

) ∈ O(S

V

(n)).

Siggraph 2003 Tutorial 16

Zachmann/Langetepe: Geometric Data Structures for CG 47

2

4

2

3

2

2

2

1

2

0

W

23

W

24

V

0

V

1

V

2

V

4

V

4

V

3

Figure 70: The binary structure W

n

contains the structure V

i

if a

i

= 1 holds for the

binary representation of n. For examples see n = 23 (left) and n = 24

(right).

Therefore it remains to analyse I

W

(n).

As we have seen from Figure 70 sometimes the

whole structure of W

n

is destroyed when W

n+1

was

build up. In this example we had to perform the

following tasks:

extract(V

0

, D

0

); extract(V

1

, D

1

); extract(V

2

, D

2

);

D := D

0

∪ D

1

∪ D

2

∪ ¦d¦;

build(V

3

, D);

In general we have to build up V

j

and extract and

erase V

j−1

, V

j−2

, . . ., V

0

only if a

i

= 1 holds for

i = 0, 1 . . . , j − 1 and a

j

= 0 holds (in the binary

representation of the current n).

In this special case we have

I

W

(n) ≤

j−1

∑

i=0

E

V

(2

i

)

+Cj + B

V

(2

j

)

≤ E

V

(2

j

) +Cj + B

V

(2

j

)

∈ O

B

V

(2

j

)

.

For a long sequence of insertions many of them

are performed without extreme reconstructions. Thus

the effort for all Insert(W, d) is amortized over

time.

Generally, let Work be an arbitrary operation

with cost function W. For a sequence of s differ-

ent operations let Work be applied k times. If

total cost of k Work operationen

k

≤ W(s)

holds for a monotonically increasing cost function

W, we say that the operation Work is performed in

amortized time W(s).

Note, that this is not an expected value and that

W is a function of s, i.e., the length of the operation

sequence. The current data set may have a number

of elements n ≤ s.

For the Insert(W, d) operation one can prove

I

W

(s) ∈ O

log s

s

B

V

(s)

.

Note, that except insertions there are only queries

in s. Queries do not change the size of the data set

and so we can also replace s by the number of in-

sertions here.

Altogether, the results are presented in the fol-

lowing theorem.

Theorem 11 A static abstract data type as pre-

sented in Figure 69 can be dynamized by means

of the binary structure in a dynamic abstract data

type TDyn so that the operation Insert(W, d) is

performed in amortized time

I

W

(s) ∈ O

log s

s

B

V

(s)

.

Let n be the size of the current data set. We have

S

W

(n) ∈ log n S

v

(n)

B

W

(n) ∈ B

V

(n))

Q

W

(n) ∈ log n Q

v

(n).

7.2.2 Amortized Delete: Occasional

Reconstruction

Assume that we did not have implemented the Insert

operation, yet.

Siggraph 2003 Tutorial 16

48 Zachmann/Langetepe: Geometric Data Structures for CG

If we have to delete an object we can not choose

its location beforehand. Therefore the deletion of

an objects is much more difﬁcult than the insertion.

Deletion may cause fundamental reconstruction.

For many data structures it is easier to simply

mark an object as deleted. Physically the object re-

mains in the structure but does no longer belong to

the data set D. These objects have bad inﬂuence on

the running time of all operations although they

are no longer necessary. Therefore from time to

time we have to reconstruct the data structure for

the actual data set.

First of all, for TStat we introduce an addi-

tional operation weak.delete(V, d) with cost func-

tion WD

V

(n). We simply want to construct a

strong delete function with an acceptable amortized

time bound for TDyn.

Therefore we use weak.delete(V, d) until D has

only the half size of V. Then we erase V and build

a new structure V out of D. The cost of the oc-

casional reconstruction is amortized over the pre-

ceeding delete-operations. This gives the following

result.

Theorem 12 A static abstract data type as pre-

sented in Figure 69 with an additional operation

weak.delete(V, d) and with additional cost func-

tion WD

V

(n) can be dynamized by means of oc-

casional reconstruction in a dynamic abstract data

type TDyn so that

B

W

(r) = B

V

(r)

E

W

(r) ∈ O(E

V

(r))

Q

W

(r) ∈ O(Q

V

(r))

S

W

(r) ∈ O(S

V

(r))

D

W

(s) ∈ O

WD

V

(s) +

B

V

(s)

s

,

holds. The size of the current actual data set is de-

noted with r and s denotes the length of the opera-

tion sequence.

We omit the proof here.

7.2.3 Amortized Insert and Amortized Delete

In the preceeding sections we have discussed Insert

and Delete separately. Now we want to show how

to combine the two approaches.

A static abstract data type with a weak delete im-

plementation is given. As in Section 7.2.1 we use

the binary structure for the insertion. The opera-

tion weak.delete is only available for the structures

V

i

and we have to extend it to W in order to apply

the result of Section 7.2.2. If Weak.Delete(W, d) is

applied, d should be marked as deleted in W. But

we do not know in which of the structures V

i

the

element d lies. Therefore in addition to the binary

structure we construct a balanced searchtree T that

stores this information. For every d ∈ W there is a

pointer to the structure V

i

with d ∈ V

i

, an example

is shown in Figure 71.

The additional cost of the search tree T is covered

as follows. Query operations are not involved. For

Weak.Delete(W, d) there is an additional O(log n)

for searching the corresponding V

i

and for marking

d as deleted in V

i

.

If an object d has to be inserted we have to up-

date T. The object d gets an entry for its struc-

ture V

j

in T, this is done in time O(log n) and it

will not affect the time bound for the insertion.

But furthermore if V

0

, . . . , V

j−1

has to be erased

the corresponding objects should point to V

j

after-

wards. This can be efﬁciently realized by collecting

the pointers of T to V

i

in a list for every V

i

. We

collect the pointers and change them to "‘V

j

"’. This

operation is already covered by time O(B

V

(2

j

)) for

constructing V

j

.

Altogether we conclude:

Theorem 13 A static abstract data type as pre-

sented in Figure 69 with an additional operation

weak.delete(V, d) and with additional cost function

WD

V

(n) can be dynamized by means of binary

structure, searchtree T and occasional reconstruc-

tion in a dynamic abstract data type TDyn so that

the amortized time for insertion reads

I

W

(s) ∈ O

log s

B

V

(s)

s

,

and the amortized time for deletion reads

D

W

(s) ∈ O

log s +WD

V

(s) +

B

V

(s)

s

.

For the rest of the operations we have

B

W

(r) = B

V

(r)

E

W

(r) ∈ O(log r E

V

(r))

Q

W

(r) ∈ O(log r Q

V

(r))

S

W

(r) ∈ O(S

V

(r)) .

Siggraph 2003 Tutorial 16

Zachmann/Langetepe: Geometric Data Structures for CG 49

15

13

9

1 2 3 4 5 6 7 8

14

10 11 12

T

V

3

V

0

V

1

V

2

Figure 71: A structure W

15

with a searchtree T storing pointers to V

i

for every d ∈ V

i

.

The size of the current actual data set is denoted

with r and s denotes the length of the operation

sequence.

7.3 Worst-Case sensitive Insert and

Delete

In the last section we have seen that it is easy to

amortize the cost of Insert and Delete analytically

over time. The main idea for the construction of

the dynamic data structure was given by the binary

structure of W

n

which has fundamental changes

from time to time but the corresponding costs were

amortized. Now we are looking for the worst-

case cost of Insert and Delete. The idea is to dis-

tribute the construction of V

j

itself over time, i.e.,

the structure V

j

should be ﬁnished if V

j−1

, V

j−2

, . . .

V

0

has to be erased.

We only refer to the result of this approach. The

ideas are very similar to the ideas of the preceed-

ing sections. Technically, a modiﬁed binary repre-

sentation is used in order to distribute the effort

of the reconstruction over time. For the interested

reader we refer to Klein

55

or van Kreveld

89

and

Overmars.

72

Theorem 14 A static abstract data type as pre-

sented in Figure 69 with an additional operation

weak.delete(V, d) and with additional cost function

WD

V

(n) can be dynamized in a dynamic abstract

data type TDyn so that

Build(W, D) ∈ O(B

V

(n))

Query(W, q) ∈ O(log n Q

V

(n))

Insert(W, d) ∈ O

log n

n

B

V

(n)

Delete(W, d) ∈ O

log n +WD

V

(n) +

B

V

(n)

n

Space O(S

V

(n)).

Here n denotes the number of relevant, stored

data objects.

7.4 A Simple Example

For convenience, we take a simple example from

Section 2 and apply Theorem 14, thus implement-

ing worst-case sensitive insertion and deletion.

In Section 2.2 an easy implementation of the

static k-d-tree was presented with S

k-d

(n) = O(n)

and query time Q

k-d

(n) = O(

√

n + a), where a

represents the size of the answer (see Theorem 4).

Obviously, weak.delete(k-d, x) can be implemented

in O(log n) time, thus we obtain WD

k-d

(n) =

O(log n). Additionally we have B

k-d

(n) = O(n log n).

Let Dyn(k-d) denote the dynamic variant based

upon the statically implemented k-d-tree.

Application of Theorem 14 results in:

Build(Dyn(k-d), D) ∈ O(n log n)

Query(Dyn(k-d), q) ∈ O(

√

n log n + a)

Insert(Dyn(k-d), d) ∈ O

log

2

n

**Delete(Dyn(k-d), d) ∈ O(log n)
**

Space O(n).

References

[1] S. Ar, B. Chazelle, and A. Tal, Self-

Customized BSP Trees for Collision Detection,

Computational Geometry: Theory and Applica-

tions, 15 (2000), pp. 91–102.

[2] S. Ar, G. Montag, and A. Tal, Deferred,

Self-Organizing BSP Trees, in Eurographics, Sept.

2002, pp. 269–278. http://www.ee.technion.

ac.il/~ayellet/papers.html.

[3] J. Arvo and D. B. Kirk, Fast Ray Trac-

ing by Ray Classiﬁcation, in Computer Graphics

(SIGGRAPH ’87 Proceedings), M. C. Stone, ed.,

vol. 21, July 1987, pp. 55–64.

[4] F. Aurenhammer, Voronoi diagrams: A sur-

vey of a fundamental geometric data structure,

ACM Comput. Surv., 23 (1991), pp. 345–405.

Siggraph 2003 Tutorial 16

50 Zachmann/Langetepe: Geometric Data Structures for CG

[5] F. Aurenhammer and R. Klein,

Voronoi Diagrams, in Handbook of Com-

putational Geometry, J.-R. Sack and J. Ur-

rutia, eds., Elsevier Science Publishers B.V.

North-Holland, Amsterdam, 2000, pp. 201–

290. http://wwwpi6.fernuni-hagen.de/

Publikationen/tr198.pdf.

[6] J. Avro and D. Kirk, A survey of ray trac-

ing acceleration techniques, in An Introduction to

Ray Tracing, A. Glassner, ed., Academic Press, San

Diego, CA, 1989, pp. 201–262. ISBN0-12-286160-

4.

[7] L. Balmelli, J. Kovacevic, and

M. Vetterli, Quadtrees for Embedded Sur-

face Visualization: Constraints and Efﬁcient Data

Structures, in Proc. of IEEE International Confer-

ence on Image Processing (ICIP), vol. 2, Oct. 1999,

pp. 487–491.

[8] L. Balmelli, T. Liebling, and M. Vet-

terli, Computational Analysis of 4-8 Meshes

with Application to Surface Simpliﬁcation using

global Error, in Proc. of the 13th Canadian Confer-

ence on Computational Geometry (CCCG), Aug.

2001.

[9] G. Barequet, B. Chazelle, L. J.

Guibas, J. S. B. Mitchell, and A. Tal,

BOXTREE: A Hierarchical Representation for

Surfaces in 3D, Computer Graphics Forum, 15

(1996), pp. C387–C396, C484. ISSN 0167-7055.

[10] N. Beckmann, H.-P. Kriegel,

R. Schneider, and B. Seeger, The

R

∗

-tree: An efﬁcient and robust access method

for points and rectangles, in Proc. ACM SIGMOD

Conf. on Management of Data, 1990, pp. 322–331.

[11] J. Bernal, Bibliographic notes on Voronoi di-

agrams, tech. rep., National Institute of Standards

and Technology, Gaithersburg, MD 20899, 1992.

[12] J.-D. Boissonnat and M. Teillaud,

On the randomized construction of the Delaunay

tree, Theoret. Comput. Sci., 112 (1993), pp. 339–

354. http://www.inria.fr/cgi-bin/wais_ra_

sophia?question=1140.

[13] G. Borgefors, Distance transformations

in arbitrary dimensions, in Computer. Vision,

Graphics, Image Processing, vol. 27, 1984,

pp. 321–345.

[14] P.-T. Bremer, S. D. Porumbescu,

F. Kuester, B. Hamann, K. I. Joy,

and K.-L. Ma, Virtual Clay Modeling us-

ing Adaptive Distance Fields, in Proceedings of

the 2002 International Conference on Imaging

Science, Systems, and Technology (CISST 2002),

H. R. A. et al., ed., vol. 1, Athens, Georgia, 2002.

[15] P. J. C. Brown, Selective Mesh Reﬁne-

ment for Rendering, PhD dissertation, Em-

manuel College, University of Cambridge, Feb.

1998. http://www.cl.cam.ac.uk/Research/

Rainbow/publications/pjcb/thesis/.

[16] L. P. Chew, Constrained Delaunay triangula-

tions, Algorithmica, 4 (1989), pp. 97–108.

[17] , Guaranteed-quality mesh generation for

curved surfaces, in Proc. 9th Annu. ACM Sympos.

Comput. Geom., 1993, pp. 274–280.

[18] N. Chin, Partitioning a 3D Convex Polygon

with an Arbitrary Plane, in Graphics Gems III,

D. Kirk, ed., Academic Press, 1992, chapter V.2,

pp. 219–222.

[19] D. Cohen-Or, A. Solomovici, and

D. Levin, Three-Dimensional Distance Field

Metamorphosis, ACM Transactions on Graphics,

17 (1998), pp. 116–141. http://visinfo.zib.

de/EVlib/Show?EVL-1998-152.

[20] , Three-Dimensional Distance Field Meta-

morphosis, ACM Transactions on Graphics, 17

(1998), pp. 116–141. ISSN 0730-0301.

[21] M. de Berg, Linear Size Binary Space Parti-

tions for Fat Objects, in Proc. 3rd Annu. European

Sympos. Algorithms, vol. 979 of Lecture Notes

Comput. Sci., 1995, pp. 252–263.

[22] , Linear size binary space partitions for un-

cluttered scenes, Algorithmica, 28 (2000), pp. 353–

366.

[23] M. de Berg, M. van Kreveld,

M. Overmars, and O. Schwarzkopf,

Computational Geometry: Algorithms and Ap-

plications, Springer-Verlag, Berlin, Germany,

2nd ed., 2000.

[24] F. Dehne and H. Noltemeier, A com-

putational geometry approach to clustering prob-

lems, in Proc. 1st Annu. ACM Sympos. Comput.

Geom., 1985, pp. 245–250.

[25] A. K. Dewdney and J. K. Vranch, A

convex partition of R

3

with applications to Crum’s

problem and Knuth’s post-ofﬁce problem, Utilitas

Math., 12 (1977), pp. 193–199.

[26] H. Djidjev and A. Lingas, On computing

the Voronoi diagram for restricted planar ﬁgures,

in Proc. 2nd Workshop Algorithms Data Struct.,

vol. 519 of Lecture Notes Comput. Sci., 1991,

pp. 54–64.

[27] D. P. Dobkin and M. J. Laszlo, Prim-

itives for the manipulation of three-dimensional

subdivisions, Algorithmica, 4 (1989), pp. 3–32.

[28] R. A. Dwyer, Higher-dimensional Voronoi di-

agrams in linear expected time, Discrete Comput.

Geom., 6 (1991), pp. 343–367.

Siggraph 2003 Tutorial 16

Zachmann/Langetepe: Geometric Data Structures for CG 51

[29] H. Edelsbrunner, Algorithms in Combina-

torial Geometry, vol. 10 of EATCS Monographs

on Theoretical Computer Science, Springer-

Verlag, Heidelberg, West Germany, 1987.

[30] H. Edelsbrunner and N. R. Shah, In-

cremental topological ﬂipping works for regular

triangulations, Algorithmica, 15 (1996), pp. 223–

241.

[31] S. A. Ehmann and M. C. Lin, Accurate

and Fast Proximity Queries Between Polyhedra

Using Convex Surface Decomposition, in Com-

puter Graphics Forum, vol. 20, 2001, pp. 500–510.

ISSN 1067-7055.

[32] A. A. Elassal and V. M. Caruso, USGS

digital cartographic data standards - Digital Ele-

vation Models, Technical Report Geological Sur-

vey Circular 895-B, US Geological Survey, 1984.

[33] D. A. Field, Implementing Watson’s algo-

rithm in three dimensions, in Proc. 2nd Annu.

ACM Sympos. Comput. Geom., 1986, pp. 246–

259.

[34] S. Fortune, Voronoi diagrams and Delaunay

triangulations, in Computing in Euclidean Geom-

etry, D.-Z. Du and F. K. Hwang, eds., vol. 1 of Lec-

ture Notes Series on Computing, World Scientiﬁc,

Singapore, 1st ed., 1992, pp. 193–233.

[35] S. F. Frisken, R. N. Perry, A. P.

Rockwood, and T. R. Jones, Adap-

tively Sampled Distance Fields: A General Rep-

resentation of Shape for Computer Graphics, in

Siggraph 2000, Computer Graphics Proceedings,

K. Akeley, ed., Annual Conference Series, 2000,

pp. 249–254. http://visinfo.zib.de/EVlib/

Show?EVL-2000-61.

[36] H. Fuchs, Z. M. Kedem, and B. F.

Naylor, On Visible Surface Generation by

a Priori Tree Structures, in Computer Graphics

(SIGGRAPH ’80 Proceedings), vol. 14, July 1980,

pp. 124–133.

[37] D. Fussell and K. R. Subramanian,

Fast Ray Tracing Using K-D Trees, Technical Re-

port TR-88-07, U. of Texas, Austin, Dept. Of Com-

puter Science, Mar. 1988.

[38] A. S. Glassner, ed., An Introduction to Ray

Tracing, Academic Press, 1989.

[39] J. Goldsmith and J. Salmon, Automatic

Creation of Object Hierarchies for Ray Trac-

ing, IEEE Computer Graphics and Applications, 7

(1987), pp. 14–20.

[40] S. Gottschalk, M. Lin, and

D. Manocha, OBB-Tree: A Hierarchical

Structure for Rapid Interference Detection,

in SIGGRAPH 96 Conference Proceedings,

H. Rushmeier, ed., ACM SIGGRAPH, Aug. 1996,

pp. 171–180. held in New Orleans, Louisiana,

04-09 August 1996.

[41] L. J. Guibas and J. Stolfi, Primitives for

the manipulation of general subdivisions and the

computation of Voronoi diagrams, ACM Trans.

Graph., 4 (1985), pp. 74–123.

[42] H. W. Hamacher, Mathematische Lö-

sungsverfahren für planare Standortprobleme,

Verlag Vieweg, Wiesbaden, 1995.

[43] I. Hoff, Kenneth E., T. Culver,

J. Keyser, M. Lin, and D. Manocha,

Fast Computation of Generalized Voronoi Dia-

grams Using Graphics Hardware, pp. 375–376.

[44] K. E. Hoff III, T. Culver, J. Keyser,

M. Lin, and D. Manocha, Fast Com-

putation of Generalized Voronoi Diagrams Us-

ing Graphics Hardware, LA, California, Aug.8–

13 1999, pp. 277–286. http://www.cs.unc.edu/

~geom/voronoi/.

[45] J. Huang, Y. Li, R. Crawfis, S. C. Lu,

and S. Y. Liou, A complete distance ﬁeld rep-

resentation, in Proceedings of the conference on

Visualization 2001, 2001, pp. 247–254. ISBN 0-

7803-7200-X.

[46] P. M. Hubbard, Real-Time Collision Detec-

tion and Time-Critical Computing, in SIVE 95,

The First Worjshop on Simulation and Interaction

in Virtual Environments, no. 1, Iowa City, Iowa,

July 1995, University of Iowa, pp. 92–96.

[47] H. Inagaki, K. Sugihara, and

N. Sugie, Numerically robust incremental

algorithm for constructing three-dimensional

Voronoi diagrams, in Proc. 4th Canad. Conf.

Comput. Geom., 1992, pp. 334–339.

[48] B. Joe, 3-Dimensional Triangulations from Lo-

cal Transformations, SIAM J. Sci. Statist. Com-

put., 10 (1989), pp. 718–741.

[49] , Construction of Three-Dimensional De-

launay Triangulations Using Local Transforma-

tions, Comput. Aided Geom. Design, 8 (1991),

pp. 123–142.

[50] M. W. Jones and R. A. Satherley,

Shape representation using space ﬁlled sub-voxel

distance ﬁelds, pp. 316–325.

[51] T. C. Kao and D. M. Mount, Incre-

mental construction and dynamic maintenance of

constrained Delaunay triangulations, in Proc. 4th

Canad. Conf. Comput. Geom., 1992, pp. 170–175.

Siggraph 2003 Tutorial 16

52 Zachmann/Langetepe: Geometric Data Structures for CG

[52] N. Katayama and S. Satoh, The SR-tree:

An Index Structure for High-Dimensional Near-

est Neighbor Queries, in Proc. ACM SIGMOD

Conf. on Management of Data, 1997, pp. 369–380.

[53] T. L. Kay and J. T. Kajiya, Ray Trac-

ing Complex Scenes, in Computer Graphics (SIG-

GRAPH ’86 Proceedings), D. C. Evans and R. J.

Athay, eds., vol. 20, Aug. 1986, pp. 269–278.

[54] R. Kimmel, N. Kiryati, and A. M.

Bruckstein, Multi-Valued Distance Maps for

Motion Planning on Surfaces with Moving Obsta-

cles, IEEE Transactions on Robotics and Automa-

tion, 14 (1998), pp. 427–436.

[55] R. Klein, Algorithmische Geometrie, Addison-

Wesley, Bonn, 1997. http://www.oldenbourg.

de/cgi-bin/rotitel?T=24382.

[56] R. Klein, A. Schilling, and

W. Straer, Reconstruction and simpliﬁcation

of surfaces from contours, in Paciﬁc Graphics,

1999, pp. 198–207. http://cg.cs.uni-bonn.

de/publications/publication.asp?id=31.

[57] J. T. Klosowski, M. Held, J. S. B.

Mitchell, H. Sowrizal, and K. Zikan,

Efﬁcient Collision Detection Using Bounding Vol-

ume Hierarchies of k-DOPs, IEEE Transactions on

Visualization and Computer Graphics, 4 (1998),

pp. 21–36.

[58] T. Larsson and T. Akenine-Mller,

Collision Detection for Continuously Deforming

Bodies, in Eurographics, 2001, pp. 325–333. short

presentation.

[59] J.-C. Latombe, Robot Motion Planning,

Kluwer Academic Publishers, Boston, 1991.

[60] C. L. Lawson, Software for C

1

surface inter-

polation, in Math. Software III, J. R. Rice, ed., Aca-

demic Press, New York, NY, 1977, pp. 161–194.

[61] D. T. Lee and A. K. Lin, Generalized De-

launay Triangulation for Planar Graphs, Discrete

Comput. Geom., 1 (1986), pp. 201–217.

[62] S. Leutenegger, J. Edgington, and

M. Lopez, STR : A Simple and Efﬁcient Algo-

rithm for R-Tree Packing, in Proceedings of the

13th International Conference on Data Engineer-

ing (ICDE’97), Washington - Brussels - Tokyo,

Apr. 1997, pp. 497–507. ISBN 0-8186-7807-0.

[63] T.-Y. Li and J.-S. Chen, Incremental 3D

Collision Detection with Hierarchical Data Struc-

tures, in Proc. VRST ’98, Taipei, Taiwan, Nov.

1998, ACM, pp. 139–144.

[64] P. Lindstrom, D. Koller, W. Rib-

arsky, L. F. Hughes, N. Faust, and

G. Turner, Real-Time, Continuous Level of

Detail Rendering of Height Fields, in SIGGRAPH

96 Conference Proceedings, H. Rushmeier, ed.,

ACM SIGGRAPH, Aug. 1996, pp. 109–118. held

in New Orleans, Louisiana, 04-09 August 1996.

[65] P. Lindstrom and V. Pascucci, Visual-

ization of Large Terrains Made Easy, in Proc. IEEE

Visualization, San Diego, 2001.

[66] W. E. Lorensen and H. E. Cline,

Marching Cubes: A High Resolution 3D Surface

Construction Algorithm, in Computer Graphics

(SIGGRAPH ’87 Proceedings), M. C. Stone, ed.,

vol. 21, July 1987, pp. 163–169.

[67] G. Mller, S. Schfer, and W. D. Fell-

ner, Automatic Creation of Object Hierarchies

for Radiosity Clustering, Computer Graphics Fo-

rum, 19 (2000). ISSN 0167-7055.

[68] B. Naylor, J. Amanatides, and

W. Thibault, Merging BSP Trees Yields Poly-

hedral Set Operations, in Computer Graphics

(SIGGRAPH ’90 Proceedings), F. Baskett, ed.,

vol. 24, Aug. 1990, pp. 115–124.

[69] B. F. Naylor, A Tutorial on Binary Space

Partitioning Trees, ACM SIGGRAPH ’96 Course

Notes 29, (1996).

[70] M. Novotni and R. Klein, A Geometric

Approach to 3D Object Comparison, in Interna-

tional Conference on Shape Modeling and Appli-

cations, May 2001, pp. 167–175.

[71] R. Osada, T. Funkhouser,

B. Chazelle, and D. Dobkin, Matching

3D models with shape distributions, in Pro-

ceedings of the International Conference on

Shape Modeling and Applications (SMI-01),

B. Werner, ed., Los Alamitos, CA, May 7–11 2001,

pp. 154–166.

[72] M. H. Overmars, The Design of Dynamic

Data Structures, vol. 156 of Lecture Notes Com-

put. Sci., Springer-Verlag, Heidelberg, West Ger-

many, 1983.

[73] D. W. Paglieroni, Distance Transforms:

Properties and Machine Vision Applications,

CVGIP: Graphical Models and Image Processing,

54 (1992), pp. 56–74.

[74] I. J. Palmer and R. L. Grimsdale, Colli-

sion Detection for Animation using Sphere-Trees,

Computer Graphics Forum, 14 (1995), pp. 105–

116. ISSN 0167-7055.

[75] M. S. Paterson and F. F. Yao, Efﬁ-

cient binary space partitions for hidden-surface

removal and solid modeling, Discrete Comput.

Geom., 5 (1990), pp. 485–503.

Siggraph 2003 Tutorial 16

Zachmann/Langetepe: Geometric Data Structures for CG 53

[76] B. A. Payne and A. W. Toga, Dis-

tance ﬁeld manipulation of surface models, IEEE

Computer Graphics and Applications, 12 (1992),

pp. 65–71.

[77] F. P. Preparata and M. I. Shamos,

Computational Geometry: An Introduction,

Springer-Verlag, New York, NY, 1985.

[78] V. T. Rajan, Optimality of the Delaunay tri-

angulation in R

d

, in Proc. 7th Annu. ACM Sym-

pos. Comput. Geom., 1991, pp. 357–363.

[79] J. Revelles, C. Urena, and M. Las-

tra, An Efﬁcient Parametric Algorithm for Oc-

tree Traversal, in WSCG 2000 Conference Pro-

ceedings, University of West Bohemia, Plzen,

Czech Republic, 2000. http://visinfo.zib.de/

EVlib/Show?EVL-2000-307.

[80] N. Roussopoulos and D. Leifker,

Direct spatial search on pictorial databases using

packed R-trees, in Proceedings of ACM-SIGMOD

1985 International Conference on Management of

Data, May 28–31, 1985, LaMansion Hotel, Austin,

Texas, S. Navathe, ed., NewYork, NY10036, USA,

1985, pp. 17–31. ISBN 0-89791-160-1. http://

www.acm.org/pubs/articles/proceedings/

mod/318898/p17-roussopoulos/

p17-roussopoulos.pdf;http://www.acm.

org/pubs/citations/proceedings/mod/

318898/p17-roussopoulos/.

[81] R. Seidel, Constrained Delaunay triangula-

tions and Voronoi diagrams with obstacles, Tech-

nical Report 260, IIG-TU Graz, Austria, 1988.

[82] J. A. Sethian, An Analysis of Flame Propaga-

tion, PhD thesis, Dept. of Mathematics, University

of California, Berkeley, 1982. http://visinfo.

zib.de/EVlib/Show?EVL-1982-2.

[83] , Level Set Methods, Cambridge University

Press, 1996. http://visinfo.zib.de/EVlib/

Show?EVL-1996-149.

[84] , Level set methods and fast marching

methods, Cambridge University Press, 1999.

[85] M. I. Shamos, Computational Geometry,

ph.D. thesis, Dept. Comput. Sci., Yale Univ., New

Haven, CT, 1978.

[86] M. Tanemura, T. Ogawa, and

W. Ogita, A New Algorithm for Three-

Dimensional Voronoi Tesselation, J. Comput.

Phys., 51 (1983), pp. 191–207.

[87] E. Torres, Optimization of the Binary Space

Partition Algorithm (BSP) for the Visualization of

Dynamic Scenes, in Eurographics ’90, C. E. Van-

doni and D. A. Duce, eds., Sept. 1990, pp. 507–518.

[88] G. van den Bergen, Efﬁcient Collision

Detection of Complex Deformable Models using

AABB Trees, Journal of Graphics Tools, 2 (1997),

pp. 1–14.

[89] M. J. van Kreveld, New Results on Data

Structures in Computational Geometry, ph.D.

dissertation, Dept. Comput. Sci., Utrecht Univ.,

Utrecht, Netherlands, 1992.

[90] M. Wan, F. Dachille, and A. Kauf-

man, Distance-ﬁeld based skeletons for virtual

navigation, in Proceedings of the conference on

Visualization 2001, 2001, pp. 239–246. ISBN 0-

7803-7200-X.

[91] C. A. Wang, Efﬁciently updating the con-

strained Delaunay triangulations, BIT, 33 (1993),

pp. 238–252.

[92] C. A. Wang and L. Schubert, An optimal

algorithm for constructing the Delaunay triangu-

lation of a set of line segments, in Proc. 3rd Annu.

ACM Sympos. Comput. Geom., 1987, pp. 223–

232.

[93] D. F. Watson, Computing the n-Dimensional

Delaunay Tesselation with Applications to

Voronoi Polytopes, Comput. J., 24 (1981),

pp. 167–172.

[94] H. Weghorst, G. Hooper, and D. P.

Greenberg, Improved Computational Meth-

ods for Ray Tracing, ACM Transactions on Graph-

ics, 3 (1984), pp. 52–69.

[95] L.-Y. Wei and M. Levoy, Fast Texture

Synthesis Using Tree-Structured Vector Quanti-

zation, in Siggraph 2000, Computer Graphics Pro-

ceedings, K. Akeley, ed., Annual Conference Se-

ries, 2000, pp. 479–488. http://visinfo.zib.

de/EVlib/Show?EVL-2000-87.

[96] J. Wilhelms and A. V. Gelder, Octrees

for Faster Isosurface Generation Extended Ab-

stract, in Computer Graphics (San Diego Work-

shop on Volume Visualization), vol. 24, Nov. 1990,

pp. 57–62.

[97] C. Youngblut, R. E. Johnson,

S. H. Nash, R. A. Wienclaw, and

C. A. Will, Different Applications of

Two-Dimensional Potential Fields for Vol-

ume Modeling, Tech. Rep. UCAM-CL-TR-

541, University of Cambridge, Computer

Laboratory, 15 JJ Thomson Avenue, Cam-

bridge CB3 0FD, United Kingdom, Aug. 2002.

http://www.cl.cam.ac.uk/users/nad/pubs/.

[98] G. Zachmann, Real-time and Exact Collision

Detection for Interactive Virtual Prototyping, in

Proc. of the 1997 ASME Design Engineering Tech-

nical Conferences, Sacramento, California, Sept.

1997. Paper no. CIE-4306.

Siggraph 2003 Tutorial 16

54 Zachmann/Langetepe: Geometric Data Structures for CG

[99] , Rapid Collision Detection by Dynamically

Aligned DOP-Trees, in Proc. of IEEE Virtual Real-

ity Annual International Symposium; VRAIS ’98,

Atlanta, Georgia, Mar. 1998, pp. 90–97.

[100] , Minimal Hierarchical Collision Detection,

in Proc. ACM Symposium on Virtual Reality

Software and Technology (VRST), Hong Kong,

China, Nov.11–13 2002, pp. 121–128. http://

www.gabrielzachmann.org/.

[101] B. Zhu and A. Mirzaian, Sorting does not

always help in computational geometry, in Proc.

3rd Canad. Conf. Comput. Geom., Aug. 1991,

pp. 239–242.

Siggraph 2003 Tutorial 16

2

Zachmann/Langetepe: Geometric Data Structures for CG

Prerequisites

Participants of this course should be familiar with the basic principles of computer graphics and the type of problems in the area. Familiarity with computer programming is not required. The intended audience are practitioners working in 3D computer graphics (VR, CAD/CAM, entertainment, animation, etc.) and students from both computer graphics and computational geometry, possibly working on a master or PhD thesis.

Syllabus

Our goal is to familiarize practitioners and researchers in computer graphics with some very versatile and ubiquitous geometric data structures, enable them to readily recognize geometric problems during their work, modify the algorithms to their needs, and hopefully make them curious about further powerful treasures to be discovered in the area of computational geometry. In order to achieve these goals in an engaging yet sound manner, the general concept throughout the course is to present each geometric data structure in the following way: ﬁrst, the data strucure will be deﬁned and described in detail; then, some of its fundamental properties will be highlighted; after that, one or more computational geometry algorithms based on the data structure will be presented; and ﬁnally, a number of recent, representative and practically relevant algorithms from computer graphics will be described in detail, showing the utilization of the data structure in a creative and enlightening way. We have arranged the topics in roughly increasing degree of difﬁculty. The hierarchical data structures are ordered by increasing ﬂexibility, while the non-hierarchical topics build on each other. Finally, the last topic presents a generic technique for dynamizing geometric data structures. Detailed informations about the topics discussed and the corresponding presenters are given in the schedule below. Component 1. Component 2. Introduction Introduction – Zachmann/Langetepe. Quadtree/Octree Construction, complexity, balancing, navigation – Langetepe. Terrain visualization, iso-surface generation – Zachmann. Bounding volume hierarchies Deﬁnition, construction, hierarchical collision detection – Zachmann. Voronoi diagrams / Delaunay triangulations Deﬁnition, construction, generalizations, applications – Langetepe. NURBS tesselation, texture synthesis – Zachmann. Distance ﬁelds Deﬁnition, modelling, morphing – Zachmann. Dynamization of geometric data structures Deﬁnition, amortized Insert and Delete – Langetepe.

Component 3. Component 4.

Component 5. Component 6.

Siggraph 2003 Tutorial 16

Zachmann/Langetepe: Geometric Data Structures for CG

3

Contents

1 Introduction 2 Quadtrees and K-d-Trees 2.1 Quadtrees and Octrees . . . . . . . . 2.1.1 Deﬁnition . . . . . . . . . . . 2.1.2 Complexity and Construction 2.1.3 Neighbor Finding . . . . . . 2.2 K-d-Trees . . . . . . . . . . . . . . . 2.3 Height Field Visualization . . . . . . 2.4 Isosurface Generation . . . . . . . . 2.5 Ray Shooting . . . . . . . . . . . . . 2.5.1 3D Octree . . . . . . . . . . . 2.5.2 5D Octree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 5 5 5 6 6 6 7 10 11 12 13 15 16 17 17 19 20 20 20 21 22 24 24 25 25 25 26 28 28 29 29 30 31 32 32 34 34 34 34 35 36 36 38

3 BSP Trees 3.1 Rendering Without a Z-Buffer . . . . 3.2 Representing Objects with BSPs . . . . 3.3 Boolean Operations . . . . . . . . . . . 3.4 Construction Heuristics . . . . . . . . 3.4.1 Convex objects . . . . . . . . . 3.4.2 Cost driven heuristic . . . . . . 3.4.3 Non-uniform queries . . . . . 3.4.4 Deferred, self-organizing BSPs

4 Bounding Volume Hierarchies 4.1 Construction of BV Hierarchies . . . . . . 4.1.1 Bottom-up . . . . . . . . . . . . . 4.1.2 Insertion . . . . . . . . . . . . . . 4.1.3 Top-down . . . . . . . . . . . . . . 4.1.4 Construction criteria . . . . . . . . 4.1.5 The criterion for collision detection 4.2 Collision Detection . . . . . . . . . . . . .

5 Voronoi Diagrams 5.1 Deﬁnitions and Elementary Properties . . . . . . . . . . . . 5.1.1 Voronoi Diagram . . . . . . . . . . . . . . . . . . . . 5.1.2 Delaunay Triangulation . . . . . . . . . . . . . . . . 5.2 Computation . . . . . . . . . . . . . . . . . . . . . . . . . . 5.3 Generalization of the Voronoi Diagram . . . . . . . . . . . . 5.3.1 Voronoi Diagram and Delaunay Triangulation in 3D 5.3.2 Constrained Voronoi diagrams . . . . . . . . . . . . 5.3.3 Other Types of Generalizations . . . . . . . . . . . . 5.4 Applications of the Voronoi Diagram . . . . . . . . . . . . . 5.4.1 Nearest Neighbor or Post Ofﬁce Problem . . . . . . 5.4.2 Motion planning . . . . . . . . . . . . . . . . . . . . 5.4.3 Other Applications of the Voronoi Diagram in 2D . . 5.5 Texture Synthesis . . . . . . . . . . . . . . . . . . . . . . . 5.6 Shape Matching . . . . . . . . . . . . . . . . . . . . . . . .

Siggraph 2003 Tutorial 16

4

Zachmann/Langetepe: Geometric Data Structures for CG

6 Distance Fields 6.1 Computation and representation of DFs . 6.1.1 Propagation method . . . . . . . 6.1.2 Projection of distance functions . 6.2 Applications of DFs . . . . . . . . . . . . 6.2.1 Morphing . . . . . . . . . . . . . 6.2.2 Modeling . . . . . . . . . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

39 39 41 42 43 43 44 44 45 46 46 47 48 48 49

7 Dynamization of Geometric Data Structures 7.1 Model of the Dynamization . . . . . . . . . . . . . . 7.2 Amortized Insert and Delete . . . . . . . . . . . . . . 7.2.1 Amortized Insert: Binary Structure . . . . . . 7.2.2 Amortized Delete: Occasional Reconstruction 7.2.3 Amortized Insert and Amortized Delete . . . 7.3 Worst-Case sensitive Insert and Delete . . . . . . . . 7.4 A Simple Example . . . . . . . . . . . . . . . . . . .

Siggraph 2003 Tutorial 16

Zachmann/Langetepe: Geometric Data Structures for CG

5

1

Introduction

In recent years, methods from computational geometry have been widely adopted by the computer graphics community. Many solutions draw their elegance and efﬁciency from the mutually enriching combination of such geometrical data structures with computer graphics algorithms. This course imparts a working knowledge of a number of essential geometric data structures and explains their elegant use in several representative, diverse, and current areas of research in computer graphics such as terrain visualization, texture synthesis, modelling, and tesselation. Our selection of data structures and algorithms consists of wellknown concepts, which are both powerful and easy to implement, ranging from quadtrees to BSP trees and bounding volume trees. We do not try to provide an exhaustive survey of the topics touched upon here — this would be far beyond the scope of this course. Neither do we try to present leading edge algorithms because we feel that for practical purposes a good trade-off between simplicity and efﬁciency is important. Participants will learn to recognize geometric problems and develop a thorough understanding of suitable algorithms. As a prerequisite, they should already be familiar with the basic principles of computer graphics and the type of problems in the area. The general concept throughout the course is to present each geometric data structure in the following way: ﬁrst, the data strucure will be deﬁned and described in detail; then, some of its fundamental properties will be highlighted; after that, one or more computational geometry algorithms based on the data structure will be presented; and ﬁnally, a number of recent, representative and practically relevant algorithms from computer graphics will be described in detail, showing the utilization of the data structure in a creative and enlightening way.

A natural generalization of the one-dimenional search tree to k dimensions is shown in Section 2.2. The k-d-tree is efﬁcient for axis-parallel rectangular range queries. The quadtree description was adapted from de Berg et al.23 and the k-d-tree introduction was taken from Klein.55

**2.1 Quadtrees and Octrees
**

2.1.1 Deﬁnition A quadtree is a rooted tree so that every internal node has four children. Every node in the tree corresponds to a square. If a node v has children, their corresponding squares are the four quadrants, as shown in Figure 1.

NE

NW

SW

SE

Figure 1: An example of a quadtree. Quadtrees can store many kinds of data. We will describe the variant that stores a set of points and suggest a recursive deﬁnition. A simple recursive splitting of squares is continued until there is only one point in a square. Let P be a set of points. The deﬁnition of a quadtree for a set of points in a square Q = [x1 Q : x2Q ] × [y1 Q : y2 Q ] is as follows: • If |P| ≤ 1 then the quadtree is a single leaf where Q and P are stored. • Otherwise let Q NE , Q NW , QSW and QSE denote the four quadrants. Let xmid := (x1 Q + x2 Q )/2 and ymid := (y1Q + y2Q )/2, and deﬁne PNE := {p ∈ P : p x > xmid ∧ py > ymid }, PNW := {p ∈ P : p x ≤ xmid ∧ py > ymid }, PSW := {p ∈ P : p x ≤ xmid ∧ py ≤ ymid }, PSE := {p ∈ P : p x > xmid ∧ py ≤ ymid }. The quadtree consists of a root node v, Q is stored at v. In the following, let Q(v) denote the square stored at v. Furthermore v has four children: The X-child is the root of the quadtree of the set PX , where X is an element of the set {NE, NW, SW, SE}.

2

Quadtrees and K-d-Trees

Within this section we will present some fundamental geometric data structures. In Section 2.1, we introduce the quadtree structure. Its deﬁnition and complexity, the recursive construction scheme and a standard application are presented. Quadtrees and octrees have applications in mesh generation as shown in Section 2.3, 2.4, 2.5.

Siggraph 2003 Tutorial 16

where c 2 is the smallest distance between any two points in P and s is the side length of the initial square. the total number of leaves is one plus three times the number of internal nodes. The given node can also be internal.3 Neighbor Finding A simple application of the quadtree of a point set is neighbor ﬁnding. as deﬁned above. the depth of the tree is related to the distance between the points. Therefore. that is. if µ is a leaf. If µ is an internal node. Normally.or NWchild of its parent. First. This simple procedure runs in time O(d + 1). the quadtree is unbalanced. there is also a simple procedure that constructs a balanced quadtree out of a given quadtree T. Theorem 1 The depth of a quadtree for a set P of points in the plane is at most log( s/c) + 3 . at every depth we have at most n internal nodes that gives the node bound. we extend the neighbor search. which stores a set of n points.1. respectively. Suppose we want to ﬁnd the north neighbor of v. If the split operation cannot be performed well. east. For convenience let k = 2 and let us assume that all X. The task is equivalent to ﬁnding an adjacent square of a given square in the quadtree subdivision. Despite this effect. The quadtree construction can be easily extended to octrees in 3D. has O((d + 1)n) nodes and can be constructed in O((d + 1)n) time. Obviously.6 Zachmann/Langetepe: Geometric Data Structures for CG 2. Only the starting square has to be chosen adequately. 2. The cost of the recursive construction and the complexity of the quadtree depends on the depth of the tree. If v itself is the NEor NW-child of its parent. one square may have many such neighbors. This can be done in time O(d + 1)m and O(m) space if T has m nodes.2 K-d-Trees The k-d-tree is a natural generalization of the onedimenional search tree. The 3D equivalent of quadtrees are octrees. then its north neighbor is easy to ﬁnd. The squares of the node of a single depth cover the initial square.23 Similar results hold for octrees as well. v and v should be adjacent corresponding to the given direction and should also have the same depth. Theorem 3 Let T be quadtree of depth d. If there is no such node.or SW-child of its parent. the north neighbor we seek for is µ itself. Due to the degree 4 of internal nodes. given a node v and a direction. Recursively ﬁnd the north neighbor of µ of the parent of v. For convenience. The internal nodes of octrees have eight sons and the sons correspond to boxes instead of squares.1. v is a leaf and v should be a leaf as well. 2. can be found in O(d + 1) time.2 Complexity and Construction The recursive deﬁnition implies a recursive construction algorithm. then we proceed as follows. then the north neighbor of v is a child of µ. q Figure 2: The square q has many west neighbors. The neighbor of a given node v in T a given direction. For details see Berg et al.and Y-coordinates are different. Hence it sufﬁces to bound the number of internal nodes. The most time-consuming task in one step of the recursive approach is the distribution of the points. The algorithm works as follows. If v happens to be the SE. we want to ﬁnd the deepest node whose square is adjacent. Let D be a set of n points in Rk . ﬁnd a node v so that Q(v) is adjacent to Q(v ). that is. as shown in Figure 2. north. Theorem 2 A quadtree of depth d. Furthermore. Any internal node v has one or more points inside Q(v). we search for a Siggraph 2003 Tutorial 16 . south or west. The amount of time spent is only linear in the number of points and the O((d + 1)n) time bound holds. it is the NE.

Thus. height ﬁelds can be stored as triangular irregular networks (TINs) (see Figure 5). For example. With this order we recursively split the set into subsets of equal size in time O(log n). R(r) is the plane itself. which is the intersection of halfplanes corresponding to the path from the root to v. N − 1]2 → R. while distant parts should be rendered Siggraph 2003 Tutorial 16 . such as GIF. of height values. for the sons of r.384 or more (see Figure 4). or. The construction runs in time O(n log n). Additionally we have to test whether the points inside the subtree of v are inside Q. one of the standard forms in which the US Geological Survey publishes their data. the set of sites v ∈ D with v ∈ Q A special area in 3D visualization is the rendering of large terrains. x > s} = = D ∩ {X < s} D ∩ {X > s}. due to their much more complex structure. For every node v of the 2-d-tree we deﬁne the rectangle R(v). A range query with an √ axisparallel rectangle can be answered in time O( n + a). Altogether the following theorem holds: Theorem 4 A balanced k-d-tree for n points in the plane can be constructed in O(n log n) and needs O(n) space.Zachmann/Langetepe: Geometric Data Structures for CG 7 Y i g d 5 b c f k can be computed efﬁciently. y) ∈ D.and Y-coordinates. N ∈ I. y) ∈ D. known as the Digital Elevation Model (DEM). Each internal node of the tree corresponds to a split-line. We sort the X. we obtain a binary tree. of height ﬁelds.64 However. there are a few parts of the terrain that are very close. such a raw height ﬁeld is often stored in some image ﬁle format. For the root r. The efﬁciency of the k-d-tree with respect to range queries depends on the depth of the tree. The set of rectangles {R(l) : l is a leaf} gives a partition of the plane into rectangles. Then we split D by the split-line X = s into subsets: D<s = {(x. A height ﬁeld is usually given as a uniformlygridded square array h : [0. 2. so they can approximate any surface at any desired level of accuracy with fewer polygons than any other representation. j e a 5 10 X h x=5 x<5 5<x y=4 y<4 4<y y<5 y=5 5<y x=2 x<2 a y=3 y<3 e 2<x x<3 b 3<y c x=3 3<x x<8 d y=2 x=8 8<x j 2<y f x<7 g x=7 7<x y=6 y<6 k 6<y i y<2 h Figure 3: A k-d-tree for k = 2 and a rectangular range query. They can adapt much better to the detail and features (or lack thereof) in the height ﬁeld. while the majority of the visible terrain is at a larger distance. say le f t and right.32 Alternatively. if Q is an axisparallel rectangle. Every R(l) has exactly one point of D inside. more generally. A balanced k-d-tree can be easily constructed. we produce to halfplanes R(le f t) and R(right) and so on. as shown in Figure 3. We simply have to compute all nodes v with: R(v) ∩ Q = ∅. The nodes correspond to split lines. This structure supports range queries of axisparallel rectangles. split-value s of the X-coordinates. A regular grid is. We repeat the process recursively with the constructed subsets. The problem in terrain visualization is a low viewpoint directed at the horizon: then. x < s} D>s = {(x. for instance.3 Height Field Visualization For both sets we proceed with the Y-coordinate and split-lines Y = t1 and Y = t2 . where a denotes the size of the answer. TINs do not lend themselves as well as more regular representations to interactive visualization. Close parts of the terrain should be rendered with high detail. namely the 2-dtree of the point set D. In practice. where N is typically in the order of 16.

since they seem to be a good compromise between the simplicity of non-hierarchical grids and the good adaptivity of TINs. Thus. The general idea is to construct a quadtree over the grid. to triangulate each node. crack ) between the top left square and the ﬁne detail squares inside the top right square. or if we have to go down further. Triangulating them would help in theory. The vertices causing this problem are called T-vertices. but in practice this leads to long and thin triangles which have problems on their own. in particular. a data structure is needed that allows to quickly determine the desired level of detail in each part of the terrain. it should be balanced. One problem with quadtrees (and quadranglebased data structures in general) is that nodes are not quite independent of each other. Figure 7: A quadtree deﬁnes a recursive subdivision scheme yielding a 4-8 mesh. 4 8 Figure 6: In order to use quadtrees for deﬁning a height ﬁeld mesh.a.65 This yields a mesh where all vertices have degree 4 or 8 (except the with very little detail in order to maintain a high frame rate. Quadtrees are such a data structure. some 8 (hence the name). a quadtree offers a recursive subdivision scheme to deﬁne a triangulated regular grid (see Figure 7): start with a square subdivided into two right-angle triangles. with each recursion step. Assume we have constructed a quadtree over some terrain as Siggraph 2003 Tutorial 16 . The solution is.k. If we render that as-is. we decide whether the detail offered by rendering it is enough. In order to solve this problem. of course. At each node.15 T-vertices! Figure 5: The same height ﬁeld approximated by a TIN. subdivide the longest side of all triangles (the hypothenuse) yielding two new right-angle triangles each (hence this scheme is sometimes referred to as “longest edge bisection”). and then traverse this quadtree top-down in order to render it. depicted in Figure 6.8 Zachmann/Langetepe: Geometric Data Structures for CG Figure 4: A height ﬁeld approximated by a grid. then there will be a gap (a. Some vertices have degree 4. The dots denote the newly added vertices.

we will want In other words: you cannot subdivide one triangle alone. i } do not need to test the child vertices any more. every memory access that can submesh(i. Let M0 be the fully subdivided mesh (which corresponds to the original grid) and M be the current.j) Siggraph 2003 Tutorial 16 . border vertices). however. all its ancestors (remember: a vertex has 2 parents). During rendering. of course. j) ∈ M : (i . so it really would not make you render a vertex. cr ) where error(i) is some error measure for vertex i. this is easy to check. which is why such a mesh is often called a 4-8 mesh. and the interested reader is referred to. we will choose cells of the subdivision at different levels. again. j). where parent(j) = {i. j) ∈ M. long list of vertices that are then fed into memory as-is (for instance. Rendering such a mesh generates (conceptually) 2. Note that almost all vertices are created twice (see Figure 7). this is easy to detect. so pointers would not work at all. During rendering. Eventually. and Bi is the sphere around vertex i that completely encloses all descendant triangles. The solid lines connect siblings that share a common father. pseudo-code for the algorithm looks like this (simWe should keep in mind. you also have to subdivide the one on to store it as a single linear array for two reasons: the other side. We want to map the ﬁle that holds the tree into a single. The condition of being crack-free can be reformulated in terms of the DAGs associated with M0 and M: Figure 9: The red quadtree can be stored in the unused “ghost” nodes of the blue quadtree. with Unix’ mmap the graphics pipeline as a single triangle strip. then you also have to render sense to store it using pointers. then we ∀(i. Note that this algorithm can produce the same vertex multiple times consecutively. the algorithm has to copy older vertices to the current front of the list at places where it makes a “turn”. so all nodes in the graph have 4 children and 2 parents (except the border vertices). incompletely subdivided mesh. The function). (1) We still need to think about the way we store our terrain subdivision mesh. The tree is complete. that with curpliﬁed): rent architectures. this means that if 1. This will be denoted by an edge (i. M corresponds to a subset of the DAG of M0 . This subdivision scheme induces a directed acyclic graph (DAG) on the set of vertices: vertex j is a child of i if it is created by a split of a right angle at vertex i. In order to produce one strip. if error(i) < τ then return end if if Bi outside viewing frustum then return end if submesh( j.Zachmann/Langetepe: Geometric Data Structures for CG 9 red red blue level 0 1 2 3 4 blue Figure 8: The 4-8 subdivision can be generated by two interleaved quadtrees. cl ) V += pi submesh( j.65 M is crack-free ⇔ One can speed up the culling a bit by noticing M does not have any T-vertices ⇔ that if Bi is completely inside the frustum.

given the three vertices of a triangle.. In order to improve this. Assume for the moment that we are given a scalar ﬁeld f : R3 → R..64 Lindstrom and Pascucci.. several triangulations are possible. Lindstrom and Pascucci65 report that this is. In some cases. we will call these nodes “ghost nodes”. corner) has a value less than t and one node has a value greater than Siggraph 2003 Tutorial 16 . at least for terrain visualization. By doing all calculations in computational space. of course). which are the vertices generated by the second step of the 4-8 subdivision scheme. It turns out that by cleverly choosing the indices of the top-level vertices this can be done as efﬁciently as with a matrix layout. During rendering we need to calculate the indices of the child vertices.10 Zachmann/Langetepe: Geometric Data Structures for CG physical space ⊕ ⊕ ⊕ ⊕ ⊕ ? ⊕ ⊕ ⊕ node cell computational space ⊕ Figure 10: A scalar ﬁeld is often given in the form of a curvilinear grid. The simplest way to organize the terrain vertices is a matrix layout.. Such a curvilinear grid is usually stored as a 3D array. such as MRI or CT. Since we live in a discrete world (at least in computer graphics). and we have one scalar and a 3D point stored at each node (see Figure 10).8 Balmelli et al. except it is rotated by 45°. people often introduce some kind of blocking. The 4-8 subdivision scheme can be viewed as two quadtrees which are interleaved (see Figure 8): we start with the ﬁrst level of the “red” quadtree that contains just the one vertex in the middle of the grid.e. The task of ﬁnding an isosurface for a given value t in a curvilinear grid amounts to ﬁnding all cells of which at least one node (i. too. This process repeats logically. the scalar ﬁeld is usually given in the form of a curvilinear grid : the vertices of the cells are called nodes.4 Isosurface Generation One technique (among many others) of visualizing a 3-dimenional volume is to extract isosurfaces and render those as a regular polygonal surface. the cells are often called voxels ). not be satisﬁed by the cache is extremely expensive (this is even more so with disk accesses. Then the task of ﬁnding an isosurface would “just” be to ﬁnd all solutions (i. which is the one that is generated by the 4-8 subdivision with the ﬁrst step. 2. Unfortunately.e. which can be conceived as a regular 3D grid (here. They offer the advantage that vertices on the same level are stored fairly close in memory. Next comes the ﬁrst level of the “blue” quadtree that contains 4 vertices.7 and many others. The nice thing about them is that we can store the red quadtree in place of these ghost nodes (see Figure 9). The disadvantage is that there is no cache locality at all across the major index. It can be used to extract the surfaces of bones or organs in medical scans.65 Balmelli et al. where each block is stored in matrix and all blocks are arranged in matrix order. we can usually save a lot of computational effort. Figure 11: Cells straddling the isosurface are triangulated according to a lookup table. This reduces the number of unused elements in the ﬁnal linear array down to 33%. all roots) of the equation f (x) = t. Notice that the blue quadtree contains nodes that are outside the terrain grid. which must be resolved by heuristics. The interested reader can ﬁnd more about this topic in Lindstrom et al. Note that the blue quadtree is exactly like the red one.. When you overlay the red and the blue quadtree you get exactly the 4-8 mesh. worse than the simple matrix layout by a factor 10! Enter quadtrees.

A simple idea to avoid checking the ray against all objects is to partition the universe into a regular grid (see Figure 14). Each leaf ν stores the minimum νmin and the maximum νmax of the 8 nodes of the cell.e. So in the following. when we visit an edge for the ﬁrst time.. t. The leaves point to the lower left node of their associated cell (see Figure 12). and check the ray against all those objects that are stored with that cell. One problem is that we must not miss any little part of the isosurface. Notice that in this algorithm we have only used the 3D array — we have not made use at all of the information exactly where in space the nodes are (except when actually producing the triangles). 2. to ﬁnd the earliest hit of a given ray when following that ray through a scene composed of polygons or other objects. and in games for collision detection or terrain following. In this scheme (and others). the 3D array). Similarly. restrict ourselves to consider only regular grids. Therefore. and store the edge together with the vertex in a hash table. we remove it from the hash table. then Siggraph 2003 Tutorial 16 . So we need a data structure that allows us to discard large parts of the volume where the isosurface is guaranteed to not be. < t). in fact. But before doing an intersection test with an object. during traversal. Our observation also allows us to keep the size of the hash table fairly low: when an edge has been visited for the fourth time. we store the ray’s ID with the object whenever we have performed an intersection test with it.. then that Figure 13: Volume data layout should match the order of traversal of the octree.5 Ray Shooting Ray shooting is an elementary task that frequently arises in ray tracing. 3D arrays. We have.Zachmann/Langetepe: Geometric Data Structures for CG 11 y x=0 m0 m0 y=0 1 x Figure 12: Octrees offer a simple way to compute isosurfaces efﬁciently. without loss of generality. that is. we can. we will assume that the grid’s size is a power of two). edge will be visited exactly four times during the complete procedure. and triangulate it (if at all). use the eight signs as an index into the lookup table. Then. then consider each cell in turn. volume visualization. made a transition from computational space (i. we ﬁrst try to look up that edge in the hash table. we compute the vertex of the isosurface on that edge. The idea is to construct a complete octree over the cells of the grid96 (for the sake of simplicity. a simple algorithm works as follows:66 compute the sign for all nodes (⊕ > t. This already suggests how the algorithm works: start with the root and visit recursively all the children where the condition holds. So whenever we need a vertex on an edge. The question is. At the leaves. With each cell we store a list of objects that occupy that cell (at least partially). then we know that it cannot be visited any more. we just walk along the ray from cell to cell. how can we improve the exhaustive algorithm. Such cells are then triangulated according to a lookup table (see Figure 11).e. therefore. Observe that an isosurface intersects the volume associated with a node ν (inner or leaf node) if and only if νmin ≤ t ≤ νmax . the curvilinear grid) to computational space (i. The task is. we look into its mailbox whether or not the current ray’s ID is already there. This can be accelerated further by noticing that if the isosurface crosses an edge of a cell. if so. construct the triangles as usual. each inner node of the octree stores the min/max of its 8 children. This calls for octrees. basically. So. we need a technique called mailboxes that prevents us from checking the ray twice against the same object:38 every ray gets a unique ID (we just increment a global variable holding that ID whenever we start with a new ray).

the line interl sects a cell if and only if max{ti } < min{th }. which actually advance along the ray. xh ] × [yl . 2. though. Here.79 The idea is to work only with the ray parameter in order to decide which children of a node must be visited. In the following. All algorithms for ray shooting with octrees can be classiﬁed into two classes: • Bottom-up: this method starts at that leaf in the octree that contains the origin of the ray. later. zh ] In the following. only one polygon/object occupies the cell. z} 2 α (2) So. etc. we will describe the algorithm assuming that all di > 0. tm |th ) end for where tl |tm means that we construct the lower boundary for the respective cell by passing the appropriate components from tl and tm .1 3D Octree A canonical way to improve any grid-based method is to construct an octree (see Figure 15). j The algorithm can be outlined as follows: traverse( v. we have to make “horizontal” steps. tl . we need to compute only three new line parameters. maximum depth reached. Siggraph 2003 Tutorial 16 . we will describe a top-down method. Clearly. th ) compute tm determine order in which sub-cells are hit by the ray for all sub-cells vi that are hit do traverse( vi . the octree leaves store lists of objects (or. pointers to objects). observe that if we already have the line parameters of the intersection of the ray with the borders of a cell. for 8 children of a cell. we know that we have already performed the intersection test in an earlier cell. α ∈ {x. yh ] × [zl . the leaf rule for the octree construction process must be changed slightly: 1. we will show that the algorithm works also for all other cases. y. We can try to better approximate the geometry of the scene by changing the rule to stop only when there are no objects in the cell (or the maximum depth is reached). First of all. from there it tries to ﬁnd that neighbor cell that is stabbed next by the ray. Since we are dealing now with polygons and other graphical objects. How do we traverse an octree along a given ray? Like in the case of a grid. we will present two methods that both utilize octrees to further reduce the number of objects considered. • Top-down: this method starts at the root of the octree. we also need to make “vertical” steps. Let the ray be given by x = p + td and a voxel v by [xl . Here. With octrees. 2.5. which traverse the octree up or down. then it is trivial to compute the line intervals half-way in between (see Figure 16): tm = α 1 l h (t + tα ) . rather. those nodes and leaves that are stabbed by the ray.12 Zachmann/Langetepe: Geometric Data Structures for CG Figure 14: Ray shooting can be implemented efﬁciently with an octree. and tries to recurse down into exactly Figure 15: The same scenario utilizing an octree. or. tl |tm .

where “ex. This can be implemented efﬁciently by an XOR operation. +z. Using the direction cube.” means the exit side of the ray for the current sub-cell.e.6 Again. +y. only the case tlx > tl is depicted. Here. rays are essentially static objects. In 3D. S2 ↔ [−1.3. we ﬁrst need to determine which sub-cell is being hit ﬁrst by the ray. hence it is called direction cube (see Figure 19). simple algorithm. Siggraph 2003 Tutorial 16 . The nice thing about it is that we can now perform any hierarchical partitioning scheme that works in the plane. if one or both of the conditions of the second column hold. The ﬁrst column is the entering side determined in the ﬁrst step. Next. which are 5-dimenional objects. +1]2 × {+x. y 3 7 In order to determine the order in which subcells should be traversed. −z} In the previous. The third column yields the index of the ﬁrst sub-cell to be visited: start with an index of zero. we still walk along a ray every time we shoot it into the scene. we determine on which side the ray has been entering the current cell by Table 1. i. Figure 17: The sub-cell that must be traversed ﬁrst can be found by simple comparisons. In 2D.Zachmann/Langetepe: Geometric Data Structures for CG 13 h ty tm y tlx tl y th x tm x tm > tl y x tm < tl y x Figure 16: Line parameters are trivial to compute for children of a node. but is essentially the same. Consider a cube enclosing the unit sphere of all directions. −y. we determine the ﬁrst sub-cell to be visited by Table 2 (see Figure 18 for the numbering scheme). −x. this takes a little bit more work.. However. we can establish a oneto-one mapping between direction vectors and points on all 6 sides of the cube. we can traverse all sub-cells according to Table 3. First. If the ray direction contains a negative component(s). then the corresponding bit in the index as indicated by the third column should be set. it We will denote the coordinates on the cube’s side by u and v. The underlying technique is a discretization of rays. such as an octree: we just apply the scheme individually on each side. Then.2 5D Octree y 2 6 5 0 z 4 x Figure 18: Sub-cells are numbered according to this scheme. just like the geometry of the scene! This is the basic observation behind the following algorithm. We can identify any ray’s direction with a point on that cube. then we just have to mirror all tables along the respective axis (axes) conceptually. 2. Finally. this is accomplished by two comparisons (see Figure 17).5. makes use of octrees to adaptively decompose the problem. the comparison of tm with tm tells x y us which cell is next.

This just increases the number of false positives a little bit. +z. we must also partition its set of objects and assign each subset to one of the children. Observe that each node in the 5D octree deﬁnes a beam in 3-space: the xyz-interval of the ﬁrst three coordinates of the cell deﬁne a box in 3-space. Having computed the six 5D octrees for a given scene. d u v u v + = Figure 19: With the direction cube. we now build six 5-dimensional octrees as follows. −y. +1]2 × {+x. the node’s cell is too large. there are too many objects associated with it. ray tracing through that octree is almost trivial: map the ray onto a 5D point via the direction cube. it is almost trivial to deﬁne how objects are assigned to sub-cells: we just compare the bounding volume of each object against the sub-cells 3D beam. −x. and then checking the objects bounding sphere against that cone. +y. Within a given universe B = [0. Associate (conceptually) all objects with the root. Returning to our goal. Together (more precisely. If a node is partitioned. Since we have now deﬁned what a 5D cell of the octree represents. The test whether or not an object intersects a beam could be simpliﬁed further by enclosing a beam with a cone.14 Zachmann/Langetepe: Geometric Data Structures for CG Side XY l max{ti } condition tm z tm y < < tlx tlx index bits current sub-cell 0 1 2 3 4 5 6 7 YZ 4 5 6 7 ex ex ex ex exit side XZ XY 2 3 ex ex 6 7 ex ex 1 ex 3 ex 5 ex 7 ex 0 1 0 2 1 2 Side YZ XZ XY XZ YZ tlx tl y tl z tm < tl x y tm < tl z y tm < tlx y tm < tlx z Table 1: Determines the entering side. which can be implemented conveniently by 6 copies of 5-dimenional boxes. −z} (3) Figure 20: A uv interval on the direction cube plus a xyz interval in 3-space yield a beam. we can represent all possibly occurring rays by points in R = B × [−1. their Minkowski sum) they deﬁne a beam in 3-space that starts at the cell’s box and extends in the general direction of the cone (see Figure 20). Table 3: Determines the traversal order of the sub-cells. we can discretize directions. Note that an object can be assigned to several sub-cells (just like in regular 3D octrees). Partition a node in the octree. ﬁnd the leaf in that oc- Siggraph 2003 Tutorial 16 . and the remaining two uv-intervals deﬁne a cone in 3space. 1]3 (we assume it is a box). and organize them with any hierarchical partitioning scheme. start with the root of that octree which is associated to the side of the direction cube onto which the ray was mapped. Table 2: Determines the ﬁrst sub-cell. if 1. and 2.

like k-d trees. we would like to mention a memory optimization technique for 5D octrees. Another trick (that works with other ray acceleration schemes as well) is to exploit the fact that we do not need to know the ﬁrst occluder between a point on a surface and a light source. we have discarded all objects that do not lie in the general direction of the ray. If the minimum coordinate of an object along the dominant axis is greater than the current intersection point.75 3 BSP Trees BSP trees (short for binary space partitioning trees ) can be viewed as a generalization of k-d trees. this is not really necessary. If our input is a set of polygons. We maintain a cache for each level in the ray tree that stores the leaves of the 5D octrees that were visited last time.Zachmann/Langetepe: Geometric Data Structures for CG 15 tree that contains the 5D point (i. Then the BSP T(S) is deﬁned by 1. orientation and position of a splitting plane can be chosen arbitrarily. then we can stop — all other possible intersection points are farther away. resp. we have to make a trade-off between space and speed here. Deﬁnition 1 (BSP tree) Let S be a set of objects (points. The deﬁnition of a BSP (short for BSP tree) is fairly straight-forward. With BSPs. but now the Siggraph 2003 Tutorial 16 . Figure 23 shows an example for a set of objects. When following a new ray. we have much more freedom to place the splitting planes than with k-d trees. check the ray against all objects associated with that leaf. it is possible to show the following in 2D. but when chosen properly. Should a ray not hit any object.23. these can only be polygons. the convex region of one of the leaves has been highlighted as an example. we can just put those objects into both subsets. the cut-off distance should not reduce performance too much while still saving a signiﬁcant amount of memory.e. While an auto-partition can have Ω(n2 ) fragments. First of all. Obviously. or other spatial objects). we sort all objects associated with a leaf along the dominant axis of the beam by their minimum (see Figure 21). By locating a leaf in one of the six 5D octrees. h+ and h− denote the positive and negative half-space. This can readily be turned into a general algorithm for constructing BSPs. we can utilize ray coherence as follows. which is convex. If |S| > 1. Second. in 3D. But we can optimize the algorithm even further. In some applications though (such as ray shooting). Note that a splitting step (i. we will present a recursive deﬁnition. If |S| ≤ 1. polygons. and T + is the BSP for ν + the set of objects S+ := {x ∩ hν |x ∈ S}.e. T − is the BSP for the set of objects S− := {x ∩ h− |x ∈ S}. However. then a very common approach is to choose one of the polygons from the input set and use this as the splitting plane. Let h denote a plane in Rd . In Figure 23. before we start searching for it from the root.. then we start a new intersection query with another ray that has the same direction and a starting point just behind that maximum distance. Any occluder sufﬁces to assert that the point is in shadow. Note that with each node of the BSP a convex cell is associated (which is possibly unbounded): the “cell” associated with the root is the whole space. splitting a convex region into two parts yields two convex regions. instead. 2. Finally. or points). this also makes that decision much harder (as almost always in life). we ﬁrst look into the octree leaf in the cache whether it is contained therein. This is called an autopartition (see Figure 24). then the root of T is a node ν. ν also has two children T − and T + . the ray). and let S(ν) denote the set of objects associated with a node ν. then T is a leaf ν which stores S(ν) := S. To get a feeling for a BSP tree. the construction of an inner node) requires us to split each object into two disjoint fragments if it straddles the splitting plane of that node. ν stores a plane hν and a set S(ν) := {x ∈ S|x ⊆ hν } (this is the set of objects that lie completely inside hν . BSP trees are binary trees. groups of polygons. because they can occupy a lot of memory. It is based on the observation that within a beam deﬁned by a leaf of the octree the objects at the back (almost) never intersect with a ray emanating from that cell (see Figure 22). edges.. So we also keep a cache with each light source which stores that object (or a small set) which has been an occluder last time. Here. So we store objects with a cell only if they are within a certain distance.

we will describe how to solve this polygons such that any BSP (not just auto-partitions) must have Ω(n2 ) many fragments (see Figure 24 problem.16 Zachmann/Langetepe: Geometric Data Structures for CG 1 2 3 4 Figure 21: By sorting objects with in each 5D leaf.36 At the time. However. but because it nicely exhibits one for a “bad” example for auto-partitions). one can construct sets of costly in terms of memory. we can often stop checking ray intersection quite early. of the fundamental “features” of BSP trees: they Siggraph 2003 Tutorial 16 . 3. all of these examples producing quadratic BSPs violate the principle of locality : polygons are small compared to the extent of the whole set. because a z-buffer was just too a similar result. hidden-surface removal was still a major obstacle towards interactive In higher dimensions. Figure 22: By truncating the beam (or rather.69 Figure 24: Left: an auto-partition. the list of objects) we can save a lot of memory usage of a 5D octree. while reducing performance only insigniﬁcantly. In this section. it is not possible to show computer graphics. not so much because the application itself is relevant today. In practice. Right: an example conﬁguration of which any auto-partition must have quadratic size. Lemma 1 Given a set S of n line segments in the plane. near polygons h1 h3 h4 h2 h4 h3 h2 far polygons h1 Figure 23: An example BSP tree for a set of objects. In fact. the expected number of fragments in an auto-partition T(S) is in O(n log n). it can be constructed in time O(n2 log n). no BSPs have been observed that exhibit the worst-case quadratic behavior.1 Rendering Without a Z-Buffer BSP trees were introduced to computer graphics by Fuchs et al. Figure 25: BSP trees are an efﬁcient data structure encoding visibility order of a set of polygons.

e. because we know that the left child of such a pseudo-leaf will be “in” and the right one will be “out”. In the next section. But in order to actually save work. for instance. In this section. we should make use of the viewing direction by skipping BSP branches that lie completely behind the viewpoint. then traverse the other branch containing the viewpoint (see Figure 25). they are completely “in” our “out”. and this part is drawn on the screen. Furthermore. and that the right child of a BSP node lies in the positive half-space and the left child in the negative halfspace. we also need to maintain a 2D BSP for the screen that allows us to quickly discard those parts of a polygon that fall onto a screen area that is already occupied. splitting it into smaller and smaller convex parts until it reaches the leaves. except that here we stop the construction process (see Deﬁnition 1) only when the set is empty. is the painter’s algorithm : render the scene from back to front as seen from the current viewpoint. We can also perform view-frustum culling by testing all vertices of the frustum against the plane of a BSP node. 1 Actually. it is ﬁrst run through the screen BSP. we will follow the convention that normals point to the “outside”.1 A simple algorithm to render a set of polygons with correct hidden-surface removal. if it reaches a free leaf. thus effectively hiding the polygons in the back. To remedy this. in a real implementation that adheres to these conventions.. i. build an auto-partition). although only the last write “survives”. to determine whether or not a given a point is inside an object. These leaves represent homogeneous convex cells of the space partition. 3. Front polygons will just overwrite the contents of the frame buffer. it consists only of a “free” root node. Siggraph 2003 Tutorial 16 . we can perform back-face culling as usual (which does not cause any extra costs). for instance. First of all. it is very easy and efﬁcient. When a new polygon is to be rendered. we mark all cells either “free” or “occupied”. ﬁrst traverse the branch that does not contain the viewpoint. Another problem with the simple algorithm is that a pixel is potentially written to many times (this is exactly the pixel complexity ). we must traverse the BSP from front to back. If a part reaches a leaf that is already occupied. 3 1 out out 6 in in 7 out 4 2 in 5 1 5 out in out 7 in out 2 4 out in 6 out 3 out out Figure 26: Each leaf cell of BSP representation of an object is completely inside or completely outside. Initially. we will describe an algorithm for solving a slightly more difﬁcult problem.2 Representing Objects with BSPs BSPs offer a nice way to represent volumetric polygonal objects. we can still stop the construction when only one polygon is left. we can efﬁciently compute these boolean operations on solids.e. this is almost trivial: starting from the root. they have an “inside” and an “outside”. we would like to mention a few strategies to optimize this algorithm. Such a BSP representation of an object is just like an ordinary BSP for the set of polygons (we can. then render the polygon stored with the node. Given such a representation. nothing happens. but we will deal with that later. the ﬁrst version of Doom used exactly this algorithm to achieve its fantastic frame rate (at the time) on PCs even without any graphics accelerator. For sake of completeness. which are objects consisting of polygons that are closed.Zachmann/Langetepe: Geometric Data Structures for CG 17 enable efﬁcient enumeration of all polygons in visibility order from any point in any direction. A B ∪ ∩ \ Figure 27: Using BSPs. How can we efﬁciently obtain such a visibility order of all polygons? Using BSP trees. So. then it is inserted beneath that leaf. and without a z-buffer.. There are polygon conﬁgurations where this kind of sorting is not always possible. In that 2D screen BSP. i. Figure 26 shows an example for such a BSP representation.

This can be computed efﬁciently using the BSP representation of objects.69 Furthermore. Figure 28: The fundamental step of the construction is this simple operation. Computing P ∩ R(T + ) might seem very expensive. H. p T .. + → → Figure 30: Computation of boolean operations is based on a general merge operation. T ⊕ ) ← (T + . T − . all regions R(L j ) Siggraph 2003 Tutorial 16 .18 Zachmann/Langetepe: Geometric Data Structures for CG H T First. T+ T ∩ H + (see Figure 28). The ﬁrst step is a sub-procedure for computing the following simple operation: given a BSP T and a plane H. 3. T + ). T +⊕ ) ← split-tree(T + . T +⊕ ) ← split-tree(T + . which basically amounts to ﬁnding the two edges that intersect with HT . T + = left and right child of T. where H is the splitting plane. P ) → (T . We will present the algorithm for boolean operations bottom-up in three steps.68./pos. \. we need to deﬁne some nomenclature: T − . but it is really pretty simple. R(T) H HT pT "anti-parallel on" H P pT "pos. resp. T ⊕ ) end case This might look a little bit confusing at ﬁrst sight. T + ) ← (HT . Let Ci denote the set of elementary cells of a BSP. where op ∈ {∪. and computes p ∩ H + and p ∩ H − . T + ) T ⊕ ← T +⊕ case “mixed” : (T + . T −⊕ . The polygon P is only needed in order to ﬁnd the case applying at each recursion. P ∩ R(T + )) (T − . More generally." "mixed" HT H HT Finally. H. a very frequent task is to compute the intersection or union of a pair of objects. we want to compute C := A op B. p T ∩ H − . ∩.3 Boolean Operations In solid modeling. T +⊕ ) "leaf" Figure 29: The main building block of the algorithm consists of these four cases (plus analogous ones). resp./pos. T − ) case “pos. P ∩ R(T − )) T T⊕ ← (HT . The previous algorithm is already the main building block of the overall boolean operation algorithm. the algorithm is almost the same for all of these operations: only the elementary step that processes two leaves of the BSPs is different. classiﬁes the case found at each recursion. it can be computed quite efﬁciently by computing + P ∩ HT . H. However. T) case “anti-parallel” and “on” : return (T . T − . T ⊕ ) ← (T. such that ˆ ˆ T− T ∩ H− . p is the polygon associated with T (with p ⊂ H). of which the code details 4 (see Figure 29): split-tree( T. The pseudo-code below is organized into 8 cases. } (see Figure 27). return (T .e. It seems surprising at ﬁrst sight that function split-tree does almost no work — it just traverses the BSP tree. Please see Chin18 for more details on how to detect the correct case. T −⊕ ) ← split-tree(T − . p T . which merges a BSP and a plane. Since ˆ we will not need the new tree T explicitly. R(T) = region of the cell of node T (which is convex) T ⊕ . H) T ← (HT . i. given two objects A and B. This basically splits a BSP tree by a plane and then puts that plane at the root of the two halves. The next step towards that end is an algorithm that performs a so-called merge operation on two BSP trees T1 and T2 . T =portion of T on the positive/negative side of H. we will describe only the splitting procedure (which is the bulk of the work anyway). we would like to deﬁne a node T by the tuple (HT . conˆ struct a new BSP T whose root is H. T − .” : (T + . p T ∩ H + . T ⊕ ) {P = H ∩ R(T)} case T is a leaf : return (T . A few notes might be in order.

T3 . The following pseudo-code describes this recursive procedure more formally: merge( T1 . 3. and we obtain two pairs of BPSs. The merge operation consists of two cases.21.4 Construction Heuristics The function cell-op is the only place where the semantic of the general merge operation is specialized. T2 ) ← split-tree(T2 . The following table lists the details of this function (assuming that T1 is the leaf): One can prove that in general. objects with bounded aspect ration) and “uncluttered” scenes admit a BSP with linear size.) − − T3 ← merge(T1 . the construction strategy should produce “good” BSPs. the “hidden” constants do matter. auto-partitions have the same complexity as other partitionings.22 However. . of tree Ti where L j are all the leaves. When we have reached that point. c2 ∈ C2 . . i. so we can just replace it by the other node’s sub-tree suitably modiﬁed according to the boolean operation. it has been proven that “fat” objects (i. Then the merge of T1 .. then we know that one of the two cells is homogeneous. that are smaller. we just split one of the two with the splitting plane from the root of the other. or whether or not a line intersects with an object. there are two kinds of applications: • Classiﬁcation: These are applications where the BSP is used to determine the inside/outside status of a point. T2 ) → T3 if T1 or T2 is a leaf then perform the cell-op as required by the boolean operation to be constructed (see below) else ⊕ (T2 . those two pairs can be merged recursively (see Figure 31). T2 yields a new BSP tree T3 such that C3 = {c1 ∩ c2 |c1 ∈ C1 . In the other case. completely inside or outside. case occurs when one of the two operands is a leaf: then at least one of the two regions is homogenous. we would like to point out that the merge function is symmetric: it does not matter whether we partition T2 with H1 or.23. . both trees are inhomogenous over the same region of space: then. T3 ) end if Operation ∪ ∩ \ T1 in out in out in out in out Result T1 T2 T2 T1 c T2 T1 c T2 T2 Furthermore. So. Depending on the application itself. Siggraph 2003 Tutorial 16 .e. for practical applications. and still cover the same regions in space.e. c1 ∩ c2 = ∅} (see Figure 30).Zachmann/Langetepe: Geometric Data Structures for CG 19 split merge merge combine Figure 31: A graphical depiction of the merge step in the algorithm for boolean operations on objects represented by BSP trees. T2 ) − + T3 ← (H1 . almost trivial. the deﬁnition of exactly what a “good” BSP tree is can be quite different.. T1 with H2 — the result will be the same. however. Basically. The ﬁrst.75 In addition. the other way round. T2 ) + ⊕ + T3 ← merge(T1 . H1 .

This is a valid assumption if nothing is known about the distribution. then we should make use of this and construct the BSP such that frequent queries can be answered most quickly. Therefore. If the BSP is to be an auto-partition. 0.). takes time O(n2 ) to construct. . β are two parameters that can be used to make the BSP more balanced or smaller. then we can balance the BSP much better. This probability depends. one needs to deﬁne the quality of a BSP. s the set of polygons split by a node. 4 are usually good values to start from. . 3. and add a penalty for polygons that are split by the current node. we believe that their heuristic has some ﬂaws. On the other hand.95 and β = 4 . The following table shows the actual complexities for some values of α: α 0. in the case of inside/outside queries P(T − ) = Vol(T − ) Vol(T) Obviously. the size of the BSP. For instance. (69 reports that 1 3 α = 0.1 Convex objects As an example. An abstract measure is the cost of a BSP T C(T) = 1 + P(T − )C(T − ) + P(T + )C(T + ) (4) where S is the set of polygons associated with a node.e. such that on both sides are about the same number of points. on the application the BSP is going to be used for. . 3. the question now is how to choose the splitting planes. consider an convex object. . etc.36 Randomly choose k polygons from S and select the one that produces the least number of splits. Determine a plane. and is a linear tree.4 n7 As mentioned above.. and such that all points are far away from the plane (obviously. the rationale being that the probability that a polygon gets split is proportional to its size.2 n2 0.4. and α.4. Siggraph 2003 Tutorial 16 . . trying to optimize Equation 4 globally is prohibitively expensive. an auto-partition has size O(n). The same principle is underlying the Huffman encoding scheme.4. We propose the following simple heuristic:2 Compute a representative vertex for each polygon (barycenter. this is yields an optimization process. In that caese.2 Cost driven heuristic In order to derive construction criteria.87 However.3 3 where P(T − ) is the probability that the left subtree T − will be visited under the condition that the tree 2 For the case of convex objects.8. They report that k = 5 yielded near-optimal BSPs (for visibility ordering). obviously. we assumed that all queries are uniformly distributed over a certain domain.05 n1. Consequently. If we allow arbitrary splitting planes.15 0.) Again.3 Non-uniform queries In the previous section. This does not seem to be a very smart BSP (although it is perfectly suitable for visibility ordering). we try to minimize the number of splits. a local heuristic must be employed to guide the splitting process. of course. .20 Zachmann/Langetepe: Geometric Data Structures for CG In this case. but now it only a local process. . then a very quick approximization of the local optimum yields very good results: just sort the polygons according to their size and evaluate Equation 5 for the ﬁrst k polygons. The construction time will be T(n) = n + 2T( n + αn) ∈ O(n1+δ ) . bbox center. we try to optimize the balancedness of the BSP. An even simpler heuristic was proposed by. so that C(T) = 1 + |S− |α + |S+ |α + βs (5) where α is the fraction of polygons that are split at each node. Then. so we try to get rid of them as early as possible. a heuristic has already been proposed by. choose the one that produces the least costly BSP (subtree). i. A simple heuristic is the following:69 estimate the cost of the subtrees by the number of polygons. • Visibility: These are applications where the BSP is used to sort the polygons in “visibility order” such as rendering without z-buffer. this is an optimization). 0 < α < 2 n 2 T has been visited (dito for P(T + )). . 3. if we know more about it.

Now we need to ﬁll in the open issues. 3. quite often we know more about the queries. polygons with a higher probability of getting hit by the ray tend to end up higher in the tree. what should we do if we just don’t know the usually not uniformly distributed in space. So the algorithm for constructing a BSP adapted to a given distribution is the following randomized greedy strategy: sort all polygons according to score(p). if 2. or it could be now also triggers the construction of the BSP: derived from the geometry. l) = sin2 (n p .ν) if ν is a leaf then for all P ∈ Lν do if R intersects P then return hit end if end for else ν1 ← child of ν that contains startpoint of R ν2 ← other child testray(R.. If the angle between a ray and a polygon is large. this could be measured. i. we only build as much of the BSP that within cavities or completely inside. rior of objects.4 Deferred. they usually do not emanate from the intesure it by experiments? The answer is.ν1 ) if no hit in ν1 then testray(R. .1 we can estimate the costs of a tory (in some form) of all the queries we have seen query by so far. of course. tecting intersections between a 3-dim. choose randomly one out of the “top k“ and split the set S. or.Zachmann/Langetepe: Geometric Data Structures for CG 21 Indeed. the starting points are Now. l)ω(l)dl where the weight w is deﬁned as w(S.ν2 ) end if end if Since the line segment is ﬁnite (in particular.4 Since a BSP is now no longer completely conhits a polygon are structed before we use it. Let S be the set of polygons over which the BSP is to be built. is absolutely necessary. we should minimize the number of stabbed leaf cells before a polygon hit occurs. but the details have been omitted here. In addition. of the object/universe). 2. Let ω(l) denote the density of all rays l over some The algorithm for answering queries with a ray R domain D.2 As an example. in object are hit more frequently than those that are other words. or if it is too expensive to meastance. because we are only interested in a yes/no answer. The initial BPS is just one node (the root) with L = S. according to this. but the queries have to visit only 2 − −10× less polygons. then the probability is large. p.e. let us consider the problem of deSo. p. . so whenever we have to build a new part of the BSP we base the construction on that history C(query) = # nodes visited (as a best guess of the probability distribution of all ≤ depth(BSP) · # stabbed leaf cells queries to come). we keep a hisAccording to. self-organizing BSPs For instance. If the polygon is large (relative to the total size it is a preliminary leaf. all polygons of the object or scene. for which the subtree has not been built yet.4. Thus. Also. 1. for inquery distribution. the polygon P deﬁning the splitting plane. Assign to each polygon p a score score(p) = D w(S.1 The authors report that it usually has about 2× as many polygons as its “oblivious” version. the nodes must store ad1. line segment The factors inﬂuencing the probability that a ray and a set of polygons. a list L ⊆ S of polygons associated with it. 3. in particular in the game programming industry. the prominent polygons of an to defer the complete construction of the BSP. . . The BSP thus constructed has been named customized BSP by. rl ) Area(p) Area(S) and n p is the normal of p and rl is the direction of l. ditional information: then the probability is large. if it is short). namely: 4 Sometimes. this algorithm can usually stop much earlier. Siggraph 2003 Tutorial 16 testray(R. in ray tracing. while in ray tracing we want to determine the earliest intersection. this is also called “collision detection”.

such as quadtrees or BSP trees: instead of partitioning space. The threshold e is often set to 1. Another parameter in the deﬁnition is the arity. we will argue at the end that BV hierarchies are just at the other end of a whole spectrum of hierarchical data structures. geographical data bases. bounding volume hierarchies (BVHs) are mostly used to prevent performing an operation exhaustively on all objects. then we use the ﬁrst polygon from Lν as the splitting plane. The threshold can be an absolute value or relative to the sum of all counters. on } be a set of elementary objects. can also be answered.22 Zachmann/Langetepe: Geometric Data Structures for CG 1. Just like sorting. If |O| = e. Mostly. then BVH(O) := a leaf node that stores O and a BV of O. the optimum can be larger. control the balance between linear search/operation 4 Bounding Volume Hierarchies Like the previous hierarchical data structures. Often times. then we split that node (leaf). such as ray shooting. the optimal e can be much larger. For the “how” question: we keep a counter per polygon P ∈ Lν . There are other ways to organize the polygon lists at the leaves: move the polygon currently being hit to the front of the list. with this algorithm. bounding volume (BV) hierarchies are described as the opposite of spatial partitioning schemes. BV hierarchies are constructed as binary trees. or. objects can be anything from points to complete graphical objects. If |O| > e. . as the deﬁnition suggests. but depending on the application. AABB sphere DOP OBB spherical shell convex hull prism cylinder intersection of other BVs Figure 32: Some of the most commonly used BVs. when the set of objects is small. where each child νi is a BV hierarchy BVH(Oi ) over a subset Oi ⊂ O. and collision detection (the latter will be discussed in more detail below). met.2 the performance gain in their experiments was a factor of about 2–20. The deﬁnition mentions two parameters. which can be implemented with space partitioning schemes. view frustum and occlusion culling. occlusion culling. a BSP subtree will never be “wasted” on these polygons. which gets incremented every time that node is traversed during a query. is deﬁned by 1. νn . one can improve a huge range of applications and queries using BVHs. then BVH(O) := a node ν with n(ν) children ν1 . Siggraph 2003 Tutorial 16 . . In addition. 2. With BV hierarchies. but again. However. and they will be stored at the end of the lists at the leaves. . BVH(O). swap it with the one in front of it. too. ν stores a BV of O. almost all queries. frustum culling. and some less often used ones. this can be done incrementally whenever one of the counters changes. We sort Lν according to this counter. although this often simpliﬁes implementations considerably. the outdegree of nodes in a BV hierarchy does not necessarily have to be constant. when do we split a preliminary leaf? (and which one?) 2. . Therefore. A bounding volume hierarchy for O. nearestneighbor search. it is often cheaper to perform the operation on all of them. Deﬁnition 2 (BV hierarchy) Let O = {o1 . . which is incremented every time an intersection with P is found. point location queries.2 the strategy that sorts the list seemed to work best. According to. Whenever one of the counters is over a certain threshold.5 Here. . according to. It turns out that many polygons are never hit by a line segment. these two parameters. point location. how do we split? For the “when” question: we keep an access counter per node. the idea is to partition the set of objects recursively until some leaf criterion is 5 However. If a split is to be performed for ν. Effectively. e and n(ν). And what is more. because recursive algorithms always incur some overhead. nearest neighbor. such that Oi = O. Like with previously discussed hierarchical data structures. . Example queries and operations are ray shooting. collision detection. .

this may not always be avoidable. they are the intersection of k slabs. For inner nodes.. Let h(B. this means. But if possible.52 There are three characteristic properties of BVs: • tightness. Finally. Depending on the application. Instead. The worst case is depicted in Figure 34. The Hausdorff distance from an OBB to an enclosed be the directed Hausdorff distance. i.e.. i. g) b∈B g∈G d is any metric. A spherical shell is the intersection of a shell and a cone (the cone’s apex coincides with the sphere’s center). f ∈G be the diameter of G. G) = max min d(b. Since the Hausdorff distance is very sensitive to outliers. Finally. and it decreases approximately linearly with the depth in the hierarchy. Prisms and cylinders have been proposed by Barequet et al. DOPs53. and a shell is the space between two concentric spheres. The difference between OBBs6 and AABBs is that OBBs can be oriented arbitrarily (hence “oriented bounding boxes”). one can always take the intersection of two or more different types of BVs.9 and Weghorst et al. the type of BVs. Then we can deﬁne tightness τ := h(B. The tightness of the father is τ = h/d. at least.99 are a generalization of AABBs: basically.Zachmann/Langetepe: Geometric Data Structures for CG 23 (which is exhaustive). one has to make a trade-off between these properties: generally. Then. G some geometry bounded by B. Let Vol(ν) be the volume of the BV stored with ν. very often just the Euclidean distance. we observe a fundamental difference between AABBs and OBBs:40 • The tightness of AABBs depends on the orientation of the enclosed geometry. we can deﬁne the tightness as τ := Vol(ν) . g ⊂ B. one more design choice: the type of BV used at each node. this does not necessarily mean that each node uses the same type of BV. you should always split the set of objects into disjoint subsets.. we can deﬁne it as τ := Vol(ν) . Figure 35 depicts the situation for a sphere. we need to deﬁne tightness. and the construction process. and a maximally recursive algorithm. Siggraph 2003 Tutorial 16 . • The tightness of OBBs does not depend on the orientation of the enclosed geometry. one can establish a theoretical advantage of OBBs. it depends on its curvature.40 Deﬁnition 3 (Tightness by Hausdorff distance) Let B be a BV. • number of operations needed to test the query object against a BV.) Let diam(G) = max d(g.57. Figure 32 shows a number of the most commonly used BVs. diam(G) See Figure 33 for an illustration.e. the maximum distance of B to the nearest point in G. (Here. But ﬁrst. What is worse is that the tightness of the children of an AABB enclosing a surface of small curvature is almost the same as that of the father. There are more design choices possible according to the deﬁnition. there is. Regarding the tightness. G) . Getting back to the tightness deﬁnition based on the Hausdorff distance. Often. the type of BV that offers better tightness also requires more operations per query and more memory. it only requires that Oi = O. f ) g. Again. ∑ν ∈C(ν) Vol(ν ) Alternatively. ∑ν ∈L(ν) Vol(ν ) where L(ν) is the set of leaves beneath ν. that the same object o ∈ O could be associated with several children. • memory usage. one could also think of other deﬁnitions such as the following one: Deﬁnition 4 (Tightness by volume) Let C(ν) b the set of children of a node ν of the BV hierarchy. while the h/2 h tightness of a child is τ = d/2 = d/2 = τ.94 but they seem to be too expensive computationally.

the query times offered by such a BV hierarchy are by a large factor worse. In the following we will describe algorithms for each construction strategy.80 For each bi ∈ B ﬁnd the nearest neighbor bi ∈ B. another Siggraph 2003 Tutorial 16 .1. the higher computational effort needed for most queries per node when traversing an OBB tree with a query. Asymptotically. and instead deal with their BVs and consider those as the atoms. During construction of a BV hierarchy. This yields a new set B . Thus. We will describe it ﬁrst in 2D. which just splits the set of objects into two equally sized parts. This makes OBBs seem much more attractive than AABBs. 4. Figure 35: The tightness of an OBB decreases for deeper levels in a OBB hierarchy for small curvature surfaces. Sometimes. the tightness for an OBB bounding a spherical arc 1−cos φ of degree φ is τ = 2 sin φ . The price of the much improved tightness is. with |B| = n. The second strategy is less greedy in that it computes a tiling for each level. it is convenient to forget about the graphical objects or primitives. Then.62 Again. Note that this strategy does not necessarily produce BVs with a small “dead space”: in Figure 36. then the true extents of the objects must be considered. there are 3 strategies to build BV trees: • bottom-up.1 Construction of BV Hierarchies Essentially. do the same with the next k elements from B. etc. in practice. where the objects are assigned randomly to either subset. simpliﬁcation is to just approximate each object by its center (baryenter or bounding box center). and then deal only with sets of points during the construction. while the diameter of the arc is d = 2r sin φ. which approaches 0 linearly as φ → 0. of course. 4. and the process is repeated. G) diam(G) G φ d h Œ/2 h d Figure 33: One way to deﬁne tightness is via the directed Hausdorff distance. Of course. • top-down. this usually yields the same query time as any other strategy. while choosing the right pair would result in much less dead space. • insertion From a theoretical point of view. let B be the set of BVs on the top-most level so far constructed. the strategy would choose to combine the left pair (distance = 0).1 Bottom-up In this class. when the BVs are ﬁnally computed for the nodes. combine the ﬁrst k nodes in B under a common father. one could pursue a simple top-down strategy. let di be the distance between bi and bi . Figure 34: The tightness of an AABB remains more or less constant throughout the levels of a AABB hierarchy for surfaces of small curvature. However. spherical arc is h = r(1 − cos φ). Sort B with respect to di .24 Zachmann/Langetepe: Geometric Data Structures for CG B h h(B. we will actually describe two algorithms. Let B be the set of BVs on the top-most level of the BV hierarchy that has been constructed so far.

there is a vast number of criteria for guiding the splitting. Then.) Obviously. 4. so that we end up with k tiles (see Figure 37). and usually it can be implemented easily. Then. its BV is combined. and the process repeats with a new set B . if we can estimate the probability that a ray will hit a child box when it has hit the father box. or merging.3 Top-down This scheme is the most popular one. we will present a few of these criteria.4 Construction criteria In the literature. Finally. even though the BVs utilized are well known. Step 2 is important because a “bad” choice in the beginning can probably never be made right afterwards. the set B is split into n/k vertical “slices” (again with respect to cix ). to be performed on the BV tree. 4. The following pseudo-code describes the general procedure: 1: 2: 3: 4: 5: Figure 37: A less greedy strategy combines BVs by computing a “tiling”. insertion.1. It seems to produce very good hierarchies while still being very efﬁcient. the authors endow the thus constructed BV hierarchy with a new name.Zachmann/Langetepe: Geometric Data Structures for CG 25 Figure 36: A simple greedy strategy can produce much “dead space”. The general idea is to start with the complete set of elementary BVs. In Rd it works quite similarly: we just split each √ d slice repeatedly by n/k along all coordinate axes. Usually. For ray tracing. it sorts B along the x-axis with re√ spect to cix . Let B be the set of elementary BVs. algorithms in this class have complexity O(n log n). In the following. The splitting is guided by some heuristic or criterion that (hopefully) produces good hierarchies. split that into k parts. all nodes in a tile are combined under one common father. so that insertion of b into ν causes minimal increase in the costs of the total tree ν := ν end while end while All insertion algorithms only vary step 2 and/or 5. during BV tree construction. Let us assume that all rays emanate from the same origin (see Figure 38). Now. Now. 6: 7: 8: while |B| > 0 do choose next b ∈ B ν := root while ν = leaf do choose child ν . the criterion depends on the application for which the BV tree is to be used.2 Insertion This construction scheme starts with an empty tree.1. then we know how likely it is. that we need to visit the child node when we have visited the father node. and create a BV tree for each part recursively. See below for a few criteria. 4. (Often. The algorithm ﬁrst computes the center ci for each bi ∈ B.1. each slice is sorted according to ci and subsequently split into y √ n/k “tiles”. Step 5 depends on the type of query that is Siggraph 2003 Tutorial 16 .

because of the recursive deﬁnition of the cost function. z do sort B along axis α with respect to the BV centers ﬁnd ν ν kα = min Area(b1 . . but this can be extended to other arities analogously.. . B) under the condition that we have already determined during collision detection that we need to traverse the hierarchies further down. y.g.1. under the condition that it is contained in the father BV. B2 ) = min C(B . This is because for a convex object. bn ) Area(B) end for choose the best kα Figure 38: The probability of a ray hitting a child box can be extimated by the surface area. then the volume instead of the surface area should be used. B \ B ) B ∈P (B) where B1 . For a given set B of such points. . A quite different splitting algorithm does not (explicitely) try to estimate any probabilities.. choose the largest of them (i. split B into two subsets according to the side on which the point lies. ﬁnally.e. place a plane orthogonal to that principal axis and through the barycenter of all points in B. .5 The criterion for collision detection In the following. . b j ) denotes the surface area of the BV enclosing b1 .67 and Beckmann et al. we can observe that the probability that a ray s hits a child box ν under the condition that it has hit the father box ν is P(s hits ν |s hits ν) = θν Area(ν ) ≈ θν Area(ν) (6) where Area denotes the surface area of the BV. 4.6 A more elaborate criterion tries to establish a cost function for a split and minimize that. It then proceeds as follows. For ray tracing. . such a minimization is too expensive in practice. in particular. B2 are the subsets of elementary BVs (or objects) assigned to the children. the volume seems to be a good probability estimation. and for collision detection.39 So. (This description is a slightly modiﬁed version of Gottschalk et al. one can place the splitting plane through the median of all points. . too. . So.. B) be the expected costs of a node pair (A. b j . but not necessarily better ones. For range queries.37 Müller et al.39 Siggraph 2003 Tutorial 16 . This would lead to balanced trees. Fussell and Subramanian. a simple strategy is to just minimize the surface area of the BVs of the children that are produced by a split. is approximately proportional to its surface area. we have assumed a binary tree. .10 have proposed the following approximation algorithm: 6 where Area(b1 . b j ) Area(B) j=0. . Of course. this cost function can be approximated by Area(ν1 ) Area(ν2 ) C(ν1 ) + C(ν2 ) Area(ν) Area(ν) (7) where ν1 . the one exhibiting the largest variance). instead of the barycenter. . compute its principal components (the Eigenvectors of the covariance matrix). It just approximates each elementary BV/object by its center point. the strategy is to choose that child node whose area is increased least.. If the query is a point location query (e.26 Zachmann/Langetepe: Geometric Data Structures for CG θν θν for α = x. we will describe a general criterion that can guide the splitting process of topdown BV hierarchy construction algorithms. the solid angle subtended by it. This is because the probability that a point is contained in a child BV. and θ denotes the solid angle subtended by the BV. such that the hierarchy produced is good in the sense of fast collision detection100 (see Section 4. . Let C(A.n j+ (n − j) Area(b j+1 .40 ) Alternatively.. ν2 ) = C(B1 .2). Assuming For the insertion scheme. Here. . ν2 are the children of ν. when seen from large distances. is proportional to the ratio of the two volumes. . . . The optimal split B = B1 ∪ B2 minimizes this cost function: C(ν1 . is a given point inside or outside the object).

Construction algorithm. we have chosen the lower left corner of B as its anchor point. . + P(A2 . B) ≈ 4 1 + P(A1 . but this is arbitrary. According to the criterion derived above. Bj ) (8) where Ai . Bj are the children of A and B. Now we will derive an estimate of the probability P(A1 . (9) and then ﬁnd the minimum. B1 )P(A12 . B11 ) + .7 Because B1 is a child of B. .. An optimal construction algorithm would need to expand (8) down to the leaves: C(A. Equation 10 can be minimized only by minimizing Vol(A1 ) + Vol(B1 ). B2 ) (10) 7 Vol(A) + Vol(B) + 2α So we can estimate the volume of the Minkowski sum of two boxes by Vol(A ⊕ B) ≈ 2(Vol(A) + Vol(B)) yielding P(A1 . B1 ) ≈ Vol(A1 ) + Vol(B1 ) Vol(A) + Vol(B) (13) Since Vol(A) + Vol(B) has already been committed by an earlier step in the recursive construction. Consequently. This situation is depicted in Figure 39. because the Minkowski sum is invariant under translation. we can bound the volume of the Minkowski sum by Vol(A) + Vol(B) + 2 Vol(A) Vol(B) ≤ α Vol(A ⊕ B) ≤ Vol(A) Vol(B) (12) ∑ P(Ai . Since we are interested in ﬁnding a local criterion. binary trees and unit costs for an overlap test. For sake of simplicity. we know that the anchor point of B1 must lie somewhere in the Minkowski sum A ⊕ B ⊕ d. we know that A1 ⊕ B1 ⊂ A ⊕ B ⊕ d.j=1. Bj ) · C(Ai . B11 ) + P(A1 . . Bj ) is the probability that this pair must be visited (under the condition that the pair (A. this can be expressed by C(A. of course. B) = 4 + i. we can derive an estimate for the cost of the split of a set of polygons associated with a node. which gives C(A. we approximate the cost function by discarding the terms corresponding to lower levels in the hierarchy. we will assume in Siggraph 2003 Tutorial 16 . B2 ) + P(A1 . This is done by trying to ﬁnd a good splitting for each of the three coordinate In the ﬁgure. B1 ) = Vol(A1 ⊕ B1 ) Vol(A ⊕ B ⊕ d) Vol(A1 ⊕ B1 ) = Vol(A ⊕ B) d (11) Figure 39: By estimating the volume of the Minkowski sum of two BVs. However. Since A1 is inside A and B1 inside B. for arbitrary convex BVs the probability of overlap is P(A1 . B21 ) +. it is safe to assume that the aspect ratio of all BVs is bounded by α.2 In the case of AABBs.. B) has been visited).Zachmann/Langetepe: Geometric Data Structures for CG 27 B A B1 A1 d locus of possible anchor points the following that AABBs are used as BVs. similar arguments should hold for all other kinds of convex BVs. each recursion step will try to split the set of polygons so that the cost function (10) is minimized. resp. B1 ) + . B1 ) + P(A1 . B2 )P(A11 . and P(Ai .. The event of box A intersecting box B is equivalent to the condition that B’s “anchor point” is contained in the Minkowski sum A ⊕ B. So. This is our criterion for constructing restricted boxtrees. . B) =P(A1 . B1 ). where d = anchor(B1 ) − anchor(B). B1 )P(A11 . + P(A1 .

88. where n is the number of polygons. which induces a so-called recursion tree (see Figure 40). for instance. of which some children are not visited (because their BVs do not overlap). we consider each polygon in turn.31 to name but a few. such as OBBs. These assumption have been valid in all practical cases we have encountered so far. almost all hierarchical collision detection algorithms implement the following general algorithm scheme: traverse(A. in a second pass. going either up or down. DOPs. During collision detection. This algorithm has proven to be geometrically robust. simulation of natural interaction with objects. and even convex hulls. The algorithm and criterion we propose here could also be applied to construct hierarchies utilizing other kinds of BVs. or one upper and one lower box. if the objects have moved only a little relative to each other. In each case. whether or not a BV test is done at the leaves depends on how expensive it is. the “bottom slice” through the recursion tree (see the dashed lines in Figure 40). under certain assumptions. and then selecting the best one. we just pick the one with least total volume of the subsets.57. and the algorithm for construction of the BV trees. and assign it to that subset whose volume is increased least. Leaves in the recursion tree denote an intersection test of the enclosed primitives (polygons). we consider three cases: both subsets form lower boxes with respect to its parent. since there is no error propagation. It is a fundamental problem of dynamic simulation of rigid bodies.40 DOPs.8 we run alternatingly through the array of polygons. Bounding volume trees seem to be a very efﬁcient data structure to tackle the problem of collision detection for rigid bodies. compared to the intersection test of primitives.28 Zachmann/Langetepe: Geometric Data Structures for CG axes. One idea is to save this set for a given pair of objects. the overlap test for a pair of nodes.B) if A and B do not overlap then return end if if A and B are leaves then return intersection of primitives enclosed by A and B else for all children A[i] and B[j] do traverse(A[i].58. so that the other subset never gets a polygon assigned to. a simple epsilon guard for all comparisons sufﬁces. we can start from this set.99 AABBs. The algorithm outlined above is essentially a simultaneous traversal of two hierarchies. Hopefully. Given two hierarchical BV volume data structures for two objects A and B. which is as close as possible to the outer border that is perpendicular to the splitting axis. Then. It can be shown that this algorithm is. Therefore. when the sequence of polygons happens to be ordered such that each polygon increases one subset’s volume just a little bit. After good splitting candidates have been obtained for all three axes. This scheme is called incremental hierarchical collision detection.2 Collision Detection Fast and exact collision detection of polygonal objects undergoing rigid motions is at the core of many simulation algorithms in computer graphics.100 sphere. 9 This happens. We suspect that the volume of AABBs would work fairly well as an estimate of the volume of the respective BVs.9 in O(n).46.63 When this pair is to be checked next time. In order to prevent “creeping greediness”. Along each axis. the number of nodes that need to be added or removed from the bottom slice is small. we ﬁrst try to ﬁnd a good “seed” polygon for each of the two subsets. both are upper boxes. and haptic rendering. all kinds of highly interactive applications such as virtual prototyping need exact collision detection at interactive speed for very complex. The characteristics of different hierarchical collision detection algorithms lie in the type of BV used. In particular. All kinds of different types of BVs have been explored in the past: 8 This algorithm quickly “zooms in” on pairs of close polygons. Let us call the set of nodes.B[j]) end for end if 4. the simultaneous traversal will stop at some nodes in the recursion tree. Each node in this tree denotes a BV overlap test. 5 Voronoi Diagrams For a given set of sites inside an area the Voronoi diagram is a partition of the area into regions of Siggraph 2003 Tutorial 16 . arbitrary “polygon soups”.74 OBBs.98 and convex hulls.

no four of them lie on the same circle and no three of them on the same line.1). Finally.3.3.1 Voronoi Diagram Let S a set of n ≥ 3 point sites p. For further details and further literature see one of the surveys mentioned above.1 Deﬁnitions and Elementary Properties 5. B A B1 A1 A2 B2 Figure 41: Hierarchical collision detection can discard many pairs of polygons with one BV check. We present generalizations of the Voronoi diagram and the Delaunay Triangulation in Section 5.1 transformations to three dimensions are given and in Section 5. x2 ) let d(p.4 applications of the Voronoi diagram and the Delaunay triangulation in 2D and 3D are shown. For points p = (p1 .4.2 the concept of constrained Voronoi diagrams is introduced.4.e. The closure of a set A will be denoted by A.1 with the simple case of the Voronoi diagram and the Delaunay triangulation of n points in the plane. Siggraph 2003 Tutorial 16 . Then a simple application of the Voronoi diagram of line segments for motion planning is presented in Section 5. A collection of other interesting generalizations is presented in Section 5. in the plane.4. In Section 5.3. By pq we denote the line segment from p to q.Zachmann/Langetepe: Geometric Data Structures for CG 29 A A1 1 B C B2 B3 C2 C3 2 3 D E F G D4 D5 E4 E5 D6 D7 E6 E7 F6 F7 G6 G7 F4 F5 G4 G5 4 5 6 7 Figure 40: The recursion tree is induced by the simultaneous traversal of two BV trees. .1. The Voronoi diagram and its dual have been used for solving numerous problems in many ﬁelds of science. that we can only sketch many of the subjects here. In Section 5.2 different algorithmic schemes for computing the structures are mentioned. . We present a simple incremental construction approach which can be easily generalized to 3D (see Section 5. p2 ) and x = (x1 . under the Euclidean distance.3.2.3 a collection of 2D-applications is shown. chapters 5 and 6 of Preparata and Shamos77 and chapter 13 of Edelsbrunner29 could be consulted. First.3. q. x) denote their Euclidean distance. in Section 5.5 5. r. We start in Section 5. . Here..3.1 we discuss the famous post ofﬁce problem.5 Additionally. i. the same neighborship. In Section 5.11 Fortune34 and Aurenhammer and Klein. We will concentrate on its application to geometric problems in 2D and 3D. For an overview of the Voronoi diagram and its dual in computational geometry one may consult the surveys by Aurenhammer. Additionally we mention some of the elementary structural properties that follow from the deﬁnitions. in Section 5. all pairs of polygons in A1 and B2 can be discarded. Note. The ﬁgures are taken from Aurenhammer and Klein.4 Bernal. In the following we assume that the points are in general position.

A point p of S lies on the convex hull of S iff its Voronoi region VR(p.q=p vertices.q∈S. The Voronoi diagram is a simple linear structure and provides for a partition of the plane into cells of the same neighborship. they belong to the common boundary of three or more Voronoi regions. that the Voronoi edges and vertices build a graph. Γ Figure 42: A Voronoi diagram of points in the Euclidean plane. 3. If the Voronoi edge e borders the regions of p and q then e ⊂ B(p. The average number of edges in the boundary of a Voronoi region is less than 6. q and r. For any point x in the plane we can expand the circle C(r) with center x and radius r by increasing r continuously. There is an intuitive way of looking at the Voronoi diagram. then x ∈ VR(p. S) = q∈S. the Voronoi diagram of S is deﬁned by V(S) = p. S) is open and convex. q) = {x | d(p. Note. see de Berg et al. Every VR(p. x)} be the bisector of p and q. An illustration is given in Figure 42. Therefore the diagram normally is represented by a graph of linear size. We detect three cases depending on which event occurs ﬁrst: • If C(r) hits one of the n sites. q) = {x | d(p. Different Voronoi regions are disjoint. We will enumerate some of the signiﬁcant properties of Voronoi diagrams. the so called Delaunay triangulation. B(p. S).p=q VR(p. q) the Voronoi region of p with respect to S. if it contains more than one point.23 or with the help of an adjacency matrix. S) is the intersection of at most n − 1 open halfplanes containing the site p. S). We call VR(p. q) holds. S) ∩ VR(q. It shows how the plane is decomposed by V(S) into Voronoi regions. x)} containing p from the halfplane D(q. q and r simultaneously x is the Voronoi vertex of p. x) < d(q. The Voronoi diagram V(S) has O(n) many edges and vertices. The common boundary of two Voronoi regions belongs to V(S) and is called a Voronoi edge.30 Zachmann/Langetepe: Geometric Data Structures for CG Deﬁnition 5 For p. which is maximal in the sense that no further straight line edge can be added without crossing other edges.2 Delaunay Triangulation D(p. q ∈ S let B(p. say p. p) containing q. In general. The triangulation of a point set S has not more than O(|S|) triangles. Note that it is convenient to imagine a simple closed curve Γ around the “interesting” part of the Voronoi diagram. a triangulation of S is a planar graph with vertex set S and straight line edges.. We omit the proofs and refer to the surveys mentioned in the beginning. 1. x) = d(q. 5.1. • If C(r) hits three sites p. Finally. S) is unbounded. Endpoints of Voronoi edges are called Voronoi We consider the dual graph of the Voronoi diagram. • If C(r) hits two sites p and q simultaneously x belongs to the Voronoi edge of p and q. Siggraph 2003 Tutorial 16 . It separates the halfplane D(p. For example the diagram can be represented by a doubly connected edge list DCEL. q) is the perpendicular line through the center of the line segment pq. 2. Each Voronoi region VR(p.

Let qr be an edge of DTi−1 . for example line segments or polygonal chains. interior or boundary. qr cannot belong to DTi . tain the new site. t. DT(S) s If pq is an edge of the convex hull of S we call the supporting outer halfplane H not containing S an r p v inﬁnite triangle with edge pq. r contains at least one of pi . pi t will be a new Delaunay edge. and let T(q. the Delaunay triangulation DT(S) is They can also be generalized to other metrics and a triangulation of S. r. due to the (equivalent) def• A reduction to the convex hull problem is given inition. . r. Instead. see ﬁg. Simple incremental construction: The insertion process is described as follows: We construct 2. r. tion. The result of the algorithms is ure 43. Its circumcircle is H itself. If its circumcircomplexity Θ(n log n).2 Computation the triangle adjacent to qr that lies on the other The construction of the Voronoi diagram has time side of qr than pi . Siggraph 2003 Tutorial 16 Deﬁnition 6 The Delaunay triangulation DT(S) is the dual Graph of the Voronoi diagram. Obviously.sites other than points. construct DTi by exchanging edges. This process of replacing edge qr by pi t is called an edge ﬂip. All these approaches run in deterministic time launay triangulation. As a consequence. Three points of S give rise to a Delaunay trian. We present two equivalent deﬁnitions of the De. Two points p. According to the (equivalent) deﬁnition of the DTi . pi .ary. . by the same argument from above. t) contains pi then each circle through can be achieved by the following reductions. t) be 5. The line seg• Incremental construction.struction technique which runs in O(n log n) expected time and computes the Delaunay triangulagram is no longer well-deﬁned.Zachmann/Langetepe: Geometric Data Structures for CG 31 are convenient for the construction of the Voronoi diagram or the Delaunay triangulation. r) of DTi−1 that contains pi . p }) by inserting the site 1 i i−1 i gle iff their circumcircle does not contain a point p into DT . by Shamos. see above. an example is shown in Fig. respectively.stored in a graph of linear size.85 because there exists a circle contained in C(q.DT = DT({p . ian. and s will be new De• Divide-and-Conquer and launay edges. for example if the dual of a Voronoi dia. q. We follow Guibas and Stolﬁ41 and i i−1 of S in its interior. • Sweep . until all edges invalidated by pi have been removed. The lower bound Ω(n log n) cle C(q. We explain a simple Incremental conputation of the diagram and give also rise to generalization. t) • A reduction to the -closeness problem is given that contains only pi and t in its interior or boundby Djidjev and Lingas26 and by Zhu and Mirza. are said to be in conﬂict with pi . They are applied for the comO(n log n). Consequently. The edges of DT(S) are called Delaunay edges. each edge of a Delaunay triangulation is now adjaq cent to two triangles. The presentation is adapted from Klein and 1. see Figure 44.5 The technique can easily be geniff a circle C exists that passes through p and q eralized to the three dimensional case as we will see and does not contain any other site of S in its in Section 5. r. ments connecting pi to q.3. Figure 43: Voronoi diagram and Delaunay trianThose triangles of DTi−1 whose circumcircles congulation.101 The necessary edge ﬂips can be carried out efﬁThe well-known computation paradigms ciently if we know the triangle T(q.1. Figure 45. p . V(S) It is helpful to extend the notion of triangle to w the unbounded face of the Delaunay triangulation. using Lawson’s60 original edge ﬂipping procedure. q of S give rise to a Delaunay edge Aurenhammer. . . the limit of all circles through p and q whose center tend to inﬁnity within H. s. they will no longer be Delaunay triangles.

and vertices of V(S) deﬁne a cell complex in 3D. This shows that the total number of components of the diagram V(S) in 3D is O(n2 ). Altogether we get the following result: Theorem 7 The Delaunay triangulation of a set of n points in the plane can be easily incrementally constructed incrementally in expected time O(n log n). then f is a face (facet. t) is in conﬂict with pi then former Delaunay edge qr must be replaced by pi t. thus achieving their maximum possible number of n . by including a tetrahedron spanned by S as Delaunay iff its circumsphere is empty of sites in S. Find the triangle of DTi−1 that is in conﬂict with pi . a triangle for each edge.t) q 5. As an appropriate data structure for storing a 3-dimenional cell complex we mention the facet-edge structure in Dobkin and Laszlo. facets.r. edge qr must be ﬂipped. The following description was adapted from Aurenhammer and Klein. Dwyer28 showed that the expected size of V(S) in d-space is only O(n). With a special implementation using a directed acyclic graph (DAG). 2 e. at most one for each site q ∈ S \ {p}. The regions.g. the number of edges and vertices of VR(p. edge. The circumcenters of these empty spheres are just the vertices Siggraph 2003 Tutorial 16 pi C(q. In fact. If so. the structural work needed for computing DTi from DTi−1 is proportional to the degree d of pi in DTi . 2. by inspecting all candidates. the Delaunay triangulation DT(S) in 3D is deﬁned as the geometric dual of V(S). Hence. needs to be ﬂipped. This result indicates that highdimenional Voronoi diagrams will be small in many practical situations. So we yield an obvious O(n2 ) time algorithm for constructing the Delaunay triangulation of n points: we can determine the triangle of DTi−1 containing pi within linear time. too. edges.3 Generalization of the Voronoi Diagram r C(pi. Next. If the triangle of DTi−1 containing pi is known.25 This fact sometimes makes Voronoi diagrams in 3D less useful compared to 2-space. It contains a tetrahedron for each vertex. The average is taken over the different orders of inserting the n sites. . and of vertices (endpoints of edges). q ∈ S is the perpendicular plane through the midpoint of the line segment pq.1 Voronoi Diagram and Delaunay Triangulation in 3D We will see that incremental construction is also appropriate for the 3D case. There can be single vertices in DTi that do have a high degree. by the Eulerian polyhedron formula. On the other hand.32 Zachmann/Langetepe: Geometric Data Structures for CG t 5.3. The region VR(p. Two task have to be considered: 1. S) of a site p ∈ S is the intersection of halfspaces bounded by bisectors. The last argument is too crude. DT(S) may be deﬁned using the empty sphere property. S) is O(n).27 Complexity: The number of facets of VR(p. of edges (maximal line segments in the boundary of facets). but their average degree is bounded by 6. Equivalently. r. using expected linear space.. Perform all ﬂips starting from this triangle. S) consists of facets (maximal subsets within the same bisector). and obtain DTi . Dewdney and Vranch. but not containing pi . In analogy to the 2-dimenional case. and so on. S) is at most n − 1. also called Delaunay tree due to Boissonnat and Teillaud. or vertex) of both regions. This cell complex is face-to-face: if two regions have a non-empty intersection f . It can be shown that the second task is bounded by the degree of pi in the new triangulation. g. of V(S). the degree of pi is trivially bounded by n.12 we can detect the triangles of DTi−1 which are in conﬂict with pi in O(log i) expected time.t) Figure 44: If triangle T(q. see. and an edge for each facet. The bisector of two sites p. The boundary of VR(p. Moreover. and thus is a 3-dimenional convex polyhedron. we check if e. provided S is drawn uniformly at random in the unit ball. We continue until no further edge currently forming a triangle with.5 Let S be a set of n point sites in 3D. the edges qt and tr are tested. there are conﬁgurations S that force each pair of regions of V(S) to share a facet.

Simple incremental construction: Among the various proposed methods for constructing V(S) in 3D. A complete algorithm with run time O(n2 ) can be found in Shah.g.2) is most intuitive and easy to implement.49 Rajan. The existence of such a sequence of ﬂips is less trivial. Joe48 demonstrated that no ﬂipping sequence might exist that turns an arbitrary tetrahedral triangulation for S into DT(S). to obtain DT(S ∪ {p}). after having added a site to the current Delaunay triangulation. and then deletes the parts of V(S) interior to this region. that there are structural differences. two different techniques for integrating a new site p into V(S) have been applied. Joe. Basically. Figure 47: An Euclidean Voronoi diagram of line segments. Siggraph 2003 Tutorial 16 .47 describe a robust implementation of this method. incremental insertion of sites (compare Section 5. this amounts to detecting and removing all tetrahedra of DT(S) whose circumspheres contain p. The more obvious method ﬁrst determines all facets of the region of p in the new diagram.33 and Tanemura et al. and edge qr has already been ﬂipped. certain ﬂips changing the local tetrahedral structure are performed in order to achieve local “Delaunayhood”. DT(S) is a partition of the convex hull of S into tetrahedra.78 and Edelsbrunner and Shah30 follow a different and numerically more stable approach.93 Field. and then ﬁlling the ’hole’ with empty-sphere tetrahedra with p as apex. of V(S). V(S ∪ {p}).Zachmann/Langetepe: Geometric Data Structures for CG 33 q t pi F s SF r s pi q t pi T r s SF q t r (i) (ii) (iii) Figure 45: Updating DTi−1 after inserting the new site pi . s have been added. Two more ﬂips are necessary before the ﬁnal state shown in (iii) is reached. Note that the edges of DT(S) may form the complete graph on S. Like in the planar case.86 Inagaki et al. In (ii) the new Delaunay edges connecting pi to q. however.30 p q p q Figure 46: The Voronoi diagram of a point set in L1 and L2 . An example of an edge ﬂip in 3D is shown in Figure 48. Note. see e. Watson. r. provided S is in general position. In the dual environment.

61 Chew. In the resulting constrained Voronoi diagram VD(S. The exact dual of VD(S.34 Zachmann/Langetepe: Geometric Data Structures for CG Figure 48: Two–into–three tetrahedra ﬂip for ﬁve sites. For example.91 In Seidel81 and Kao and Mount51 one will ﬁnd good implementation schemes. The segments in L may be considered as obstacles. a comparison of L1 and L2 is shown in Figure 46 – L∞ – Convex distance functions • Different space – On trees and graphs – Higher dimensions • Weights • More general sites – Line segments (see Figure 47). Siggraph 2003 Tutorial 16 . L) may be no longer a full triangulation of S (even if S is included) but we can modify VD(S. thus we have |L| ≤ 3n − 6. regions of sites that are close but not visible from each other are separated by segments in L. For every line segment l we proceed as follows: All sites of the clipped regions to the left of a segment l build a special Voronoi diagram to the right and vice versa. An application of DT(S.3.17 5.1 Nearest Neighbor or Post Ofﬁce Problem We consider the well-known post ofﬁce problem.61 Let S be a set of n points in the plane. For a set S of sites in the plane and an arbitrary query point x we want to compute the point of S closest to x efﬁciently. The bounded distance between two points x and y in the plane is deﬁned as follows: b(x. y) ∞ if xy ∩ L = ∅ otherwise nay triangulation DT(S.3 Other Types of Generalizations We simply list some of the generalization schemes and show examples of some intuitive ones.4 Applications of the Voronoi Diagram 5.3. – Polygonal chains • Farthest point Voronoi diagram • K-th order Voronoi digram • Colored objects where d stands for the Euclidean distance.4. L) that also includes L.2 Constrained Voronoi diagrams For many applications it is not useful to consider neighborship relations without any constraints. L) and the constrained Delau- 5. L). and let L be a set of non-crossing line segments spanned by S. an example is shown in Figure 49. y) = d(x. L) have been proposed in Lee and Lin. L). • Different metrics – L1 . Note that the endpoints of the line segments are always neighbors in the new diagrams and therefore the line segments itself are inserted (see Figure 49). L) to quality mesh generation can be found in Chew.16 Wang and Schubert92 and Wang. Algorithms for computing the constrained Voronoi diagram VD(S. The neighborship within these special diagrams lead to additional edges inserted into the dual of VD(S. a small distance between two cities may become unimportant if there is a (natural or artiﬁcial) border line between them and the border line itself should not serve as a new site. 5. L) in order to dualize it into a "near to Delaunay" triangulation DT(S. To overcome such problems the concept of constrained Voronoi diagrams was introduced.

one can. 2 .e. We can solve this problem by computing the Voronoi diagram VD(S) of the corresponding line segments. Figure 50: After constructing the slabs.4. There are also more efﬁcient approaches. for safetyness it should maximize its distance to both segments. see Figure 50. Edelsbrunner29 constructs a O(log n) search structure for the Voronoi diagram in linear time and with linear space.Zachmann/Langetepe: Geometric Data Structures for CG 35 Figure 49: The constrained Voronoi diagram VD(S. Now for a single answer we only have to determine its class. i. a query point x can be located quickly. Altogether the robot should try to move along the Voronoi diagram of the line segments of the polygonal scene. its nearest neighbor in S can be found in time O(log n). To solve this task a simple technique can be applied. For every segment of VD(S) we can easily compute whether the robot ﬁts between the corresponding obstacles. In the ﬁeld of computational geometry there is a general technique for solving such query problems. y∈li x This goal is reached if the robot moves along the biscetor of l1 and l2 . L) and its dual. Let us assume that the robot moves between to obstacle line segments l1 and l2 . Let us assume that a two dimensional environment with polygonal obstacles is given. Theorem 8 Given a set S of n point sites in the plane. That is. The Voronoi diagram represents the locus approach for the post ofﬁce problem. This gives rise to a reasonable solution. This technique is called locus approach.2 Motion planning We present a simple application of Voronoi diagrams for computing collision-free paths in polygonal environments. One tries to decompose the query set into classes so that every class has the same answer. Altogether we need O(n2 ) time for the simple construction. 5. for every position x we want to maximize |xli | = min |xy|. construct a data structure that supports nearest neighbor queries: for an arbitrary query point x. The classes correspond to the regions of the sites. For simplicity we assume that a circleshaped robot is given and a collision-free path from s to t should be computed (see Figure 51). For a query point x we locate its slab in O(log n) time and afterwards its region in O(log n) time by binary search. i = 1. The simple technique can be easily extended to 3D. The lines decompose the diagram into slabs. We draw a horizontal line through every vertex of the diagram and sort the lines in O(n log n) time. For every slab we sort the set of crossing edges of the Voronoi diagram in linear time. within O(n2 ) time and storage. Siggraph 2003 Tutorial 16 .. For a query point x we want to determine its class/region and return its owner.

O(n log n) • Largest empty circle. • Consider the graph G of the remaining diagram together with s and t . • Consider the closest point s ∈ VD(S) to s. O(n) • Nearest Neighbor Search – O(n) for all nearest neighbors of the sites – O(k log2 n) expected time for k-th nearest neighbors of query point x • Minimum Spanning Tree and TSP-Heuristic.4. Altogether we have the following result: Theorem 9 There is a collision-free path of a circleshaped robot with radius r in a polygonal environment of a set line segments S if and only if the radius r is smaller than |ss | und |tt | and a collisionfree movement from s to along the segments of VD(S) exists. Now we can solve our problem as follows: • Compute the Voronoi diagram VD(S) of the set of line segments S. O(n) • Smallest enclosing circle (square with ﬁxed orientation).5 Texture Synthesis Textures are visual detail of the rendered geometry. respectively t ∈ VD(S) to s. Virtually all Siggraph 2003 Tutorial 16 . Thus many of the presented problems can be solved in three dimensions with almost the same time bound.36 Zachmann/Langetepe: Geometric Data Structures for CG t' t yt l s' s ys Figure 51: Computing a collision-free path from s to t for a circle-shaped robot in the presence of polygonal obstacles. • Compute a path from s to t in G by standard graph algorithms. We will present some special applications for 3D. 5. • Delete the segments of VD(S) where the robot does not ﬁt between the obstacles. where k is the number of colors • Localization problems. 5. • Consider the Voronoi regions of s and t in VD(S). which have become very important in the past few years. see Hamacher42 • Clustering of objects. see Dehne and Noltemeier24 All these results stem more or less from the linear complexity of the diagram. provided that the diagram is given: • Closest Pair of sites.3 Other Applications of the Voronoi Diagram in 2D There are many different geometrical applications of the Voronoi diagram and its dual. O(n) • Smallest color spanning circle (square with ﬁxed orientation). Here we simply list some of them. As we have already mentioned the complexity of the diagrams in three dimension is also linear in many practical situations. because the cost of rendering with texture is the same as the cost without texture. O(nk). together with some performance results.

but if you want to synthesize such images. it does not. 2. Mathematical descriptions can be as simple as a number of sine waves to generate water ripples.95 Given a sample image. the image on the left is the original one. try to compute explicitly the stochastic model. Basically. real-world objects have texture. Figure 54: Some results of the texture synthesis algorithm. the one on the right is the (partly) synthesized one. from a mathematical description. while physical models try to describe the physical or biological effects and phenomena that lead to some texture (such as patina or fur). the texture synthesis process becomes fairly robust against different scales of detail in the sample images. which implicitly contains that model already. textures are images with the following properties: 1. too. like most other methods. we will describe a stochastic algorithm that is very simple. very efﬁcient. Figure 53: Using an image pyramid.Zachmann/Langetepe: Geometric Data Structures for CG 37 N(p) || · || || · || Td Id p T I p N(p) || · || N(pi ) pi random border T0 I0 Figure 52: The texture synthesis algorithm proceeds in scan line order through the texture and considers only the neighborhood around the current pixel as shown. Then. and works remarkably well. Stationary: if a window with the proper size is moved about the image. ﬁlled with random pixels (this will be thrown away again at the end). it uses the sample image itself. the portion inside the window always appears the same. and ﬁnally it generates a new texture from the statistic. the knowledge about the texture is in the model and the algorithm. In all of these “model-based” methods. either from given images.95 In each pair. The algorithm starts by adding a suitably sized border at the left and the top. Local: each pixel’s color in the image depends only on a relatively small neighborhood. then they try to ﬁnd some statistical or stochastic description (explicitely or implicitely) of these. images not satisfying these criteria can be used as textures as well (such as façades). Texture synthesis generally tries to synthesize new textures. The other class of methods starts with one or more images. We will use the following terminology: I = Original (sample) image T = New texture image pi = Pixel from I p = Pixel from T to be generated next N(p) = Neighborhood of p (see Figure 52) Initially. T is cleared to black. then a statistical or stochastic approach is probably not feasible. Of course. or from a physical model. it performs the following simple loop in scan line order (see Figure 52): Siggraph 2003 Tutorial 16 . Instead. so it is extremely important to render them in synthetic worlds. In the following.

all pixels of the new texture are deterurally. . we have to build a but only in approximate nearest neighbors (benearest-neighbor search structure for each level. Often times. now we have replaced the parameter of The main difference among most shape matching the best size of the neighborhood by the parameter algorithms is. starting at the coarsest level. we generate a pyramid I for the sample image I 0 . the database. it must just be chosen such that all but the current pixel are already com. most researchers pursue the “query 10This idea seems to originate from image database retrieval. compute its feature texture pyramid T 0 .e. which (hopethe Euclidean distance. those transformation functions are preministically deﬁned. Id allows for fast nearest-neighbor search. once the random border has ferred that are invariant under rotation and/or been ﬁlled. . we can synthesize an image pyramid (see Fig0. such that if d( f 1 . d is just the Euclidean disthe neighborhood N(p). Then. Compute a feature vector for each shape in the database and store them in a data structure that dent. this is (partly) a human factors issue. . they must just match the shape of N(p). Usually. you are borhood N(p) of a pixel p over k levels as depicted not interested in the exact k nearest neighbors by Figure 53. Such a functionality resulting distribution of f is called a shape distriis needed. cause the feature vector is an approximation of because as we proceed downwards in the texture the shape anyway). viously. . The general idea is to deﬁne some shape function f (P1 . T d level by level with vector.3. T 1 . NatObviously. where a query is speciﬁed by providing a (possibly crude) shape. fully) captures the shape in its essence. I1. However. search! This can be performed efﬁciently with the Almost all approaches perform the following steps: algorithm presented in Section 5. therefore. or CAD databases. f 2 ) is large. which computes some ge5. and retrieve the nearest neighbor from the above algorithm.dom points that lie on the surface of the shape. First. but for sake of completeness. . The comes an interesting problem. Deﬁne a transformation function that takes a tains k pixels. . Pn ) → R. other “scans” of the texture are vectors. . fast shape retrieval essentially requires a fast levels to consider for the neighborhood.38 Zachmann/Langetepe: Geometric Data Structures for CG by content” approach.. The shape of the neighborhood N(p) translation and tessellation. Siggraph 2003 Tutorial 16 . itself depends on the “granularity” in the sample image. In The quality of the texture depends on the size of almost all algorithms. bution. . i.10 The fundamental step here is the matching of shapes. the search in line 2 is exactly a nearest-neighbor calculation of a similarity measure. as Wei and Levoy95 report. Of course. s2 do not look similar. the Well. . Likewise. Deﬁne a similarity measure d on the feature puted. . the size of the neighborhood grows. the transformation from of the best size per level and the best number of shape to feature vector. a shape. then the points are just 3k-dimenshape and computes a so-called feature vector ional vectors of RGB values. a neighborhood of 9 × (approximate) nearest neighbor search.1: if N(p) con1. the optimal size tance. However.6 Shape Matching ometrical property of a number of points.2. and the distance is just in some high dimensional space.e.. ure 53). We could 9 (at the ﬁnest level) across 2 levels seems to be stop our discussion of shape matching here. searching for such models be. 1: 2: 3: 4: for all p ∈ T do ﬁnd the pi ∈ I that minimizes |N(p) − N(pi )|2 p := pi end for where it was called QBIC = “query by image content”. So. One question is how to specify a query. for instance. Obder). Usually. we synthesize the 4. i. in medical image databases. Figure 54 shows two examples of the results that algorithm (from the plethora of others) to compute a feature vector. In order to make the algorithm indepen. . the system also retrieves The only difference is that we extend the neighall k nearest neighbors. then the possible and sensible (for instance a spiral scan orassociated shapes s1 . and then As the availability of 3D models on the net and in evaluate this function for a large number of randatabases increases. Given a query. we will describe a very simple sufﬁcient in almost all cases.71 can be achieved with this method. Consequently. can be chosen arbitrarily.4. pyramid. . for which the database is to return best matches.

82. Voxel grids and octrees are the most commonly used data structures for storing DFs.e. such as the bounding box center.e. Deﬁnition 5 (Distance ﬁeld) Let S be a surface in R3 . Another vector ﬁeld that is often used in the context of DFs is the gradient of the distance ﬁeld. P2 .1 Computation and representation of DFs For special surfaces S. are in the same Voronoi cell (see Figures 56 and 57).73 Not surprisingly. if p inside if p outside (14) In other words. octree. Examples are: • f (P1 . However. the DF of a surface deﬁned by an implicit function is not necessarily identical to the original implicit function. such as distance maps and potential ﬁelds. The distance of a point from the surface is color-coded (the distance for points inside the polygon is not shown). or just gradient ﬁeld. The process of. In general. because they contain a huge amount of information (compared to just the surface itself). +1. and polygons (not necessarily connected). Consequently. this computation can usually be performed only as a preprocessing step. Thus. Figure 56 shows a distance ﬁeld for a simple polygon in the plane. store them in a 3D voxel grid. and image processing.54 GIS (see Figures 58 and 59 for an example). DS tells for any point p the distance to the closest point on the surface S. P4 ) = volume of the tetrahedron between the four points. there are a lot of possibilities (your imagination is the limit). edges.84 robotics. 6 Distance Fields Distance ﬁelds can be viewed as a way to represent surfaces (and solids). the isosurface for the iso-value 0 of a DF is exactly the original surface (see Figure 56). this term bears the connotation of producing inaccurate distance ﬁelds. P1 P3 ). Figure 57 shows a vector distance ﬁeld (for the same surface). P3 ) = ∠(P1 P2 . namely Voronoi diagrams (see Section 5).. P2 ) = |P1 − P2 |. they are difﬁcult to adapt for deformable geometry. we have to discretize DS spatially. the converse is not true in general. where P0 is a ﬁxed point. (We could also regard the vector of the DF as a kind of ID of the respective Voronoi cell.Zachmann/Langetepe: Geometric Data Structures for CG 39 10000 8000 6000 4000 2000 0 cube cylinder pillow sphere torus 0 1 2 3 4 distance 5 6 7 Figure 55: The shape distribution of a number of different simple objects. the distance ﬁeld of a surface S is a scalar function DS : R3 → R such that for all p ∈ R3 . We can augment the DF further to obtain a vector distance ﬁeld VS by storing a vector to the closest point p ∈ S for each point x. P3 . whose vectors point to the same feature (point. where sgn(p) = −1. • f (P1 . we may be able to compute DS analytically. Siggraph 2003 Tutorial 16 . Then. then all points in space.11 Distance ﬁelds have close relationships to isosurfaces and implicit functions. This is why they usually take fairly long to compute. DFs come under many other names. DS (p) = sgn(p) · min d(p. DS (x) = VS (x) .. or the algorithm for computing a DF is sometimes called distance transform.50 So. This is a vector ﬁeld. • f (P1 . or other space partitioning data structure.) density 6. and 11Sometimes. For the shape function. or oplygon). Figure 55 shows the shape distributions of a few simple objects with the distance between two points as shape function. P2 . They are a very powerful data structure. edge. q)|q ∈ S . Given a vector distance ﬁeld for a set of points. distance ﬁelds (DFs) have been “invented” in many different areas. i. When regarded as an implicit function. Apparently. however. i. There is another data structure related to distance ﬁelds. such as computational physics. • f (P1 ) = |P1 − P0 |.

for most applications this is too costly not only in memory utilization but also in computational efforts.35 This representation is called an adaptively sampled distance ﬁeld (ADF). Only a few vectors are shown. Figure 57: The vector distance ﬁeld for the same polygon as shown on the left. and generate all other distances in the interior of voxels by trilinear in- . the kind of hierarchical Siggraph 2003 Tutorial 16 we will describe algorithms for them in the following. because they are simple to construct and offer fairly good adaptivity and allow for easy algorithms. be used as well. the distance of other points must be interpolated from these values.40 Zachmann/Langetepe: Geometric Data Structures for CG Figure 56: Example of a distance ﬁeld in the plane for a simple polygon (thick black lines). usually DFs are represented using octrees (see Figure 60). The simplest discrete representation of a DF is the 3D voxel grid. The dashed lines show the Voronoi diagram for the same polygon. The distance of each point in the plane from a road is color coded. to determine the areas where new houses can be built. although (in theory) every point of the ﬁeld has a vector. Figure 58: A network of roads described in the plane by a set of edges. terpolation. The distance ﬁeld inside the polygon is not shown. for example. of course. Actually. More sophisticated representations try to store more information at each voxel in order to be able to extract distances quickly from the ﬁeld.45 Since each cell in a discrete distance ﬁeld stores one signed distance to the surface for only one “representative”. So. The thin lines show isosurfaces for various isovalues.e. Figure 59: The distance map of these roads. One simple method is to store exact distances for the nodes (i. the corners of the voxels). However. It could be used.. Other interpolation methods could.

1 Propagation method We can now further approximate this by not considering the inﬁnite “neighborhood” (i. 6. Then. z) = min i. and second. 0. y. we subdivide a cell if the distance ﬁeld is not well approximated by the interpolation function deﬁned so far by the cell corners. we need at least two scans: for instance. taking advanconvolution.. ∞ . It can produce only approximain some kind of scan order. In each pass. It could still happen. j. k) from the center node (0. it contains only nodes that have already been comThe idea is to start with a binary DF. z + k) +d M (i. it is faster to compute an ADF top-down. More formally speaking. we can reformulate Equation 14 as follows ˜ DS (x. Here a 5 × 5 × 5 example of such a matrix is shown.12 part of matrix for forward scan √ 6 3 √ √ 6 3 √ √ 5 2 √ √ 6 3 √ 3 6 √ 5 6 √ √ 2 3 √ 1 2 √ √ 2 3 √ √ 5 6 √ √ 3 √ √ √ 6 5 6 3 √ 10 3 8 √ √ 3 6 5 √ √ 6 5 2 √ √ 3 6 5 √ √ √ 10 10 8 2 3 √ √ 10 6 3 √ √ 5 6 √ 6 3 √ √ 10 10 Figure 61: By convoluting a “distance matrix” with an initially binary distance ﬁeld (0 or ∞ ). a single scan will not assign meaningcurrently is. space partitioning is a design parameter of the algorithm. no matter what order the scan preforms. Constructing ADFs works much like constructing regular octrees for surfaces. Since a pracing and ﬂood ﬁlling algorithms and is also called ˜ tical computation of DS would compute each node chamfer method. ﬁrst. Actually. ful distance values to all nodes. BSPs (see Section 3) probably offer much more efﬁcient storage at the price of more complex interpolation. for instance. but they can be turned into an ADF by coalescing cells in a bottom-up manner if the resulting cell still describes the DF well enough. except that here. stellation.1. j. that 12Usually. 13This idea has been proposed as early as 1984. 0). j. This method bears some resemblance to region growbut instead only a local one I ⊂ Z. we somehow “propagate” these known This process looks very similar to conventional values to voxels in the neighborhood.e. backwards from bottom to top. though. y + j. except that here we perform a minitage of the fact that we already know the distances mum operation over a number of sums. k) (15) where d M is the distance of a node (i. of course. this is already a slight approximation of the exact DF. k) ∈ Z3 . Siggraph 2003 Tutorial 16 .13 and maybe even there are still nodes with distance ∞ in the respecearlier. and all others are assigned a distance of sional matrix (see Figure 61). while the between neighboring voxels. The following two algorithms for computing DFs produce only ﬂat representations (i. a 3D scanline order from top to bottom (“forward”).k∈Z3 D(x + i. only one half of the 3D matrix d M needs to be considered (see Figure 61). we choose I such that tions of the exact DF.13 Note that these disconventional convolution performs a sum over a tances only depend on the local neighborhood connumber of products. Therefore.j. Thus.Zachmann/Langetepe: Geometric Data Structures for CG 41 √ part of matrix for backward scan layer -2 -1 0 1 2 √ 10 3 8 √ √ 3 6 5 √ √ 6 5 2 √ √ 3 6 5 √ √ √ 10 10 8 6 3 √ √ 5 6 √ 6 3 √ √ 10 10 3 √ √ 10 √ 6 3 √ √ 6 3 √ √ 5 2 √ √ 6 3 √ 3 6 √ 5 6 √ √ 2 3 √ 1 2 √ √ 2 3 √ √ 5 6 √ 3 √ √ √ 6 5 6 3 -2 0 √ √ √ √ 8 5 2 5 4 √ √ √ √ 2 1 8 2 5 2 1 0 1 2 √ √ √ √ 2 8 5 2 1 √ √ √ √ 5 5 2 5 8 -1 1 Figure 60: Representing distance ﬁelds by octrees has both memory and computational advantages. grids). d M can be prevoxels intersecting the surface are assigned a discomputed and stored conveniently in a 3-dimentance of 0. where all puted by the respective scan. since we want to compute the DF only for a discrete set of points in space. one gets an approximate distance ﬁeld. no matter where the “propagation front” Obviously. tive part of the chamfer matrix.

These cones are called the distance function for a point. The time for computing the exact distance shell can be optimized by utilizing an octree or BV hierarchy for closest point computation. This is a very general technique that often helps to get a better and simpler view on a complex problem. The key technique applied in this approach is to embed the problem into more dimensions than are inherent in the input/output itself.44 and. then we get a cone with the apex in that point. 6. so each point in the plane will be “hit” by n distance values from the projection (see Figure 62). we get n cones. it can be applied only to polygonal surfaces S. computing a discrete DF for a set of sites in the plane can be done by rendering all the associated distance functions (represented as polygonal meshes) and reading out the z-buffer (and possibly the frame buffer if we also want the site IDs. though. 14Furthermore. we describe a method that can produce much better approximations. If we want to compute a three-dimenional DF. by Sethian. discretized Voronoi regions). However. The method described in the following was presented by Hoff et al. if there are n point sites in the plane. from a different point of view. the distance values are not even an upper bound on the real distance. However. polygons.. not only from top to bottom and back. Figure 64: The distance function of sites in 3D is different for the different slices of the volume.e.2 Projection of distance functions The previous method can be applied to all kinds of surfaces S. the matrix d M contains vectors instead of scalars. but also from left to right. One noteworthy catch. If we consider this a surface in 3D. curves) is a little bit more complicated (see Figure 63). then. Another option is to increase the size of d M . an approximate vector distance ﬁeld can be computed. then we proceed sliceby-slice.44 Figure 63: More complex sites have a bit more complex distance functions. one can make a few more passes. m = number of voxels. is that the distance functions of the sites changes from slice to slice.42 Zachmann/Langetepe: Geometric Data Structures for CG Figure 62: The distance function of a point site in the plane is a cone. The distance function for other features (line segments. For instance. Now. Analogously. and initializing each search with the distance (and vector) to the closest point of a nieghbor voxel. for each voxel in the neighborhood of the surface (usually just the 33 -neighborhood) we compute vectors to the exact closest point on the surface. So. the accuracy of the distance values can be pretty low. In the following.. in fact.83 Let us consider the distance ﬁeld of a single point in 2D.14 In order to further improve accuracy. etc. i. The time complexity of this method is in O(m). only the smallest one wins and gets “stored” with that point — and this is exactly what the z-buffer of graphics hardware was designed for. Obviously. it can produce only very gross approximations. In other words. this shell is propagated by several passes with the vector-valued matrix d M . the result is only an approximation of the distance ﬁeld. In order to improve the accuracy. However. we can proceed in two steps: ﬁrst. the distance function for a point Siggraph 2003 Tutorial 16 .50 In that case.1. the distance ﬁeld of a point in a plane is just the orthogonal projection of suitable cone onto the plane z = 0.

there will be in-between models that almost vanish. 6. 6. S is warped by some function W(t..e.S) + (1 − t)DT . i. In the following. and ﬁnally an elastic part that is not a linear transformation: W(t. The idea of the warp is that it encodes the expertise of the user who usually wants a number of prominent feature points from S to transition onto other feature points on T. The rotation and translation of the warp function can be determined by least-squares ﬁtting. sometimes it refers only to those transitions that are bijective.. such that M(0. Therefore. the term morphing is equivalent to the notion of homeomorphism in the area of topology. Sometimes. then a translation. Aomng them are motion planning in robotics. x) into S . she wants the corresponding tips of nose. we usually want to split the morphing into two steps (for each t): ﬁrst. it was presented by Cohen-Or et al.i ) = p1.i ∈ S.59 collision detection.. where p0. T) = tDS + (1 − t)DT .i ). x) = (1 − t)I + tE R(a.97 navigation in virtual environments. p0. In the following. shape matching. S) = S. the number of “holes” in S and T is different). Therefore. M(t.i ∈ T (see Figure 65).2. then DS and DT are interpolated. with the point site being coincident with the vertex of the hyperboloid (see Figure 64). if S and T are “aligned” with each other (in an intuitive sense). the user can identify feature points that should transition into each other during the morph. there is a bit of confusion about terms: sometimes.Zachmann/Langetepe: Geometric Data Structures for CG 43 that lies not in the current slice is a hyperboloid. θ) is a rotation about axis a and angle θ. i. x) such that W(1.90 reconstruction. to name but a few. we are looking for a shape transformation M(t.e. we can assemble it from a rotation.2 Applications of DFs Due to their high information density. t ∈ [0. tθ)x + tc (17) In order to obtain a polygonal representation. we can just interpolate linearly between the two DFs of S and T yielding a new DF M(t. in addition to the DF interpolation.70 morphing. and have a continuous inverse. while the elastic transformation can be formulated as a Siggraph 2003 Tutorial 16 . the user has to specify a small number of correspondences (p0. S) = T.56 offset surface construction.i . For instance. i. and feet of two different characters transition into each other.35. we will highlight two easy ones of them.i .20 The nice thing about a volumetric representation is that it can naturally handle genus changes (i. and the term metamorphosis is used to refer to the broader deﬁnition. distance ﬁelds have a huge number of applications. However. S) = J(t. we determine a warp function W(t.1 Morphing One interesting application of DFs is morphing. morphing refers to any smooth transition. Rd ). when morphing two sticks that are perpendicular where E is the elastic transformation. R(a.14. The difference between a homeomorphism and a metamorphosis is that the former does not allow to cut or glue the shape during the transition (this would change the topology).e.19 volumetric modeling. p1.20 to each other. In the simplest form.. (16) Figure 65: By specifying correspondences. and p1. 1]. In the latter case. we can compute the isosurface for the value 0. M(1.76 and dynamic LODs. Then.e. continuous. we will describe a simple method for metamorphosis of two shapes given as volumetric models. Since the warp function should distort S as little as possible (just “align” them). ﬁngers. and c is the translation. the problem of ﬁnding a “smooth” transition from a shape S ⊂ Rd to a shape T ⊂ Rd . S. This works quite well. S) = tDW(t.54.

conceptually. the result is shown. scattered data interpolation problem. Examples of volumetric modeling is constructive solid geometry (CSG) and voxel-based modeling. there is need for more complex dynamic structures which allow efﬁcient insertion and deletion of objects.14 Figure 68: Close-up view showing the adaptivity. such as union. One method that has proven quite robust is the approach using radial basis functions. Computing the Boolean operation on two DFs basically amounts to evaluating the appropriate operator on the two ﬁelds. then a recursive procedure has to be applied to the object’s ADF in order to compute the resulting ADF. the static structure mostly has to cope with data queries due to its geometric intention. the two DFs for tool and object are shown superimposed. Often a simple static data structure is sufﬁcient if the set of represented geometric objects will have few changes over time. The AVL-tree implementation is more complex Siggraph 2003 Tutorial 16 . The following tables gives these operators for a ﬁeld DO (for the object) and a ﬁeld DT (for the tool): Boolean op.20 6. The advantage of using distance ﬁelds for volumetric modeling is that they are much easier to implement than CSG. but provide much better quality than simple voxelbased approaches.2 Modeling A frequently used modeling paradigm in CAD is volumetric modeling. subtraction. except that here the subdivision is governed by the compliance of new object ADF with the tool ADF: a cell is further subdivided if it contains cells from the tool ADF that are smaller. If the set of objects varies very much over time. on the right. But if the set M has many changes over time. which means that objects are. the advantage is that it is fairly simple to deﬁne Boolean operations on such a representation. Once created. DT DO∩T = max DO . For example a one dimensional sorted array of a ﬁxed set M is sufﬁcient for x is Element of M queries. If ADFs are used for representation of the DFs. −DT Figure 66 shows an example of the difference operation. DT DO−T = max DO . a dynamic AVL-tree would be more likely.44 Zachmann/Langetepe: Geometric Data Structures for CG 2 1 0 -1 -2 2 1 0 -1 -2 -2 -1 0 1 2 Figure 66: Example of difference of two DFs. Figure 67: Example of a 3D difference operation. deﬁned by specifying for each point whether or not it is a member of the object. Union Intersection Difference operator on DF DO∪T = min DO . It is similar to the generation of ADFs (see above). On the left.2. 7 Dynamization of Geometric Data Structures We present a generic approach for the dynamization of an arbitrary static geometric data structure. The interested reader will ﬁnd the details in Cohen-Or et al. and intersection. and if the trilinear interpolation inside the cell does not approximate well enough the ADF of the tool.

D) Insert(W.: BV (n) QV (n) EV (n) u Import 7. q): extract(V. D): Build the structure W of type TDyn with data objects in the set D. d): Delete the complete data structure W from the storage.2 we present methods allowing insertion and deletion in amortized efﬁcient time. D) query(V.e. We want to deﬁne the generic dynamization by a module that imports the following operations from TStat: build(V. For details see Klein55 or the work of Overmars72 and van Kreveld. D): Collects all data objects D of V in a single set an returns a pointer to this set. Note. The cost functions depend on the implementation of TStat.Zachmann/Langetepe: Geometric Data Structures for CG 45 since rotations of the tree has to be considered for insertion and deletion of objects. The notations are fully presented in Figure 69. the AVL-tree dynamization was invented for the special case of the one-dimenional search.1 Model of the Dynamization Let us assume that TStat is a static abstract (geometric) data type. Within this section the dynamization technique is explained in detail and the amortized cost of the new operations are shown. Gives the answer (objects of D) to a query to V with query object q. Query(W. D): Collects all data objects D of W in a single set and returns a pointer this set. The effort of the dynamization itself is amortized over time. Similar ideas for the worst-case sensitive approach are sketched in Section 7. but they are easy to implement and efﬁcient for many applications.4. D): Build the structure V of type TStat with all data objects in the set D. Modul Dynamize Export Comp.89 We present a simple example in Section 7. Since we have a geometric data structure. For many applications this is already efﬁcient enough. Extract(W. Once this generic approach is implemented it can be used for many static data structures. i. We want to show that it is possible to dynamize a simple static data structure indirectly but also efﬁciently in a general setting.: SW (n) Space: SV (n) Figure 69: Dynamization in the generic sense. Note. D) Comp. Space.. Insert object d into W. that the cost function of TDyn will depend on the cost functions of TStat together with the efﬁciency of the our general dynamization. Additionally. d): Delete d out of W. we assume that the essential motivation of TStat is a query operation on the set of stored objects D. The dynamization module should export a dynamic abstract (geometric) data type TDyn with the following operations: Build(W. query(V. Erase(W): Insert(W.3.: BW (n) QW (n) EW (n) IW (n) DW (n) ADT TDyn ADT TStat Build(W. that the new operations Delete and Insert are necessary since we have a dynamic data type now. Delete(W. we introduce some cost functions for the operations of the abstract dynamic and the abstract static data type. In Section 7. D) Query(W. In Section 7. q) Extract(W.1 we formalize the given problem and deﬁne some requirements. erase(V): Delete the complete data structure V from the storage. q) extract(V. Additionally. D) of TStat. for a query object q the answer is always a subset of D which might be empty. q): Gives the answer (objects of D) to a query to W with query object q. d) Delete(W. In order to guarantee some bounds for the corresponding cost functions of TDyn the cost functions Siggraph 2003 Tutorial 16 . The generic approaches presented here are not optimal against a dynamization adapted directly to a single data structure. For example let BV (n) denotes the time function for the operation Build(V. d) build(V.

n2 . see the requirements. It is also easy to see that log n SW (n) ≤ i=0 ∑ SV (2i ) ∈ O(SV (n)). they should not oscillate. If a new element has to be inserted we hope that only a single structure Vi may be concerned. EV (n) ≤ 2 · BV (n). n2 . BV (n) n Build(W. The collection of these structures is a representation of Wn which is called binary structure (see Figure 70). . d) and Delete(W. 4. Computing the binary representation of n and the decomposition into Di can be done in linear time O(n).2 Amortized Insert and Delete 7. a1 a0 is the binary representation of n. We can prove EW (n) ≤ log n EV (n) the results of extraxt(Vi ) for at most log n structures Vi .. D). Additionally. n. Di ) for every Di . Di ) needs BV (2i ) time. To build up the binary structure Wn we proceed as follows: We used the fact that cally. Build(W. D): Compute binary representation of n = |D|. and also log n with n > 1. Similar results hold for some other operations.t.1 Amortized Insert: Binary Structure The very ﬁrst idea is to implement Insert(W. QV (n) and EV (n) increase monotonically in n. We have i ≤ l = log n and therefore we conclude: log n i=0 3. d). d) : Extract(W. QW (n) ≤ log n Qv (n) holds if we assume that the query can be decompose as well. d) : Extract(W. Altogether we have BV (n) n O(BV (n)). In principle. but not 2n . examples n. Let n = al 2l + al−1 2l−1 + .r. EV . For all f ∈ {QV . D \ {d}). we assume that the that the query operation can be decomposed. as well as the products of this functions. 2n . 2. Decompose D into sets Di with |Di | = 2i w. the binary structure Wn can be constructed as quick as the corresponding structure V. i. BV . so that f (2n) ≤ C f (n).2. n2 . . Siggraph 2003 Tutorial 16 . n. √ examples: 1.46 Zachmann/Langetepe: Geometric Data Structures for CG of TStat must not increase arbitrarily. 2log n increases monotoni- BV (n) n BW (n) ∈ O(n + BV (n)) = O(BV (n)) since BV (n) is at least linear. (n) and SVn increase monotonically in n. D ∪ {d}) Delete(W. Then al al−1 . d) lead to the solution of query(V. examples: 1. ∑ BV (2i ) log n = ≤ ≤ ∈ i=0 log n i=0 ∑ 2i 2i BV (2i ) 2i BV (n) n ∑ 7. √ n. Altogether we deﬁne the following requirements which are fulﬁlled in many cases: 1. The operation build(Vi . log n. n log n. On the other hand for the proof of some time bounds we need some kind of monotonic behavior in the functions. Moreover. SV } there is a constant C ≥ 1. Therefore we distribute the n data objects of the static structure V among several structures Vi . + a1 2 + a0 mit ai ∈ {0. 2n . Lemma 10 BW (n) ∈ O(BV (n)).e. . D). the representation of n. 1}. n log n. This is true for many kinds of range queries. . n. d) directly by Insert(W. Build(W. Compute build(Vi . for a decomposition V = V1 ∪ V2 ∪ · · · ∪ Vj of the data set V the results of the single operations query(Vi . For every ai = 1 we build a structure Vi which has 2i elements. This throw-away implementation is not very efﬁcient.

e. build(V3 . d) is performed in amortized time I W (s) ∈ O log s BV (s) . . D1 ). D := D0 ∪ D1 ∪ D2 ∪ {d}. For a sequence of s different operations let Work be applied k times.. the length of the operation sequence. In this example we had to perform the following tasks: extract(V0 . extract(V2 . . Therefore it remains to analyse IW (n). Generally. D0 ).2. . s IW (n) ≤ ≤ ∈ i=0 ∑ EV (2i ) + Cj + BV (2 j ) EV (2 j ) + Cj + BV (2 j ) O BV (2 j ) . Queries do not change the size of the data set and so we can also replace s by the number of insertions here. let Work be an arbitrary operation with cost function W.Zachmann/Langetepe: Geometric Data Structures for CG 47 V4 2 4 V4 V3 23 V2 22 V1 21 V0 20 W23 W24 Figure 70: The binary structure Wn contains the structure Vi if ai = 1 holds for the binary representation of n. The current data set may have a number of elements n ≤ s. that this is not an expected value and that W is a function of s. In general we have to build up Vj and extract and erase Vj−1 . that except insertions there are only queries in s. j − 1 and a j = 0 holds (in the binary representation of the current n). Theorem 11 A static abstract data type as presented in Figure 69 can be dynamized by means of the binary structure in a dynamic abstract data type TDyn so that the operation Insert(W. . Vj−2 . Altogether. i.. s Note. . D). Thus the effort for all Insert(W. For examples see n = 23 (left) and n = 24 (right). d) operation one can prove I W (s) ∈ O log s BV (s) . the results are presented in the following theorem. 1 . In this special case we have j−1 Note. D2 ). . For the Insert(W. yet. As we have seen from Figure 70 sometimes the whole structure of Wn is destroyed when Wn+1 was build up. If total cost of k Work operationen ≤ W(s) k holds for a monotonically increasing cost function W. . We have SW (n) BW (n) QW (n) ∈ ∈ ∈ log n Sv (n) BV (n)) log n Qv (n). we say that the operation Work is performed in amortized time W(s). extract(V1 . d) is amortized over time. For a long sequence of insertions many of them are performed without extreme reconstructions. Siggraph 2003 Tutorial 16 Let n be the size of the current data set.2 Amortized Delete: Occasional Reconstruction Assume that we did not have implemented the Insert operation. V0 only if ai = 1 holds for i = 0. 7.

Siggraph 2003 Tutorial 16 . If Weak. d) and with additional cost function WDV (n) can be dynamized by means of occasional reconstruction in a dynamic abstract data type TDyn so that BW (r) EW (r) QW (r) SW (r) DW (s) = BV (r) ∈ O (EV (r)) ∈ O (QV (r)) ∈ O (SV (r)) ∈ O WDV (s) + BV (s) s . Therefore in addition to the binary structure we construct a balanced searchtree T that stores this information.Delete(W. . . searchtree T and occasional reconstruction in a dynamic abstract data type TDyn so that the amortized time for insertion reads I W (s) ∈ O log s BV (s) s .2. For many data structures it is easier to simply mark an object as deleted. d) there is an additional O(log n) for searching the corresponding Vi and for marking d as deleted in Vi .2. This can be efﬁciently realized by collecting the pointers of T to Vi in a list for every Vi . If an object d has to be inserted we have to update T. Physically the object remains in the structure but does no longer belong to the data set D. . Therefore the deletion of an objects is much more difﬁcult than the insertion.delete(V. But furthermore if V0 .1 we use and the amortized time for deletion reads DW (s) ∈ O log s + WDV (s) + BV (s) s . for TStat we introduce an additional operation weak. The size of the current actual data set is denoted with r and s denotes the length of the operation sequence. d) with cost function WDV (n). These objects have bad inﬂuence on the running time of all operations although they are no longer necessary. We collect the pointers and change them to "‘Vj "’. For the rest of the operations we have BW (r) EW (r) QW (r) SW (r) = ∈ ∈ ∈ BV (r) O (log r EV (r)) O (log r QV (r)) O (SV (r)) . . A static abstract data type with a weak delete implementation is given. the binary structure for the insertion. 7. Therefore from time to time we have to reconstruct the data structure for the actual data set. an example is shown in Figure 71. We simply want to construct a strong delete function with an acceptable amortized time bound for TDyn. d) is applied. Query operations are not involved. As in Section 7. For Weak. Altogether we conclude: Theorem 13 A static abstract data type as presented in Figure 69 with an additional operation weak.3 Amortized Insert and Amortized Delete In the preceeding sections we have discussed Insert and Delete separately.delete(V. But we do not know in which of the structures Vi the element d lies.delete(V.Delete(W. Then we erase V and build a new structure V out of D. The object d gets an entry for its structure Vj in T. this is done in time O(log n) and it will not affect the time bound for the insertion. d) and with additional cost function WDV (n) can be dynamized by means of binary structure. For every d ∈ W there is a pointer to the structure Vi with d ∈ Vi . The additional cost of the search tree T is covered as follows. d) until D has only the half size of V. Vj−1 has to be erased the corresponding objects should point to Vj afterwards. Deletion may cause fundamental reconstruction. Therefore we use weak. This gives the following result. This operation is already covered by time O(BV (2 j )) for constructing Vj . The operation weak.delete(V. First of all. holds.2. Now we want to show how to combine the two approaches. d should be marked as deleted in W.2. We omit the proof here. Theorem 12 A static abstract data type as presented in Figure 69 with an additional operation weak.delete is only available for the structures Vi and we have to extend it to W in order to apply the result of Section 7.48 Zachmann/Langetepe: Geometric Data Structures for CG If we have to delete an object we can not choose its location beforehand. The cost of the occasional reconstruction is amortized over the preceeding delete-operations.

B. a modiﬁed binary representation is used in order to distribute the effort of the reconstruction over time. The size of the current actual data set is denoted with r and s denotes the length of the operation sequence. 7. D) ∈ O(BV (n)) Query(W. . pp. SelfCustomized BSP Trees for Collision Detection. We only refer to the result of this approach. the structure Vj should be ﬁnished if Vj−1 . ACM Comput. d) ∈ O log2 n Delete(Dyn(k-d). Tal.. in Computer Graphics (SIGGRAPH ’87 Proceedings). For the interested reader we refer to Klein55 or van Kreveld89 and Overmars. thus we obtain WDk-d (n) = O(log n).2 an easy implementation of the static k-d-tree was presented with Sk-d (n) = O(n) √ and query time Qk-d (n) = O( n + a).delete(k-d. Ar.72 Theorem 14 A static abstract data type as presented in Figure 69 with an additional operation weak. Tal. d) ∈ O (log n) Space O(n). Delete(W. . stored data objects. The main idea for the construction of the dynamic data structure was given by the binary structure of Wn which has fundamental changes from time to time but the corresponding costs were amortized. Deferred.4 A Simple Example 7. q) ∈ O( n log n + a) Insert(Dyn(k-d).e. x) can be implemented in O(log n) time. thus implementing worst-case sensitive insertion and deletion. M. Obviously. ac. pp. 23 (1991). C. vol.Zachmann/Langetepe: Geometric Data Structures for CG 49 1 2 3 4 5 6 7 8 9 10 11 12 T 13 14 15 V3 V2 V1 V0 Figure 71: A structure W15 with a searchtree T storing pointers to Vi for every d ∈ Vi . References [1] S. d) and with additional cost function WDV (n) can be dynamized in a dynamic abstract data type TDyn so that Build(W. Application of Theorem 14 results in: Build(Dyn(k-d). Siggraph 2003 Tutorial 16 . [4] F.html. July 1987. Let Dyn(k-d) denote the dynamic variant based upon the statically implemented k-d-tree.. 2002. we take a simple example from Section 2 and apply Theorem 14. Self-Organizing BSP Trees.ee. [3] J. 21. ed. i. pp. Voronoi diagrams: A survey of a fundamental geometric data structure. 15 (2000). . Stone. and A. 269–278. Computational Geometry: Theory and Applications. D) ∈ O(n log n) √ Query(Dyn(k-d). [2] S.3 Worst-Case sensitive Insert and Delete In the last section we have seen that it is easy to amortize the cost of Insert and Delete analytically over time. Kirk. Here n denotes the number of relevant. Ar. Sept.technion. V0 has to be erased. pp. q) ∈ O(log n · QV (n)) Insert(W. In Section 2. 345–405. weak. 55–64. d) ∈ O log n n BV (n) BV (n) n For convenience.il/~ayellet/papers. Surv. Technically. Additionally we have Bk-d (n) = O(n log n). Arvo and D. in Eurographics. d) ∈ O log n + WDV (n) + Space O(SV (n)). Vj−2 . The ideas are very similar to the ideas of the preceeding sections. and A.delete(V. Chazelle. http://www. The idea is to distribute the construction of Vj itself over time. 91–102. G. Fast Ray Tracing by Ray Classiﬁcation. Now we are looking for the worstcase cost of Insert and Delete. Aurenhammer.. where a represents the size of the answer (see Theorem 4). Montag. B.

2000. 12 (1977). A computational geometry approach to clustering problems. 3rd Annu. 2001. 15 (1996). 339– 354. 1999. Germany. 1992. Avro and D.. Guaranteed-quality mesh generation for curved surfaces. ACM Sympos. Primitives for the manipulation of three-dimensional subdivisions. Kirk. 9th Annu. Berlin. [18] N. Lingas. 245–250. Bibliographic notes on Voronoi diagrams. Borgefors. Algorithmica. in Proc. Seeger. 2002. pp. and K. I. pp.inria. pp. 1991. [24] F.. 321–345. B. pp. Laszlo. A. Amsterdam. Academic Press.2. San Diego. J.pdf. J. [28] R.-L.50 Zachmann/Langetepe: Geometric Data Structures for CG [5] F. Schneider. vol.. ISSN 0167-7055. [26] H. North-Holland. T.. R. [8] L. Theoret. in Proceedings of the 2002 International Conference on Imaging Science.. 97–108. vol. 252–263. Dwyer. 1989. eds. pp. C. Brown. Chin. ISBN 0-12-2861604..-T. Sci. Computational Geometry: Algorithms and Applications. Graphics. Hamann. in Proc. and A. Comput. Sack and J. pp. Systems. 1984. pp. Algorithms. pp. [7] L. A. et al. 201–262. [11] N. pp. J. 487–491. ACM Sympos. of IEEE International Conference on Image Processing (ICIP). R. K. tech. Vetterli. 1995.uk/Research/ Rainbow/publications/pjcb/thesis/. 201– 290.zib. ed. in Graphics Gems III. ACM SIGMOD Conf. in Computer. Constrained Delaunay triangulations. 28 (2000). pp. . Sci. [19] D. Vranch. Linear Size Binary Space Partitions for Fat Objects. de Berg. 1990. pp.cl. Siggraph 2003 Tutorial 16 .V. in Proc. on Management of Data. Algorithmica. [15] P. 1992. 274–280.. Computer Graphics Forum. 54–64. M. Discrete Comput. 322–331. 3–32. of the 13th Canadian Conference on Computational Geometry (CCCG). ISSN 0730-0301. 2nd ed. National Institute of Standards and Technology. 1998. 17 (1998). P. . Beckmann. pp. Glassner. M. Linear size binary space partitions for uncluttered scenes. PhD dissertation. ACM Transactions on Graphics. BOXTREE: A Hierarchical Representation for Surfaces in 3D. in Proc. de Berg. Levin. pp. vol. D. vol. University of Cambridge. Geom. Schwarzkopf.. Computational Analysis of 4-8 Meshes with Application to Surface Simpliﬁcation using global Error.ac. Teillaud. 2000. pp. C387–C396. A convex partition of R3 with applications to Crum’s problem and Knuth’s post-ofﬁce problem. Academic Press. Athens. 4 (1989). A. Geom. and M. On computing the Voronoi diagram for restricted planar ﬁgures. [21] [9] G. Emmanuel College. ed.-D. chapter V. pp. 1993. pp. 343–367. Algorithmica. Noltemeier.. Comput.. Sci. B.-R.. Geom. 4 (1989). K. in Handbook of Computational Geometry. Vetterli. MD 20899. Balmelli. Georgia.fr/cgi-bin/wais_ra_ sophia?question=1140. S. Cohen-Or. pp. pp. in Proc. Dehne and H. Kriegel. Gaithersburg. Tal. in Proc. Elsevier Science Publishers B. 1st Annu. Mitchell. [10] R∗ -tree: An efﬁcient and robust access method for points and rectangles. [12] J. J. Barequet. 112 (1993). Klein. 1985. 116–141. Three-Dimensional Distance Field Metamorphosis. Guibas. 219–222. Bernal. Boissonnat and M. 17 (1998). D. [6] J. J.. Liebling.-P. Porumbescu. Dobkin and M. 519 of Lecture Notes Comput. Aurenhammer and R. and B. Dewdney and J. 979 of Lecture Notes Comput. 353– 366. http://www. L. vol. 193–199.cam. CA. European Sympos. H. F. Comput. Quadtrees for Embedded Surface Visualization: Constraints and Efﬁcient Data Structures. 2.. and O. de/EVlib/Show?EVL-1998-152. 2nd Workshop Algorithms Data Struct. J. ACM Transactions on Graphics. Bremer. Djidjev and A.de/ Publikationen/tr198. [13] G. On the randomized construction of the Delaunay tree. S. Vision. Overmars. http://www. [20] . http://wwwpi6. Solomovici. K. [25] A. C484. Feb. P. Kovacevic. Ma. Virtual Clay Modeling using Adaptive Distance Fields. in Proc. [16] [17] L. Utilitas Math. Voronoi Diagrams. Oct. [14] P. Chew. Joy. Selective Mesh Reﬁnement for Rendering. Higher-dimensional Voronoi diagrams in linear expected time. B. in An Introduction to Ray Tracing. Balmelli. 1. pp. 27. [22] M. 6 (1991). H. ed. 116–141..fernuni-hagen. J. Partitioning a 3D Convex Polygon with an Arbitrary Plane. Kuester. and Technology (CISST 2002). van Kreveld. [27] D. The [23] M. A. Springer-Verlag. and M. Chazelle. Three-Dimensional Distance Field Metamorphosis. Image Processing. Kirk. Distance transformations in arbitrary dimensions. Urrutia.. A survey of ray tracing acceleration techniques. http://visinfo. rep. and D. Aug.

A. Voronoi diagrams and Delaunay triangulations. no. and S. 123–142. [44] K. 171–180. Dept. ISBN 07803-7200-X. On Visible Surface Generation by a Priori Tree Structures. Lu. Rockwood. 4th Canad. Geom. Goldsmith and J. U. Akeley. Primitives for the manipulation of general subdivisions and the computation of Voronoi diagrams. [37] D. Y. Numerically robust incremental algorithm for constructing three-dimensional Voronoi diagrams. Du and F. Academic Press. 246– 259. Mathematische Lösungsverfahren für planare Standortprobleme. and N. [43] [32] A.. 1. R. Stolfi. 1992. Comput. 1992. [45] J. Perry. 7 (1987). T. July 1980. in Proc. 1987. and B. J. ACM Sympos. http://visinfo. L. Fuchs. [38] [39] A. S. Huang. 14. A complete distance ﬁeld representation. pp. Subramanian. pp. Iowa. Z. R. [46] P. Keyser. pp. Of Computer Science. Jones.Digital Elevation Models. R. [31] S. Caruso. 170–175. ed. K. 2001. 74–123. Kenneth E. [49] . Hoff III. US Geological Survey. Implementing Watson’s algorithm in three dimensions. in Proc. 500–510. Li. pp. 10 (1989). M. 1 of Lecture Notes Series on Computing. Comput. Fussell and K. 1986. eds. 3-Dimensional Triangulations from Local Transformations. Field. in SIGGRAPH 96 Conference Proceedings. Statist.. W. 247–254. C. pp. Keyser. 1996. Gottschalk. K. Shape representation using space ﬁlled sub-voxel distance ﬁelds. Lin. Algorithmica.edu/ ~geom/voronoi/. and D. C. 316–325. T. 375–376. ACM SIGGRAPH. and T. pp. W. pp. Kedem. M. Conf. California. in Computing in Euclidean Geometry.-Z. West Germany. A. Salmon. 14–20. Aug. M. held in New Orleans. [51] T. Lin. Joe.Zachmann/Langetepe: Geometric Data Structures for CG 51 [29] H. 1995. [50] M. Liou. Graph. R. pp. 249–254. P. pp. Iowa City. M. 223– 241. Fast Ray Tracing Using K-D Trees. of Texas. OBB-Tree: A Hierarchical Structure for Rapid Interference Detection. SIAM J. ed. [36] H. M. Jones and R. The First Worjshop on Simulation and Interaction in Virtual Environments. Incremental construction and dynamic maintenance of constrained Delaunay triangulations. 2nd Annu. Ehmann and M. Adaptively Sampled Distance Fields: A General Representation of Shape for Computer Graphics. E. 20. Algorithms in Combinatorial Geometry. C. A. Fast Computation of Generalized Voronoi Diagrams Using Graphics Hardware. July 1995. 718–741. Heidelberg. Inagaki. I. Comput. and D. Manocha. http://www. Mar. Hwang. in Computer Graphics Forum. ed. J. Culver. pp. Hamacher. [41] [30] H. N... 1988. vol. Fast Computation of Generalized Voronoi Diagrams Using Graphics Hardware. Mount. Hoff. J. [47] H. Rushmeier. Verlag Vieweg. M. Real-Time Collision Detection and Time-Critical Computing. 277–286. Glassner. [34] S. SpringerVerlag. Wiesbaden. Geom.cs. pp. Shah. 4 (1985). LA.. pp. Aug. Hubbard. in Computer Graphics (SIGGRAPH ’80 Proceedings). Sugie. A. J. Technical Report Geological Survey Circular 895-B. Annual Conference Series. Satherley. 334–339. [42] H. Siggraph 2003 Tutorial 16 . M. D. World Scientiﬁc. Comput. University of Iowa. H. 4th Canad. USGS digital cartographic data standards . and D.. 193–233. Incremental topological ﬂipping works for regular triangulations. Automatic Creation of Object Hierarchies for Ray Tracing. Lin. Lin. 2001. vol. [48] B.. Comput. ACM Trans. Crawfis. 1st ed. Louisiana. Edelsbrunner. 10 of EATCS Monographs on Theoretical Computer Science. Naylor. vol. pp.8– 13 1999. Fortune. Technical Report TR-88-07. Construction of Three-Dimensional Delaunay Triangulations Using Local Transformations. [33] D.. Kao and D. in SIVE 95. in Proc. An Introduction to Ray Tracing. S. Singapore. F. Accurate and Fast Proximity Queries Between Polyhedra Using Convex Surface Decomposition. Manocha. Geom. [35] S. Computer Graphics Proceedings.. 1989. 1992. Conf. 1984. 04-09 August 1996. pp. [40] S. F. vol. Austin. Aided Geom.. pp. 2000. in Siggraph 2000. Manocha. Edelsbrunner and N. 15 (1996). A. K. Design. Sugihara. ISSN 1067-7055. pp. pp.unc. Sci. Culver. Frisken. 92–96. pp.de/EVlib/ Show?EVL-2000-61. Guibas and J. IEEE Computer Graphics and Applications. Y. 124–133.zib. Elassal and V. in Proceedings of the conference on Visualization 2001. R.. 8 (1991).

Bonn. Akenine-Mller. H. 485–503. 14 (1995). B. and G. 109–118. Aug.. pp. Overmars. NY. Efﬁcient Collision Detection Using Bounding Volume Hierarchies of k-DOPs. L. 1996. and W. 1991. and A. in Math. and M. 2001. Geom. 139–144. Louisiana. and W. Li and J.. P. West Germany. Baskett. Bruckstein. Lee and A. H. [74] I. 4 (1998). [57] J. Kay and J. ed. 163–169. eds. A. 24. Paglieroni. 21–36. pp. Klein. IEEE Transactions on Visualization and Computer Graphics. Latombe.cs. [72] M. 154–166. F. Klosowski. 19 (2000). T. J.Tokyo. D. AddisonWesley. W. W. pp. 198–207. pp.-C. Detail Rendering of Height Fields. [69] B. [59] [60] J. Stone. Marching Cubes: A High Resolution 3D Surface Construction Algorithm. Lopez. R.oldenbourg. Ray Tracing Complex Scenes. Thibault. Taiwan. Los Alamitos. 1997. The Design of Dynamic Data Structures. Lorensen and H. J. 369–380. P. Efﬁcient binary space partitions for hidden-surface removal and solid modeling. Chazelle. Straer. M..Brussels . A Tutorial on Binary Space Partitioning Trees. [68] B. Kimmel. in Proc. [56] R. Ribarsky. [65] [53] T. T.. Automatic Creation of Object Hierarchies for Radiosity Clustering. in Computer Graphics (SIGGRAPH ’90 Proceedings). S. Kajiya. pp. pp. Springer-Verlag. L. (1996).-S. Zikan. B. S. Dobkin. Klein. 269–278. Lindstrom and V. [67] [55] R. The SR-tree: An Index Structure for High-Dimensional Nearest Neighbor Queries. Reconstruction and simpliﬁcation of surfaces from contours. Merging BSP Trees Yields Polyhedral Set Operations. CVGIP: Graphical Models and Image Processing. Larsson and T. [58] T. ACM SIGMOD Conf. on Management of Data. [64] Siggraph 2003 Tutorial 16 . 54 (1992). Boston. 1986.. ed. pp. 1990. Kluwer Academic Publishers. Software III. 201–217. Schfer. 156 of Lecture Notes Comput. May 7–11 2001. http://cg. L. Real-Time. STR : A Simple and Efﬁcient Algorithm for R-Tree Packing. Matching 3D models with shape distributions. C. Faust. S. 04-09 August 1996. 1983. pp. Amanatides. ed. vol. pp. in Eurographics. [73] [62] S. and D. pp. B. Yao. M. Discrete Comput. [71] R. 105– 116. July 1987.. [66] [54] R. ed. http://www. in International Conference on Shape Modeling and Applications. in Proc. vol. ed. Hughes. F. Grimsdale. Kiryati.. Fellner. and W. 1997. CA. Software for C1 surface interpolation. Naylor. Klein. W. H. Computer Graphics Forum. pp. ISSN 0167-7055. K. Athay. Collision Detection for Animation using Sphere-Trees. T.uni-bonn. Aug. ISSN 0167-7055. vol. Edgington. Lindstrom. ISBN 0-8186-7807-0. held in New Orleans. and K. Heidelberg. Chen. Schilling. Werner. Algorithmische Geometrie. in Proc. 21. Apr. pp. 5 (1990). Rice. pp. C. Continuous Level of [75] M. Visualization of Large Terrains Made Easy. T. [63] T. [61] D. Sci. 1997. San Diego. Lawson. Incremental 3D Collision Detection with Hierarchical Data Structures. Computer Graphics Forum. Satoh. Distance Transforms: Properties and Machine Vision Applications. pp. [70] M. C. 1977. Held. IEEE Visualization. J. 56–74. Naylor. Mitchell. N. short presentation.. Pascucci. 115–124.asp?id=31. Taipei. 14 (1998). Nov. in Paciﬁc Graphics. ACM SIGGRAPH. 161–194. A Geometric Approach to 3D Object Comparison. New York. pp. Sowrizal. E. Funkhouser. Evans and R. 1998. 427–436. Robot Motion Planning. 1 (1986). Aug. J. M. Palmer and R. in Proceedings of the International Conference on Shape Modeling and Applications (SMI-01). N. 497–507. Turner. in SIGGRAPH 96 Conference Proceedings. Katayama and S. pp.. in Computer Graphics (SIGGRAPH ’87 Proceedings). Mller. J. Multi-Valued Distance Maps for Motion Planning on Surfaces with Moving Obstacles. de/publications/publication. D.52 Zachmann/Langetepe: Geometric Data Structures for CG [52] N. E. D. F. ACM. VRST ’98. Geom. pp. F. Collision Detection for Continuously Deforming Bodies. Academic Press. 20. de/cgi-bin/rotitel?T=24382. Novotni and R. 167–175. Washington . 2001. J. Lin. G. Koller. May 2001. Discrete Comput. 1999.-Y. ACM SIGGRAPH ’96 Course Notes 29. Cline. L. D. vol. pp. 325–333. Generalized Delaunay Triangulation for Planar Graphs. Paterson and F. Osada. IEEE Transactions on Robotics and Automation. Leutenegger. Rushmeier. in Proceedings of the 13th International Conference on Data Engineering (ICDE’97). in Computer Graphics (SIGGRAPH ’86 Proceedings).

Urena. Kaufman. T. A. 1997.. 24 (1981). ph.zib. in WSCG 2000 Conference Proceedings. 15 JJ Thomson Avenue. New York. vol. Utrecht. 239–246.. . Annual Conference Series. 24. CIE-4306. Wilhelms and A. 167–172. Sci.. Wei and M. Dept. 17–31. Optimization of the Binary Space Partition Algorithm (BSP) for the Visualization of Dynamic Scenes.pdf. Seidel. Cambridge CB3 0FD. in Siggraph 2000.acm.. J. Direct spatial search on pictorial databases using packed R-trees. 357–363. Wan. An Analysis of Flame Propagation. Duce. Weghorst. Distance-ﬁeld based skeletons for virtual navigation. C. LaMansion Hotel. E.zib. Toga. Comput. A.org/pubs/articles/proceedings/ mod/318898/p17-roussopoulos/ p17-roussopoulos. V.de/EVlib/Show?EVL-1982-2. [77] F. 57–62. and M. Austin. Ogawa.de/EVlib/ Show?EVL-1996-149. Yale Univ. 1982. Dept. Dachille. Comput. Navathe. and C. United Kingdom. A. Plzen.-Y. A. G. 238–252. and D. 223– 232. D. S. Octrees for Faster Isosurface Generation Extended Abstract. pp. IIG-TU Graz. A. eds.. C. http:// www. J. http://visinfo. 2000. An optimal algorithm for constructing the Delaunay triangulation of a set of line segments. Sept. in Eurographics ’90. University of West Bohemia. pp. Johnson. van den Bergen. pp. Akeley. Ogita. Efﬁciently updating the constrained Delaunay triangulations. Torres. Czech Republic. Lastra. Utrecht Univ. and A. New Haven. Cambridge University Press. ACM Transactions on Graphics. 1987.zib. pp. org/pubs/citations/proceedings/mod/ 318898/p17-roussopoulos/. Tanemura. California. CT. University of Cambridge. pp. L. G. Rajan. 2000. 12 (1992). 3rd Annu. Payne and A. in Proceedings of the conference on Visualization 2001. 1990. E. Berkeley. Comput. Level Set Methods. A. dissertation. Watson. NY 10036. Distance ﬁeld manipulation of surface models. UCAM-CL-TR541. W. 7th Annu.ac. in Proceedings of ACM-SIGMOD 1985 International Conference on Management of Data. Greenberg. May 28–31. J. of the 1997 ASME Design Engineering Technical Conferences. 65–71. [92] [93] [94] H. C. Geom. [86] M. F. Level set methods and fast marching methods. P.de/ EVlib/Show?EVL-2000-307. Computer Graphics Proceedings. J. S. 1985. Improved Computational Methods for Ray Tracing. 51 (1983). [89] [78] V. pp.D. BIT. Sethian. 479–488. University of California. Netherlands. ed. Texas. PhD thesis.. 1992. 1996. pp. ISBN 07803-7200-X. 1990. pp. Journal of Graphics Tools. http://www. Nov.uk/users/nad/pubs/. Wang and L. F. 1999. Computational Geometry: An Introduction. ISBN 0-89791-160-1. Wienclaw. of Mathematics. [91] [80] N. Vandoni and D. Aug. in Proc. Sept. pp.. pp. http://visinfo.cam. [96] [84] [85] [97] M. http://visinfo. [98] Siggraph 2003 Tutorial 16 . pp. [81] R. 191–207. Wang. Optimality of the Delaunay triangulation in Rd . Sci. ed. 2 (1997). ACM Sympos. 1978. C. A. Tech. Real-time and Exact Collision Detection for Interactive Virtual Prototyping. Different Applications of Two-Dimensional Potential Fields for Volume Modeling. Zachmann. NY. New Results on Data Structures in Computational Geometry. Geom.acm. R. Revelles. Dept. Computational Geometry. 52–69. 2001. Shamos. Computing the n-Dimensional Delaunay Tesselation with Applications to Voronoi Polytopes. Schubert. Preparata and M. Nash. C. ph. 1991. J. Fast Texture Synthesis Using Tree-Structured Vector Quantization. Phys.. thesis.. Comput. [90] M. 1988. Cambridge University Press. in Proc. A New Algorithm for ThreeDimensional Voronoi Tesselation. 1985. Efﬁcient Collision Detection of Complex Deformable Models using AABB Trees. Hooper. ACM Sympos.D. in Proc.. Levoy. Sacramento. T. P. I. pp. 1985. [87] E. in Computer Graphics (San Diego Workshop on Volume Visualization). Will. Leifker. [88] G. R. New York. Youngblut. zib. [79] J. 1–14. Constrained Delaunay triangulations and Voronoi diagrams with obstacles. 507–518. Computer Laboratory. Comput. USA. K. 3 (1984). H.cl. Gelder. Technical Report 260. Roussopoulos and D.Zachmann/Langetepe: Geometric Data Structures for CG 53 [76] B. An Efﬁcient Parametric Algorithm for Octree Traversal. van Kreveld. 2002. 33 (1993). IEEE Computer Graphics and Applications. [95] [82] [83] . and W. Comput. Austria. I. M. Shamos. Paper no. Rep. http://visinfo. pp. de/EVlib/Show?EVL-2000-87. Springer-Verlag..http://www.

239–242.. Siggraph 2003 Tutorial 16 . Comput. Georgia. pp. . http:// [100] [101] B. VRAIS ’98. 121–128. 1991. in Proc. ACM Symposium on Virtual Reality Software and Technology (VRST). pp. in Proc. Zhu and A. China.11–13 2002. pp. in Proc. Conf. Mar. 3rd Canad.gabrielzachmann. Mirzaian. www. Rapid Collision Detection by Dynamically Aligned DOP-Trees. Hong Kong. Geom. Nov. Minimal Hierarchical Collision Detection.54 Zachmann/Langetepe: Geometric Data Structures for CG [99] . 1998. Sorting does not always help in computational geometry. Aug. of IEEE Virtual Reality Annual International Symposium. Atlanta.org/. 90–97.

- Simple Path Covers in Graphs
- ComputerAidedGeometricDesignTechniquesforSurfaceGridGeneration.pdf
- 6 Back Tracking
- Janus(EA)
- Sentence Compression as ILP problem
- sss
- research article
- COMP211slides_7
- Download
- GATE Question
- lec19
- CS301 Notes
- Tree
- cse 1997 gate paper
- Tree
- ProblemSolving Search
- Data Structure and Algorithm
- 2-3-trees
- On Prediction Using Variable Order Markov Models.pdf
- 10.1.1.105
- Short Online Q&A for DataStructure
- sigmod98
- Binary+and+Other+Trees
- 01-Bayesian Network Structure Learning by Recursive Autonomy Identification
- dtrees-vimp
- Anuga User Manual
- Non Linear Data Structures
- 10.1.1.26.1024
- DAA Chapter 6 Exploring Graphs
- Inductive Synthesis of Functional Programs

Sign up to vote on this title

UsefulNot usefulClose Dialog## Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

Loading