Computer Aided Geometric Design 6 (1989) 205-218 North-Holland
20s
Fat arcs: A bounding region with cubic convergence Thomas W. SEDERBERG, Scott C. WHITE and Alan K. ZUNDEL Engineer&g Computer Graphics Laboratov, Brigham Young University, Provo, UT 84602, U.S.A. Received July 1988 Revised Novem’ber 1988 Abstra& A new bowling region for planar Skier curves is introduced. This bound is referred to as a fat arc, and is simply a circular arc with some finite thickness. Fat arcs are compared with three other traditional bounding regions: convex hulls, min-max boxes and bounding strips. Based on empirical data, fat arcs demonstrate O(h3) convergence, convex hulls and bounding strips O(h*) convergence, and min-max boxes converges linearly to the curve. This means that, in tbe limit, fat arcs for the two halves of a subdivided curve total i the area of the fat arc of the undivided curve. Operation counts are given for the four bounding &ions. A curve intersection algorithm is discussed.
1. llltrodu&on Bounding regions, such as convex hulls of control polygons or bounding boxes, are used in many computer aided geometric design algorithms. A bounding region of a planar curve serves as a robust (though rough) approximation of the curve, in that all points of the curve lie within the bounding region. The value of a particular bounding region can be judged on three criteria: area (how tightly does it hug the curve), ease of creation (how expensive is it to determine the region) and ease of interrogation. This paper introduces a bounding region which excels in the area category, while not unreasonably expensive to create or interrogate. We refer to this new bounding region as a fat arc. In this paper, fat arcs are compared with three other bounding regions: convex hulls, min-max boxes, and bounding strips. In practice, convex hulls of control polygons are rarely used as bounding regions because their algorithmic complexity. They are included in this discussion, however, because the convex hull property is a fundamental characteristic of Bkier and B-spline curves. A good reference for algorithms for computing the convex hull of a set of points is [Preparata et al. ‘851. Bounding min-max boxes are probably the most widely used bounding region, because they are almost trivial to compute and to implement. A min-max bounding box is the rectangle of smallest area which encloses the control polygon. The rectangle is always oriented parallel to the x and y coordinate axes, and hence is coordinate system dependent. Bounding strips are rotated rectangles. [Ballard ‘811 uses strips in processing piecewise linear curves. Ballard stores the strips hierarchically as nodes on a binary tree and refers to this datz structure as a strip tree. A bounding strip for a degree n Bkzier curve is a rectangle parallel to line PO- P,. In general, the rectangle is just wide and long enough to contain all of the control points as. shown in Fig. 1. We can, at little expense, tighten the rectangle for integral cubic Bkzier curves by noting that if the curve is convex, the width can safely be reduced by 4 (see 0167-83%/89/$3.50
0 1989, Else&r science Publishers R.V. (North-Holland)
T. W. Sederberg et 01. / Fat arcs
206
Fig. 1. Bounding strip.
Fig. 2) by the following reasoning. If di and d2 are the respective distances from Pi and Pz to line PO- P,, then the distance d(t) from any point on the curve to line PO- P, is d(t) = 3(1- f)2td, + 3(1Denoting d,
t)t2d2.
= max(di, d2),
t)‘?+ 3(1-
d(t) I d,[3(1-
t)t’]
I $d,.
We can likewise reason that if the curve straddles the line PO- Ps, the width can be reduced by 5 (see Fig. 3). Section 2 motivates fat arcs by comparing their performance against convex hulls, min-max boxes and strip trees. Section 3 discusses how fat arcs are created and presents a numericai example. Se&ion 4 suggests a curve intersection algorithm featuring fat arcs, and Section 5 examines the number of arithmetic operations required by the various bounding techniques. 1.1. Related work The problem of approximating a curve using piecewise circular arcs has been investigated previously. [Sabin ‘771 was the first to consider the merits of piecewise circuhu arcs. Sabin
r_--
__-- __--
Y\
__-- _--
__-_*-- __-__-__-- __--
1
--, \
;a
a
\
__-- _---
i
Fig. 2. Tig!iter &wding
strip.
T. W. Sederberg et al. / Fat arcs
Fig. 3. Tighter bounding
207
strip.
addresses the problem of minkking the error when approximating a given curve using a given number of circular arcs. [Marciniak et al. ‘841disc~es how to find the minimum set of arcs to approximate a given c&e to within a given- tolerance. [Rossignac et al. ‘841describes how to approximate surface intersection curves using piec43vise circular arcs.
Fat Arc
Bounding
Boz
*-----_o
’
P Area
= 82
Relative
Area
\
/ / / ~ Area
= 8.
Relative
Area
Convex Hull
= 9.7
strip +-___
Area
Relative
Area
\
/ I / / 0 Area
= 4.5
= 5.5
\
/
= 1.0
P
\
I
= 5.
Relative Fig. 4. Sample curve 1.
Area
= 6.
\
\
T.W. Sederberget al. / Fat arcs
20%
2. Four bounding regions compared Fig. 4 shows four bounding regions for a sample cubic B&tier curve. This is admittedly an example which makes fat arcs look good. The relative area listed shows how each contestant
Bounding
Fat Arc
Area
Area
= .I4
Relative
Area
122
Area
1.43
Area
Relative
=
Convex
Area
=
Relative
= 4.75
Relative
Area
1.0
Box
= 34.
Hull
= 9.
=
Area
=
10.
Fig. 5. Curve 1 after 1 subdivide.
Bounding
Fat Arc
I
I
Area
Area
= .017
Relative
Area
=
Convex
Area
Area
=
Areu. =
19.
133.
strip
Hull
= .31
Relative
= 221
Relative
1.0
Box
I
Area
= .36
Relative
Area
Fig. 6. Curve 1 subdivided into 4 segments.
= 22.
T. W Sederberget al. / Fat arcs
1
Fat Arc
Area
Bounding
Area
=
Relative
1.0
Area
Area
strip
Area
= ,078
Relative
Area
= 529.
-
Convex Hull
I
Box
Area = 1.10
= .0021
Relative
209
= .089
Relative
= 38.
Area
= 43.
Fig. 7. Curve ¶ subdivided into 8 segments.
fares against the fat arc: the bounding min-max box is 9.7 times the area of the fat arc, the convex hull is 5.5 times larger, and the strip is 6 times larger. The absolute area is provided to indica:e the area reduction after a single subdivision of the curve. In Fig. 5, we note that the bounding min-max box area reduces from 8 units to 4.75 units
Fat Arc I ’
Bounding I
i\ I
1
’
f-4
\ \
’
I
I
\
q&--J
Box
\
\
I
\
\
\ Area = 92 Relative Area
,’
\
k’ =
Area = 12.0 Relative Area
1.0
Convex Hull
=
1.7
strip F I ’
\ \
I
\ \ \
\
\
\ & Area = 8.0 Relative Area
’
I
m k” Area = 7.11 Relative Area
= 87
Fig 8. Sample curve 2.
= 77
i? W. Sederberg et al. / Fat arcs
210
Bounding
Fat Arc
aT!s
fia Area
=
Relative
Area
1.8 Area
=
= 5.5
Relative
7.0
= 3.
!LE?a
;!!?N ATea =
Area
strip
Convex Hull
Reiative
Box
Relative
1.1
Area
=
1.7
Fig. 9. Curve 2 subdivided into 2 segments.
(the sum of both rectangles) - nearly a factor of 2. The strip aca reduced by a factor of 3.7 (5.25/l-43), the convex hull area also reduces by a factor of 3.7 *,-1.5/1.22), and the fat arc area reduced by a factor of 5.9. Figs. 6 and 7 show two more subdivisions of the curve. Note that after dividing this curve into 8 pieces, three bounding regions lie within a pen width of the curve. The total bounding
I
Fat AT-C
Area
I
= .32
Relative
Area
1.0
Area
= 2.54
Relative
A?-ea = 8.
Hull
= .52
Relative
Bounding
Area =
Convex
Area
r
&ea
=
1.6
=
Relative
.66 Area
Fig. 10. Curve 2 subdivided into 4 segments.
= 2.
Box
1
T. W. Sederherg et al. / Fat arcs
\\_
/
211
Fig. 11. Median circle.
min-max box area is 529 times the area of the fat arcs, the strip area is 43 times the fat arc area, and thz convex hull is 38 times the fat arc area. The area reduction between Figs. 6 and 7 suggests the convergence rate for the various bounds: In the limit, the fat arc area reduces by a factor of 8 with each subdivision, bounding min-max box area by a factor of 2, and convex hulls and bounding strips by a factor of 4. We conclude that fat arcs demonstrate 0(h3) convergence. Figs. 8-10 show bounding regions for a second curve, which has an inflection point.
3. Creating fat arcs To create a fat arc, first define a median circle; second, determine how ‘fat’ the circle must be to contain the curve; and third, determine the angular range of the arc. There are several options in defining a median circle. We chose to use the circle containing the three points P(O), P(i) and P(1) (see Fig. 11). The median circle has center X, = (xc, yC) and radius F. It may happen that two of those points are identical, in which case we subdivide the curve and make two fat arcs. It may also happen that the three points are collinear, in which case the median circle has infinite radius (see Section 3.1 on homogeneous representation). The inner and outer radii of the fat arc r,, and rmax are determined by computing the range of distances d(l) between X, and points on the curve P(t):
If P(t) is an integral B&ier curve of degree n, then d*(t) Bernstein form:
d*(t) = ; i=O
q(2r?)‘i(l-
t)2n-i.
is a degree 2n polynomial
in
T. W. Sederberg et al. / Fat arcs
212
Fig. 12. Angular range.
Since nlax(d(t))
min(d(t))
= \Imaxo),
= Jmax(min(d2(t)),
it suffices to obtain bounds on d 2(t). Since d2(t) is a polyno~bl
0) ,
0 I t 5 1,
in Bernstein form, we have
from the convex hull property:
max(d2(t))
min(d’(t))
I max(c,-),
kmin(ci),
i=O ,..., 2n.
The final step in creating a fat arc is to determine the angular range of the arc, which amounts to computing the radial line segments that cap the ends of the fat arc. Normally, those line segments simply he on the Iines X, - PO and X, - P,. However, if the curve turns more than 90”, the angular range may need to be increased as suggested in Fig. 12. In Fig. 12, the radial lines X, - PI and X, - P3 bound the curve. We recommend that if a curve does turn more than 90’ that it be subdivided into segments that turn less than 90° before computing any fat arcs. For any curve which turns 90 o or less, the radial lines X, - PO and X, - P, correctly cap its fat arc. The angle through which a curve turns can be ascertained from its hodograph [Sederberg et al. ‘881. A numerical example
Here we provide a numerical example in which we compute the fat arc bounding the integral cubic Bkzier curve in Fig. 13. 1. Computemedian circle. The circle through the three points P(0) = (2, 16), P(+) = (14, 10) and P(1) = (17, 1) has a center at X, = (2, 1) and a radius f = 15.
To find the inner and outer radii, computation is simplified if we translate the curve so that X, is at the origin. After translation, the four control points are: P&Q, Yo) = (0,15),
(12,1%
pi = (x1,
Yd =
p2 =
Y2) = (1%
(x2,
Y3) =
ps = (x,,
4),
(1590)
2. Compute rtin and r_. This requires us to find the ci coefficients of the Bernstein polynomial d2(t), after translating (x,, y,) to the origin: d’(t)
= ; i=O
ci( p)cl
-
t)?’
T. W. Sederberg et al. / Fat arcs
213
Pi-J=
b
Ps = (17,l)
Fig. 13. Cubic Bkier curve.
Performing
the Bernstein polynomial
multiplication
yields
cg = c, - r2 = 225, c* = xoxi +yoyt = 225, 2&3x, c2 =
c = 3 cq =
x0x3
+
3x: + 5
+ %x2
2YlJY2
+
3Y,2 = 257
.j ,
+YoY3 + 9YiY2 = I68 , 10
2x,x3 + 3xf + 2YtY3 + 3Y,z = 216 6 - , 5
~5 = ~2x3 +Y2Y3 = 225. Thus, r&., = 168 so rti, = 12.96 and r:,
= 257.4 so r,,
= 16.04.
3. Determine angular range. This curve happens to turn exactly 90 O, so we are certain that the curve lies within the sector bounded by the rays X, - PO and X, - P3. The resulting fat arc is shown in Fig. 14. 3.1. Homogeneous representation In order to handle the case where the median circle has an infinite (or, nearly infinite) radius, and to handle rational BCzier curves, it is best to work in homogeneous form. The homogeneous equation for a circle is a(X2+
Y2)+bXW+cYW+dW2=0
where the Cartesian coordinates (x, y) are related to the homogeneous coordinates (X, Y, W) by x=X,/W, y = Y/W. If the three points which define the median circle are (xi, yi),
214
T. W. Sederberg et al. / Fat arcs
Fig. 14. Fat arc.
(x2, y2) and (x3, y3), then the homogenous equation of the circle is found by solving for a, b, c, d from the homogeneous linear equations:
Since this is a set of homogeneous equations, its solution is only unique to within a scale factor. However, even if a, b, c, d are uniformly scaled, the circle they define is not changed. If the three points are collinear, forcing a circle of infinite radius (a straight line), then it works out that a = 0.
4. Curve intersection Fat arcs provide a robust curve intersection algorithm which converges very quickly. The intersection algorithm concerns itself only with the fat circles which contain the fat arcs. A fat circle FC is defined by a midpoint X, and inner and outer radii ri and r,,. FC= ((~9 u)Iqk(x
-x,)‘+(y-yJ’2rf).
Fig. 15 shows two curves with their fat circles. The two fat circles intersect cleanly, and we observe that any points common to both fat circles are contained within the fat line (FL) shown. Therefore, the fat line contains all points at which the two fat curves intersect. If the two circles FCi and FC2 are defined by the inequalities FCI = ((x, Y) I r,: 2 (x -xc*)*+
~Y-Ycl)‘~d)
and FC,= ((x, y)I-&z
-(x--x,,)*-(Y-Y~~)*,
-&),
T. W. Sederberg et al. / Fat arcs
Fig. 15. Fat circles.
then the fat line is found by simply adding the two fat circles: FL = FC, + FC, =
((x,
y)Ir,:-ri2,2(x--
+.I2
+
(Y
-Ycd2
-
(x
-xc2)2
-
(Y -Yc212
I
2 ri: - r,‘2 ,
FL=
((x,
y)Iri-&22(xc2-
XCIb
+ 2(YC2 -YcdY
+ x,: +u,:
-x:2
-UC!2
2
ri:- r$ } .
Clearly, FL 3 (FC, n FC2), Thus, the fat line is actually a bounding region of the points at which the two curves intersect. Also, it is always true that ri - t-s 2 ri - r,“2, so a fat line is even defined if the two fat circles do not overlap at all. The value of a fat line is that it is much easier to intersect a curve with a line than with a second curve. Regions of a curve that lie outside the fat line cannot intersect the other curve. A quick method for identifying portions of a curve which lie ou.tside of a fat line is as follows. Define a local coordinate system (x’, y’) with the x’ axis parallel to the fat line. The parameter values of the intersection of the Bezier curve with the fat line are independent of the x’ coordinates of the control points. Therefore, we can translate the control points so that their x’ coordinates are evenly spaced between x’ = 0 and x’ = 1. This translation is illustrated in Fig. 16 (before translation) and Fig. 17 (after translation). The value of this control point translation is that the curve is now a non-parametric Bezier curve because x’ = t, the curve parameter. We next find the intersection between the fat line and the convex hull of the non-parametric Bezier curve and denote by XL and XL the minimum and maximum x’ coordinates of that intersection (see Fig. 17). We are assured that the portions of the curve 0 < t < xi and XL -z t < 1 lie outside the fat line. A curve intersection algorithm thus proceeds as follows. Given two planar Bdzier curves, compute their respective fat circles from which the fat line is computed. Identify regions of each curve which lie outside the fat line (as illustrated in Fig. 17) and clip those regions off. If
T. W. Sederberg et al. / Fat arcs
216
LINE
Fig. 16. Control point translation.
LINE
Fig. 17. Curve clipping. .33 \
Original Curves
After First Iteration Fig. 18. Intersection algorithm.
T. W. Sederberg et al. / Fat arcs
217
Table 1 curve 1 lter
0 I 2 3 4 5
0.26994 0.49325 0.5125369 0.5125949 0.5125949
curve 2
kin
t max
&3X - ‘mi”
hnin
tmax
GMX- *min
0
1 0.60552 0.51708 0.5126080 0.5125949 0.5125949
1 0.33558 0.02383 7.11 x10-5
0 0.32570 0.39185 0.3951785 0.3951846 0.3951846
1 0.69084 0.41360 0.3952182 0.3951846 0.3951846
1 0.36514 0.02175 3.97x10-s 1.29x10-‘0
the intersection tolerance is not satisfied (t,, - t,.,&, repeat the procedure. If clipping cannot be performed because the fat line it too thick, subdivide each curve in half and apply the algorithm to the four resulting pairs of curves. Fig. 18 illustrates the first two iterations of this algorithm and Table 1 lists the parameter ranges after each iteration. After five iterations, 16 digits of accuracy are obtained in this example. Even tough the algorithm converges quickly, there is, of course, a lot over overhead at each iteration. We have not performed a serious timing test, but preliminary results suggest that for cubic curves, the algorithm is slightly faster than convex hull and interval based intersection algorithms, yet several times slower than an algorithm based on implicitization [Sederberg et al. ‘861.
5. Operation count
We now look at how many multiplies/divides, adds/subtracts and comparisons are required to create and interrogate the various bounding regions. In Table 2, the three values in parenthesis indicate the number of ( * /, + - , c > ) operations required for an integral cubic B&ier curve. The first row lists the number of operations to creatp a bounding region. For a fat arc, this means computing a center point and inner and outer radii. Point classification means determining whether a given point lies within a bounding region. The operation counts are all worst case. Curve overlap means test whether two bound& regions (of the same type) overlap. For two fat arcs, this is accomplished by computing a fat dne and checking whether the curve control points straddle the fat line. The bounding min-max box is superior in its simplicity, but inferior in how tightly it bounds a curve. For curves of higher degree, the operation count for bounding min-max boxes and strip trees increases linearly, whereas the expense for fat arcs and convex hulls grows more rapidly.
Table 2 Fat arc
Bounding box
Convex huh
Bounding strip
Bounding region compute
(54,42,1(l)
(0,4
(1234
(15,10,4)
Point classify
(9,9,4)
(0, 0,4)
(88.4)
(4,694) (16,24,16) W2)
12)
3)
Curve overlap
(8,188)
(0, 034)
complicated
Convergencerate
W’)
O(h)
W2)
T. W. Sederberg et al. / Fat arcs
218
6. Conclusions This paper presents a bounding region for planar Bkier curves which is reasonably easy to compute and interrogate, and which provides a tighter bound than previously published regions. The value of this paper may lie largely in the future directions that it generates. Two extensions present themselves: bounding planar curves with more compkated regions, and bounding space curves. The development in Section 3 is easily extended to use general bounding algebraic curves of the form: Cl If(X,
v)
-(
E2.
If f(x, JJ) is an algebraic curve of the same degree as the parametric curve, then it is always possible to have ci = e2 = 0, which amounts to implicitization. If the degree of f(x, JJ) is less than the degree of the parametric curve, then we have an approximate irnpiicitization with error bounds. Clearly, the convergence rates will increase with the complexity of the bounding algebraic ctuve. The fat arc idea can be extended to space curves by using, for example, a sector of a torus to bound a space curve. Rounds on surface patches, such as ‘fat’ spherical or toroidal sectors need to be studied. This may facilitate surface intersection algorithms.
Acknowledgements The authors thank Malcolm S&ii, Ron Goldman, and the referees for helpful comments. This research was supported in part by the National Science Foundation under grant number DMC-8657057.
References Ballard, D.H. (1981), Strip trees: a hierarchical representation for curves, Comm. ACM, 24, 310-321. Marciniak, K. and Putz, B. (1984), Approximation of spirals by piecewise curves of fewest circular arc segments, Computer-Aided Design X,87-90. Preparata, F.P. and Shamos, M.I. (1985), Computational Geometry, an Introduction, Springer, Berlin. Rossignac, JR. and Requicha, A.A.G. (1984), Constant-radius blending in solid modeling, Computers in Mechanical Engineering, July, 65-73. Sabin, M.A. (1977), The use of piecewise forms for the numerical representation of shape, Ph.D. Dissertation, Budapest, Hungary. Sederberg, T.W. and Parry, S.R. (1986), Comparison of three curve intersection algorithms, Computer-Aided Design 18,58-63. Sederberg, T.W. and Meyers, R.J. (1988), Loop detection in surface patch intersections, Computer Aided Geometric Design 5,161-171.