Triangulations Triangulations • A triangulation of set S of points in the plane is a partition of the convex hull of the set into triangles whose vertices Computational Geometry Computational Geometry are the points, and do not contain other points. (Why is there always a triangulation?!) • Alternative definition: A maximal collection of line- segments inside CH( S ) whose endpoints are points of S . (These segments form the triangles.) Delaunay Triangulation Delaunay Triangulation • There are an exponential number of triangulations of a point set. (Best known bound: O(59 n ), where n is the number of points [Santos and Seidel, 2003].) 2 1 Motivation Motivation Piecewise- Piecewise -Linear Interpolation Linear Interpolation • Assume a height value is associated with each point. • The height of a point P inside a triangle is determined by • A triangulation of the points defines a piecewise- the height of the triangle vertices, and the location of P . linear surface of triangular patches. • The result depends on the triangulation. 0 0 0 0 >0 >0 0 0 P P 0 0 0 >0 0 0 0 0 2D 3D 3 4 Barycentric Coordinates Coordinates Barycentric Piecewise- -Linear Interpolation Linear Interpolation Piecewise α + α + α = Any point inside a triangle x x x x 1 1 2 2 3 3 p can be expressed uniquely α + α + α = v 3 y y y y as a convex combination of 1 1 2 2 3 3 p v 2 A 1 α + α + α − = p z z z z 0 the triangle vertices: A 2 A 3 1 1 2 2 3 3 p α + α + α = 1 1 2 3 v 1 = α + α + α p v v v (x 3 ,y 3 ,z 3 ) 1 1 2 2 3 3 (x 4 ,y 4 ,z 4 ) A (x 5 ,y 5 ,z 5 ) α = ≤ ≤ P i for 1 i 3 + + i P A A A (x 1 ,y 1 ,z 1 ) 1 2 3 (x 1 ,y 1 ,z 1 ) α ≥ α + α + α = 0 , 1 (x 2 ,y 2 ,z 2 ) i 1 2 3 5 6 1
n log n ) An O( n n 3 O( n log n 3 ) An An O( )- -Time Triangulation Algorithm Time Triangulation Algorithm An O( )- -Time Triangulation Algorithm Time Triangulation Algorithm • Repeat • Construct the convex hull of the points, and connect one arbitrary vertex to all others. • Select two sites. • Insert the other sites one after the other. • If the edge connecting them does not intersect previously kept edges, keep it. • Two possibilities: Until all faces are triangles. • Point inside a triangle: One triangle becomes three. • Question: Why is the algorithm guaranteed to stop before running out of edges? • Point on an edge: Two triangles become four. • Answer: Because every non-triangular face has a diagonal that was not processed yet. Question Question: : O( n n log log n n ) time? Why O( ) time? Why 7 8 Number of Triangles Number of Triangles Quality (angle Quality (angle- -optimal) triangulations optimal) triangulations • Consider a triangulation T . • The number of triangles t in a triangulation of n points depends on the number of vertices k on the convex • Let α ( T ) = ( α 1 , α 2 ,.., α 3 t ) be the vector of angles in the hull: t = 2 n–k –2. triangulation T sorted in increasing order. • A triangulation T 1 is “better” than T 2 if α ( T 1 ) > α ( T 2 ) (compared lexicographically). n = 8 • The Delaunay triangulation is the “best” (avoiding, as much as possible, long skinny triangles). Good: Bad: k = 6 → t = 8 k = 5 → t = 9 9 10 Improving a Triangulation Thales’ ’s s Theorem Theorem Improving a Triangulation Thales • In any convex quadrangle, an edge flip is possible. • Theorem: (Why? Why isn’t it possible in a concave triangle?) Let C be a circle, and ℓ a line intersecting C at the points a and b . Let p , q , r , and s be points lying on the same side • Claim: If this flip improves the triangulation locally, it of ℓ , where p and q are on C , r inside C , and s outside C . also improves the global triangulation. Then: ∠ > ∠ = ∠ > ∠ arb apb aqb asb s • Proof omitted. q p (Thales proved the theorem directly; • If an edge flip improves the triangulation (locally and one can deduce it from the sine r hence globally), the first edge is called illegal . a theorem.) ℓ b 11 12 2
Θ ( An Θ n 4 Illegal Edges ( n 4 ) Illegal Edges An )- -Time Delaunay Triangulation Time Delaunay Triangulation • Lemma: An edge pq is illegal iff any of its opposite • For all triples of sites: vertices is inside the circle defined by the other three • If the circle through the triple of sites does not vertices. contain any other sites, keep the triangle whose • Proof: By Thales’s theorem. p p vertices are the triple. • Moreover, a convex quadrangle in general position • Complexity: Θ ( n 3 ) triples, Θ ( n ) work on each triple; has exactly one legal diagonal. q q Total: Θ ( n 4 ) time. • Theorem: A Delaunay triangulation does not contain illegal edges. (Otherwise it can be improved locally.) (Space complexity: Θ ( n ).) • Corollary: A triangle is Delaunay iff the circle through its vertices is empty of other sites. • Observation: The Delaunay triangulation is not unique if more than three sites are cocircular. 13 14 The In- The In -Circle Test Circle Test Naive Delaunay Algorithm Naive Delaunay Algorithm ⎛ + ⎞ Theorem: If a , b , c , d form a CCW 2 2 a a a a 1 ⎜ x y x y ⎟ • Start with an arbitrary triangulation. convex polygon, then d lies in the + 2 2 ⎜ b b b b 1 ⎟ > x y x y det 0 • Flip any illegal edge until no more exist. ⎜ ⎟ circle determined by a , b , and c iff: + 2 2 c c c c 1 ⎜ ⎟ x y x y ⎜ ⎟ + 2 2 ⎝ d d d d 1 ⎠ x y x y Proof: We prove that equality holds if the points are co-circular. There exists a center q − + − = 2 2 2 ( a q ) ( a q ) r and radius r such that: x x y y Similarly for b , c , d . ⎛ ⎞ + ⎛ ⎞ ⎛ ⎞ ⎛ ⎞ a 2 a 2 a a 1 y ⎜ x y ⎟ ⎜ x ⎟ ⎜ ⎟ ⎜ ⎟ + 2 2 ⎜ b b ⎟ b ⎜ b ⎟ 1 ⎜ ⎟ ⎜ ⎟ − − + + − = x y x y 2 2 2 2 q 2 q ( q q r ) 0 In vector notation: ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ + x y x y 2 2 c c c c 1 ⎜ ⎟ ⎜ y ⎟ x y ⎜ x ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ + 2 2 ⎝ d d ⎠ ⎝ d ⎠ ⎝ d ⎠ ⎝ ⎠ 1 x y x y So these four vectors are linearly dependent, and hence their determinant vanishes. Corollary : d ∈ ° ( a , b , c ) iff b ∈ ° ( a , c , d ) iff c ∈ ° ( b , a , d ) iff a ∈ ° ( b , c , d ). 15 16 Naive Delaunay Algorithm (cont.) Delaunay Triangulation by Duality Naive Delaunay Algorithm (cont.) Delaunay Triangulation by Duality • Draw the Delaunay graph (the dual graph of the Voronoi • Question: Why does the algorithm terminate? diagram) by connecting each pair of neighboring sites in • Answer: Because every flip increases the vector the Voronoi diagram. angle, and there are finitely-many such vectors. • If no four points are cocircular, then • However, this algorithm is in practice very slow. the Delaunay graph is triangulated, • General position assumption: • Question: Why does the algorithm converge to the There are no four cocircular points. optimum triangulation? • We need to prove: • Answer: Because there are no local maxima (proof • Correctness of this duality. That is, that drawing omitted). the Delaunay graph with straight segments does not cause any segment intersection. • That this triangulation indeed maximizes the angle vector. • Corollary: The Delaunay triangulation (DT) of n points can be computed in O( n log n ) time. 17 18 3
Recommend
More recommend