c-top05

Upload: abhiraj1234

Post on 14-Apr-2018

226 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/27/2019 c-top05

    1/2

    Convex Hull Algorithms. Voronoi Diagram.

    Roman Durikovic (323-B, [email protected], http://www.u-aizu.ac.jp/ roman)

    Convex Hull

    A convex combination of points p1

    : : : pn

    is

    f

    1

    p1

    + +

    n

    pn

    :

    k

    0

    1

    + +

    n

    = 1 g

    For example, a triangle consists of all convex combinations of itsfour vertices.

    The convex hull of a set of pointsP

    is the set of all convexcombinations of points of

    P

    .Computing the convex hull of a set of points in two or more di-

    mensions in one of the basic problems in computational geometry.Below we consider several popular convex hull algorithms.

    2D Gift Wrapping. A set ofn

    points on the plane is given.

    Find the lowest point p0

    (smallest y-coordinate)repeat

    find pk + 1

    such that all points lie to the left of pk

    pk + 1

    by scanning through all the pointsuntil p

    k + 1

    = p0

    .

    If the number of sides of the hull ish

    then the complexity of thealgorithm is

    n h

    .

    Graham Scan. A set ofn

    points on the plane is given.

    1. Find rightmost lowest point p0

    2. Shift the origin of coordinates to p 0 and sort all otherpoints according to their polar angles. If two pointshave the same polar angle, the point closest to p

    0

    goesfirst.

    3. Build the hull, by marching around all the points,adding edges when a left turn is made, and back-tracking when a right turn is made (use stack to doback-tracking).

    The most expensive part of the Graham scan algorithm is sorting.So the the complexity of the algorithm is

    O ( n l o g n )

    .

    Divide-and-Conquer. A set ofn

    points on the plane is given.The divide-and-conquer algorithm consists of the following steps

    1. Sort the points byx

    coordinate.

    2. Divide the points into two setsA

    andB

    , whereA

    contains theleft

    d n = 2 e

    points andB

    contains the rightb n = 2 c

    points.

    3. Compute the convex hulls of the setsA

    andB

    .

    4. Merge the convex hulls ofA

    andB

    into the convex hull of

    A B

    .

    The merging step consists of finding the lower and upper tangentsof the convex hulls of

    A

    andB

    . The algorithm to compute the lowertangent is given below.

    Enumerate the vertices of the convex hulls ofA

    andB

    inthe counter-clockwise order starting from the lowest points.a

    rightmost point ofA

    .b

    leftmost point ofA

    .while

    T = a b

    is not lower tangent to bothA

    andB

    dowhile

    T

    is not lower tangent toA

    doa a ; 1

    whileT

    is not lower tangent toB

    dob b + 1

    0

    1

    2

    3

    4

    56

    7

    8

    0

    1

    2

    3

    4

    5

    6

    7

    A

    B

    uppertangent

    lowe

    rtan

    gent

    The the algorithm complexity isO ( n l o g n )

    .

    Incremental Algorithm. It is easy to invent an incremental al-gorithm to construct the convex hull of a set of points.

    Consider a convex hull (polygon) whose vertices p1

    : : :

    pn

    arecounted in the counter-clockwise direction and a new point q. Ifthe new point q is inside the hull there is nothing to do. Otherwise,let us delete all the edges that the new point can see. Add two edgesto connect the new point to the remainder of the old hull.

    0

    1

    2

    3

    4

    56

    7

    8

    q

    p

    An edgep

    k

    p

    k + 1

    is seen from q if the signed area of the triangleq p

    k

    pk + 1

    is negative. If pk

    = ( x

    k

    y

    k

    )

    , pk + 1

    = ( x

    k + 1

    y

    k + 1

    )

    ,and q = ( x

    0

    y

    0

    )

    then the signed area of the triangle q pk

    pk + 1

    is

    given by

    A =

    1

    2

    x

    0

    y

    0

    1

    x

    k

    y

    k

    1

    x

    k + 1

    y

    k + 1

    1

  • 7/27/2019 c-top05

    2/2

    2

    Voronoi Diagram

    Given a set of points on the plane, the Voronoi diagram of the setis a partition of the plane into cells (Voronoi cells), each of whichconsists of the points closer to one particular point of the set than toany others.

    More precisely, letP = f p

    1

    p2

    : : : pn

    g

    be a set of pointson the plane. The points are called the sites. The Voronoi regionV ( p

    i

    )

    of a site pi

    is the set of all points on the plane that are closerto p

    i

    than they are to any other site:

    V ( pi

    ) = f x : j x ; pi

    j j x ; pj

    j

    for anyj 6= i g

    The set of all points that have more than one nearest site form theVoronoi diagram for the set of sites P .

    The edges of the Voronoi regions are called Voronoi edges, andthe vertices are called Voronoi vertices. Note that a point on the in-terior of a Voronoi edge has two nearest sites, and a Voronoi vertexhas at least three nearest sites.

    The Voronoi diagram possesses several interesting properties:

    V1. Each Voronoi region V ( pi

    )

    is convex.

    V2. V ( pi

    )

    is unbounded if and only if pi

    lies on the convex hullof

    P

    .

    V3. If v is a Voronoi vertex at the junction ofV (

    p1

    )

    ,V (

    p2

    )

    , andV ( p

    3

    )

    , thenv

    is the center of the circleC ( v) determined by

    p1

    , p2

    , and p3

    . The interior ofC ( v ) contains no sites.

    Problems

    1. An affine combination of points f p1

    p2

    : : : pn

    g

    on theplane is a sum of the form

    f

    1

    p1

    + +

    n

    pn

    :

    1

    + +

    n

    = 1 g

    This differs from the definition of a convex combination inthat the conditions

    k

    0

    is dropped. Find the affine com-bination of two given points. Find the affine combination ofthree collinear points. Find the affine combination of threenon-collinear points.

    2. Propose anO ( n )

    algorithm to compute the convex hall of anon-convex polygon given by the list vertices enumerated inthe counter clockwise direction.

    3. Describe the Voronoi diagram for the set of points consistingof vertices of a regular polygon plus one point at the center ofthe polygon.

    4. Prove that forn 3

    the number of vertices in the Voronoidiagram of a set of

    n

    sitesP

    on the plane is at most2 n ; 5

    and the number of edges is at most3 n ; 6

    .

    HIN T: Prove the statement using Eulers formula. Since Eu-lers formula cannot be applied directly toV o r ( P )

    , becauseV o r ( P )

    has infinite edges, add one extra vertex v1

    at infin-ity to the set of sites

    P

    and connect all half-infinite edges of

    V o r ( P )

    to v1

    . Apply Eulers formula to the obtained graph.

    v8 v

    1p

    1

    p

    p

    2

    3