Download presentation
Presentation is loading. Please wait.
Published byKenneth Thomas Modified over 9 years ago
2
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.
3
Space Partitioning n-dimensional space splitting hyperplane (n-1)-dimensional a 1 x 1 + a 2 x 2 + … a n x n + a n+1 = 0 ax + by + c = 0 (2D) ax+by+cz+d = 0 (3D)
4
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
5
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.
6
2D a b c d g e f h Equation of ph is x – 6 = 0 6
7
2D a b c d g e f h Equation of ph is y –x –2 = 0 2
8
3D x z y Equation of ph is z –2 = 0 General: ax + by + cz + d = 0
9
Space Partitioning n-dimensional space -ve+ve -ve +ve coincident list
10
Objects in 2D a b c d g e f h
11
a b c d g e f h
12
a b c d g e f h a-de-h
13
Objects in 2D a b c d g e f h a-de-h
14
Objects in 2D a b c d g e f h a-b e-fc-dg-h
15
Objects in 2D a b c d g e f h abcd e f gh
16
Collision Detection a b c d g e f h abcd e f gh
17
Visibility Ordering a b c d g e f h abcd e f gh
18
BSP Tree Construction Select partitioning hyperplanes. Partition objects. Repeat on partitions.
19
Partitioning Hyperplane Selection Face of an object. a b c d g e f h
20
Partitioning Hyperplane Selection Face of an object. a b c d g e f h
21
Autopartition Only object faces are used as splitting hyperplanes a b c d g e f h
22
Partitioning Hyperplane Selection Axis-aligned orthogonal hyperplanes a b c d g e f h
23
Partitioning Hyperplane Selection Axis-aligned orthogonal hyperplanes a b c d g e f h
24
Partitioning Hyperplane Selection Balance # objects (pieces) on each side of hyperplane Minimize increase in number of objects/pieces. a b c d g e f h
25
3D Example
29
Another 3D Example
31
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
32
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
33
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
34
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
35
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
36
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 f e d c f e
37
BSP Tree of an Object Orient partitioning hyperplanes so that interior is to left. With this orientation, left leaves are interior and right leaves are exterior. a a b b c d f e d e f c
38
BSP Tree Construction Node structure: ph = equation of partitioning hyperplane cList = list of objects coincident with ph leftChild rightChild
39
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;
40
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)};
41
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)};
42
Randomization Autopartition. Splitting hyperplane is randomly selected to be one of the object faces. Lines in 2D; planes in 3D. a b g e h
43
Randomization—2D Analysis Start with n (nonintersecting) line segments. Total number of line segments in autopartition bsp is expected to be <= n + 2n ln n. If this bound is exceeded; rerun construction. Expected number of construction rounds before this bound is not exceeded is 2. 8 3 8 4 6 n = 29
44
So, number of nodes in bsp is O(n log n). Construction time at each node is O(n) as at each node O(n) segments need to be partitioned. Time is O(n 2 log n) per construction round. 2 rounds expected. Expected complexity is O(n 2 log n). Randomization —2D Analysis 8 3 8 4 6 n = 29
45
Randomization—3D Analysis Start with n (nonintersecting) triangles. Total number of triangles in autopartition bsp is O(n 2 ). There exist n-triangle examples for which every autopartition has (n 2 ) triangles. n = 24
46
Free Partitions One that does not split an object. Do a free partition whenever possible; otherwise, randomly select a segment/face as partitioning hyperplane. 8 3 8 4 6
47
Free Partitions Using an object face, that crosses a BSP region, results in a free partition of that BSP region. Portion of black segment bounded by red (previous) splitting lines may be used to partition blue region. No segments in blue region can be split as line segments are non- intersecting.
48
Free Partitions Using an object face, that crosses a BSP region, results in a free partition of that BSP region. When green segment is used to partition blue region, segments in blue region may be split.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.