2n An O(h ) Hermite approximation for conic sections Michael Floater SINTEF P.O. Box 124, Blindern 0314 Oslo, NORWAY November 1994, Revised March 1996 Abstract. Given a segment of a conic section in the form of a rational quadratic Bézier curve and any positive odd integer n, a geometric Hermite interpolant, with 2n contacts, counting multiplicity, is presented. This leads to a Gn−1 spline approximation having an approximation order of O(h2n ). A bound on the Hausdorff error of the Hermite interpolant is provided. Both the interpolation and error bound are extended to an important subclass of rational biquadratic Bézier surfaces. For low n, the approximation provides a method for converting the so-called analytic curves and surfaces used in CAGD to polynomial spline form with very small error. Keywords. high order approximation, conic sections, splines §1. Introduction It was described in a recent paper [6], how one can approximate a conic section, in the form of a rational quadratic Bézier curve r, by a quadratic spline having order of continuity C 1 and G2 and order of approximation O(h4 ). Moreover an explicit error bound, having the same convergence order, was constructed. The error bound provides a simple method for converting conic sections and surfaces such as the sphere, torus, cone and cylinder to quadratic spline and tensor-product quadratic spline form. The approximation method in [6] consists essentially of quadratic geometric Hermite interpolation. In the present paper we present a geometric Hermite interpolant of any odd degree n and an upper bound on the Hausdorff error. The interpolant has a total number of 2n contacts with the conic; n − 1 at the end-points and 2 at the mid-point. It follows from recent work by Degen [2] that the approximation order is O(h2n ), where h is the maximum length of the parameter intervals, under recursive subdivision. Scherer [9] has recently studied O(h2n ) approximations to general planar curves by polynomials of degree n. The spline approximation, formed by piecing together the sequence of Hermite interpolants, must have Gn−2 continuity since the order of contact at the end points is n − 2. But if the conic is subdivided in the correct (symmetric) way, as in [6], the continuity of the spline is raised to C 1 and Gn−1 , the latter meaning that the spline is C n−1 with respect to arc length. Discussions of both arc length and Frenet frame geometric continuity are given in Dyn & Micchelli [4] and Gregory [7]. Thus this paper serves two purposes; one practical and one theoretical. 1 (1) For small n such as three or five, the approximation provides a very efficient method of converting analytic curves and surfaces to polynomial spline form. (2) The interpolant shows that O(h2n ) Hermite interpolation for planar curves is possible for arbitrarily high n. The technique used to find the Hermite interpolant approximating the conic section r is to use the implicit form of r, namely f (r) = 0, where f is the appropriate bivariate quadratic polynomial. This idea was first introduced by Dokken et al. [3] in their construction of O(h6 ) cubic approximations to the circle. One finds an approximating curve q for which f (q) is small. One then argues that if f (q) is small, then q is ‘close’ to r. How do we construct q to make f (q) small? Lyche & Mørken [8] recently found that for odd n there is a sequence of polynomial approximations in t to a circle at a point. The n-th approximation consists mainly of a geometric series in t2 and is shown to be O(h2n ). The fact that such a sequence exists was the inspiration for our construction of the twopoint (actually three-point) Hermite approximation q. We expand the denominator of r as an asymptotic expansion in the variable a = w − 1, where w is the central weight in the rational form of r, and add a correction term. The fact that one can expand r in terms of a polynomial reveals the advantage of working with the general conic section in rational Bézier form rather than with the specific case of a circle. The cubic circle approximations in [3] involve trigonometric functions rather than polynomials and this probably makes it difficult to generalise them to arbitrary degree. In the framework of the present paper, the conic section is regarded as a generalisation of the parabola rather than the circle. A bound on the Hausdorff distance between the approximant and the conic is found in terms of the maximum of f (q) using the special form of f and its derivatives as a Bézier triangle. At the same time it proved that for a large range of possible r’s — all the elliptic cases and many of the hyperbolic ones — the curve q lies inside the convex hull of the control polygon of r. In a similar way, we can approximate surfaces which are tensor-products of conic sections by tensor-product splines of degree n1 in one parameter and n2 in the other. These have order of approximation O(h2n1 ) in the first parameter direction and O(h2n2 ) in the other. The orders of continuity are Gn1 −1 and Gn2 −1 respectively. Two numerical examples, the approximation of a sphere and torus respectively, show how small the error of the approximation is. We have not derived in this paper a range on w for which q is a regular curve but it is clear that when w is close enough to 1, this is certainly true and it follows that by subdividing, the spline approximation is eventually guaranteed to be regular. The paper is organised in the following way. The Hermite interpolant is presented in Section 2 and at the end a brief derivation of the C 1 and Gn−1 continuity of the resulting spline approximation is provided. The error bound is derived in Section 3. The interpolant and error bound are extended to surfaces in Section 4 and numerical examples are discussed in Section 5. 2 p 1 1 w>1 0 0 w=1 r 0 w<1 p p 0 2 0 0 −2w 2 (p + p ) / 2 0 2 Fig. 1. The conic r in the cases 0<w<1, w=1 and w>1 and the Bézier points of f . §2. The Hermite interpolant We will approximate the rational quadratic Bézier curve r(t) = B0 (t)p0 + B1 (t)wp1 + B2 (t)p2 B0 (t) + B1 (t)w + B2 (t) (1) where p0 , p1 , p2 ∈ IR2 are the control points, w ∈ IR is the weight associated with p1 , assumed positive, B0 (t) = (1 − t)2 , B1 (t) = 2(1 − t)t, B2 (t) = t2 , are the Bernstein basis functions, and t is in the range [0,1]. r is said to be in normal form and it is well known that r is an ellipse when w < 1, a parabola when w = 1 and a hyperbola when w > 1; see Farin [5]. It will help to refer to the curve as r0 when w = 1. Figure 1 shows the various possibilities. The quantity a = w − 1 can be thought of as a measure of the ‘rationality’ of r and will be used in the construction of a Hermite approximation. Let ψ = ψ(t) = 2(1 − w)(1 − t)t so that we can write the denominator of r as 1 − ψ(t). Note that ψ is small when w is close to 1. We can then express r in the more useful form r(t) = J0 (t)p0 + J1 (t)p1 + J2 (t)p2 , where J0 (t) = and of course that P2 i=0 (1 − t)2 , 1 − ψ(t) J1 (t) = 2w(1 − t)t , 1 − ψ(t) J2 (t) = (2) t2 , 1 − ψ(t) (3) Ji = 1. We also define m = (n − 1)/2. Recall from geometric series m−1 X ψi = i=0 1 − ψm . 1−ψ For odd n, n ≥ 3, we shall show that the polynomial curve q, of degree n, q(t) = K0 (t)p0 + K1 (t)p1 + K2 (t)p2 3 (4) where K0 (t) =(1 − t)2 m−1 X i=0 K1 (t) = 2wt(1 − t) K2 (t) =t 2 m−1 X ψi + m−1 X ψi + i=0 (1 − t) m ψ , 1+w ψi + i=0 w ψm , 1+w (5) t ψm , 1+w is a geometric Hermite interpolant to r. Note that if w = 1, then ψ = 0 and q(t) = r(t) = r0 (t). Note also that, for all w, q(0) = r(0) = p0 and q(1) = r(1) = p2 . Why have we chosen q to have this particular form? Using the fact that one can write the denominator of r in (1) as 1 − ψ(t), one can expand, for example, J0 (t) as a series in ψ: (1 − t)2 J0 (t) = = (1 − t)2 (1 + ψ + ψ 2 + ψ 3 · · ·). (1 − ψ) So the first term of K0 (t) is a truncation of this series up to the term ψ m−1 . This is as high as one can go without exceeding degree n = 2m + 1 since ψ has degree two. This expansion makes the difference q(t) − r(t) small. The remaining terms in the Ki were chosen in such a way that the Hausdorff distance between q and r is even smaller. We regard these extra terms as ‘correction’ terms. In what follows, we will need to consider the implicit form of a conic section. Any point (x, y) ∈ IR2 can be written uniquely in terms of barycentric coordinates τ0 , τ1 , τ2 , where τ0 + τ1 + τ2 = 1, with respect to the triangle △p0 p1 p2 : (x, y) = τ0 p0 + τ1 p1 + τ2 p2 . Consequently any function f : IR2 → IR can be expressed as a function of τ0 , τ1 , τ2 . The following lemma is well known and is given, for example, in Farin [5]. In fact it is immediate from (2) and (3) since the Ji are barycentric coordinates for r and J12 (t)−4w2 J0 (t)J2 (t) = 0. Lemma 2.2. Let f : IR2 → IR be defined as f (x, y) = τ12 − 4w2 τ0 τ2 . Then the curve r satisfies the equation f (r(t)) = 0 for all t. Figure 1 depicts f in Bézier form. At this point we observe that the Ki have been chosen so that they sum up to one. Indeed, from (3) one can rewrite them as K0 (t) = J0 (t)(1 − ψ m ) + α0 ψ m , K1 (t) = J1 (t)(1 − ψ m ) + α1 ψ m , K2 (t) = J2 (t)(1 − ψ m ) + α2 ψ m , in which α0 (t) = 1−t , 1+w α1 (t) = 4 w , 1+w α2 (t) = (6) t . 1+w (7) P P P Therefore, since Ji = αi = 1, we find that Ki = 1. This is convenient because it means that the Ki are barycentric coordinates for q and so from Lemma 2.2, f (q(t)) = K12 (t) − 4w2 K0 (t)K2 (t), (8) which is a polynomial of degree 2n. Now it remains to simplify the right-hand side of (8) in order to factorize f (q(t)). Lemma 2.3. The polynomial f (q(t)) can be factorized as f (q(t)) = w2 w2 2 2m n−1 (2t − 1) ψ (t) = 2 (w − 1)n−1 (1 − t)n−1 tn−1 (2t − 1)2 . (1 + w)2 (1 + w)2 Proof. Substituting the expressions in (6) into the right-hand side of (8) leads to f (q) = (J12 − 4w2 J0 J2 )(1 − ψ m )2 + (2J1 α1 − 4w2 (J0 α2 + J2 α0 ))(1 − ψ m )ψ m + (α12 − 4w2 α0 α2 )ψ 2m . The first term is zero from Lemma 2.2 and the second is zero due to the particular choice of the αi . As a consequence, f (q(t)) = (α12 (t) − 4w2 α0 (t)α2 (t))ψ 2m (t) = w2 (2t − 1)2 ψ 2m (t), (1 + w)2 as claimed. ⊳ It follows that q is a geometric Hermite approximation to r. The curve q has a total number of 2n contacts with r since the equation f (q(t)) = 0 has 2n roots inside [0, 1]. In fact, the two curves meet at three values of t: 0, 1/2, 1. To see that q(1/2) = r(1/2), a short calculation reveals that J0 (1/2) = J2 (1/2) = α0 (1/2) = α2 (1/2) = 1/2(1 + w) and J1 (1/2) = α1 (1/2) = w/(1 + w), so that from (6), Ki (1/2) = Ji (1/2), for i = 0, 1, 2. Notice that when n = 3, the polynomial f (q(t)) has degree six and two zeros at each of the values t = 0, 1/2, 1. In the special case when r is a circle, this must be a constant multiple of the polynomial found in [3]. This means that the approximation q can be regarded as a generalisation of the first cubic approximation in [3] to both conic sections and for general odd degree n. Notice also that f (q(t)) is non-negative for any n and t, which implies that q always lies to one side of r, in fact the side closest to the point p1 . Continuity of the spline approximation. By recursively subdividing r, using the scheme discussed in [6], and applying the Hermite approximation to each subcurve, one obtains a spline approximation. The unusual aspect of this spline curve is that its continuity is higher than expected, namely C 1 and Gn−1 due to the symmetry inherent in r and the subdivision scheme. Briefly, r can be affinely mapped into r̂, either a circle or an equilateral hyperbola, symmetric about the x-axis [6]. Then the two subcurves r̂1 , r̂2 , are symmetries of each 5 other. Using the facts: (a) that q, the spline approximation to r̂, consisting of the two Hermite approximations, is symmetric about the x-axis, (b) that q is Gn−2 , and (c) that n − 2 is odd, one can deduce that q is both C 1 and Gn−1 . Since parametric and geometric continuity are invariant under affine transformations, it follows that the spline approximation to r inherits the same orders of continuity. The same argument applies to any depth of subdivision. In fact, we can reparametrize this symmetric q with respect to arc length s and write q(s) = (x(s), y(s)), for s > 0, and q(s) = (x(−s), −y(−s)), for s < 0. Then, using the Leibnitz rule, one differentiates the equation q′ (s).q′ (s) = 1, n − 2 times and, since q has all derivatives up to n − 2 at s = 0, one obtains (q(n−1) (0+) − q(n−1) (0−)) . q′ (0) = 0. But q′ (0+) = (x′ (0), y ′ (0)) and q′ (0−) = (−x′ (0), y ′ (0)) mean that q′ (0) = (0, y ′ (0)). Therefore (q(n−1) (0+) − q(n−1) (0−)) . e2 = 0, (9) where e2 = (0, 1). Now differentiating q(s) in the two cases s > 0, s < 0 we also find, since n − 1 is even, that q(n−1) (0+) = (x(n−1) (0), y (n−1) (0)) and q(n−1) (0−) = (x(n−1) (0), −y (n−1) (0)) and so q(n−1) (0+) − q(n−1) (0−) = (0, 2y (n−1) (0)), from which it follows that q(n−1) (0+) − q(n−1) (0−) . e1 = 0, (10) where e1 = (1, 0). Finally, (9) and (10) imply that q(n−1) (0+) − q(n−1) (0−) = 0 and that q is Gn−1 at s = 0. That q is C 1 with respect to t, is an immediate consequence of the symmetry coupled with the fact that q is G1 . §3. The error bound In order to implement the Hermite interpolation in practice it is important to have a bound on the error of approximation. In this paper we are not concerned with the usual type of approximation of the form q(t) ≈ r(t). Instead we wish to bound the Hausdorff distance discussed by Degen [1], ¡ ¢ dH (q, r) = max d1 (q, r), d2 (q, r) , where the two one-sided distances are d1 (q, r) = max min |q(s) − r(t)|. t∈[0,1] s∈[0,1] and d2 (q, r) = max min |q(s) − r(t)|. s∈[0,1] t∈[0,1] The main theorem in this section is the following. 6 Theorem 3.1. If 0 < w ≤ 3 then max(1, w2 ) (w − 1)n−1 1 dH (q, r) ≤ (1 + w)2 2n+1 n µ ¶n−1 1 1− |p0 − 2p1 + p2 |. n The two salient features in the bound are the terms (w − 1)n−1 and |p0 − 2p1 + p2 |. In a previous paper [6] it was shown, using a particular recursive subdivision scheme for r, consisting of alternately subdividing at the mid-point and normalising each subcurve, that the quantity a = w − 1 is O(h2 ). It was further shown that the quantity |p0 − 2p1 + p2 |, essentially a second order difference, is also O(h2 ). It follows that the error bound above is O(h2n ), which is of the same order as the approximation itself. It is also interesting to point out that considerable reduction in the error can be made purely by increasing n, while leaving a fixed, especially if a is already small. Indeed with the proviso that |a| < 2, we see that dH (q, r) converges to zero as n tends to infinity with order O((a/2)n−1 /n). The remainder of this section is devoted to proving the theorem. The first element in this direction is a general lemma concerning any continuous curve p, of which q is a specific example. By consdering the direction p0 − 2p1 + p2 , we bound the distance between r and p in terms of the maximum of |f (p(t))|. Since f is quadratic, it may in general have two zeros along any straight line. In order to make sure we are close to the right one we have to restrict p to being inside the triangle △p0 p1 p2 . Lemma 3.2. Suppose that p : [0, 1] → IR2 is any continuous curve which lies entirely inside the (closed) triangle △p0 p1 p2 and such that p(0) = p0 and p(1) = p2 . Then µ ¶ 1 1 , 1 max |f (p(t))| |p0 − 2p1 + p2 |. dH (p, r) ≤ max 4 w2 t∈[0,1] Proof. Let t ∈ [0, 1] and consider the (infinite) straight line l passing through the point r(t), parallel to the vector −p0 + 2p1 − p2 . We know that p(0) = p0 , p(1) = p2 and that the curve p is continuous. Because p0 and p2 lie on opposite sides of l, it immediately follows that p must intersect it at some point p(s), for some s ∈ [0, 1], though not necessarily uniquely. Similarly, given s ∈ [0, 1], there is a straight line l passing through the point p(s), and there must also be a corresponding (unique in this case) t ∈ [0, 1] such that r(t) lies on the line l, since p is inside △p0 p1 p2 . From these observations and the definition of the metric dH , we see that dH (p, r) is bounded by the maximum of the furthest distance between p and r along all lines parallel with −p0 + 2p1 − p2 . Now suppose that r(t) and p(s) lie on the same line l, parallel with −p0 + 2p1 − p2 . From now on we assume that t ≤ 1/2 since a similar argument is applicable to the remaining cases. First of all, since one can write r in the form r(t) = (J0 (t) − J2 (t))p0 + J1 (t)p1 + 2J2 (t)c, where c = (p0 + p2 )/2 it follows that the point r(t) lies in △p0 p1 c since J0 (t) − J2 (t) = (1 − t)2 − t2 1 − 2t = ≥ 0. 1 − ψ(t) 1 − ψ(t) 7 In order to find out where the line l intersects the edges of the triangle write r(t) in the form r(t) = (1 − ξ1 )((1 − u)p0 + uc) + ξ1 ((1 − u)p0 + up1 ), and by comparing coefficients one finds that u = 1 + J2 (t) − J0 (t) and ξ1 = J1 (t)/(1 + J2 (t) − J0 (t)). With these values, the line intersects the edge p0 c at the point p3 = (1 − u)p0 + uc, and intersects the edge p0 p1 at the point p4 = (1 − u)p0 + up1 . Now consider g : [0, 1] → IR, the restriction of f to the line segment p3 p4 : g(ξ) = f ((1 − ξ)p3 + ξp4 ). The values of g at 0 and 1 can easily be evaluated by evaluating f as a quadratic Bézier curve along edges p0 c and p0 p1 respectively. Indeed g(0) = −(2 − u)uw2 , and g(1) = u2 . By restricting f to the the segment cp1 , and then computing the second derivative along it we also see that when p3 = c and p4 = p1 (i.e. u = 1), g ′′ (ξ) = 2(1 − w2 ). Using the fact that any directional second derivative of f is constant, one can then readily verify that in general g(ξ) = −(1 − ξ)2 w2 u(2 − u) − 2(1 − ξ)ξw2 u(1 − u) + ξ 2 u2 . Therefore, ¡ ¢ g ′ (ξ) = 2u (1 − ξ)w2 + ξ(u + w2 (1 − u)) . As a consequence, g ′ (ξ) ≥ 2u min(w2 , 1) for all ξ ∈ [0, 1] and g is monotonically increasing. Therefore, recalling that r(t) = (1 − ξ1 )p3 + ξ1 p4 and that f (r(t)) = 0, we must have that g(ξ1 ) = 0 and g(ξ) < 0 for 0 ≤ ξ < ξ1 and g(ξ) > 0 for ξ1 < ξ ≤ 1. But since p(s) lies on the line l and p lies inside △p0 p1 p2 , there must exist ξ2 ∈ [0, 1] such that p(s) = (1 − ξ2 )p3 + ξ2 p4 . 8 p 1 q(t) r(t) r (t) q(t) 0 1<w<=3 0<w<1 r(t) p p 2 0 (p + p ) / 2 0 2 Fig. 2. Where the points r(t) and q(t) are in relation to r0 (t) in the cases 0<w<1 and 1<w≤3. There are two possible cases: ξ2 ≥ ξ1 and ξ2 ≤ ξ1 . In the first, observe that Z ξ2 g ′ (ξ) dξ ≥ 2u min(w2 , 1)(ξ2 − ξ1 ), g(ξ2 ) = g(ξ2 ) − g(ξ1 ) = ξ1 while in the second, −g(ξ2 ) = g(ξ1 ) − g(ξ2 ) = Z ξ1 ξ2 g ′ (ξ) dξ ≥ 2u min(w2 , 1)(ξ1 − ξ2 ). In either case, 1 |ξ2 − ξ1 | ≤ max 2u or in other words But µ |p(s) − r(t)| 1 ≤ max |p4 − p3 | 2u ¶ 1 , 1 |g(ξ2 )|, w2 µ |p4 − p3 | = u|p1 − c| = ¶ 1 , 1 |f (p(s))|. w2 u |p0 − 2p1 + p2 | 2 implies that 1 |p(s) − r(t)| ≤ max 4 µ ¶ 1 , 1 |f (p(s))| |p0 − 2p1 + p2 |, w2 and hence the required estimate follows by taking the maximum over s. ⊳ In order to apply Lemma 3.2 to the curve q we will require that q lies entirely inside the triangle △p0 p1 p2 . The following two lemmas show that this is the case when r is elliptic and in many of the hyperbolic cases too (0 < w ≤ 3). For w > 3, it is not surprising that q is badly behaved since then |ψ(1/2)| > 1 and the series in the Ki are divergent as n → ∞ (numerical examples were run to confirm this; as one increases w beyond 3, parts of the approximation curve move outside the triangle and convexity is lost even though r always remains inside). We show in addition that q lies entirely on the same side of the parabola r0 as r, in the two cases, 0 < w < 1 and 1 < w ≤ 3. Figure 2 illustrates the various possibilities. 9 Lemma 3.3a. If 0 < w < 1 (i.e. all the elliptic cases) then the curve q lies inside the (closed) triangle △p0 p1 p2 . Furthermore, if the triangle is considered to be split into two halves by the curve r0 then q (like r) lies in the half not containing p1 . Proof. To show the first statement it is necessary to show that K0 (t), K1 (t), and K2 (t) are all non-negative for t ∈ [0, 1]. This is a trivial consequence of their definition in (5) since ψ > 0. Due to the convexity of r0 , the second statement holds if K0 (t) ≥ (1 − t)2 and K2 (t) ≥ t2 . This is also self-evident from (5) since K0 can be written as the sum of (1 − t)2 and positive quantities and likewise K2 can be written as the sum of t2 and positive quantities. ⊳ The hyperbolic case is a little more tricky. We found that there is a relatively easy proof for Lemma 3.3b, by induction on n, due to some recursive identities. To indicate the dependency of the Ki on n in (5) we write Ki,n . Then the identities are K0,n = (1 − t)2 + ψK0,n−2 , K1,n = 2wt(1 − t) + ψK1,n−2 , (11) K2,n = t2 + ψK2,n−2 , which hold for n = 5, 7, 9, . . . and follow easily from definition (5). Notice that these also demonstrate that the L∞ limit of Ki,n as n → ∞ is Ji as long as 0 < w < 3. In fact, Ki,n − Ji = ψ(Ki,n−2 − Ji ), which means that kKi,n − Ji k∞ → 0 as n → ∞ because |ψ(t)| ≤ |ψ(1/2)| = |1 − w|/2 < 1. Lemma 3.3b. If 1 < w ≤ 3 (r is hyperbolic) then the curve q lies inside the triangle △p0 p1 p2 . Furthermore, if the triangle is considered to be split into two halves by the curve r0 then q (like r) lies in the half containing p1 . Proof. As before, the first statement is equivalent to the condition that K0 (t), K1 (t), and K2 (t) are all non-negative for t ∈ [0, 1]. Meanwhile, since r0 is convex, the second statement holds if K0 (t) ≤ (1 − t)2 and K2n (t) ≤ t2 . Thus it is sufficient to show that 0 ≤ K0 (t) ≤ (1 − t)2 and 0 ≤ K2 (t) ≤ t2 since this immediately implies that K1 (t) = 1 − K0 (t) − K2 (t) ≥ 2(1 − t)t ≥ 0. Consider the first case, n = 3. Because 1 < w ≤ 3 and t ≤ 1, µ ¶ µ ¶ 2(w − 1)t 2(w − 1) (3 − w) 2 K0,3 (t) = 1 − (1 − t) ≥ 1 − (1 − t)2 = (1 − t)2 ≥ 0. 1+w 1+w (1 + w) The non-negativity of K2,3 is demonstrated in a similar way. Furthermore, the negativity of ψ implies that K0,3 (t) ≤ (1 − t)2 and K2,3 (t) ≤ t2 . We prove the hypothesis for n = 5, 7, 9, . . . by induction, applying (11) and observe that ψ < 0. Suppose the hypothesis of the lemma holds when n is replaced by n − 2. Now, since ψ < 0 and K0,n−2 (t) ≥ 0, it is clear that K0,n (t) ≤ (1 − t)2 . In a similar way one 10 finds that K2,n (t) ≤ t2 . On the other hand, since w ≤ 3 and K0,n−2 (t) ≤ (1 − t)2 , one finds that K0,n (t) ≥ (1 − t)2 − 4(1 − t)t(1 − t)2 = (1 − t)2 (1 − 2t)2 ≥ 0. Similarly, K2,n (t) ≥ t2 − 4(1 − t)t.t2 = t2 (1 − 2t)2 ≥ 0, and this completes the induction step. ⊳ It remains to get an upper bound on the polynomial f (q(t)). This bound is valid for all w and follows directly from Lemma 2.3. Lemma 3.4. For all t ∈ [0, 1], w2 (w − 1)n−1 1 0 ≤ f (q(t)) ≤ (1 + w)2 2n−1 n µ 1 1− n ¶n−1 . Proof. Let F (t) = (1 − t)m (2t − 1)tm . We find the maximum and minimum of F over t in the range [0, 1]. Indeed, ¡ ¢ F ′ (t) =(1 − t)m−1 tm−1 − mt(2t − 1) + m(1 − t)(2t − 1) + 2(1 − t)t ¡ ¢ = − (1 − t)m−1 tm−1 (4m + 2)t2 − (4m + 2)t + m . p So F ′ (t) = 0√implies that t = ti = 1/2 ± 1/ 2(4m + 2), i = 1, 2. But n = 2m + 1, so ti = (1 ± 1/ √n)/2. Further, t2 = 1 − t1 , and therefore (1 − ti )ti = (1 − 1/n)/4. Also 2ti − 1 = ±1/ n and so 1 1 F (ti ) = ± m √ (1 − )m . n 4 n The maximum of f (q)) occurs at one of the values ti and since f (q(t)) = 2n−1 w2 (w − 1)n−1 F 2 (t), (1 + w)2 the lemma is complete. ⊳ Finally, we combine Lemmas 3.2, 3.3, and 3.4 to prove Theorem 3.1. Proof of Theorem 3.1. For 0 < w ≤ 3, Lemmas 3.3a, 3.3b show that q lies inside △p0 p1 p2 . Then we may apply Lemma 3.2 to get µ ¶ 1 1 , 1 max |f (q(t))| |p0 − 2p1 + p2 |. dH (q, r) ≤ max 4 w2 t∈[0,1] So from Lemma 3.4, we find max(1, w2 ) (w − 1)n−1 1 dH (q, r) ≤ (1 + w)2 2n+1 n as claimed. ⊳ 11 µ ¶n−1 1 |p0 − 2p1 + p2 |, 1− n §4. Approximation of surfaces In this section we show how one can, in a similar way, also approximate the rational tensor-product biquadratic Bézier surface P2 P2 j=0 Bi (u)Bj (v)wij pij i=0 , (12) r(u, v) = P2 P2 B (u)B (v)w i j ij j=0 i=0 with pij ∈ IR3 , provided that w00 wij = wi0 w0j . Assuming (13), we can first reparametrize r in such 1 w2 [wij ] = w1 w1 w2 1 w2 (13) a way that the new weights are 1 w1 , 1 and we can then re-express r in the form r(u, v) = 2 2 X X Ji,w1 (u)Jj,w2 (v)pij . i=0 j=0 Here the subscripts w1 and w2 indicate the obvious dependency of the Ji on w in (3). The geometric Hermite interpolant is then the tensor-product polynomial surface q(u, v) = 2 2 X X Ki,n1 ,w1 (u)Kj,n2 ,w2 (v)pij . i=0 j=0 We now analyse the Hausdorff distance between these surfaces. In order to use the error bound already developed in the curve case, we make the definition µ ¶n−1 max(1, w2 ) (w − 1)n−1 1 1 E(w, n) = 1− . (14) (1 + w)2 2n+1 n n Let p : Ω → IR3 and q : Ω → IR3 be any pair of continuous surfaces defined on the unit square Ω = [0, 1] × [0, 1]. The Hausdorff distance is then ¡ ¢ dH (p, q) = max d1 (p, q), d2 (p, q) , where the two one-sided distances are d1 (p, q) = max min |p(u1 , v1 ) − q(u2 , v2 )|. (15) max min |p(u1 , v1 ) − q(u2 , v2 )|. (16) (u2 ,v2 )∈Ω (u1 ,v1 )∈Ω and d2 (p, q) = (u1 ,v1 )∈Ω (u2 ,v2 )∈Ω Now consider the following lemma. 12 Lemma 4.1. The Hausdorff distance between p and q is bounded by the Hausdorff distances between corresponding isoparametric curves in either variable: dH (p, q) ≤ max dH (p(·, v), q(·, v)), and v dH (p, q) ≤ max dH (p(u, ·), q(u, ·)). u Proof. It follows from definition (15) that d1 (p, q) = max max min min |p(u1 , v1 ) − q(u2 , v2 )|. u2 v2 u1 v1 ≤ max max min |p(u1 , v) − q(u2 , v)|. v u2 u1 = max d1 (p(·, v), q(·, v)). v So the (one-sided) distance of p from q is bounded by the maximum of the distances of corresponding isoparametric curves in the first parameter. A similar inequality relates the distance (d2 ) of the second surface from the first and taking the maximum of these yields dH (p, q) ≤ max dH (p(·, v), q(·, v)). v The same argument applies to isoparametric curves in the second parameter. ⊳ Now let a1 = w1 − 1 and a2 = w2 − 1. Lemmas 3.3 and 4.1 and Theorem 3.1 are used to prove the following. Recall the definition of E in (14). Theorem 4.2. If 0 < w1 ≤ 3 and 0 < w2 ≤ 3, then dH (q, r) ≤ E(w1 , n1 ) max |p0,j − 2p1,j + p2,j | + E(w2 , n2 ) max |pi,0 − 2pi,1 + pi,2 |. j=0,1,2 i=0,1,2 Proof. We define the intermediate surface g : Ω → IR3 as g(u, v) = 2 2 X X Ji,w1 (u)Kj,n2 ,w2 (v)pij . i=0 j=0 Since dH is a metric, we may use the triangle inequality, dH (q, r) ≤ dH (q, g) + dH (g, r). Now it follows from Lemma 4.1 that dH (q, g) ≤ max dH (q(·, v), g(·, v)). v But for all v, q(u, v) = 2 X Ki,n1 ,w1 (u)qi (v), and i=0 g(u, v) = 2 X i=0 13 Ji,w1 (u)qi (v), where qi (v) = 2 X Kj,n2 ,w2 (v)pij . j=0 Therefore both curves q(·, v) and g(·, v), share the same three control points and central weight. So we can apply Theorem 3.1 with 0 < w1 ≤ 3. Further, Lemmas 3.3a and 3.3b show that when 0 < w2 ≤ 3, the basis {Kj,n2 ,w2 } forms a partition of unity. Thus dH (q, g) ≤E(w1 , n1 )|q0 (v) − 2q1 (v) + q2 (v)|, ≤E(w1 , n1 ) max |p0,j − 2p1,j + p2,j |. (17) j=0,1,2 It is a standard fact that the basis {Ji,w1 } forms a partition of unity whenever w > 0. By considering isoparametric curves in v (fixed u), and applying Theorem 3.1 with 0 < w2 ≤ 3, we then find similarly that dH (g, r) ≤ E(w2 , n2 ) max |pi,0 − 2pi,1 + pi,2 |, i=0,1,2 (18) and the theorem follows from the triangle inequality. ⊳ It is clear from this bound that by recursively subdividing and normalising r in either parameter direction as in [6], we can approximate it by a spline q(u, v), whose order of approximation is O(h2n1 ) in u and O(h2n2 ) in v. After each subdivision, the greater of the two error bounds (17) and (18) can be used to determine the parameter direction in which to subdivide next. The approximant will also be C 1 and Gn1 −1 in each isocurve in the u parameter and C 1 and Gn2 −1 in each isocurve in the v parameter. §5. Numerical examples In order to express the approximant as a C 1 uniform spline we derived the Bézier form for the Hermite interpolant q in (4). It is sufficient to express K0 in Bernstein form and, by degree raising each ψ i to degree n, writing a = w − 1, and recalling that n = 2m + 1, this turns out to be n µ ¶ X n j t (1 − t)n−j kj,0 , K0 (t) = j j=0 where kj,0 P ´ ³ ´ ³ j i n−2i−2 / nj (−2a) i=0 j−i ´ ´ ¡ ¢ ³ ³Pm−1 n m i n−2i−2 + (−2a) /(2 + a) / m (−2a) i=0 m−i = ´ ³ ´ ³ Pn−j−2 i n−2i−2 / nj (−2a) j−i i=0 0 for j = 0, . . . , m − 1, for j = m, for j = m + 1, . . . , n − 2, for j = n − 1, n. If the Bernstein coefficients of K1 (t) and K2 (t) are kj,1 and kj,2 respectively, then clearly kj,2 = kn−j,0 and kj,1 = 1 − kj,0 − kj,2 . From this, one computes the Bézier points 14 Fig. 3. Approximation of sphere Fig. 4. Approximation of torus. of q. Since the spline curve approximations are C 1 , one can simply remove the common Bézier points where segments meet; the remaining ones are the spline control points. The difference between each two adjacent distinct knots is equal and each internal knot has multiplicity n − 1. The surface approximations can be put into spline form by applying first the conversion from the Ki ’s to Bernstein form in one parameter direction, followed by a conversion in the other. The approximation scheme was applied to the standard NURBS representation for the unit sphere. In this representation there are eight patches of the form r in (12) and (13) holds in each √ case. For example, the surface r representing the first octant has weights w1 = w2 = 1/ 2 and control points (1, 0, 0) (1, 0, 1) (0, 0, 1) [pij ] = (1, 1, 0) (1, 1, 1) (0, 0, 1) . (0, 1, 0) (0, 1, 1) (0, 0, 1) We subdivided r twice in each variable and computed the tensor-product Hermite interpolant q for each subpatch, using degree n1 = n2 = 7. The upper bound in Theorem 4.2 on the Hausdorff error was found to be 4 × 10−16 . This illustrates how simple the method is to implement even for high degrees. By piecing together the spline approximations for each of r’s eight patches, one obtains a single spline approximation, whose patches are depicted in Figure 3, for the whole unit sphere. Due to symmetry, similar to [6], the continuity of the whole approxmant is G6 along all isocurves. Note that each isocurve in Figure 3 is itself a G6 curve approximation of degree seven to a unit circle. In practice one would probably choose n = 3 or n = 5 since polynomials of high degree are slow to display and manipulate. The surface in Figure 4 shows a bicubic approximant (n1 = n2 = 3) to a torus of overall diameter 1, with outer radius 3/8 and inner radius 1/8. Here, the approximant has one patch corresponding to each of the eight patches of the torus in standard rational biquadratic representation, i.e. there were no subdivisions. The figure shows extra isocurves. The continuity is G2 in each parameter direction and the error bound in this case is 0.00025. 15 §6. Conclusion An O(h2n ) Hermite interpolant to a rational quadratic Bézier curve has been presented. A precise bound on the Hausdorff error has also been derived. The interpolant has very desirable properties: it has almost maximum order of contact at the end-points, making the spline approximation very smooth; yet it has tangential contact at the mid-point, making the error very small. For small n such as three or five, the approximation and error bound provide the basis for a conversion algorithm, converting analytic curves and surfaces to spline form. The interpolant also shows that global O(h2n ) Hermite interpolation for planar curves is possible for arbitrarily high n. It may be possible to find explicit geometric Hermite interpolants for arbitary rational Bézier curves, based on the ideas discussed here. Firstly, any rational Bézier curve can be put in implicit form. Secondly, assuming standard form, the denominator can always be written as the sum of 1 and a polynomial which will be small when the weights are close to 1. This means that an expansion of the kind in (5) is possible. The difficulty would be choosing the right correction terms, analogous to the αi in (7), in order to factorize f (q(t)) or at least sufficiently reduce |f (q(t))| to again obtain O(h2n ). §7. References 1. Degen, W., Best approximations of parametric curves by splines, in Mathematical Methods in CAGD, T. Lyche & L. L. Schumaker (eds.), Academic Press, Boston (1992), 171–184. 2. Degen, W., High accurate rational approximation of parametric curves, ComputerAided Geom. Design 10 (1993), 293–313. 3. Dokken, T., M. Dæhlen, T. Lyche & K. Mørken, Good approximation of circles by curvature-continuous Bézier curves, Computer-Aided Geom. Design 7 (1990), 33–41. 4. Dyn, N. & C. A. Micchelli, Piecewise polynomial spaces and geometric continuity of curves, Numer. Math. 54 (1988), 319–337. 5. Farin, G., Curves and surfaces for computer aided geometric design, Academic Press, San Diego, 1988. 6. Floater, M. S., High order approximation of conic sections by quadratic splines, Computer-Aided Geom. Design 12 (1995), 617–637. 7. Gregory, J. A., Geometric continuity, in Mathematical Methods in CAGD, T. Lyche & L. L. Schumaker (eds.), Academic Press, Boston (1989), 353–371. 8. Lyche, T. & K. Mørken, A metric for parametric approximation, in Curves and Surfaces in Geometric Design, P. J. Laurent, A. Le Méhauté, and L. L. Schumaker (eds.), A K Peters, Wellesley, MA (1994), 311–318. 9. Scherer, K., O(h2n ) approximation by piecewise polynomial curves of degree n in the plane, preprint. 16

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertisement