Computational Geometry Monotone partitioning proof Exercise session #5: Quadtrees • Lemma 1 : a polygon is y -monotone if it has no split or merge vertices (proven in lecture). • Proof of correctness for monotone partitioning • Lemma 2 : algorithm MakeMonotone adds a • Quadtrees set of non-intersecting diagonals and partitions � Mesh generation for VSLI circuits P into monotone subpolygons. � QuadTrees • Proof : The pieces obtained from P have no � Octrees and applications split or merge vertices, so by lemma 1 they are • Homework 3 handed y -monotone. 1 17 Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005 Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005 Proof of non-intersection VLSI circuit analysis • VLSI circuit heat emission analysis. • Analysis of physical processes typically done v m using finite element methods. • Computation according to current element and e j e k Q its neighbors. • Tradeoff between accuracy and time controlled by number of elements. v i • Improvement: non-uniform mesh – small elements only where detail is needed. 18 19 Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005 Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005 Non-uniform triangular mesh Problem definition • Input: square circuit board with polygonal components, vertices on grid of size U * U , U =2 m . • Only four orientations for edges: 0, 45, 90, or 135 degrees with x axis. • Output: a subdivision into triangles: � Conforming – vertices do not intersect interiors of edges. � Respecting input – component edges contained in mesh triangle edges. � Well shaped – triangle angles between 45 to 90 degrees. � Non-uniform – mesh should be fine near component edges. 20 21 Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005 Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005 1
QuadTrees of point sets QuadTree Example • One of the first spatial data structures suitable root for high dimensions. • Idea: subdivide space into 2 d ‘quadrants’ NW NE SW SE recursively until every square contains at most one point. • Tree structure with 2 d sons per internal node. • Easy to search because node area is simple. 22 23 Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005 Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005 Range queries with QuadTrees QuadTree depth • Lemma : The depth of a quadtree for a set P of points root in the plane is at most log( s / c )+3/2, where c is the smallest distance between any two points in P and s is NE NW SW SE the side length of the initial square containing P . • Proof : � length of side at depth i is s /2 i . � Length of diagonal at this depth is sqrt(2) s /2 i . � For any internal node of depth i : sqrt(2) s /2 i ≥ c . � Therefore: i ≤ log(sqrt(2) s / c ) = log( s / c )+1/2. � Depth of leaves adds one more to bound. 24 25 Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005 Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005 QuadTree complexity Polygon QuadTrees • Theorem : A quadtree of depth d storing a set of n • Instead of points, the data is polygonal objects. points has O (( d +1) n ) nodes and can be constructed in • New recursion stopping criteria: stop when a O (( d +1) n ) time. node contains at most one ‘feature’. • Proof : • Treat interior of polygon as empty. � Total number of leaves is one plus three times number of internal nodes � suffice to bound • Leaves contain either: empty space, interior of number of internal nodes. polygon, or an edge dividing interior/exterior. � Each internal nodes contains at least two points. • Similar complexity bounds of tree, maximum � Squares of internal node of same depth are disjoint. depth determined by length of shortest edge. � Number of nodes in same depth is at most n . � Construction time: linear in points of every depth. 26 27 Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005 Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005 2
From QuadTrees to Meshes Well shaped conforming subdivision • Circuit layout is polygonal. • Use quadtree subdivision to obtain required mesh. • Respecting input : stop recursion when square does not intersect any edge or has unit size. • Output is non-uniform but it is not conforming. • Conformity : need to balance quadtree – make every neighboring squares differ by at most a factor of two. 28 29 Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005 Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005 Octrees in Ray Tracing Ray Tracing example • Ray Tracing – popular technique in computer graphics for generating photorealistic images. • Ray shot from viewpoint to find which object it hit first. • Ray reflected from object to find the next object hit. • Octrees – the 3D versions of Quadtrees with eight children per node. • Octrees guide the search for intersected objects. 30 31 Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005 Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005 Neighbor finding in QuadTrees Variants of QuadTrees • Non-uniform division centered at a point rather • Given a tree node, find a neighbor of this node than the center of symmetry. in a given direction. � Points stored at internal tree nodes. • Neighbor should be at same depth. � Idea further improved by KD-trees. • If not possible, find deepest neighbor. • Bucket QuadTrees • Algorithm for north neighbor: � Recursion stops when number of points is at most the bucket size. � If node is SW or SE child of parent, return appropriate brother. � Useful when memory is not sufficient to hold all data. � Else, recursively find north neighbor of parent. � Store tree structure alone, buckets are read in pages. � If leaf, return. Otherwise return appropriate child. 32 33 Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005 Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005 3
Recommend
More recommend