CMPS 3130/6130 Computational Geometry Spring 2017

Slides:



Advertisements
Similar presentations
Introduction to Algorithms
Advertisements

INTERVAL TREE & SEGMENTATION TREE
AVL Trees1 Part-F2 AVL Trees v z. AVL Trees2 AVL Tree Definition (§ 9.2) AVL trees are balanced. An AVL Tree is a binary search tree such that.
Augmenting Data Structures Advanced Algorithms & Data Structures Lecture Theme 07 – Part I Prof. Dr. Th. Ottmann Summer Semester 2006.
Dynamic Planar Convex Hull Operations in Near- Logarithmic Amortized Time TIMOTHY M. CHAN.
I/O-Algorithms Lars Arge Fall 2014 September 25, 2014.
2/14/13CMPS 3120 Computational Geometry1 CMPS 3120: Computational Geometry Spring 2013 Planar Subdivisions and Point Location Carola Wenk Based on: Computational.
2/3/15CMPS 3130/6130 Computational Geometry1 CMPS 3130/6130 Computational Geometry Spring 2015 Triangulations and Guarding Art Galleries II Carola Wenk.
9/12/06CS 6463: AT Computational Geometry1 CS 6463: AT Computational Geometry Fall 2006 Triangulations and Guarding Art Galleries II Carola Wenk.
Zoo-Keeper’s Problem An O(nlogn) algorithm for the zoo-keeper’s problem Sergei Bespamyatnikh Computational Geometry 24 (2003), pp th CGC Workshop.
9/5/06CS 6463: AT Computational Geometry1 CS 6463: AT Computational Geometry Fall 2006 Plane Sweep Algorithms and Segment Intersection Carola Wenk.
Robert Pless, CS 546: Computational Geometry Lecture #3 Last Time: Convex Hulls Today: Plane Sweep Algorithms, Segment Intersection, + (Element Uniqueness,
Klee’s Measure Problem Computational Geometry, WS 2007/08 Group Work Prof. Dr. Thomas Ottmann Khaireel A. Mohamed Algorithmen & Datenstrukturen, Institut.
Orthogonal Range Searching Computational Geometry, WS 2006/07 Lecture 13 – Part II Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für.
Orthogonal Range Searching 3Computational Geometry Prof. Dr. Th. Ottmann 1 Orthogonal Range Searching 1.Linear Range Search : 1-dim Range Trees 2.2-dimensional.
I/O-Algorithms Lars Arge Aarhus University February 27, 2007.
Lecture 12 : Special Case of Hidden-Line-Elimination Computational Geometry Prof. Dr. Th. Ottmann 1 Special Cases of the Hidden Line Elimination Problem.
Computational Geometry, WS 2007/08 Lecture 15 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät für Angewandte Wissenschaften.
Lecture 5: Orthogonal Range Searching Computational Geometry Prof. Dr. Th. Ottmann 1 Orthogonal Range Searching 1.Linear Range Search : 1-dim Range Trees.
Special Cases of the Hidden Line Elimination Problem Computational Geometry, WS 2007/08 Lecture 16 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen,
Orthogonal Range Searching Computational Geometry, WS 2006/07 Lecture 13 – Part III Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für.
I/O-Algorithms Lars Arge University of Aarhus March 1, 2005.
I/O-Algorithms Lars Arge Spring 2009 March 3, 2009.
Geometric Data Structures Computational Geometry, WS 2007/08 Lecture 13 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik.
I/O-Algorithms Lars Arge Aarhus University March 5, 2008.
Point Location Computational Geometry, WS 2007/08 Lecture 5 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät für.
Unit 11a 1 Unit 11: Data Structures & Complexity H We discuss in this unit Graphs and trees Binary search trees Hashing functions Recursive sorting: quicksort,
Lecture 6: Point Location Computational Geometry Prof. Dr. Th. Ottmann 1 Point Location 1.Trapezoidal decomposition. 2.A search structure. 3.Randomized,
Lecture 11 : More Geometric Data Structures Computational Geometry Prof. Dr. Th. Ottmann 1 Geometric Data Structures 1.Rectangle Intersection 2.Segment.
O RTHOGONAL R ANGE S EARCHING الهه اسلامی فروردین 92, 1.
1 Section 9.2 Tree Applications. 2 Binary Search Trees Goal is implementation of an efficient searching algorithm Binary Search Tree: –binary tree in.
AALG, lecture 11, © Simonas Šaltenis, Range Searching in 2D Main goals of the lecture: to understand and to be able to analyze the kd-trees and.
CSE373: Data Structures & Algorithms Lecture 6: Binary Search Trees Lauren Milne Summer
Orthogonal Range Searching I Range Trees. Range Searching S = set of geometric objects Q = query object Report/Count objects in S that intersect Q Query.
1 Geometric Intersection Determining if there are intersections between graphical objects Finding all intersecting pairs Brute Force Algorithm Plane Sweep.
UNC Chapel Hill M. C. Lin Point Location Reading: Chapter 6 of the Textbook Driving Applications –Knowing Where You Are in GIS Related Applications –Triangulation.
Basics Set systems: (X,F) where F is a collection of subsets of X. e.g. (R 2, set of half-planes) µ: a probability measure on X e.g. area/volume is a.
UNC Chapel Hill M. C. Lin Orthogonal Range Searching Reading: Chapter 5 of the Textbook Driving Applications –Querying a Database Related Application –Crystal.
External Memory Algorithms for Geometric Problems Piotr Indyk (slides partially by Lars Arge and Jeff Vitter)
14/13/15 CMPS 3130/6130 Computational Geometry Spring 2015 Windowing Carola Wenk CMPS 3130/6130 Computational Geometry.
Mehdi Mohammadi March Western Michigan University Department of Computer Science CS Advanced Data Structure.
Lars Arge Presented by Or Ozery. I/O Model Previously defined: N = # of elements in input M = # of elements that fit into memory B = # of elements per.
2IL50 Data Structures Fall 2015 Lecture 9: Range Searching.
Segment Trees - motivation.  When one wants to inspect a small portion of a large and complex objects. Example: –GIS: windowing query in a map.
Segment Trees Basic data structure in computational geometry. Computational geometry.  Computations with geometric objects.  Points in 1-, 2-, 3-, d-space.
CMPS 3130/6130 Computational Geometry Spring 2015
Interval S = [3,10]  {x | 3 ≤ x ≤ 10} Closed segment S = (3,10)  {x | 3 < x < 10} Opened segment S = [3,3]  {3} Point.
CMPS 3130/6130 Computational Geometry Spring 2015
February 17, 2005Lecture 6: Point Location Point Location (most slides by Sergi Elizalde and David Pritchard)
UNC Chapel Hill M. C. Lin Geometric Data Structures Reading: Chapter 10 of the Textbook Driving Applications –Windowing Queries Related Application –Query.
May 2012Range Search Algorithms1 Shmuel Wimer Bar Ilan Univ. Eng. Faculty Technion, EE Faculty.
CMPS 3130/6130 Computational Geometry Spring 2017
Computational Geometry
Geometric Data Structures
CMPS 3130/6130 Computational Geometry Spring 2017
CMPS 3130/6130 Computational Geometry Spring 2017
CMPS 3130/6130 Computational Geometry Spring 2017
Segment tree and Interval Tree
Orthogonal Range Searching and Kd-Trees
CMPS 3130/6130 Computational Geometry Spring 2017
Reporting (1-D) Given a set of points S on the line, preprocess them to build structure that allows efficient queries of the from: Given an interval I=[x1,x2]
Shmuel Wimer Bar Ilan Univ., School of Engineering
CMPS 3130/6130: Computational Geometry Spring 2017
Approximating Points by A Piecewise Linear Function: I
CMPS 3130/6130 Computational Geometry Spring 2017
Merge Sort 2/23/ :15 PM Merge Sort 7 2   7  2   4  4 9
CMPS 3120: Computational Geometry Spring 2013
CMPS 3130/6130 Computational Geometry Spring 2017
Merge Sort 5/30/2019 7:52 AM Merge Sort 7 2   7  2  2 7
Divide-and-Conquer 7 2  9 4   2   4   7
Presentation transcript:

CMPS 3130/6130 Computational Geometry Spring 2017 Windowing Carola Wenk CMPS 3130/6130 Computational Geometry

CS 6463 AT: Computational Geometry Windowing Input: A set S of n line segments in the plane Query: Report all segments in S that intersect a given query window Subproblem: Process a set of intervals on the line into a data structure which supports queries of the type: Report all intervals that contain a query point. Interval trees Segment trees CS 6463 AT: Computational Geometry

CMPS 3130/6130 Computational Geometry Interval Trees Input: A set I of n intervals on the line.   disjoint union Idea: Partition I into Ileft Imid  Iright where xmid is the median of the 2n endpoints. Store Imid twice as two lists of intervals: Lleft sorted by left endpoint and as Lright sorted by right endpoint. Imid stored as Lleft , Lright interval tree for Ileft interval tree for Iright CMPS 3130/6130 Computational Geometry

CMPS 3130/6130 Computational Geometry Interval Trees Lemma: An interval tree on a set of n intervals uses O(n) space and has height O(log n). It can be constructed recursively in O(n log n). time. Proof: Each interval is stored in a set Imid only once, hence O(n) space. In the worst case half the intervals are to the left and right of xmid, hence the height is O(log n). Constructing the (sorted) lists takes O(|Iv| + |Ivmid| log |Ivmid|) time per vertex v. CMPS 3130/6130 Computational Geometry

CMPS 3130/6130 Computational Geometry Interval Tree Query Theorem: An interval tree on a set of n intervals can be constructed in O(n log n) time and uses O(n) space. All intervals that contain a query point can be reported in O(log n + k) time, where k = #reported intervals. Proof: We spend O(1+kv) time at vertex v, where kv = #intervals reported at v. We visit at most 1 node at any depth. CMPS 3130/6130 Computational Geometry

Segment Trees Let I={s1,…,sn} be a set of n intervals (segments), and let p1, p2, …,pm be the sorted list of distinct interval endpoints of I. Partition the real line into elementary intervals: −∞, 𝑝 1 , 𝑝 1 , 𝑝 1 , 𝑝 1 , 𝑝 2 ,…, 𝑝 𝑚−1 , 𝑝 𝑚 , 𝑝 𝑚 , 𝑝 𝑚 , 𝑝 𝑚 ,∞ Construct a balanced binary search tree T with leaves corresponding to the elementary intervals p1 p2 p3 p4 p5 p6 p7

Elementary Intervals Int(m):=elementary interval corresponding to leaf m Int(v):=union of Int(m) of all leaves in subtree rooted at v v Int(v) p1 p2 p3 p4 p5 p6 p7

Store segments as high as possible Segment Trees Store segments as high as possible Each vertex v stores (1) Int(v) and (2) the canonical subset I(v)I: I(v):= {sI | Int(v)  s and Int(parent(v))  s} s1 s2 s3 s4 s5 p1 p2 p3 p4 p5 p6 p7

Store segments as high as possible Segment Trees Store segments as high as possible Each vertex v stores (1) Int(v) and (2) the canonical subset I(v)I: I(v):= {sI | Int(v)  s and Int(parent(v))  s} p1 p2 p3 p4 p5 p6 p7

Space Lemma: A segment tree on n intervals uses O(n log n) space. Proof: Any interval s is stored in at most two sets I(v1), I(v2) for two different vertices v1, v2 at the same level of T. [If s was stored in I(v3) for a third vertex v3, then s would have to span from left to right, and Int(parent(v2))s, hence s is cannot be stored in v2.] The tree is a balanced tree of height O(log n). s

Segment Tree Query Runtime Analysis: Visit one node per level. Spend O(1+kv) time per node v.  Runtime O(log n + k)

Segment Tree Construction Sort interval endpoints of I.  elementary intervals Construct balanced BST on elementary intervals. Determine Int(v) bottom-up. Compute canonical subsets by incrementally inserting intervals s=[x,x’]I into T using InsertSegmentTree: O(n log n) s s )

Segment Trees Each interval stored at most twice per level Runtime: Each interval stored at most twice per level At most one node per level that contains the left endpoint of s (same with right endpoint) Visit at most 4 nodes per level O(log n) per interval, and O(n log n) total Theorem: A segment tree for a set of n intervals can be built in O(n log n) time and uses O(n log n) space. All intervals that contain a query point can be reported in O(log n + k) time.

CS 6463 AT: Computational Geometry 2D Windowing Revisited Input: A set S of n disjoint line segments in the plane Task: Process S into a data structure such that all segments intersecting a vertical query segment q:=qx  [qy,q’y] can be reported efficiently. q’y qy qx CS 6463 AT: Computational Geometry

CS 6463 AT: Computational Geometry 2D Windowing Revisited Solution: Segment tree with nested range tree Build segment tree T based on x-intervals of segments in S.  each Int(v) Int(v)(-,) vertical slab I(v)S(v) canonical set of segments spanning vertical slab Store S(v) in 1D range tree (binary search tree) T(v) based on vertical order of segments CS 6463 AT: Computational Geometry

CS 6463 AT: Computational Geometry 2D Windowing Revisited Query algorithm: Search regularly for qx in T In every visited vertex v report segments in T(v) between qy and q’y (1D range query)  O(log n + kv) time for T(v) O(log2n + k) total q’y qy qx CS 6463 AT: Computational Geometry

CS 6463 AT: Computational Geometry 2D Windowing Summary Theorem: Let S be a set of (interior-) disjoint line segments in the plane. The segments intersecting a vertical query segment (or an axis-parallel rectangular query window) can be reported in O(log2 n + k) time, with O(n log n) preprocessing time and O(n log n) space. q’y qy qx CS 6463 AT: Computational Geometry