Presentation is loading. Please wait.

Presentation is loading. Please wait.

Robert Pless, CS 546: Computational Geometry Lecture #3 Last Time: Plane Sweep Algorithms, Segment Intersection, + (Element Uniqueness)

Similar presentations


Presentation on theme: "Robert Pless, CS 546: Computational Geometry Lecture #3 Last Time: Plane Sweep Algorithms, Segment Intersection, + (Element Uniqueness)"— Presentation transcript:

1 Robert Pless, CS 546: Computational Geometry Lecture #3 Last Time: Plane Sweep Algorithms, Segment Intersection, + (Element Uniqueness)

2 Robert Pless, CS 546: Computational Geometry Lecture #3 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 Robert Pless, CS 546: Computational Geometry Lecture #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 Robert Pless, CS 546: Computational Geometry Lecture #3 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 Robert Pless, CS 546: Computational Geometry Lecture #3 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 Robert Pless, CS 546: Computational Geometry Lecture #3 Counting elements of a PSLG 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. 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.

7 Robert Pless, CS 546: Computational Geometry Lecture #3 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 Robert Pless, CS 546: Computational Geometry Lecture #3 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 Robert Pless, CS 546: Computational Geometry Lecture #3 “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 Robert Pless, CS 546: Computational Geometry Lecture #3 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 Robert Pless, CS 546: Computational Geometry Lecture #3 Crazy Names Winged Edge Data Structure. Quad Edge Data Structure. Our focus on “Doubly Connected Edge List”. [ DCEL: doubly connected edge list ] f0f0f0f0 f1f1f1f1 e e 4,0 v1v1v1v1 v0v0v0v0 - represent edge as 2 halves - lists: vertex, face, edge/twin -facilitates face traversal e’s twin v2v2v2v2 v7v7v7v7 v6v6v6v6 v5v5v5v5 v3v3v3v3 v4v4v4v4 e 0,1 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

12 Robert Pless, CS 546: Computational Geometry Lecture #3 Crazy Names f0f0 f1f1 e e 4,0 v1v1 v0v0 Pop quiz. -How to enumerate all edges of a face? -How to enumerate all edges incident on a node? e’s twin v2v2 v7v7 v6v6 v5v5 v3v3 v4v4 e 0,1 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.

13 Robert Pless, CS 546: Computational Geometry Lecture #3 Given two planar subdivisions, S 1 and S 2, and we want to compute their overlay. Overlay is a subdivision whose vertices are the union of the vertices + intersection of edges in S 1 and S 2. S 1 and S 2 are planar, so all intersections are one edge from S 1 and one edge from S 2 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 Robert Pless, CS 546: Computational Geometry Lecture #3 b1 b1.twin a1 a1.twin Given two intersecting segments, select edge pointers to a 1 and b 1 that go “forward” across the sweep line. V Create: V Important case is when sweep processes an intersection event.

15 Robert Pless, CS 546: Computational Geometry Lecture #3 a1 a1.twin Given two intersecting segments, select edge pointers to a 1 and b 1 that go “forward” across the sweep line. V Create: V 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 a2 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 Robert Pless, CS 546: Computational Geometry Lecture #3 b1 b1.twin a1 a1.twin Given two intersecting segments, select edge pointers to a 1 and b 1 that go “forward” across the sweep line. V Create: V 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 a2 b2 b2.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 Robert Pless, CS 546: Computational Geometry Lecture #3 b1 b1.twin a1 a1.twin V Fix up the “next” pointers. A1.next = ? a2.twin a2 b2 b2.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 Robert Pless, CS 546: Computational Geometry Lecture #3 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. p0p0 Inside vulnerable Outside vulnerable

19 Robert Pless, CS 546: Computational Geometry Lecture #3 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 Robert Pless, CS 546: Computational Geometry Lecture #3 Next class Read Chapter 3! Art gallery theorem.


Download ppt "Robert Pless, CS 546: Computational Geometry Lecture #3 Last Time: Plane Sweep Algorithms, Segment Intersection, + (Element Uniqueness)"

Similar presentations


Ads by Google