Presentation is loading. Please wait.

Presentation is loading. Please wait.

3. Polygon Triangulation

Similar presentations


Presentation on theme: "3. Polygon Triangulation"— Presentation transcript:

1 3. Polygon Triangulation
Iwama lab M1 Naoki Hatta

2 How to minimize # of cameras….
Introduction We consider about the security in the art gallery Owner wants to minimize the number of cameras How to minimize # of cameras….

3 preliminary simple polygon We consider about only simple polygons.
regions enclosed by a single closed polygonal chain that does not intersect itself a simple polygon NOT a simple polygon We consider about only simple polygons.

4 example A convex polygon can always be guarded with one camera.
Finding the minimum number of cameras for a given polygon is NP-hard For any simple polygon with n vertices, we will give a worst-case bound. convex polygon 1 camera 3 camera

5 Triangulation A simple polygon may be a complicated shape.
So, we decompose it into triangles. Drawing diagonals between pairs of vertices without intersecting. Many different ways of triangulation exist.

6 Theorem 3.1 Every simple polygon admits a triangulation, and any triangulation of a simple polygon with n vertices consists of exactly n-2 triangles. n=5 T= 3 n=19 T= 17

7 Proof We prove this by induction. case n=3 Clearly, 1 triangle exists.
n=19 T= 17 We prove this by induction. case n=3 Clearly, 1 triangle exists. case n=m (m<n) We assume that the theorem is true. case n=n Any diagonal cuts P into 2 simple subpolygons(P1,P2). Let m1 and m2 be # of vertices of P1 and P2. Total vertices increase 2 by cutting, thus m1 + m2 = n + 2. However, # of triangles do not change, so (m1 - 2)+(m2 - 2)= n-2 triangles. decompose n=16 T= 14 n=5 T= 3

8 Does a diagonal always exist?
v u Choose one vertex (v) and connect two neighbors(w, u), we get a diagonal wu. If there are vertices inside △vuw, wu is not a diagonal, but vv’ cannot intersect an edge of a polygon, so vv’ is a diagonal . w v u v’ In conclusion, a diagonal always exists. v’: the vertex farthest from uw

9 By the way, how many cameras are needed?
on each triangle on well-chosen diagonals on well-chosen vetices n=19 T= 17 17 cameras 9 cameras 6 cameras n-2 roughly n/2 roughly n/3

10 Therorem 3.2 For a simple polygon with n vertices, cameras are occasionally necessary and always sufficient to have every point in the polygon visible from at least one of the cameras. 3-Coloring The coloring will be such that any two vertices connected by an edge or a diagonal have different colors. any triangles have each 3 color vertices Set cameras on one color vertices, all triangles are covered. Thus, cameras are sufficient.

11 Does 3-coloring always exist?
Consider about dual graph. The edge of dual graph corresponds to a diagonal of the original graph. Dual graph is a tree. Coloring algorithm Step 1: Choose one vertex on dual graph and color the three vertices of the triangle. Step 2: Depth first search (O(n) time) Step 3: color the remining vertex on the next triangle without same colored vertex. Step 4: Go to step2

12 Is this limit? needles and n vertices Look at this example.
・・・ An instance which needs cameras to cover exists. Thus, the worst case bound is and it is optimal. cameras are needed.

13 ? How to triangulation?? We notice that cameras is sufficient,
but how to triangulation actually? And how long does it take to compute this? 3-coloring INPUT OUTPUT ? doubly connected edge list triangulated list

14 ? Trivial algorithm In worst case computation time is O(n^2)
n vertices 1 vertex + n-1 vertices O(n) In worst case computation time is O(n^2)

15 Outline of efficient algorithms
? Make Monotone Algorithm Triangulation Algorithm O(nlogn) O(n)

16 Monotone y–monotone : A simple polygon is y-monotone if for any line perpendicular to y-axis the intersection of the polygon with the line is connected. y-monotone NOT y-monotone

17 Make Monotone Algorithm
INPUT: A simple polygon OUTPUT: Some simple polygons which are y-monotone We distinguish five types of vertices. start vertex : ① and ③ end vertex : ① and ④ regular vertex : else split vertex : ② and ③ merge vertex : ② and ④ ① interior angle is less than π ② interior angle is greater than π ③ neighbors lie below ④ neighbors lie above ※if two vertices have same y-coordinate, let the left one be the “above” vertex.

18 Lemma 3.4 A polygon is y-monotone if it has no split vertices or merge vertices. Proof Suppose a polygon is not y-monotone, scan edges from p(second vertex from most left), then have to meet a split or merge vertex, until reaching the next intersection. split vertex q p r q p r merge vertex

19 detail of algorithm Step1 : Sort vertices by y-coordinate and
By Lemma3.4, we should remove a split and merge vertices. sweep line v5 e4 v3 v6 e3 Find diagonals to decompose a polygon into y-monotone polygons without such vertices. v4 e2 v7 v9 e1 v1 v2 v8 Step1 : Sort vertices by y-coordinate and set event queue Step2 : Check type of each vertices by neighbors Step3 : Plane sweep algorithm using the queue Step4 : At a vertex, work the algorithm which corresponds to type of it v14 v10 v15 v11 v12 v13 event queue v5 v3 v4 v6 start merge regular

20 definition of helper helper(ej) : The lowest vertex above the sweep line such that the horizontal segment connecting the vertex to ej lies inside a polygon. sweep line v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11 v12 v13 v14 v15 e1 e2 e3 e4 1 3 1 helper(e3) = v3 helper(e5) = v5 helper(e7) = v2 helper(e9) = v8 2 2 helper(e3) = v3 helper(e5) = v4 3 When sweep line is on a split or merge vertex, if we connect the vertex to helper(ek) (ek is the left edge of it), the line is a good diagonal.

21 work like this We use a binary search tree in order to save the way to the edges against vertices v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11 v12 v13 v14 v15 e1 e2 e3 e4 1 binary search tree 1 helper(e5) = v5 2 helper(e3) = v3 3 2 helper(e5) = v4 4 helper(e3) = v3 5 7 5 6 3 3 Get a diagonal !! helper(e6) = v6 helper(e3) = v3 9 7 3 1 4 ……

22 Computation time Computation time is O(nlogn) Preprocessing :
binary search tree Preprocessing : Sorting in O(nlogn) time At one event search in O(logn) time insert and delete in O(1) time n vertices 9 7 3 1 Computation time is O(nlogn)

23 Triangulation Algorithm
INPUT: A y-monotone polygon OUTPUT: Some triangles Scan the vertices from above, and cut out the triagnles using a stack. v1 v2 v3 v4 v5 v12 v11 v10 v9 v8 v7 v6 Step 1 : Search a vertex and check the stacked vertices If we get three vertices then If the triangle is outer of the polygon, then stack the vertices. else add a diagonal as much as possible Step 2 : Goto step 1

24 Work like this v1 v2 v3 v4 v5 v12 v11 v10 v9 v8 v7 v6 stack v8 v9 v10

25 Computation time Computation time is O(n) Vertices are already sorted
At one vertex push happens at most twice pop happens at most 2n times Computation time is O(n)

26

27 algorithm of each type start vertex(vi) : Insert ei in T and set helper(ei) to vi end vertex(vi) : Insert ei in T and set helper(ei) to vi v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11 v12 v13 v14 v15 e1 e2 e3 e4


Download ppt "3. Polygon Triangulation"

Similar presentations


Ads by Google