Advertisement
Guest User

Untitled

a guest
Oct 13th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.26 KB | None | 0 0
  1. # Voronoi Diagrams
  2.  
  3. - Problem: We have a map with n points in there (p_1, p_2, ..., p_n) and we want
  4. to identify for each point q what is the point p_i.
  5.  
  6. * For the PPT: We have **n** Tambos in a map and we want to identify regions in
  7. this map such that for each point in a region, the closest Tambo is the one
  8. in that region
  9.  
  10. * Voronoi assignment model: Assign every point to the nearest city
  11. * Voronoi diagram: Subdivision induced by the Voronoi assignment model
  12.  
  13. 1: Dado n Tambos en un mapa, identificar regiones tal que cada region tenga un solo Tambo y para cada punto dentro de esa región el Tambo más cercano sea el que está en esa regionProblema motivacional
  14. 2: Dado n Tambos en un mapa, determinar en que punto conviene conviene abrir un nuevo Tambo de manera que la distancia con el Tambo más cercano sea la máxima posible
  15.  
  16. Formaly:
  17. Let
  18. * P = {p_1, p_2, ..., p_n} where p_i is a point in R^2
  19. * V(p_i) = {q in R^2 | dis(q, p_i) lt dis(q, p_j) j in [1, n], j != i}
  20.  
  21. Then, Voronoi diagram of P = Vor(P) = Union V(p_i) i in [1, n]
  22.  
  23. * Mediatrix of points p, q is the line perpendicular to pq and intersects with
  24. its middle point
  25.  
  26. * def. h(p, q) is the half-plane of the mediatrix of p and q where p is located
  27.  
  28. Then, we have h(p, q) = {r in R ^ 2 | dis(r, p) < dis(r, q)}
  29.  
  30. Then V(p_i) = Intersection (h(p_i, p_j)) j in [1, n], j != i
  31.  
  32. **Theorem 1** If all points of P are collinear -> Vor(P) consists of
  33. n - 1 parallel lines, Otherwise, Vor(P) is connected and its edges are either segments or half-lines.
  34.  
  35. **Proof**
  36.  
  37. If all points of P are collinear then all its mediatrices are collinear, then
  38. its intersections are parallel, so Vor(P) consists of n - 1 parallel lines.
  39. Else
  40. - Suppose that an edge e that is a full line in Vor(P), then it is the mediatrix
  41. of two points (p_i, p_j), but there exists a point p_k not collinear with
  42. p_i and p_j, so the mediatrix of p_k, p_j intersects with e, then as h(p_j,
  43. p_i) intersection h(p_j, p_k) != empty set -> e if not in Vor(P).
  44. - For every i, V(p_i) is the intersection of a finite number of convex sets, then V(p_i) is
  45. convex.
  46.  
  47. So far, we have the V(p_i) has at most n - 1 vertices and edges, so Vor(P) have
  48. O(n ^ 2) vertices and edges. But, is there a tigh bound ?
  49.  
  50. **Theorem 2** For n >= 3, Vor(P) has at most 2n - 5 and the number of edges is at most 3n - 6.
  51.  
  52. **Proof**
  53. If the points are collinear, then we have n - 1 vertices and edges, then it
  54. holds.
  55. Else, we add a vertex at infinity and connect it with with the half-infinity
  56. edges of Vor(P), then we have a plannar graph. Then, by Euler's formula
  57.  
  58. (V + 1) - E + n = 2
  59. 2E = sum of degrees >= 3 * (V + 1)
  60.  
  61. -> 2E >= 3 * (2 + E - n)
  62. 2E >= 6 + 3E -3n
  63. **3n - 6 >= E**
  64.  
  65. 3n - 6 >= V + 1 + n - 2
  66. **2n - 5 >= V**
  67.  
  68. Def. C_P(q) = {B(q, r), r = max(r' | B(q, r') intersection P = Empty set}
  69.  
  70. **Theorem 3:
  71. (i) A point q is in V iff |clausura(C_P(q)) intersection P| >= 3
  72. (ii) m(p_i, p_j) define an edge of E iff exists q in the m(p_i, p_j) |
  73. |clausura(C_P(q)) insertection P| = {p_i, p_j}
  74.  
  75. **Proof**
  76. (i)
  77. (->)
  78. Let p_i, p_j, p_k be in |clausura(C_P(q) intersection P| -> dis(q, pi)
  79. = dis(q, p_j) = dis(q, p_k) and as the interior of C_P(q) is empty, then q is
  80. in the boundary of V(p_i), V(p_j), V(p_k), then q is in V
  81. (<-)
  82. Every vertex q in V has at least degree 3. Then exists p_i, p_j, p_k |
  83. it is in the boundary of V(p_i), V(p_j), V(p_k) and dis(q, p_i) = dis(q, p_j)
  84. = dis(q, p_k) and there is not a closer point to q. Then |Clausura(C_P(q)
  85. intersection P| >= 3
  86.  
  87. (ii)
  88. (->)
  89. dis(q, p_i) = dis(q, p_j) <= dis(q, p_k) k in [1, n] and by (i) it is not
  90. a vextex -> it is part on an edge.
  91. (<-)
  92. For q in the interior of the edge defined by m(p_i, p_j) in Vor(P), |clausura(C_P(q)) intersects P| included in {p_i, p_j} if
  93. there were a p_k in |clausura(C_P(q) intersects P| -> q would be a vextex by
  94. (i) (-> <-). Then clausura(C_P(q) intersects P) = {p1, p2}
  95.  
  96. # Brute Force
  97.  
  98. For each p_i compute the intersection of the half-planes h(p_i, p_j) [i != j]
  99. using the alogirhtm presented in Chapther 4. Then, each cell can be computed in
  100. O(n log n), so the total complexity is O(n ^ 2 log n)
  101.  
  102. But, we can design a faster algorithm with a plane sweep algorithm.
  103.  
  104. The idea of a plane sweep algorithm is to sweep a line over the plane while
  105. maintaining information of the region already visited and updating it at
  106. special points - the event points.
  107.  
  108. For this problem we will use a sweep line from top to bottom maintaining
  109. information about the part of the Voronoi diagram of the points above the line
  110. that cannot be change by points below the line.
  111.  
  112. Let l be the sweep line.
  113.  
  114. * For a point q above l, the distance from q to l is leq than to any point
  115. above l. Hence if dis(q, p_i) <= dis(q, l) for some point p_i in l+, them the
  116. region of q won't change. The set of points that are closer to q than to l
  117. form a parabola.
  118. * For every point in l+ we can get its parabola and intersect all of them to
  119. get a sequence of parabolic arcs that we will call beach line. That is, the
  120. beach line for l+ if a function that for each x-coordinate associated the
  121. lowest point of the parabolas of each p_i in l+
  122.  
  123. **Observation** The intersection of two parabolic arcs (breackpoints) lie on
  124. edges of the Voronoi diagram. It follows from Theorem 2 (ii).
  125.  
  126. Then, as we move our sweep line l, we maintain its beach line.
  127.  
  128. We will call the event when l reach a new point a site event.
  129.  
  130. How the beach line changes in a site event.
  131.  
  132. **Affirmation 1** The only way in which a new arc can appear on the beach line
  133. is through a site event
  134.  
  135. **Proof**
  136. By contradiction
  137. - Case 1. It appear tangent to another parabola (no sense)
  138. - Case 2. It appear in a breakpoint (its parabola wont appear)
  139.  
  140. **Therefore, each site event can**
  141. * Rise one new arc
  142. * Split one existing arc into two
  143.  
  144. So, the beach line consist of at most 2n - 1 parabolic arcs.
  145.  
  146. - Lets call a circle event when the line reaches the lowest point of a circle defined by three points
  147. that define consecutive arcs of the beach line
  148.  
  149. **Affirmation 2** The only way in wich an existing arc can dissapear from the
  150. beach line is through a circle event
  151.  
  152. **Proof**
  153. Left to the reader as an exercise
  154.  
  155. # Data structures
  156. - Doubly-connected edge list for the Voronoi diagram under construction. But Voronoi diagram has edges
  157. that are half-line of full lines, them we will add a big bounding box. Then, we will compute the Voronoi
  158. diagram inside this box.
  159.  
  160. - Balanced binary search tree T for the beach line.
  161. * Leaves correspond to arcs of the beach line
  162. * Internal points represent breakpoints in the form (p_i, p_j)
  163. * Leaves also store a pointer to a node in the event queue (the circle event in
  164. wich it will dessapear)
  165. * Internal nodes have a pointer to the hald-edge in the doubly-connected edge
  166. list
  167.  
  168. - The event queue Q is implemented as a priority queue where the order is based
  169. of y-coordinate.
  170. * For the site event we simply store the point itself
  171. * Fot a circle event we store the lowest point of the circle, with a pointer to
  172. the leaf of T that represents the arc that will desappear
  173.  
  174. How to detect the events ?
  175. - Site event: We know all of them
  176. - Circle event:
  177. * Idea 1:
  178. * Idea 2:
  179.  
  180. **Affirmation 3:** Every Voronoi vertex is detected by means of a circle event.
  181.  
  182. **Proof**
  183.  
  184.  
  185. # Pseudocode
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement