UNC Chapel Hill M. C. Lin Line Segment Intersection Chapter 2 of the Textbook Driving Applications –Map overlap problems –3D Polyhedral Morphing.

Slides:



Advertisements
Similar presentations
Two Segments Intersect?
Advertisements

Geometry Introduction
Polygon Triangulation
Spatial Information Systems (SIS) COMP Terrain modeling and geometric problems (part 2)
Computational Geometry
Line Segment Intersection. Balanced binary search tree Internal nodes: Rightmost leaf in its left subtree Status Structure T.
Map Overlay Algorithm. Birch forest Wolves Map 1: Vegetation Map 2: Animals.
Polygon overlay in double precision arithmetic One example of why robust geometric code is hard to write Jack Snoeyink & Andrea Mantler Computer Science,
2/14/13CMPS 3120 Computational Geometry1 CMPS 3120: Computational Geometry Spring 2013 Planar Subdivisions and Point Location Carola Wenk Based on: Computational.
Brute-Force Triangulation
2/3/15CMPS 3130/6130 Computational Geometry1 CMPS 3130/6130 Computational Geometry Spring 2015 Triangulations and Guarding Art Galleries II Carola Wenk.
Convex Hull obstacle start end Convex Hull Convex Hull
One of the most important problems is Computational Geometry is to find an efficient way to decide, given a subdivision of E n and a point P, in which.
UNC Chapel Hill M. C. Lin Polygon Triangulation Chapter 3 of the Textbook Driving Applications –Guarding an Art Gallery –3D Morphing.
9/12/06CS 6463: AT Computational Geometry1 CS 6463: AT Computational Geometry Fall 2006 Triangulations and Guarding Art Galleries II Carola Wenk.
1 Voronoi Diagrams. 2 Voronoi Diagram Input: A set of points locations (sites) in the plane.Input: A set of points locations (sites) in the plane. Output:
Overlay of Two Subdivisions
9/5/06CS 6463: AT Computational Geometry1 CS 6463: AT Computational Geometry Fall 2006 Plane Sweep Algorithms and Segment Intersection Carola Wenk.
Intersections. Intersection Problem 3 Intersection Detection: Given two geometric objects, do they intersect? Intersection detection (test) is frequently.
November 4, Algorithms and Data Structures Lecture XIV Simonas Šaltenis Nykredit Center for Database Research Aalborg University
Computational Geometry Piyush Kumar (Lecture 3: Convexity and Convex hulls) Welcome to CIS5930.
Query Processing in Databases Dr. M. Gavrilova.  Introduction  I/O algorithms for large databases  Complex geometric operations in graphical querying.
Robert Pless, CS 546: Computational Geometry Lecture #3 Last Time: Convex Hulls Today: Plane Sweep Algorithms, Segment Intersection, + (Element Uniqueness,
CS138A Line Segment Intersection Peter Schröder.
Computational Geometry -- Voronoi Diagram
17. Computational Geometry Chapter 7 Voronoi Diagrams.
Lecture 2 Line Segment Intersection Computational Geometry Prof.Dr.Th.Ottmann 1 Line Segment Intersection Motivation: Computing the overlay of several.
6/2/ :35 AMIncremental Convex Hull1 q w u e zt.
Line Segment Intersection Computational Geometry, WS 2007/08 Lecture 3 – Part I Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik.
Lecture 12 : Special Case of Hidden-Line-Elimination Computational Geometry Prof. Dr. Th. Ottmann 1 Special Cases of the Hidden Line Elimination Problem.
Hidden-Line Elimination Computational Geometry, WS 2006/07 Lecture 14 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät.
Point Location Computational Geometry, WS 2007/08 Lecture 5 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät für.
Lecture 6: Point Location Computational Geometry Prof. Dr. Th. Ottmann 1 Point Location 1.Trapezoidal decomposition. 2.A search structure. 3.Randomized,
Voronoi Diagrams.
Line Segment Intersection Computational Geometry, WS 2006/07 Lecture 3 – Part II Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik.
Lecture 2 Line Segment Intersection Computational Geometry Prof.Dr.Th.Ottmann 1 Line Segment Intersection Motivation: Computing the overlay of several.
Line Segment Intersection Computational Geometry, WS 2006/07 Lecture 3 – Part I Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik.
Lecture 2 Line Segment Intersection Computational Geometry Prof.Dr.Th.Ottmann 1 Line Segment Intersection Motivation: Computing the overlay of several.
Brute-Force Triangulation
Orthogonal Line Segment Intersection Given N horizontal and N vertical line segments, find all intersections. All x and y coordinates are distinct.
Advanced Algorithm Design and Analysis (Lecture 9) SW5 fall 2004 Simonas Šaltenis E1-215b
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.
Triangulating a monotone polygon
UNC Chapel Hill M. C. Lin Orthogonal Range Searching Reading: Chapter 5 of the Textbook Driving Applications –Querying a Database Related Application –Crystal.
UNC Chapel Hill M. C. Lin Linear Programming Reading: Chapter 4 of the Textbook Driving Applications –Casting/Metal Molding –Collision Detection Randomized.
Line Arrangement Chapter 6. Line Arrangement Problem: Given a set L of n lines in the plane, compute their arrangement which is a planar subdivision.
Center for Graphics and Geometric Computing, Technion 1 Computational Geometry Chapter 8 Arrangements and Duality.
Center for Graphics and Geometric Computing, Technion 1 Computational Geometry Chapter 8 Arrangements and Duality.
2/19/15CMPS 3130/6130 Computational Geometry1 CMPS 3130/6130 Computational Geometry Spring 2015 Voronoi Diagrams Carola Wenk Based on: Computational Geometry:
CMPS 3130/6130 Computational Geometry Spring 2015
Computational Geometry: Intersection Search Joseph S. B. Mitchell Stony Brook University.
UNC Chapel Hill M. C. Lin Computing Voronoi Diagram For each site p i, compute the common inter- section of the half-planes h(p i, p j ) for i  j, using.
UNC Chapel Hill M. C. Lin Delaunay Triangulations Reading: Chapter 9 of the Textbook Driving Applications –Height Interpolation –Constrained Triangulation.
February 17, 2005Lecture 6: Point Location Point Location (most slides by Sergi Elizalde and David Pritchard)
9/8/10CS 6463: AT Computational Geometry1 CS 6463: AT Computational Geometry Fall 2010 Triangulations and Guarding Art Galleries Carola Wenk.
Center for Graphics and Geometric Computing, Technion 1 Computational Geometry Chapter 9 Line Arrangements.
1/20/15CMPS 3130/6130 Computational Geometry1 CMPS 3130/6130 Computational Geometry Spring 2015 Plane Sweep Algorithms I Carola Wenk.
Polygon Triangulation
UNC Chapel Hill M. C. Lin Geometric Data Structures Reading: Chapter 10 of the Textbook Driving Applications –Windowing Queries Related Application –Query.
CMPS 3130/6130 Computational Geometry Spring 2017
Computational Geometry
Geometric Data Structures
CMPS 3130/6130 Computational Geometry Spring 2017
Algorithm design techniques Dr. M. Gavrilova
Computational Geometry Capter:1-2.1
I. The Problem of Molding
Computational Geometry
Overlay of Two Subdivisions
Algorithms and Data Structures Lecture XIV
Presentation transcript:

UNC Chapel Hill M. C. Lin Line Segment Intersection Chapter 2 of the Textbook Driving Applications –Map overlap problems –3D Polyhedral Morphing

UNC Chapel Hill M. C. Lin Thematic Map Overlay GIS systems split each map into several layers Each layer is called a thematic map, storing one type of information Find overlay of several maps to locate interesting junctions

UNC Chapel Hill M. C. Lin Transform to a Geometric Problem Curves can be approximated by small (line) segments Each thematic map can be viewed as a collection of line segments Finding the overlay of two networks => computing all intersection points between the line segments of two sets

UNC Chapel Hill M. C. Lin Let’s Be More Serious & Precise... Segments closed or open? –Take a look at the original problem => should be closed To simplify further, make 2 sets into 1 –But, how do we identify the really interesting one? Filter them out by checking if they are from the same set.

UNC Chapel Hill M. C. Lin Problem Analysis Brute Force Approach: O(n 2 ) Desiderata: output(intersection) sensitive –Segments that are close together are the candidates for intersection x y

UNC Chapel Hill M. C. Lin Plane Sweep Algorithm Status of l : the set of segments intersecting l Event points: where updates are required l : sweep line event point

UNC Chapel Hill M. C. Lin Plane Sweep Algorithm (cont) At a event point: update the status of the sweep line & perform intersection tests Upper: a new segment is added to the status of l and it’s tested against the rest Lower: it’s deleted from the status of l => Only testing pairs of segments for which there is a horizontal line intersects both segments. => But, this is not good enough. It may still be inefficient, O(n 2 ) for some cases. (ex) a set of segments all intersect with x-axis.

UNC Chapel Hill M. C. Lin Plane Sweep Algorithm (cont) To include the idea of being close in the horizontal direction, only test segments that are adjacent in the horizontal direction -- Only test each with ones to its left and right New “status”: ordered sequence of segments New “event points”: endpoints and intersects l SjSj SkSk SlSl SmSm

UNC Chapel Hill M. C. Lin Nasty Cases (Degeneracies) Horizontal lines Overlapping line segments Multiple line segments intersect at one single point

UNC Chapel Hill M. C. Lin Plane-Sweep Algorithm (Recap) Move a horizontal sweep line l downwards Halt l at event points (end pts & intersects) While l moves, maintain ordered sequence of segments intersected by it When l halts at an event point, the sequence of segments changes, status of l needs to be updated and to detect intersections depending on type of events

UNC Chapel Hill M. C. Lin Event Types NOTE: only intersection points below l are important, assuming all intersection points above l have been computed correctly. Upper end point: If S i and S k are adjacent on l, a new upper end point of S j appears, check S j with S i and S k for intersections Intersection point of 2 lines: Change their order. Each gets (at most) 1 new neighbor Lower end point: Its two neighbors are now adjacent and must be tested for intersection below the sweep line l

UNC Chapel Hill M. C. Lin Data Structure Type: Event queue that stores events Operations –remove next event and return it to be treated –among 2 events with the same y-coordinate, the one with smaller x-coordinate is returned (left-to-right priority order) –allow for insertions & check if it is already there –allow 2++ event points to coincide (ex) two upper end points coincide

UNC Chapel Hill M. C. Lin Implementing Event Queue Define an order on event points, according to which they will be handled Store the event points in a balanced binary search tree T according to their orders –both fetching & insertion takes O(log m) time, where m is the number of events Maintain the status of l using T –the left-to-right order of segments on the line l the left-to-right order of leaves in T –segments in internal nodes guide search –each update and search takes O(log m)

UNC Chapel Hill M. C. Lin Status Structure, T l SjSj SkSk SlSl SmSm SiSi SiSi SjSj SkSk SlSl SmSm SiSi SjSj SkSk SlSl T

UNC Chapel Hill M. C. Lin FindIntersections (S) Input : a set S of line segments in a plane Output : a set of intersections and their associated line segments in S 1. Initialize Q. Insert the end points into Q with their corresponding segments 2. Initialize an empty status structure T 3. While Q is not empty 4. Do Find next event point p in Q & delete it 5. HandleEventPoint ( p )

UNC Chapel Hill M. C. Lin Handling Changes in Status l S4S4 S1S1 S3S3 S8S8 S7S7 S5S5 S2S2 S1S1 S3S3

UNC Chapel Hill M. C. Lin Handling Changes in Status S7S7 S3S3 S1S1 S8S8 S3S3 S2S2 S1S1 S2S2 S7S7 T S1S1 S3S3 S8S8 S5S5 S4S4 S1S1 S3S3 S7S7 S5S5 S4S4 S7S7 T S2S2 l S4S4 S1S1 S3S3 S8S8 S7S7 S5S5 S1S1 S3S3

UNC Chapel Hill M. C. Lin HandleEventPoint (p) 1. Let U(p) be set of segments whose upper end point is p 2. Search in T for set S(p) of all segments that contains p ; they are adjacent in T. Let L(p)  S(p) be the set of segments whose lower endpts in p and C(p)  S(p) be the set of segments that contains p in its interior 3. If L(p)  U(p)  C(p) contains more than 1 segment 4. then Report p as an intersect with L(p), U(p) and C(p) 5. Delete segments in L(p)  C(p) from T 6. Insert segments in U(p)  C(p) into T. Order segments in T according to their order on sweep line just below p. A horizontal one comes last among all containing p.

UNC Chapel Hill M. C. Lin HandleEventPoint (p) 7. (Deleting & re-inserting segments of C(p) reverses order) 8. If U(p)  C(p) = 0 9. then Let s l and s r be the left/right neighbors of p in T 10. FindNewEvent (s l, s r, p ) 11.else Let s ’ be the left most segment of U(p)  C(p) in T 12. Let s l be the left neighbor of s ’ in T 13. FindNewEvent( s l, s ’, p ) 14. Find s ’’ be rightmost segment of U(p)  C(p) in T 15. Let s r be the right neighbor of s ’’ in T 16. FindNewEvent( s ’’, s r, p )

UNC Chapel Hill M. C. Lin FindNewEvent (s l, s r, p) 1. If s l and s r intersect below the sweep line, or on it and to the right of current point p, and the intersection is not yet present as an event in Q 2. Then Insert the intersection point as an event into Q

UNC Chapel Hill M. C. Lin Algorithm Analysis Let S be a set of n segments in a plane All intersections in S can be reported in –O(n log n + I log n) time –O(n) space –where I is the number of intersection points

UNC Chapel Hill M. C. Lin Doubly-Connected Edge List 3 records: vertices, faces and “half-edges” Vertex: coordinates(v) & a ptr to a half-edge Face: –OuterComponent(f): bounding edges –InnerComponent(f): edges on the boundary of holes contained in the face, f Edge: a ptr to Origin(e), a ptr to a twin-edge, ptrs to Next(e) & Prev(e) edges and its left IncidentFace(e)

UNC Chapel Hill M. C. Lin Computing Overlay of Subdivisions Let S 1, S 2 be two planar subdivisions of complexity n 1 and n 2 respectively; and let n = n 1 + n 2 Overlay of S 1 and S 2 can be constructed in O(n log n + k log n) time, where k is the complexity of overlay

UNC Chapel Hill M. C. Lin Boolean Operations Let P 1, P 2 be two polygons with n 1 and n 2 vertices respectively; and let n = n 1 + n 2 Their boolean operations (intersection, union, and difference) can each be computed in O(n log n + k log n) time, where k is the complexity of the output