You are on page 1of 6

Approxi mati ngyquad ratic

NURBS c u r v e s arc spllnes


D S Meek and D J Walton

a rotating cutting tool and which is an offset of the shape,


When a quadratic NURBScurve is used to describe the path will also be an arc spline. Special care is required if a
o f a computer-controlled cuttin9 machine, the NURBScurve cutting path intersects itself. The self-intersection points
is usually approximated by many straight-line segments. of the offset of an arc spline are easy to find as they are
It is preferable to describe the cutting path as an arc spline, the intersection points of circles with circles, circles with
a tangent-continuous, piecewise curve made of circular arcs straight lines, or straight lines with straight lines. For
and straioht-line segments. The paper presents an comparison, the offset of a NURBS curve is, in general,
algorithm for finding an arbitrarily close arc-spline not a NURBS curve, and the self-intersection points of the
approximation to a quadratic NURBScurve. offset of a quadratic ~URBS curve are the solution of two
rather complicated simultaneous nonlinear equations.
arc splines, quadratic NURBS curves
The arc splines presented in this paper are formed from
a set of biarcs. A biarc can join two points and match
The standard practice for cutting an arbitrary smooth the unit tangents at the two points. The biarc is not
curve with a computer-controlled machine is to cut a unique, but the region in which the family of biarcs lies
polygon that is very close to the smooth curve. A polygon is bounded by a certain pair of circular arcs which are
is a continuous curve with a discontinuous tangent, and
described more fully in the next section (also see Figure
the following problems arise: 1 ). More discussion on the choice and methods of biarc
• Visible facets are produced which have to be smoothed construction can be found in recent literature 2-5.
after cutting. All quadratic NURBS curves are conics (see Lee 6 for a
• The many sudden changes in direction cause wear on wealth of information about quadratic NURBS curves and
the cutting machine. conics). If the quadratic NURBS curve degenerates to a
• The curve cannot be cut as fast as a tangent- circular arc or straight line, that arc or line is used as
continuous curve. part of the arc spline. For all other conics, the vertices,
the points of maximum and minimum curvature, can be
Modern cutting machines are capable of cutting circular
found. The conics can be subdivided at the vertices so
arcs as well as straight lines. A tangent-continuous curve
that only spiral segments of conics need be considered.
called an arc spline can be formed from circular arcs and
Spiral segments of conics have the property that they lie
straight-line segments 1-3. An arc-spline cutting path
in a region bounded by a certain pair of circular arcs
avoids the three problems listed above. This paper
which are described more fully below (also see Figure
presents an algorithm for finding an arbitrarily close
2). It is shown that the bounding circular arcs for a spiral
arc-spline approximation to a quadratic NURBS curve.
segment of a conic are the same as the bounding circular
An important advantage of arc splines is that their
arcs for the family of biarcs.
offset curves are easy to find. The offset curve of a straight
A simple formula gives the maximum distance between
line is another straight line, the offset of a circular arc is
the two bounding circular arcs. A divide-and-conquer
another circular arc, and the offset of an arc spline is
strategy is used to subdivide the NURBS curve so that the
another arc spline (except when the offset is so large that
maximum distance between pairs of bounding circular
a cusp is produced). If the shape to be cut is described
arcs is less than a given tolerance. Once that subdivision
as an arc spline, the cutting path, which is the centre of
is achieved, any biarc that joins the points, matching
tangents, must be within the tolerance of the conic. Thus,
Department of Computer Science, University of Manitoba, Canada an arbitrarily close approximation of a NURBS curve by
R3T 2N2 biarcs can be found. The biarcs taken together form an
Paper received:25 June 1992. Revised: 28 October 1992 arc spline that is arbitrarily close to the NURBS curve.

volume 25 number 6 june 1 9 9 3 0010-4485/93/060371-06 © 1993 Butterworth-Heinemann Ltd 371


D S Meek and D J Walton

to point B and match the unit tangent vectors t A and tB


at A and B. The bounding curves are C A, the circular
arc that passes from A to B and matches t A at A, and
CB, the circular arc that passes from A to B and matches
t B at B. Unit tangent vectors are used here to resolve an
ambiguity. There are two circular arcs, two arcs that
make a complete circle, that pass from one given point
to another given point and match the tangent at one of
the points, but only one of the circular arcs matches the
unit tangent vector.
Theorem 1: The family of biarcs defined in Reference 1
lies in the biarc region, the region with boundaries CA
and C B.
Proof: Let e be the anticlockwise angle from vector t A
A tA to vector B - A , ~ in ( - n , n ) , and let fl be the
anticlockwise angle from vector B - A to ta. Several special
F i g u r e 1. Region in which biarcs lie
cases are considered first. If e =/3 = 0, the biarcs are the
line segment AB. If the definition of the bounding circular
arcs is extended to include straight lines, the bounding
arcs CA and C B are the line segment AB. If ~ = - f l ¢ 0,
the biarcs are S-shaped curves which have the joining
point of the two arcs on the line AB; such biarcs are all
in the biarc region. I f e = fl 4: 0, the biarcs are the circular
arc joining A to B and matching tA at A and t B at B;
the boundaries of the biarc region CA and C B are the
same circular arc. If one of e and/3 is 0, and the other
is not 0, take ~ > 0; an analysis similar to that given
below shows that the biarc region has as its boundaries
CA and CB, where C B is the line segment AB. In the
general case, c~and/3 are nonzero, and they have different
e~
magnitudes. N a m e the larger one in magnitude ~ and,
without loss of generality, assume that e > 0. The range
for 0 is 1
0<~-/~<0<2~<2n
A tA
The lengths of the two circular arcs of the biarc are
F i g u r e 2. Conic Q ( t ) in region bounded by two circular
0- tc~-/3)
arcs 0 sin
2
SA ~- 0 ~ + / 3 ]{B -- AII
Recently, another method of approximating quadratic
B6zier curves (parabolas) by arc splines has been 2 sin sin
2 2
proposed 7. It is based on finding the exact distance from
and
an arc spline to a parabola. Here, a bound is found for 2c~ - 0
.the distance from an arc spline to any conic. (c~ + / ~ - 0) sin
2
sB -- IIB -- A II
~+/~- 0 c~+/3
DEVELOPMENT OF A L G O R I T H M 2 sin sin - - -
2 2
These two arc lengths are required to be positive 1.
Bounds on biarc The radii of the two arcs are rA=SA/O and
A biarc is a pair of circular arcs or straight-line segments ru = s B / ( ~ + fl -- 0), where a circle with an infinite radius
that are joined with matching tangents. There is a should be interpreted as a straight line. All the angles
1-parameter family of biarcs that passes through two that are arguments of the sine function in the expression
given points and matches given unit tangents at those for s A are in (0, n), and SA is positive. Thus, both 0 and
points. The parameter 0 is used in Reference 1 for this rA are positive. The derivative
family of biarcs, and the biarc region, the region
containing the family of biarcs, is found by varying 0. sin e - fi II B - A II
Below, Theorem 1 shows that the bounding curves of the dr x 2
biarc region can be found by setting 0 to its limiting dO 4 sin 7 +/3 sin2 0
values. Suppose that a biarc is required to join point A 2 2

372 computer-aided design


A p p r o x i m a t i n g q u a d r a t i c NURBScurves by arc splines

is also positive; rA increases as 0 increases. Letting 0 P r o o f : A parametric representation of a parabola is


approach its limit 2or, it is seen that rA < RA =
liB - All/(2 sin a). The entire first arc of the biarc is to Q1 ( t ) = \ 2 a t J
the left when travelling along CA from A to B. The arc
CA arrives at B forming an angle 20t with t A, and the A spiral segment of a parabola does not include the point
second arc of the biarc arrives at B forming an angle Q1 (0). Consider two points on the parabola:
ot + fl with tA. The second arc of the biarc meets C A at
B, is to the left of CA when approaching B since 0t > I/~1,
and meets the joining point of the two arcs of the biarc, Yo
which is to the left of C A. Since two circles can intersect and
in at most two points, the entire second arc of the biarc
is to the left of CA. Thus, the whole biarc is to the left to < t 1
Yl
of CA. The derivative
where to, tl ~ [0, oo). The family of circles passing
ot-fl through A and B having radius R and centre
sin IIB - A II
dr s 2

dO 4 sin -~ +- fl sin 2 ~ + fl - 0
2 2
satisfies the conditions
is positive except when 0 = 0t + fl; rB increases as
0 increases. Two subcases are n > ~ > f l > 0 and (Xo - Cx) 2 + (Yo -- C , ) 2 = R2 (1)
n > ~ > 0 > fl > - n. In the first of these, the biarc region and
is crescent-shaped, and, in the second, it is shaped like (X1 - - Cx) 2 + (Yl - Cy) 2 = R2 (2)
a convex lens. Assuming that n > c t > f l > 0 , it is
convenient to break the range of 0 at ct + ft. If The condition that the circle is tangent to the parabola
- f l < 0 < ~ + fl, then rn is positive; the biarc is a at A is
C-shaped curve. Letting 0 approach its lower limit, it is to(X o - C~) + Yo - Cy = 0 (3)
seen that Rn = liB - All/(2 sin fl) < rs. The second arc
of the biarc lies to the right of Cs. If 0 = :t + fl, the second Let r = Xo - C~ and s = Yo - Cr, and replace C~ and Cy;
arc is a straight-line segment that is tangent to, and to Equations 1-3 become
the right of, Cn. If ct + fl < 0 < 2ct, rn and a + fl - 0 are r 2 -I- S2 ~-- R 2 (4)
negative, and the biarc is an S-shaped curve. Again, the
second arc of the biarc lies to the right of Ca. Assuming (Xl - Xo + r) 2 + (Yx - Yo + s) 2 = R2 (5)
that n > ~ > 0 >/3 > - n , rs and ~ + fl - 0 are negative and
as ~ + f l < c ~ - f l < 0 . As before, R s < r s, although R s
tor + s = 0 (6)
is now negative. In this subcase, the second arc of the
biarc is to the right of Cs. In both subcases, the arc C s Subtracting Equation 4 from Equation 5 gives a linear
leaves A forming an angle a - f l with tA, and the first arc equation in r and s:
of the biarc leaves A parallel to tA. The first arc of the biarc
( X 1 - - X 0 ) 2 "J- ( Y l - - YO) 2 + 2(xl - x o ) r
meets Cs at A, is to the right of C s when leaving A since
> fl, and meets the joining point of the two arcs of the + 2(yl - yo)S = 0 (7)
biarc, which is to the right of Cs. The entire first arc of
Equation 7 can be rewritten as
the biarc is to the right of Cs. Thus, the whole biarc lies
to the right of Cs. Finally, the biarc is in the region 2(to + t l ) r + 4s = - - a ( t I - to)[(t o + tl) 2 -4- 4] (8)
bounded by CA and Cs. []
and the solution of Equations 6 and 8 is
Property of conics 2r = - a [ ( t o + t l ) 2 + 4]
A spiral is a curve whose curvature is of one sign and is and
monotone-increasing or monotone-decreasing as the
2s = ato[ (t o + t l ) 2 + 4]
curve is traversed. Consider a finite spiral segment of a
conic, a segment that does not include a vertex in its The deviation of the parabola from the circle can be
interior. The circular arcs joining the two endpoints that measured by
match the unit tangent vector at the first point and that
D = (x- Cx) 2 + ( y - Cr) 2 - R 2
match the unit tangent vector at the second point enclose
the conic (see Figure 2). Algebraic proofs of this result = (x - Xo) 2 + (y - yo) 2 + 2(x - x o ) r + 2(y - y o ) s
for the parabola, the ellipse and the hyperbola are given
in Theorems 2, 3 and 4. = -a2(t-- t o ) 2 ( t l -- t)(2t o + t + tl)

Theorem 2." Given a spiral segment of a parabola from


where
/ %

A to B, the two circular arcs CA and Cs enclose the to<,<,,


parabolic segment. \y/

volume 25 n u m b e r 6 june 1993 373


D S Meek and D J Walton

is any point on the parabola between A and B. D is where t is restricted to the interval [0, :r~ ). A development
negative, and so the circular arc CA is on the convex side analogous to that of Theorem 3 gives the deviation of
of the parabola. Using a similar argument, the circular the hyperbola from the circle as
arc Ce is on the concave side of the parabola. Finally,
the two circular arcs enclose the parabolic segment. [] D = - 4 C a 2 + b2) sinh 2 ! ~ t ° sinh tl - t sinh 2t° + t + t 1
2 2 2
Theorem 3." Given a spiral segment of an ellipse from A
to B, the two circular arcs CA and CB enclose the elliptic where Q3(t), to < t < tl, is any point on the hyperbola
segment. between A and B. D is negative, and so the circular arc
CA is on the convex side of the hyperbola. Using a similar
Proof: A parametric representation of an ellipse is argument, the circular arc C~ is on the concave side of
(acost~ the hyperbola. Finally, the t w o c i r c u l a r arcs enclose the
Q2(t) = \ b sin tJ hyperbolic segment. []

where, without loss of generality, a > b. A spiral segment Arc-spline approximation to quadratic
of the ellipse does not include the points Q2(0), NURBS curve
Q 2 ( ( 1 / 2 ) z ) , Qz(Tr) and Q z ( ( 3 / 2 ) l r ) ; the parameter t
c a n be restricted to the interval [0, ~ / 2 ] . Using the same The above result for conics shows that spiral segments
notation as in Theorem 1, Equation 7 gives a linear of conics can be bounded by pairs of circular arcs. The
relation between r and s. Rewriting Equation 7 gives bounding circles enclose a crescent-shaped region,
because conics are curves whose curvature does not
- a sin to -+--tl r + b cos to + tl change sign.
. . . . . . S
2 2 The maximum distance between two bounding c i r c u l a r

=_(a2sin2'°+" + cos 2 'o+',) tx-'o


~ sin ~ (9)
arcs which form a crescent-shaped region can be
calculated as follows. Suppose the c i r c u l a r arcs join A to
B matching unit tangent vectors t A and te. Let C be the
The condition that the circle is tangent at A is point of intersection of the tangent at A and the tangent
at B (see Figure 3). Naming the lengths of the sides of
a sin tor - b cos toS = 0 (~o) triangle ABC in the conventional way, the radii of the
From Equations 9 and 10, two c i r c u l a r arcs are c/(2 sin A) and c/(2 sin B), and the
maximum distances from the line AB to the circular arcs
r = (aZsin 2t°+t~-2 + b2 COS2 t°+t~)C°Sat°2 are (c/2)tan(A/2) and (c/2)tan(B/2). Let s be the
semiperimeter, and L be the area of triangle ABC; the
formulae
and
A ((s-b)(s-c)) 1'2
s (a2sin 2 t. . .°. . .+ tl b2 COS t ° + t l ) sint°
= .. + 2
tan~= s(s~a)
2 2 b
The deviation of the ellipse from the circle is B ((s-a)(s-c)) 1/2
tan =
D=(x-Cx) z+(y-Cy) 2-R 2 2 s(s--b)
and
= -4Ca z - b 2) sin 2 t---t° sin tl - t sin 2t° + t + tl
2 2 2
L = (s(s - a)(s - b)(s - c)) 1/2
where give the maximum distance between the two circles as
c(s-c)la-b[
(;)=Q2(t) t o < t < t 1, d=
2L
is any point on the ellipse between A and B. Since B

I
0 < t o < t < t~ < g/2 and a > b, D is negative, and the
circular arc CA is on the convex side of the ellipse. Using
a similar argument, the c i r c u l a r arc CB is on the c o n c a v e
side of the ellipse. Finally, the two circular arcs enclose
the elliptic segment. []
Theorem 4." Given a spiral segment of a hyperbola from
A to B, the two c i r c u l a r arcs CA and CB enclose the
hyperbolic segment.
Proof: A parametric representation of a spiral segment
of one branch of a hyperbola is

Q3(t) =
(;cosh;)
sinh
A b C
F i g u r e 3. Maximum distance between bounding circles

374 computer-aided design


Approximating quadratic NURBScurves by arc splines

A divide-and-conquer strategy is used to find points on 92


spiral segments of conics so that the pairs of bounding
circular arcs are closer than a given tolerance. Any biarc
that joins the points, matching tangents, is between the
same pair of bounding circular arcs as the conic. Thus,
any such biarc is within the given tolerance of the conic.
Of all the possible biarcs, it is desirable to use ones that
produce C-shaped curves when approximating conics.
The data from conics always has ct and fl with the same
sign, and so Sabin's choice 8 for making the biarc unique
gives C-shaped biarcs, and is consequently used here.
(Sabin takes the joining point of the two circular arcs in
a biarc to be the incentre of the triangle ABC, or 0 = ~t
in the notation used here.) Finally, the biarcs that are
within the given tolerance of the spiral conic segments
taken together form an arc spline that is within the given
tolerance of the NURBS curve.
Po
Figure 5. Ellipse segment with control points and weights
[(Po, wo) = (20, 20,1), (PI, W l ) = ( 1 5 0 , 2 5 0 , 0 . 9 ) and (P2, w 2 ) =
EXAMPLES (320,300, 1). The four vertices occur at t = - 4 . 2 6 0 , t = - 0 . 3 1 0 ,
t = 1.498 and t = 6.361.]
The B6zier form of a quadratic NURBS curve is
(1 -- t)2woPo + 2t(1 -- t)wxP 1 + t2w2P2
Q(t) = 92
(1 - t)2Wo + 2t(1 - t)wl + t2w2
where Po, P1, P 2 a r e control vertices, wo, wl, w 2 are
positive weights, and 0 ~< t ~< 1. The weights determine
the type of conic curve that is produced 6'9.
In Figures 4, 5 and 6, spiral segments of a parabola,
an ellipse and a hyperbola are shown. None of the conic
segments contains a vertex for 0 ~< t ~< 1.
Table I compares the accuracy of the bounding circular
arcs with the accuracy of the arc-spline approximation,
and gives the number of biarcs used. When a certain
accuracy is required, the divide-and-conquer algorithm
subdivides the conic until the bounding circular arcs are
within that accuracy. A biarc is then placed between the
bounding circular arcs. As one would expect, the biarc

92
P0
F i g u r e 6. Hyperbola segment with control points and
weights
[(Po, wo) = (20,20, 1), ( P I , w l ) = (150,250, 1.1) and (P2, w2) =
(280, 300, 1 ). The two vertices occur at t = 1.020 and t = 10.606.]

is much closer to the conic than the bounding circular


arcs are to each other. In the examples given, the
deviation of the biarc from the NUR]]S curve is about
one-tenth of the distance between the bounding circular
arcs. The actual accuracy of the arc spline is hard to find.
The maximum distance from a circular arc to a conic
would generally involve the zeros of a quartic (cubic for
parabolas) polynomial. The circular arcs are tangent to
the conic at known points, and this reduces the degree
of the polynomial by 1. Thus, the maximum distance
Po from a biarc to a conic can be found by solving a
Figure 4. Parabola segment with control points and quadratic for parabolas 7, and by solving a cubic for other
weights conics. If one is willing to do this, exact measures of the
[(Po, W o ) = ( 2 0 , 2 0 , 1 ) , (Pl, w l ) = ( 1 5 0 , 2 5 0 , 1 ) and (P2, w 2 ) = distance can be used, and much of the subdivision of the
(320, 300, 1 ). The vertex occurs at t = 1.065.] conic segment can be avoided. In Table 1, an approximate

volume 25 number 6 june 1993 375


D S Meek and D J Walton

Table 1. Distance between bounding circular arcs compared with REFERENCES


approximate distance between are spline and NURHScurve
I Meek, D S and Walton, D J 'Approximating discrete
Distance Approximate Numberof data by G 1 arc splines' Comput.-Aided Des. Vol 24
between distance biarcs
bounding between (1992) pp 301 306
circular arcs arc spline and
NURBS curve 2 Nutbourne, A W and Martin, R R Differential Geometry
Applied to Curve and Surface Design. Volume I:
Parabola 16.99 2.186 1 Foundations Ellis Horwood (1988)
2.258 0.2357 2
0.2886 0.02439 4 3 Su, B Q and Liu, D Y Computational Geometry
0.03598 0.002857 8
Curve and Surface Modeling Academic Press, USA
Ellipse 16.99 1.841 1
2.809 0.2130 2 (1989)
0.3715 0.02846 4
0.04631 0.003577 8 4 Bolton, K M 'Biarc curves' Comput.-Aided Des. Vol 7
(1975) pp 89-92
Hyperbola 21.81 3.042 I
2.776 0.3297 2
0.3485 0.03168 4 5 Sharroek, T J 'Biarcs in three dimensions' in Martin,
0.04353 0.003534 8 R R (Ed.) Mathematics of Surfaces H Oxford
University Press, U K (1986)
6 Lee, E T Y 'Rational quadratic B6zier representation
distance, the maximum of distances at 100 points on the for conics' in Farin, G (Ed.) Geometric Modeling:
conic from the biarc, is used in place of the exact distance Algorithms and New Trends Society of Industrial and
between the arc spline and the NURBS curve. Applied Mathematics, USA (1987) pp 3-19
7 Walton, D J and Meek, D S 'Approximation of
quadratic B6zier curves by arc splines' J. Comp. Appl.
Math. (accepted for publication)
ACKNOWLEDGEMENT
8 Sabin, M A 'The use of piecewise forms for the
The authors acknowledge the many helpful comments numerical representation of shape' Report 60/1977
from two anonymous referees of this paper. They also Computer and Automation Institute, Hungarian
acknowledge the financial support of the Natural Academy of Sciences, Hungary (1977)
Sciences and Engineering Research Council of Canada
for the research described in this paper. 9 Piegi, L ' O n N U R B S : a survey' IEEE Comput. Graph.
& Applic. Vol 11 (1991) pp 55 71

376 computer-aided design

You might also like