BSP Trees - Advanced Data Structures - Lecture Slides, Slides of Computer Science

These are the Lecture Slides of Advanced Data Structures which includes Split Algorithm, Unbalanced Binary Search Trees, Forward Pass, Forward Pass Example, Backward Cleanup Pass, Retrace Path, Current Nodes, Roots of Respective Tries, Branch Nodes etc. Key important points are: Bsp Trees, Binary Space Partitioning Trees, Collection of Objects, Dimensional Hyperplanes, Classifying Object, Intersection Points, Coincident List, Dimensional Space, Collision Detection

Typology: Slides

2012/2013

Uploaded on 03/19/2013

dharmakeerti
dharmakeerti 🇮🇳

4.2

(27)

89 documents

1 / 24

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
BSP Trees
Binary space partitioning trees.
Used to store a collection of objects in n-
dimensional space.
Tree recursively divides n-dimensional
space using (n-1)-dimensional hyperplanes.
Space Partitioning
n-dimensional space
splitting hyperplane
(n-1)-dimensional
a1x1+ a2x2+ … anxn+ an+1 = 0
ax + by + c = 0 (2D)
ax+by+cz+d = 0 (3D)
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18

Partial preview of the text

Download BSP Trees - Advanced Data Structures - Lecture Slides and more Slides Computer Science in PDF only on Docsity!

BSP Trees

• Binary space partitioning trees.

• Used to store a collection of objects in n-

dimensional space.

• Tree recursively divides n-dimensional

space using (n-1)-dimensional hyperplanes.

Space Partitioning

n-dimensional space

splitting hyperplane (n-1)-dimensional a 1 x 1 + a 2 x 2 + … anxn + an+1 = 0 ax + by + c = 0 (2D) ax+by+cz+d = 0 (3D)

Space Partitioning

n-dimensional space +ve half space ax + by + c > 0 ax+by+cz+d > 0

-ve half space ax + by + c < 0 ax+by+cz+d < 0

coincident ax + by + c = 0 ax+by+cz+d = 0

Classifying Object z

• In 2D, ph is the line ax + by + c = 0.

ƒ Compute ax + by + c for all vertices of z.

ƒ If all values are = 0; z is coincident to ph.

ƒ If all values are <= 0; z is left of ph.

ƒ If all values are >= 0; z is right of ph.

ƒ Otherwise, z spans ph and is to be split by

finding intersection points with ph.

3D

x

z

y

Equation of ph is z – 2 = 0 General: ax + by + cz + d = 0

Space Partitioning

n-dimensional space

-ve +ve

-ve

+ve

coincident list

Objects in 2D

a

b

c

d

g

e

f

h

Objects in 2D

a

b

c

d

g

e

f

h

Objects in 2D

a

b

c

d

g

e

f

h a-b c-d^ e-f g-h

Objects in 2D

a

b

c

d

g

e

f

h

a bc d e f^ g^ h

Collision Detection

a

b

c

d

g

e

f

h

a bc d e f^ g^ h

Visibility Ordering

a

b

c

d

g

e

f

h

a bc d e f^ g^ h

Partitioning Hyperplane Selection

  • Face of an object.

a

b

c

d

g

e

f

h

Autopartition

• Only object

faces are used as

splitting

hyperplanes

a

b

c

d

g

e

f

h

Partitioning Hyperplane Selection

  • Axis-aligned orthogonal

hyperplanes

a

b

c

d

g

e

f

h

Partitioning Hyperplane Selection

  • Axis-aligned orthogonal

hyperplanes

a

b

c

d

g

e

f

h

3D Example

3D Example

3D Example

Another 3D Example

BSP Tree of an Object

  • Each leaf represents a region that is either wholly inside or outside the object.
  • Object surface is considered inside object.
  • Surface planes are used as partitioning planes.
  • Orient partitioning hyperplanes so that interior is to left.

a

a

b

b

BSP Tree of an Object

  • Each leaf represents a region that is either wholly inside or outside the object.
  • Object surface is considered inside object.
  • Surface planes are used as partitioning planes.
  • Orient partitioning hyperplanes so that interior is to left.

a

a

b

b

c

c

BSP Tree of an Object

  • Each leaf represents a region that is either wholly inside or outside the object.
  • Object surface is considered inside object.
  • Surface planes are used as partitioning planes.
  • Orient partitioning hyperplanes so that interior is to left.

a

a

b

b

c

c

d

d

BSP Tree of an Object

  • Each leaf represents a region that is either wholly inside or outside the object.
  • Object surface is considered inside object.
  • Surface planes are used as partitioning planes.
  • Orient partitioning hyperplanes so that interior is to left.

a

a

b

b c d e

d (^) e c

BSP Tree Construction

• Node structure:

ƒ ph = equation of partitioning hyperplane

ƒ cList = list of objects coincident with ph

ƒ leftChild

ƒ rightChild

BSP Tree Construction

BSPtree(O)

// O is object set

if O is empty , return null ; Create a new node N ; N.ph = partitioning hyperplane for O ; lList = rList = N.cList = null ; for each object z in O do if z is coincident to ph or |O| = 1, add z to N. cList ; if z is left of ph , add z to lList ; if z is right of ph , add z to rList ; if z spans ph , split z and add pieces to lList and rList ; N.leftChild = BSPTree(lList); N.rightChild = BSPTree(rList); return N;

Basic Draw Back to Front

draw(N)

if eye left of N.ph

{ draw(N.rightChild); draw N.cList; draw(N.leftChild) };

else if eye right of N.ph

{ draw(N.leftChild); draw N.cList; draw(N.rightChild) };

else // eye coincident to N.ph

{ draw(N.leftChild); draw(N.rightChild) };

Basic Draw Front to Back

draw(N)

if eye left of N.ph

{ draw(N.leftChild); draw N.cList; draw(N.rightChild) };

else if eye right of N.ph

{ draw(N.rightChild); draw N.cList; draw(N.leftChild) };

else // eye coincident to N.ph

{ draw(N.rightChild); draw(N.leftChild) };