Computer-Aided
PII: SOOlO-4485(96)00030-9
Design. Vol 28, No 12, pp 943-950. 1996 Copyrqht c 1996 Elsevier Science Ltd Prmted I” Great Britain. All rights reserved OOIO-4485/96/$15 oo+o.oo
ELSEVIER
A Pythagorean quintic spiral
hodograph
D J Walton and D S Meek
these applications produce attractive alternatives to the usual cubic splines used in CAD and CAGD, neither guarantees a curvature continuous curve which is Fair in the sense of Farin5, that curvature extrema should only occur where explicitly desired by the designer. A curve composed of circular arcs and straight line segments with spiral segments acting as transition curves between the circular arcs and straight line segments can be designed to be fair in this sense since the designer may place the circular arcs where the curvature extrema are desired. Applications in which fair curves are of particular importance are the design of highways, railways and robot trajectories. The clothoid or Cornu spiral has been used in highway design for many years’. Baass’ identified five transition curve cases in highway design, namely, straight line to circle, circle to circle with a (broken back) C transition, circle to circle with an S transition, straight line to straight line, and circle to circle where one circle lies inside the other with a spiral transition. He recommends the use of clothoid templates because of the linear relationship between the curvature and arclength of a clothoid. Computational methods that are suitable for implementation on a microcomputer to obtain these clothoid transition segments have since been developed’. Control polygon approaches based on guided clothoid splines for general curve design and for highway design in particular have been developed9.‘0. A cubic B&er spiral has been developed as an alternative to the clothoid”; however, it does not have the desirable properties of a PH curve. The purpose of this paper is to introduce a Pythagorean hodograph quintic curve segment that is a spiral, i.e. its curvature varies monotonically with arclength. Since this curve segment does not have internal cusps, loops, and inflection points. it is suitable for applications such as highway design, in which the clothoid has traditionally been used. Since it is polynomial, it can be conveniently incorporated in CAD systems that are based on B-splines, Bizier curves, or NURBS (non-uniform rational B-splines) and is thus suitable for general curve design for applications in which fair curves are important. Some background information, summarized from the literaturelp3, is presented. The PH quintic spiral is then defined. Its use for the various transitions encountered in general curve and highway design is analysed. Several practical examples of curve design using PH quintic spirals are illustrated. In conclusion, its potential applications are discussed and related work in progress is mentioned.
A polynomial
curve with a Pythagorean hodograph has the properties that its arc-length is a polynomial of its parameter. and its offset is a rational algebraic expression. A quintic is the lowest degree Pythagorean hodograph curve that may have an inflection point and that inflection point allows a segment of it to be joined to a straight line segment while preserving continuity of curvature, continuity of position, and continuity of tangential direction. The curvature of a spiral varies monotonically with arc-length. Spiral segments are useful in the design of fair curves. A Pythagorean hodograph quintic spiral is presented which allows the design of fair curves in a NURHS based CAD system. It is also suitable for applications such as highway design in which the clothoid has traditionally been used. Copyright CF 1996 Elsevier Science Ltd Keywords: Pythagorean continuous transition
hodograph
quintic spiral,
curvature
INTRODUCTION Parametric polynomial splines are used extensively for computer-aided design (CAD) and computer-aided geometric design (CAGD) applications. However, in general, a polynomial spline has the following undesirable features. (1) The arc-length of any segment is the integral of the square root of a polynomial of the parameter. (2) Its offset is neither a polynomial, nor a rational algebraic function of its parameter. (3) Segments of polynomial curves of degree greater than two may have internal cusps, loops and more than one inflection point at locations that are not easily controlled. Pythagorean hodograph (PH) curves were introduced by Farouki”‘. These special parametric polynomial curves do not suffer from the first two of the aforementioned undesirable features. The lowest degree PH curves that have enough flexibility for curve design and geometric modelling in general are the quintics’. Some useful applications of PH quintics are Hermite interpolation to construct C’ polynomial spline curve?, and curve fitting to produce C’ curves4. Although both
Department of Computer Science. University
of Manitoba.
Winnipeg,
Canada P~prr
receiwtl:
II
Octohrr
1995.Revised: 26 March
1996
943
Quintic spiral: 0 J Walton and 0 S Meek
BACKGROUND
THE PYTHAGOREAN HODOGRAPH QUINTIC SPIRAL
The following notation and conventions are used. The dot product of two vectors, V and W is V . W. The norm ofa vector V is IIVII. A G 2 point of contact of two curves (where a curve may be a straight line, a circle, or a PH quintic spiral) is a point where the two curves meet, their unit tangent vectors match, and their curvatures match. Let T and N be two mutually orthogonal unit vectors in the plane. Consider the curve Q(t) = x(t)T + y(t)N and its derivative with respect to t,Q'(t)= x'(t)T + y'(t)N where x(t) and y(t) are polynomials in t. The curve Q(t) is said to be a Pythagorean hodograph curve if {X'(t)}2 + {y'(t)}2 can be expressed as the square ofa polynomial in t. To ensure that Q(t) is indeed a PH curve, define x'(t) and y'(t) as l
Given a beginning point, Po, beginning and ending unit tangent vectors, T and G, respectively, and ending radius of curvature r, a Pythagorean hodograph quintic Bezier spiral, called the H-spiral for convenience of subsequent reference, is defined by the following choice of 0, /3, " p and ( in Equation 3:
7/3 p = 0 = 4(1 + cos()
(6)
JL=(=O
(7)
and
x'(t) = u2(t) - v2(t) and
I - cos() 1+ cos()
,=/3
y'(t) = 2u(t)v(t) where u(t) and v(t) are polynomials. If u(t) and v(t) are linear then Q(t) is cubic but does not have any inflection points2 ; a segment of it can thus not be joined to a straight line segment so that the joint is a G 2 point of contact. If u(t) and v(t) are quadratic then Q(t) is quintic and may have a point of inflection 3 • A PH quintic Bezier form ofQ(t) is obtained by defining u(t) and v(t) as 3
u(t) = 0(1 - t)2 + 2p(1 - t)t + /3t 2
(I)
and
v(t) = JL(I - t)2 + 2((1 - t)t + ,t 2, The Bezier form is then
Q(t) =
t(~)Pi(1 i=O
(5)
/3=!J7rsin()
0$ t$ I
(2)
3
where 0 < () $ 71"/2. It has the following properties: ",(0)
=0
",(I)
=-
(10)
",'(I)
=0
(11 )
(3)
(9)
I
r
",'(t) > 0 for 0 $ t < I
(12)
Inequality 12 means that the above quintic PH curve is a spiral segment. These properties are now verified. Substitution of p = 0, and JL = ( = 0, into Equations I and 2 yields
u(t) t)itS-i
(8)
= 0
+ (/3 -
0)t 2
(13)
and
1
(14)
where 3
Substitution of Equations 13 and 14 and their derivatives into Equation 4 gives
2 PI = Po +! (0 - JL2)T + ~OJLN P 2 = PI +! (Op - JL()T +! (o( + pJL)N P3 = P2 + +
is (2/ -
",(t) =
2(2 + 0/3 - JL,)T
is (4p( + 0, + /3JL)N
40,t
{02 + 20(/3 - 0)t2 + (/3 - 0)2 t 4 + ,2 t 4}2
Substitution of 0, /3 and , in terms of rand () from Equations 5, 6 and 8 into this expression produces
P 4 = P 3 +! (p/3 - (,)T +! (p, + /3()N
",(t) =
and P s = P 4 +!(/32 _,2)T +~!3!N
( 15)
The curvature of the PH curve Q( t) is given by 3
",(t) = 2(u(t)v'(t) - u'(t)v(t» (u 2(t) + v2(t»2
(4)
Let G be the ending unit tangent vector of Q(t), i.e. G = Q( I )1II Q( I ) II, and let () be the angle measured from T to G, then cos () = T· G. If 0 < () $ 71"/2, and ifQ(t) has no internal loops, cusps, or inflection points, then ",(t) does not change sign and N, the unit normal to the curve at Po, may be chosen asN = (G - Tcos()/IIG - T cos ()II. Since spiral segments do not have internal loops, cusps, or inflection points, it is assumed throughout that this choice of N is made and that the curvature of spiral segments is non-negative. 944
1024(1 + cos ()2t r{49 + (56cos() - 42)t 2 + (25 - 24 cos ()t 4}2
Equations 9 and 10 follow by substitution of t = 0 and t = I into Equation 15. Differentiation of 15 followed by rearrangement and simplification leads to ",'(t)
=
7168(1 + cos()2 f(>..) 2 4 r{49 + (56 cos () - 42)t + (25 - 24 cos ()t }3 where
f(>..) = 7 - 6(4cos() - 3)>" - (25 - 24 cos ()>..2 and >.. = t 2
Quintic
The coefficient of A’ is negative,f’(O) > 0 and,f’(l) = 0, so,f’(A) > 0 for 0 5 X < 1. Hence K’( 1) = 0 and a’ > 0 for 0 5 t < 1 which verifies Equations 11 and 12. The H-spiral has five degrees of freedom. They are: two for P,,, and one for each of r, 8, and the unit tangent vector T. The unit tangent vector G is determined by T and 8. It follows upon substitution of p = cy, and p = < = 0, into Equation 3 that the control vertices of the H-spiral satisfy P, = P,, + ;a2T
spiral:
r > 0 centred at C. Let L be the straight parallel to T, let N
and D S Meek
line through
Z
(C-Z) - {CC-Z)-TlT
=
Il(C - Z) - {CC- Z) -TlTIi and let h = (C - Z) . N. If 60/91/7 <: r < h, then there is a unique H-spiral as shown in Figurr 1, that joins L to R such that the points of contact are G”. This is now verified. It follows from Equation 16 that (Ps - PO) . N = +/(2a
P2 = P, +$a
D J Walton
+ 34)
but, since P5 lies on R it is also true that
P3 = P2 + A (2n’ + trp)T + & c~uyN
(Ps - Po).N
Pq=P3++[jT+$~N
Comparison
an d
=
(I7 -
rcos8)
of these two equations
yields
&y(2~1+3P)-h+rcos,9=0
P, = P,+;(@
-y’)T+$yN
The vector from beginning thus
Q(1) -Q(o)
to end-point
of the H-spiral
is
which, with the use of Equations rearrangement and algebraic written as
17 and 18, followed manipulation can
l8rcos’~+(1lr-60h)cos0+91r-60h=O
= P, - PO
= h (80’ + 4a/j + 3p’ - 3y’)T + &y(2r> + 3P)N (16)
by be
(19)
Consider ,f’(x) =
l&X’
+
(1 lr - 60/7)X + 91r - 60h
where JOINING LINES
THE
SPIRAL
TO CIRCLES
x = case
AND
Use of the H-spiral for the five cases that occur in highway design is now examined. As was done with clothoids”, a single spiral is used for the first and last cases; pairs of spirals are used for the second, third and fourth cases. There are two possible solutions for each of the first three cases. One solution has been arbitrarily selected in each of these cases; an analogous analysis will produce the alternative solution if desired. The fourth case has many possible solutions. A unique solution is obtained by allowing the curve designer to specify a curvature value where the two spirals meet. The fifth case cannot always be solved. Expressions of the forms in the coefficients of T and N in Equation 16 occur in several places in this section. They may be expressed in terms of r and 0 as
=-
7r sin B
~(63+26cosQ+
12cos’H)
If 60/91h < r < 17. then ,f’(O) I= 91r - 6017 > 0 and ,f’( 1j = 120(r - h) < 0, hence Equation 19 has a unique solution for X in (0, l), i.e. 0 in (0,7r/2), since .f’(x) is quadratic. The H-spiral is obtained by solving Equation 19 for 0 and applying Equations 5 -8.
Joining two circles with a broken back C Given two circles f&,, 0, centred at C,,, C, with radii r(, and r, respectively, where (without loss of generality) rl 2 rn. If rl - rO < IIC, - C,\I < 2.675(r, + ro) then the two circles can be joined by a pair of H-spirals forming a C-shaped curve such that all points of contact are G’ as shown in Figure 2. To verify this. let the H-spiral that meets Ri be Q,(r) with hodograph
(17)
120( 1 + cosH)and (18)
This follows upon substitution of 0, p, and y in terms of 1 and 0 from Equations 5, 6 and 8 into Equation 16.
Joining a straight line to a circle Given a point, Z, a unit vector, T, and a circle f2 of radius
Figure 1
Straight
line to circle transition
945
Quintic
spiral:
D J Walton
and D S Meek
where
that (QI(I)-Q,I(I))*T=(CI
u,(t) = 0, + (,j, - o,)?
-C,,).T+(~,,+~,)sillH (22)
il nd (Q,(I)-Qo(l)).N=(C,
pC,,).N-(r,
-r,,)cosH (23)
Two H-spirals have IO degrees of freedom. To ensure ;I G’ match where the two spirals meet, let them be joined at their beginning points (where they both have ycro curvature) and let T,, ~~ --T, = T. hence also N,, N, = N. There are thus 7 remaining degrees of freedom. Since Q,,( I ) and Q, ( I ) arc each free to move on the circumference of a circle. their G’ points of contact each impose three constraints on Q,)(t) and Q, (t). There is still one remaining degree of freedom. By the definition of the H-spiral, the angles from -T to Q(;( I ) and from T to Q;(l) are f& and H,, respectively, where 0 < H,,;H, < n/2. The remaining degree of freedom is used to set U,, = 0, = H. This not only simplifies subsequent algebraic expressions. but also balances the angle ot tangent of the two H-spirals. It is assumed (arbitrarily but without loss ot generality) that the orientations of T and N arc such that T. (C, - C,,) > 0 and T,N, - T,N, = I. This causes one of two possible solutions to be selected. If desired. the other solution may be selected by choosing the orientation of N such that T,N, ~ T,N, 7 I. It now follows from Equation I6 that (Q,(l)
- Q(,(l)).T
= &(Xn;
+40,,,j0
+x0;+4+i,
$~ 3,$ t3$
39,; 3-,fi
and
- ?I,&-/()) + (1.1- F(,)cosH
(25)
No\\ o,,. ,j,,. ?,, and 0,. ,j,. :, with I’ = I‘,, and I’ = I., respectively, satisfy Equations 5, 6 and X. Use of Equations I7 and 18 with the appropriate r. or V, for I in Equations 24 and 25, with subsequent rearrangement and algebraic manipulation, leads to
and
I(‘,
C
0
)
*
N
-:
L-2!, 60
(0)
“2
(27)
sin H K,(f/) _ --~(I +cosH)’
(321 - 5XcosH - 36coG H)
(2X)
;1n d
+<(?c~,~~, t 3’1,;,, -7tr,,-r,l J~A,-/,,)
20 and 22 that
where 120)
(Q,(l)-Q(,(I)).N=
It t‘ollows from Equations
(21)
Since Qo( I) and Q, (I ) lie on circles G,,. 0, it is also true
From Equations 26 and 27 it follows that the pair of Hspirals are obtained upon solution of / (0) :- 0
(30)
LVilWJ
It follows
\
,_Rp__.
Figure
946
‘L_/’ /
from
Equations
/(O) = l/C, ~ c,#
2X. 29 and 31 that
- (I’, ~ /$)’ > 0
I-urthermore, f”(H) < 0 on (0. 7r/2) since. from Equations 2X and 29. g, (H). 0 on (0, -ir/2) and by differentiation of Equations 2X and 29 followed by
Quintic
subsequent (0, n/2)
algebraic
manipulation
1
gxH) =(I +cosq2
it follows
that
> 0
PI - PO- {(PI - PO).To)To
2 sin 0
(40-
= (1 + cos8)’
18cos@-9cos’8)
No =IIP, - PO-
>o
from which it follows that Equation 30 has a unique 0 solution for 0 in (0,7r/2). The two H-spirals are obtained by solving Equation 30 for 0, determining T and N, from Equations 26-29, and then applying Equation 5 to Equation 8.
Joining two circles with an S Given two circles R0 and fi, centred at C,, and C, with radii r,, and rl, respectively. If r, + r0 < IIC, - Co\1 < J(321/120)’ + (91/60)2(r, + rO) < 3.075(r, + rO) then the two circles can be joined by a pair of H-spirals forming an S-shaped curve such that all points of contact are G’ as shown in Figure 3. To verify this, let the H-spiral that meets R, be Q;(t). Analogous to the previous case, it is found that the pair of H-spirals is determined upon solution of the equation
“l+o~o)&o) - (5&q(H) = 0 Col12 - (-(32)
where g,(H) and g2(0) are defined by Equations 28 and 29. By an analysis similar to that of the previous case, it follows that Equation 32 has a unique solution for 0 < B < r/2. Analogous to the previous case, the two H-spirals are obtained by solving Equation 32 for 8, determining T and N and then applying Equation 5 to Equation 8.
Joining two non-parallel straight lines Given
two
line
and D S Meek
on
and
IIC, -
D J Walton
(700 - 365 cos 0 - 72 co? 0
- 36~0~~0)
‘&)
spiral:
segments
Lo and
L, that
meet
at a
(0’1 - PO)~TolToll PO-PI -{P’o-PI)~TI~TI llpo PI - {(PO- PI) .TI }TI II
N1 = e=;(n-a)
(33)
where (I < 7r is the angle at P formed by PO,P, and P,. For any value of r, the pair of H-spirals with T and N taken as To and No for the first spiral and T, and N, for joins the two line the second spiral, respectively, segments such that all points of contact are G’ as shown in Figure 4; the radius of the circle of curvature of the two spirals at their joint is r. To verify this, observe that two H-spirals have 10 degrees of freedom. Let G and r be the unit tangent vector and the radius of the circle of curvature, respectively, of Qo(t) at t = 1. To ensure a G’ match where Q,,(t) and Q, (t) meet, the unit tangent vector and radius of the circle of curvature of Q,(u) should, respectively, be -G and r at t = 1, together with the condition Q,,(l) = Q,(l). There are thus 6 remaining degrees of freedom. Since Q,(O) and Q, (0) are each free to move along a straight line and since both Qo(t) and Q, (t) have zero curvature at their beginning points, the G’ requirements at these points of contact each impose two constraints on Q,,(t) and Q,(t). There are still 2 remaining degrees of freedom. The beginning unit tangent vectors of Qo( t) and Q, (t) are TO and T, , respectively. By definition, the angles from T, to G and from T, to -G are 19~ and 8,, respectively, where 0 < Bo, 19, < -/r/2. One of the remaining degrees of freedom is used to set 8, = B. = 0, hence 0 = f (7~- a) and G = (To - T,)/I(T, - T, I). This not only simplifies subsequent algebraic expressions, but also makes the two H-spirals identical, except for orientation. The remaining degree of freedom is left for the curve designer to use as a shape parameter by choosing a value for r. The choice 1200( 1 + cos e)* (34)
r=(182+525cos8)tanB
-T
\
I
\
I
‘-__* Figure 3
Circle
,
Figure 4
Straight
line to straight
line transition
947
Quintic
spiral:
D J Walton
and D S Meek
where CT= min(/JP ~ P,,I/, //P - PI/I) lets one of the spirals start at whichever of P,, or P, is closest to P. To verify this. label P,, and P, such that (T = /JP ~ P,,I(. Now m
=
{
Qo(
Qo(o)}
1) _
or. from Equation
. T,,
+
\
@!!!!:~ti*-!%
16.
Use of Equations 17 and subsequent rearrangement tan o/2 leads to 71.
“A
18 in Equation 35 with and multiplication by
, (63 + 26 cos H + I2 cos’ H) tan : sin H
120( 1 + cosH)+
7~(I -cosH)(13+6cosH) 60( I + cos H)
I
_cst,n~
/
(36)
7
, , , , I
It follows from Equation 33 that r>/2 = n/2 ~ H. which. upon substitution into Equation 36 with subsequent simplification and solution of r. yields Equation 34.
,
Figure
10247( I + cos 0)’ {49 + (56~0~0 ~ 42)~’ + (2.5 - 34cosH)rJ}
“I /‘I) (371
The transition curve is a spiral, i.c. of monotone increasing curvature, so it takes on each curvature value exactly once. Hence if H is known, then Equation 37 can be solved uniquely for T in (0, 1). It follows from the definition of a PH curve. and Equations 13. 14 and 16 that tan
($
_
214(T)/‘(T) !.‘(T)_.____ .\-’ ( T )
948
G(T) ~ G(T)
C‘irck
to circle
transition
(Co ~ PO) - T -t I‘(,sin p =
Joining two circles with one circle inside the other For this case. a transition curve with 6 degrees ot freedom is required for G’ contact with the circles. The beginning point. P,, of the H-spiral cannot be used as ;I point of contact because the curvature there is 0. An additional degree of freedom is the parameter value ot the unknown point of contact of the larger circle with the arc of the H-spiral. This case does not seem to always have a solution. Furthermore, the algebra required to prove uniqueness should a solution exist. seems unwieldy and has not been carried out at this time. This case is not as important as the previous four for general curve design but is included because it is used in highway design. Consider two circles Qo,RI centred at C,,. C, with radii r. > Y, and such that fi, is completely contained inside RO. It is desirable to join the two circles by a single H-spiral such that both points of contact arc G’ as shown in Figuw 5. Let the H-spiral meet Q, at t = T and 0, at t = 1, respectively. Let the angle from T to the unit tangent vector at t = T be (:1.It follows from Equation I5 that
5
hith
.; I
II single
,l{u’(t)
spiral
- r;(t)}dt
:I nd
(C’,
PC,).
2-, N - j’i cosH = -(2o IS
+ ~;j)
(42)
Quintic
where 2^u g,(H) = E (2o + 3b) + Yt cos 0 - ;o+
It follows from Equations 43 and 44 that the H-spiral, it exists. is obtained upon solution of q(Q) = IIC, - C0112 - MW2
- {&(W2
= 0
if
(45)
Since Equation 38 gives 4 explicitly, Equations 37 and 45 are two simultaneous non-linear equations in r and 6’ where a, p and y are given by Equations 5, 6 and 8 with I’ = rl. One way which seems to work in finding a solution, if a solution exists, is to treat Equation 45 as a non-linear equation in a single unknown namely 0, then use bisection where, for each evaluation of q(Q) for some value of 8, Equation 37 is solved for r and 4 is computed from Equation 38.
EXAMPLES Examples that demonstrate practical use of H-spirals are shown in Figure 6. All joints are shown as black dots.
Figure 6
(a)Highway
centreline;
(b) vase cross-section;
(c) cam cross-section:
spiral:
D J Walton
and D S Meek
Circles are shown as broken lines. Figure 6u illustrates a hypothetical highway centreline layout incorporating two straight line-circle transitions, one broken back C transition, and one S transition. Figure 6b illustrates a vase cross-section incorporating two straight line-circle, and two S transitions. Figure 6c illustrates a cam crosssection incorporating two broken back C transitions. Figure 6d illustrates a hypothetical quadrant of a highway cloverleaf interchange layout incorporating a straight line-straight line transition, and two straight line-circle transitions.
CONCLUSION The Pythagorean hodograph quintic spiral described here is useful in curve design because it is of low degree; being polynomial, unlike the clothoid, it is a special case of a NURBS curve. Since straight line segments and circular arcs also have NURBS representations”, curves designed using a combination of H-spirals, circular arcs, and straight line segments, can be represented entirely by NURBS. The arc length of any segment of a curve composed of straight line segments, circular arcs and H-spirals can be determined in closed form. Furthermore, such a curve has a rational offset.
(d) cloverleaf
quadrant
Quintic
spiral:
D J Walton
and D S Meek
theta = . -eta
= 90
The spirals discussed in Al the c;~ses but one xc Biziel curves whose parametric values range from 0 to I. The fifth case uses a parametric value that ranges from ;I positive value less than I. to I, However. using avail:tble subdivision algorithms” this spilal may be reparametcrized so th;lt its parameter ranges from 0 to I. The H-spiral is LI reasonable alternative to the clothoid fo1 applications such zis highway and railway design. A highway transition needs LI good ofYset representation. The highway centreline is designed using straight lint segments, circular arcs and spiral transition segments. Offsets to the centreline ;\re used for the luyout of the highway. F;&rr 7 shows the H-spiral‘s curvature versus ilrclength plots for values of H from IO to 90 in steps of 10 The curve has been normalized to have unit curv;tturc at II = I The total arc-length for each plot has been scaled to equal the total arc-length of the B = IO curve so as to tit all the plots on the same system of axes. The curvature versus arc-length relationship for the clothoid is linear (indicated as a broken straight line in F&UC fi ). Work in progress includes an investigation of the behaviour of the H-spiral when Q( 1) is beyond the point of contact with the second circle just as Q(O) occurs before the point of contact of the first circle in Fig’uw -5. By moving the point of maximum curvature away from 1 it may be possible to obtain a curvature versus xc-length relationship that is closer to linear.
ACKNOWLEDGEMENT This work WBS supported by the Natural Engineering Research Council of Canada.
REFERENCES
950
Sciences
;tnd