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

CPE 514-3 - Graphics Data Structure

Uploaded by

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

CPE 514-3 - Graphics Data Structure

Uploaded by

Samuel jidayi
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 20

CPE 514

COMPUTER GRAPHICS AND ANIMATION


MODULE 1

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.

 Every node in the tree


corresponds to a square.

 If a node v has children, their


corresponding squares are
the four quadrants

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.

 A simple recursive splitting of squares is continued until there is only one


point in a square.

 Let P be a set of points. Q = [x1Q : x2Q] £ [y1Q : y2Q]

11/14/2024 6
Quadtrees
 The definition of a quadtree for a set of points in a square

 Q = [x1Q : x2Q] £ [y1Q : y2Q] is as follows:


• If jPj · 1 then the quadtree is a single leaf where Q and P are stored.

• 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.

 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}.

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.

 Handling Observer-Object Interactions: Subdivide the


quadtree/octree until each leaf’s region intersects only a small
number of objects. Each leaf holds a list of pointers to objects that
intersect its region.

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.

 Let D be a set of n points


in k.

For convenience let k = 2


and assume that all X- and
Y-coordinates are different.
11/14/2024 12
K-d-Trees
Algorithm
 First search for a split-value s of  For both sets we proceed with
the X-coordinates. the Y-coordinate and split-lines
 Then split D by split-line X = s Y = t1 and Y = t2.
 Then repeat the process
into subsets: recursively with the constructed
subsets.
 Thus, we obtain a binary tree,
namely the 2-tree of the point
set D, as shown in the Figure
above.
 Each internal node of the tree
corresponds to a split-line.
11/14/2024 13
K-d-Trees
For every node v of the 2-d-tree defines the rectangle 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 left
and right, it leads to halfplanes R(left) and R(right) and so on.

 The set of rectangles {R(l) : l is a leaf}gives a partition of the


plane into rectangles. Every R(l) has exactly one point of D
inside.
11/14/2024 14
K-d-Trees
 This structure supports range queries of axis parallel
rectangles.
 For example, if Q is an axis-parallel rectangle, the set of sites
with Q can be computed efficiently.

 We simply have to compute all nodes v with:

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.

 • BSP-tree techniques are generally a waste of effort for small


scenes. We use them on: Large, complex scenes.

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

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy