CPE 514-3 - Graphics Data Structure
CPE 514-3 - Graphics Data Structure
11/14/2024 1
Introduction
Methods from computational geometry have been widely adopted by the
computer graphics community.
Many solutions draw their elegance and efficiency 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 representatives,
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 well known concepts,
which are both powerful and easy to implement, ranging from quadtrees to BSP
trees and bounding volume trees.
11/14/2024 2
Objectives
The major objective of this unit is to present each geometric data
structure, familiarize students 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 familiar with the
basic principles of graphics data and the type of problems in the area.
11/14/2024 3
GRAPHICS DATA STRUCTURES
1. Quadtrees
2. K-d-trees
3. BSP Trees
4. Bounding Volume Hierarchies
11/14/2024 4
Quadtrees
A quadtree is a rooted tree in
which every internal node
has four children.
11/14/2024 5
Quadtrees
Quadtrees can store many kinds of data.
It is about the variant that stores a set of points and how it suggests
recursive definition.
11/14/2024 6
Quadtrees
The definition of a quadtree for a set of points in a square
• Otherwise let QNE, QNW, QSW and QSE denote the four quadrants.
Let xmid := (x1Q + x2Q)/2 and
ymid := (y1Q + y2Q)/2, and
define PNE := {p ∈ P : px > xmid ^ py > ymid}
PNW := {p ∈ P : px · xmid ^ py > ymid}
PSW := {p ∈ P : px · xmid ^ py · ymid}
PSE := {p ∈ P : px > xmid ^ py · ymid}
11/14/2024 7
Quadtrees
The quadtree consists of a root node v, Q is stored at v.
11/14/2024 8
Uses
Quadtrees are used to partition 2-D space, while octrees are for 3-D.
The two concepts are nearly identical, unfortunate they are given
different names.
11/14/2024 9
Uses
• Inside/Outside Tests for Odd Shapes
The root node represent a square containing the shape.
If a node’s region lies entirely inside or entirely outside the shape, do not
subdivide it.
Otherwise, do subdivide (unless a predefined depth limit has been
exceeded). Then the quadtree or octree contains information allowing
us to check quickly whether a given point is inside the shape.
11/14/2024 10
Uses
• Sparse Arrays of Spatially-Organized Data
Store array data in the quadtree or octree. Only subdivide if that region
of space contains interesting data.
This is how an octree is used in the BLUIsculpt program
11/14/2024 11
K-d-Trees
The k-d-tree is a natural
generalization of the one
dimensional search tree.
For the root r, R(r) is the plane itself; for the sons of r, say left
and right, it leads to halfplanes R(left) and R(right) and so on.
11/14/2024 15
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.
The figure below depicts the
feeling of a BSP tree.
11/14/2024 16
Characteristics of BSP Tree
A BSP tree is a binary tree. • Organization:
Nodes can have 0, 1, or two Each facet lies in a unique plane. In
children. Order of child nodes 2-D, a unique line. For each facet,
matters, and if a node has just one may choose one side of its plane
to be the “outside”. (The other
1 child, it matters whether this
direction is “inside”.)
is its left or right child. This can be the side the normal
• Each node holds a facet. vector points toward. Rule: For each
This may be only part of a facet node,
from the original scene. When • Its left descendant subtree holds
constructing a BSP tree, there only facets “inside” it.
might be need for spliting Its right descendant subtree holds
only facets “outside” it.
facets.
11/14/2024 17
Uses BSP Tree
• BSP trees are primarily useful when a back-to-front or front-
toback ordering is desired: For HSR,
For translucency via blending.
• Since it can take some time to construct a BSP tree, they are
useful primarily for: Static scenes. • Some dynamic objects are
acceptable.
11/14/2024 18
Bounding Volume Hierarchies
Like the previous hierarchical data structures, bounding volume
hierarchies (BVHs) are mostly used to prevent performing an operation
exhaustively on all objects.
Like with previously discussed hierarchical data structures, one can
improve a huge range of applications and queries using BVHs, such as
ray shooting, point location queries, nearest neighbor search, view
frustum and 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 met. Here, objects can be
anything from points to complete graphical objects.
11/14/2024 19
Bounding Volume Hierarchies
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.
11/14/2024 20