Download presentation

Presentation is loading. Please wait.

Published byJaidyn Yates Modified over 2 years ago

1
Map Overlay Algorithm

2
Birch forest Wolves Map 1: Vegetation Map 2: Animals

3
Birch and wolves Overlay Thus we need to find intersections of segments of two planar subdivisions

4
Overlay of two subdivisions S1 and S2 are two subdivisions (planar graphs), given in the form of DCEL’s Our goal is to compute the DCEL for the overlay O(S1, S2) Note: f is a face of O (S1, S2) if and only if there are two faces f 1 from S1 and f 2 from S2 such that f is the maximal connected component of the intersection f 1 and f 2

5
Strategy Take the union of DCEL’s of S1 and S2 This union is NOT a valid DCEL (does not represent planar subdivision) We need to transform this union into a valid DCEL, i.e. to compute new half-edge records, face records, and vertex records For each face record f in O (S1, S2) we also need to report information about faces f 1 from S1 and f 2 from S2 such that f is the maximal connected component of the intersection f 1 and f 2 Recall: any half-edge in DCEL is oriented so that the face it bounds lies to the left. Therefore we can use an unchanged half-edge record from S1 in O(S1, S2) if and only if it is not intersected by any edge from S2, and vice versa

6
Algorithm - preparation By complexity of a subdivision we mean the num. of vertices + the num. of edges + the num. of faces In what follows, k will denote the complexity of D (the resulting subdivision), and n will denote the sum of complexities of S1 and S2 Note: due to the Euler's formula, the complexity of a connected planar subdivision is O (number of edges)

7
Algorithm - preparation Based on the plane sweep algorithm for segment intersections We use it to find intersections of edges from S1 and S2 Data structures to be used: Q (event queue) and T (status structure) as before Additionally, D will be new DCEL Together with edges in T, we store pointers to the corresponding half-edges in D Initially, D contains the union of DCEL’s of S1 and S2 During the algorithm, D will be transformed into the correct DCEL for the overlay O (S1, S2)

8
Algorithm – handling an event point We update T and Q as in the case of segment intersection algorithm If event point involves segments from only one of S1 or S2, nothing else happens If not, we must create new half-edges in D This involves several possible case: an edge of S1 crosses and edge of S2 an edge from S1 passes through a vertex of S2 (or vice versa) a common vertex

9
Case 1 Before After S1 S2 Similarly in the case of more segments, going through one point v – event point

10
Case 1 Before After S1 S2 S1 S2 v – event point v

11
Case 1 Before After v – event point v e1'e1' e 1 '' e1e1 e2e2 e' 2 e'' 2 Updates to D: Next(e' 2 ) = e'' 1, Next(e'' 1 ) = Next (e 1 ), Prev(e' 1 )= Prev(e 1 ), and so on Next(e 1 ) Prev(e 1 ) Clockwise order around v to determine Next() and Prev()

12
Case 1 After v e1'e1' e 1 '' e' 2 e'' 2 Clockwise order around v to determine Next() and Prev() It takes O(deg v) time to determine Next() and Prev() relationships around v It takes constant time to determine Next() and Prev() relationships around every other vertex, involved in the event Thus, in total (i.e. for all vertices of D) it takes sum of degrees of all vertices of D, which is O(k)

13
Case 2 Before After S1 S2 v – event point is a vertex of S1

14
Case 2 Before After S1 S2 v – event point is a vertex of S1 O(k) total time to determine Prev() and Next() relationships

15
Case 3 Before After S1 S2 event point is a vertex of both S1 and S2

16
Case 3 Before After S1 S2 event point is a vertex of both S1 and S2 O(k) total time to determine Prev() and Next() relationships

17
Total Time Let k be the complexity of D and n be the sum of complexities of S1 and S2 Then, according to the time required for the segment intersection algorithm, the previous part of the map overlay algorithm takes O(n log n + k log n) time

18
Some remarks During the plane sweep: 1. for each half-edge in D, we can record the corresponding half- edge from S1 or S2 - this will allow us to find the corresponding face record from S1 or S2 by looking at IncidentFace () 2.for each vertex v of S1 which does not belong to any edge of S2, we can determine a face of S2 that contains it by looking and the edges of S2 in the status T, immediately to the left and to the right of v (and vice versa, for each v of S2) 3.for each vertex we will record the half-edge of D that lies immediately to the left of the vertex with respect to the current position of the sweep line By traversing the edges of D, we can find all boundary cycles in O(k) time, where k is the complexity of D This will help us to create face records in D Moreover, using 1. and 2. from the above, for each new face record we will be able to find faces f1 and f2 of S1 and S2, respectively, such that f is the intersection of f1 and f2

19
Face records in D We know all boundary cycles of D Problem: which of them are outer boundaries of faces and which are inner cycles, i.e. boundaries of holes inside faces? It can be solved as follows Look at the leftmost vertex of the cycle If half-edges from the boundary of the cycle, that are incident to this vertex, form an angle < 180 o, it is outer cycle, otherwise it is an inner cycle

20
Face records in D Another Problem: which of outer cycles lie in a given inner cycle? To decide, we will construct a special graph G as follows: vertices of G are boundary cycles additional vertex corresponds to the imaginary outer boundary of the unbounded face two vertices are joined by an edge if and only if one of the corresponding cycles is the boundary of a hole and the other cycle has a half-edge immediately to the left of the leftmost vertex of that hole cycle if there is no such half-edge, then the vertex is linked to the vertex, corresponding to the unbounded face It takes O(k) time to construct G

21
Example Which half-edge is immediately to the left of v? Sweep line v e′e′ e′′

22
Example

23
Lemma 2.5 Each connected component of the graph G corresponds exactly to the set of cycles incident to one face Thus, we need to determine connected components of G It takes O(k) time to do it (using e.g. a depth-first search)

24
Total time required for map overlay Let n be the sum of complexities of S1 and S2 and k be the complexity of D Plan sweep: O (n log n + k log n) After the plane sweep: Finding boundary cycles: O(k) Constructing the graph: O(k) Finding connected components of G: O(k) Thus the total time is still O (n log n + k log n)

25
Algorithm MAPOVERLAY(S1,S2) Input. S1 and S2 stored as DCEL’s Output. The overlay of S1 and S2 stored in DCEL D Copy DCEL’s for S1 and S2 to D Plane sweep: compute all intersections between edges from S1 and S2 In addition, do the following during the plane sweep: Update D if the event involves edges of both S1and S2 (create new half-edges and update Next() and Prev() info) Store the half-edge immediately to the left of the event point at the vertex in D representing it (will be required later to create G) For each v from S1 which does not belong to any edge of S2, record the face of S2 in which it is contained (and similarly for vertices of S2) Now D is the DCEL for O(S1,S2), except that the information about the faces has not been computed yet

26
Determine the boundary cycles in O(S1,S2) by traversing D. Construct the graph G whose vertices correspond to boundary cycles and whose edges connect each hole cycle to the cycle to the left of its leftmost vertex Compute connected components of G For each connected component in G Do Let C be the unique outer boundary cycle in the component and let f denote the face bounded by this cycle create a face record for f set OuterComponent (f) to some half-edge of C construct the list InnerComponents (f) consisting of pointers to one half-edge in each hole cycle in the component let the IncidentFace() pointers of all half-edges in the cycles point to the face record of f End Do Label each face of O(S1,S2) with the names of the faces of S1 and S2 containing it

Similar presentations

OK

Curve Curve: The image of a continous map from [0,1] to R 2. Polygonal curve: A curve composed of finitely many line segments. Polygonal u,v-curve: A polygonal.

Curve Curve: The image of a continous map from [0,1] to R 2. Polygonal curve: A curve composed of finitely many line segments. Polygonal u,v-curve: A polygonal.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on samuel taylor coleridge Ppt on series and parallel circuits pdf Ppt on spiritual leadership definition Ppt on placement in hrm Ppt on rain water conservation Ppt on types of distribution channels Ppt on causes of 1857 revolt ppt Download ppt on oxidation and reduction definition Ppt on security features of atm Ppt on object-oriented concepts and principles