Folie 1 - Electures

Download Report

Transcript Folie 1 - Electures

Art Gallery Theorem

Computational Geometry, WS 2006/07 Lecture 8, Part 1

Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät für Angewandte Wissenschaften Albert-Ludwigs-Universität Freiburg

Agenda

• Motivation: Guarding art galleries • Art gallery theorem for simple polygons • Partitioning of polygons into monotone pieces • Triangulation of y-monotone polygons

Computational Geometry, WS 2006/07 Prof. Dr. Thomas Ottmann

2

Guarding art galleries

Problem Definition

Imagine an art gallery room whose floor plan can be modeled by a polygon of

n

vertices. Victor Klee asked (1973): How many stationary guards are needed to guard the room?

Computational Geometry, WS 2006/07 Prof. Dr. Thomas Ottmann

3

Guarding art galleries

 The gallery is represented by a simple polygon   A guard is represented by a point within the polygon Guards have a viewport of 360 °, and of course cannot see  through a wall A polygon is completely guarded, if every point within the polygon is guarded by at least one of the watchmen

Visibility polygon:

The visibility polygon of a polygon

P

that are visible from a base point

p

.

is defined by the set of all points Demo

Computational Geometry, WS 2006/07 Prof. Dr. Thomas Ottmann

4

Guarding art galleries

Even if two polygons have the same number of vertices, one may be easier to guard than the other.

We are NOT interested in the minimum number of guards for a

specific

polygon, but rather want to determine the number of guards that suffice for an

arbitrary

polygon with

n

vertices.

Computational Geometry, WS 2006/07 Prof. Dr. Thomas Ottmann

5

Guarding art galleries

If the polygon is complex, it is not obvious to see how many gurads are needed.

Idea

: Divide the polygon into pieces that are easy to guard

Computational Geometry, WS 2006/07 Prof. Dr. Thomas Ottmann

6

Guarding a triangulated polygon

Computational Geometry, WS 2006/07 Prof. Dr. Thomas Ottmann

7

Triangulation of simple polygons

Does every simple polygon admit a triangulation?

If yes, what is the number of triangles?

Does any triangulation of a polygon

P

lead to the same number of triangles?

Computational Geometry, WS 2006/07 Prof. Dr. Thomas Ottmann

8

Theorem

Theorem: Every simple polygon admits a triangulation.

Proof: By induction on

n

. Let

n>3

, and assume theorem is true for all

m

. Let

P

be polygon with

n

vertices. We first prove the existence of a diagonal in

P

. Let v be leftmost vertex of P. Let u and v be two neighboring vertices of v.

If uw lies in the interior of P we have found a diagonal. Else, there are one or more vertices inside the triangle defined by u, v, and w. Let v ´ be the farthest vertex from uw. The segment connecting v ´ to v cannot intersect an edge of p (contradicts the definition of v ´). Hence vv´ is a diagonal.

Computational Geometry, WS 2006/07 Prof. Dr. Thomas Ottmann

9

Proof of Diagonal

Case 1: Consider leftmost vertex v of P uw completely in P Case 2: uw not completely in P w w v u v u

Computational Geometry, WS 2006/07 Prof. Dr. Thomas Ottmann

10

Diagonals and Triangulation

So a diagonal exists. Any diagonal cuts P in two simple sub-polygons

P1

and

P2

. Let

m1

be the number of vertices of

P1

and

m2

the number of vertices of

P2

. Both

m1

and

m2

must be smaller than

n

, so by induction hypothesis

P1

and

P2

can be triangulated so

P

can be triangulated as well. Back to the questions Does any triangulation of a polygon

P

lead to the same number of triangles?

If yes, what is the number of triangles?

Computational Geometry, WS 2006/07 Prof. Dr. Thomas Ottmann

11

Theorem

Theorem : Any triangulation of P contains

n-2

triangles.

Proof : By induction on

n

.

n=3

trivial. Let

n>3

, and assume theorem is true for all

m

.

Consider an arbitrary diagonal in some triangulation This diagonal cuts

m 1 + m 2 T p

.

P

into

2

subpolygons with

m 1

and

m 2

vertices:

= n + 2

. So by induction hypothesis any triangulation of

P i

 contains

m i - 2

triangles

(m 1 - 2) + (m 2 - 2) = n - 2

triangles.

Computational Geometry, WS 2006/07 Prof. Dr. Thomas Ottmann

12

Upper and lower bounds for the number of guards

We know that for any simple polygon with

n

always enough. vertices

n-2

guards are But can we do better?

Computational Geometry, WS 2006/07 Prof. Dr. Thomas Ottmann

13

Upper and lower bounds for the number of guards

Idea: Compute a 3-coloring of the vertices and place guards on nodes with the least-frequently used color. No two nodes connected by an edge are assigned the same color.

-> Every triangle has all 3 colors. Hence every triangle is watched. Hence the entire polygon is watched.

Computational Geometry, WS 2006/07 Prof. Dr. Thomas Ottmann

14

Example

Computational Geometry, WS 2006/07 Prof. Dr. Thomas Ottmann

15

3- coloring

b Theorem: The triangulation graph of a polygon

P

is

3

-colorable.

Proof: Induction on

n

. Clearly, a triangle can be

3

-colored. Let

n>3

, and assume theorem is true for all

m

Meister’s Two Ears Theorem

,

P

has an ear By

abc

.

a c Corollary:  n/3  guards are always sufficient to guard a simple Polygon with

n

vertices.

Computational Geometry, WS 2006/07 Prof. Dr. Thomas Ottmann

16

Art gallery theorem

For a simple polygon with

n

vertices,  n/3  cameras are occasionally necessary and always sufficient to have every point in the polygon visible from at least one of the cameras.

Worst-case example?

Computational Geometry, WS 2006/07 Prof. Dr. Thomas Ottmann

17

Worst-case example

Demo

Computational Geometry, WS 2006/07 Prof. Dr. Thomas Ottmann

18