CS138A 1999 1 Line Segment Intersection Peter Schröder.

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
INTERVAL TREE & SEGMENTATION TREE
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.
Visibility Graph Team 10 NakWon Lee, Dongwoo Kim.
CS138A Single Source Shortest Paths Peter Schröder.
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
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.
I. The Problem of Molding Does a given object have a mold from which it can be removed? object not removable mold 1 object removable Assumptions The object.
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.
Computational Geometry Piyush Kumar (Lecture 3: Convexity and Convex hulls) Welcome to CIS5930.
Robert Pless, CS 546: Computational Geometry Lecture #3 Last Time: Convex Hulls Today: Plane Sweep Algorithms, Segment Intersection, + (Element Uniqueness,
Computational Geometry -- Voronoi Diagram
17. Computational Geometry Chapter 7 Voronoi Diagrams.
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.
CP = E[ s 2, s 5, s 1, s 3, s 2 ’, s 3 ’, s 4, s 1 ’, s 4 ’, s 5 ’ ] S[] I[] s1s1 s1’s1’ s2s2 s2’s2’ s4s4 s4’s4’ s3s3 s3’s3’ s5s5 s5’s5’ Plane Sweep Algorithm.
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
CSE53111 Computational Geometry TOPICS q Preliminaries q Point in a Polygon q Polygon Construction q Convex Hulls Further Reading.
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 Line Segment Intersection Chapter 2 of the Textbook Driving Applications –Map overlap problems –3D Polyhedral Morphing.
14/13/15 CMPS 3130/6130 Computational Geometry Spring 2015 Windowing Carola Wenk CMPS 3130/6130 Computational Geometry.
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
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.
Lecture 15 Computational Geometry Geometry sweeping Geometric preliminaries Some basics geometry algorithms.
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.
1/20/15CMPS 3130/6130 Computational Geometry1 CMPS 3130/6130 Computational Geometry Spring 2015 Plane Sweep Algorithms I Carola Wenk.
Polygon Triangulation
Line Sweep Algorithms Schalk-Willem Krüger – 2009 Training Camp 1 presentation.start();
CMPS 3130/6130 Computational Geometry Spring 2017
3. Polygon Triangulation
Geometric Data Structures
CMPS 3130/6130 Computational Geometry Spring 2017
CMPS 3130/6130 Computational Geometry Spring 2017
Orthogonal Range Searching and Kd-Trees
Computational Geometry Capter:1-2.1
Polygon Triangulation
Chapter 7 Voronoi Diagrams
I. The Problem of Molding
CMPS 3130/6130: Computational Geometry Spring 2017
CMPS 3130/6130 Computational Geometry Spring 2017
Overlay of Two Subdivisions
CS 113: Data Structures and Algorithms
Algorithms and Data Structures Lecture XIV
Presentation transcript:

CS138A Line Segment Intersection Peter Schröder

CS138A Intersection Problem statement given a set of n line segments in the plane, find all intersections examples brute force? can you do better Output sensitive algorithms running time is sensitive to the actual number of intersections

CS138A Plane Sweep Algorithm When can lines intersect? sweep line status of sweep line set of segments intersecting sweep line status only changes at discrete points status changes define event points end points as event points can still be quadratic maintain horizontally ordered list of event points

CS138A Line Sweep Algorithm Ordered sequence of events status changes at end points and at intersection points order changes at intersection points new strategy: only test neighbors against each other and only when events occur ignore boundary cases for now no segment horizontal any two segments intersect in at most one point no three segments intersect in one point

CS138A Line Sweep Algorithm Correctness Lemma 1: Let s i and s j be two non- horizontal segments whose interiors intersect in a single point p, and assume there is no third segment passing through p. Then there is an event point above p where s i and s j become adjacent and are tested for intersection

CS138A Line Sweep Algorithm Outline sweep line downward maintain ordered status update status at event points new segment inserted, old segment removed segment intersection only test neighbors in status against each other at event points order may change and action has to be taken

CS138A Line Sweep Algorithm Data structures event queue (balanced binary search tree) status structure (balanced binary tree) 1. FindIntersections(S) 2. Q = {}; 3. Insert all segment endpoints into Q 4. Record corresponding segment with upper endpoints 5. T = {}; 6. while( !Q.empty() ) 7. p = Q.extractMin(); 8. HandleEvenPoint(p);

CS138A HandleEventPoint 1. HandleEventPoint(p) 2. U(p) = segmentsUpper(p); S(p) = segmentsContaining(p); 3. L(p) = subset( S(p), T ).lower(p) 4. C(p) = subset( S(p), T ).interior(p) 5. if( |L(p)+U(p)+C(p)| > 1 ) 6. report p as intersection 7. T.delete( L(p)+C(p) ); T.insert( U(p)+C(p) ) 8. if( U(p)+C(p) == {} ) 9. s l = leftNeighbor( p, T ); s r = rightNeighbor( p, T ) 10. FindNewEvent( s l,s r,p ) 11. else 12. s’ = leftmostSegment( U(p)+C(p), T ) 13. s l = leftNeighbor( s’, T ) 14. FindNewEvent( s l,s’,p ) 15. s’’ = rightmostSegment( U(p)+C(p), T ) 16. s r = rightNeighbor( s’’, T ) 17. FindNewEvent( s’’,s r,p )

CS138A FindNewEvent 1. FindNewEvent( s l, s r, p ) 2. q = Intersect( s l, s r ) 3. if( q && (( q.y < p.y )|| 4. (( q.y == p.y ) && ( q.x > p.x ))) 5. !Q.contains(q) ) 6. Q.insert(q)

CS138A Correctness Does it find all intersections? Lemma 2: algorithm FindIntersections computes all intersection points and the segments that contain it correctly Running time Lemma 3: for n segments it is O(n log n + I log n), where I is the number of intersections