Presentation is loading. Please wait.

Presentation is loading. Please wait.

4-3~4-5 03366045 鄭力瑋. concave polygon:convex polygon: Convex polygons 「凸」的定義是:圖形內任意兩點的連線不會經過圖形外部。

Similar presentations


Presentation on theme: "4-3~4-5 03366045 鄭力瑋. concave polygon:convex polygon: Convex polygons 「凸」的定義是:圖形內任意兩點的連線不會經過圖形外部。"— Presentation transcript:

1 4-3~4-5 03366045 鄭力瑋

2 concave polygon:convex polygon: Convex polygons 「凸」的定義是:圖形內任意兩點的連線不會經過圖形外部。

3 Convex hull The convex hull of a set of planar points is defined as the smallest convex polygon containing all the points

4 The Graham scan Graham's Scan 嘗試先將所有點依照角度排序排好,再來做繞行一圈的動 作,繞行途中順便掃除凸包內部的點

5 The Graham scan https://www.youtube.com/watch?v=BTgjXwhoMuI

6 Divide-and-Conquer for Convex Hull Input : A set S of planar points Output : A convex hull for S Step 1: If S contains no more than three points, use exhaustive searching to find the convex hull and return. Step 2: Find a median line perpendicular to the X-axis which divides S into S L and S R, with equal sizes. Step 3: Recursively construct convex hulls for S L and S R, denoted as Hull(S L ) and Hull(S R ), respectively. Step 4: Apply the merging procedure to merge Hull(S L ) and Hull(S R ) together to form a convex hull.

7 The divide-and-conquer strategy to solve the problem: 找小於 π/2 最大的 找大於 3π/2 最小的

8 The merging procedure: 1.Select an interior point p. 2.There are 3 sequences of points which have increasing polar angles with respect to p. (1) g, h, i, j, k (2) a, b, c, d (3) f, e 3.Merge these 3 sequences into 1 sequence: g, h, a, b, f, c, e, d, i, j, k. 4.Apply Graham scan to examine the points one by one and eliminate the points which cause reflexive angles.

9 Final result: e.g. points b and f need to be deleted.

10 Time complexity O(n) for split O(n) for merge O(n) for scan T(n) = 2T(n/2) + O(n) = O(n log n)

11 原式 -- T(n)=2T(n/2)+O(n) 把原式的 n 用 n/2 帶入, 得 第二式 -- T(n/2)=2T(n/4)+O(n/2). 把第二式帶入原式中的 T(n/2), 得 T(n)=2(2T(n/4)+O(n/2))+O(n). 接下來類似, 上式中的 T(n/4), 可用 T(n/4)=2T(n/8)+O(n/4) 帶入, 得 T(n)=2(2(2T(n/8)+O(n/4))+O(n/2))+O(n), 即 T(n)=(2^3)T(n/8)+[3*O(n)]. 再一直類似的迭帶, 直到 ( 設 n=2^k) T(n)=(2^k)T(n/n)+[k*O(n)] 因為 T(1)=0, 所以 T(n)=kO(n)=(logn)O(n)=O(nlogn)

12 Voronoi diagram for two points To find the nearest neighbors of points in the plane L P1P2

13 Voronoi diagram for three points P1 P2 P3

14 Definition of Voronoi Diagrams Pi Pj

15 The vertices of the Voronoi diagram are called Voronoi points and its segments are called Voronoi edges. Voronoi points Voronoi edges P1 P2 P3 P4 P5 P6

16 Delaunay Triangulation

17 Divide-and-Conquer for Voronoi Diagram Input: A set S of n planar points. Output: The Voronoi diagram of S. Step 1: If S contains only one point, return. Step 2: Find a median line L perpendicular to the X-axis which divides S into S L and S R, with equal sizes. Step 3: Construct Voronoi diagrams of S L and S R recursively. Denote these Voronoi diagrams by VD(S L ) and VD(S R ). Step 4: Construct a dividing piece-wise linear hyperplane HP which is the locus of points simultaneously closest to a point in S L and a point in S R. Discard all segments of VD(S L ) which lie to the right of HP and all segments of VD(S R ) that lie to the left of HP. The resulting graph is the Voronoi diagram of S.

18 Step 1

19 Step 2

20

21

22 Step3 VD(S R ) VD(S L )

23 Step4

24 Merging Two Voronoi Diagrams into One Voronoi Diagram

25

26 P2 P3P1P4P5P6P7P11P10 P9 P8 P13P12 Merging Two Voronoi Diagrams

27 The Final Voronoi Diagram P2 P3 P1 P4 P5 P6 P7 P11 P10 P9 P8 P13 P12

28 Time complexity Time complexity for merging 2 Voronoi diagrams: Total: O(n) – Step 1: O(n) – Step 2: O(n) – Step 3 ~ Step 5: O(n) (at most 3n - 6 edges in VD(S L ) and VD(S R ) and at most n segments in HP) Time complexity for constructing a Voronoi diagram: O(n log n) because T(n) = 2T(n/2) + O(n)=O(n log n)

29 The Lower Bound of the Voronoi Diagram Problem The lower bound of the Voronoi diagram problem is  (n log n). sorting  Voronoi diagram problem The Voronoi diagram for a set of points on a straight line

30 Applications of the Voronoi diagrams The Euclidean nearest neighbor searching problem. O(log n) with O(n log n) preprocessing The Euclidean all nearest neighbor problem. O(n) with O(n log n) preprocessing

31 Dynamic Voronoi Diagram https://www.youtube.com/watch?v=VXfQgc7VzzQ

32 Thank you for your listening


Download ppt "4-3~4-5 03366045 鄭力瑋. concave polygon:convex polygon: Convex polygons 「凸」的定義是:圖形內任意兩點的連線不會經過圖形外部。"

Similar presentations


Ads by Google