1 / 73

Computational Geometry

Computational Geometry. Piyush Kumar (Lecture 4: Planar Graphs, Polygons and Art Gallery). Welcome to CIS5930. Every planar graph can be drawn in the plane with straight edges. Fáry-Wagner. Definitions. Planar Straight Line Graph No two edges intersect except at endpoints.

Download Presentation

Computational Geometry

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computational Geometry Piyush Kumar (Lecture 4: Planar Graphs, Polygons and Art Gallery) Welcome to CIS5930

  2. Every planar graph can be drawn in the plane with straight edges Fáry-Wagner Definitions • Planar Straight Line Graph • No two edges intersect except at endpoints Courtesy Lovasz

  3. The clique of size 4 PSLG • A graph is called planar if it can be drawn in the plane in such a way that no two edges intersect except possibly at endpoints.

  4. PSLG : Definitions • A plane graph cuts the plane into regions called faces. 4 faces! 6 edges 4 vertices v – e + f = ?

  5. PSLG What about K3,3 ?

  6. PSLG • Another example v – e + f = ?

  7. Euler 1752 • For any connected planar graph G, • vertices – edges + faces = 2 Let v = # of vertices e = # of edges f = # of faces

  8. Why study PSLGs?

  9. PSLG • Any planar graph can be triangulated • Draw the planar graph with straight edges • For every face with more than 3 edges • Insert new edges

  10. PSLG • Any planar graph can be embedded on the sphere with ‘straight line’ edges • Stereographic projection • Wrapping the plane on a sphere

  11. Courtesy Hopf Euler’s Formula: Proof • Sum of angles of a triangle? • What about a triangle on a sphere?

  12. Formula for the spherical excess Area of a 2-gon = ? Formula for spherical excess?

  13. Euler’s Formula Proof 2v –f = 4; 3f = 2e; and hence v-e+f = 2 Note that f = O(v) and e=O(v)

  14. Food for thought • Prove that on a torus • V – e + f = 0 • In general for g handles • V-e + f = 2-2g

  15. Euler’s formula extensions • In 3D, a polyhedral subdivision can already have e in O(v2) • Dehn-Sommerville relations relate the maximum number of edges vertices and faces of various dimensions.

  16. Kuratowski’s Theorem [1930] A graph is planar if and only if it contains no subgraph obtainable from K5 or K3,3 by replacing edges with paths.

  17. Graph Coloring • A coloring of a graph is an assignment of colors to the vertices of the graph such that the endpoints of every edge has different colors.

  18. Four-Color Theorem [1976] The vertices of any planar graph can be 4-colored in such a way that no two adjacent vertices receive the same color. Appel-Haken

  19. Representing PSLGs • Doubly connected edge list • Winged Edge • Quad Edge • Facet edge • Split edge, Corner edge • obj file format ;)

  20. Obj file format Drawback: How do you find which all vertices a vertex connects to? What if you wanted to jump from a face to an adjacent one?

  21. Half Edges (DCEL) • Vertex List • Knows its coordinates • Knows one of its incident edges • Face List • Pointer to one of its edges • Edges • Split the edge into two records

  22. DCEL: Edge record

  23. Quad Edge • Considers the PSLG and its dual

  24. Quad Edge • Edge Record • Two vertices , two faces • Vertex • A circular list of adjacent edges • Face • A circular list of adjacent edges

  25. Quad Edge example

  26. Art Gallery

  27. Visibility inside polygons • When is x visible to y if both x and y are inside a polygon P?

  28. Art gallery problem • Art Gallery Problem • Art gallery room is a polygon P. • A guard can see all around (360 degrees) • Place G(n) guards such that they cover P. • What is minimum G(n) that is occasionally necessary and always sufficient?

  29. Theorem • Every simple polygon admits a triangulation with n-2 triangles. • Proof: • Lemma: Every polygon has a diagonal • For a triangle the theorem is true. • Use MI now.

  30. G(n) from previous theorem • Every n vertex polygon can be guarded using n-2 cameras. (Why?) • What if we place the cameras on the diagonals? (n-3 diagonals / 2) • What about vertices? • If we place a guard on a vertex, it can cover all the triangles incident on the vertex.

  31. 3-colorablity of polygon triangulations • If T be a triangulation of a polygon P, then the vertices of P can be 3-colored.

  32. Why can we do 3-coloring? • Look at the dual graph of the polygon triangulation. What is the maximum degree of the dual? Each edge of the dual is associated with a diagonal of the polygon. Removal of each edge of the dual splits the dual into two connected components

  33. Why can we do 3-coloring • The dual is a free tree • No cycles • Every free tree has a leaf (An EAR) • Proof of 3-colorability • Use MI • For a triangle its trivial • For a polygon P, color and remove an ear, by induction, we are done!

  34. The Art Gallery Theorem • Given a simple polygon with n vertices there exists a set of g(n) = floor(n/3) guards that can cover it. • Proof: Use vertex guards: the minimum cardinality vertex set of same color in the 3-coloring of the polygon triangulation.

  35. Art Gallery theorem • In the following example you would use red.

  36. Art Gallery Theorem • Let r <= g <= b be the number of nodes colored with red, green and blue colors (w.l.o.g) • Can r > n/3? • If not, then r <= n/3 • But r has to be an integer • So r must be <= floor(n/3) • For what kind of Polygon is r = floor(n/3)?

  37. Polygon Triangulation • Triangulation of a polygon refers to the decomposition of P into triangles using non-intersecting diagonals such that no more diagonals can be further added. • A maximal set of non-intersecting diagonals.

  38. Polygon Triangulation • Naïve algorithm? • Find diagonal, add it, recurse • T(n) = T(n-1) + O(n2)*n = O(n3) • Less Naïve? • Find diagonal using existence theorem • T(n) = T(n-1) + O(n) = O(n2) • What about O(n) or O(nlogn)?

  39. History • O(nlogn) Monotone pieces 1978 • O(nlogn) D&C 1982 • O(nlogn) Plane Sweep 1985 • O(nlog*n) Randomized 1991 • O(n) Polygon cutting, 1991 • O(n) Randomized 2000 • O(n) implementable with small constants? ??

  40. What about point set triangulation? • A triangulation T of V is a set of triangles such that • Each t in T is incident on 3 vertices of V and does not contain any other vertex • If t1, t2 in T => t1 does not intersect t2 • T is a decomposition of the convex hull of V.

  41. Point Set Triangulation

  42. Point Set triangulation • Can be built using one vertex at a time. • Three cases • New point outside current convex hull • New point inside triangle • New point on an edge of the current triangulation

  43. Back to Polygon Triangulations Courtesy Martin Held

  44. Polygon Triangulation • Partition the polygon into monotone pieces O(nlogn) • Triangulate them in O(n) time

  45. Monotone polygons • A polygon is x-monotone if the intersection of P with a vertical line is connected ( a point, a line segment or O ).

  46. Monotonicity • in x Implies you can sort all the x-coordinates of the vertices in O(n) • implies that there are no “cusps”. • A reflex vertex is a vertex with internal angle > π • A reflex vertex is a cusp if its neighbors both lie to the left or to the right of the vertical line.

  47. Monotone polygons => no cusps • Th: Any polygon that contains no cusps is monotone. • Proof: We will prove that any polygon that is non-monotone has a cusp. Lets assume that P’ is a non-monotone polygon due to its upper chain. Let v1, v2…vk be its upper chain and vi be the first vertex such that v(i+1) lies left to vi.

  48. Monotone polygons => no cusps The vertex leftmost from vi…in the chain vi to vk….has to be a cusp.

  49. Polygon Triangulation • First we partition the polygon into polygons without cusps. (Remove all cusps). O(nlogn) • Then we triangulate all the monotone polygons. O(n)

  50. Polygon Triangulation • Sweep from left to right. • Remove leftward pointing cusps • Sweep right to left • Remove rightward pointing cusps • Triangulate all monotone polygons

More Related