Master's Thesis: Closed formulae for distance functions involving ellipses.

36
UNIVERSIDAD DE CANTABRIA FACULTAD DE CIENCIAS DPTO. DE MATEMÁTICAS ,ESTADÍSTICA Y COMPUTACIÓN Closed formulae for distance functions involving ellipses. T ESIS DEL MÁSTER EN MATEMÁTICAS Y C OMPUTACIÓN REALIZADA POR GEMA R. QUINTANA P ORTILLA BAJO LA DIRECCIÓN DE LOS PROFESORES D. F ERNANDO E TAYO GORDEJUELA Y D. L AUREANO GONZÁLEZ -VEGA DURANTE EL CURSO 2008-2009

description

M.Sc. in Mathematics thesis. Tesis Máster en Matemáticas y Computación.

Transcript of Master's Thesis: Closed formulae for distance functions involving ellipses.

  • 1. U NIVERSIDAD DE C ANTABRIA FACULTAD DE C IENCIAS D PTO . DE M ATEMTICAS , E STADSTICA Y C OMPUTACINClosed formulae for distance functionsinvolving ellipses. T ESIS DEL M STER EN M ATEMTICAS Y C OMPUTACIN REALIZADA POR G EMA R. Q UINTANA P ORTILLABAJO LA DIRECCIN DE LOS PROFESORES D. F ERNANDO E TAYOG ORDEJUELA Y D. L AUREANO G ONZLEZ -V EGA DURANTE ELCURSO 2008-2009

2. 2 3. ContentsContents3List of Figures51 Introduction 71.1 General considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71.2 Description of the contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . .82 The distance between two ellipses112.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112.2 The distance between one point and an ellipse . . . . . . . . . . . . . . . . . . .112.3 The distance between two ellipses . . . . . . . . . . . . . . . . . . . . . . . . .143 Closest approach of two ellipses or ellipsoids 173.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173.2 Two ellipses case . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . 18 3.2.1 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213.3 Distance of closest approach of two ellipsoids . . . . . . . . . . . . . . . . . . . 25 3.3.1 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274 Conclusions and future work314.1 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . 314.2 Future work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . 314.2.1 Using ellipses to check safety regions . . . . . . . . . . . . . . . . . . . 324.2.2 Haussdorf distance computations between ellipses and ellipsoids. . . . . 33Bibliography 35 4. 4 CONTENTS 5. List of Figures 2.1Analyzing graphically d(E0 , E1 ). . . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.2Analyzing the implicit curve determined by d(E0 , E1 ). . . . . . . . . . . . . . . .16 3.1Distance of closest approach of two ellipses in two dimensions. . . . . . . . . . .19 3.2Conguration of the two ellipses. . . . . . . . . . . . . . . . . . . . . . . . . . .21 3.3Position of the ellipses A (blue) and B (green). . . . . . . . . . . . . . . . . . . 22 3.4Position of the ellipses A(t) (blue) and B (green) at the instant t = t0 . . . . . . . 23 3.5Position of the ellipses A(t) (blue) and B (green) at the instant t = t1 . . . . . . . 23 3.6Position of the ellipses A(t) (blue) and B (green) at the instant t = t2 . . . . . . . 24 3.7Position of the ellipses A(t) (blue) and B (green) at the instant t = t3 . . . . . . . 24 3.8Conguration of the two ellipsoids. . . . . . . . . . . . . . . . . . . . . . . . . .26 3.9Conguration of the two ellipsoids E1 (blue)and E2 (green). . . . . . . . . . . .27 3.10 Conguration of the two ellipsoids E1 (t) (blue)and E2 (green) at the instant t = t0 . 28 3.11 Conguration of the two ellipsoids E1 (t) (blue)and E2 (green) at the instant t = t1 . 29 3.12 Conguration of the two ellipsoids E1 (t) (blue)and E2 (green) at the instant t = t2 . 29 3.13 Conguration of the two ellipsoids E1 (t) (blue)and E2 (green) at the instant t = t3 . 30 6. 6 LIST OF FIGURES 7. Chapter 1Introduction1.1 General considerations This thesis deals with two main problems: the computation of the minimum distance between two coplanar ellipses; and the calculus of the closest approach of two arbitrary separated ellipses. Both of them are special important issues in some elds related to mathematics: The problem of detecting the collisions or overlap of two ellipses or ellipsoids is of inter- est to robotics, CAD/CAM, computer animation, computer vision, etc., where ellipses or ellipsoids are often used for modeling (or enclosing) the shape of the objects one wants to analyze. What we are looking for is to obtain a closed formula which gives us the minimum distance between two ellipses in the two dimensional real afne space. Computing the distance of the closest approach of two ellipses is one topic which has a lot of importance in some areas of the Physics and Chemistry. It appears, for example, in modeling 2D liquid crystals or in modeling the phase behavior of isotropic uids. The ideas of the second chapter of the thesis have been exposed in a short-talk given by theauthor of the thesis in the Seventh International Workshop on Automated Deduction in Geometry2008 that was hosted by the East China Normal University (ECNU) at its campus in Shanghai,China, from September 22nd to September 24th in 2008. In the proceedings of this conferenceit appears a short resume of the content of the talk: Closed formulae for distance functions in-volving ellipses by Fernando Etayo, Laureano Gonzalez-Vega, Gema R. Quintana and WenpingWang. Another short-talk about the same topic was also given by the author of the Master Thesisin the XI Encuentro de lgebra Computacional y Aplicaciones which took place in Granada from10th September 12th to in 2008. 8. 8 CHAPTER 1. INTRODUCTIONThe third chapter constitutes the main topic of a short-talk under the title Computing the dis-tance of closest approach between ellipses and ellipsoids given by the author at the Conferenceon Geometry: Theory and Applications that has been held from June 29 to July 2, 2009 at Pilsen inCzech Republic, dedicated to the memory of the Professor Josef Hoschek. It also has been recentlyaccepted for presentation at the 2009 SIAM/ACM Joint Conference on Geometric and PhysicalModeling conference, which will be celebrated from 5th to 8th October, 2009, at the Hilton SanFrancisco Financial District in San Francisco (California). The talk will be given in the sessiondedicated to the eld of Geometric Algorithms.1.2 Description of the contentsThe thesis is divided in four chapters, beginning with an introduction to the topics which aregoing to be developed in it.The second chapter deals with the problem of computing the minimum distance between twoseparated ellipses in the plane. Our goal is to obtain that using a closed formula. Using eliminationtheory we nd a polynomial, which depends only on the parameters that determine the denitionof the ellipses, that provides us the square of the minimum distance as its smallest positive realroot. The same polynomial gives us the maximum distance as the square positive root of its max-imum real root. Our approach provides a new point of view in this eld of problems: what we dorst is to introduce a formula for the distance between a given point and one ellipse. All the processis completed in a way totally independent of footpoints. Note that in all the previous works (see[3],[4],[9],[12]) the computation of this distance requires the previous calculus of these points.That points are the ones in which the probability of the minimum distance of being reached takesit maximum. That is, to nd (using geometric and optimization techniques) the closest regionsbetween the conics: those regions where the points in which the minimum distance is reachedare going to be contained. Then, the problem is reduced to the calculus of distances from point topoint. We avoid this calculus, obtaining the searched distance in a direct way. In order to do that wehave used several tools coming from Real Algebraic Geometry and Computer Algebra. The for-mula we obtain for the calculus of the distance from a point to an ellipse is then used to determinein a similar way (avoiding the calculus of footpoints) the distance between two given ellipses, justmaking the exterior point to belong to another ellipse. The main advantage our method presents isthat we can generalize this method to other conics, like hyperbolas, and to quadrics, like ellipsoids,in an easy way. It is also easy to apply it to the continuous motion case, that constitutes one of thelines of our future work. This case takes special importance in robotics when you are interested incomputing the safety regions in which your automata can move avoiding crashes between them,for example. The third chapter contains the computation of the closest approach of two arbitrary separatedellipses in the plane. That is the distance among their centers when they are externally tangent, 9. 1.2 Description of the contents 9after moving them through the line joining the centers of the ellipses. That distance in the case ofhard particles modeled as ellipses is a key parameter of their interaction and plays an important rolein the resulting phase behavior. In [15], the paper that encouraged us to deal with the study of thistopic, the authors obtain it in a complicate way. That way involves the calculus of the eigenvaluesand eigenvectors of a matrix of a linear transformation. What we do is to propose an alternativeway to obtain that which do not require that calculus: the searched distance is provided as thesmallest real root of a polynomial. That is, we obtain, again, a closed formula. Our method is basedon the results given in [7], [13] and [14] that characterize the positions of two separated ellipsesand ellipsoids. The algorithm we have developed for the case of two coplanar ellipses is adaptedeasily to the case of two ellipsoids in R3 , obtaining another closed formula for the distance we areinterested in. The main advantage this method presents is that we avoid the calculus of eigenvectorsor eigenvalues which is known to be a difcult task in numerical and symbolic algorithms.The last chapter of this document presents an resume of the conclusions obtained in it, and italso contains some comments about the topics we hope to study and to obtain interesting resultsabout which will conform our future work guideline. 10. 10 CHAPTER 1. INTRODUCTION 11. Chapter 2The distance between two ellipses2.1 Introduction Since we are interested in the practical applications of the calculus of the distance between twoconics we are going to assume that the distance between a given point and one ellipse is a posi-tive real algebraic number. We show how to determine and study the univariate polynomial whosesmallest nonnegative real root provides the square of the distance between a given point and anellipse. The coefcients of this polynomial are polynomials in the different parameters character-izing the given ellipse (center coordinates, axes length and orientation) and the given point.The minimum distance presented in this way does not depend on the footpoints giving the dis-tance directly and thus we can use this formula for analyzing the Ellipses Moving Problem (EMP).This is a critical problem in Computer Graphics and previous solutions to this problem require thecomputation of footpoints being this task a source of numerical problems since they do not behavecontinuously like the distance does. This problem has been analyzed by several authors like [3], [4], [9], [11], [12] but all of theirapproximations are based on the footpoints determination with the drawbacks mentioned before.2.2 The distance between one point and an ellipse Let E0 be an ellipse with center at the origin of coordinates (0,0) and semiaxes of lenghts aand b parallel to the coordinate axis. Let (x0 , y0 ) be a point exterior to E0 . The distance betweenthem, d, is given by:d = min (x x0 )2 + (y y0 )2 : (x, y) E0In order to get a closed formula giving d in terms of the parameters a, b, x0 and y0 , the ellipse 12. 12 CHAPTER 2. THE DISTANCE BETWEEN TWO ELLIPSESE0 is characterized by the usual parametrization: x = a cos t, y = b sin t, t [0, 2)In this way the square of the minimum distance from (x0 , y0 ) to E0 , D = d2 , is attained at avalue of the parameter t0 where the function 2 2f (t) = x0 a cos t + y0 b sin ttakes its minimum value1 .Thus t0 is a solution of the equation: g(t) = f (t) = 2(b a) cos t sin t + 2x0 a sin t 2y0 b cos t = 0and d2 = f (t0 ). To get the searched formula for d we have to eliminate t0 from the system of equations:f (t0 ) D = 0 g(t0 ) = 0To perform this elimination, and in order to make cos(to ) and sin(t0 ) disappear, we introducethe change of variable2 :1 1 cos(t0 ) = 2 z + z11sin(t0 ) = 2i z z The principal advantage of this change of variable is given by the fact that if z = cos(t0 ) + 1i sin(t0 ) then z = z . In this way it is concluded that the searched D veries that there exists z Csuch that |z| = 1 and (b a)z 4 + 2(x0 a iy0 b)z 3 2(x0 a iy0 b)z + a b = 0 (b a)z 4 + 2(x0 a iy0 b)z 3 2(2(x2 + y0 D) + a + b)z 2 + 4(x0 a + iy0 b)z + b a = 0 o2What we have to do now is to solve the previous system. The way we do that consists in com-puting the resultant of the two equations with respect to the variable z. Its known that in that cal-culus strange factors may appear3 . In our case the factor which appears and that we have removed 1This derivation has the following geometric interpretation: it is essentially computing the envelope of circles cen-tered on the ellipses. The equation obtained is the offset curve of distance d to the ellipse. Lets remember that an offsetcurve is the set of all points that lie a perpendicular distance d from a given curve in R2 .The scalar d is called the offsetradius. If the parametric equation of the given curve is P (t) = (x(t), y(t)) then the offset curve with offset radius d isgiven by(y (t), x (t)) (d, P (t)) = P (t) + d x (t)2 + y (t)2Note that in this denition, if d is positive, the offset is on our right as we walk along the base curve in the direction ofincreasing parameter value.2In [10] one can see how this transformation is used to solve some kinematic equations3This is due to the implementation of the scientic software we are using: Maple 12 13. 2.2 The distance between one point and an ellipse 13[x ,y ]is 256(a b)2 . Once we have done that we obtain a polynomial F[a,b] 0 (D) in Z[a, b, x0 , y0 ][D]0which provides the desired formulae for d as shown by the next theorem.Theorem 2.2.1. If d is the distance of a point (x0 , y0 ) to the ellipse with center (0, 0) and semiaxesa and b then D = d2 is the smallest nonnegative real root of the polynomial[x ,y0 ]0F[a,b] (D) = (a b)2 D4 + 2(a b)(b2 + 2x2 b + y0 b 2ay0 a2 x2 a)D3 + 022 0+ (y0 b2 8y0 ba2 6b2 a2 + 6a3 y0 2x2 a3 + a4 + 6x2 y0 b2 2y0 b3 + 6y0 a2 + 4x2 a2 b+42 2 0 0224 0 + 2b3 a + 6x2 y0 a2 + 2a3 b 6x4 ab + 4y0 b2 a + 6x4 b2 + x4 a2 + 6b3 x2 10x2 y0 ab + b4 02 02 0 0 00 2 8x2 ab2 6y0 ab)D2 04 2(ab4 + y0 a4 a2 b3 + a4 b + 2y0 a2 + 2b2 x6 a3 b2 bx2 ay0 bx4 ay0 + 3x2 ay0 b2 +2 60 040202+ 3x2 a2 y0 b by0 a + b2 y0 x2 + 3x4 b3 + 3y0 a3 + x2 b4 + x4 a2 y0 bx6 a 5x4 ab2 +02 6 4 0 040 020 0 + 3b2 y0 x4 + 3y0 a 2x2 a3 y0 + 3x4 a2 b + 3x2 b2 y0 2x2 ab3 2y0 a3 b 3y0 ab3 3x2 a3 b2 0 4 0 2 004022 0 2x2 b3 y0 5y0 a2 b + 4x2 a2 b2 + 4y0 a2 b2 )D+02 4 0 2+ (x4 + 2x2 b + b2 2x2 a 2ba + a2 + y0 + 2x2 y0 2y0 b + 2ay0 ) (bx2 + ay0 ba)2 =0 00 4 02 2202 4 [a,b]= hk (x0 , y0 )Dk (2.1)k=0[x ,y ]when (x0 , y0 ) is not a foci of E0 . The biggest real root of F[a,b] 0 (D) = 0 is the square of the 0maximum distance between (x0 , y0 ) and the points in the ellipse E0 .Remark 2.2.2. If (x0 = a b , y0 = 0)is a foci of E0 (and for simplicity assuming a > b) then d= a ab.In this case [ ab,0]F[a,b] (D) = (a b)2 D2 (D2 + 2(b 2a)D + b2 ) .The solution D = 0 comes from the fact that the complex (and non real) value a t = arc cos abmakes the function f (t) to vanish. The other two solutions 2 D = 2a b 2 a(a b) =a ab 2 D = 2a b + 2 a(a b) =a+ abproduce, respectively, the minimum and the maximum distance from the foci to the ellipse E0 . 14. 14 CHAPTER 2. THE DISTANCE BETWEEN TWO ELLIPSESRemark 2.2.3. If a = R2 , b = R2 (the ellipse E0 becomes a circumference) and D = d2 then:[x ,y ] 2 F[R0 ,R2 ] (d2 ) = R4 y0 + x220 2 0 d2 + 2Rd + R2 y0 x2 20 d2 2Rd + R2 y0 x22 0with real rootsd1 = R +y0 + x22 0d2 = R y0 + x2 20d3 = R + y0 + x22 0d4 = R y0 + x22 0Thus:d = min {di : di 0} = R y0 + x2 . 20It is important to quote here that the formula presented in Theorem 2.2.1 provides the minimumdistance without requiring the availability or previous computation of the footpoints (i.e. the pointswhere the searched distance is attained).2.3 The distance between two ellipses Let E0 be the ellipse given by the equation x=a cos(t), y =b sin(t) and E1 any other ellipse, disjoint with E0 , presented by the parameterization x = (s), y = (s) and s [0, 2) Thend(E0 , E1 ) = min (x1 x0 )2 + (y1 y0 )2 : (x0 , y0 ) E0 , (x1 , y1 ) E1is the square root of the smallest nonnegative real root of the family of univariate polynomials [(s),(s)]F[a,b] (D). The foci question pointed out in Remark 2.2.2 needs to be taken into account hereif one of the foci of E0 belongs to E1 . That is not a problem because that question is very easy tocheck and to deal with when computing d(E0 , E1 ). [(s),(s)] In order to determine the smallest positive real root of F[a,b] (D) we are analyzing twopossibilities. In the rst one D is determined as the smallest positive real number such that thereexists s [0, 2] such that4 [(s),(s)][a,b]F[a,b] = hk ((s), (s))Dk = 0 , k=0 15. 2.3 The distance between two ellipses 15 4[(s),(s)] def [a,b]F [a,b] = h ((s), (s))Dk = 0s kk=0Since (s) and (s) are linear forms on cos(s) and sin(s) then this question is converted into analgebraic problem in the same way we have proceeded in Section 2.2 by performing the change ofvariables in both equations: 1 1 1 1cos(s) = w+ , sin(s) =w . 2 w 2iw Computing the resultant of these two equations with respect to w (both have degree 16 in w)produces an univariate polynomial GE1 (D) of degree 60 whose smallest positive real root is theE0 [x ,y ]square of d(E0 , E1 ). This polynomial needs to be computed once (like F[a,b] 0 (D) as shown in 0Theorem 2.2.1) and depends polynomially on the parameters dening E0 and E1 . [(s),(s)]In the second possibility D is determined by analyzing the implicit curve F[a,b] (D) =0 in the region D 0 and s [0, 2). In order to apply the algorithm in [8] the change ofcoordinates1 u2 2u cos(s) =, sin(s) =1 + u2 1 + u2[(u),(u)] is used and the real algebraic plane curve F[a,b] (D) = 0 analyzed in D 0, u R.Example 2.3.1. We consider a = 3, b = 2 (for E0 ) and E1 the ellipse with center (2, 3) parallelto the coordinate axis and with a = 2 and b = 1.Figure 2.1: Analyzing graphically d(E0 , E1 ).The picture at Figure 2.1 shows the surface where the height is the smallest nonnegative real[x0 ,y ]root of F[3,2] 0 (D) for any (x0 , y0 ): the heights of the intersection points between this surface andthe cylinder over E1 are the distances to E0 of the points in E1 being d(E0 , E1 ) the smallest height(in green). 16. 16CHAPTER 2. THE DISTANCE BETWEEN TWO ELLIPSESFigure 2.2: Analyzing the implicit curve determined by d(E0 , E1 ).The picture Figure 2.2 shows the square root of the smallest and the biggest positive at [ 2 cos(s)+2,sin(s)3]real roots of F[3,2](D) for any given s [0, 2). The point in green representsd(E0 , E1 ) and the point in blue the maximum distance between the ellipses E0 and E1 .The degree 60 polynomial GE1 (D) factors, in this case, as the product of one degree 12 poly-E0nomial of multiplicity one, one degree 12 polynomial with multiplicity three and other multiplefactors of lower degree being the non multiple factor of degree 12 the one providing the smallestand the biggest real roots of GE1 (D): E0G1 (d) = k1 d4 (d12 216d11 + ...)(d2 54d + 1053)2 (d2 52d + 1700)2 (k2 d12 + k3 d11 + ...)3 0where ki are real numbers.It is not still clear if this factorization pattern appears in a general way, in the case of ellipseswith parallel axis, and can be used in practice. But our conjecture is that it would be possibly true.We will see that one part of our future work consists in nding the geometric interpretation of thisfactorization pattern hoping that it would help us to prove the conjecture. 17. Chapter 3Closest approach of two ellipses orellipsoids3.1 IntroductionThe distance of closest approach of two arbitrary separated ellipses (resp. ellipsoids) is thedistance among their centers when they are externally tangent, after moving them through the linejoining their centers.That distance modelizes the problem of nding the distance of closest approach of hard parti-cles which is a key topic in some physical questions: short-range repulsive forces between atomsand molecules in soft condensed matter are often modeled by an effective hard core, which gov-erns the proximity of neighbors. Since the attractive interaction wit a few nearest neighbors usuallydominates the potential energy, the distance of closest approach is a key parameter in statisticaldescriptions of condensed phases.For non-spherical molecules, such as the constituents of liquid crystals1 , the distance dependson orientation and its calculation is surprisingly difcult: at rst glance, this problem seems simpleenough for high-school geometry homework assignment. Further consideration shows, however,that it s not simple at all. A prize for its solution was informally announced at the Liquid CrystalGordon Conference in 1983 (attended by W. M. Gelbart and R. B. Meyer); this, however, did notgenerate a solution. J. Vieillard-Baron, an early worker on this problem, was reportedly greatlydisturbed by the difculties he encountered.The simplest smooth non-spherical shapes are the ellipse and the ellipsoid. In [15], the authorsdescribe a method for solving the problem of determining the distance of closest approach of thecenters of two arbitrary hard ellipses, nding an analytic expression for that distance as a function 1 An introduction to this topic can be found in [2]: a review article which gives an overview of the simulation workperformed so far, and focuses on the still unanswered questions which will determine the future challenges in the eld. 18. 18 CHAPTER 3. CLOSEST APPROACH OF TWO ELLIPSES OR ELLIPSOIDSof their orientation relative to the line joining their centers. Their approach proceeds via the steps: 1. They consider two ellipses initially distant so that they have no point in common. 2. One ellipse is then translated toward the other along the line joining their centers until theyare in point contact externally 3. PROBLEM: to nd the distance d between the centers when the ellipses are so tangent, thatis, to nd the distance of closest approach. 4. Transformation of the two tangent ellipses into a circle and an ellipse. The circle and theellipse remain tangent after the transformation. 5. Determination of the distance d of closest approach of the circle and the ellipse. 6. Determination of the distance d of closest approach of the initial ellipses by inverse trans-formation.The problem here is that we have to deal with anisotropic2 scaling3 and the inverse trans-formation, and this implies the calculus of the eigenvectors and eigenvalues of the matrix of thetransformation. It is known the difculties this could involve numerically. Because of that, we introduce a new approach to the problem using the results shown in [7].The authors of that paper introduce a new approach for characterizing the ten relative positionsof two ellipses by using several tools coming from Real Algebraic Geometry, computer Alge-bra and Projective Geometry (Sturm-Habicht sequences and the classication of pencils of conicsin P2 (R)). Each relative position is exclusively characterized by a set of equalities and inequal-ities depending only on the matrices dening the two considered ellipses and does not requirein advance the computation or knowledge of the intersection points between them. We use thecharacterization of externally tangent ellipses and ellipsoids provided in [13] and [14].3.2 Two ellipses caseDenition 3.2.1. Given two arbitrary separated ellipses E1 and E2 we dene the distance oftheir closest approach as the distance among their centers when they are externally tangent, aftermoving them through the line joining their centers. 2The anisotropy is the property of being directionally dependent(i.e. opposed to isotropy, which means homogeneityin all directions). It can be dened as a difference in a physical property (absorbance, refractive index, density, etc.) forsome material when measured along different axes. An example is the light coming through a polarizing lens.3By anisotropic scaling an ellipse can be transformed into a unit circle, that is to make the isotropy disappear, asyou can see in [15]. 19. 3.2 Two ellipses case19 Figure 3.1: Distance of closest approach of two ellipses in two dimensions.Let A = (x, y) R2 : a11 x2 + a22 y 2 + 2a12 xy + 2a13 x + 2a23 y + a33 = 0be the equation of an ellipse. As usual it can be rewritten asX T AX = 0where X T = (x, y, 1) and A = (aij ) is the symmetric positive denite matrix of the coefcients.Following the notation in [13] and [14] we dene the characteristic polynomial of the pencil de-termined by two ellipses as follows.Denition 3.2.2. Let A and B be two ellipses given by the equations X T AX = 0 and X T BX = 0respectively, the degree three polynomial f () = det(A + B)is called the characteristic polynomial of the pencil A + BIn [13] and [14] the authors give some partial results about the intersection of two ellipsoids,obtaining a complete characterization, in terms of the sign of the real roots of the characteristicpolynomial, of the separation case: i.e when the two ellipsoids can be separated by a plane. Moreprecisely they prove that: the two considered ellipsoids are separated if and only if their characteristic polynomial (which has degree four in the case of ellipsoids) has two distinct positive roots; the characteristic equation always has at least two negative roots; and the ellipsoids touch each other externally if and only if the characteristic equation has a positive double root.In [7] an equivalent characterization is given for the case of two coplanar ellipses. That isthe characterization we are going to use in order to obtain the solution of the problem without 20. 20 CHAPTER 3. CLOSEST APPROACH OF TWO ELLIPSES OR ELLIPSOIDSusing geometric transformations which involve the calculus of eigenvalues or eigenvectors. Thepresented approach provides a closed formula for the polynomial S(t) (depending polynomiallyon the ellipse parameters) whose smallest real root provides the distance of closest approach. Wewill see that the presented approach extend in a natural way to the distance of closest approach fortwo ellipsoids.Remark 3.2.3. In order to simplify the computation, we consider the two coplanar ellipses givenby the equations:x2 y2 E1 = (x, y) R2 : a+b 1=0 E2 = (x, y) R2 : a11 x2 + a22 y2 + 2a12 xy + 2a13 x + 2a23 y + a33 = 0 That is one of them centered at the origin with semi-axes of length a and b, along thecoordinate axes, x and y, respectively; and the other one located in a general position, as shown ingure 3.2. Let A2 be the matrix associated to E2 : a11 a12 a13 A2 = a12 a22 a23 a13 a23 a33The center of E2 is the point (p, q) whose coordinates are given in terms of the elements of A2as follows:a22 a13 a12 a23p= a2 a11 a22 12 a11 a23 a12 a13q=a2 a11 a2212 The equation of the moving ellipse E1 (t) obtained making the rst one move along the linewhich joins the centers of the two ellipses yields:(x pt)2 (y qt)2E1 (t) = (x, y) R2 : +1=0a b Now we consider the characteristic polynomial of the pencil A2 + A1 (t):H(t; ) = det(A2 + A1 (t)) = h3 (t)3 + h2 (t)2 + h1 (t) + h0 (t)Note that the case we are interested in is the externally tangent one. This situation is pro-duced when the polynomial H(t; ) has a double positive root. So the equation which gives us thesearched value of t, t0 is S(t) = 0 where S(t) = disc H(t; ) = s8 t8 + s7 t7 + s6 t6 + s5 t5 + s4 t4 + s3 t6 + s2 t4 + s1 t2 + s0 21. 3.2 Two ellipses case 21If t0 is the smallest positive real root of S(t) then the searched distance of the closest approachof our ellipses is equal to t0 p2 + q 2 Figure 3.2: Conguration of the two ellipses.Theorem 3.2.4. Given two separated ellipses E1 and E2 dened as in the remark 3.2.3 the dis-tance of their closest approach is given asd = t0p2 + q 2where t0 is the smallest positive real root of S(t) = disc H(t; ), H(t; ) is the characteristicpolynomial of the pencil determined by them and (p, q) is the center of E2 .3.2.1 ExampleIn order to show the aspect the polynomials involved in the previous calculus we are goingto consider the following example: let A and B be the ellipses given by the following equations,respectively:1A := (x, y) R2 : x2 + 2 y 2 1 = 0B := (x, y) R2 : 9x2 + 4y 2 54x 32y + 109 = 0This initial conguration is shown in the gure 3.3.That is, both of them have axes parallel tothe coordinate axes (in fact, A has its axes contained in them). The center of A is the origin of 1coordinates and the lengths of its semi-axes are 1 and 2 . B is centered in the point (3, 4) withsemi-axes of lengths 2 and 3, resp. 22. 22CHAPTER 3. CLOSEST APPROACH OF TWO ELLIPSES OR ELLIPSOIDSFigure 3.3: Position of the ellipses A (blue) and B (green). We make the center of the rst one to move along the line determined by the centers of theellipses. That gives us the equation of a moving ellipse, depending on the parameter t:(y 4t)2A(t) := (x, y) R2 : (x 3t)2 + 1=02The characteristic polynomial of the pencil B + A(t), once turned monic, results:17 2 17523 145 2 145 1 HA(t) (t; ) = 3 + B t +t 2 + t +t +36 1824 648 2592 12962592And computing the resultant of this polynomial with respect to we can determine the poly- Bnomial SA(t) (t) whose its smallest real root represents the instant t = t0 when the ellipses aretangent: 251243 115599091 1478946641 266704681 55471163 BSA(t) (t) = 80621568 t + 8707129344 t2 + 34828517376 t4 8707129344 t3 + 2902376448 t6158971867 56076225 6076225 40111 4353564672 t + 8707129344 t8 1088391168 t7 + 136048896BThe four real roots of SA(t) (t) are:t0 = 0.2589113100, t1 = 0.7450597195, t2 = 1.254940281, t3 = 1.741088690The situations associated to each value of the parameter t = ti , i = 0, 1, 2, 3 are shown in thefollowing gures: 23. 3.2 Two ellipses case 23 Figure 3.4: Position of the ellipses A(t) (blue) and B (green) at the instant t = t0 . Figure 3.5: Position of the ellipses A(t) (blue) and B (green) at the instant t = t1 . 24. 24CHAPTER 3. CLOSEST APPROACH OF TWO ELLIPSES OR ELLIPSOIDS Figure 3.6: Position of the ellipses A(t) (blue) and B (green) at the instant t = t2 . Figure 3.7: Position of the ellipses A(t) (blue) and B (green) at the instant t = t3 . BAs one can see in the previous gures, the four real roots of SA(t) (t) give us the four instantsin which the two ellipses are tangent. Being t0 the root which gives us the closest approach ofthem which is d = 5t0 = 1.294556550 in this case. 25. 3.3 Distance of closest approach of two ellipsoids253.3 Distance of closest approach of two ellipsoidsThe presented approach in the previous section extends in a natural way to the distance ofclosest approach for two ellipsoids4 .Denition 3.3.1. A real ellipsoid is the quadricsurface dened X T AX = 0 where X T =(x, y, z, 1),a11 a12 a13a14 a12 a22 a23a24 A= a13 a23 a33a34 a14 a24 a34a44is non-singular, det(A) > 0 and the cofactor of the term a44 does not vanish.Denition 3.3.2. The center (xc , yc , zc ) of a central quadric surface5 X T AX = 0 is given by theequations:A14 A24A34xc = ; yc = ; zc =A44 A44A44where each Aij represents the cofactor of the element aij of the matrix A.Remark 3.3.3. In order to make the computation more simple we consider the following congu-ration of the quadrics we are studying:Let A1 and A2 be the symmetric denite positive matrices dening the separated ellipsoidsE1 andE2 as X T A1 X = 0 and X T A2 X = 0 where X T = (x, y, z, 1), and 1a00 0 0 1 b00 A1 = 01 0c 0 0 00 1 a11 a12a13a14 a12 a22a23a24 A2 = a13a23a33a34 a14 a24a34a44i.e., x2 y2 z2 E1 = (x, y) R2 : a + b + c 1=0 a11 x2 + a22 y 2 + a33 z 2 + 2a12 xy + 2a13 xz+E2 =(x, y) R2 : 2a23 yz + 2a14 x + 2a24 y + 2a34 z + a44 = 04In [5] it is shown the relation between this distance and molecular simulations.5Like the ellipsoid. 26. 26CHAPTER 3. CLOSEST APPROACH OF TWO ELLIPSES OR ELLIPSOIDS We act like we did in the case of the ellipses, assuming that one of the ellipsoids is centered at the origin of coordinates with semi-axis of length a, b, c, along the directions describedby the coordinate axes, x, y and z, respectively; and the second one given in a general form, withcenter at (xc , yc , zc ), determined by the entries of the matrix A2 in the way it is shown by thedenition 3.3.2. That conguration is shown in gure 3.8 Figure 3.8: Conguration of the two ellipsoids.In the same way we proceeded in the case of the ellipses we make the center of E1 (and so allthe points in E1 do) move in the line which joins the centers of the two surfaces, obtaining (x txc )2 (y tyc )2 (z tzc )2 E1 (t) =(x, y) R2 :+ +1=0 a b cIn order to nd the value of t, t0 , for which the ellipsoids are externally tangent we have tostudy the roots of the characteristic polynomial associated to them, that is to check if the polyno-mial H(t; ) = det(E1 (t) + E2 ), which has degree four, has a double real root, like the authorsdo in [14]. This is done by computing the roots of the polynomial of degree 12:S(t) = disc (H(t, )) = s12 t12 + ... + s0 If t0 is the smallest positive real root of S(t) then the searched distance of closest approach isequal tot0 x2 + yc + zcc2 2Theorem 3.3.4. Given two separated ellipsoids E1 and E2 dened as in 3.3.3 the distance of theirclosest approach is given asd = t0 x2 + yc + zcc 2 2where t0 is the smallest positive real root of S(t) = disc H(t; ), H(t; ) is the characteristicpolynomial of the pencil determined by them, and (xc , yc , zc ) is the center of E2 . 27. 3.3 Distance of closest approach of two ellipsoids273.3.1 Example In order to illustrate the previous theorem we are going to consider a practical example. LetE1 and E2 be the two ellipsoids given as follows:E1 := (x, y, z) R3 : 1 x2 + 1 y 2 + z 2 1 = 04 2E2 := (x, y, z) R3 : 1 x2 2 x + 1 y 2 3 y + 51 + 1 z 2 5 z = 0 54 22 That is, E1 is centered at the origin of coordinates with semi-axis of lengths 2, 2 and 1 alongthe x-axis, y-axis and z-axis, resp. And the point (5, 6, is the center of E2 whose axis are parallel5) to the coordinate ones and have semi-lengths equal to 5, 2 and 2 with respect to the coordinateframe. This situation can be observed in gure3.9. Figure 3.9: Conguration of the two ellipsoids E1 (blue)and E2 (green).We make the center of the ellipsoid E1 to move along the line determined by the centers ofthe two quadrics we are studying. That is the way in which the equation of a moving ellipsoid,depending on the parameter t, is obtained: 28. 28CHAPTER 3. CLOSEST APPROACH OF TWO ELLIPSES OR ELLIPSOIDS 1 2 1 25197 2E1 (t) := (x, y, z) R3 : x + y + z 2 tx 6 ty 10 tz 1 +t =0 42 2 4The characteristic polynomial of E2 and E1 (t), once turned monic, results: E2HE1 (t) (t; ) = 4 43 3 197 3 t2 301 2 659 2 t2 +42 4 19723 t 2372 265 t2 + 659 2 t + 5 + 265 t22And computing the resultant of this polynomial with respect to the variable we can determineE2 (t)the polynomial SE1 (t) whose its smallest real root represents the instant t = t0 when the ellipsoidsare tangent: E (t) 16641 2 SE1 (t) = 1)4 (2725362025t8 21802896200t7 + 75970256860t6 150580994360t5 +1024 (t 185680506596t4 145836126384t3 + 71232102544t2 19777044480t + 2388833408) 2E (t)The four real roots of SE1 (t) that determine the four tangency points are all provided by thefactor of degree 8 which appears in its decomposition. And they are the following: t0 = 0.6620321914, t1 = 0.6620321914, t2 = 1.033966297, t3 = 1.337967809The relative positions of the two ellipsoids associated to each value of the parameter t = ti ,i = 0, 1, 2, 3 are shown in the following gures:Figure 3.10: Conguration of the two ellipsoids E1 (t) (blue)and E2 (green) at the instant t = t0 . 29. 3.3 Distance of closest approach of two ellipsoids29Figure 3.11: Conguration of the two ellipsoids E1 (t) (blue)and E2 (green) at the instant t = t1 .Figure 3.12: Conguration of the two ellipsoids E1 (t) (blue)and E2 (green) at the instant t = t2 . 30. 30CHAPTER 3. CLOSEST APPROACH OF TWO ELLIPSES OR ELLIPSOIDSFigure 3.13: Conguration of the two ellipsoids E1 (t) (blue)and E2 (green) at the instant t = t3 .As it happened in the case of the ellipses the previous gures show that when t takes the four E2 (t)values determined by that four real roots of SE1 (t) the four instants in which the two ellipsoidsare tangent are produced. Being t0 the root which gives us the closest approach of the two quadric surfaces, which is d = 11t0 = 2.195712378 for the example we are working with. 31. Chapter 4Conclusions and future work4.1 Conclusions The main conclusions of the work we have developed are the following: A closed form solution for several problems involving ellipses or ellipsoids when dealing with interference or distance computations has been presented. Closed form solutions try to concentrate at the very end the application of numerical tech- niques. Closed form solutions are a critical step towards efciency when dealing with moving ob- jects (in order to dene safety regions or to check that a collision is still far away). Do not forget that we are looking for solutions easy to be found and checked, that is, for real-time applications: software or hardware systems that are subject to real-time constraints (i.e., operational deadlines from event to system response). We have completely avoided the calculus of the footpoints. Avoiding footpoints computation is very important in this context: the key is that distance is a continuous function of the geometric data while footpoints are not.4.2 Future workIn relation to the study of the minimum distance between two separated ellipses, the maintopic in which we are interested consist of obtaining the decomposition of the polynomial GE1 (D)E0of degree 60, in the general case. We just have it in particular cases. Once we have done that wewould be able to prove our conjecture and it also will help us with the study of the existing rela-tionship between the geometric congurations of the two ellipses and the terms that appear in thefactorization of GE1 (D). E0 32. 32CHAPTER 4. CONCLUSIONS AND FUTURE WORKParticular geometric congurations1 of the quadrics or conics we are studying seem to berelated with specially simple decompositions of the polynomials involved in the calculus of theminimum distance between them or of the closest approach of them. We are currently working inthe algebraic-geometric interpretation of this situation in order to extract global conclusions.We would also like to continue the study of the continuous motion case, in order to apply ourtechniques to robotics and similar elds in which the objects of study are not static, they representbodies which are describing trajectories depending on the time. In a more or less easy way the approach we have introduced for the computation of the min-imum distance between two separated ellipses in the plane seems to be generalizable to the threedimensional case: the study of the minimum distance between two separated ellipsoids in thespace. It will also be interesting to consider the case of non-coplanar ellipses, that is, when the twoseparated ellipses are not contained in the same plane, and of course the case of other coplanarand non-coplanar conics, like hyperbolas, for instance.4.2.1 Using ellipses to check safety regionsSuppose that you have a collection of moving automata and you are interested in checkingthe regions in which your robots do not collide each others. In other words, you are interested innding the set of the safety regions. This problem can be modelized using ellipses: we can assumethat each robot is contained into an ellipse and then ask questions like: When the distance between both ellipses is bigger than d? Is there any closed formulae which gives us that? Note that collision detection is an important problem in animation, CAD and robotics. Col-lision detection is usually used to improve reality in virtual environment by avoiding penetratingbetween objects. Besides, it is used as path planning in robotics to calculate in advance paths ofmoving robots to avoid collision during motions. There are many applications like robot or vehiclepath planning where the robots and vehicles are represented as 2D gures moving in 2D plane. The answer to them is given by considering the following discriminant: [(s),(s)] H(D) = discs F[a,b] (D)and asking when all the positive rald roots of H(D) are bigger than d2 . The way in which closedformulae can be determined is using subresultants and similar techniques.1This has to be understood in the sense of extreme regularity (like the bi-quadratic polynomials case, for instance)of the decomposition of the polynomials involved in the calculus of the minimum distance or closest approach. 33. 4.2 Future work 334.2.2 Haussdorf distance computations between ellipses and ellipsoidsSimilar approaches to deal with Haussdorf distance computations between ellipses and ellip-soids are being analyzed: The eld of the analysis and comparison of geometric shapes acquiresspecial importance in various application areas within Computer Science. For example patternrecognition or computer vision. It does also in other disciplines concerned with the shape of ob-jects such as cartography, molecular biology, medicine... The general situation is that we are given two objects A, B modeled as subsets of the two orthree dimensional space and we are interested in knowing how much they resemble each other.For this purpose we need a similarity measure dened on pairs of shapes indicating the degree ofresemblance of these shapes. As one can see in [6] and [1] a frequently used similarity measureis the Hausdorff distance, which is dened for two arbitrary non-empty compact sets A and B.It assigns to each point of one set the distance to its closest point in the other set and takes themaximum over all these values.Denition 4.2.1. The one-sided Hausdorff distance from A to B isH (a, b) = {maxaA minbB } d(a, b)where d(a, b) denotes a distance measure between points a and b.The case which is directly related with the topics in which we have been working is the onewhen A and B are planar shapes, i.e., A, B R2 and d is the Euclidean distance. All the pre-vious works in this area are again based on the calculus of the footpoints.The authors reduce theproblem of determining the Hausdorff distance from a curve a; a(t) = (xa (t), ya (t)) to a curve b;b(s) = (xb (s), yb (s)) to determining the distance of constantly many candidate or critical pointson a to the curve b and then taking the maximum over these distances. To characterize all candi-date points they make some theoretical considerations involving, for example, the computation ofthe medial axis of the curve. Our goal here is to obtain similar characterizations like the proposed in [6] or [1] but (ofcourse) avoiding the calculus of the footpoints, doing it in a direct way, using similar ideas that theones which have appear in the previous chapters of this document. 34. 34 CHAPTER 4. CONCLUSIONS AND FUTURE WORK 35. Bibliography[1] H. A LT, L. S CHARF, Computing the Hausdorff distance between curved objects, Interna-tional Journal of Computational Geometry and Applications 18, 307-320, 2008.[2] R. B ERARDI , L. M UCCIOLI , S. O RLANDI , M. R ICCI AND C. Z ANNONI, Computersimulations of biaxial nematics, J. Phys.: Condens. Matter 20, 463101, 2008.[3] I. Z. E MIRIS , E. T SIGARIDAS , G. M. T ZOUMAS, The predicates for the Voronoi diagramof ellipses, Proc. ACM Symp. Comput. Geom., 2006.[4] I. Z. E MIRIS , G. M. T ZOUMAS, A Real-time and Exact implementaction of the predi-cates for the Voronoi diagram of parametric ellipses, Proc. ACM Symp. Solid PhysicalModelling, 2007.[5] R. E VERAERS AND M. R. E JTEHADI, Interaction potentials for soft and hard ellipsoids,Physical Review 67, 041710, 2003.[6] G. E LBER AND T. G RANDINE, Hausdorff and Minimal Distances between ParametricFreeforms in R2 and R3 , Advances in Geometric Modeling and Processing, Lecture Notesin Computer Science 4975, 191-204, 2008.[7] F. E TAYO , L. G ONZLEZ -V EGA , N. DEL R O, A new approach to characterizing therelative position of two ellipses depending on one parameter, Computed Aided GeometricDesing 23, 324-350, 2006.[8] L. G ONZLEZ -V EGA , I. N ECULA, Efcient topology determination of implicitly denedalgebraic plane curves, Computed Aided Geometric Desing 19, 719-743, 2002.[9] C. L ENNERZ , E. S CHMER, Efcient distance computation for quadratic curves andsurfaces, Geometric Modelling and Processing Proceedings, 2002. [10] B. M OORE , J. S CHICHO , C. G OSSELIN, Dynamic balancing of planar mechanisms usingtoric geometry, Journal of Symbolic Computation 44, 1346-1358, 2009. Effective Meth-ods in Algebraic Geometry [11] J. K. S EONG , D. E. J OHNSON , E. C OHEN, A hingher dimensional formulation for robustand interactive distance queries, Proc. ACM Symp. Solid Physical Modelling, 2006. 36. 36 BIBLIOGRAPHY [12] K. A. S OHN , B. J UTTLER , M. S. K IM , W. WANG, Computing the distance between twosurfaces via line geometry, Proc. Pacic Conf. Comp. Graph. and App., 236-245, 2002. [13] W. WANG , R. K RASAUSKAS, Interference analysis of conics and quadrics, Contempo-rary Math. 334, 25-36,2003. [14] W. WANG , J. WANG , M. S. K IM, An algebraic condition for the separation of two ellip-soids, Computer Aided Geometric Desing 18, 531-539, 2001. [15] X. Z HENG , P. PALFFY-M UHORAY, Distance of closest approach of two arbitrary hardellipses in two dimensions, Physical Review, E 75, 061709,2007.