1 / 20

Last Time: Plane Sweep Algorithms, Segment Intersection, + (Element Uniqueness)

Last Time: Plane Sweep Algorithms, Segment Intersection, + (Element Uniqueness). This time: Planar Subdivisions. Eventually, get to problems such as intersection of planar subdivisions, and show that these algorithms are easier (more efficient) than general segment intersection.

kalil
Download Presentation

Last Time: Plane Sweep Algorithms, Segment Intersection, + (Element Uniqueness)

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. Last Time: Plane Sweep Algorithms, Segment Intersection, + (Element Uniqueness)

  2. This time: Planar Subdivisions Eventually, get to problems such as intersection of planar subdivisions, and show that these algorithms are easier (more efficient) than general segment intersection. Some slides in this lecture come from Carola Wenk, Univ. Texas, San Antonio

  3. Don’t usually have “n segments” Common inputs represent something more interesting than n segments… perhaps a “subdivision” of the plane into regions. Today we won’t look at algorithms, rather we will define “planar subdivisions”, and look at: • A data structure to represent them, and • Relationships between edges, vertices and faces.

  4. Planar subdivisions include: • Voronoi Diagrams • Polygon/Delaunay triangulations • Representation to reason about and manipulate the subdivision should, at least: • be able to list the edges that bound each face of the subdivision in cyclic order, and • be able to list the edges that surround each vertex.

  5. Planar Graph: • Graph which can be drawn with edges intersecting only at endpoints. Planar Straight Line Graph (PSLG): • Embedded on the plane, and edges are all straight. PSLG subdivides the plane into different types of regions. • 0 dimensional vertices, • 1 dimensional edges, and • 2 dimensional faces. These regions are disjoint, • each edge is topologically open (it does not include it endpoints) • each face is open (it does not include its boundary). Fun Facts: • There is always one unbounded face, that stretches to infinity. • The underlying planar graph need not be a connected graph. • faces may contain holes (and these holes may contain other holes. • Can completely specify the embedding by giving the connectivity of the graph, and the cyclic order of edges around each vertex.

  6. Counting elements of a PSLG Can add new vertex and new edge without adding a face Adding a new edge between existing vertices adds a face (or connects two components. • Variables: • V number of vertices, • E number of edgs, • F number of faces Euler's formula: V - E + F = 2. • If graph is disconnected, with C connected components: V - E + F - C = 1: • Example: • V = 13 • E = 12 • F = 4 • C = 4.

  7. Euler and Complexity Theorem: A planar graph with V vertices has at most 3(V - 2) edges and at most 2(V - 2) faces. Idea: add extra edges and faces to make resulting graph easier to reason about. Proof: First, make new graph G(V,E’) Triangulate the graph. For each face that is bounded by more than three edges (or whose boundary is not connected) add new edge. Repeat until every face in the graph is bounded by exactly three edges. New graph has E’ edges and F’ faces. E' >= E and F' >= F

  8. Resulting graph G(V,E’) has: • one connected component, • every face is bounded by exactly three edges, • each edge has a different face on either side of it. • Every face has 3 edges • So the number of “face bounding edges” is 3F’ • Every edge is part of 2 faces. • So number of “face bounding edges” is 2E’ • So 3F’ = 2E’, or… E’ = 3F’/2 • Euler's formula • Using: E' = 3F’/2 we have • V + E' - F' = 2, • V - 3F'/2 + F' = 2, • F’ = 2(V-2) • F <= F' = 2(V - 2); • F <= 2(V-2) • Using: F' = 2E' / 3 we have • V + E' - F' = 2, • V - E' + 2E'/3 = 2, so • E <= E' = 3(V - 2): • E <= 3(V - 2)

  9. “A planar graph with V vertices has at most 3(V - 2) edges and at most 2(V - 2) faces” Why do we care? For planar graph, doing something a constant number of times for each edge, or a constant number of times for each face remains O(n).

  10. Enough Theory… We require a convenient and efficient way to represent a planar subdivision. • Components in the planar subdivision: • Vertices, edges, faces • Data structure focus on preserving adjacency relationships between components, (but each could have a pointer to additional information).

  11. Crazy Names v7 v2 v1 • Winged Edge Data Structure. • Quad Edge Data Structure. • Our focus on “Doubly Connected Edge List”. e’s twin f1 v3 e v6 f0 e0,1 v5 e4,0 v0 v4 • Every edge e is struct: • e.org, e.dest: pointer to origin and dest vertices. • e.face is face on left of edge • e.twin is the same edge, oriented the other direction. • e.next is next edge along the face [DCEL: doubly connected edge list] • represent edge as 2 halves • lists: vertex, face, edge/twin • facilitates face traversal

  12. Crazy Names v7 v2 • Every edge e is struct: • e.org, e.dest: pointer to origin and dest vertices. • e.face is face on left of edge • e.twin is the same edge, oriented the other direction. • Each Face has a pointer to one edge of that face. • Each vertex has pointer to one edge away from that vertex. v1 e’s twin f1 v3 e v6 f0 e0,1 v5 e4,0 v0 v4 • Pop quiz. • How to enumerate all edges of a face? • How to enumerate all edges incident on a node?

  13. Given two planar subdivisions, S1 and S2 , and we want to compute their overlay. • Overlay is a subdivision whose vertices are the union of the vertices + intersection of edges in S1 and S2. • S1 and S2 are planar, so all intersections are one edge from S1 and one edge from S2 • If each subdivision is represented using a DCEL, can we adapt the plane sweep algorithm update the DCEL (rather than just report intersections?) • First, build the edge and vertex records for the new subdivision. • Then fix up the faces. Faces are harder because we don’t know what faces there are without looking ``into the future'‘.

  14. Important case is when sweep processes an intersection event. Given two intersecting segments, select edge pointers to a1 and b1 that go “forward” across the sweep line. a1 a1.twin V • Create: V b1 b1.twin

  15. Given two intersecting segments, select edge pointers to a1 and b1 that go “forward” across the sweep line. a1 a1.twin V • Create: V a2 • Split edge a1 at V to create a1 and a2: • a2.dest = a1.dest • a2.org = V • a1.dest = V • a1.twin.org = V • a2.twin.dest = V • a2.twin.org = a2.dest a2.twin • Every edge e is struct: • e.org, e.dest: pointer to origin and dest vertices. • e.face is face on left of edge • e.twin is the same edge, oriented the other direction. • e.next is next edge along the face

  16. Given two intersecting segments, select edge pointers to a1 and b1 that go “forward” across the sweep line. a1 b2 a1.twin b2.twin V • Create: V a2 b1 • Split edge a1 at V to create a1 and a2: • a2.dest = a1.dest • a2.org = V • a1.dest = V • a1.twin.org = V • a2.twin.dest = V • a2.twin.org = a2.dest b1.twin a2.twin • Every edge e is struct: • e.org, e.dest: pointer to origin and dest vertices. • e.face is face on left of edge • e.twin is the same edge, oriented the other direction. • e.next is next edge along the face

  17. a1 b2 a1.twin b2.twin V a2 b1 • Fix up the “next” pointers. • A1.next = ? b1.twin a2.twin • Every edge e is struct: • e.org, e.dest: pointer to origin and dest vertices. • e.face is face on left of edge • e.twin is the same edge, oriented the other direction. • e.next is next edge along the face

  18. Hints. • If line is always left turning, and the initial point “p” is (and always has been) on the left of the current segment, then there is no possible intersection. • Keep track of “ranges of vulnerability” • Inside vulnerability • Outside vulnerability • Calculate work in terms of how often each edge is tested, not how much work is done when looking at next segment. Inside vulnerable p0 Outside vulnerable

  19. Hints 2 • Can have a circular sweep line. • Need to define what the sweep line keeps and what are events. • Need to show how to process each event. • Do this processing lead to a new event?

  20. Next class • Read Chapter 3! • Art gallery theorem.

More Related