Presentation is loading. Please wait.

Presentation is loading. Please wait.

Department of Geoinformation Science Technische Universität Berlin WS 2006/07 Geoinformation Technology: Voronoi Diagrams Alexandra Stadler Institute for.

Similar presentations


Presentation on theme: "Department of Geoinformation Science Technische Universität Berlin WS 2006/07 Geoinformation Technology: Voronoi Diagrams Alexandra Stadler Institute for."— Presentation transcript:

1 Department of Geoinformation Science Technische Universität Berlin WS 2006/07 Geoinformation Technology: Voronoi Diagrams Alexandra Stadler Institute for Geodesy and Geoinformation Science Technische Universität Berlin Credits: This material is mostly an english translation of the course module no. 2 (‘Geoobjekte und ihre Modellierung‘) of the open e-content platform www.geoinformation.net.www.geoinformation.net

2 2 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Voronoi Diagrams – An Overview  Introduction  Geometric Interpretation  History  Applications  Definition  Construction  Computing the Voronoi Diagram Intersection of Half-planes Divide and Conquer Sweep Plane (Fortune)  Literature

3 3 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Voronoi Diagrams – An Overview  Introduction  Geometric Interpretation  History  Applications  Definition  Construction  Computing the Voronoi Diagram Intersection of Half-planes Divide and Conquer Sweep Plane (Fortune)  Literature

4 4 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Introduction Planning of a supermarket chain  profitable? How do people decide where to do their shopping? Similar question: Where do people post their letters?  “Post Office Problem” (Computational Geometry). To study this problem we make the following simple assumptions:  The price is the same at every site  The cost of transportation to the site is a linear function of the Euclidean distance  Customers try to minimize the cost of acquiring the good or service

5 5 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Voronoi Diagrams – An Overview  Introduction  Geometric Interpretation  History  Applications  Definition  Construction  Computing the Voronoi Diagram Intersection of Half-planes Divide and Conquer Sweep Plane (Fortune)  Literature

6 6 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Geometric Interpretation Voronoi diagram = subdivision of the total area into regions (the trading areas of the sites)  People who live in the same region all go to the same site  The trading area for a given site consists of all those points for which that site is closer than any other site

7 7 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Voronoi Diagrams – An Overview  Introduction  Geometric Interpretation  History  Applications  Definition  Construction  Computing the Voronoi Diagram Intersection of Half-planes Divide and Conquer Sweep Plane (Fortune)  Literature

8 8 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 History  1644: Descartes was first to use Voronoi diagrams – he described the regions of gravitational influence of the sun and other stars Georgy Voronoi 1868-1908 René Descartes 1596-1650  However, they are named after Georgy Fedoseevich Voronoi studies on positive quadratic forms (together with Peter Gustav Lejeune Dirichlet)

9 9 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Voronoi Diagrams – An Overview  Introduction  Geometric Interpretation  History  Applications  Definition  Construction  Computing the Voronoi Diagram Intersection of Half-planes Divide and Conquer Sweep Plane (Fortune)  Literature

10 10 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Applications in Real World  Astronomy -- Identify clusters of stars and clusters of galaxies  Biology, Ecology, Forestry -- Model and analyze plant competition ("Area potentially available to a tree", "Plant polygons")  Geography -- Analyzing patterns of urban settlements  Geometric Modelling -- Finding "good" triangulations of 3D surfaces  Marketing -- Modelling of market areas  Mathematics -- Study of positive definite quadratic forms ("Dirichlet tesselation", "Voronoi diagram")  Meteorology -- Estimate regional rainfall averages ("Thiessen polygons")  Pattern Recognition -- Find simple descriptors for shapes that extract 1D characterizations from 2D shapes ("Medial axis" or "skeleton" of a contour)  Physiology -- Analysis of capillary distribution in cross-sections of muscle tissue to compute oxygen transport ("Capillary domains")  Robotics -- Path planning in the presence of obstacles  Zoology -- Model and analyze the territories of animals

11 11 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Applications within the Field of Computer Science  Knuth's Post Office Problem -- Given a set of locations for post offices, how do you determine the closest post office to a given house? (ignoring zip codes)  All Nearest Neighbors -- Given a set of points, find each point's nearest neighbors  Euclidean Minimum Spanning Tree, Convex Hull -- as parts of the Delaunay triangulation  Closest Pair -- Given a set of points, which two are closest together?  Largest Empty Circle -- also known as the Toxic Waste Dump Problem

12 12 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Voronoi Diagrams – An Overview  Introduction  Geometric Interpretation  History  Applications  Definition  Construction  Computing the Voronoi Diagram Intersection of Half-planes Divide and Conquer Sweep Plane (Fortune)  Literature

13 13 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Definition Let P={p 1, p 2,…,p n } be a set of n distinct points in the plane; these are the sites. We define the Voronoi diagram of P as the subdivision of the plane into n cells, one for each site in P, with the property that a point q lies in the cell corresponding to a site p i if and only if dist(q,p i ) < dist(q,p j ) for each p j є P with j≠i. The cells represent the trading areas of the sites p i ; they are called Voronoi regions. The boundary of a Voronoi region may consist of line segments, half-lines and infinite lines, which we call Voronoi edges. The end points of Voronoi edges are called Voronoi nodes. They belong to the boundary of 3 or more Voronoi regions. i Voronoi edge Voronoi node site Voronoi region

14 14 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Voronoi Diagrams – An Overview  Introduction  Geometric Interpretation  History  Applications  Definition  Construction  Computing the Voronoi Diagram Intersection of Half-planes Divide and Conquer Sweep Plane (Fortune)  Literature

15 15 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Construction of the Voronoi Diagram ?

16 16 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Construction of the Voronoi Diagram  Definition: Bisector of p 1 and p 2 = perpendicular bisector of the line segment p 1 p 2 Splits the plane into two half-planes, each containing the points closer to p 1 or p 2 respectively  Retrieve all the points closer to p 1 than to any other point in the plane Calculate n-1 bisectors between p 1 and all the other points Intersection of n-1 half-planes  (possibly unbounded) open convex polygonal region bounded by at most n-1 vertices and at most n-1 edges

17 17 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Voronoi Diagrams – An Overview  Introduction  Geometric Interpretation  History  Applications  Definition  Construction  Computing the Voronoi Diagram Intersection of Half-planes Divide and Conquer Sweep Plane (Fortune)  Literature

18 18 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Voronoi Diagrams – An Overview  Introduction  Geometric Interpretation  History  Applications  Definition  Construction  Computing the Voronoi Diagram Intersection of Half-planes Divide and Conquer Sweep Plane (Fortune)  Literature

19 19 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Computation I: Intersection of Half-planes Algorithm I (Naïve method)…  Input: list of n sites P  Output: Voronoi diagram for P  Step1: For each site generate n-1 half-planes and compute their common intersection  Step2: Return all intersections as regions of the Voronoi diagram

20 20 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Computation I: Intersection of Half-planes Algorithmic Complexity – Algorithm I (Naïve method)…  Input: list of n sites P  Output: Voronoi diagram for P  Step1: For each site generate n-1 half-planes and compute their common intersection  Step2: Return all intersections as regions of the Voronoi diagram  O(n³) O(n²logn) naïve more sophisticated  O(n) O(n) O(n³) O(n²logn)

21 21 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Voronoi Diagrams – An Overview  Introduction  Geometric Interpretation  History  Applications  Definition  Construction  Computing the Voronoi Diagram Intersection of Half-planes Divide and Conquer Sweep Plane (Fortune)  Literature

22 22 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Computation II: Divide and Conquer Divide and Conquer…  one of the fundamental paradigms for designing efficient algorithms  original problem is recursively divided into several simple subproblems of almost equal size  solution of the original problem is obtained by merging the solutions of the subproblems

23 23 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Computation II: Divide and Conquer Algorithm II.1 (Divide and conquer method)… Input: List of sites P in increasing order of the x coordinates Output: Voronoi diagram for P  Step1: if n<=3  Direct construction of the Voronoi diagram  Step2: otherwise: Divide P into P L and P R (using the median) Compute Voronoi diagrams for P L and P R by algorithm II.1 (recursion!) Merge the Voronoi diagrams by algorithm II.3  Step3: Return the Voronoi diagram for P

24 24 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Computation II: Divide and Conquer Algorithm II.1 (Divide and conquer method)… Animation:

25 25 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Computation II: Divide and Conquer  Essential problem: Merging of two Voronoi diagrams Generate new Voronoi nodes Generate new Voronoi edges  result from the interaction of left and right sites Delete superfluous portions from the input Voronoi diagrams  The sets of sites P L and P R can be separated by a vertical line.  To construct the new nodes and edges, we want to start at the top  We need an algorithmic tool for finding the topmost edge/line such that It touches two disjoint convex polygons and All other points of the polygons lie on the same side of the line.

26 26 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Computation II: Divide and Conquer Algorithm II.2 (Upper common support)… Input: 2 non-overlapping convex polygons U L and U R (convex hull of P L and P R ) Output: Pair of nodes such that the line L(u,w) forms the upper common support  Step1: Find the node in U L with the largest x coordinate  u and the node in U R with the smallest x coordinate  w  Step2: Until no more nodes are detected: While the next node on U L (ccw) lies above L(u,w): replace u While the next node on U R (cw) lies above L(u,w): replace w  Step3: Return the pair of nodes (u,w)

27 27 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Computation II: Divide and Conquer Algorithm II.2 (Upper common support)… Animation:

28 28 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Computation II: Divide and Conquer Algorithm II.3 (Merger of two Voronoi diagrams)… Input: 2 Voronoi diagrams for P L and P R Output: Voronoi diagram for P L  P R (=P)  Step1: Compute the convex hulls of P L and of P R  Step2: Find the upper common support by algorithm II.2 and mark the corresponding regions as active  Step3: Find a point at infinity upward on the bisector of the resulting pair of nodes  Step4: While the upper common support is not reached: Find the intersections of the bisector with the active Voronoi region Choose the intersection with the largest y coordinate and activate the next Voronoi region  Step5: Add the polygonal line and delete superfluous portions from the input Voronoi diagrams

29 29 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Computation II: Divide and Conquer Algorithm II.3 (Merger of two Voronoi diagrams)… Animation:

30 30 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Computation II: Divide and Conquer Data Structure  Doubly-connected edge-list  Advantages: Direct access to neighboring regions Iterate the boundary in linear time  But: Half-lines & full lines cannot be represented in this structure  Bounding box

31 31 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Computation II: Divide and Conquer Algorithm II.1 (Divide and conquer method)… Input: List of sites P in increasing order of the x coordinates Output: Voronoi diagram for P  Step1: if n<=3  Direct construction of the Voronoi diagram  Step2: otherwise: Divide P into P L and P R (using the median) Compute Voronoi diagrams for P L and P R by algorithm II.1 (recursion!) Merge the Voronoi diagrams by algorithm II.3  Step3: Return the Voronoi diagram for P

32 32 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Computation II: Divide and Conquer Algorithmic Complexity – Algorithm II.1 (Divide and conquer method)… Input: List of sites P in increasing order of the x coordinates Output: Voronoi diagram for P  Step1: if n<=3  Direct construction of the Voronoi diagram  Step2: otherwise: Divide P into P L and P R (using the median) Compute Voronoi diagrams for P L and P R by algorithm II.1 (recursion!) Merge the Voronoi diagrams by algorithm II.3  Step3: Return the Voronoi diagram for P  O(1)  2T(n/2)  O(n) 2T(n/2)+O(n)

33 33 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Computation II: Divide and Conquer Algorithmic Complexity – Alg II.1 (Divide and conquer method)…  optimal in terms of worst case complexity T(n) = 2T(n/2)+O(n) Total: T(n) = O(nlogn) Recursion tree method

34 34 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Voronoi Diagrams – An Overview  Introduction  Geometric Interpretation  History  Applications  Definition  Construction  Computing the Voronoi Diagram Intersection of Half-planes Divide and Conquer Sweep Plane (Fortune)  Literature

35 35 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Computation III: Sweep Plane (Fortune) Sweep Plane Method…  Another fundamental paradigm for designing efficient geometric algorithms  Strategy: Sweep a line – the sweep line – from top to bottom across the plane  While sweeping, information is maintained regarding the structure one wants to determine  Information only changes at certain special points, the so called event points

36 36 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Computation III: Sweep Plane (Fortune)  Problem: The part of V above the sweep line l depends also on sites below l (l enters a Voronoi region before it meets its corresponding site!) …sweep line l …sites below l …sites above l

37 37 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Computation III: Sweep Plane (Fortune) DON’T maintain intersections of V with the sweep line DO maintain information about the part of V that is fix - corresponding to the sites above l  What part of V cannot be changed anymore?  Which points q above l have fixed nearest neighbors?  Definition of an area consisting of points q that lie nearer to any known site (above l) than to l and the points below  All sites below l cannot influence q  Special geometric feature, which is defined as the set of points with the same distance of a point and a line  PARABOLA

38 38 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Computation III: Sweep Plane (Fortune)  Every site above l defines a complete parabola  Merging all areas limited by the parabolas Boundary = beach line  The beach line is the function that (for each x coordinate) passes through the lowest point of all parabolas  At the breakpoints, the distance to both sides must be the same as the distance to l  While sweeping, the breakpoints of the beach line exactly trace out the Voronoi diagram  We maintain the beach line (but not explicitly since it changes continuously) – more later…

39 39 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Computation III: Sweep Plane (Fortune) Changes in the combinatorial structure of the beach line – Where and how?  When a new parabolic arc appears on it (a).  When a parabolic arc shrinks to a point and disappears (b). (a) (b)

40 40 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Computation III: Sweep Plane (Fortune) When does a new parabolic arc appear?  When the sweep line reaches a new site.  a new parabola is formed (defined by the new site)  The part of the new parabola below the old beach line is now part of the new beach line. degenerated parabola with zero width  SITE EVENT

41 41 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Computation III: Sweep Plane (Fortune) What happens to V at a site event?  2 breakpoints appear  trace out the same edge (they coincide first and then move in opposite directions)  = the only way for the appearing of new arcs (max 2n-1 arcs). initially the edge is not connected to the rest of V

42 42 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 α α'α' α'' q q Computation III: Sweep Plane (Fortune) When does an existing arc shrink to a point and disappear?  When α ' disappears, all 3 consecutive arcs meet in a point q, which is equidistant from l and each of the 3 sites  circle through the 3 sites, q as center, touching l  No other sites can be inside the circle  3 equidistant sites to q, no nearer sites possible  node of V  CIRCLE EVENT

43 43 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Computation III: Sweep Plane (Fortune)  2 possibilities for changes in the structure of the beach line  SITE EVENT The sweep line reaches a new site A new arc appears A new edge starts to grow  CIRCLE EVENT Circle through 3 sites, q as center, touching l An existing arc drops out 2 growing edges meet to form a Voronoi node in q

44 44 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Computation III: Sweep Plane (Fortune)  Leaves = arcs of the beach line (ordered!) stored value: site defining the arc pointer to: node representing circle event when arc disappears  Internal nodes = breakpoint between arcs stored value: ordered tuple of sites (defining left/right parabola) pointer to: edge that breakpoint traces out  We can find the arc lying above a new site in O(logn) time Representation of the beach line: balanced binary tree T

45 45 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Computation III: Sweep Plane (Fortune) The event queue Q as a priority queue for handling events  Ordered by y coordinates  priority  Stored events: SITE EVENT  site is stored (known in advance) CIRCLE EVENT  lowest point of the circle is stored pointer to the leaf in T representing the disappearing arc (have to be detected)

46 46 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Computation III: Sweep Plane (Fortune) Algorithm III (Sweep plane method)… Input: A set P of sites in the plane Output: V for P  Step1: Initialize the event queue Q with all site events  Step2: WHILE Q is not empty DO Remove the event with largest y coordinate from Q  p i IF the event is a site event THEN HandleSiteEvent(p i ) ELSE HandleCircleEvent(γ), where γ is the leaf of T representing the arc that will disappear  Step3: the remaining internal nodes in T represent half-infinite edges  add them to V  Step4: Return V

47 47 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Computation III: Sweep Plane (Fortune) Procedure HandleSiteEvent(p i )  Step1: IF T is empty, insert p i into it  Step2: ELSE Search in T for arc α vertically above p i IF α has pointer to circle event  false alarm  delete from Q Replace in T the leaf containing α by a subtree with the leaves p j, p i, p j and the internal nodes and  rebalancing Create new record in V for half-edge separating V(p i ) and V(p j ) Check the triple of consecutive arcs (for p i … left/right arc) IF the breakpoints converge  insert circle event into Q

48 48 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Computation III: Sweep Plane (Fortune) Procedure HandleCircleEvent(γ)  Step1: Delete the leaf γ from T representing the disappearing arc α  update internal nodes, rebalancing Delete circle events involving α from Q  Step2: Add the center of the circle causing the event as a node to V  Step3: Create 2 half-edge records in V corresponding to the new breakpoint of the beach line  Step4: Check the new triples of consecutive arcs (where the former left/right neighbor of α is the middle arc ) IF the breakpoints converge  insert circle event into Q

49 49 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Computation III: Sweep Plane (Fortune) Algorithmic Complexity - Algorithm III (Sweep plane method)…  Primitive operations on the tree and the event queue: O(logn)  Primitive operations on the doubly-connected edge list: O(1)  Handling an event: constant number of such primitive operations  O(logn) n site events  O(nlogn) Linear number of circle events  O(nlogn) Total: O(nlogn)  optimal in terms of worst case complexity

50 50 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Voronoi Diagrams – An Overview  Introduction  Geometric Interpretation  History  Applications  Definition  Construction  Computing the Voronoi Diagram Intersection of Half-planes Divide and Conquer Sweep Plane (Fortune)  Literature

51 51 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Literature Okabe, Atsuyuki et al.: Spatial Tesselations: Concepts and Applications of Voronoi-Diagramms. John Wiley & Sons, 2000. de Berg, van Kreveld et al.: Computational Geometry – Algorithms and Applications. Springer, 2000. http://home.dti.net/crispy/Voronoi.html  Voronoi game http://www.pi6.fernuni-hagen.de/GeomLab/VoroGlide/index.html.en  Interactive generation of Voronoi diagram, Delaunay traingulation and Convex hull http://www.snibbe.com/scott/bf/index.htm  Voronoi art

52 52 A. Stadler – Geoinformation Technology: lecture 11 Department of Geoinformation Science WS 2006/07 Outlook So, maybe in future you will explore some astonishing analogies...


Download ppt "Department of Geoinformation Science Technische Universität Berlin WS 2006/07 Geoinformation Technology: Voronoi Diagrams Alexandra Stadler Institute for."

Similar presentations


Ads by Google