Space-based Partitioning Data Structures and their Algorithms. Jon Leonard

Similar documents
Spatial Data Structures

Spatial Data Structures

Spatial Data Structures

Spatial Data Structures

CS535 Fall Department of Computer Science Purdue University

Spatial Data Structures and Speed-Up Techniques. Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology

Computer Graphics. Bing-Yu Chen National Taiwan University The University of Tokyo

Ray Tracing Acceleration Data Structures

Spatial Data Structures

Computer Graphics. Bing-Yu Chen National Taiwan University

Organizing Spatial Data

Announcements. Written Assignment2 is out, due March 8 Graded Programming Assignment2 next Tuesday

CPSC / Sonny Chan - University of Calgary. Collision Detection II

Ray Tracing III. Wen-Chieh (Steve) Lin National Chiao-Tung University

Algorithms for GIS:! Quadtrees

Scene Management. Video Game Technologies 11498: MSc in Computer Science and Engineering 11156: MSc in Game Design and Development

Accelerating Ray Tracing

CS 563 Advanced Topics in Computer Graphics Culling and Acceleration Techniques Part 1 by Mark Vessella

Intersection Acceleration

Ray Tracing: Intersection

Collision Detection based on Spatial Partitioning

Acceleration Data Structures

Spatial Data Structures and Speed-Up Techniques. Ulf Assarsson Department of Computer Science and Engineering Chalmers University of Technology

Lecture 25 of 41. Spatial Sorting: Binary Space Partitioning Quadtrees & Octrees

Simulation in Computer Graphics Space Subdivision. Matthias Teschner

Computer Graphics (CS 543) Lecture 13b Ray Tracing (Part 1) Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

Computer Graphics II

Geometric Algorithms. Geometric search: overview. 1D Range Search. 1D Range Search Implementations

CEng 477 Introduction to Computer Graphics Fall 2007

COMP 175: Computer Graphics April 11, 2018

Hidden Surface Elimination: BSP trees

Identifying those parts of a scene that are visible from a chosen viewing position, and only process (scan convert) those parts

More Hidden Surface Removal

Computer Graphics. Lecture 9 Hidden Surface Removal. Taku Komura

Accelerated Raytracing

Query Processing and Advanced Queries. Advanced Queries (2): R-TreeR

11 - Spatial Data Structures

Spatial Data Structures for Computer Graphics

Spatial Data Structures and Acceleration Algorithms

An improvement in the build algorithm for Kd-trees using mathematical mean

Hidden surface removal. Computer Graphics

Comparison of hierarchies for occlusion culling based on occlusion queries

Geometric data structures:

Speeding up your game

Data Structures and Algorithms

Using the Holey Brick Tree for Spatial Data. in General Purpose DBMSs. Northeastern University

Collision Detection. These slides are mainly from Ming Lin s course notes at UNC Chapel Hill

Foundations of Multidimensional and Metric Data Structures

Collision and Proximity Queries

MSBVH: An Efficient Acceleration Data Structure for Ray Traced Motion Blur

CS 563 Advanced Topics in Computer Graphics QSplat. by Matt Maziarz

Dynamic Spatial Partitioning for Real-Time Visibility Determination. Joshua Shagam Computer Science

Universiteit Leiden Computer Science

Multidimensional Indexes [14]

Second degree equations - quadratics. nonparametric: x 2 + y 2 + z 2 = r 2

Algorithms. Algorithms GEOMETRIC APPLICATIONS OF BSTS. 1d range search line segment intersection kd trees interval search trees rectangle intersection

Algorithms. Algorithms GEOMETRIC APPLICATIONS OF BSTS. 1d range search line segment intersection kd trees interval search trees rectangle intersection

Acceleration Data Structures for Ray Tracing

Algorithms. Algorithms GEOMETRIC APPLICATIONS OF BSTS. 1d range search line segment intersection kd trees interval search trees rectangle intersection

Algorithms. Algorithms GEOMETRIC APPLICATIONS OF BSTS. 1d range search kd trees line segment intersection interval search trees rectangle intersection

Homework 1: Implicit Surfaces, Collision Detection, & Volumetric Data Structures. Loop Subdivision. Loop Subdivision. Questions/Comments?

INFOGR Computer Graphics. J. Bikker - April-July Lecture 11: Acceleration. Welcome!

Page 1. Area-Subdivision Algorithms z-buffer Algorithm List Priority Algorithms BSP (Binary Space Partitioning Tree) Scan-line Algorithms

Ray Tracing with Spatial Hierarchies. Jeff Mahovsky & Brian Wyvill CSC 305

Geometric Structures 2. Quadtree, k-d stromy

Chapter 11 Global Illumination. Part 1 Ray Tracing. Reading: Angel s Interactive Computer Graphics (6 th ed.) Sections 11.1, 11.2, 11.

Lecture 2 - Acceleration Structures

Two Optimization Methods for Raytracing. W. Sturzlinger and R. F. Tobler

Spatial Data Structures and Acceleration Algorithms

EFFICIENT BVH CONSTRUCTION AGGLOMERATIVE CLUSTERING VIA APPROXIMATE. Yan Gu, Yong He, Kayvon Fatahalian, Guy Blelloch Carnegie Mellon University

Topic 10: Scene Management, Particle Systems and Normal Mapping. CITS4242: Game Design and Multimedia

CSE 167: Introduction to Computer Graphics Lecture #9: Visibility. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2018

! Good algorithms also extend to higher dimensions. ! Curse of dimensionality. ! Range searching. ! Nearest neighbor.

Code Transformation of DF-Expression between Bintree and Quadtree

Culling. Computer Graphics CSE 167 Lecture 12

Point Cloud Filtering using Ray Casting by Eric Jensen 2012 The Basic Methodology

Computer Graphics Ray Casting. Matthias Teschner

CSE 167: Introduction to Computer Graphics Lecture 11: Scene Graph 2. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2013

UNIVERSITY OF WATERLOO Faculty of Mathematics

kd-trees Idea: Each level of the tree compares against 1 dimension. Let s us have only two children at each node (instead of 2 d )

Accelerating Geometric Queries. Computer Graphics CMU /15-662, Fall 2016

CSL 859: Advanced Computer Graphics. Dept of Computer Sc. & Engg. IIT Delhi

Computer Graphics. - Spatial Index Structures - Philipp Slusallek

Solid Modeling. Thomas Funkhouser Princeton University C0S 426, Fall Represent solid interiors of objects

Range Searching. Data structure for a set of objects (points, rectangles, polygons) for efficient range queries.

Subdivision Of Triangular Terrain Mesh Breckon, Chenney, Hobbs, Hoppe, Watts

Chap4: Spatial Storage and Indexing. 4.1 Storage:Disk and Files 4.2 Spatial Indexing 4.3 Trends 4.4 Summary

Overview. Pipeline implementation I. Overview. Required Tasks. Preliminaries Clipping. Hidden Surface removal

Using Bounding Volume Hierarchies Efficient Collision Detection for Several Hundreds of Objects

Ray Tracing. Cornell CS4620/5620 Fall 2012 Lecture Kavita Bala 1 (with previous instructors James/Marschner)

Three-Dimensional Shapes

Geometry proxies (in 2D): a Convex Polygon

Quadrant-Based MBR-Tree Indexing Technique for Range Query Over HBase

CS 352: Computer Graphics. Hierarchical Graphics, Modeling, And Animation

Advanced Ray Tracing

VIII. Visibility algorithms (II)

l Without collision detection (CD), it is practically impossible to construct e.g., games, movie production tools (e.g., Avatar)

MODELING AND HIERARCHY

improving raytracing speed

Clipping. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

Transcription:

Space-based Partitioning Data Structures and their Algorithms Jon Leonard

Purpose Space-based Partitioning Data Structures are an efficient way of organizing data that lies in an n-dimensional space 2D, 3D, even 4D and beyond Reasoning about the data is usually much easier Bottom Line: Cut down on the search space

Example 1 X Values Y Values 1 3 5 6 9 3 3 1 8 8 4 9 1 2 2 4 8 1 4 2 7 2

Outline Quadtrees Octrees Binary Space Partitions (BSP) Kd-Trees R-Tree Bounded Volume Hierarchy (BVH)

Outline Quadtrees Octrees Binary Space Partitions (BSP) Kd-Trees R-Tree Bounded Volume Hierarchy (BVH)

Quadtree Origins The term Quadtree was coined by Raphael Finkel and J.L. Bentley in 1974 A data structure to store data in two dimensions Follows the same intuition as a binary tree Binary Tree: I have one range of data I want to partition Quadtree: I have two ranges of data I want to partition

Quadtree Quadtrees represent finite, square areas The internal nodes of a quadtree are also finite, square areas that make up a quadrant of their parent node's region As such, each internal node has four children, one for each quadrant The leaf nodes of a quadtree hold a finite number of elements Filled leaf nodes will break into four quadrants and the data is inserted into the quadrants

Quadtree

Quadtree Insert Code quadtree_insert(quadtree node, data_type data) if(node has quadrants) if in first quadrant quadtree_insert(node.firstquad, data) if in second quadrant... quadtree_insert(node.secondquad, data) else if node.data.size < threshold else node.data.insert(data) break up into quadrants insert existing data into quadrants insert data into quadrant

Quadtree Alternative Implementations Rectangular Quadrants Point Quadtree Quadtrees are flexible, implementations can vary to work for many situations Conway's Game of Life Bitmap Image Representation Not limited to spacial data

Octrees are the 3D analog to Quadtrees Octree internal nodes contain 8 octants Octree Aside from more coordinate comparisons, quadtrees and octrees are identical in code

Quadtree/Octree Uses Ray tracing Line of Sight Hidden Surface Removal Occlusion Culling Collision Detection

Outline Quadtrees Octrees Binary Space Partitions (BSP) Kd-Trees R-Tree Bounded Volume Hierarchy (BVH)

Binary Space Partition Trees Binary Space Partition Trees (BSPs) are binary trees Each internal node in a BSP has a partition, oriented any arbitrary direction The two branches of the BSP, Front and Back All data down either side of the node is guaranteed to be either in front of the partition or behind

bsp_tree create_bsp(data_type data[]) node = new bsp_tree; if data[].size == 1 Binary Space Partition Construction else node.data = data return node; good_partition = find the partition that cuts data[] into two near equal sets node.partition = good_partition node.front = create_bsp(data[] in front of partition done.back = create_bsp(data[] behind partition

Binary Space Partition Uses Rendering Scenes Painter's Algorithm Ray Tracing Back to Front Tree Traversal

Back to Front Traversal traverse_tree(bsp_tree node, point eyepoint) { } location = determine which side of the partition eyepoint is on if location is in front traverse_tree(bsp.back, eyepoint) show(node.data) traverse_tree(bsp.front, eyepoint) else // location in behind or eyepoint is on the partition traverse_tree(bsp.front, eyepoint) show(node.data) traverse_tree(bsp.back, eyepoint)

Binary Space Partition Has now been replaced for graphical applications Only works in 2D/Pseudo-3D spaces Historically solved computational barriers BSPs utilized in Doom (1993) Quake (1996) as well Other Applications Image compression

Doom BSP In a paper released by Daniel Gordon and Shuhong Chen in September 1991 Utilized by John Carmack Uses walls and other naturally flat objects in the game as the partition Does a front to back traversal of the tree Keeps track of what areas of the screen have been drawn to already

Kd-tree A special form of a BSP Instead of arbitrarily directed partitions, Kd-tree partitions are parallel to the x and y axis Works just like a binary tree Each internal node has 2 children Each internal node either splits the x axis or the y axis

Kd-tree Construction Kdtree construct_kdtree(int axis, data_type data[]) { } find the datapoint closest to the average/median value for the given axis as the pivot point store the data in the node leftnode = construct_kdtree(next axis, data less than pivot point) rightnode = construct_kdtree(next axis, data greater than pivot point)

Nearest Neighbor Search 1. Traverse down the tree to a leaf node that contains the query point 2. Return current leaf node as best choice 3. When returning up the tree, check to see if a circle centered on the query point with radius equal to the distance to the current best choice will cross the pivoting axis at that node If so, following this procedure again down the other branch and compare the result to the current best choice Otherwise, continue up the tree continuing to check if another branch should be considered.

Outline Quadtrees Octrees Binary Space Partitions (BSP) Kd-Trees R-Tree Bounded Volume Hierarchy (BVH)

R-tree Stands for Rectangle-Tree Variation of a B-tree Made up of minimum bounding rectangles (MBRs) Unlike quadtrees quadrants, MBRs can overlap For large datasets

R-Tree

R-Tree Variations R*-tree R+ tree Indexes spacial information more efficiently than a R-tree by minimizing MBR overlap No overlapping MBRs, it will insert an object in multiple nodes if needed Priority R-tree Better overall R-tree, but more efficient for extreme datasets

Outline Quadtrees Octrees Binary Space Partitions (BSP) Kd-Trees R-Tree Bounded Volume Hierarchy (BVH)

Bounded Volume Hierarchy Similar to a 3D R-Tree Not limited to simple bounding rectangles Any volume to surround objects can be utilized Sphere, Cone, etc. Tries to maximize tightness property of spacial data structures

Tightness Querying any of these data structures is only as efficient as how tight the data structure fits the data set Minimize the amount of unused space bounded by the bounding shape While minimizing the height of the tree

Bounded Volume Hierarchy

Conclusions

Resources Arge, Lars et al. The Priority R-Tree: A Practically Efficient and Worst-Case Optimal R-Tree Proceedings of the 2004 ACM SIGMOD. June 2004. Gordon, Dan and Chen, Shuhong. Front-to-Back Display of BSP Trees. IEEE Computer Graphics & Algorithms, pp 79 85. September 1991. Krishnaswamy, Ravinder and Alijani, Ghasem S. On Constructing Binary Space Partitioning Trees. Proceeding CSC '90 Proceedings of the 1990 ACM annual conference on Cooperation, pp 230-235. 1990. Samet, Hanan. The Quadtree and Related Hierarchical Data Structures. ACM Computing Surveys Volume 16 Issue 2, pp 187-260. June 1984.