The Visibility Graph Among Polygonal Obstacles: a Comparison of Algorithms ABSTRACT
Total Page:16
File Type:pdf, Size:1020Kb
The Visibility Graph Among Polygonal Obstacles: a Comparison of Algorithms by John Kitzinger [email protected] B. S., Computer Engineering, University of New Mexico,1993 M. S., Computer Science, University of New Mexico, 2003 ABSTRACT This paper examines differences of four approaches in finding the visibility graph of a polygonal region with obstacles defined by simple polygons. Each has been implemented and tuned. Experimental comparisons via time measurements have been carried out against a variety of testcases ranging in graph density from maximal, O( n 2), to minimal, W(n). In this manner, expected asymptotic time bounds have been verified with crossover points between the algorithms †identified. † iv Table of Contents List of Figures.................................................................................................................... vi List of Tables..................................................................................................................... vii Introduction.......................................................................................................................... 1 Input/Output Assumptions................................................................................................... 4 Naive Algorithm................................................................................................................... 6 Overview.................................................................................................................. 6 Implementation Details.............................................................................................6 Lee’s Algorithm................................................................................................................... 7 Overview.................................................................................................................. 7 Implementation Details.............................................................................................8 Overmars and Welzl’s Algorithm.......................................................................................10 Overview.................................................................................................................10 Implementation Details...........................................................................................12 Ghosh and Mount’s Algorithm.......................................................................................... 13 Overview.................................................................................................................13 Implementation Details...........................................................................................19 Performance Comparisons..................................................................................................23 Timing Methodology..............................................................................................23 Timing Results....................................................................................................... 23 Other Aspects and Comparisons........................................................................................ 38 Conclusion......................................................................................................................... 41 Appendices........................................................................................................................ 42 Appendix A - Tuning the Naive Method................................................................ 44 Appendix B - Tuning Lee’s Method..................................................................... 46 Appendix C - Tuning Overmars and Welzl’s Method........................................... 48 Appendix D - Tuning Ghosh and Mount’s Method.............................................. 49 Appendix E - Tables of Measurements Used in the Plots...................................... 51 Appendix F - Rotation Tree Pseudocode............................................................... 56 References......................................................................................................................... 59 v List of Figures Figure 1 - Examples of Collinear Points...............................................................................4 Figure 2 - Example of Lee Scan with Edge-List................................................................... 7 Figure 3 - Basic Cases in the Lee Scan.................................................................................7 Figure 4 - Looping the Rotation Tree (One Iteration Re-Attaching to Grandparent)...........11 Figure 5 - Looping the Rotation Tree (One Iteration Re-Attaching to Chain Above).......... 11 Figure 6 - Chains in the Mehlhorn Triangulation............................................................... 13 Figure 7 - Various Cases of the Mehlhorn Triangulation................................................... 14 Figure 8 - A Vertex As Apex of More than one Funnel......................................................15 Figure 9 - An Example of the Lower and Upper Tree for an Edge (x,y) and the Induced Funnel Sequence (Lower Parent in Parens)..................................15 Figure 10 - The Relevant Vertices of a Split when Adding a New Vertex........................... 16 Figure 11 - Pseudocode of the Split Procedure............................................................. 17-18 Figure 12 - A Split Where r Is A Special Case...................................................................21 Figure 13 - Skipping Vertices in the s to r Walk................................................................ 22 Figure 14 - Polygonal Region with O( n 2) Visibility Edges, e.g. n=25.............................. 24 Figure 15 - The Entire Visibility Graph of the Example in Figure 14................................. 24 Figure 16 - Plot of Execution Times for the Circle of Obstacles Set.................................. 25 Figure 17 - n-gon with O( n†2) Visibility Edges, e.g. n=10.................................................† 26 Figure 18 - Plot of Execution Times for the n-gon Set....................................................... 27 Figure 19 - Polygonal Region with O( n 3/2 ) Visibility Edges, e.g. n=68............................29 Figure 20 - Plot †of Execution Times for Square† Grid of Obstacles Set.............................. 30 Figure 21 - Polygonal Region with O( n) Visibility Edges, e.g. n=22............................... 31 Figure 22 - Plot of Execution† Times for the Line of Triangles† Set..................................... 32 Figure 23 - Spiral with O( n) Visibility Edges, e.g. n=86.................................................. 33 Figure 24 - Plot of Execution† Times for the Spirals Set.....................................................† 34 Figure 25 - Random Region, e.g. n=154............................................................................ 35 Figure 26 - Plot †of Execution Times for †the Random Set................................................... 36 vi List of Tables Table 1 - Measurements of the n-gon Testcase with n=5000............................................. 28 Table 2 - Measurements of the Square Grid of Obstacles Testcase with n=7748.............. 29 Table 3 - Measurements of the Line of Triangles Testcase with n=10,000........................ 33 Table 4 - Measurements of the Random Testcase with n=5000......................................... 37 Table A-1 - “linear154” Measurements for Naive Versions (seconds).............................† 44 Table A-2 - “box148” Measurements for Naive Versions† (seconds)................................ 45 Table A-3 - “quad58” Measurements for Naive Versions (seconds)................................ 45 Table B-1 - “linear154” Measurements for Lee Versions (seconds)................................ 46 Table B-2 - “box148” Measurements for Lee Versions (seconds)................................... 47 Table B-3 - “quad58” Measurements for Lee Versions (seconds)................................... 47 Table B-4 - Lee Measured Improvements from Version to Version................................... 47 Table C-1 - “linear154” Measurements for Overmars/Welzl Versions (seconds)............ 48 Table C-2 - “box148” Measurements for Overmars/Welzl Versions (seconds)............... 48 Table C-3 - “quad58” Measurements for Overmars/Welzl Versions (seconds)............... 48 Table D-1 - “linear154” Measurements for Ghosh/Mount Versions (seconds)............... 49 Table D-2 - “box148” Measurements for Ghosh/Mount Versions (seconds).................. 50 Table D-3 - “quad58” Measurements for Ghosh/Mount Versions (seconds).................. 50 Table E-1 - Average Measures for the Circle of Obstacles Testcases (milliseconds).......... 51 Table E-2 - Average Measures for the n-gon Testcases (milliseconds).............................. 52 Table E-3 - Average Measures for the Square Grid of Obstacles Testcases (milliseconds)........................................................ 52 Table E-4 - Average Measures for the Line of Triangles Testcases (milliseconds)............. 53 Table E-5 - Average Measures for the Spiral Testcases (milliseconds).............................. 54 Table E-6 - Average Measures for the Random Testcases (milliseconds).......................... 55 vii Introduction In computational geometry problems, visibility has been an important property to find. Of course, computational visibility problems vary in form. Among the two dimensional variety,