/
1/26/17 1/26/17

1/26/17 - PowerPoint Presentation

marina-yarberry
marina-yarberry . @marina-yarberry
Follow
366 views
Uploaded On 2017-06-28

1/26/17 - PPT Presentation

CMPS 31306130 Computational Geometry 1 CMPS 31306130 Computational Geometry Spring 2017 Triangulations and Guarding Art Galleries Carola Wenk 12617 CMPS 31306130 Computational Geometry ID: 564105

monotone polygon 6130 3130 polygon monotone 3130 6130 computational cmps geometry line vertex vertices time sweep simple edge chain

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "1/26/17" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1

1/26/17

CMPS 3130/6130 Computational Geometry

1

CMPS 3130/6130 Computational GeometrySpring 2017

Triangulations andGuarding Art GalleriesCarola WenkSlide2

1/26/17

CMPS 3130/6130 Computational Geometry

2

Guarding an Art Gallery

Problem:

Given the floor plan of an art gallery as a simple polygon P in the plane with n vertices. Place (a small number of) cameras/guards on vertices of P such that every point in P can be seen by some camera.

Region enclosed by simple polygonal chain that does not self-intersect.Slide3

1/26/17

CMPS 3130/6130 Computational Geometry

3

Guarding an Art Gallery

There are many different variations:

Guards on vertices only, or in the interior as wellGuard the interior or only the wallsStationary versus moving or rotating guardsFinding the minimum number of guards is NP-hard (Aggarwal ’84)First subtask: Bound the number of guards that are necessary to guard a polygon in the worst case.Slide4

1/26/17

CMPS 3130/6130 Computational Geometry

4

Guard Using TriangulationsDecompose the polygon into shapes that are easier to handle: trianglesA

triangulation of a polygon P is a decomposition of P into triangles whose vertices are vertices of P. In other words, a triangulation is a maximal set of non-crossing diagonals.

diagonalSlide5

1/26/17

CMPS 3130/6130 Computational Geometry

5

Guard Using TriangulationsA polygon can be triangulated in many different ways.Guard polygon by putting one camera in each triangle: Since the triangle is convex, its guard will guard the whole triangle.Slide6

1/26/17

CMPS 3130/6130 Computational Geometry

6

Triangulations of Simple PolygonsTheorem 1: Every simple polygon admits a triangulation, and any triangulation of a simple polygon with

n vertices consists of exactly n-2 triangles.

Proof: By induction.n=3:

n>3: Let

u be leftmost vertex, and v

and w adjacent to v

. If vw does not intersect boundary of

P: #triangles = 1 for new triangle +

(n-1)-2

for remaining polygon = n-2

u

w

v

PSlide7

1/26/17

CMPS 3130/6130 Computational Geometry

7

Triangulations of Simple PolygonsTheorem 1: Every simple polygon admits a triangulation, and any triangulation of a simple polygon with

n vertices consists of exactly n-2 triangles.

If vw intersects boundary of P: Let

u’

u be the the

vertex furthest to the left of vw

. Take uu’

as diagonal, which splits P

into P

1 and P

2.

#

triangles in P

=

#triangles in P

1

+ #triangles in P2 = #vertices in P1 – 2 + #vertices in

P2 - 2 = n + 2 - 4 = n-2

u

w

v

u’

P

P

1

P

2Slide8

1/26/17

CMPS 3130/6130 Computational Geometry

8

3-ColoringA 3-coloring of a graph is an assignment of one out of three colors to each vertex such that adjacent vertices have different colors.Slide9

1/26/17

CMPS 3130/6130 Computational Geometry

9

3-Coloring LemmaLemma: For every triangulated polgon there is a 3-coloring.

Proof:

Consider the dual graph of the triangulation:vertex for each triangleedge for each edge between trianglesSlide10

1/26/17

CMPS 3130/6130 Computational Geometry

10

3-Coloring LemmaLemma: For every triangulated polgon there is a 3-coloring.

The dual graph is a tree (connected acyclic graph): Removing an edge corresponds to removing a diagonal in the polygon which disconnects the polygon and with that the graph.Slide11

1/26/17

CMPS 3130/6130 Computational Geometry

11

3-Coloring LemmaLemma: For every triangulated polgon there is a 3-coloring.

Traverse the tree (DFS). Start with a triangle and give different colors to vertices. When proceeding from one triangle to the next, two vertices have known colors, which determines the color of the next vertex.Slide12

1/26/17

CMPS 3130/6130 Computational Geometry

12

Art Gallery TheoremTheorem 2: For any simple polygon with

n vertices guards are sufficient to guard the whole polygon. There are polygons for which guards are necessary.

n3

n

3

Proof:

For the upper bound, 3-color any triangulation of the polygon and take the color with the minimum number of guards.

Lower bound:

n

3

spikes

Need one guard per spike.Slide13

1/26/17

CMPS 3130/6130 Computational Geometry

13

Triangulating a PolygonThere is a simple

O(n2

) time algorithm based on the proof of Theorem 1.There is a very complicated O(n) time algorithm (Chazelle ’91) which is impractical to implement.We will discuss a practical O(n log n) time algorithm:Split polygon into

monotone polygons (

O(n

log n)

time)

Triangulate each monotone polygon (O(n

) time)Slide14

1/26/17

CMPS 3130/6130 Computational Geometry

14

Monotone PolygonsA simple polygon P

is called monotone with respect to a line l iff for every line l’ perpendicular to l the intersection of

P with l’ is connected.P is x-monotone iff l = x-axisP is y-monotone iff l = y-axis

l’

l

x-monotone

(monotone w.r.t

l

)Slide15

1/26/17

CMPS 3130/6130 Computational Geometry

15

Monotone PolygonsA simple polygon P

is called monotone with respect to a line l iff for every line l’ perpendicular to l the intersection of

P with l’ is connected.P is x-monotone iff l = x-axisP is y-monotone iff l = y-axis

l’

l

NOT x-monotone

(NOT monotone w.r.t

l

)Slide16

1/26/17

CMPS 3130/6130 Computational Geometry

16

Monotone PolygonsA simple polygon P

is called monotone with respect to a line l iff for every line l’ perpendicular to l the intersection of

P with l’ is connected.P is x-monotone iff l = x-axisP is y-monotone iff l = y-axis

l

NOT monotone w.r.t any line

l

l’Slide17

1/26/17

CMPS 3130/6130 Computational Geometry

17

Test Monotonicity

How to test if a polygon is x-monotone?Find leftmost and rightmost vertices,

O(n) time→ Splits polygon boundary in upper chain and lower chainWalk from left to right along each chain, checking that x-coordinates are non-decreasing. O(n) time.Slide18

1/26/17

CMPS 3130/6130 Computational Geometry

18

Triangulating a Polygon

There is a simple

O(n2) time algorithm based on the proof of Theorem 1.There is a very complicated

O(n

) time algorithm (Chazelle ’91) which is impractical to implement.

We will discuss a practical O(

n log

n) time algorithm:

Split polygon into

monotone polygons (O(

n log

n)

time)Triangulate each monotone polygon (

O(n

) time)Slide19

1/26/17

CMPS 3130/6130 Computational Geometry

19

Triangulate an l-Monotone Polygon

Using a greedy plane sweep in direction lSort vertices by increasing

x-coordinate (merging the upper and lower chains in O(n) time)Greedy: Triangulate everything you can to the left of the sweep line.

1

2

3

4

l

5

6

7

8

9

10

11

12

13Slide20

1/26/17

CMPS 3130/6130 Computational Geometry

20

Triangulate an

l

-Monotone Polygon

Store stack (sweep line status) that contains vertices that have been encountered but may need more diagonals.

Maintain invariant:

Un-triangulated region has a

funnel shape

. The funnel consists of an upper and a lower chain. One chain is one line segment. The other is a

reflex chain

(interior angles >180°) which is stored on the stack.

Update, case 1: new vertex lies on chain opposite of reflex chain. Triangulate.Slide21

1/26/17

CMPS 3130/6130 Computational Geometry

21

Triangulate an

l

-Monotone Polygon

Update, case 2: new vertex lies on reflex chain

Case a: The new vertex lies above line through previous two vertices: Triangulate.

Case b: The new vertex lies below line through previous two vertices: Add to reflex chain (stack).Slide22

1/26/17

CMPS 3130/6130 Computational Geometry

22

Triangulate an l-Monotone Polygon

Distinguish cases in constant time using half-plane tests

Sweep line hits every vertex once, therefore each vertex is pushed on the stack at most once.Every vertex can be popped from the stack (in order to form a new triangle) at most once. Constant time per vertex O(

n)

total runtimeSlide23

1/26/17

CMPS 3130/6130 Computational Geometry

23

Triangulating a Polygon

There is a simple

O(n2) time algorithm based on the proof of Theorem 1.There is a very complicated

O(n

) time algorithm (Chazelle ’91) which is impractical to implement.

We will discuss a practical O(

n log

n) time algorithm:

Split polygon into

monotone polygons (O(

n log

n)

time)Triangulate each monotone polygon (

O(n

) time)Slide24

1/26/17

CMPS 3130/6130 Computational Geometry

24

Finding a Monotone SubdivisionMonotone subdivision: subdivision of the simple polygon

P into monotone piecesUse plane sweep to add diagonals to P that partition P into monotone piecesEvents at which violation of x-monotonicity occurs:

split vertex

merge vertex

interiorSlide25

1/26/17

CMPS 3130/6130 Computational Geometry

25

Helpers (for split vertices)

helper(

e

):

Rightmost vertically visible vertex below e on the polygonal chain (left of sweep line) between

e and e’, where e’

is the polygon edge below e on the sweep line.Draw diagonal between

v and helper(e), where

e is the edge immediately above v.

split vertex

v

u

= helper(

e

)

v

u

e

e’Slide26

1/26/17

CMPS 3130/6130 Computational Geometry

26

Sweep Line Algorithm

Events:

Vertices of polygon, sorted in increasing order by x-coordinate. (No new events will be added)Sweep line status:

Balanced binary search tree storing the list of edges intersecting sweep line, sorted by y-coordinate. Also, helper(e) for every edge intersecting sweep line.

Event processing of vertex v:Split vertex:

Find edge e lying immediately above v

.Add diagonal connecting v to helper(e

). Add two edges incident to v to sweep line status.

Make v helper of e and of the lower of the two edges

e

vSlide27

1/26/17

CMPS 3130/6130 Computational Geometry

27

Sweep Line Algorithm

Event processing of vertex

v

(continued):

Merge vertex:

Delete two edges incident to

v

.

Find edge

e

immediately above

v

and set helper(

e

)=

v

.

Start vertex:Add two edges incident to v to sweep line status.

Set helper of upper edge to v.End vertex: Delete both edges from sweep line status.Upper chain vertex:Replace left edge with right edge in sweep line status.Make v helper of new edge.Lower chain vertex:Replace left edge with right edge in sweep line status.Make v helper of the edge lying above v.

e

v

v

v

v

vSlide28

1/26/17

CMPS 3130/6130 Computational Geometry

28

Sweep Line AlgorithmInsert diagonals for merge vertices with “reverse” sweep

Each update takes O(log n) timeThere are n events

→ Runtime to compute a monotone subdivision is O(n log n)

Related Contents


Next Show more