Academia.eduAcademia.edu
Resultants, Implicit Parameterizations, and Intersections of Surfaces Robert H. Lewis1 Fordham University, New York, USA rlewis@fordham.edu, https://fordham.academia.edu/RobertLewis Abstract. A fundamental problem in computer graphics and computer aided design is to convert between a parameterization of a surface and an implicit representation of it. Almost as fundamental is to derive a parameterization for the intersection of two surfaces. In these problems, it seems that resultants, specifically the Dixon resultant, have been underappreciated. Indeed, several well known papers from ten to twenty years ago reported unsuitability of resultant techniques. To the contrary, we show that the Dixon resultant is an extremely effective and efficient method to compute an implicit representation. To use resultants to compute a parameterization of an intersection, we introduce the concept of an “implicit parameterization.” Unlike the conventional parameterization of a curve where x, y, and z are each explicitly given as functions of, say, t, we have three implicit functions, one each for (x, t), (y, t), and (z, t). This concept has rarely been mentioned before. We show that given a (conventional) parameterization for one surface and either an implicit equation for the second, or a parameterization for it, it is straightforward to compute an implicit parameterization for the intersection. Doing so is very easy for the Dixon resultant, but can be very daunting even for well respected Gröbner bases programs. Further, we demonstrate that such implicit parameterizations are useful. We use builtin 3D plotting utilities of a computer algebra system to graph the intersection using our implicit parameterization. We do this for examples that are more complex than the quadric examples usually discussed in intersection papers. Keywords: surface, polynomial system, resultant, Dixon, parameters, intersection, Gröbner basis 1 Resultants and Implicitization A classic problem in computer graphics and computer aided design is to derive an implicit equation for a surface given a parameterization of it. Since our surfaces are in three-dimensional space, we conventionally have three equations x =f (s, t). y =g(s, t). z =h(s, t). 2 R. Lewis If homogeneous coordinates are being used, there is a fourth equation for w. The implicit equation is produced by eliminating the s and t. As a very simple two-dimensional example, for a circle of radius r, the parametric equations are x = r cos(θ), y = r sin(θ). It is easy to eliminate θ by squaring and adding: x2 + y 2 = r2 cos2 (θ) + r2 sin2 (θ) = r2 yielding the familiar equation for a circle. (r is not a variable, but a parameter in the other sense of the word “parameter.”) Real examples of interest are much more complicated than this, and sophisticated elimination techniques are needed. The simple example illustrates an important idea. Parametric systems frequently involve trig functions, usually sine and cosine. Elimination techniques usually require polynomial (or rational) functions. A system with sine and cosine is easily converted to a polynomial system by replacing cosine with, say, ct, sine with st, and adding a new equation ct2 + st2 − 1 = 0. The theory of eliminating variables from a system of equations has a long history, starting with Bezout around 1760. A key idea is the resultant of a system of polynomial equations [3], [18]. Bezout did this for one-variable polynomials. Dixon [4] extended it to multivariate polynomials, and proved it would work in a certain ideal situation. However, for real problems the ideal situation rarely applies and often the method seems to fail. Kapur, Saxena, and Yang showed how to get around all those problems in 1994 [5], [1]. Lewis refined and greatly improved the method in 2008 [7] to what is called Dixon-EDF. Gröbner bases can also be used to eliminate variables [18]. In spite of the 1994 publication, the Kapur-Saxena-Yang (KSY) method seems to have not been noticed by the computer graphics community. In 2000 the authors of [2] explicitly reject resultants as unworkable. In 2004 Wang [19] was aware of the Bezout-Dixon method but not KSY. He develops a new method to implicitize surfaces and tests fifteen examples with his method, resultants, and Gröbner bases. As in [2] he reports that in many cases resultants will not work because the Dixon method returns 0. This is one of the situations that KSY overcomes! In the following table we compare Wang’s reported time using pre-KSY Dixon, Wang’s method, and our solution today using Dixon-KSY-EDF. Our computer is 2.3 times faster than Wang’s, so the final column is our time multiplied by 2.3. All times are in seconds. An asterisk ∗ means that Wang’s Dixon failed after that many seconds. (The 47000 is not a typo.) Example Wang’s Dixon Wang’s Method Dixon-EDF 2.3 Dixon-EDF 6 0.31* 0.019 0.004 0.009 9 1.21* 0.25 0.057 0.13 10 1830* .051 0.09 .207 13 2673 47000 0.59 1.36 In 2017 Shen and Goldman [16] also report a new method for certain implicitizations. They also say that some resultant matrices have a 0 determinant and therefore resultants cannot be used. They do not refer to KSY. Resultants, Parameters, and Surfaces 3 In the following table we compare their reported times (in seconds) and our solutions today using Dixon-EDF working on some of their examples. We assume that our computers are comparable in speed. Example Shen-Goldman Dixon-EDF 1 1.43 0.19 5 0.66 1.67 6 0.29 0.43 7 0.18 0.146 8 0.73 0.61 9 169.7 12.5 10 0.07 0.02 12 – 0.07 Example 5 has an answer with extremely large numerical coefficients. They describe their example 12 as a special case for which their method does not work directly and they need to “take remedial action.” This example is completely straightforward with Dixon-EDF and finishes in 0.07 seconds. They try resultants in the generalized Sylvester form as found in [17] on their examples, and they also try Gröbner basis techniques. Gröbner bases failed in every case, meaning that nothing was returned within 10 minutes. Their resultants failed in the same way in every case except example 10. Definition 1. In the following, Dixon always denotes the complete combination Dixon-KSY-EDF. 2 Resultants and Intersection of Surfaces A very important problem is to compute the intersection of two surfaces. Many papers have addressed this question, such as [6], [10], [13], [15]. Virtually all the papers assume that the surfaces are quadric, i.e., degree 2. This means that the implicit equation is of the form ax2 + by 2 + cz 2 + dxy + exz + f yz + gx + hy + iz + j = 0 [10] asumes one is quadric and the other a torus (which is a degree 4 curve). We describe here an apparently new way to compute intersections so long as at least one of the surfaces is given by a conventional parameterization, as in the previous section. There is no restriction on the degrees of the surfaces, at least theoretically. Suppose surface one is given by x = f1 (s1 , t1 ), y = g1 (s1 , t1 ), z = h1 (s1 , t1 ) and surface two is x = f2 (s2 , t2 ), y = g2 (s2 , t2 ), z = h2 (s2 , t2 ) 4 R. Lewis For the intersection simply combine this to form a system of six equations. (N.B: it is the same x, y, z.) Use Dixon to eliminate five variables, say y, z, t1 , s2 , t2 . That yields one equation (resultant) involving x and s1 . If this is linear in x, solve for x and obtain the parametric equation for the x-coordinate of the intersection curve. Repeat for y and z. One could just as well express x in terms of s2 , t1 or t2 . That might have computational advantages. The process described above also works if one surface has a parameterization and the second has an implicit definition, say p(x, y, z) = 0. We then have four equations x = f1 (s1 , t1 ), y = g1 (s1 , t1 ), z = h1 (s1 , t1 ), p(x, y, z) = 0 and we eliminate three variables, say y, z, t1 . If the resultant is degree 2 in x, one can easily use the quadratic formula to get two possible expressions for x in terms of s1 . Numerical testing could determine which is correct. Of course, degree 3 or 4 could also be handled by formulas, but the expressions would no doubt become daunting. What if the degrees are higher than 2 or we don’t want to deal with messy formulas? This leads to a new concept: Definition 2. An implicit parameterization of a curve in 3-space is a set of three equations f (x, s) = 0, g(y, s) = 0, h(z, s) = 0 whose solution set includes the curve. s is called the curve parameter. This is similar to the concept defined in [14]. f, g, and h could be any continuous functions, but will be rational functions in this work. Theorem 1. Given two surfaces defined as above with polynomial functions, the Dixon resultant will produce an implicit parameterization of their intersection. This follows immediately from the above discussion. The only possible flaw is if the set of six (or four) equations does not have a zero-dimensional solution space. That means for some values of the parameter s1 there are infinitely many values of x. The authors of [1] show that Dixon can fail in that case. 3 Examples of Surface Intersections We have found that when one of the surfaces is quadric and we use one of its parameters as curve parameter, f, g, and h in Definition 2 are quadratic in the variable. Explicit formulas for x, y, and z are then easy to compute. In the examples below, we always use equations that are as general as possible. That means we use parameters, in the other sense of the word “parameter.” The parametric equations of a torus are x = (R + r cps)cth, y = (R + r cps)sth, z = r sps in which there are six parameters: r and R are the radii, cps = cos(ψ), sps = sin(ψ), cth = cos(θ), sth = sin(θ). Similarly, below when we use spheres, ellipses, cones, etc., the equations contain parameters for radii, axes, etc. Polynomials Resultants, Parameters, and Surfaces 5 using these parameters are fed to the Dixon resultant. That is symbolic computation. Only at the last step, when we want to produce a graph, do we substitute numerical values for these parameters into the symbolic resultants.. We compute Dixon resultants using Fermat [8], [9]. Numerical values for the parameters were then substituted into the implicit resultants for x, y, and z. The ensuing functions were fed to Mathematica [12]. A fairly straightforward group of Mathematica commands [11] was used to produce the graphs. 3.1 Twisted torus and sphere A twisted torus is defined by x = (R + r cps)cth, y = (R + r cps)sth, z = r sps + 2 sth cth Fig. 1: Twisted torus and sphere Each implicit resultant is quadratic in the main variable. Their intersection: Fig. 2: Twisted torus and sphere intersection 6 3.2 R. Lewis Tilted ellipsoid and torus Fig. 3: Tilted ellipsoid and torus, cut-away view Each implicit resultant is degree four in the main variable. The intersection: Fig. 4: Tilted ellipsoid and torus intersection Resultants, Parameters, and Surfaces 3.3 7 Other examples – arbitrarily oriented cones: Fig. 5: Skew cones and their intersection – distorted “bowl torus” and ordinary torus. – two distorted “bowl tori:” Fig. 6: Distorted tori intersection The computation of the resultants for the arbitrarily oriented cones is easy for Dixon, but very hard for Gröbner basis implementations. Dixon running on Fermat takes 1.7 seconds for each resultant. Magma was killed after 7 hours. Maple running FGb was killed after 8.5 hours. 4 Summary Computing an implicitization with Dixon is straightforward and routine. No special conditions on the surfaces are needed. 8 R. Lewis The concept introduced here of “implicit parameterization” is easy to compute with Dixon. No special conditions on the surfaces are needed. Implicit parameterizations can be dealt with in fairly straightforward ways with commercial software. There is much room for further research. For example, how to decide which parameter to use for the curve parameter? References 1. Buse L., Elkadi M., and Mourrain B. Generalized resultants over unirational algebraic varieties. J. Symbolic Comp. (29) p. 515 - 526 (2000). 2. Cox, D., Goldman R., Zhang M. On the validity of implicitization by moving quadrics for rational surfaces with no base points. Journal of Symbolic Computation 29 (3) pp. 419 - 440 (2000). 3. Cox D., Little J., O’Shea D. Using Algebraic Geometry. Graduate Texts in Mathematics, 185. Springer-Verlag. New York, 1998. 4. Dixon A. L. The eliminant of three quantics in two independent variables. Proc. London Math. Soc. 6 468 - 478 (1908). 5. Kapur D., Saxena T., and Yang L. Algebraic and geometric reasoning using Dixon resultants. In: Proc. of the International Symposium on Symbolic and Algebraic Computation. A.C.M. Press (1994). 6. Lazard S., Peñaranda L., Petitjean S. Intersecting Quadrics: An Efficient and Exact Implementation. Computational Geometry 35 (1-2) pp. 74 - 99 (2006). 7. Lewis R. H. Heuristics to accelerate the Dixon resultant, Mathematics and Computers in Simulation 77 (4) pp. 400 - 407 (2008). 8. Lewis R. H. Computer algebra system Fermat. http://home.bway.net/lewis/ 9. Lewis R. H. Fermat code for Dixon-EDF, http://home.bway.net/lewis/dixon 10. Li Q., Zhang S., Ye X. Algebraic Algorithms for Computing Intersections between Torus and Natural Quadrics. Computer-Aided Design and Applications 1 (1-4) pp. 459 - 467 (2004). 11. Lichtblau, D. personal communication (2018). 12. Mathematica, https://www.wolfram.com/mathematica/ 13. Quadric intersections website, http://vegas.loria.fr/qi/ 14. Sendra J.R., Sevilla D., Villarino C. Algebraic and algorithmic aspects of radical parameterizations. Computer Aided Geometric Design 55 pp. 1-14 (2017). 15. Shen L-Y., Cheng J-S., Xiaohong J. Homeomorphic approximation of the intersection curve of two rational surfaces. Computer Aided Geometric Design (29) 8 pp. 613 - 625 (2012). 16. Shen L., Goldman R. Implicitizing Rational Tensor Product Surfaces Using the Resultant of Three Moving Planes. ACM Transactions on Graphics 36 (5) pp. 1 - 14 (2017). 17. Shi X., Wang X., Goldman R. Using µ-bases to implicitize rational surfaces with a pair of orthogonal directrices. Computer Aided Geometric Design 29 (7) pp. 541 - 554 (2012). 18. Sturmfels B. Solving systems of polynomial equations. CBMS Regional Conference Series in Mathematics 97, American Mathematical Society (2003). 19. Wang D. A simple method for implicitizing rational curves and surfaces. Journal of Symbolic Computation 38 pp. 899 - 914 (2004).