Voronoi Diagrams Computational Geometry Lecture · The Post O ce Problem Vor(P) = Voronoi diagram...

125
Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams 1 Tamara Mchledidze · Darren Strash Computational Geometry Lecture INSTITUT F ¨ UR THEORETISCHE INFORMATIK · FAKULT ¨ AT F ¨ UR INFORMATIK Voronoi Diagrams 03.06.2014 Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams

Transcript of Voronoi Diagrams Computational Geometry Lecture · The Post O ce Problem Vor(P) = Voronoi diagram...

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams1

    Tamara Mchledidze · Darren Strash

    Computational Geometry Lecture

    INSTITUT FÜR THEORETISCHE INFORMATIK · FAKULTÄT FÜR INFORMATIK

    Voronoi Diagrams

    03.06.2014

    Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams2-1

    The Post Office Problem

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams2-2

    The Post Office Problem

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams2-3

    The Post Office Problem

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams2-4

    The Post Office Problem

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams2-5

    The Post Office Problem

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams2-6

    The Post Office Problem

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams2-7

    The Post Office Problem

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams2-8

    The Post Office Problem

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams2-9

    The Post Office Problem

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams2-10

    The Post Office Problem

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams2-11

    The Post Office Problem

    p

    q

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams2-12

    The Post Office Problem

    p

    q

    b(p, q)

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams2-13

    The Post Office Problem

    p

    q

    b(p, q) = {x ∈ R2 : |xp| = |xq|}

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams2-14

    The Post Office Problem

    p

    q

    b(p, q)

    h(p, q)

    = {x ∈ R2 : |xp| = |xq|}

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams2-15

    The Post Office Problem

    p

    q

    b(p, q)

    h(p, q)

    = {x ∈ R2 : |xp| = |xq|}

    = {x : |xp| < |xq|}

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams2-16

    The Post Office Problem

    p

    q

    b(p, q)

    h(p, q) h(q, p)

    = {x ∈ R2 : |xp| = |xq|}

    = {x : |xp| < |xq|}

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams2-17

    The Post Office Problem

    p

    q

    b(p, q)

    h(p, q) h(q, p)

    = {x ∈ R2 : |xp| = |xq|}

    = {x : |xp| < |xq|} = {x : |xq| < |xp|}

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams2-18

    The Post Office Problem

    p

    q

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams2-19

    The Post Office Problem

    P = {p1, p2, . . . , pn}

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams2-20

    The Post Office Problem

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams2-21

    The Post Office Problem

    Vor(P ) = Voronoi diagram of P

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams2-22

    The Post Office Problem

    Vor(P ) = Voronoi diagram of P

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams2-23

    The Post Office Problem

    Vor(P ) = Voronoi diagram of P

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams2-24

    The Post Office Problem

    1) Define Voronoi cells, edges, and vertices!

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams2-25

    The Post Office Problem

    1) Define Voronoi cells, edges, and vertices!

    2) Are Voronoi cells convex?

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams3

    The Voronoi Diagram

    Let P be a set of points in the plane and let p, p′, p′′ ∈ P .

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams3

    The Voronoi Diagram

    Let P be a set of points in the plane and let p, p′, p′′ ∈ P .

    Vor(P )Voronoi Diagramp

    p′

    p′′

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams3

    The Voronoi Diagram

    Let P be a set of points in the plane and let p, p′, p′′ ∈ P .

    Vor(P )Voronoi Diagramp

    p′

    p′′

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams3

    The Voronoi Diagram

    V({p}) =

    Let P be a set of points in the plane and let p, p′, p′′ ∈ P .

    Vor(P )Voronoi Diagram

    Voronoi cell

    p

    p′

    p′′

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams3

    The Voronoi Diagram

    V({p}) =

    Let P be a set of points in the plane and let p, p′, p′′ ∈ P .

    Vor(P )Voronoi Diagram

    Voronoi cell

    p

    p′

    p′′

    =V(p)

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams3

    The Voronoi Diagram

    V({p}) =

    Let P be a set of points in the plane and let p, p′, p′′ ∈ P .

    Vor(P )

    {x ∈ R2 : |xp| < |xq| ∀q ∈ P \ {p}

    }Voronoi Diagram

    Voronoi cell

    p

    p′

    p′′

    =V(p)

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams3

    The Voronoi Diagram

    V({p}) ==⋂

    q 6=p h(p, q)

    Let P be a set of points in the plane and let p, p′, p′′ ∈ P .

    Vor(P )

    {x ∈ R2 : |xp| < |xq| ∀q ∈ P \ {p}

    }Voronoi Diagram

    Voronoi cell

    p

    p′

    p′′

    =V(p)

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams3

    The Voronoi Diagram

    V({p}) ==⋂

    q 6=p h(p, q)

    Let P be a set of points in the plane and let p, p′, p′′ ∈ P .

    Vor(P )

    {x ∈ R2 : |xp| < |xq| ∀q ∈ P \ {p}

    }Voronoi Diagram

    Voronoi cell

    p

    p′

    p′′

    =V(p)

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams3

    The Voronoi Diagram

    V({p}) ==⋂

    q 6=p h(p, q)

    Let P be a set of points in the plane and let p, p′, p′′ ∈ P .

    Vor(P )

    V({p, p′})

    {x ∈ R2 : |xp| < |xq| ∀q ∈ P \ {p}

    }Voronoi edges

    Voronoi Diagram

    Voronoi cell

    p

    p′

    p′′

    =

    =V(p)

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams3

    The Voronoi Diagram

    V({p}) ==⋂

    q 6=p h(p, q)

    Let P be a set of points in the plane and let p, p′, p′′ ∈ P .

    Vor(P )

    V({p, p′})

    {x ∈ R2 : |xp| < |xq| ∀q ∈ P \ {p}

    }

    {x : |xp| = |xp′| and |xp| < |xq| ∀q 6= p, p′}Voronoi edges

    Voronoi Diagram

    Voronoi cell

    p

    p′

    p′′

    =

    =V(p)

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams3

    The Voronoi Diagram

    V({p}) ==⋂

    q 6=p h(p, q)

    Let P be a set of points in the plane and let p, p′, p′′ ∈ P .

    Vor(P )

    V({p, p′})∂V(p) ∩ ∂V(p′)=

    {x ∈ R2 : |xp| < |xq| ∀q ∈ P \ {p}

    }

    {x : |xp| = |xp′| and |xp| < |xq| ∀q 6= p, p′}Voronoi edges

    Voronoi Diagram

    Voronoi cell

    p

    p′

    p′′

    =

    =V(p)

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams3

    The Voronoi Diagram

    V({p}) ==⋂

    q 6=p h(p, q)

    Let P be a set of points in the plane and let p, p′, p′′ ∈ P .

    Vor(P )

    V({p, p′})∂V(p) ∩ ∂V(p′)= int( )

    {x ∈ R2 : |xp| < |xq| ∀q ∈ P \ {p}

    }

    {x : |xp| = |xp′| and |xp| < |xq| ∀q 6= p, p′}Voronoi edges

    Voronoi Diagram

    Voronoi cell

    p

    p′

    p′′

    =

    =

    d.h. without endpoints,

    V(p)

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams3

    The Voronoi Diagram

    V({p}) ==⋂

    q 6=p h(p, q)

    Let P be a set of points in the plane and let p, p′, p′′ ∈ P .

    Vor(P )

    V({p, p′})∂V(p) ∩ ∂V(p′)= int( )

    {x ∈ R2 : |xp| < |xq| ∀q ∈ P \ {p}

    }

    {x : |xp| = |xp′| and |xp| < |xq| ∀q 6= p, p′}Voronoi edges

    Voronoi Diagram

    Voronoi cell

    p

    p′

    p′′

    =

    =

    d.h. without endpoints,

    V(p)

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams3

    The Voronoi Diagram

    V({p}) ==⋂

    q 6=p h(p, q)

    Let P be a set of points in the plane and let p, p′, p′′ ∈ P .

    Vor(P )

    V({p, p′})∂V(p) ∩ ∂V(p′)= int( )

    {x ∈ R2 : |xp| < |xq| ∀q ∈ P \ {p}

    }

    {x : |xp| = |xp′| and |xp| < |xq| ∀q 6= p, p′}

    Voronoi verticesV({p, p′, p′′})

    Voronoi edges

    Voronoi Diagram

    Voronoi cell

    p

    p′

    p′′

    =

    =

    d.h. without endpoints,

    V(p)

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams3

    The Voronoi Diagram

    V({p}) ==⋂

    q 6=p h(p, q)

    Let P be a set of points in the plane and let p, p′, p′′ ∈ P .

    Vor(P )

    V({p, p′})∂V(p) ∩ ∂V(p′)= int( )

    {x ∈ R2 : |xp| < |xq| ∀q ∈ P \ {p}

    }

    {x : |xp| = |xp′| and |xp| < |xq| ∀q 6= p, p′}

    Voronoi vertices= ∂V(p) ∩ ∂V(p′) ∩ ∂V(p′′)V({p, p′, p′′})

    Voronoi edges

    Voronoi Diagram

    Voronoi cell

    p

    p′

    p′′

    =

    =

    d.h. without endpoints,

    V(p)

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams3

    The Voronoi Diagram

    V({p}) ==⋂

    q 6=p h(p, q)

    Let P be a set of points in the plane and let p, p′, p′′ ∈ P .

    Vor(P )

    V({p, p′})∂V(p) ∩ ∂V(p′)= int( )

    {x ∈ R2 : |xp| < |xq| ∀q ∈ P \ {p}

    }

    {x : |xp| = |xp′| and |xp| < |xq| ∀q 6= p, p′}

    Voronoi vertices= ∂V(p) ∩ ∂V(p′) ∩ ∂V(p′′)V({p, p′, p′′})

    Voronoi edges

    Voronoi Diagram

    Voronoi cell

    p

    p′

    p′′

    =

    =

    d.h. without endpoints,

    V(p)

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams3

    The Voronoi Diagram

    V({p}) ==⋂

    q 6=p h(p, q)

    Let P be a set of points in the plane and let p, p′, p′′ ∈ P .

    Vor(P )

    V({p, p′})∂V(p) ∩ ∂V(p′)= int( )

    {x ∈ R2 : |xp| < |xq| ∀q ∈ P \ {p}

    }

    {x : |xp| = |xp′| and |xp| < |xq| ∀q 6= p, p′}

    Voronoi vertices= ∂V(p) ∩ ∂V(p′) ∩ ∂V(p′′)V({p, p′, p′′})

    Voronoi edges

    Voronoi Diagram

    Voronoi cell

    p

    p′

    p′′

    =

    =

    subdivision

    d.h. without endpoints,

    V(p)

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams3

    The Voronoi Diagram

    V({p}) ==⋂

    q 6=p h(p, q)

    Let P be a set of points in the plane and let p, p′, p′′ ∈ P .

    Vor(P )

    V({p, p′})∂V(p) ∩ ∂V(p′)= int( )

    {x ∈ R2 : |xp| < |xq| ∀q ∈ P \ {p}

    }

    {x : |xp| = |xp′| and |xp| < |xq| ∀q 6= p, p′}

    Voronoi vertices= ∂V(p) ∩ ∂V(p′) ∩ ∂V(p′′)V({p, p′, p′′})

    Voronoi edges

    Voronoi Diagram

    Voronoi cell

    p

    p′

    p′′

    =

    =

    subdivision

    geometric graph

    d.h. without endpoints,

    V(p)

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams4

    Properties

    Theorem 1: Let P ⊂ R2 be a set of n points. If all points arecollinear, then Vor(P ) consists of n− 1 parallellines. Otherwise Vor(P ) is connected and itsedges are either segments or half lines.

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams4

    Properties

    Theorem 1: Let P ⊂ R2 be a set of n points. If all points arecollinear, then Vor(P ) consists of n− 1 parallellines. Otherwise Vor(P ) is connected and itsedges are either segments or half lines.

    How many edges and vertices Vor(P ) has?

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams4

    Properties

    Theorem 1: Let P ⊂ R2 be a set of n points. If all points arecollinear, then Vor(P ) consists of n− 1 parallellines. Otherwise Vor(P ) is connected and itsedges are either segments or half lines.

    Find a set P so that a cell in Vor(P ) has linear complexity.

    How many edges and vertices Vor(P ) has?

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams4

    Properties

    Theorem 1: Let P ⊂ R2 be a set of n points. If all points arecollinear, then Vor(P ) consists of n− 1 parallellines. Otherwise Vor(P ) is connected and itsedges are either segments or half lines.

    Find a set P so that a cell in Vor(P ) has linear complexity.

    Can this happen with (almost) all cells?

    How many edges and vertices Vor(P ) has?

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams4

    Properties

    Theorem 1: Let P ⊂ R2 be a set of n points. If all points arecollinear, then Vor(P ) consists of n− 1 parallellines. Otherwise Vor(P ) is connected and itsedges are either segments or half lines.

    Find a set P so that a cell in Vor(P ) has linear complexity.

    Theorem 2: Let P ⊂ R2 be a set on n points. Vor(P ) has atmost 2n− 5 nodes and 3n− 6 edges.

    Can this happen with (almost) all cells?

    How many edges and vertices Vor(P ) has?

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams4

    Properties

    Theorem 1: Let P ⊂ R2 be a set of n points. If all points arecollinear, then Vor(P ) consists of n− 1 parallellines. Otherwise Vor(P ) is connected and itsedges are either segments or half lines.

    Find a set P so that a cell in Vor(P ) has linear complexity.

    Theorem 2: Let P ⊂ R2 be a set on n points. Vor(P ) has atmost 2n− 5 nodes and 3n− 6 edges.

    Can this happen with (almost) all cells?

    How many edges and vertices Vor(P ) has?

    Exercise!

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams5

    Characterization

    Definition: Let q be a point. Define CP (q) to be the points inP that lie on the empty circle with center q.

    q

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams5

    Characterization

    Definition: Let q be a point. Define CP (q) to be the points inP that lie on the empty circle with center q.

    q

    CP (q)

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams5

    Characterization

    Definition: Let q be a point. Define CP (q) to be the points inP that lie on the empty circle with center q.

    q

    CP (q)

    Theorem 3: A point q is a Voronoi vertex⇔ |CP (q) ∩ P | ≥ 3,the bisector b(pi, pj) defines a Voronoi edge⇔ ∃q ∈ b(pi, pj) with CP (q) ∩ P = {pi, pj}.

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams6

    Computing Vor(P )

    How can we calculate Vor(P ) withmethods we already know?

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams6

    Computing Vor(P )

    For each p ∈ P is V(p) =⋂

    p′ 6=p h(p, p′) is the intersection of

    n− 1 half planes.

    How can we calculate Vor(P ) withmethods we already know?

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams6

    Computing Vor(P )

    For each p ∈ P is V(p) =⋂

    p′ 6=p h(p, p′) is the intersection of

    n− 1 half planes.

    How can we calculate Vor(P ) withmethods we already know?

    foreach p ∈ P docompute V(p) =

    ⋂p′ 6=p h(p, p

    ′)

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams6

    Computing Vor(P )

    For each p ∈ P is V(p) =⋂

    p′ 6=p h(p, p′) is the intersection of

    n− 1 half planes.

    How can we calculate Vor(P ) withmethods we already know?

    foreach p ∈ P docompute V(p) =

    ⋂p′ 6=p h(p, p

    ′) O(n log n) [Lecture 4]

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams6

    Computing Vor(P )

    For each p ∈ P is V(p) =⋂

    p′ 6=p h(p, p′) is the intersection of

    n− 1 half planes.

    How can we calculate Vor(P ) withmethods we already know?

    foreach p ∈ P docompute V(p) =

    ⋂p′ 6=p h(p, p

    ′) O(n log n) [Lecture 4]

    O(n2 log n)

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams6

    Computing Vor(P )

    For each p ∈ P is V(p) =⋂

    p′ 6=p h(p, p′) is the intersection of

    n− 1 half planes.

    How can we calculate Vor(P ) withmethods we already know?

    foreach p ∈ P docompute V(p) =

    ⋂p′ 6=p h(p, p

    ′) O(n log n) [Lecture 4]

    O(n2 log n)

    Is O(n2 log n) running time for a linear-size object necessary?

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams6

    Computing Vor(P )

    For each p ∈ P is V(p) =⋂

    p′ 6=p h(p, p′) is the intersection of

    n− 1 half planes.

    How can we calculate Vor(P ) withmethods we already know?

    foreach p ∈ P docompute V(p) =

    ⋂p′ 6=p h(p, p

    ′) O(n log n) [Lecture 4]

    O(n2 log n)

    Is O(n2 log n) running time for a linear-size object necessary?

    Idea 2: Sweep line

    `

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams6

    Computing Vor(P )

    For each p ∈ P is V(p) =⋂

    p′ 6=p h(p, p′) is the intersection of

    n− 1 half planes.

    How can we calculate Vor(P ) withmethods we already know?

    foreach p ∈ P docompute V(p) =

    ⋂p′ 6=p h(p, p

    ′) O(n log n) [Lecture 4]

    O(n2 log n)

    Is O(n2 log n) running time for a linear-size object necessary?

    Idea 2: Sweep line

    Problem:Vor(P ) over ` depends onpoints under `!

    `

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams6

    Computing Vor(P )

    For each p ∈ P is V(p) =⋂

    p′ 6=p h(p, p′) is the intersection of

    n− 1 half planes.

    How can we calculate Vor(P ) withmethods we already know?

    foreach p ∈ P docompute V(p) =

    ⋂p′ 6=p h(p, p

    ′) O(n log n) [Lecture 4]

    O(n2 log n)

    Is O(n2 log n) running time for a linear-size object necessary?

    Idea 2: Sweep line

    Problem:Vor(P ) over ` depends onpoints under `!

    `

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams7

    In the Direction of the Sweep Line

    Obviously the intersection of Vor(P ) and sweep line ` at thecurrent time point is not known yet.

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams7

    In the Direction of the Sweep Line

    Obviously the intersection of Vor(P ) and sweep line ` at thecurrent time point is not known yet.

    Instead, we store the part above ` that is already fixed!

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams7

    In the Direction of the Sweep Line

    Obviously the intersection of Vor(P ) and sweep line ` at thecurrent time point is not known yet.

    Instead, we store the part above ` that is already fixed!

    What does it consist of?

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams7

    In the Direction of the Sweep Line

    Obviously the intersection of Vor(P ) and sweep line ` at thecurrent time point is not known yet.

    Instead, we store the part above ` that is already fixed!

    What does it consist of?

    p(px, py)

    `(`y)

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams7

    In the Direction of the Sweep Line

    Obviously the intersection of Vor(P ) and sweep line ` at thecurrent time point is not known yet.

    Instead, we store the part above ` that is already fixed!

    What does it consist of?

    p(px, py)

    `(`y)

    Points closer to p than ` are already processed.

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams7

    In the Direction of the Sweep Line

    Obviously the intersection of Vor(P ) and sweep line ` at thecurrent time point is not known yet.

    Instead, we store the part above ` that is already fixed!

    What does it consist of?

    p(px, py)

    `(`y)

    fixed

    not fixed

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams7

    In the Direction of the Sweep Line

    Obviously the intersection of Vor(P ) and sweep line ` at thecurrent time point is not known yet.

    Instead, we store the part above ` that is already fixed!

    What does it consist of?

    p(px, py)

    `(`y)

    fixed

    not fixed

    q = (x, f(x))

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams7

    In the Direction of the Sweep Line

    Obviously the intersection of Vor(P ) and sweep line ` at thecurrent time point is not known yet.

    Instead, we store the part above ` that is already fixed!

    What does it consist of?

    p(px, py)

    `(`y)

    Enforcing the equality |pq| = |q`| gives

    f(x) =1

    2(py − `y)(x− px)2 +

    py + `y2

    fixed

    not fixed

    q = (x, f(x))

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams7

    In the Direction of the Sweep Line

    Obviously the intersection of Vor(P ) and sweep line ` at thecurrent time point is not known yet.

    Instead, we store the part above ` that is already fixed!

    What does it consist of?

    p(px, py)

    `(`y)

    Enforcing the equality |pq| = |q`| gives

    f(x) =1

    2(py − `y)(x− px)2 +

    py + `y2

    fixed

    not fixed

    q = (x, f(x))

    f `p(x) =

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams8

    The Beach Line

    Definition: The beach line β` is the lower envelope ofparabolas f `p for the points already found.

    The Beach Line

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams8

    The Beach Line

    Definition: The beach line β` is the lower envelope ofparabolas f `p for the points already found.

    β`

    The Beach Line

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams8

    The Beach Line

    Definition: The beach line β` is the lower envelope ofparabolas f `p for the points already found.

    β`

    What does it have to do with Vor(P )?

    The Beach Line

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams8

    The Beach Line

    Definition: The beach line β` is the lower envelope ofparabolas f `p for the points already found.

    β`

    What does it have to do with Vor(P )?

    Obs.: The beach line is x-monotoneIntersection points in the beach line lie on VoronoiedgesAs the sweep-line goes down, intersection pointsrun along Vor(P )

    The Beach Line

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams8

    The Beach Line

    Definition: The beach line β` is the lower envelope ofparabolas f `p for the points already found.

    β`

    What does it have to do with Vor(P )?

    Obs.: The beach line is x-monotoneIntersection points in the beach line lie on VoronoiedgesAs the sweep-line goes down, intersection pointsrun along Vor(P )

    The Beach Line

    Goal: Store (implicit) contour β` instead of Vor(P ) ∩ `

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams9

    Before we proceed...

    Demohttp://www.diku.dk/hjemmesider/studerende/duff/Fortune/

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams10

    Point Events

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams10

    Point Events

    If ` meets a point, then a new parabola is added to β`

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams10

    Point Events

    If ` meets a point, then a new parabola is added to β`

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams10

    Point Events

    If ` meets a point, then a new parabola is added to β`

    The two intersection points generate a new part of an edge.

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams10

    Point Events

    If ` meets a point, then a new parabola is added to β`

    The two intersection points generate a new part of an edge.

    Lemma 1: New arcs on β` only come from point events.

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams10

    Point Events

    If ` meets a point, then a new parabola is added to β`

    The two intersection points generate a new part of an edge.

    Lemma 1: New arcs on β` only come from point events.

    Corollary: β` is at most 2n− 1 parabolic arcs

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams10

    Point Events

    If ` meets a point, then a new parabola is added to β`

    The two intersection points generate a new part of an edge.

    Lemma 1: New arcs on β` only come from point events.

    Corollary: β` is at most 2n− 1 parabolic arcs

    More about this in exercises...

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams11

    Circle Events

    pi

    pj

    pk

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams11

    Circle Events

    A parabolic arc disappears from f `pi , f`pj , f

    `pk

    at a commonpoint q

    pi

    pj

    pk pi

    pj

    pk

    q

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams11

    Circle Events

    A parabolic arc disappears from f `pi , f`pj , f

    `pk

    at a commonpoint q

    pi

    pj

    pk pi

    pj

    pk

    q

    The circle CP (q) that touches pi, pj , pk and `⇒ q is a Voronoi vertex

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams11

    Circle Events

    A parabolic arc disappears from f `pi , f`pj , f

    `pk

    at a commonpoint q

    pi

    pj

    pk pi

    pj

    pk pi

    pj

    pk

    q

    The circle CP (q) that touches pi, pj , pk and `⇒ q is a Voronoi vertex

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams11

    Circle Events

    A parabolic arc disappears from f `pi , f`pj , f

    `pk

    at a commonpoint q

    pi

    pj

    pk pi

    pj

    pk pi

    pj

    pk

    q

    The circle CP (q) that touches pi, pj , pk and `⇒ q is a Voronoi vertex

    Def.: The lowest point of the circle defined by three pointsof consecutive arcs in β` defines a circle event.

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams11

    Circle Events

    A parabolic arc disappears from f `pi , f`pj , f

    `pk

    at a commonpoint q

    pi

    pj

    pk pi

    pj

    pk pi

    pj

    pk

    q

    The circle CP (q) that touches pi, pj , pk and `⇒ q is a Voronoi vertex

    Lemma 2: Arcs of β` only disappear through circle events.

    Def.: The lowest point of the circle defined by three pointsof consecutive arcs in β` defines a circle event.

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams11

    Circle Events

    A parabolic arc disappears from f `pi , f`pj , f

    `pk

    at a commonpoint q

    pi

    pj

    pk pi

    pj

    pk pi

    pj

    pk

    q

    The circle CP (q) that touches pi, pj , pk and `⇒ q is a Voronoi vertex

    Lemma 2: Arcs of β` only disappear through circle events.

    Def.: The lowest point of the circle defined by three pointsof consecutive arcs in β` defines a circle event.

    Lemma 3: For each Voronoi vertex there is a circle event.

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams12

    Data Structures

    Double-connected edge list (DCEL) D for Vor(P )Warning: Include a bounding box to avoid half-lines

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams12

    Data Structures

    Double-connected edge list (DCEL) D for Vor(P )Warning: Include a bounding box to avoid half-lines

    Balanced binary search tree T for implicit beach line– Leaves represent parabolic arcs from left to right– Interior nodes 〈pi, pj〉 represent intersection points of fpi and fpj– Pointers from interior nodes to the corresponding edges in D

    p1

    p2

    p3

    p4

    p5

    〈p4, p5〉

    〈p2, p3〉

    〈p1, p2〉 〈p3, p4〉

    〈p5, p4〉

    p1 p2 p3 p4

    p5 p4

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams12

    Data Structures

    Double-connected edge list (DCEL) D for Vor(P )Warning: Include a bounding box to avoid half-lines

    Balanced binary search tree T for implicit beach line– Leaves represent parabolic arcs from left to right– Interior nodes 〈pi, pj〉 represent intersection points of fpi and fpj– Pointers from interior nodes to the corresponding edges in D

    p1

    p2

    p3

    p4

    p5

    〈p4, p5〉

    〈p2, p3〉

    〈p1, p2〉 〈p3, p4〉

    〈p5, p4〉

    p1 p2 p3 p4

    p5 p4

    Priority queue Q for the point and circle events– Pointer from circle event to corresponding leaf in T and vice versa

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams13

    Fortune’s Sweep Algorithm

    VoronoiDiagram(P ⊂ R2)Q ← new PriorityQueue(P ) // Point events sorted by yT ← new BalancedBinarySearchTree() // sweep status (β)D ← new DCEL() // DS for Vor(P )while not Q.empty() do

    p← Q.ExtractMax()if p point event then

    HandlePointEvent(p)else

    α← arcs of β to be removedHandleCircleEvent(α)

    Handle interior remaining nodes of T (half-lines of Vor(P ))return D

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams13

    Fortune’s Sweep Algorithm

    VoronoiDiagram(P ⊂ R2)Q ← new PriorityQueue(P ) // Point events sorted by yT ← new BalancedBinarySearchTree() // sweep status (β)D ← new DCEL() // DS for Vor(P )while not Q.empty() do

    p← Q.ExtractMax()if p point event then

    HandlePointEvent(p)else

    α← arcs of β to be removedHandleCircleEvent(α)

    Handle interior remaining nodes of T (half-lines of Vor(P ))return D

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams14

    Handing Point Events

    HandlePointEvent(point p)

    p

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams14

    Handing Point Events

    HandlePointEvent(point p)

    Search in T for the arc α above p.If α has a pointer to a circle event in Q, remove it from Q.

    p

    α

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams14

    Handing Point Events

    HandlePointEvent(point p)

    Search in T for the arc α above p.If α has a pointer to a circle event in Q, remove it from Q.

    p

    α

    How?

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams14

    Handing Point Events

    HandlePointEvent(point p)

    Search in T for the arc α above p.If α has a pointer to a circle event in Q, remove it from Q.Split α into α0 and α2.Let α1 be a new arc for p.

    p

    α

    q

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams14

    Handing Point Events

    HandlePointEvent(point p)

    Search in T for the arc α above p.If α has a pointer to a circle event in Q, remove it from Q.Split α into α0 and α2.Let α1 be a new arc for p.

    q

    α

    p

    α

    q

    In T :

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams14

    Handing Point Events

    HandlePointEvent(point p)

    Search in T for the arc α above p.If α has a pointer to a circle event in Q, remove it from Q.Split α into α0 and α2.Let α1 be a new arc for p.

    q

    α

    p

    α

    q

    In T :

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams14

    Handing Point Events

    HandlePointEvent(point p)

    Search in T for the arc α above p.If α has a pointer to a circle event in Q, remove it from Q.Split α into α0 and α2.Let α1 be a new arc for p.

    q 〈q, p〉

    q 〈p, q〉

    p q

    α

    p

    α

    q

    α0 α1 α0

    α2α1

    In T :

    2

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams14

    Handing Point Events

    HandlePointEvent(point p)

    Search in T for the arc α above p.If α has a pointer to a circle event in Q, remove it from Q.Split α into α0 and α2.Let α1 be a new arc for p.

    q 〈q, p〉

    q 〈p, q〉

    p q

    α

    Intersection points

    p

    α

    q

    α0 α1 α0

    α2α1

    In T :

    2

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams14

    Handing Point Events

    HandlePointEvent(point p)

    Search in T for the arc α above p.If α has a pointer to a circle event in Q, remove it from Q.Split α into α0 and α2.Let α1 be a new arc for p.

    q 〈q, p〉

    q 〈p, q〉

    p q

    α

    Add edges 〈q, p〉 and 〈p, q〉 to D.

    Intersection points

    p

    α

    q

    α0 α1 α0

    α2α1

    In T :

    2

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams14

    Handing Point Events

    HandlePointEvent(point p)

    Search in T for the arc α above p.If α has a pointer to a circle event in Q, remove it from Q.Split α into α0 and α2.Let α1 be a new arc for p.

    q 〈q, p〉

    q 〈p, q〉

    p q

    α

    Add edges 〈q, p〉 and 〈p, q〉 to D.Check 〈pl, q, p〉 and 〈p, q, pr〉 for circle events.

    Intersection points

    p

    α

    q

    α0 α1 α0

    α2α1

    In T :

    2pl

    Neighbors of β

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams14

    Handing Point Events

    HandlePointEvent(point p)

    Search in T for the arc α above p.If α has a pointer to a circle event in Q, remove it from Q.Split α into α0 and α2.Let α1 be a new arc for p.

    q 〈q, p〉

    q 〈p, q〉

    p q

    α

    Add edges 〈q, p〉 and 〈p, q〉 to D.Check 〈pl, q, p〉 and 〈p, q, pr〉 for circle events.

    Intersection points

    p

    α

    q

    α0 α1 α0

    α2α1

    In T :

    2

    Running time?pl

    Neighbors of β

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams14

    Handing Point Events

    HandlePointEvent(point p)

    Search in T for the arc α above p.If α has a pointer to a circle event in Q, remove it from Q.Split α into α0 and α2.Let α1 be a new arc for p.

    q 〈q, p〉

    q 〈p, q〉

    p q

    α

    Add edges 〈q, p〉 and 〈p, q〉 to D.Check 〈pl, q, p〉 and 〈p, q, pr〉 for circle events.

    Intersection points

    p

    α

    q

    α0 α1 α0

    α2α1

    In T :

    2

    Running time?

    O(log n)

    pl

    Neighbors of β

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams15

    Handling Circle Events

    HandleCircleEvent(arc α)

    ααleft

    αrightp

    p′

    p′′

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams15

    Handling Circle Events

    HandleCircleEvent(arc α)

    T .delete(α); Update intersection points in T

    ααleft

    αrightp

    p′

    p′′

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams15

    Handling Circle Events

    HandleCircleEvent(arc α)

    T .delete(α); Update intersection points in TRemove all circle events with middle arc α from Q.

    ααleft

    αrightp

    p′

    p′′

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams15

    Handling Circle Events

    HandleCircleEvent(arc α)

    T .delete(α); Update intersection points in TRemove all circle events with middle arc α from Q.

    ααleft

    αrightp

    p′

    p′′

    falsealarms

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams15

    Handling Circle Events

    HandleCircleEvent(arc α)

    T .delete(α); Update intersection points in TRemove all circle events with middle arc α from Q.Add node V({p, p′, p′′}) and edges 〈p, p′′〉, 〈p′′, p〉 to D.

    ααleft

    αrightp

    p′

    p′′

    falsealarms

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams15

    Handling Circle Events

    HandleCircleEvent(arc α)

    T .delete(α); Update intersection points in TRemove all circle events with middle arc α from Q.Add node V({p, p′, p′′}) and edges 〈p, p′′〉, 〈p′′, p〉 to D.Add potential circle events 〈pl, p, p′′〉 and 〈p, p′′, pr〉 to Q.

    ααleft

    αrightp

    p′

    p′′

    Neighbors of β

    falsealarms

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams15

    Handling Circle Events

    HandleCircleEvent(arc α)

    T .delete(α); Update intersection points in TRemove all circle events with middle arc α from Q.Add node V({p, p′, p′′}) and edges 〈p, p′′〉, 〈p′′, p〉 to D.Add potential circle events 〈pl, p, p′′〉 and 〈p, p′′, pr〉 to Q.

    ααleft

    αrightp

    p′

    p′′Running time?

    Neighbors of β

    falsealarms

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams15

    Handling Circle Events

    HandleCircleEvent(arc α)

    T .delete(α); Update intersection points in TRemove all circle events with middle arc α from Q.Add node V({p, p′, p′′}) and edges 〈p, p′′〉, 〈p′′, p〉 to D.Add potential circle events 〈pl, p, p′′〉 and 〈p, p′′, pr〉 to Q.

    ααleft

    αrightp

    p′

    p′′Running time?

    O(log n)

    Neighbors of β

    falsealarms

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams16

    Fortune’s Sweep Algorithm

    Theorem 4: For a set P of n points, Fortune’s sweepalgorithm computes the Voronoi DiagramVor(P ) in O(n log n) time and O(n) space.

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams16

    Fortune’s Sweep Algorithm

    Theorem 4: For a set P of n points, Fortune’s sweepalgorithm computes the Voronoi DiagramVor(P ) in O(n log n) time and O(n) space.

    Proof sketch:Each event requires O(log n) timen point events≤ 2n− 5 circle events (= #nodes of Vor(P ))False alarms are deleted from Q before they are processed.

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams16

    Fortune’s Sweep Algorithm

    Theorem 4: For a set P of n points, Fortune’s sweepalgorithm computes the Voronoi DiagramVor(P ) in O(n log n) time and O(n) space.

    Proof sketch:Each event requires O(log n) timen point events≤ 2n− 5 circle events (= #nodes of Vor(P ))False alarms are deleted from Q before they are processed.

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams17

    Discussion

    Are there other variants of Voronoi diagrams?

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams17

    Discussion

    Are there other variants of Voronoi diagrams?

    Yes! For example, we can design an algorithm to compute the Voronoidiagram for line segments with the same running time and space.

    Other metrics like Lp or additive/multiplicativeweighted Voronoi diagrams are possible.

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams17

    Discussion

    Are there other variants of Voronoi diagrams?

    Yes! For example, we can design an algorithm to compute the Voronoidiagram for line segments with the same running time and space.

    Other metrics like Lp or additive/multiplicativeweighted Voronoi diagrams are possible.

    Voronoi diagrams for polygons define theso-called medial axis, (important in imageprocessing).

    Also farthest-point Voronoi diagrams arepossible.

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams17

    Discussion

    Are there other variants of Voronoi diagrams?

    Yes! For example, we can design an algorithm to compute the Voronoidiagram for line segments with the same running time and space.

    What happens in higher dimensions?

    Other metrics like Lp or additive/multiplicativeweighted Voronoi diagrams are possible.

    Voronoi diagrams for polygons define theso-called medial axis, (important in imageprocessing).

    Also farthest-point Voronoi diagrams arepossible.

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams17

    Discussion

    Are there other variants of Voronoi diagrams?

    Yes! For example, we can design an algorithm to compute the Voronoidiagram for line segments with the same running time and space.

    What happens in higher dimensions?

    The complexity of Vor(P ) increases to Θ(ndd/2e) and the running timeto O(n log n+ ndd/2e).

    Other metrics like Lp or additive/multiplicativeweighted Voronoi diagrams are possible.

    Voronoi diagrams for polygons define theso-called medial axis, (important in imageprocessing).

    Also farthest-point Voronoi diagrams arepossible.

  • Tamara Mchledidze · Darren Strash · Computational Geometry Voronoi-Diagrams18

    From Voronoi to Art...

    Geogebra

    The Post Office ProblemThe Voronoi DiagramPropertiesCharacterizationComputing $\vd(P)$In the Direction of the Sweep LineThe Beach LinePoint EventsCircle EventsData StructuresFortune's Sweep AlgorithmHanding Point EventsHandling Circle EventsFortune's Sweep AlgorithmDiscussion