Exit intersection of convex polygons for nonconvex n

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: -vertex Q, the worst-case 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: "Output-size sensitive" polygon intersection algorithm Core Problem: "Output-size sensitive" line segment intersection algorithm Bentley-Ottmann 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 Sweep-Line Algorithmic Paradigm: 33.4 source: 91.503 textbook Cormen et al. Intersection of >2 Line Segments Sweep-Line 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: "Output-size sensitive" line segment intersection algorithm that actually computes all intersection points Bentley-Ottmann 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 sweep-line intersection structure check for intersection only adjacent segments insert intersection event into sweep-line 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 n-vertex P, m-vertex 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

Ask a homework question - tutors are online