Computer-Aided Design 38 (2006) 703–712 www.elsevier.com/locate/cad
Cone spline approximation via fat conic spline fitting Xunnian Yang *, Weiping Yang Department of Mathematics, Zhejiang University, Yuquan, Hangzhou 310027, People’s Republic of China Received 20 November 2005; accepted 3 March 2006
Abstract Fat conic section and fat conic spline are defined. With well established properties of fat conic splines, the problem of approximating a ruled surface by a tangent smooth cone spline can then be changed as the problem of fitting a plane fat curve by a fat conic spline. Moreover, the fitting error between the ruled surface and the cone spline can be estimated explicitly via fat conic spline fitting. An efficient fitting algorithm is also proposed for fat conic spline fitting with controllable tolerances. Several examples about approximation of general developable surfaces or other types of ruled surfaces by cone spline surfaces are presented. q 2006 Elsevier Ltd. All rights reserved. Keywords: Cone spline; Fat conic spline; Ruled surface; Developable surface; Approximation
1. Introduction Developable surface is a kind of ruled surface that can be mapped to a plane isometrically. From the viewpoint of differential geometry, developable surfaces are composed of general cylinders, general cones, tangent surface of a spatial curve or a composition of these types of surfaces [1]. With well established properties, developable surfaces find wide applications in shape modeling and manufacturing with nonstretchable material such as paper, leather and steel, etc. [2–7]. Within the types of developable surfaces, cones of revolution and cone spline of revolution are of special interests. These surfaces can be represented in parametric form as well as algebraic form. The offsets are the same type of the original surfaces and the development of a cone of revolution into a plane is elementary. Besides developable surfaces, general types of ruled surfaces play important roles in geometric modeling and shape optimization too. With more degrees of freedom, they can be used to approximate a set of measured data [8,9] or can be used as intermediate approximation to double curved surfaces [10,11]. The main goal of this paper is focusing on the approximation of a ruled surface by a cone spline within prescribed tolerances. * Corresponding author. Tel.: C86 571 87951609. E-mail address:
[email protected] (X. Yang).
0010-4485//$ - see front matter q 2006 Elsevier Ltd. All rights reserved. doi:10.1016/j.cad.2006.03.001
To incorporate developable surfaces into a CAD/CAM system, many researches have been devoted to the representation of developable surfaces in Be´zier or B-spline forms. Aumann [12] and Lang and Ro¨schel [13] derived sufficient conditions when a tensor product Be´zier surface is developable. Because the tangent plane at every point on a generator of a developable surface are the same, then the developable surface is also the envelope of the set of tangent planes along all generators. With this property, the definition of a developable surface is equivalent to the computation of a curve in duality space. Bodduluri and Ravani [14], Pottmann and Farin [15] have studied developable B-spline surface and developable rational B-spline surfaces using duality methods. The approximation of a given surface by a developable Be´zier or B-spline surface have important application in shape modeling and manufacturing. By representing the fitted planes or points in projective space, Hoscheck and Pottmann [16], Pottmann and Farin [13] presented several methods for developable surface fitting. These methods can be applied easily, but the fitting error cannot be controlled efficiently. Pottmann and Wallner [17] have designed an approximation algorithm under a proper metric in projective space. Recently, Park et al. [18] proposed an optimal control algorithm for developable surface design with which the base curve has to be solved when the directions of the rules are given. For the purpose of fabrication, ruled surfaces or a general type of developable surfaces are preferred to be approximated by cone spline surfaces or planes. Aumann [2] and Elber [11] proposed to approximate a skew ruled surface by a set of triangles. Though the fitting error can be controlled, but
704
X. Yang, W. Yang / Computer-Aided Design 38 (2006) 703–712
the approximating surfaces are not smooth any more. Leopoldseder and Pottmann [19], Leopoldseder [20,21] have developed several interesting algorithms for approximating general types of developable surfaces with cone splines. The algorithms compute the fitting cones using either a Hermite like interpolation technique or space arc spline method. However, this method cannot be extended for the approximation of general types of ruled surfaces directly. In this paper, we propose an efficient new algorithm for ruled surface approximation with cone splines. Inspired by plane curve approximation with conic splines [22–24], we show that the problem of cone spline approximation can be changed as fat conic spline fitting. For a ruled surface bounded by two parallel planes, when it is projected onto one of these two paralleling planes, we will then obtain a planar fat curve, of which the boundaries are just the projection of the surface boundaries. Similarly, the boundaries of cone spline between two paralleling planes are two conic splines, and the projection of the cone spline is a fat conic spline. Moreover, the fat conic spline can be represented as piecewise rational surfaces and the control polygons of two boundary conic splines are piecewise parallel. As discussed in the following text, the approximation of a planar fat curve by a fat conic spline can be implemented efficiently and the fitting error between two surfaces can be estimated by these two planar fat curves. Finally, the fitting cone spline can be obtained by elevating the boundaries of the fat conic spline onto the original two parallel planes, respectively. The organization of the paper is as follows. In Section 2, we will give the definition of fat conic arc and fat conic spline. In Section 3, we will present the approximation algorithm. The fitting error will be analyzed in Section 4. Some numerical examples are presented in Section 5 and we conclude the paper in Section 6.
2. Fat conic arc It is well known that a conic section is the intersection curve between a plane and a cone of revolution (see Fig. 1). The conic
section can be an ellipse, a parabola or a hyperbola according to the position that the plane lie with respect to the cone. In the field of computer-aided design, a conic segment can be represented as one or several pieces of rational quadratic Be´zier curves and on the contrary any rational quadratic Be´zier curve is a conic segment [25,26]. Within this paper, we mean the conic segment by a standard rational quadratic Be´zier curve RðtÞ Z
R0 B0;2 ðtÞ C R1 wB1;2 ðtÞ C R2 B2;2 ðtÞ ; B0;2 ðtÞ C wB1;2 ðtÞ C B2;2 ðtÞ
where Ri(iZ0,1,2) are the control points of the Be´zier curve, Bi;2 ðtÞZ C2i ti ð1KtÞ2Ki are the Bernstein basis functions of the curve. Even more, the positive weight w can be used to characterize the conic type, the curve is a segment of parabola when the weight wZ1, and the curve is a segment of ellipse or a segment of hyperbola when w is less than or greater than 1, respectively. Even more, when the control polygon R0R1R2 is an isosceles triangle and wZcos q where qZ:R0R1R2, then the quadratic rational Be´zier curve is a circular arc. In a similar way as the definition of a conic section, we can now define a fat conic arc geometrically. At first, we can intersect a cone of revolution by two parallel planes, then we have two conic sections on the paralleling planes (see Fig. 2). Let the two conic segments between the two planes and two rulings on the cone be PðtÞ Z
P0 B0;2 ðtÞ C P1 wB1;2 ðtÞ C P2 B2;2 ðtÞ ; B0;2 ðtÞ C wB1;2 ðtÞ C B2;2 ðtÞ
t 2½0; 1
(1)
and QðtÞ Z
Q0 B0;2 ðtÞ C Q1 wB1;2 ðtÞ C Q2 B2;2 ðtÞ ; B0;2 ðtÞ C wB1;2 ðtÞ C B2;2 ðtÞ
t 2½0; 1;
(2)
respectively, then the cone surface between the two paralleling planes can be represented as a rational Be´zier surface c(s,t)Z (1Ks)P(t)CsQ(t). When we project the rational Be´zier surface onto one of the paralleling planes, we obtain a fat conic arc on the plane (see Fig. 3). For the efficiency of fat conic arc fitting,
parabola
ellipse hyperbola
Fig. 1. Conic section.
t 2½0; 1
Fig. 2. Fat conic section.
X. Yang, W. Yang / Computer-Aided Design 38 (2006) 703–712
q1 q0
p0
q2 p1
p2
Fig. 3. Control mesh of a fat conic arc.
in this paper we consider only the case that P(t) and Q(t) lie at just one side of the apex of the cone. Without loss of generality, we assume that the projection plane is just the xy-plane. When the rational Be´zier surface c(s,t) has been projected onto the plane, the projected area is bounded by two conic sections p(t), q(t) and two lines p0q0 and p2q2, where p(t) and q(t) are the projections of P(t) and Q(t), pi(iZ0,1,2) and qi(iZ0,1,2) are the projections of Pi(iZ0,1,2) and Qi(iZ0,1,2), respectively. From the above definition, we know that the rational Be´zier surface c(s,t) is a developable surface, then the tangent plane at every point on one generator of the surface are the same. This implies that the points P0, Q0, P1 and Q1 are on a plane. Similarly, the points P1, Q1, P2 and Q2 are coplanar too. Moreover, when the surface c(s,t) is lying on a cone, it can be easily verified that the three lines P0Q0, P1Q1 and P2Q2 all pass through the apex of the cone. If the surface c(s,t) lies on a circular cylinder, these three lines are parallel with each other and the intersection point becomes infinity. With this analysis, we have Theorem 1. Let c(s,t) be a cone patch bounded by two parallel planes with boundary conics as P(t) and Q(t), then we have P0P1kQ0Q1, P1P2kQ1Q2 and P0P2kQ0Q2. From Theorem 1, we know that DP0P1P2 and DQ0Q1Q2 are similar triangles and the control polygons of two boundary conics are piecewise parallel. As to the plane fat conic arc we have Theorem 2. The conic segments p(t) and q(t) are two boundary curves of a fat conic arc if and only if the corresponding weights of these two conics are the same and the control points satisfy the following conditions: p0p1kq0q1, p1p2kq1q2 and p0p2kq0q2. Proof. From the definition of the fat conic arc, if p(t) and q(t) are two boundary conics of a fat conic arc, the weights of p(t) and q(t) are equal to the weights of P(t) and Q(t) which are the boundary curves of the original cone surface, then the corresponding weights of p(t) and q(t) are the same. Furthermore, the control polygons of p(t) and q(t) are the projections of P(t) and Q(t), respectively, and from Theorem 1,
705
we have p0p1kq0q1, p1p2kq1q2 and p0p2kq0q2. On the other hand, if the corresponding edges of Dp0p1p2 and Dq0q1q2 are parallel, then these two triangles are similar, and it can be easily derived that the three lines p0q0, p1q1 and p2q2 either intersect at one common point or are parallel with each other. When we elevate the triangles on two parallel planes with different heights, the two space triangles form the control mesh of a cone patch. If the corresponding weights of p(t) and q(t) are equal and the weights of the cone surface are defined same with those as p(t), then p(t) and q(t) are just the projections of the boundaries of the cone surface bounded by two parallel planes. So, p(t) and q(t) are two boundary curves of a fat conic segment. The theorem is proven. , In the same way as the definition of fat conic arcs, the projection of a tangent smooth cone spline surface bounded by two parallel planes forms a fat conic spline. Suppose that none boundary conic arc within a fat conic spline collapses, and from Theorems 1 and 2 we have Corollary. The control polygons of two boundary curves of a G1 fat conic spline are piecewise parallel.
3. Fat conic spline fitting For a ruled surface r(u,v) bounded by two parallel planes we will have a planar fat curve by projecting the ruled surface onto a plane. Without loss of generality we assume that the ruled surface is r(u,v)Z(1Ku)b0(v)Cub1(v), where b0(v) and b1(v) are two boundary curves lying on the planes zZh0 and zZh1, respectively. We choose the xy-plane as the projection plane, and obtain a plane fat curve by projection. The boundary curves of the plane fat curve are just the projection of b0(v) and b1(v) and we still denote the boundaries as b0(v) and b1(v) in the following text without special declaration. To compute a cone spline surface approximating the original ruled surface r(u,v), we should just fit a fat conic spline curve to the projected fat curve of r(u,v). With a plane fat conic spline obtained, we will obtain the approximating cone spline surface by elevating the boundary conic arcs of each fat conic arc onto planes zZh0 and zZh1, respectively. Within the rest of this section, we will pay attention to the approximation of a plane fat curve by a fat conic spline. 3.1. Interpolation by parallel polygons A planar fat curve is bounded by two curves b0(v), b1(v) as well as two straight lines connecting the ends of b0(v) and b1(v) at vZ0 and 1. Because the two straight lines b0(0)b1(0) and b0(1)b1(1) are determined by b0(v) and b1(v), then we mean b0(v) and b1(v) when we refer the boundary curves of a fat curve. Instead of constructing the control polygons or boundary conic splines directly, we first interpolate the boundary curves of the original fat curve by two piecewise parallel polygons in this subsection. The construction of boundary conic splines for a fitting fat conic spline will be presented in next subsection.
706
X. Yang, W. Yang / Computer-Aided Design 38 (2006) 703–712
For two boundary curves b0(v) and b1(v) of a fat curve, we can interpolate these two curves by two polygons L0L1.Ln and L 0 L 1 .L n with pairs of paralleling lines LiK1 Li kL iK1 L i ðiZ 1; 2; .; nÞ. Because Li and L i are lying on b0(v) and b1(v), respectively, we can then assume that LiZb0(vi) and L i Z b1 ðvi Þ, where 0Zv0%v1%.%vnZ1 and 0Z v0 % v1 % .% vn Z 1. When Li is connected to L i for iZ0,1,.,n, we will obtain a set of trapezoids or triangles interpolating the original fat curve (see Fig. 4). To construct two interpolating parallel polygons, we start with the beginning points of curves b0(v) and b1(v), i.e. v0Z0, v0 Z 0 and L0Zb0(v0), L 0 Z b1 ðv0 Þ. After that, we choose another point on one of the boundary curves such as b0(v) with a default forward step d. Let the parameter corresponding to the point be v1, then a new interpolating point is computed as L1Z b0(v1). To compute the corresponding point on the curve b1(v), we should compute the intersection points between the curve b1(v) and a line through L 0 while paralleling L0L1. We check the solution within the parameter interval ðv0 ; v0 C kf dÞ, where kf is a constant, which can be picked between 1 and 2 for most practical cases. If the solutions exist within the interval, we choose the smallest one for the new point. Then we have v1 O v0 and LiK1 Li kL iK1 L i (see Fig. 4). If there is no solution within the interval, we can just choose v1 Z v0 and the line L 0 L 1 collapses to a point. When we have obtained a pair of parallel lines LiK1Li and L iK1 L i interpolating two boundary curves b0(v) and b1(v), we can then choose the end points Li and L i as the beginning points of next pair of interpolating parallel lines. Again we compute a line interpolating the curve b0(v) or b1(v) firstly for new parallel line computation, and a default rule for curve selection is that we choose a curve with smaller parameter vi or vi . This choice will make the generators of the fat conic arc more compatible with those of the original fat curve. Whether Li and L i can be accepted or should be recomputed depends on the fitting accuracy of a corresponding cone surface. This procedure can be implemented independently or along with cone spline fitting procedure, and will end until the last two end points of b0(v) and b1(v) have been interpolated. 3.2. Construction of boundary conic splines With a set of parallel lines interpolating two boundaries of the original fat curve, every line segment can be considered as the chord of an interpolating conic arc. To determine a conic arc fitting one of the original boundary curves, we should b1(v)
b0(v) Fig. 4. Interpolating a fat curve by a pair of parallel polygons.
construct its control polygon and compute weights for all control points. Let LiK1Li and L iK1 L i (iZ1,2,.,n) be the set of parallel lines interpolating the boundary curves b0(v) and b1(v), we should compute a common tangent direction Ti at Li or L i for iZ1,2,.,n. To guarantee the existence of conic segments between every two consecutive interpolation points, we compute the tangent directions according to the following two rules. The first rule is local convexity. Assume that the chord LiK1Li does not collapse, the angle from TiK1 to the chord and the angle from the chord to Ti are with the same sign. Moreover the intersection point of the tangent line along TiK1 and the tangent line along Ti exists and lies at the same side with TiK1 to the chord LiK1Li. Secondly, the tangent Ti should also be close to the derivative direction of b00 ðvi Þ and b00 ðvi Þ simultaneously so that the final approximating conic sections are close to the boundary curves. When local convexity property holds, it means the existence of a conic arc interpolating the ends as well as the end tangents at LiK1Li. To compute the tangents satisfying the above two rules, we can just compute the tangents sequently. A default tangent direction at Li and L i is computed as the average of derivatives at these two points Vi Z
b00 ðvi Þ C b10 ðvi Þ : kb00 ðvi Þ C b10 ðvi Þk
(3)
If iZ0 we choose TiZVi. For iO0, if LiK1Li or L iK1 L i collapses, we compute vector Ti at L i or Li. In the following paragraph we compute Ti at Li under the assumption that LiK1Li does not collapse. If TiK1, LiK1Li and Vi satisfy the local convexity condition we choose TiZVi. If these three vectors do not satisfy the local convexity property, there are two cases, which should be dealt independently. The first case is that the angle from TiK1 to LiK1Li and the angle from LiK1Li to Vi have different signs. The second case is that even though the above two angles have same sign but two tangent lines through chord ends do not intersect or the intersection point lies on an unexpected side. If the second case holds, we can disturb vector Vi so that the disturbed Vi satisfies the local convexity condition. Then the disturbed vector will be picked as Ti. If the first case holds we reflect the initial Vi with respect to the chord LiK1Li. Let Wi be the reflected vector we have Wi Z
2ðVi Ui ÞUi KVi ; k2ðVi Ui ÞUi KVi k
(4)
where Ui Z Li KLiK1 =sLi KLiK1 s. For most practical cases TiK1, LiK1Li and Wi will satisfy the local convexity property, and then we can choose TiZWi. In case Wi still cannot satisfy the requirement it should be disturbed further as in second case and a disturbed vector will be picked as Ti. With all the tangent directions at the interpolation points properly defined, we can compute the intersection point Ri between the line through the point LiK1 with direction TiK1 and the line through Li with direction Ti. In a similar way, we compute the intersection point R i between the line through the point L iK1 with direction TiK1 and the line through L i with
X. Yang, W. Yang / Computer-Aided Design 38 (2006) 703–712
DL iK1 R i L i as Di and D i , respectively, we have ð ð fw ðb0 ðvÞÞdv C fw ðb1 ðvÞÞdv Z 0:
Ri b1(v) Ri
Li–1
Li
b0(v) Li–1
Li
Fig. 5. Construction of a fat conic arc. The dashed curves are boundaries of a fat curve and the solid curves are of a fat conic arc.
direction Ti. If the positions of LiK1 and Li are different, then the points LiK1, Ri and Li form the control polygon of a fitting conic segment. Similarly, L iK1 , R i and L i form the control polygon of another conic arc when two points L iK1 and L i are different from each other. If none of these two control polygons collapses to a point, the two triangles DLiK1RiLi and DL iK1 R i L i are similar triangles. From Theorem 2, the fat curve defined by these two conic segments with consistent weights is a fat conic arc (see Fig. 5). With the control polygon obtained for each conic arc, we compute the weights for these conic arcs by optimal curve fitting. Suppose that all conic segments are in standard form, we should then just compute the weight corresponding to each middle control point. As illustrated in Fig. 5, LiK1RiLi and L iK1 R i L i are the control polygons of a pair of conic arcs Ai(t) and Bi(t). The weights corresponding to the middle control points Ri and Ri are both wi, and we have these two conic arcs as
Ai ðtÞ Z
LiK1 B0;2 ðtÞ C Ri wi B1;2 ðtÞ C Li B2;2 ðtÞ ; B0;2 ðtÞ C wi B1;2 ðtÞ C B2;2 ðtÞ
t 2½0; 1
and
Bi ðtÞ Z
LiK1 B0;2 ðtÞ C Ri wi B1;2 ðtÞ C L i B2;2 ðtÞ ; B0;2 ðtÞ C wi B1;2 ðtÞ C B2;2 ðtÞ
t 2½0; 1
The weight wi should be computed so that both of conics Ai(t) and Bi(t) are as close as possible to b0(v) and b1(v), respectively. Floater [23] has presented an error estimation formula for conic approximation. The main idea of Floater’s method is to represent the conic segment in implicit form and compute the bound of a point to the implicit curve. Let point b0(v) be a point within the triangle DLiK1RiLi, and t0, t1 and t2 are the barycentric coordinates of the point with respect to the triangle, then one can define an algebraic function as fw ðb0 ðvÞÞZ 4w2i t0 t2 Kt21 . The point b0(v) lies on the conic segment Ai(t) if and only if fw(b0(v))Z0. In a similar way, if point b1(v) lies within the triangle DLiK1 Ri Li , one can define another function fw(b1(v)) by using the barycentric coordinates. The weight wi can be computed under the assumption that the sum of fw(b0(v)) and fw ðb1 ðyÞÞ are zero for all those points lying within either of the two triangles. By denoting DLiK1RiLi and
b0 ðvÞ2Di
707
(5)
b1 ðvÞ2D i
Though the solution exists theoretically for Eq. (5), but it is difficult to solve the equation exactly. For practical computation, we can just sample several points within the triangles from the original two boundary curves b0(v) and b1(v) and solve the discrete equation directly. 3.3. The fitting algorithm To construct a cone spline surface within a prescribed tolerance, we should compute the fitting cone spline globally or sequently. For global approach, we can construct an initial approximating cone spline surface using a default forward step. And then we pick segments with larger fitting error on the initial fat curve and refit the corresponding fat curve segments with more fat conic arcs. As for the sequent method we compute and test every new cone patch, and a new patch will be joined to current cone spline only when it is within the prescribed tolerance. If the fitting error is larger than a predefined criterion, we can just shorten the forward step d by a factor ks and compute another cone surface. This procedure can be repeated until a cone patch with the given tolerance has been found. In this way, we obtain a cone spline within a given tolerance sequently. In this paper, we adopt the second method for cone spline surface approximation. The fat conic spline fitting algorithm for cone spline approximation within a given tolerance is summarized as follows. Fat conic spline fitting algorithm. Input (r(u,v), tol, d0) Output (ci(s,t), iZ1,2,.,n) v0Zv0 Z0, L0Zb0(v0), L 0 Z b1 ðv0 Þ; Compute T0; iZ1; set dZd0; while (viK1!1 or viK1 ! 1) { Compute vi, vi , Li and L i ; Compute Ti; Compute Ai(t) and Bi(t); Compute fitting error err(Ai(t), Bi(t), r(u,v)); if (err!tol) {output ci(s,t); iCC; reset dZd0;} else dZksd;} 4. Error estimation for cone spline approximation In previous sections, we have shown that the approximation of a ruled surface by a cone spline surface can be reduced to the problem of fitting a fat plane curve with a fat conic spline curve. In Section 4, we will show how to compute the fitting error for cone spline approximation via fat conic spline fitting. The fitting error between a ruled surface and a cone spline is usually consisting of two parts: boundary error and skew error. As to the boundary error, we notice that the distance from
708
X. Yang, W. Yang / Computer-Aided Design 38 (2006) 703–712
Bi(t)=b1(v+ ∆v) π1
π0
Ai(t)=b0(v)
Fig. 6. The skew error between the ruled surface and the cone surface. The dashed curves are boundaries of a ruled surface while the solid curves are of a cone spline.
a boundary curve of one surface to the other one is no larger than the distance between two corresponding boundary curves on a projection plane. Then, we will compute the boundary error between a ruled surface and a cone spline as the distance between corresponding boundary curves of two projected fat curves. On another hand, even though the boundary error vanishes, there may still exists a gap between the original ruled surface and the fitting cone spline surface because of the inconsistency between the projected generators from these two surfaces. We refer this type of fitting error as skew error (see Fig. 6). As introduced in Section 3, Ai(t) and Bi(t), t2[0,1] are two boundary conics of a fat conic segment interpolating the original fat curve with boundaries b0(v) and b1(v) (see Fig. 5). The distance from Ai(t) to b0(v) and the distance from b0(v) to Ai(t) can be defined as dH ðAi ðtÞ; b0 ðvÞÞ Z max and
At this time, the error from the bilinear surface to the ruled surface is bounded by max(e0(v),e1(v)). Finally we have the error bound from the line Ai(t)Bi(t) to the ruled surface as
min distðb0 ðvÞ; Ai ðtÞÞ;
v2½viK1 ;vi t2½0;1
respectively. Then the Hausdorf distance between Ai(t) and b0(v) is defined as DH ðAi ðtÞ; b0 ðvÞÞ Z maxfdH ðAi ðtÞ; b0 ðvÞÞ; dH ðb0 ðvÞ; Ai ðtÞÞg:
1 dH ðb0 ðvÞ; L0 ðvÞÞ% e0 ðvÞ Z Dv2 sup kb000 ðvÞk; 8 v 1 dH ðb1 ðvÞ; L1 ðvÞÞ% e1 ðvÞ Z Dv2 sup kb100 ðvÞk: 8 v
min distðAi ðtÞ; b0 ðvÞÞ
t2½0;1 v2½viK1 ;vi
dH ðb0 ðvÞ; Ai ðtÞÞ Z max
Besides boundary error, we should also compute the interior deviation between the ruled surface and the cone surface. In the following text, we compute the distance from the ruled surface to the cone surface and the distance from the cone surface to the ruled surface under the assumption that the boundary error vanishes. Moreover, we will show that both of these two types of distances can be reduced to the distance computation from a line to a surface. Let Ai(t)Bi(t) be a generator on the cone surface, the two end points of the line lie on two paralleling planes, respectively, we compute the bound of the distance from line Ai(t)Bi(t) to the ruled surface r(u,v) (see Fig. 6). Assume that points Ai(t) and Bi(t) also lie on the ruled surface, i.e. there exist v and Dv such that Ai(t)Zb0(v) and Bi(t)Zb1(vC Dv) hold, and the four end points of generators b0(v)b1(v) and b0(vCDv)b1(vCDv) of the ruled surface form a bilinear surface. To compute the bound of the distance from the line Ai(t)Bi(t) to the original ruled surface, we compute the distance from the line Ai(t)Bi(t) to the bilinear surface and the distance from the bilinear surface to the ruled surface. Firstly, we define the thickness h(v) of the bilinear surface as the distance between two diagonals of the quadrangle defined by b0(v)b1(v) and b0(vCDv)b1(vCDv). Then the distance from the line Ai(t)Bi(t) to the bilinear surface is bounded by h(v). It is clear that h(v) vanishes just when this quadrangle is on a plane. Let L0(v) be the line connecting b0(v) and b0(vCDv), and L1(v) is the line connecting b1(v) and b1(vCDv), then the bound of the distance from the line L0(v) to the curve b0(v) and the bound of distance from the line L1(v) to the curve b1(v) can be computed as follows [27]:
(6)
By replacing Ai(t) with Bi(t), b0(v) with b1(v) and the interval [viK1,vi] with ½viK1 ; vi we have the definition of Hausdorf distance DH(Bi(t), b1(v)) between Bi(t) and b1(v). It should be noted that the distance from a point b0(v) to the conic section Ai(t) can be estimated explicitly when b0(v) lies in the triangle formed by the control polygon of Ai(t) (see Ref. [23]). However, not all points on the original boundary curves satisfy this condition in practice. Then we should compute the distance between two curves numerically, i.e. by computing the maximum distance of densely sampled points from b0(v) to the interpolating conic arc Ai(t). By the same way we compute the distance from curve b1(v) to Bi(t).
dðvÞ Z maxðe0 ðvÞ; e1 ðvÞÞ C hðvÞ:
(7)
As to the distance from a line b0(v)b1(v) on the ruled surface to the cone spline surface, it can be computed in a similar way. Without loss of generality, we assume that b0(v)ZAi(t) and b1(v)ZBi(tKDt), the fitting error can also be divided into two components. The first part of fitting error is due to the inconsistency of parameters, and the error bounds on either boundary curves are as 1 dH ðAi ðtÞ; L 0 ðtÞÞ% e0 ðtÞ Z Dt2 sup kAi00 ðtÞk; 8 t 1 dH ðBi ðtÞ; L 1 ðtÞÞ% e1 ðtÞ Z Dt2 sup sBi00 ðtÞs; 8 t where L 0 ðtÞ is a line connecting two points Ai(t) and Ai(tKDt), L 1 ðtÞ is a line connecting two points Bi(t) and Bi(tKDt). Let hðtÞ be the distance between two lines
X. Yang, W. Yang / Computer-Aided Design 38 (2006) 703–712 (a)
709
(b) 1.5 1
y
0.5 0 0.5 1 1.5 2.5
(c)
2
1.5
1
0.5 x
0
0.5
1
1.5
(d)
Fig. 7. Approximating a generalized cone surface by cone spline surface: (a) the original surface; (b) fitting the extended fat curve by a fat conic spline; (c) the extended fitting cone spline surface with control mesh; (d) the approximating cone spline surface.
Ai(tKDt)Bi(t) and Ai(t)Bi(tKDt), then the skew error from the line b0(v)b1(v) to the cone surface is bounded by Z maxðe0 ðtÞ; e1 ðtÞÞ C hðtÞ: dðtÞ
(8)
The total bound for the distance between the original ruled surface and the fitting cone spline surface can now be computed as maxfDH ðAi ; b0 Þ; DH ðBi ; b1 Þg C maxðd0 ; d1 Þ;
(9)
where d0 Z supv dðvÞ and d1 Z supt dðtÞ. 5. Implementation and examples As discussed in Section 3, when we interpolate a plane fat curve by two polygons with piecewise parallel lines, some line segments may collapse to points, and the trapezoids defined by parallel lines will degenerate to triangles (see Fig. 4). Though a fat conic section can still be defined for each trapezoid or triangle, but for collapsed lines the boundary conic arcs collapse to points, and the fitting conic arcs join with only C0 continuity at the degenerate points. If the boundaries of a planar fat conic spline are not smooth, the corresponding cone spline surface will have no tangent plane at the degenerate
boundary points. To obtain a tangent smooth cone spline surface in the end, we should fit the boundary curves of original fat curve by fat conic spline with smooth boundaries. To remove boundary singularities of a cone spline surface bounded by two parallel planes, one can just trim the cone spline surface with two new parallel planes lying between the original ones. Then, if we want to construct a tangent continuous cone spline surface we can extend the original ruled surface in either directions and trim the fitting cone spline surface with original two parallel planes. Assume that zZh0 and h1 be two parallel bounding planes, we extend the ruled surface to two new parallel planes zZh0 and h 1 , where h 0 hh0 and h1 ih1. In the following examples, we choose h0Z(4/3)h0K (h1/3) and h1Z(4/3)h1K(h0/3). Let p i and qi be the control points of boundary conic arcs of an extended fat conic arc, the control points of the final fat conic spline can be obtained as h Kh h Kh pi Z 1 0 pi C 0 0 qi ; h1 K h0 h1 K h0 h Kh h Kh qi Z 1 0 pi C 1 1 qi : h1 K h0 h1 K h0
710
X. Yang, W. Yang / Computer-Aided Design 38 (2006) 703–712
(b) 1.5 (a)
y
1
0.5
0
0
(c)
0.5
1
1.5 x
2
2.5
3
(d)
Fig. 8. Rule surface approximation by cone spline surface: (a) the original ruled surface; (b) the extended fitting cone spline surface; (c) the extended fitting cone spline surface; (d) the cone spline surface fitting the original surface.
Within the rest of this section we present several interesting examples concerning the approximation of ruled surfaces by cone spline surfaces. To be consistent with the fitting algorithm we use b0(v) and b1(v) to stand for the boundaries of extended fat curves while the boundaries of original fat curves are just 0.8b0(v)C0.2b1(v) and 0.2b0(v)C0.8b1(v). We shorten the forward step d with 0.9d when the fitting error of a cone patch is larger than a predefined criterion. In Figs. 7–9, surfaces with grey color are the fitting cone spline surfaces while the red ones are the original ruled surfaces. For plane fat curve fitting, the outside curves are the boundaries of extended fat curves (light color) and the fitting conic splines (deep color) while the interior curves are boundaries of original fat curves. The dashed polygons are control polygons of the fitting conic splines and the solid polygons are interpolating parallel polygons. In the first example, we approximate a section of a generalized cone surface by a spline of cone surface of revolution (see Fig. 7). The boundary curves of the original ruled surface are two spirals, and the extended boundaries are also spirals which are b0(v)Z((0.2Cv)cos(3.5pv)), (0.2Cv)sin(3.5pv) and b1(v)Zb0(v)!1.5 (see Fig. 7(b)). When the height between two bounding planes of the extended ruled surface is 1 and the permission tolerance is 0.001, we obtain an extended cone spline with seven patches (Fig. 7(c)). The cone spline surface fitting the original ruled surface can be obtained by trimming the extended cone spline surface (Fig. 7(d)). For this example no boundary conic arc collapses even for the extended fat conic spline, and the weights wis for these fat conic arcs are 0.6444, 0.6153, 0.6318, 0.6389, 0.67, 0.6487 and 0.8992, respectively.
In the second example, we approximate a non-developable ruled surface by cone spline surface (see Fig. 8). The boundaries of the original ruled surface are two Be´zier curves of degree 9. Then the extended boundary curves b0(v) and b1(v) are also Be´zier curves. The control points for b0(v) are (0,1.5), (0,1.5), (0,0), (0,0), (1,K0.075), (1,K0.075), (3,0), (3,0), (3,1.5), (3,1.5) and the control points for b1(v) are (0,1.5), (0,0.5), (0,0), (0,0), (0.5,0), (2.5,0), (3,0), (3,0), (3,0.5), (3,1.5). The height for the extended ruled surface is 1 and the given tolerance is 0.06 for this example. Though b0(v) and b1(v) coincide at two end points, a plane fat conic spline curve with 16 pieces has been constructed fitting this extended fat curve (Fig. 8(b)). When some interpolating trapezoids degenerate to triangles for plane curve fitting, there exist some singularities at the boundaries of the fitting cone spline surface (Fig. 8(c)). Finally, a tangent smooth cone spline surface is obtained by trimming the extended cone spline surface (Fig. 8(d)). The maximum fitting error is 0.0545 and the weights wis for the fat conic spline are 6.1257, 2, 0.6376, 1.3328, 1.0636, 1.0342, 7.7169, 1.1272, 1.0006, 1.0322, 1.0251, 1.0541, 60.9157, 2, 2.2879, 2. When b0(v) and b1(v) lie outside of the triangles formed by the control polygons of a fat conic arc, the corresponding weight for this fat arc is set a default value 2. In the third example, we approximate another bounded ruled surface with height 1.8 by a cone spline surface. The height of extended ruled surface is 3 and the extended boundary curve b0(v) is a cubic Be´zier curve with control points (K2,K2), (4,8), (5,K8) and (12,1). The extended boundary b1(v)Z b0(v)Cp(v), where p(v)Z3(tan[p/8 cos(pv)]cos[p/2C0.1
X. Yang, W. Yang / Computer-Aided Design 38 (2006) 703–712
711
(a)
(c)
5 4
3
3
2
2
1
1
0
0
y
y
(b) 5 4
–1
–1
–2
–2
–3
–3
–4
–4
–5 –2
–5 0
2
4
6
8
10
12
–2
x
0
2
4
6
8
10
12
x
(d)
(e)
Fig. 9. Approximating a ruled surface by cone spline surfaces: (a) the original ruled surface between two parallel planes; (b) plane fat curve fitting with a larger tolerance; (c) plane fat curve fitting with a smaller tolerance; (d) the approximating cone spline surface under (b); (e) the approximating cone spline surface under (c).
sin(pv)], tan[p/8 cos(pv)]sin[p/2C0.1 sin(pv)]). We apply two different forward steps and fitting tolerances for this example. With forward step 0.3 and permission tolerance 0.2, we obtain a fat conic spline with seven fat arcs (Fig. 9(b)). A fat conic spline with 15 fat arcs is obtained by choosing forward step 0.1 and permission tolerance 0.1 (Fig. 9(c)). The fitting cone spline surfaces under different forward steps and tolerances are illustrated in Fig. 9(d) and (e), respectively. The weight wis for the first fat conic spline are 1.0574, 1.1139, Table 1 Example
Figure
Forward step
Tolerance
Max error
Patch number
1 2 3a 3b
7 8 9 9
0.5 0.1 0.3 0.1
0.001 0.06 0.2 0.1
9.717!10K4 0.0545 0.1992 0.0998
7 16 7 15
0.0737, 0.3805, 1.0682, 1.0301, 2.0 and the weights for the second fat conic spline are 1.0031, 1.0299, 1.0043, 1.1244, 22.7854, 0.0048, 0.0166, 0.5616, 2, 0.3319, 1.0078, 1.1335, 1.0143, 1.1865, 2. The forward steps, tolerances, max fitting error and patch numbers for the above mentioned examples are listed in Table 1. 6. Conclusion and discussions In this paper, we have presented a new method for approximating a ruled surface by cone spline surfaces within prescribed tolerances. Assume that the original ruled surface lies between two parallel planes, we have a plane fat curve by projecting the ruled surface onto a plane paralleling the original bounding planes. On the selected plane, we fit the projected fat curve by a fat conic spline. The fitting error for cone surface
712
X. Yang, W. Yang / Computer-Aided Design 38 (2006) 703–712
approximation can be estimated efficiently via fat conic spline approximation. The assumption that a ruled surface to be approximated is bounded by two paralleling planes may not be valid for general types of ruled surfaces. If this case do occur, we can just divide the original ruled surface into two or several sub-ruled surfaces of which every sub-ruled surface can be bounded by a pair of paralleling planes. If one want to approximate a double curved surface by a cone spline surface, a ruled surface can first be constructed fitting the original surface, and then a developable surface is obtained by approximating the ruled surface. Acknowledgements We thank anonymous referees for their helpful comments and suggestions on an early version of the paper. This work is supported by 973 program (2002CB312101) and Natural Science Foundation of China (60303015,60333010). References [1] do Carmo MP. Differential geometry of curves and surfaces. New Jersy: Prentice Hall; 1976. [2] Aumann G. Approximate development of skew ruled surfaces. Comput Graph 1989;13(3):361–6. [3] Redont P. Representation and deformation of developable surfaces. Comput Aided Des 1989;21(1):13–20. [4] Randrup T. Approximation of surfaces by cylinders. Comput Aided Des 1998;30(10):807–12. [5] Chu CH, Sequin CH. Developable Be´zier patches: properties and design. Comput Aided Des 2002;34(7):511–27. [6] Maekawa T, Chalfant J. Design and tessellation of B-spline developable surfaces. J Mech Des Trans ASME 1998;120(3):453–61. [7] Frey WH. Modeling buckled developable surfaces by triangulation. Comput Aided Des 2004;36(4):299–313. [8] Chen HY, Pottmann H. Approximation by ruled surfaces. J Comput Appl Math 1999;102:143–56. [9] Chen HY, Lee IK, Leopoldseder S, Pottmann H, Randrup T, Wallner J. On surface approximation using developable surfaces. Graph Models Image Process 1999;61:110–24. [10] Hoscheck J, Schwanecke U. Interpolation and approximation with ruled surfaces. In: Cripps R, editor. The mathematics of surfaces VIII. Birmingham: Information Geometers; 1998. p. 213–31. [11] Elber G. Model fabrication using layout projection. Comput Aided Des 1995;27(4):283–91. [12] Aumann G. Interpolation with developable Be´zier patches. Comput Aided Geom Des 1991;8(5):409–20.
[13] Lang J, Ro¨schel O. Developable (1,n)-Be´zier surfaces. Comput Aided Geom Des 1992;9:291–8. [14] Bodduluri RMC, Ravani B. Design of developable surfaces using duality between plane and point geometries. Comput Aided Des 1993;25(10): 621–32. [15] Pottmann H, Farin G. Developable rational Be´zier and B-spline surfaces. Comput Aided Geom Des 1995;12:513–31. [16] Hoscheck J, Pottmann H. Interpolation and approximation with developable B-spline surfaces. In: Daehlen M, Lyche T, Schumaker L, editors. Mathematical methods in CAGD III. Vanderbilt University Press; 1995. [17] Pottmann H, Wallner J. Approximation algorithms for developable surfaces. Comput Aided Geom Des 1999;16(6):539–56. [18] Park FC, Yu J, Chun C, Ravani B. Design of developable surfaces using optimal control. J Mech Des Trans ASME 2002;124(4): 602–8. [19] Leopoldseder S, Pottmann H. Approximation of developable surfaces with cone spline surfaces. Comput Aided Des 1998;30:571–82. [20] Leopoldseder S. Algorithms on cone spline surfaces and spatial osculating arc splines. Comput Aided Geom Des 2001;18:505–30. [21] Leopoldseder S. Cone spline surfaces and spatial osculating arc splines— a sphere geometric approach. Adv Comput Math 2002;17:49–66. [22] Ahn YJ. Conic approximation of planar curves. Comput Aided Des 2001; 33(12):867–72. [23] Floater M. An O(h2n) Hermite approximation for conic sections. Comput Aided Geom Des 1997;14:135–51. [24] Yang X. Curve fitting and fairing using conic splines. Comput Aided Des 2004;36(5):461–72. [25] Lee ET. The rational Be´zier representation for conics, Geometric modeling: algorithms and new trends. SIAM. Academic Press, PA; 1987. p. 3–19. [26] Farin G. From conics to NURBS: a tutorial and survey. IEEE Comput Graph Appl 1992;12(5):78–86. [27] Filip D, Magedson R, Markot R. Surface algorithms using bounds on derivatives. Comput Aided Geom Des 1986;3:295–311.
Xunnian Yang is now an associate professor in the department of mathematics and institute of Computer Graphics and Image Processing at Zhejiang University, China. He obtained a BS in applied mathematics from Anhui University and a PhD in CAGD and Computer graphics from Zhejiang University in 1993 and 1998, respectively. His research interests include geometric design and processing, computer graphics and image processing.
Weiping Yang got a bachelor’s degree of science from Zhejiang University, China in 2003. He is now a graduate student in the Department of Mathematics at Zhejiang University, and his research interests are computer graphics and geometric modeling.