Presentation is loading. Please wait.

Presentation is loading. Please wait.

Quadtrees Raster and vector.

Similar presentations


Presentation on theme: "Quadtrees Raster and vector."— Presentation transcript:

1 Quadtrees Raster and vector

2 Quadtrees Finkel and Bentley, 1974
Raster structure: divides space, not objects Form of block coding: compact storage of a large 2-dimensional array Vector versions exist too

3 Quadtrees, the idea NW NE SW SE NW NE SW SE 1, 4, 16, 64, 256 nodes

4 Quadtrees, the idea NW NE Choropleth raster map SW SE NW NE SW SE

5 Quadtrees Grid with 2k times 2k pixels Depth is k +1
Internal nodes always have 4 children Internal nodes represent a non-homogeneous region Leaves represent a homogeneous region and store the common value (or name)

6 Quadtree complexity theorem
A subdivision with boundary length r pixels in a grid of 2k times 2k gives a quadtree with O(k  r) nodes. Idea: two adjacent, different pixels “cost” at most 2 paths in the quadtree.

7 Overlay with quadtrees
Acid rain with PH below 4.5 Water

8 Overlay with quadtrees

9 Result of overlay

10 Overlay algorithm If color Q1 is specified, and Q2 is a leaf, then return a leaf for Q3 with as color the combination of those of Q1 and Q2 If color Q2 is specified, and Q1 is a leaf, then return a leaf for Q3 with as color the combination of those of Q1 and Q2 If Q1 and Q2 are both a leaf, then return a leaf for Q3 with as color the combination of those of Q1 and Q2

11 Overlay algorithm If color Q1 is specified or Q1 is a leaf, and Q2 is an internal node then recurse in the four subtrees of Q2 (with the color of Q1 as specified) If color Q2 is specified or Q2 is a leaf, and Q1 is an internal node then recurse in the four subtrees of Q1 (with the color of Q2 as specified) If Q1 and Q2 are both internal nodes then recurse in the four corresponding subtrees of Q1 and Q2

12 Overlay, efficiency Result is quadtree Q3 that represents overlay
Assume n nodes in Q1 and m nodes in Q2: O(n+m) time If Q3 need only contain the overlay where Q1 has a particular theme, then it can be done more efficiently by pruning

13 Quadtree construction from raster, I
Construct complete quadtree on all pixels Merge bottom-up groups of four with same attribute Disadvantage: Temporarily a lot of storage needed (quadtree on all pixels), and not efficient in time

14 Quadtree construction from raster, II
Construct quadtree top-down and recursively Merge four subtrees immediately (when returning from recursion) into a leaf if they are four leaves with the same attribute

15 Various queries Point location: trivial
Windowing: descend into subtree(s) that intersect query window Traversal boundary polygon: up and down in the quadtree

16 Vector quadtree PM quadtree in naming of Samet
Divide each square if there are: - 2 or more vertices inside - a vertex and an edge inside that are not incident - 2 (or more) edges inside, unless these edges are all incident to the same vertex and this vertex is also in the square

17 Leaf in vector quadtree
Empty (inside a region; pointer to cell) One edge (pointer to edge in leaf) One vertex with incident edges (pointer to vertex in leaf)

18 Example vector quadtree

19 Point location in vector quadtree
Go down quadtree to leaf that contains the query point At the leaf, resolve the query e f v O(1) time O(1) time O(degree(v)) time

20 Complexity vector quadtree
Cannot be expressed in the number of stored objects only Depends on inter-distance of vertices compared to region size Depends on “accidental” distance of a vertex to a side of a square

21 Alleviating the problem
Allow a small number (e.g. 3 or 4) of points or independent edges in a square Do not split squares beyond a certain size

22 Summary Raster quadtree: simple structure, simple map overlay, simple queries Vector quadtree: possibly useful for efficient access, no performance guarantees


Download ppt "Quadtrees Raster and vector."

Similar presentations


Ads by Google