Computing Delaunay Triangulation and Voronoi Diagram
Lekcija 10 Sergio Cabello sergio.cabello@fmf.uni-lj.si FMF Univerza v Ljubljani Includes slides by Antoine Vigneron
Sergio Cabello RC – Computing Vor – Del
Computing Delaunay Triangulation and Voronoi Diagram Lekcija 10 - - PowerPoint PPT Presentation
Computing Delaunay Triangulation and Voronoi Diagram Lekcija 10 Sergio Cabello sergio.cabello@fmf.uni-lj.si FMF Univerza v Ljubljani Includes slides by Antoine Vigneron Sergio Cabello RC Computing Vor Del Outline RIC of the
Sergio Cabello RC – Computing Vor – Del
◮ RIC of the Delaunay triangulation
◮ Fortune’s algorithm to construct Voronoi diagram
Sergio Cabello RC – Computing Vor – Del
◮ assume triangle abc is counterclockwise ◮ let C be the circumcircle of abc ◮ we want to design a test inCircle(·) such that
Sergio Cabello RC – Computing Vor – Del
◮ we use the following expression:
◮ why does it work?
Sergio Cabello RC – Computing Vor – Del
◮ the orientation of (−
Sergio Cabello RC – Computing Vor – Del
◮ orientation of tetrahedron abcd = orientation of (−
Sergio Cabello RC – Computing Vor – Del
◮ Orientation (abcd)
◮ developing with respect to first column Sergio Cabello RC – Computing Vor – Del
◮ add first row to the other rows ◮ Orientation (abcd)
◮ note that it generalizes the predicate to test right turns in I
Sergio Cabello RC – Computing Vor – Del
◮ in I
Sergio Cabello RC – Computing Vor – Del
◮ let H be a non–vertical plane ◮ H has equation z = αx + βy + γ ◮ the projection of H ∩ P onto plane Oxy has equation
◮ property: the projection of H ∩ P onto plane Oxy is a circle Sergio Cabello RC – Computing Vor – Del
Sergio Cabello RC – Computing Vor – Del
Sergio Cabello RC – Computing Vor – Del
◮ let p = (px, py) ◮ we lift p onto P and obtain ˆ
x + p2 y)
◮ the transformation p → ˆ
Sergio Cabello RC – Computing Vor – Del
◮ we lift a, b, c and d:
x + a2 y)
x + b2 y)
x + c2 y )
x + d2 y )
◮ we denote by H the plane through {ˆ
◮ inCircle(a, b, c, d) = 0 means that Orientation(ˆ
Sergio Cabello RC – Computing Vor – Del
◮ a, b, c, d cocircular if ˆ
Sergio Cabello RC – Computing Vor – Del
◮ inCircle(a, b, c, d) > 0 means that Orientation(ˆ
◮ inCircle(a, b, c, d) < 0 means that Orientation(ˆ
Sergio Cabello RC – Computing Vor – Del
Sergio Cabello RC – Computing Vor – Del
◮ P = {p1, p2, . . . pn} is a set of points in the plane in general
◮ we denote ˆ
◮ last lecture: triangle pipjpk is a face of DT (P) iff its
Sergio Cabello RC – Computing Vor – Del
Sergio Cabello RC – Computing Vor – Del
◮ let acbd be a convex quadrilateral with diagonal ab ◮ then either
Sergio Cabello RC – Computing Vor – Del
ˆ c ˆ b ˆ d ˆ a a b d c d a c b OR ˆ c ˆ a ˆ d ˆ b Concave Convex
Sergio Cabello RC – Computing Vor – Del
◮ Defined only for convex quadrilaterals. ◮ Why not concave? What is wrong in the proof? Sergio Cabello RC – Computing Vor – Del
◮ P a set of n points in I
◮ T a triangulation of P ◮ ab an edge of T ◮ let (c, d) ∈ P2 such that abc and abd are triangles of T ◮ ab is illegal iff acbd convex quadrilateral and d is inside the
◮ otherwise ab is locally Delaunay: acbd non-convex quadrilateral
◮ deciding if ab is locally Delaunay or illegal is done computing the
Sergio Cabello RC – Computing Vor – Del
◮ if ab is illegal, we can perform an edge flip:
◮ now cd is locally Delaunay
Sergio Cabello RC – Computing Vor – Del
◮ if ab is illegal, we can perform an edge flip:
◮ now cd is locally Delaunay
Sergio Cabello RC – Computing Vor – Del
Sergio Cabello RC – Computing Vor – Del
◮ if T is Delaunay, then clearly all edges are locally Delaunay
◮ other direction:
Sergio Cabello RC – Computing Vor – Del
◮ draw a triangulation T of P ◮ if all the edges of T are locally Delaunay, we are done ◮ otherwise, pick an illegal edge and flip it ◮ repeat this process until all edges are locally Delaunay Sergio Cabello RC – Computing Vor – Del
Sergio Cabello RC – Computing Vor – Del
◮ it is not obvious that this program halts! ◮ in fact runs in Θ(n2) time ◮ proof using lifting map
◮ show a lower bound of Ω(n2) for this algorithm Sergio Cabello RC – Computing Vor – Del
Sergio Cabello RC – Computing Vor – Del
◮ let (p1, p2, p3 . . . pn) be a random permutation of P ◮ let p−3p−2p−1 be a large triangle containing P
◮ for all i we denote Pi = {p−3, p−2, p−1, p1, p2, . . . pi} Sergio Cabello RC – Computing Vor – Del
Sergio Cabello RC – Computing Vor – Del
Sergio Cabello RC – Computing Vor – Del
◮ insert p1, then p2 . . . and finally pn ◮ suppose we have computed DT (Pi−1) ◮ insert pi ⇒ splits a triangle into three
⋆ each non inserted point has a pointer to the triangle in
⋆ each triangle in DT (Pi−1) is associated with the list of
◮ perform edge flips until no illegal edge remains
◮ we have just computed DT (Pi) ◮ repeat the process until i = n Sergio Cabello RC – Computing Vor – Del
◮ inserting pi ◮ to simplify the notations, we denote p = pi ◮ we do not draw p−1p−2p−3 Sergio Cabello RC – Computing Vor – Del
◮ use the pointer from p to the triangle abc that contains it ◮ split abc into abp, bcp and cap ◮ split the conflict list of abc accordingly Sergio Cabello RC – Computing Vor – Del
◮ edge ab is illegal ◮ flip it Sergio Cabello RC – Computing Vor – Del
◮ edge ab has been flipped into pd ◮ ad is locally Delaunay, we keep it Sergio Cabello RC – Computing Vor – Del
◮ edge bd is illegal Sergio Cabello RC – Computing Vor – Del
◮ edge bd has been flipped into pe ◮ edges de and be are locally Delaunay, we keep them Sergio Cabello RC – Computing Vor – Del
◮ edge bc is illegal Sergio Cabello RC – Computing Vor – Del
◮ edge bc has been flipped into pf Sergio Cabello RC – Computing Vor – Del
◮ edge ac is illegal Sergio Cabello RC – Computing Vor – Del
◮ edge ag is locally Delaunay ◮ no more edge to flip: we are done Sergio Cabello RC – Computing Vor – Del
◮ we considered triangles in counterclockwise order around p and
◮ why is it enough to consider only triangles adjacent to p? ◮ see proof later ◮ the pseudocode for this algorithm is very simple ◮ see next slide Sergio Cabello RC – Computing Vor – Del
Sergio Cabello RC – Computing Vor – Del
Sergio Cabello RC – Computing Vor – Del
◮ we only flipped edges of triangles that contain p ◮ why is it sufficient? ◮ remember Theorem: locally Delaunay implies Delaunay ◮ any edge between two triangles that do not contain p was locally
◮ so it is still locally Delaunay ◮ thus the triangulation we obtain is the Delaunay triangulation Sergio Cabello RC – Computing Vor – Del
◮ we look at ti: time taken to update the current triangulation
◮ it does not account for conflict lists updates ◮ each new edge (after splitting abc or after a flip) contains pi ◮ so ti is proportional to the degree of pi in DT (pi)
Sergio Cabello RC – Computing Vor – Del
◮ we use backward analysis: Pi is fixed, pi is random ◮ each edge has two vertices ◮ so each edge contains pi with probability 2
i
◮ there are O(i) edges in the whole triangulation (by Euler
◮ so by backward analysis
◮ so the time for updating the triangulation is O(n) over the
◮ similar with trapezoidal map: what takes Θ(n log n) time is the
Sergio Cabello RC – Computing Vor – Del
◮ while inserting pi, what is the probability that p ∈ P \ Pi is
◮ backward analysis
◮ so while inserting pi, we rebucket less than 3n/i sites on average Sergio Cabello RC – Computing Vor – Del
◮ problem: a site may be rebucketed several times at step i
◮ so overall, rebucketing takes expected time
Sergio Cabello RC – Computing Vor – Del
p−3(−3M, −3M) p−2(3M, 0) P p−1(0, 3M) (M, M)
◮ why do we need p−1p−2p−3? ◮ M: max of any coordinate of any point in P ◮ For incircle test, do as if these three points are outside any circle
Sergio Cabello RC – Computing Vor – Del
Sergio Cabello RC – Computing Vor – Del
◮ sweep line algorithm ◮ what invariant do we maintain? ◮ cannot maintain Voronoi diagram to the left Sergio Cabello RC – Computing Vor – Del
◮ sweep vertical line ℓ from left to right ◮ maintain the portion of Voronoi diagram that cannot change ◮ what points cannot change? ◮ how does the corresponding portion of the Voronoi diagram look
◮ beach-line: curve separating fixed from changing part ◮ the break points of the beach-line trace Voronoi edges Sergio Cabello RC – Computing Vor – Del
Sergio Cabello RC – Computing Vor – Del
Sergio Cabello RC – Computing Vor – Del
Sergio Cabello RC – Computing Vor – Del
◮ insertion event: a new parabolic arc appears in the beach-line ◮ deletion event: a parabolic arc dissappears from the beach-line
sweep line sweep line
Sergio Cabello RC – Computing Vor – Del
sweep line sweep line
degeneretad parabola
Sergio Cabello RC – Computing Vor – Del
sweep line
sweep line
sweep line
Sergio Cabello RC – Computing Vor – Del
Sergio Cabello RC – Computing Vor – Del
◮ for each site p, make the surface cone
◮ the lower envelope of the cones are the points visible from
◮ Voronoi faces, edges and vertices are the same faces, edges and
◮ picture in the board ◮ sweep a plane π slanted 45 degrees to the xy-plane ◮ the sweep line ℓ is π ∩ xy-plane ◮ the left of ℓ is the portion of lower envelope below π Sergio Cabello RC – Computing Vor – Del
◮ it should be clear now that
Sergio Cabello RC – Computing Vor – Del
◮ Voronoi diagram to the left of the beach line
◮ Beach line
◮ Priority event queue sorted by x-coordinate
Sergio Cabello RC – Computing Vor – Del
◮ Insertion event
sweep line sweep line
degeneretad parabola
◮ Deletion event
sweep line
p q r
sweep line
p q r
sweep line
p q r
Sergio Cabello RC – Computing Vor – Del
◮ in each event we need O(log n) time ◮ there are O(n) events:
◮ the algorithm does not use parabolic arcs!! ◮ only the concept Sergio Cabello RC – Computing Vor – Del
◮ the Delaunay triangulation can be computed in expected time
◮ it holds for worst case input, the expectation is over the random
◮ the Voronoi it can be constructed in O(n log n) worst-case time ◮ remember we can go from Delaunay to Voronoi and vice versa in
◮ deterministic algorithm harder to implement ◮ combining with the point location data structures, proximity
Sergio Cabello RC – Computing Vor – Del