7
Computer-Aided Design 39 (2007) 1058–1064 www.elsevier.com/locate/cad Constrained curve drawing using trigonometric splines having shape parameters N. Choubey a , A. Ojha b,* a Govt. Autonomous M.H. College of Home Science and Science, Jabalpur, India b PDPM Indian Institute of Information Technology, Design and Manufacturing, IT Building, JEC Campus, Ranjhi, Jabalpur 482 011, India Received 15 December 2005; accepted 2 June 2007 Abstract The problem of drawing a smooth obstacle avoiding curve has attracted the attention of many people working in the area of CAD/CAM and its applications. In the present paper we propose a method of constrained curve drawing using certain C 1 -quadratic trigonometric splines having shape parameters, which have been recently introduced in [Han X. Quadratic trigonometric polynomial curves with a shape parameter. Computer Aided Geometric Design 2002;19:503–12]. Besides this, we have also presented a simpler approach for studying the approximation properties of the trigonometric spline curves. c 2007 Elsevier Ltd. All rights reserved. Keywords: C 1 -quadratic trigonometric spline curves; Constrained curve drawing; Approximability 1. Introduction Ever since the inception of computational methods used in object modelling and rendering, many curve/surface generation techniques have been proposed in the literature. Some of these techniques have also found successful applications in real life problems of modelling and designing using animation systems. Basically, these methods are used in CAD/CAM or CAGD, but have also been used in other areas such as finite element analysis or bio-informatics. Spline techniques are one such example which have been extensively studied and used in a variety of different applications. Different flavours of spline curves have been proposed over the years to suit the requirements of specific applications. Trigonometric splines are an important class of splines, which were first introduced by Schoenberg [19] and later studied with various perspectives. In recent years, special attention has been paid to applications of trigonometric splines in geometric modelling for development of certain CAD/CAM software tools. These studies were based on the observation that many problems of surface modelling could be better handled by trigonometric * Corresponding author. E-mail address: [email protected] (A. Ojha). splines, specially those relating to data fitting on spherical objects. In [15], Neamtu, Pottmann and Schumaker have proposed designing a NURBS CAM profile using trigonometric splines, while Simon and Isike have presented an efficient technique for smooth approximation of robot path using trigonometric splines in [18]. They also compare in [18], the computational expenses with the corresponding polynomial splines and provide an implementation of their techniques to the problem of real time obstacle avoidance. Similar such studies using trigonometric splines can be found in [12,13]. These observations and applications of trigonometric splines have led to the introduction of various types of trigonometric spline having features suitable for CAGD applications (see e.g., [14, 16,17,20]). The problem of determining a smooth obstacle avoiding curve has attracted the attention of many people working on CAGD. Needless to say solutions to such problems have interesting applications in CAD/CAM and robotics. In [6], the problem of interpolation of data points that lie on one side of one or more lines has been studied, where the authors employ G 2 -cubic rational spline as a solution to the problems. Later Ong and Unsworth [11] studied a more general constrained interpolation problem, where the curve was required to lie on one side of a line or a quadratic curve. A G 1 -quadratic rational 0010-4485/$ - see front matter c 2007 Elsevier Ltd. All rights reserved. doi:10.1016/j.cad.2007.06.005

Constrained curve drawing using trigonometric splines having shape parameters

Embed Size (px)

Citation preview

Page 1: Constrained curve drawing using trigonometric splines having shape parameters

Computer-Aided Design 39 (2007) 1058–1064www.elsevier.com/locate/cad

Constrained curve drawing using trigonometric splines havingshape parameters

N. Choubeya, A. Ojhab,∗

a Govt. Autonomous M.H. College of Home Science and Science, Jabalpur, Indiab PDPM Indian Institute of Information Technology, Design and Manufacturing, IT Building, JEC Campus, Ranjhi, Jabalpur 482 011, India

Received 15 December 2005; accepted 2 June 2007

Abstract

The problem of drawing a smooth obstacle avoiding curve has attracted the attention of many people working in the area of CAD/CAM andits applications. In the present paper we propose a method of constrained curve drawing using certain C1-quadratic trigonometric splines havingshape parameters, which have been recently introduced in [Han X. Quadratic trigonometric polynomial curves with a shape parameter. ComputerAided Geometric Design 2002;19:503–12]. Besides this, we have also presented a simpler approach for studying the approximation properties ofthe trigonometric spline curves.c© 2007 Elsevier Ltd. All rights reserved.

Keywords: C1-quadratic trigonometric spline curves; Constrained curve drawing; Approximability

1. Introduction

Ever since the inception of computational methods used inobject modelling and rendering, many curve/surface generationtechniques have been proposed in the literature. Some ofthese techniques have also found successful applications inreal life problems of modelling and designing using animationsystems. Basically, these methods are used in CAD/CAM orCAGD, but have also been used in other areas such as finiteelement analysis or bio-informatics. Spline techniques are onesuch example which have been extensively studied and usedin a variety of different applications. Different flavours ofspline curves have been proposed over the years to suit therequirements of specific applications. Trigonometric splines arean important class of splines, which were first introduced bySchoenberg [19] and later studied with various perspectives.

In recent years, special attention has been paid toapplications of trigonometric splines in geometric modellingfor development of certain CAD/CAM software tools. Thesestudies were based on the observation that many problems ofsurface modelling could be better handled by trigonometric

∗ Corresponding author.E-mail address: [email protected] (A. Ojha).

0010-4485/$ - see front matter c© 2007 Elsevier Ltd. All rights reserved.doi:10.1016/j.cad.2007.06.005

splines, specially those relating to data fitting on sphericalobjects. In [15], Neamtu, Pottmann and Schumaker haveproposed designing a NURBS CAM profile using trigonometricsplines, while Simon and Isike have presented an efficienttechnique for smooth approximation of robot path usingtrigonometric splines in [18]. They also compare in [18], thecomputational expenses with the corresponding polynomialsplines and provide an implementation of their techniques to theproblem of real time obstacle avoidance. Similar such studiesusing trigonometric splines can be found in [12,13]. Theseobservations and applications of trigonometric splines have ledto the introduction of various types of trigonometric splinehaving features suitable for CAGD applications (see e.g., [14,16,17,20]).

The problem of determining a smooth obstacle avoidingcurve has attracted the attention of many people workingon CAGD. Needless to say solutions to such problems haveinteresting applications in CAD/CAM and robotics. In [6], theproblem of interpolation of data points that lie on one side ofone or more lines has been studied, where the authors employG2-cubic rational spline as a solution to the problems. LaterOng and Unsworth [11] studied a more general constrainedinterpolation problem, where the curve was required to lie onone side of a line or a quadratic curve. A G1-quadratic rational

Page 2: Constrained curve drawing using trigonometric splines having shape parameters

N. Choubey, A. Ojha / Computer-Aided Design 39 (2007) 1058–1064 1059

spline curve was employed to give a solution. Recently Meek,Ong and Walton [7] have also given a solution to the problemwhere the curve lies within a closed boundary consisting oflinear or circular segments (see also [8]).

In all the results mentioned above rational curve segmentsof lower degree have been used as solutions to the constrainedinterpolation problems. Using rational curves has the advantagethat weight factors can be effectively used to control the curveshape. Nonetheless the choice of weight factors is itself notan easy job (cf. [2], p. 240). A similar problem of findingpolygonal channels (enclosures) to given spline curves with aspecified tolerance has been studied in [9,10].

In the present paper we propose a method of constrainedcurve drawing using a class of certain C1-trigonometric B-spline curves which has been recently introduced in [3]. Thebasis functions are defined using a shape parameter. Convexhull property and local control are the special features ofthe curves, which have been highlighted in [3]. The authorhas also analyzed the conditions under which the quadratictrigonometric spline curve will be closer to its control polygonthan the usual quadratic B-spline curve and vice versa.In a subsequent paper, Han [5] has also provided anotherapproach of constructing C1-quadratic trigonometric splinecurves having local control parameters, where inter alia, theauthor provides a tight envelope of trigonometric splines forrational Bezier curves (see also [4]).

The purpose of the present paper is two fold.

• We present the use of C1-quadratic trigonometric B-splinecurves to give a solution to the constrained curve drawingproblem. This is done basically to provide an alternative torational spline approaches, in view of the observations madein [15,18] (see also [12,17]).

• We provide an alternative approach to study the approxima-bility of the quadratic trigonometric spline curve as againstthat studied in [3]. It is indeed remarkable to observe thatbesides providing a simpler approach, we are also able toachieve larger range for the shape parameter.

The paper is organized as follows. In Section 2 wefirst present construction of C1-quadratic trigonometric splinecurves studied in [3]. Then we also study a problem ofdetermining a curve segment of the spline passing through agiven point P . Later in Section 3 we present an alternativeapproach to study and compare the approximability of C1-quadratic trigonometric spline curves and the correspondingusual quadratic B-spline curves for a given control polygon.Our approach is simpler with the added advantage that therange of parameter is improved. Section 4 is devoted todetermination of the conditions under which a given linesegment will be tangent to a curve segment. This will be usefulin development of an algorithm for constrained curve drawingusing trigonometric splines in Section 5.

2. Curve scheme and constrained interpolation

We begin by presenting the construction of C1-quadratictrigonometric B-spline functions introduced in [3,5] (seealso [1,4]).

Let u0 < u1 < u2 < · · · < un+3 and 4i = ui+1 − ui ,i = 0, 1, 2, . . . , n + 2. Define αi =

4i4i−1 + 4i

, βi =4i

4i + 4i+1.

We also introduce the local parameter for the interval [ui , ui+1]

by

ti := ti (u) =π(u − ui )

2 4i.

Further define

c(ti ) = (1 − sin ti )(1 − λ sin ti )

d(ti ) = (1 − cos ti )(1 − λ cos ti ), (1)

where −1 ≤ λ ≤ 1 is a shape parameter. For i = 0, 1, . . . , n,the trigonometric B-spline functions are defined as follows.

bi (u)

=

βi d(ti ), u ∈ [ui , ui+1);1 − αi+1c(ti+1) − βi+1d(ti+1), u ∈ [ui+1, ui+2);αi+2c(ti+2), u ∈ [ui+2, ui+3);0, otherwise.

(2)

It is easy to verify that the basis functions possess propertiessuitable for CAGD applications such as non-negativity andpartition of unity. Further one can also see that bi ∈ C1 on[u0, un+3]. The shape parameter λ used in the definition ofbi is shown to be useful in varying the shape of the resultingcurves [3]. In view of the fact that a change in λ globallychanges the curve, a modified set of basis functions withvariable shape parameters has been proposed by the presentauthors in [1], where the basis functions continue to enjoysimilar properties. The idea is to use a variable shape parameterλi ∈ C1 on each of the intervals [ui , ui+1] such that λi (ui ) =

λi−1(ui ) for all relevant values of i . Another approach ofconstruction of basis functions with local parameters has beensuggested in a subsequent paper by Han in [5]. In order topresent the construction given in [5], we introduce the shapeparameters λi , σi ∈ R and δi = σi 4i 4i+1. Further the basicfunctions defined by (1) are also changed to locally definedfunctions given by

ci (ti ) = αi (1 − sin ti )(1 − λi−1 sin ti ) − δi−1 cos2 tidi (ti ) = βi (1 − cos ti )(1 − λi cos ti ) + δi sin2 ti .

Notice that the choice λi = λ and δi = 0 for all i reduces to(1). We shall be using the above representation only when it isessential. Otherwise, we shall stick to representation (1) onlyfor the sake of simplicity and computational convenience. It iseasy to see that the basis functions with local shape parametersalso satisfy the condition of non-negativity and partition ofunity if −1 ≤ λi ≤ 1 and

− min{αi+2,

12βi (1 − λi )

}≤ δi

≤ min{

12αi+1(1 − λi ), βi−1

}.

With these basis functions we are now ready to define a C1-quadratic trigonometric B-spline curve for a given set of control

Page 3: Constrained curve drawing using trigonometric splines having shape parameters

1060 N. Choubey, A. Ojha / Computer-Aided Design 39 (2007) 1058–1064

Fig. 1. Trigonometric curve segment passing through given point P .

points P0, P1, . . . , Pn in R2.

T (u) =

n∑j=0

Pj b j (u), n ≥ 2, u ∈ [u2, un+1]. (3)

On the interval (uk, uk+1), the curve reduces to

T (u) = Tk(u) = Pk−2bk−2(u) + Pk−1bk−1(u) + Pkbk(u). (4)

It is clear that the curve segment defined on [uk, uk+1] lies inthe triangle 〈Ak−1 Pk−1 Ak〉 where Ak’s are defined by

Ak = αk+1 Pk−1 + (1 − αk+1)Pk . (5)

In the case of presence of local shape parameters δk , theexpression changes to

Ak = (αk+1 − δk)Pk−1 + (βk − δk)Pk . (6)

Note that δk gives us the facility of sliding the point Ak on thepolyline leg Pk−1 Pk and thus changing the local control triangleof the curve segment Tk .

Assume now that P is a given point in the interior of thelocal control triangle 〈Ak−1 Pk−1 Ak〉 through which the curvesegment is required to pass. We join the points Ak−1, Ak anddraw a line segment from Pk−1 through P to meet at Ak−1 Akon a point Q, which divides Ak−1 Ak in the ratio α : 1 − α

(Fig. 1), i.e.,

Q = (1 − α)Ak−1 + αAk

= αk(1 − α)Pk−2 + [(1 − α)(1 − αk) + ααk+1]Pk−1

+ α(1 − αk+1)Pk . (7)

Let P = (1 − w)Q + wPk−1 for some w ∈ (0, 1). Using theexpression of Q above, we can write P as follows.

P = (1 − w)(1 − α)αk Pk−2 + [(1 − w){(1 − α)(1 − αk)

+ ααk+1} + w]Pk−1 + (1 − w)α(1 − αk+1)Pk . (8)

If the curve segment passes through the given point P , thenwe must have T (tk(u)) = P for some parameter value u ∈

Fig. 2. Trigonometric curve segments with values λL and λH passing throughthe vertex point and tangential to given line segment.

(uk, uk+1), i.e.,

T (tk(u)) = Pk−2bk−2(tk(u)) + Pk−1bk−1(tk(u))

+ Pkbk(tk(u)) = P. (9)

For the sake of convenience we shall use the notation t fortk(u) and t for tk = tk(u) whenever there is no confusion. Oncomparing the coefficients of Pk−2 and Pk from Eqs. (8) and(9) and using (4), we get

(1 − w)(1 − α)αk = αkc(t ) (10a)

(1 − w)α(1 − αk+1) = βkd(t ). (10b)

Combining (10a) and (10b) with the fact that (1 − αk+1) = βk ,we obtain (1 − w) = c(t ) + d(t ) which in its turn gives

w = (1 + λ)(cos t + sin t − 1), (11)

or

sin t + cos t = 1 +w

1 + λ= m say.

After a little analysis and computation, keeping in mind thefact 0 ≤ cos(t ) ≤ 1 and that only real values have to beconsidered, we arrive at the following values of domain andshape parameters for point P to be on the curve segment Tk .

λ + 1 ≥ w(1 +√

2). (12)

t = cos−1

(m +

√2 − m2

2

).

We notice that when w → 0, λ ≥ −1 and when w → 1, λ

≥√

2 which is not within the given range of λ. Therefore w

can only be in the range 0 ≤ w ≤2

(1+√

2). For point P which

falls beyond this range of w, there will be no curve which passesthrough the point. This would certainly help us in ensuring thatthe curve does not cross the specified boundary. The foregoingcomputation regarding the range of parameter λ and the domainparameter t is crucial if one wants to find out a curve segmentwhich just escapes going out of the boundary polygon as shownin Fig. 2.

Page 4: Constrained curve drawing using trigonometric splines having shape parameters

N. Choubey, A. Ojha / Computer-Aided Design 39 (2007) 1058–1064 1061

3. Approximability: A different approach

In the present section we compare the C1-trigonometricB-spline curve discussed in the previous section with thecorresponding usual quadratic B-spline curve over the sameknot and control point sequences. As mentioned earlier, ourapproach has two major advantages over the method usedin [3] for finding out the approximability of the curve. On theone hand the computations are easier and on the other handthe range of parameter is enhanced. The associated quadraticpolynomial B-spline curve will be given by

Bk(s) = ak0(s)Pk−2 + ak1(s)Pk−1 + ak2(s)Pk, (13)

where s =u−uk4k

and ak0 = αk(1 − s)2, ak1 = 1 − αk(1 − s)2−

βks2, ak2 = βks2.

In order to find out the distance of the B-spline curve from itscontrol polyline, we find out the distance segment by segmentfor each parameter value. Consider the curve segment definedon the interval [uk, uk+1]. As in Section 2, we join the pointsAk−1 and Ak by a line segment. We further join an arbitrarypoint Q = (1 − α)Ak−1 + αAk with Pk−1 by a line segment.Let this line segment Q Pk−1 meet the curve Bk at the parametervalue s, then we have

P = (1 − w)Q + wPk−1 = Bk(s) for some 0 ≤ w ≤ 1. (14)

Using (7) for an expression of Q with w replaced by w andcomparing (13) with (14) we get

(1 − w)(1 − α)αk = αk(1 − s)2,

(1 − w)α(1 − αk+1) = βk s2.

Combining both the equations we obtain w = 2s(1− s). Noticethat Eqs. (8) and (9) also give us the expression for the pointof intersection of trigonometric curve segment Tk with the linesegment Q Pk−1 at parameter value t . The corresponding ratiow : 1−w can be obtained from Eq. (11). Let d = ‖Q − Pk−1‖,then

‖Tk(t ) − Pk−1‖ = (1 − w)d,

‖Bk(s) − Pk−1‖ = (1 − w)d.

Therefore

‖Tk(t ) − Pk−1‖ =1 − w

1 − w‖Bk(s) − Pk−1‖.

Hence for w > w, Tk will be closer to the control polygon thanBk and for w < w the converse will hold.

In order to compare w with the corresponding value of w, wereparametrize s by t with s =

2t π , so that w = 4t (π − 2t)/π2.

For w > w, we must have

f (t) = (1 + λ)π2(cos t + sin t − 1) − 4t (π − 2t) ≥ 0

∀t ∈ [0, π/2].

Notice that f (0) = f (π/2) = 0 and

f ′(t) = (1 + λ)π2(cos t − sin t) − 4π + 16t.

We further observe that f ′(t) > 0 on [0, π/4] and < 0 on(π/4, π/2] if and only if 1 + λ > 4/π . Under this condition

f (π/4) >π

2[8(

√2 − 1) − π ] > 0.

Hence f (t) ≥ 0 on [0, π/2]. This gives that w > w if and onlyif 1 + λ > 4

π.

We thus establish the following theorem.

Theorem 1. Let −1 < λ ≤ 1. For a given sequence of controlpoints {Pk}

nk=0 and parameter values u0 < u1 < · · · < un+3,

the C1-trigonometric quadratic B-spline curve given by (3) iscloser to the control polygon than the usual quadratic B-splinecurve defined for the same knot sequence and control points onthe interval [u2, un+1] if and only if λ + 1 > 4/π .

We now turn to discuss a sufficient condition under whichthe C1-trigonometric spline curve will be closer to the controlpolyline than the usual quadratic B-spline curve. This conditionestablishes a lower bound on the values of λ which is smallerthan that obtained in [3].

In order that the curve segment Tk be closer to the controlpolygon than the curve segment Bk on [uk, uk+1), we must havew ≥ w for every relevant choice of s and t . Since

max{w : 0 ≤ s ≤ 1} = 1/2,

it follows that w ≥ w if (cos t + sin t − 1)(1 + λ) ≥ 1/2for all t ∈ [0, π/2]. From (12) it follows that 1+λ

1+√

2≥ 1/2.

Therefore if λ ≥

√2−12 , then the trigonometric curve segment

Tk will be closer to the control polygon than Bk . Note that thislower bound on λ is smaller than the lower bound (

√5 − 2) as

obtained in [3].

4. Condition for tangency of a line segment to the curve

Let S0 and S1 be the end points of a given line segment S0S1.This line segment will be tangential to the given curve segmentTi defined on the interval [ui , ui+1] if

dTi

du× (S1 − S0) = 0. (15)

Now using the expression for Ti from (4) we can write theforegoing equation as follows.

dTi

du× (S1 − S0) =

π

2 4i[αi c

′(ti )(Pi−2 − Pi−1) × (S1 − S0)

+ βi d′(ti )(Pi − Pi−1) × (S1 − S0)]

= 0,

where c′(ti ) and d ′(ti ) denote derivatives with respect to ti . Thisgives

14i−1 + 4i

|c′(ti )|R =1

4i + 4i+1|d ′(ti )|S, (16)

where

R = |(Pi−2 − Pi−1) × (S1 − S0)|,

S = |(Pi − Pi−1) × (S1 − S0)|. (17)

Page 5: Constrained curve drawing using trigonometric splines having shape parameters

1062 N. Choubey, A. Ojha / Computer-Aided Design 39 (2007) 1058–1064

A little computation shows that c′(ti ) ≤ 0 and d ′(ti ) ≥ 0,for all λ and t ∈ [0, π/2]. Substituting the values of c′(ti ) andd ′(ti ), we can rewrite (16) as follows.

R4i−1 + 4i

cos ti [1 − λ(2 sin ti − 1)]

=S

4i + 4i+1sin ti [λ(1 − 2 cos ti ) + 1]

which gives

λ =ν sin ti − µ cos ti

µ cos ti (1 − 2 sin ti ) − ν sin ti (1 − 2 cos ti ), (18)

where

µ =R

4i−1 + 4i, ν =

S4i + 4i+1

.

In what follows, we shall use t for ti as mentioned earlier. Inorder to see that this value of λ is admissible, we must showthat −1 ≤ λ ≤ 1 holds for t ∈ [0, π/2]. Putting γ = µ/ν

and substituting the value of λ from Eq. (18) in the aboveconstruction of λ, we obtain the following pair of equations

(γ − 1) sin 2t ≤ 0, (19)

g(t) = 2γ cos t (1 − sin t) − 2 sin t (1 − cos t) ≥ 0, (20)

for values of t on [0, π/2], on which the denominator ispositive. Clearly (19) is satisfied if γ ≤ 1 for all t ∈ [0, π/2].We further observe that g is a decreasing function with a zerot∗ on the interval [0, π/2]. This zero depends on the value of γ

and t∗ ≤ π/4 if γ ≤ 1 and is beyond π/4 for γ > 1. Thereforeinequality (20) will also be satisfied on the interval [0, t∗] forall values of γ . Thus the line segment S0S1 will be tangential tothe given curve on [0, t∗] for λ given by (18), provided γ ≤ 1.We next turn to discuss the case when the denominator of λ

given by Eq. (18) is negative. In this case, we get the followingconstraints.

(γ − 1) sin 2t ≥ 0, (21)

and

g(t) ≤ 0. (22)

One can see that (21) holds for all t ∈ [0, π/2] provided γ ≥ 1,while (22) holds on [0, π/2] for all values of γ . Thus the linesegment S0S1 will be tangential to the curve with the value of λ

given by (18) on the interval [t∗, π/2] provided γ ≥ 1.

5. Constrained curve drawing problem

We assume that a planar boundary polygon B with verticesB0, B1, . . . , BL has been given with specified inside andoutside regions separated by the polygon. Further let P bethe control polyline of a C1-trigonometric spline curve withvertices P0, P1, . . . , Pn .

In order to plot the curve which remains inside the boundarypolygon, we shall consider the following two cases separately.

Case I. When P does not cross the boundary polygon B.Case II. When P is allowed to cross B.

Before we begin describing the algorithm, we give an outlineof some initial level preparations/rules that would be followedin the algorithm. Unless specified otherwise, we shall take4k−1 : 4k = 1. Further, as far as possible we shall make useof a constant shape parameter λ unless it is essential for us tomanipulate the curve with variable shape parameter or locallydifferent control parameters λk and δk . We begin by initializingthe minimum and maximum values of λ labelled as λL and λHrespectively with λL = −1 + ε, for some very small numberε > 0 and λH = 1. We next compute the local control triangle〈Ak−1 Pk−1 Ak〉 for each piece and find out the local feasiblerange of λ. Each time we determine the min and max admissiblevalues of λ for a curve segment, we update the values stored inthe variables λL and λH . If a common λ can be worked outfor each piece from the range λL ≤ λ ≤ λH , then we formthe entire composite curve using this value of λ. Else, we uselocally effective shape parameters. Then we find an admissiblerange of λ for each of the pieces.

We now begin with Case I. For each segment, form the localcontrol triangle 〈Ak−1 Pk−1 Ak〉, as the curve lies within thistriangle.

Suppose the convex hull 〈Ak−1 Pk−1 Ak〉 does not go outsidethe boundary polygon, then the curve will remain inside. Noupdating of λL or λH required for this segment. In this case, wechoose 4k−1 : 4k = 1.

Suppose 〈Ak−1 Pk−1 Ak〉 intersects with the outside region ofboundary polygon, then we have three main possibilities.

• When the boundary polygon enters the triangle by crossingthe line segment Ak−1 Ak . In this case, we change the curveso that it is drawn inside the polygon. This can be donein four different ways. (a) Use local shape parameter δk−1to slide the points Ak−1 and Ak on the polyline edgesPk−2 Pk−1 and Pk−1 Pk . (b) Use the variable shape parameteras introduced in [1] to pull the curve inside the boundary. (c)Change the shape parameter λ (Fig. 2 for λL ). (d) Change thevalues of domain parameter so that the local control trianglecomes inside the polygon.

• When the control triangle edge contains an edge of theboundary polygon and where the polygon is concave at oneof its vertices. Fig. 3a depicts such an example. In this case,we include both the vertices B j−2, B j−1 of the boundarypolygon in the spline control polyline. This will cause a linesegment in the resulting curve between Pk−2, B j−2, B j−1and Pk−1. Then the curve can be drawn between B j−1, Pk−1,Pk by choosing the parameter ratio 4k−1 : 4k appropriately.

• When the control triangle falls completely outside thepolygon. In this case it is not possible to draw the curveinside the boundary polyline. We perturb the point Pk−1 abit so that it lies inside the boundary polygon as shown inFig. 3b and draw the curve accordingly.

Fig. 4 shows an example of such a curve which has beenformed by taking into consideration of the above facts andmethods. Note that the computations made and conditionsobtained in Sections 2 and 3 for making the curve pass througha given point and tangential to a line segment will be used herein determining the values of λ (Fig. 2).

Page 6: Constrained curve drawing using trigonometric splines having shape parameters

N. Choubey, A. Ojha / Computer-Aided Design 39 (2007) 1058–1064 1063

Fig. 3a. The control polyline contains an edge of boundary polygon. The corresponding boundary polygon vertices included in the control polyline.

Fig. 3b. The control triangle is completely outside the boundary polygonexcept for the edges. The boundary polygon is concave at B j−1.

Fig. 4. The control polyline does not cross the boundary polygon.

We next turn to discuss the case when the control polylinecrosses the boundary polygon (Fig. 5).

As in Case I, we begin by determining the local controlpoints for all the curve segments, taking initially the ratio4k−1 : 4k = 1 and shape parameter also a constant. We nextconsider those local control triangles 〈Ak−1 Pk−1 Ak〉 whichcross the boundary and proceed as per one of the followingmethods.

• Use variable shape parameter λk s.t. λk(uk) = λk(uk+1) =

λ. and λk ∈ C1 so that the boundary edge becomestangential to the curve.

• Use the local parameter δk−1 as introduced in [5] and shiftthe points Ak−1 and Ak so that the curve lies inside theboundary polygon.

Fig. 5. The control polyline crossing the boundary polygon.

Fig. 6. Modified curve with condition for tangency used to pull the curve insidethe boundary polygon.

• Next, for the case shown in Fig. 6, a little more caution isrequired. We proceed as in Case I and consider λL and λH .We choose a variable shape λk such that λL ≤ λk(u) ≤ λHon the interval [uk, uk+1]. Or, we make use of the localparameter δk−1 to slide the points Ak−1 and Ak over theedges Pk−2 Pk−1 and Pk−1 Pk so that the curve remains insidethe domain.

6. Conclusion

In the present paper a method has been presented forcomputing trigonometric spline curves which remain on one

Page 7: Constrained curve drawing using trigonometric splines having shape parameters

1064 N. Choubey, A. Ojha / Computer-Aided Design 39 (2007) 1058–1064

side of a given boundary polygon. The authors have madesuch a study in view of the great potentials of trigonometricsplines in CAD/CAM applications. Especially, the presence ofshape parameters makes them more suitable for shape and pathmanipulation problems in robotics.

Acknowledgments

The authors wish to thank the anonymous reviewers whosecomments led to improvements in the paper. We are alsograteful to Prof. H.P. Dikshit, NBHM Visiting Professor, PDPMIIIT DMJ, India for his useful suggestions on the algorithm inSection 5. The first author’s work is supported under the facultyimprovement programme of UGC and the second author’s workis supported by MPCST and DEC funded projects.

References

[1] Choubey N, Ojha A. Trigonometric splines with variable shapeparameters. Rocky Mountain Journal of Mathematics 2007 [in press].

[2] Farin G. Curves and surfaces for CAGD: A practical guide. 5th ed.Morgan Kaufman; 2002.

[3] Han X. Quadratic trigonometric polynomial curves with a shapeparameter. Computer Aided Geometric Design 2002;19:503–12.

[4] Han X. C2 quadratic trigonometric polynomial curves with local bias.Journal of Computational and Applied Mathematics 2005;180:161–72.

[5] Han X. Quadratic trigonometric polynomial curves concerning localcontrol. Applied Numerical Mathematics 2006;56:105–15.

[6] Goodman TNT, Ong BH, Unsworth K. Constrained interpolation usingrational cubic splines. In: Farin G, editor. NURBS for curve and surfacedesign. Philadelphia: SIAM; 1991. p. 59–74.

[7] Meek DS, Ong BH, Walton DJ. A constrained guided G1 continuousspline curve. Computer Aided Design 2003;35:591–9.

[8] Meek DS, Ong BH, Walton DJ. Constrained interpolation with rationalcubics. Computer Aided Geometric Design 2003;20:253–75.

[9] Myles A, Peters J. Threading splines through 3D channels. ComputerAided Design 2005;37:139–48.

[10] Peters J, Wu X. SLEVEs for planar splines. Computer Aided GeometricDesign 2004;21:615–35.

[11] Ong BH, Unsworth K. On non parametric constrained interpolation.In: Lyche T, Schumaker LL, editors. Mathematical methods in computeraided geometric design II. Academic Press; 1992. p. 419–30.

[12] Secco EL, Visioli A, Magenes G. Minimum jerk planning of prostheticfinger. Journal of Robotic Systems 2004;21:361–8.

[13] Opher G, Oberle HJ. The derivation of cubic splines with obstacles bymethods of optimization and optimal control. Numerische Mathematik1988;52:17–31.

[14] Koch PE, Lyche T, Neamtu M, Schumaker LL. Control curves andknot insertion for trigonometric splines. Advances in ComputationalMathematics 1995;3:405–24.

[15] Neamtu M, Pottmann H, Schumaker LL. Designing NURBS CAM profileusing trigonometric splines. ASME Journal of Mechanical Design 1998;120:175–80.

[16] Pena JM. Shape preserving representation for trigonometric polynomialcurves. Computer Aided Geometric Design 1997;14:5–11.

[17] Schumaker LL, Trass C. Fitting scattered data on spherelike surfacesusing tensor product of trigonometric and polynomial splines. NumerischeMathematik 1991;60:133–44.

[18] Simon D, Isik C. Efficient cartesian path approximation for robots usingtrigonometric splines. In: Proceeding of the American control conference.1994. p. 1752–6.

[19] Schoenberg IJ. On trigonometric spline interpolation. Journal ofMathematics and Mechanics 1964;13:795–825.

[20] Zhang J. Two different forms of C-B splines. Computer Aided GeometricDesign 1997;14:31–41.