This preview shows page 1. Sign up to view the full content.
Unformatted text preview: vertex Q, the worstcase size complexity of P Q is in (nm) For convex P, Q, size is only in O(n + m) and can be computed in O(n + m) time
A Q P B Algorithm: INTERSECTION of CONVEX POLYGONS /* A is directed edge on P */ Choose A and B arbitrarily /* B is directed edge on Q */ repeat /* A, B "chase" each other */ if A intersects B then /* A, B meet at each */ Check for termination /* boundary crossing */ Update inside flag Advance either A or B depending on geometric conditions until both A and B cycle their polygons / Handle cases: P Q P Q P Q = 0 O(n+m) Intersection of Segments Goal: "Outputsize sensitive" polygon intersection algorithm Core Problem: "Outputsize sensitive" line segment intersection algorithm BentleyOttmann plane sweep: O((n+k)logn) time k = number of intersection points in output Intuition: sweep line (discrete event simulation) First, review algorithm that returns TRUE iff there exists an intersection Intersection of >2 Line Segments
SweepLine Algorithmic Paradigm: 33.4 source: 91.503 textbook Cormen et al. Intersection of >2 Line Segments
SweepLine Algorithmic Paradigm: source: 91.503 textbook Cormen et al. Intersection of >2 Line Segments
Time to decide if any 2 segments intersect:O(n lg n)
Balanced BST stores segments in order of intersection with sweep line. Associated operations take O(lgn) time. Note that it exits as soon as one intersection is detected. 33.5 source: 91.503 textbook Cormen et al. source: 91.503 textbook Cormen et al. Intersection of Segments Goal: "Outputsize sensitive" line segment intersection algorithm that actually computes all intersection points BentleyOttmann plane sweep: O((n+k)log(n+k))= O((n+k)logn) time k = number of intersection points in output Intuition: sweep vertical line rightwards just before intersection, 2 segments are adjacent in sweepline intersection structure check for intersection only adjacent segments insert intersection event into sweepline structure event types: left endpoint of a segment right endpoint of a segment intersection between 2 segments swap order Improved to O(nlogn+k) [Chazelle/Edelsbrunner]
source: O'Rourke, Computational Geometry in C Intersection of Nonconvex Polygons Variation on BentleyOttmann sweep Maintain status for each piece of sweep line: 0: exterior to P, Q P: inside P, outside Q Q: inside Q, outside P PQ: inside P , inside Q For nvertex P, mvertex Q, O((n+m)log(n+m)+k) time to compute: P Q P Q P\Q Extreme Point of Convex Polygon
Algorithm: HIGHEST POINT of CONVEX POLYGON A Geometric /* highest point is in [a,b] */ In...
View Full
Document
 Spring '10
 DANIELS
 Algorithms

Click to edit the document details