Computeing Delaunay Triangulationshomepages.math.uic.edu/~jan/mcs481/delaunayincalg.pdf · 2019. 3....

21
Computing Delaunay Triangulations 1 The Delaunay Graph the dual of a Voronoi diagram angle optimal triangulations 2 Computing the Delaunay Triangulation a randomized incremental algorithm formulation of the algorithms MCS 481 Lecture 27 Computational Geometry Jan Verschelde, 20 March 2019 Computational Geometry (MCS 481) Computing Delaunay Triangulations L-27 20 March 2019 1 / 21

Transcript of Computeing Delaunay Triangulationshomepages.math.uic.edu/~jan/mcs481/delaunayincalg.pdf · 2019. 3....

  • Computing Delaunay Triangulations

    1 The Delaunay Graphthe dual of a Voronoi diagramangle optimal triangulations

    2 Computing the Delaunay Triangulationa randomized incremental algorithmformulation of the algorithms

    MCS 481 Lecture 27Computational Geometry

    Jan Verschelde, 20 March 2019

    Computational Geometry (MCS 481) Computing Delaunay Triangulations L-27 20 March 2019 1 / 21

  • Computing Delaunay Triangulations

    1 The Delaunay Graphthe dual of a Voronoi diagramangle optimal triangulations

    2 Computing the Delaunay Triangulationa randomized incremental algorithmformulation of the algorithms

    Computational Geometry (MCS 481) Computing Delaunay Triangulations L-27 20 March 2019 2 / 21

  • the dual of a Voronoi diagram

    At the left is a Voronoi diagram.

    At the right is the dual of the Voronoi diagram.

    Computational Geometry (MCS 481) Computing Delaunay Triangulations L-27 20 March 2019 3 / 21

  • the dual graph of a Voronoi diagram

    Definition (the dual graph of a Voronoi diagram)Let Vor(P) be the Voronoi diagram of the set of points P.The dual graph DG(P) of Vor(P) is constructed as follows:

    the vertices are the sites of Vor(P), andtwo vertices are connectedif and only if the Voronoi cells of their sites share an edge.

    To every vertex of Vor(P) corresponds a face of DG(P).To every face of DG(P) corresponds a vertex of Vor(P).

    Theorem (planarity of the dual graph)The graph DG(P) is planar.

    In a planar graph, there are no crossing edges.

    Computational Geometry (MCS 481) Computing Delaunay Triangulations L-27 20 March 2019 4 / 21

  • a property of edges of the dual graphFor every edge (p,q) of DG(P), there is a circle C

    with p and q on the boundary of C, andno site of P lies in C.

    Computational Geometry (MCS 481) Computing Delaunay Triangulations L-27 20 March 2019 5 / 21

  • there are no crossing edges

    By contradiction, assume two edges cross:

    But then the circle of one edge must contain a vertex in its interior.

    This gives us the contradiction, so our assumption is wrong.

    Q.E.D.

    Computational Geometry (MCS 481) Computing Delaunay Triangulations L-27 20 March 2019 6 / 21

  • points not in general positionWe say that P is in general positionif the degree of every vertex in Vor(P) is three.

    If P is not in general position,then some face f in DG(P) is not a triangle.

    f

    Since f is convex, adding edges to obtain a triangulation is easy.

    Computational Geometry (MCS 481) Computing Delaunay Triangulations L-27 20 March 2019 7 / 21

  • uniqueness

    We derived a criterion for when we can speak ofthe Delaunay triangulation.

    Proposition (uniqueness)The Delaunay triangulation of a point set P is uniqueif and only if P is in general position.

    Computational Geometry (MCS 481) Computing Delaunay Triangulations L-27 20 March 2019 8 / 21

  • Computing Delaunay Triangulations

    1 The Delaunay Graphthe dual of a Voronoi diagramangle optimal triangulations

    2 Computing the Delaunay Triangulationa randomized incremental algorithmformulation of the algorithms

    Computational Geometry (MCS 481) Computing Delaunay Triangulations L-27 20 March 2019 9 / 21

  • characterization of vertices and edges

    p1p2

    p3

    p4

    p5p1

    p2

    p3

    p4

    p5

    Theorem (characterization of vertices and edges)Let P be a set of points in the plane.

    pi ,pj ,pk ∈ P are vertices of DG(P)⇔ the circle through pi , pj , pk contains no point of P in its interior.pi ,pj ∈ P form an edge of DG(P)⇔ a circle C contains pi and pjon its boundary and no other point of P lies inside C.

    Computational Geometry (MCS 481) Computing Delaunay Triangulations L-27 20 March 2019 10 / 21

  • circumcircle characterizationThe three vertices of a triangle define a circle uniquely.

    p

    q

    r

    circumcircle

    p

    q

    r s

    legal

    p

    q

    r s

    illegal

    Theorem (circumcircle characterization)A triangulation T of P is Delaunay⇔ the circumcircle of any triangle ofT does not contain a point of P in its interior.

    Computational Geometry (MCS 481) Computing Delaunay Triangulations L-27 20 March 2019 11 / 21

  • characterization of Delaunay triangulations

    By flipping illegal edges we turn any triangulation into a legal one.

    Theorem (legal triangulations)Let P be a set of points in the plane.A triangulation T is legal⇔ T is a Delaunay triangulation.

    The theory is summarized in the following theorem:

    Theorem (angle optimum triangulations are Delaunay)Any angle optimal triangulation is Delaunay andany Delaunay triangulation is angle optimal.

    The above theorem justifies the definition of a Delaunay triangulation.

    Computational Geometry (MCS 481) Computing Delaunay Triangulations L-27 20 March 2019 12 / 21

  • Computing Delaunay Triangulations

    1 The Delaunay Graphthe dual of a Voronoi diagramangle optimal triangulations

    2 Computing the Delaunay Triangulationa randomized incremental algorithmformulation of the algorithms

    Computational Geometry (MCS 481) Computing Delaunay Triangulations L-27 20 March 2019 13 / 21

  • the initial triangle

    Instead of applying edge flips to an existing triangulation,we will compute the Delaunay triangulation directly.

    The initial triangle is defined as follows:1 Let p0 be the highest point of P.2 Choose p−1 and p−2 so they do not lie on any circle defined by

    three points of P.

    p−2 p−1

    p0

    Computational Geometry (MCS 481) Computing Delaunay Triangulations L-27 20 March 2019 14 / 21

  • adding a point

    Adding a point pr :1 locate the triangle ∆ that contains pr ,2 add edges from pr to the vertices of ∆.

    Special care for when pr lies on an edge shared between two triangles.

    pr

    pr

    In every new triangle, illegal edges are replaced via edge flips.

    Computational Geometry (MCS 481) Computing Delaunay Triangulations L-27 20 March 2019 15 / 21

  • Computing Delaunay Triangulations

    1 The Delaunay Graphthe dual of a Voronoi diagramangle optimal triangulations

    2 Computing the Delaunay Triangulationa randomized incremental algorithmformulation of the algorithms

    Computational Geometry (MCS 481) Computing Delaunay Triangulations L-27 20 March 2019 16 / 21

  • making edges legal

    Algorithm LEGALIZEEDGE(T ,pr , (pi ,pj))

    Input: T is a Delaunay triangulation,the point pr and edge (pi ,pj) define a new triangle.

    Output: T with the illegal edges flipped.

    1 if the edge (pi ,pj) is illegal then2 let ∆pipjpk be the triangle adjacent to ∆pipjpr3 replace in T the edge (pi ,pj) by the edge (pr ,pk )4 LEGALIZEEDGE(T ,pr , (pi ,pk ))5 LEGALIZEEDGE(T ,pr , (pj ,pk ))

    Exercise 1: Make a drawing to justify the steps in the algorithm.Why are steps 4 and 5 needed?Why does LEGALIZEEDGE terminate?

    Computational Geometry (MCS 481) Computing Delaunay Triangulations L-27 20 March 2019 17 / 21

  • a randomized incremental algorithm

    Algorithm DELAUNAYTRIANGULATION(P)

    Input: P, a set of n + 1 points, P = { p0,p1, . . . ,pn }.Output: T , a Delaunay triangulation of P.

    1 let p0 be the rightmost highest point in P2 let p−1 and p−2 be such that P ⊆ ∆p−2p−1p03 T = { ∆p−2p−1p0 }4 compute a random permutation of P \ { p0 }5 for r from 1 to n do6 locate ∆pipjpk ∈ T : pr ∈ ∆pipjpk7 UPDATE(T ,pr ,∆pipjpk )

    Computational Geometry (MCS 481) Computing Delaunay Triangulations L-27 20 March 2019 18 / 21

  • updating the triangulation

    Algorithm UPDATE(T ,pr ,∆pipjpk )

    Input: T , a Delaunay triangulation, pr ∈ ∆pipjpk ∈ T .Output: T , a Delaunay triangulation, with pr added.

    1 if pr belongs to the interior of ∆pipjpk then2 add edges (pi ,pr ), (pj ,pr ), (pk ,pr ) to T3 LEGALIZEEDGE(T ,pr , (pi ,pj))4 LEGALIZEEDGE(T ,pr , (pj ,pk ))5 LEGALIZEEDGE(T ,pr , (pk ,pi))

    Exercise 2: Make a drawing to justify the second step in the algorithm.How can we be sure steps 4 and 5 do not undo the work of step 3?

    Computational Geometry (MCS 481) Computing Delaunay Triangulations L-27 20 March 2019 19 / 21

  • updating the triangulation – continued

    Algorithm UPDATE(T ,pr ,∆pipjpk )

    Input: T , a Delaunay triangulation, pr ∈ ∆pipjpk ∈ T .Output: T , a Delaunay triangulation, with pr added.

    6 if pr lies on the edge (pi ,pj) of ∆pipjpk then7 add edges (pi ,pr ), (pj ,pr ), (pk ,pr ), (pk ,p`) to T8 LEGALIZEEDGE(T ,pr , (pi ,p`))9 LEGALIZEEDGE(T ,pr , (p`,pj))

    10 LEGALIZEEDGE(T ,pr , (pk ,pj))11 LEGALIZEEDGE(T ,pr , (pi ,pk ))

    Make a drawing to justify the steps in the algorithm.

    Computational Geometry (MCS 481) Computing Delaunay Triangulations L-27 20 March 2019 20 / 21

  • recommended assignments

    We covered section 9.2 and half of 9.3 in the textbook.

    Consider the following activities, listed below.

    1 Write the solutions to exercises 1 and 2.2 Consult the CGAL documentation and example code

    on Delaunay triangulations.3 Consider the exercises 5, 6, 8 in the textbook.

    Computational Geometry (MCS 481) Computing Delaunay Triangulations L-27 20 March 2019 21 / 21

    The Delaunay Graphthe dual of a Voronoi diagramangle optimal triangulations

    Computing the Delaunay Triangulationa randomized incremental algorithmformulation of the algorithms