200 likes | 513 Views
Delaunay Triangulations. Reading: Chapter 9 of the Textbook Driving Applications Height Interpolation Constrained Triangulation. Height Interpolation.
E N D
Delaunay Triangulations • Reading: Chapter 9 of the Textbook • Driving Applications • Height Interpolation • Constrained Triangulation M. C. Lin
Height Interpolation • A terrain is a 2D surface in 3D space with a special property: every vertical line intersects it in a point. That is, it is the graph of a function f: A R2 R that assigns a height f(p) to every point p in the domain. • Problem: From the height of the sample points we somehow have to approximate the height at the other points in the domain. Triangles with small angles are undesirable. So, rank the triangulations by their smallest angles. M. C. Lin
Triangulations of Planar Point Sets • Let P := {p1, p2, …, pn} be a set of points in the plane. A triangulation of P is the maximalplanar subdivisionS whose vertex set is P, s.t. no edge connecting 2 vertices can be added to S without destroying its planarity. • Let P be a set of n points in the plane, not all collinear, and let k denote the number of points in P that lie on the boundary of the convex hull of P. Then any triangulation of P has 2n-2-k triangles and 3n-3-k edges. M. C. Lin
Basic Properties • Let C be a circle, l a line intersecting C in points a and b, and p, q, r, and s points lying on the same side of l. Suppose that p and q lie on C, that r lies inside C, and that s lies outside C, then arb > apb = aqb > asb • An edge is illegal if we can locally increase the smallest angle by flipping that edge. q s b r p C a l M. C. Lin
Basic Properties • Let T be a triangulation with an illegal edge e, and T’ be a triangulation obtained from T by flipping e. Then A(T’) > A(T), where A(.) stands for the smallest angle. • Let edge pipj be incident to triangles pipjpk and pipjpl, and let C be the circle through pi, pj, pk and pl. The edge is illegal if and only if the point pl lies in the interior of C. Furthermore, if the four points form a convex quadrilateral and do not lie on a common circle, then exactly one of pipj and pkpl is an illegal edge. M. C. Lin
Legal Triangulation • A legal triangulation is a triangulation that do not contain any illegal edge. Any angle-optimal triangulation is legal. • We can compute legal triangulation by simply flip illegal edges till all edges are legal, given a triangulation. (see next) • there are only finite number of triangulations and every iteration the smallest angle increases. So, it works, but too slow! M. C. Lin
LegalTriangulation(T) Input: Some triangulation T of a point set P. Output: A legal triangulation T. 1. while T contains an illegal edge pi pj 2. do (* Flip pi pj *) 3. Let pi pj pk and pi pj pl be the two triangles adjacent to pi pj 4. Remove pi pj from T, and add pk plinstead 5. return T M. C. Lin
Voronoi Diagram & Dual Graph • The Voronoi diagram of P, Vor(P), is the subdivision of the plane into n regions, one for each site in P, s.t. the region of a site p P contains all points in the plane for which p is the closest site. The region of a site p is called the Voronoi cell of p, denoted by V(p). • The dual graph of Vor(P), G, has a node for every Voronoi cell (or every site). G has an arc between 2 nodes if the corresponding cells share an edge. M. C. Lin
Delaunay Graph & Triangulation • Delaunay graph of P, DG(p) is the straight-line embedding of G, where the node corresponding to the Voronoi cell V(p) is the point p, and the arc connecting the nodes of V(p) is the segment pq. • If P is in general position (i.e. no 4 points lie on a circle), then all vertices of the Voronoi diagram have degree three, and consequently all bounded faces of DG(p) are triangles. In this case, DG(p) is the Delaunay triangulation of P and unique. M. C. Lin
Basic Properties of Delaunay Triangulations • Let P be a set of points in the plane. • 3 points are vertices of the same face of the DG(P) iff the circle thru them contains no point of P in interior. • 2 points form an edge of DG(P) iff there is a closed disc C that contains them on its boundary and doesn’t contain any other point. • Let P be a set of points in the plane, and let T be a triangulation of P. Then T is a Delaunay triangulation of P, iff the circumcircle of any triangulation of T doesn’t contain a point of P in its interior. M. C. Lin
Basic Properties of Delaunay Triangulations • Let P be a set of points in the plane. A triangulation T of P is legal if and only if T is a Delaunay triangulation of P. • Let P be a set of points in the plane. Any angle-optimal triangulation of P is a Delaunay triangulation of P. Any Delaunay triangulation of P maximizes the minimum angle over all triangulations of P. M. C. Lin
Computing Delaunay Triangulation • Use Voronoi diagram to get Delaunay Triangulation. • Use Randomized Incremental Construction: • Start with a big triangle that contains all the points. The vertices of this big triangle should not lie in any circle defined by 3 points in P. • Add one point pr at a time, then add edges from pr to the vertices of the existing triangle. • There are 2 cases to consider: • pr lies in the interior of a triangle • pr falls on an edge (need to make sure new edges are legal by flipping edges if necessary). M. C. Lin
DelaunayTriangulation(P) Input: A set P of n points in the plane Output: A Delaunay triangulation of P 1. Let p-1 , p-2 & p-3 be 3 point s.t. P is contained in triangle p-1 p-2 p-3 2. Initialize T as triangulation consisting of a single triangle p-1 p-2 p-3 3. Compute a random permutation p1 , … , pn of P 4. for r 1 to n 5. do (* Insert pr into T : *) 6. Find a triangle pi pj pk T containing pr 7. if pr lies in the interior of the triangle pi pj pk 8. then Add edges from pr to 3 vertices of pi pj pk and split it 9. LegalizeEdge(pr , pi pj , T) 10. LegalizeEdge(pr , pj pk , T) 11. LegalizeEdge(pr , pk pi , T) M. C. Lin
DelaunayTriangulation(P) 12. else (* pr lies on an edge of pi pj pk, say the edge pi pj *) 13. Add edges from pr to pk and to the third vertex of other triangle that is incident to pi pj , thereby splitting 2 triangles incident to pi pj into 4 tri’s 14. LegalizeEdge(pr , pi pl , T) 15. LegalizeEdge(pr , pl pj , T) 16. LegalizeEdge(pr , pj pk , T) 17. LegalizeEdge(pr , pk pi , T) 18. Discard p-1 , p-2 and p-3with all their incident edges from T 19. return T M. C. Lin
LegalizeEdge(pr , pi pj , T) 1. (* The point being inserted is pr , and pi pj is the edge of T that may need to be flipped *) 2. if pi pj is illegal 3. then Let pi pj pk be triangle adjacent to pr pi pj along pi pj 4. (* Flip pi pj *) Replace pi pj with pr pk 5. LegalizeEdge(pr , pi pk , T) 6. LegalizeEdge(pr , pk pj , T) M. C. Lin
Find Triangle Containing Pr • While we build the Delaunay triangulation, we also build a point location structure D. The leaves of D correspond to the triangles of current triangulation T. We maintain cross pointers between the leaves and the triangulation. The internal nodes of D correspond to triangles that were in triangulation at some earlier stage, but have been destroyed. • We initialize D as a DAG with a single leaf node that corresponds to the big triangle. • For the rest, see the pictorial example. M. C. Lin
How to Pick a Big Triangle • Let M be the maximum value of any coordinate of a point in P. Then, the triangle has the vertices at (3M, 0), (0, 3M), and (- 3M, - 3M). • Then, handle the cases where the edge that Prlies on has one vertex with a negative index. M. C. Lin
Algorithm Analysis • The Delaunay triangulation of a set of n points in the plane can be computed in O(n log n) expected time, using O(n) expected storage • see the proof in 9.4 (similar to previous analysis for randomized algorithms) M. C. Lin