scieee AI-readable full text Open interactive document viewer

Computing the Hausdorff distance between curved objets

Alt, Helmut; Scharf, Ludmila

Full text

Computing the Hausdor Distane Between Curved Ob jets 1 Helmut Alt Ludmila Sharf Institute for Computer Siene, Freie Universitat Berlin, Takustr.9, D-14195 Berlin Key words: shap e omparison, Hausdor distane, parametri urves 1. Intro dution Analysis and omparison of geometri shap es are of imp ortane in various appliation areas within omputer siene, suh as pattern reognition and omputer vision, but also in other disiplines on- erned with the form of ob jets suh as artography, moleular biology, mediine, or biometri signal pro essing. The general situation is that we are given two ob jets A , B mo delled as subsets of 2- or 3- dimensional spae and we want to know how muh they resemble eah other [1℄. For this purp ose we need a similarity measure dened on pairs of shapes indiating the degree of resemblane of these shapes. A frequently used similarity measure is the Hausdor distane, whih is dened for arbitrary non-empty ompat sets A and B . It assigns to eah p oint of one set the distane to its losest p oint in the other and takes the maximum of all these values. Formally, we dene the one-sided Hausdor distane from A to B as ~ Æ H ( A; B ) = max a 2 A min b 2 B d ( a; b ) ; (1) where d ( x; y ) denotes a distane measure b etween p oints x and y . Here we will assume the planar ase, i.e., that A; B  R 2 and that d is the Eulidean distane. The (bidiretional) Hausdor distane b etween A and B is dened as Æ H ( A; B ) = max( ~ Æ H ( A; B ) ; ~ Æ H ( B ; A )) (2) We will only desribe the omputation of the one-sided Hausdor distane from A to B , the omputation of the bidiretional Hausdor distane is then straightforward. 1 This researh was supp orted by the Europ ean Union under ontrat No. IST-2000-26473, Pro jet ECG. The aim of this pap er is to nd an algorithm for general shap es whih are mo delled by two sets of n algebrai urves . When we speak ab out the Hausdor distane between these two sets we atually mean the Hausdor distane b etween the two sets of points lying on these urves. We will restrit to urves that are given by rational parameterizations , i.e., eah urve is represented by a parameterization  : I ! R 2 ;  ( t ) = ( x ( t ) ; y ( t )) (3) where I  R is a losed interval and x ( t ) ; y ( t ) are rational funtions with no poles in I . Observe that this denition inludes some imp ortant families of free-form parametri urves, for example B-splines. For simpliity, we assume a ertain general p osition of the input urves. In partiular, we assume that any two urves interset in at most nitely many p oints. 2. Basi ases In this setion we will investigate how the direted Hausdor distane b etween two single objets (urves or p oints) an b e omputed. 2.1. Point-urve and urve-point The Hausdor distane from a p oint p = ( u; v ) to a urve  ( t )=( x ( t ) ; y ( t )) ; t 2 I is min t 2 I d ( p;  ( t )). The Hausdor distane from a urve  ( t ) to a p oint p is the maximum Eulidean distane from any p oint on  to p . In order to nd those parameters t where the minimum or maximum is attained, we onsider the 20th EWCG Seville, Spain (2004) 20th Europ ean Workshop on Computational Geometry zero es of the derivative of the squared distane d d t [ d 2 ( p;  ( t ))℄, i.e., the equation 2  ( u  x ( t ))  x 0 ( t ) + 2  ( v  y ( t ))  y 0 ( t ) = 0 (4) This equation has onstantly many solutions if the degree of  is b ounded. We all a p oint satisfying this equation a footpoint of p on  . In addition to the p oints given by the solutions of equation 4 the minimum or maximum distane an be attained at the endp oints of  (Fig. 1). p c(t) Q Fig. 1. Hausdor distane from a urve  ( t ) to a p oint p is the distane from p to the farthest p oint on  . 2.2. Curve-urve We redue the problem of determining the Hausdor distane from a urve a , a ( t ) = ( x a ( t ) ; y a ( t )), t 2 I a to a urve b , b ( s )=( x b ( s ) ; y b ( s )), s 2 I b to determining the distanes of onstantly many andidate p oints on a to the urve b . There are four dierent typ es of andidate p oints. Firstly, the Hausdor distane an be assumed at one of the endpoints of urve a ( type EA ). Seondly, it an happ en that the Hausdor distane is attained b etween an endpoint Q of b and a p oint on a . Therefore, we determine on a all fo otp oints of the endp oints of b by equation (4) ( type EB ). For the third typ e of andidate p oints we onsider the self-bisetor (or medial axis ) of a urve, whih is the set of all p oints whose minimal distane to the urve is attained at more than one p oint on the urve, f. Fig. 2. The Hausdor distane from a to b an b e attained at an intersetion p oint of a with the selfbisetor of b . We will only give a system of equations desribing suh a p oint here for the part of the self-bisetor where the two losest points are interior p oints of b , see Fig. 3. point−point bisector point−curve bisector curve−curve bisector Fig. 2. Self-bisetor of a parabola segment. a(t) Q b(s) R P Fig. 3. The Hausdor distane from the urve a ( t ) to the urve b ( s ) is assumed at the intersetion p oint Q of the urve a with the self-bisetor of the urve b . The p oint Q has two dierent internal foot-p oints P and R on b . Supp ose Q = a ( t ) and that P = b ( s ) and R = b ( r ) with r 6 = s are the p oints on b losest to Q . Then we obtain the following system of equations for t; s; and r :  ( x a ( t )  x b ( s )) 2 + ( y a ( t )  y b ( s )) 2    ( x a ( t )  x b ( r )) 2 + ( y a ( t )  y b ( r )) 2  = 0 (5) ( x a ( t )  x b ( s ))  x 0 b ( s ) + ( y a ( t )  y b ( s ))  y 0 b ( s ) = 0 (6) ( x a ( t )  x b ( r ))  x 0 b ( r )+( y a ( t )  y b ( r ))  y 0 b ( r ) = 0 (7) In order to enfore the ondition r 6 = s we introdue a new variable u and add one more equation to the system: 1  u ( s  r ) = 0 (8) We add all points determined by the nitely many solutions of this system to the andidate list ( type SB ). For the fourth typ e of possible andidate p oints we observe that the Hausdor distane an o ur b etween two interior p oints p 2 a and q 2 b with- Marh 25-26, 2004 Seville (Spain) out one of them lying on the self-bisetor of the other urve, see Fig. 4. a(t) b(s) p q Fig. 4. Hausdor distane at interior points. Sine q is a fo otp oint on b for p oint p , the line segment pq must b e p erp endiular to the tangent line to urve b at p oint q . In addition it an b e shown that the tangent line to the urve a at p oint p must b e parallel to the tangent line to the urve b at p oint q and, thus, also p erp endiular to the line segment pq . The remaining andidate p oints ( type I ) for the Hausdor distane are, therefore, among the solutions of the following system: ( x a ( t )  x b ( s ))  x 0 b ( s )+( y a ( t )  y b ( s ))  y 0 b ( s ) = 0 (9) ( x a ( t )  x b ( s ))  x 0 a ( t ) + ( y a ( t )  y b ( s ))  y 0 a ( t ) = 0 (10) A detailed geometri proof for this fat is omitted due to spae limitations and an b e found in [7℄. 3. The general ase As was said b efore, the general problem we onsider is to nd the Hausdor distane b etween two p oint sets given by two sets A; B of rationally parameterized algebrai urves. In order to nd ~ Æ ( A; B ) we split the urves of A at their intersetion p oints with the Voronoi diagram of B . The resulting set A 0 of urves has the prop erty that eah urve lies in one Voronoi ell of B , so its distane to B is the distane to one urve and an b e determined using the tehniques of setion 2. Computing the omplete Voronoi diagram of algebrai urves is a very diÆult task in pratie and there are some op en questions about the bisetor of algebrai urves [3{5℄. In [5℄ an approximation algorithm for Voronoi diagrams of urves is given. Instead, we just ompute the intersetion p oints desrib ed. The splitting of eah urve a of A is done inrementally. Supp ose that we have list of intersetion p oints of the Voronoi diagram of a subset of B with a and we want to add a new urve b 2 B . We do this by sanning the urrent segments of a . Eah segment s b elongs to some urve  2 B whih has already b een pro essed. First we determine all intersetion p oints of the bisetor b etween b and  with a and nd out whih ones lie inside s . s is split further with these p oints and some p ortions are labelled with b as nearest neighbor, others with  . After this has b een done it might be ne- essary to merge neighb oring segments whih are b oth marked with b but are separated by a splitp oint from previous steps. Similar to the ase of self-bisetors, the interse- tion points of with the bisetor b etween b and  an b e found as solutions of systems of equations. We only give this system here for the \interior" bisetor of two urves b and  , not the ones for the bisetor between an endp oint of one urve and another urve or b etween two endpoints. These systems, however have to b e onsidered, as well. The system for the \interior" bisetor uses the prop erty that if a p oint a ( t ) lies on the bisetor b etween b and  and the orresp onding fo otp oints are b ( s ) and  ( r ) then the line segment a ( t ) b ( s ) is p erp endiular to the tangent vetor b 0 ( s ), and a ( t )  ( r ) is p erp endiular to  0 ( r ). d ( a ( t ) ; b ( s ))  d ( a ( t ) ;  ( r )) = 0 (11) h ( a ( t )  b ( s )) ; b 0 ( s ) i = 0 (12) h ( a ( t )   ( r )) ;  0 ( r ) i = 0 (13) The worst ase running time of our algorithm as stated is O ( nm 2 ) if A onsists of n and B of m urves, assuming that the degrees of the urves are b ounded. It an be easily improved to O ( nm log m ) by using a divide-and-onquer approah for the splitting of the urves of A . It should b e worthwhile to further improve the ombinatorial omplexity of the algorithm (see also [2℄), but our ma jor intent was to nd a simple algorithm that an be put into pratie with a reasonable amount of eort. 4. Implementation We implemented the algorithm desrib ed in C++ using the omputer algebra software library SYNAPS (SYmboli Numeri APpliationS), see [8,6℄, for solving the systems of p olynomial equations. 20th Europ ean Workshop on Computational Geometry For visualization purp oses a graphial user interfae was develop ed using the GTK library. It inludes visualization of the urves, the input and editing of the parameterization and the intervals if the parameter values, the omputation of the Hausdor distane and the graphial indiation of the andidate p oints onsidered for the omputation. Figure 5 shows the interfae with an example. Fig. 5. Result of a Hausdor distane omputation with two B-splines of degree 2. Both one-way distanes and all andidate p oints are shown. Referenes [1℄ Helmut Alt and Leonidas J. Guibas. Disrete geometri shap es: Mathing, interpolation, and approximation. In Handbook of omputational geometry . Elsiever Siene B.V., 1999. [2℄ Helmut Alt and Otfried Shwarzkopf. The Voronoi diagram of urved ob jets. In Pro. 11th ACM Comput. Geom. Symp. , pages 89{97, Vanouver, BC, 1995. [3℄ Gershon Elb er and Myung-So o Kim. Bisetor urves of planar rational urves. Computer-Aided Design , 30(14):1089{1096, 1998. [4℄ Rida T. Farouki and Ra jesh Ramamurthy. Degenerate p oint/urve and urve/urve bisetors arising in medial axis omputations for planar domains with urved b oundaries. Internat. J. Comput. Geom. Appl. , 8:599{ 617, 1998. [5℄ Rida T. Farouki and Ra jesh Ramamurthy. Voronoi diagram and medial axis algorithm for planar domains with urved b oundaries, I. Theoretial foundations. Journal of Computational and Applied Mathematis , 102(1):119{141, February 1999. [6℄ G. Dos Reis, B. Mourrain, R. Rouillier, and Ph. Trebuhet. An environment for symb oli and numeri omputation. In Pro. of the International Conferene on Mathematial Software , pages 239{249, 2003. [7℄ Ludmila Sharf. Computing the Hausdor distane b etween sets of urves. Master's thesis, Freie Universitat Berlin, Germany, 2003. [8℄ http://www-sop.inria.fr/galaad/logiiels/synaps/.