motivation art gallery problem motivation art gallery
play

Motivation: Art gallery problem Motivation: Art gallery problem - PDF document

CG Lecture 3 CG Lecture 3 Motivation: Art gallery problem Motivation: Art gallery problem Definition : two points q and r in a Polygon decomposition simple polygon P can see each R other if the open segment qr lies entirely within P . p 1.


  1. CG Lecture 3 CG Lecture 3 Motivation: Art gallery problem Motivation: Art gallery problem Definition : two points q and r in a Polygon decomposition simple polygon P can see each R other if the open segment qr lies entirely within P . p 1. Polygon triangulation q • Triangulation theory A point p guards a region • Monotone polygon triangulation R ⊆ P if p sees all q ∈ R r 2. Polygon decomposition into monotone pieces Problem: Given a polygon P , what 3. Trapezoidal decomposition is the minimum number of guards required to guard P , and what are 4. Convex decomposition their locations? 5. Other results 1 2 Simple observations Simple observations Art gallery problem: upper bound Art gallery problem: upper bound • Convex polygon : all points • Theorem : Every simple planar are visible from all other polygon with n vertices has a points � only one guard in triangulation of size n -2 ( proof any location is necessary! later ). convex • Star-shaped polygon: all • n -2 guards suffice for an n -gon: points are visible from any • Subdivide the polygon into n –2 point in the kernel � only triangles (triangulation). one guard located in its • Place one guard in each triangle. star-shaped kernel is necessary. 3 4 Art gallery problem: lower bound Art gallery problem: lower bound Simple polygon triangulation Simple polygon triangulation • There exists a Input : a polygon P polygon with n described by an ordered vertices, for which sequence of vertices ⎣ n /3 ⎦ guards are < v 0 , …v n–1 >. necessary. Output : a partition of P into n –2 non-overlapping Can we improve the upper Can we improve the upper • Therefore, ⎣ n /3 ⎦ triangles and the bound? bound? guards are needed in adjacencies between Yes! In fact, at most ⎣ n /3 ⎦ Yes! In fact, at most the worst case. them. guards are necessary. guards are necessary. 5 6 1

  2. Ideas? Ideas? Simple polygon triangulation: observations Simple polygon triangulation: observations • The triangulation is not unique. One of them suffices. • The triangulation is always possible. • No new vertices are required. • The triangulation adds new edges, called diagonals , between existing vertices. Not all diagonals are valid! Not all diagonals are valid! 7 8 Triangulation theory Diagonals in polygons Diagonals in polygons Triangulation theory • A vertex is convex if its interior angle < π , Proof: let v be a convex vertex and let Case 1 Case 1 otherwise it is concave. a a a and b its adjacent vertices. Since P • A diagonal is a new edge between two polygon is a simple polygon and n >3, there is b b vertices that is entirely inside the polygon. no edge between a and b . v v Consider the following two cases: • Lemma 1 : every polygon has a convex vertex. 1. the new edge ab is a diagonal Proof: the highest vertex (the one with the Case 2 Case 2 a a L largest y coordinate) is convex. 2. Otherwise, there exists a vertex x L x x which is the closest to v with • Lemma 2 : Every polygon with n >3 vertices has b b respect to a line L parallel to ab a diagonal. v v which is a diagonal. 9 10 Triangulation theory Triangulation theory Triangulation dual Triangulation dual Theorem: Every simple polygon with Definition: The triangulation dual T of a triangulation of a simple n vertices has a triangulation with P P 1 polygon P is a graph whose nodes 1 n –3 diagonals and n –2 triangles. are triangles and whose edges are Proof: By induction on n : adjacencies between triangles sharing an edge. • Basis: A triangle ( n =3) has a Property: the triangulation dual is a triangulation (itself) with no v v tree whose node degree is ≤ 3. P 2 P diagonals and one triangle. 2 • Induction on n : Proof: Degree ≤ 3 by construction: no triangle has more than For an n -vertex polygon, construct a diagonal dividing the polygon • three neighbors. into two polygons P 1 and P 2 with n 1 and n 2 vertices such that n 1 + n 2 –2 = n . • No cycles: by contradiction. If it has a cycle, it is a Diagonals: ( n 1 –3)+( n 2 –3)+1 = ( n 1 + n 2 –2)–3 = n –3 polygon with a hole (not a simple polygon). Triangles: ( n 1 –2)+( n 2 –2) = ( n 1 + n 2 –2)–2 = n –2 • • If fact, T If fact, T is a binary tree with root degree one or two! is a binary tree with root degree one or two! 11 12 2

  3. Simple triangulation algorithm Simple triangulation algorithm Simple triangulation algorithm (1) Simple triangulation algorithm (1) v 1 v proc triangulate(P) Idea : Reduce the polygon by clipping a 1 v 2 v 2 if | P | ≤ 3 output(P) and return; triangle at each iteration. i  0; The clipped triangle will be formed by v 0 v while diagonal( v i ,v i+2 ) is not legal i ++; 0 three consecutive vertices output( v i ,v i+1 ,v i+2 ); ( v i ,v i+1 ,v i+2 ). The diagonal is ( v i ,v i+2 ). remove v i+1 from P; triangulate( P ); Test for validity : 1. The diagonal does not intersect other Complexity: n times n diagonal tests that take polygon edges. each O( n ) � O ( n 3 ). Sources of inefficiencies: 2. The diagonal must be inside the • repeated diagonal tests polygon ( test that diagonal is inside normal cone ). • diagonals are not sorted or ordered � Precompute diagonals in O ( n 2 ). 13 14 Triangulation algorithms O( n O( n log log n n ) )- -time triangulation algorithm time triangulation algorithm Triangulation algorithms • What is the lower bound? 1) Partition the polygon • O ( n 2 ) by precomputing diagonals into y -monotone pieces • Improve to O ( n log n ) by ordering them (see later). (“ תוינו טונומ תוכיתח ”). • Is less than O ( n log n ) possible? 2) Triangulate each y -monotone piece separately. 15 17 Monotone polygons: definition Monotone polygons: definition Property of monotone polygons Property of monotone polygons L • A simple polygon is called L Definition : a vertex v is an interior cusp iff it is a concave L L monotone with respect to a line L if vertex whose adjacent vertices are both at or above (at for any line L’ perpendicular to L or below) line L . the intersection of the polygon with v v L’ is connected. L L v v • A polygon is called monotone if Theorem : If a polygon P has no interior cusps with there exists any such line ℓ . respect to a line L , then it is monotone with respect to L . • A polygon that is monotone with Proof sketch : partition P into two chains connecting the respect to the x/y -axis is called x/y- top and bottom vertices. Assume one of them is not monotone. monotone with respect to L . Then P must contain an y -monotone but not Question: How can we check in O( n ) interior cusp above or below. x -monotone polygon time whether a polygon is y -monotone? 18 19 3

  4. Triangulating a Y- Triangulating a Y -monotone polygon monotone polygon Triangulating a y- -monotone polygon monotone polygon Triangulating a y • Continue sweeping while one • Sweep the polygon from top to bottom. left chain right chain chain contains only one edge, left chain right chain • Greedily triangulate anything possible above the while the other edge is concave . top top sweep line, and then forget about this region. • When a “convex edge” appears • When procesing a vertex v , the unhandled region in the concave chain (or a above it always has a simple structure: second edge appears in the other Two y -monotone (left and right) chains, each one), triangulate as much as containing at least one edge. If a chain consists of two possible using a “fan”. or more edges, it is reflex , and the other chain consists of a single edge whose bottom endpoint has not been • Time complexity: O( k ), where k handled yet. is the complexity of the polygon. bottom bottom • Each diagonal is added in O (1) time. 20 21 Monotone polygon triangulation Monotone polygon triangulation Stack operations on chains Stack operations on chains 22 23 Y- -monotone polygons monotone polygons Y Vertex classification Vertex classification Polygon vertices classification: • A start (resp., end ) vertex is a start vertex whose interior angle is less than π and its two neighboring vertices both lie merge below (resp., above) it. regular • A split (resp., merge ) vertex is a vertex whose interior angle is split greater than π and its two neighboring vertices both lie end below (resp., above) it. • All other vertices are regular . 24 25 4

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend