CS133 Computational Geometry Simplification Algorithms 1
Line Simplification ? 2
Line Simplification Given a line string and a distance threshold π , return a simplified line string such that any point in the input line string is not displaced more than π 3
Douglas β Peucker Algorithm β€ π 4
Douglas β Peucker Algorithm β€ π 5
Douglas β Peucker Algorithm 6
Douglas β Peucker Algorithm β€ π 7
Douglas β Peucker Algorithm β€ π 8
Douglas β Peucker Algorithm β€ π 9
Douglas β Peucker Algorithm β€ π 10
Douglas β Peucker Algorithm 11
Douglas β Peucker Algorithm 12
Douglas β Peucker Algorithm 13
Running Time function DouglasPeucker(P[], π ) // Find the point with the maximum distance (=maximum cross product) cmax = 0 index = 0 for i = 2 to ( end - 1) c = π 1 π[π] Γ π 1 π[π] if ( c > cmax ) π π = π π1 + π π β π1 + π π index = i cmax = c if (cmax / π 1 [π π > π ) { R1 = DouglasPeucker(P[1..index], π ) R2 = DouglasPeucker(P[index..n], π ) R1.removeLast return R1 || R2 // Concatenate the two lists else return [P[1], P[n]] // Only return the first and last points 14
Polygon Triangulation 15
Polygon Triangulation Given a simple polygon P, break it down into a set of triangles π such that the union of the triangles is equal to the polygon and no two triangles intersect. That is: Ϊ π’ π βπ π’ π = π and π’ π β© π’ π = π for any π’ π , π’ π β π and π β π 16
Polygon Triangulation 17
Convex Polygons Choose any vertex on the polygon Connect it to all other vertices to create all diagonals Number of possible triangulations is Catalan Number π· πβ2 2π 1 2π! π· π = = π π+1 π+1 !π! 18 By Eric DΓ©trez (as published at www.texample.net in 2008-10-09) - The image is the result of a latex script example published at [1]. All the site is under CC-2.5-by license, as seen on every page of the wite., CC BY 2.5, https://commons.wikimedia.org/w/index.php?curid=56872963
Number of Triangles Number of triangles in a triangulation of a polygon of π points is π β 2 triangles Can be proven by induction Trivial case: π = 3 General case: If it applies for all π < π , we need to prove that it applies for π = π That is, we want to prove that if a triangulation exists, it will have π β 2 triangles 19
Induction π 1 π 2 π 1 + π 2 = π + 1 # of triangles in π 1 = π 1 β 2 , in π 2 = π 2 β 2 # of triangles in π = π 1 β 2 + π 2 β 2 + 1 = π 1 + π 2 β 4 + 1 = π + 1 β 4 + 1 = π β 2 20
Existence of a Triangulation Any simple polygon has at least one triangulation Proof by induction Trivial case: π = 3 General case: If there are triangulations for all polygons π < π , we need to prove that there is one for π = π 21
Induction 22
Dual Graph Dual graph π£ Each triangle is represented by a vertex in π£ Two triangles that share an edge are connected by an edge in π£ 23
Recommend
More recommend