Quadtrees 1.

Slides:



Advertisements
Similar presentations
GR2 Advanced Computer Graphics AGR
Advertisements

Nearest Neighbor Search
Heaps1 Part-D2 Heaps Heaps2 Recall Priority Queue ADT (§ 7.1.3) A priority queue stores a collection of entries Each entry is a pair (key, value)
Chapter 4: Trees Part II - AVL Tree
Augmenting Data Structures Advanced Algorithms & Data Structures Lecture Theme 07 – Part I Prof. Dr. Th. Ottmann Summer Semester 2006.
I/O-Algorithms Lars Arge Fall 2014 September 25, 2014.
Searching on Multi-Dimensional Data
Computer Graphics1 Quadtrees & Octrees. Computer Graphics2 Quadtrees n A hierarchical data structure often used for image representation. n Quadtrees.
Space Partitioning for Broad Sweep Collision Detection Part 2 - Quadtrees Game Design Experience Professor Jim Whitehead February 13, 2009 Creative Commons.
Quad Trees By JJ Shepherd. Introduction So far we’ve only used binary trees to solve problems – Sort data – Search data – Confuse students Trees are not.
2-dimensional indexing structure
Multiple-key indexes Index on one attribute provides pointer to an index on the other. If V is a value of the first attribute, then the index we reach.
Self-Balancing Search Trees Chapter 11. Chapter 11: Self-Balancing Search Trees2 Chapter Objectives To understand the impact that balance has on the performance.
Self-Balancing Search Trees Chapter 11. Chapter Objectives  To understand the impact that balance has on the performance of binary search trees  To.
R-Trees 2-dimensional indexing structure. R-trees 2-dimensional version of the B-tree: B-tree of maximum degree 8; degree between 3 and 8 Internal nodes.
Priority Queues1 Part-D1 Priority Queues. Priority Queues2 Priority Queue ADT (§ 7.1.3) A priority queue stores a collection of entries Each entry is.
BSP Trees, Quadtrees & Octrees Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Wednesday, January 28, 2004.
Spatial Data Structures Jason Goffeney, 4/26/2006 from Real Time Rendering.
10/09/2001CS 638, Fall 2001 Today Spatial Data Structures –Why care? –Octrees/Quadtrees –Kd-trees.
B-Trees. CSM B-Trees 2 Motivation for B-Trees So far we have assumed that we can store an entire data structure in main memory What if we have so.
The BSP-tree from Prof. Seth MIT.. Motivation for BSP Trees: The Visibility Problem We have a set of objects (either 2d or 3d) in space. We have.
PRESENTED BY – GAURANGI TILAK SHASHANK AGARWAL Collision Detection.
2-3 Tree. Slide 2 Outline  Balanced Search Trees 2-3 Trees Trees.
B-Trees. CSM B-Trees 2 Motivation for B-Trees So far we have assumed that we can store an entire data structure in main memory What if we have so.
Advanced HSR Methods Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Friday, January 30, 2004.
IKI 10100: Data Structures & Algorithms Ruli Manurung (acknowledgments to Denny & Ade Azurat) 1 Fasilkom UI Ruli Manurung (Fasilkom UI)IKI10100: Lecture17.
PRIORITY QUEUES AND HEAPS CS16: Introduction to Data Structures & Algorithms Tuesday, February 24,
Spatial Indexing Techniques Introduction to Spatial Computing CSE 5ISC Some slides adapted from Spatial Databases: A Tour by Shashi Shekhar Prentice Hall.
Week 10 - Friday.  What did we talk about last time?  Graph representations  Adjacency matrix  Adjacency lists  Depth first search.
Indexing Database Management Systems. Chapter 12: Indexing and Hashing Basic Concepts Ordered Indices B + -Tree Index Files File Organization 2.
Heaps © 2010 Goodrich, Tamassia. Heaps2 Priority Queue ADT  A priority queue (PQ) stores a collection of entries  Typically, an entry is a.
CS552: Computer Graphics Lecture 28: Solid Modeling.

CSE 554 Lecture 5: Contouring (faster)
AA Trees.
File Organization and Processing Week 3
Indexing and hashing.
As the last CC-list represents Maximum Compatible Classes we conclude:
UNIT III TREES.
Binary Search Tree (BST)
Priority Queues © 2010 Goodrich, Tamassia Priority Queues 1
Modeliranje kompleksnih modelov
Heaps © 2010 Goodrich, Tamassia Heaps Heaps
Heaps 9/13/2018 3:17 PM Heaps Heaps.
Tonga Institute of Higher Education
Chapter Trees and B-Trees
Chapter Trees and B-Trees
KD Tree A binary search tree where every node is a
Binary Trees Lecture 36 Wed, Apr 21, /21/2018 Binary Trees.
Orthogonal Range Searching and Kd-Trees
Heaps and Priority Queues
Wednesday, April 18, 2018 Announcements… For Today…
Priority Queues and Heaps
Part-D1 Priority Queues
Heaps and Priority Queues
Tree Representation Heap.
Heaps and Priority Queues
© 2013 Goodrich, Tamassia, Goldwasser
G-trees Region identifier: string of bits built as follows
Ch. 8 Priority Queues And Heaps
Heaps and Priority Queues
The BIRCH Algorithm Davitkov Miroslav, 2011/3116
Multiway Trees Searching and B-Trees Advanced Tree Structures
CS679 - Fall Copyright Univ. of Wisconsin
Heaps and Priority Queues
B-Trees.
Modeliranje kompleksnih modelov
B-Trees.
B-Tree of degree 3 t=3 data internal nodes
Heaps 9/29/2019 5:43 PM Heaps Heaps.
Presentation transcript:

Quadtrees 1

Background Split along pre-defined planes Used to partition 2-D space In general, a quadtree is a tree in which each node has at most 4 children Each node of the tree corresponds to a square region If a node has children, think of its region being chopped into 4 equal subregions. Child nodes correspond to these smaller subregions of their parent’s region Subdivide as little or as much as necessary Each internal node has exactly 4 children

Quadtree Example The root node of a quadtree corresponds to a square region in space. Generally, this encompasses the entire “region of interest”. If desired, subdivide along lines parallel to the coordinate axes, forming four smaller identically sized square regions. The child nodes correspond to these. Some or all of these children may be subdivided further. Octrees work in a similar fashion, but in 3-D, with cubical regions subdivided into 8 parts. A A A A B C B C D E D E A A B C B C D E D E F G F G H I H I

Collision Detection Two objects that are at opposite ends of the screen can not possibly collide, so there is no need to check for a collision between them. We can use quadtree to reduce the number of checks. A quadtree starts as a single node. Objects added to the quadtree are added to the single node.

Collision Detection When more objects are added to the quadtree, it will eventually split into four subnodes. Each object will then be put into one of these subnodes according to where it lies in the 2D space. Any object that cannot fully fit inside a node’s boundary will be placed in the parent node. Each subnode can continue subdividing as more objects are added

Collision Detection As you can see, each node only contains a few objects. We know then that, for instance, the objects in the top-left node cannot be colliding with the objects in the bottom-right node, so we don't need to run an expensive collision detection algorithm between such pairs.

Implementation of the Operations Actual objects stored inside the leaves, not inner nodes. Insert an object into the quadtree Check if the object intersects the current node. If so, recurse. If you've reached the leaf level, insert the object into the collection. Delete an object from the quadtree Execute the exact same steps as if inserting the object, but when you've reached the leaf level delete it from the collection. Test if an object intersects any object inside the quadtree Execute the exact same steps as if inserting the object, but when you've reached the leaf level check for collision with all the objects in the collection. Test for all collisions between all objects inside the quadtree For every object in the quadtree execute the single object collision test. Update the quadtree Delete all objects from the quadtree whose position has been modified and insert them again.

?

References