Geometric methods in shape and pattern recognition Lecture 10: 14-03-2006 15:15-17:00 Prof. dr. H. Alt Volkan Çardak 0246816 Solutions to assignments Homework 3 (March 2, 2006) Exercise 3.1 Delaunay triangulation Show that for a finite set S of points in the plane in general position and distinct p,q,r elements of S the following holds: __ a) pq is an edge of the Delaunay triangulation of S exactly if there is an empty circle passing through p and q. b) p,q,r form a triangle (facet) of the Delaunay triangulation of S exactly if the circle through p,q, and r is empty Here a circle is called empty if its interior contains no points of S. Two sites A and B are connected by a Delaunay edge in the Delaunay triangulation, iff there is an empty circle passing through A and B. This is known (3.1a) as the empty circle property. If two sites are neighbours in the Delaunay triangulation, then their cells are neighbours in the Voronoi diagram. So for any point on the Voronoi edge between these sites, you can can draw a circle centered at this point passing through A and B which can’t contain any other point (since they must be closest, center is equidistant to both A and B and there is no closer site). Exercise 3.1b is about the circumcircle property, that the circumcircle of any triangle in the Delaunay is empty. This is because the center of this circle is the Voronoi vertex dual to the triangle, and by definition of the Voronoi diagram, the three sites defining this vertex are its nearest neighbours. Exercise 3.2 Sweepline Describe a sweepline algorithm that identifies for a given simple polygon P and a given finite set S of points all points in S that lie inside P. Determine the asymptotic runtime of this algorithm as a function of the number n of edges of P and the number m of points in S. The event points are : the vertices of P points in S Sweep line status (SLS): segments of P that intersect SL. The data structure used is the AVL tree, where at each node you store the number of vertices in that subtree. Do the following: Sweep a) b) at vertices v of P if (v left of a line segment e) then add e to SLS if (v right of a line segment e) then remove e from SLS at points p from S search the SLS. Find in what interval the point p lies by adding the numbers in the vertices that are roots of left subtrees from the search path. If the sum is odd, p is inside P otherwise it is outside. Each of these m+n events can be processed in O(log n) time. In beginning you should sort all the points of P,S and this would take O((n+m)log(n+m). So the overall time of this algorithm would be O((n+m)log(n+m)). Exercise 3.3 Hausdorff distance a) Show that the Hausdorff distance is a metric. b) Let p = (0, 0), q = (1, 1), r = (1, 0), A the (set of points on) the line segment pq, and B the set of points on the polygonal chain p, r, q. Determine the directed Hausdorff-distances → → dH(A,B) and dH (B,A). The Hausdorff distance is called a metric if it satisfies the following properties: d(x,y) = 0 ↔ x = y This follows from the definition of the Euclidean distance, that this distance is 0 only if these points are identical. d(x,y) = d(y,x) The distance from point x to another point y should be the same as the distance from point y to point x. The directed Hausdorff distances are not metric because these distances don’t have to be the same ( d(x,y) ≠ d(y,x) ). If we look at the definition of the Hausdorff distance: → → dH (A,B) = max { dH (A,B), dH (B,A) } this problem is solved. If we exchange the values of A and B , the maximum distance will not change. So they are symmetric. d(x,z) ≤ d(x,y) + d(y,z) for all x,y,z (also known as the triangle inequality). ↓ ↓ ↓ L1 L2 L3 where d is the Hausdorff distance. The proof of the triangle inequality is as follows: 1) Take an arbitrary element a of X. The following holds: There is an element b of Y where d2(a,b) ≤ L2. 2) Take an arbitrary element b of Y. The following holds: There is an element c of Z where d2(b,c) ≤ L3. If you take 1 and 2 together, you get the following: d2(a,c) ≤ d2(a,b)+ d2(b,c) ≤ L2 + L3, So for any a in X there is a c in Z such that d2(a,c) ≤ L2+L3. The converse holds, as well, therefore, d(X,Z) ≤ L2+L3. How to compute the Fréchet distance? Recap from previous lecture: Given two polygonal chains f and g, which both represent a path. The person and the dog walk both on a different path and they should try to stay as close as possible. Both can control their speed but are not allowed to go backwards. Determine the minimal length of the leash that is necessary. To represent this we construct a free space diagram. The point (t,s) is colored white in the free space diagram if d2(f(t), g(s)) < ε. If there exists a monotone increasing path from (0,0) to (1,1) in the freespace this will imply that the Fréchet distance < ε . The next step was how to construct the free space diagram for polygonal chains. This is done by computing the free space for each cell. Then determine whether there exists a monotone increasing path. Reachable points We define reachable points in the free space as those points to which a monotone increasing path from (0,0) exists. For each cell :if reachable points on the lower + left side of a cell are known , then we can compute the ones on the upper and right side and then traverse the diagram ( This is done from left to right for each row and bottum to top). If you look at figure 1, then you can see that everything in the top and right intervals can be reached from the left and bottom intervals But what if it is the case as in figure 2. Then only everything above the dotted line can be reached. Figure 1 Figure 2 After this we traverse the diagram as described , so we have an O(mn) algorithm for the decision problem. By the remark from before it follows : There exists an O(mn log d/δ) algorithm for a scene of diameter d that computes the Fréchet distance to precision δ. To look at a comparison between the Hausdorff -and Fréchet distance the following holds: dH ≤ dF (In dH you take the smallest and then take the maximum so this is always less than or equal to dF ).