Skip to main content
Advertisement
Browse Subject Areas
?

Click through the PLOS taxonomy to find articles in your field.

For more information about PLOS Subject Areas, click here.

  • Loading metrics

A quadratic trigonometric spline for curve modeling

  • Shamaila Samreen ,

    Contributed equally to this work with: Shamaila Samreen, Muhammad Sarfraz, Malik Zawwar Hussain

    Roles Conceptualization, Methodology, Software, Visualization, Writing – original draft

    shamailasamreen16@gmail.com

    Affiliations Department of Mathematics, University of Engineering and Technology, Lahore, Pakistan, Department of Mathematics, University of the Punjab, Lahore, Pakistan

  • Muhammad Sarfraz ,

    Contributed equally to this work with: Shamaila Samreen, Muhammad Sarfraz, Malik Zawwar Hussain

    Roles Conceptualization, Investigation, Supervision, Writing – review & editing

    Affiliation Department of Information Science, College of Computing Sciences & Engineering, Kuwait University, Safat, Kuwait

  • Malik Zawwar Hussain

    Contributed equally to this work with: Shamaila Samreen, Muhammad Sarfraz, Malik Zawwar Hussain

    Roles Supervision

    Affiliation Department of Mathematics, University of the Punjab, Lahore, Pakistan

Abstract

An imperative curve modeling technique has been established with a view to its applications in various disciplines of science, engineering and design. It is a new spline method using piecewise quadratic trigonometric functions. It possesses error bounds of order 3. The proposed curve model also owns the most favorable geometric properties. The proposed spline method accomplishes C2 smoothness and produces a Quadratic Trigonometric Spline (QTS) with the view to its applications in curve design and control. It produces a C2 quadratic trigonometric alternative to the traditional cubic polynomial spline (CPS) because of having four control points in its piecewise description. The comparison analysis of QTS and CPS verifies the QTS as better alternate to CPS. Also, the time analysis proves QTS computationally efficient than CPS.

2. Introduction

Designing curves, especially robust curves, which are controllable, well behaved and easily worked out, contributes a special role in computer graphics and geometric modeling. A number of applications of these vigorous curves in modeling objects, CAD/CAM, font designing, object recognition, medical imaging and fingerprints recognition are the motivations in the direction of curve designing. Besides the applications, the significance of curve designing in computer visualization, robotics and even in broad casting is the inspiration to do research. In the existing literature, a wide-ranging effort has been put in the course of curve modeling. For reference, the readers are directed to [125].

It is favorable to adopt an effective, robust, well controlled and visually nice method as a key of many problems on a single platform. In the area of geometric modeling and computer graphics, a cubic polynomial spline (CPS) curve method is supposed to be an adequate approach in the current literature [125]. Deliberation of a stable and faster new spline, as a better alternate to CPS, accompanied by piecewise descriptions can be a better proposal for this paper. Thus, providing a quadratic trigonometric spline alternate of a CPS, which not only keeps decent attributes of CPS but is also computationally less expensive, could be a better choice for designers and engineers.

It is worthy to present a method for a class of trigonometric splines with a support of ideal geometric properties and efficiency. Boehm [1] constructed the curvature continuous curves and surfaces. Barsky [2] developed B-splines basis to Beta splines. He preserved the geometric smoothness property of the curve modeling while enabling the conditions of continuity on the splines at different knots to be assorted by certain shape parameters; thus, providing more flexibility. Cline [3] used the splines under tension for the curve fitting. Dierckx and Tytgat [4], presented a proficient procedure to compute the Bézier points of a generalized cubic β-spline curve and showed the connection with multiple knot insertion. They also determined the β-spline vertices for a composite G2 Bézier curve. Farin [5] has the detail study on curves and surfaces for Computer-Aided Geometric Design (CAGD). Foley [6] constructed the weighted spline to acquire the tension locally. Foley [7] built B-spline like local basis functions for weighted nu-splines. The local basis for GC2 splines was introduced by Lewis [8]. Nielson [910] described the classification of splines with tension and offered the alternates of splines under tension. The developed splines were the generalization of CPS, nu-splines and weighted splines. A general setting was specified by Pruess [11], for smooth interpolation of the splines depending on a parameter. Sarfraz [1217] constructed various spline techniques for shape modeling using various spline which are a big contribution in literature. Sarfraz [18] built a spline for object designing. The developed spline presents the generalization of Ball’s cubic spline. Hussain et al. [19] developed the shape preserving method using rational quadratic trigonometric function. Later Sarfraz et al. [2023] and Samreen et al. [24] constructed different spline methods for shape designing using a quadratic trigonometric splines with well controlled shape influences of parameters.

This paper presents a quadratic trigonometric spline (QTS) as a better alternate to the CPS. The proposed QTS method is robust, geometrically ideal, and computationally faster. The paper has been organized in various sections. Section 3 offers the QTS and CPS whereas Section 4 calculates the error analysis of QTS using Peano-Kernel Theorem. Section 5 proposes the new C2 QTS, it is presented here in interpolation form. An efficient and compact algorithm, to compute and plot the curve design, is also part of this section. Geometric properties of the proposed QTS are logically described and proved in Section 6. These properties include partition of unity, positivity, end-point interpolation, convex hull, affine invariance and variation diminishing. Section 7 provides a comparison analysis of the proposed QTS versus CPS. In this regard, area between two spline curves, visual differences, time elapsed of two splines and error analysis of both splines are taken into account. Section 8 is dedicated to specify the advantageous features of the proposed QTS method and analyzes the superiority of QTS over CPS. Finally, Section 9 concludes the paper.

3. The proposed spline

To describe the QTS, assume the data points at the knots ti, i = 0,1,…,n−1, where t0<t1<,…,<tn. For [ti,ti+1], i = 0,1,…,n−1, let and (1) where, , and (2)

Also, (3)

Then, eventually piecewise QTS behaves like a Hermite CPS. The Hermite CPS, defined for [ti,ti+1],ti<ti+1,∀ i = 0,1,…,n−1, with the data points Fi and Vi, , is described by: (4) where, , and (5)

Also, it can be obviously seen, the CPS fulfills the interpolation properties as in (3).

4. Error analysis of QTS

The error of QTS function (1) is calculated in this segment while the function F(t)∈[t0,tn] is interpolated. Since the quadratic trigonometric function interpolated locally without losing generality, the error is calculated in the subinterval [ti,ti+1]. Let P(t) be the quadratic trigonometric function of F(t) interpolated in [ti,ti+1] as defined in (1) then by applying the Peano-Kernel Theorem, where is the kernel of integral defined for the quadratic trigonometric function given by (6) with, and

The proof of the error estimation mainly consisting of two steps; discussing the properties of function u1(τ,t) and v1(τ,t) and in the second step, computing the absolute values and

Step 1: u1(τ,t) and v1(τ,t),τ∈[ti,t], are the quadratic trigonometric functions of τ. Also for all , u(ti,t) = 0 and v(ti+1,t) = 0.

Now to calculate the roots of u1(τ,t) and v1(τ,t), put τ = t in Eq (6) as and where, with implies that

Let, be an equation defined in θ, its root in is (7)

It implies, It can easily be observed that, for σσ*,u1(t,t)≤0 and for σσ*,u1(t,t)≥0. Consider (ti+1τ) = (ti+1t+tτ) = hi(1−σ)+(tτ). Now rewrite u1(τ,t) to observed sign of u1(τ,t) in [ti,t], as

Then the two roots of u1(τ,t) are and where and with the real values.

Similarly, it can be noted that for σσ*,v1(t,t)≤0 and for σσ*,v1(t,t)≥0. To show this sign change behavior rewrite v1(τ,t) as Then the two roots of v1(τ,t) are and using (ti+1τ) = (ti+1t+tτ) = hi(1−σ)+(tτ).

Step 2: While σ>σ*, u1(τ,t)>0 and when σ<σ*, u1(τ,t)<0. It can also noted that ti<τ2<τ1<t. Thus, for σ<σ*,u1(τ,t)<0 ∀ τ∈[ti,t], (8)

Also for σ>σ*, u1.(τ,t) changes sign on both sides of τ1 and τ2, so (9)

Similarly, it can display easily that when σσ*, v1(τ,t) moves from negative side to positive side of τ1*, and while σσ*, v1(τ,t)>0 in (t,ti+1), where σ* is given by Eq (7). Thus while taking σσ* (10) but while σσ*, (11)

So, combining (8) and (10), the following result holds for σσ*, where γ*(σ) is defined by (12) and the result obtained for σσ*, by combining (9) and (11), where, (13)

The above analysis yields the following results.

Theorem 1. Let P(t) be be the quadratic trigonometric function, as defined in (1). The error estimation of P(t) holds the followings: where γ*(σ) and γ*(σ) are respectively, taken from (12) and (13).

Remark 1. The coefficient of error term, d* can be defined as: (14)

5. Formation of C2 QTS

As seen in Section 2, the QTS is C1 by its construction. A C2 QTS can be formed by applying C2 continuity at the joints of curve segments as follows: (15)

From the second order derivative of (1), we simply achieve the followings: (16) and (17)

Let (18) then, the Eqs (16) and (17), respectively, crop to: (19) and (20)

Also (21)

Thus, using (19), (20) and (21) in (14), a tri-diagonal system of consistency equations is acquired by the followings: (22)

The above system can be expressed by the following matrix: (23)

It is supposed that end conditions D0 and Dn are given. One can choose the arbitrary end conditions by choice. Overall, for open curves, the end conditions D0 and Dn are determined using the given data points as follows: (24) (25)

For closed curves, the following periodic end conditions D0 = Dn are assumed: (26)

Thus, for the appropriate end conditions, the above system (22) is a tri-diagonal linear system and is diagonally dominant. It also retains unique solutions for Dis and hence a unique solution for QTS. To solve the tri-diagonal system for Dis, it is efficient to accomplish the LU-decomposition method. Thus, the above conversation can be concise as follows:

Theorem 2. The C2 QTS exists and has a unique solution.

5.1. Algorithm design

The above discussion is summarized in some steps here. It is done by designing a suitable algorithm for the curve modeling applications. In this way, a user may have an open choice to play with a curve at its own satisfaction level. It can be achieved by an appropriate algorithm design as follows:

  1. Step 1:Input control points Fi’s.
  2. Step 2:Compute the tangents Di’s, from the data points in Step 1, using system of Eqs (2326).
  3. Step 3:Compute the QTS curve (1) of Section 3.

This is a simple algorithm to implement QTS. The algorithm for CPS is also similar and hence not been mentioned here. Both of CPS and QTS have been implemented using Matlab [25] software.

5.2. Data of objects

The data of various objects drawn in the Figs is given in Table 1.

For the chosen data points C2 QTSs are demonstrated in Fig 1A–1F.

thumbnail
Fig 1.

The data points of different objects (a) Circle, (b) Lamp, (c) Car, (d) Flower, (e) Guitar, (f) Vase, are interpolated by QTS with periodic end conditions.

https://doi.org/10.1371/journal.pone.0208015.g001

6. Geometric properties of QTS

The QTS owns several ideal geometric properties discussed by the propositions as follow:

Proposition 1 (Convex Hull Property (CHP)): The QTS curve lies completely inside the convex hull determined by its control polygon.

Proof: By re-writing Eq (1) as: (27) where Bj(θ)≥0,j = 0,…,3, are Bernstein Bézier like functions and . Therefore, the QTS curve lies within the convex hull as shown in Fig 2.

Proposition 2 (Affine Invariance Property (AIP)): Let be the C2 QTS curve and be the control points. Then C2 QTS curve is invariant under affine transformation.

Proof: Let, (x1,y1) = (a1x+a2y+a3,b1x+b2y+b3), be an affine transformation and dj(lj,mj),j = 0,…,3 be the control points of the C2 QTS curve for t∈[ti,ti+1]. Then,

Now, As we have Thus,

The AIP proved in Preposition 2, is illustrated in Fig 3.

thumbnail
Fig 3.

AIP using Data of Letter “A” and its corresponding QTS with (a) translation, (b) scaling, (c) rotation with angle π and (d) shearing.

https://doi.org/10.1371/journal.pone.0208015.g003

Proposition 3 (Variation Diminishing Property (VDP)): Consider the QTS curve for t∈[ti,ti+1], having control points Then any N−1 dimensional plane will intersect the QTS curve no more times than it will intersect the control polygon.

The VDP is displayed, in Fig 4(A), (B) and (C), for different object data of Butterfly, Fish, and Car respectively. The interpolated QTS curves behave positively in all the model curves.

thumbnail
Fig 4.

VDP for various object data and their corresponding QTSs: (a) Butterfly, (b) Fish, (c) Car.

https://doi.org/10.1371/journal.pone.0208015.g004

7. Comparison analysis

In this section, a brief comparison analysis of QTS and CPS is discussed. In this regard area of each spline, area between two spline curves QTS and CPS, visual differences of QTS and CPS, time elapsed of the two splines and error analysis of both splines are taken into account.

7.1. Area covered by CPS

The area of the CPS, defined in the interval [ti,ti+1], is derived as follows: . Here, , and so, . Thus, (28)

7.2. Area covered by QTS

The QTS, defined by (1) in the interval [ti,ti+1], has the area to be derived as follows: , since, , , so, . Thus, (29)

7.3. Area analysis of QTS and CPS

It can be noticed from (28) and (29) that mathematically, the areas of the CPS and QTS are two different entities. This difference can also be noticed visually. For example, the QTS and the CPS are interpolated using the functions f = sin(t), tan(t) and et. The area plots and the area between these two spline curves are demonstrated for area analysis of both splines.

In Figs 5(A), 6(A) and 7(A), CPS interpolates the functions f = sin(t), tan(t) and et, respectively, while in Figs 5(B), 6(B) and 7(B), these functions are interpolated by QTS. Figs 5(C), 6(C) and 7(C) demonstrate the area plots of the functions f = sin(t), tan(t) and et, through the CPS, while Figs 5(D), 6(D) and 7(D) demonstrate the area plots of these functions by QTS. Finally, in the Figs 5(E), 6(E) and 7(E), area differences between two the splines CPS and QTS are demonstrated.

thumbnail
Fig 5.

Area Analysis of QTS and CPS using f = sin(t): (a) Plot of CPS, (b) Plot of QTS, (c) Area plot of CPS, (d) Area plot of QTS, and (e) Area between CPS and QTS.

https://doi.org/10.1371/journal.pone.0208015.g005

thumbnail
Fig 6.

Area Analysis of QTS and CPS using f = tan(t): (a) Plot of CPS, (b) Plot of QTS, (c) Area plot of CPS, (d) Area plot of QTS, and (e) Area between CPS and QTS.

https://doi.org/10.1371/journal.pone.0208015.g006

thumbnail
Fig 7.

Area Analysis of QTS and CPS using f = et: (a) Plot of CPS, (b) Plot of QTS, (c) Area plot of CPS, (d) Area plot of QTS, and (e) Area between CPS and QTS.

https://doi.org/10.1371/journal.pone.0208015.g007

7.4. Visual difference between the CPS and QTS

The QTS interpolates almost like the CPS. However, because of different areas covered by them, their visual outputs are slightly variant from each other. To view the differences between the two splines CPS and QTS, the data of distinct existing objects is interpolated to produce design curves.

In Fig 8(A), data of the letter “A” is interpolated by CPS, while in Fig 8(B), the same object is interpolated using QTS. One can easily judge that the QTS is showing visually better smoothness than the CPS in almost every piece of curve. The curve in QTS is piece wisely more bulged outward as compared to its CPS counterpart.

thumbnail
Fig 8.

Data of the letter “A” is interpolated: (a) by CPS; (b) by QTS.

https://doi.org/10.1371/journal.pone.0208015.g008

Like in Fig 8, one can notice similar to the behavior in Fig 9 too. In Fig 9(A), data of “Lamp” is interpolated by CPS, while in Fig 9(B), it is interpolated using QTS. It is very clearly judgable that the QTS shows visually better smoothness than the CPS in almost every piece of curve. The curve in QTS is piece wisely more bulged outward as compared to its CPS counterpart.

thumbnail
Fig 9.

Data of a lamp is interpolated: (a) by CPS; (b) by QTS.

https://doi.org/10.1371/journal.pone.0208015.g009

In Fig 10(A) and Fig 10(B), data of the “Car” is interpolated by CPS and QTS respectively. The QTS is showing visually smoother and bulging attitude in every piece of curve as compared to the CPS.

thumbnail
Fig 10.

Data of a car is interpolated: (a) by CPS; (b) by QTS.

https://doi.org/10.1371/journal.pone.0208015.g010

Adding another example of a Vase in Fig 11, does not surprise to previous figures demonstrations. Fig 11(A) and Fig 11(B) are interpolated curves by CPS and QTS respectively. The QTS, as usual, is showing visually smoother and bulging attitude in every piece of curve as compared to the CPS.

thumbnail
Fig 11.

Data of a vase is interpolated: (a) by CPS; (b) by QTS.

https://doi.org/10.1371/journal.pone.0208015.g011

7.5. Time elapsed by the two splines

The comparison analysis that the QTS is superior to CPS is also justified by comparing the time of execution of both the splines. Data of nine different objects, see Table 2, have been chosen for an extensive study.

In Table 2, different computed timings have been calculated for a variety of curves for data of nine objects mentioned in Column 2. The data in Column 3 represents the time elapsed by CPS, Column 4 represents the time elapsed by QTS, and Column 5 represents the difference of the times elapsed between CPS and QTS. It is very obvious to observe that the time elapsed by QTS is much smaller in quantity than that of the CPS. This difference is very significant as can be seen in Column 5 of Table 2. Hence, with a variety of experimentations, in Table 2, it is not difficult to decide that the proposed QTS is much faster curve interpolation scheme than the traditional CPS. Hence, QTS is a better substitute to CPS.

7.6. Error analysis for CPS and QTS

The error calculated by both CPS and QTS is defensible for comparing these splines. It is presented in Table 3 for six distinct trigonometric, logarithmic and polynomial functions sin(t),cos(t),tan(t),sec(t),log(t) and shown in column 3. The domain of the functions are mentioned in column 2. Errors of these functions with CPS and QTS are shown in columns 4 and 5 respectively. Column 6 of Table 3 shows the difference of errors calculated by CPS and QTS. The difference, in column 6, between errors of both the splines is calculated to observe the accuracy of the splines.

thumbnail
Table 3. Table of error analysis, for CPS and QTS, for a variety of functions.

https://doi.org/10.1371/journal.pone.0208015.t003

8. Advantages of the proposed QTS

In this paper, a substantial method has been developed to construct a C2 QTS and a brief comparison analysis is discussed. The advantages of proposed scheme are comprehended as follows:

  • The proposed QTS scheme has decent characteristics of trigonometric splines.
  • The method keeps the suitable geometric properties of splines.
  • It carries out the C2 smoothness.
  • The proposed QTS produces an alternative to traditional CPS because of having four control points in its piecewise description.
  • The comparison analysis of QTS and CPS, in Section 6, verifies the QTS as smother, more flexible, and more accurate alternate to CPS.
  • The time analysis proves QTS computationally faster than CPS.

We can analyze the features of both QTS as well as CPS to see an overview of the two spline methods. It will highlight the differences between QTS and CPS. This is demonstrated in Table 4.

9. Conclusion

A C2 spline technique QTS is proposed and built with the eagerness of the object modeling using quadratic trigonometric functions. The curve model built through the proposed method owns the best suitable geometric properties such as partition of unity, CHP, AIP and VDP. The proposed scheme is more advantageous over the traditional CPS method. It is smoother, more flexible, faster and more accurate alternate to CPS. Furthermore, the built curve method is modest overall and is ideal for curve modeling. The authors, as future work, are also looking to expand the idea of the proposed QTS curve models for the designing of surface models.

Supporting information

References

  1. 1. Boehm W., Curvature continuous curves and surfaces, Computer Aided Geometric Design, 2(2) (1985) 313–323.
  2. 2. Barsky B., The Beta-spline: A local representation based on shape parameters and fundamental geometric measure, Ph.D. Thesis, University of Utah, 1981.
  3. 3. Cline A., Curve fitting in one and two dimensions using splines under tension, Communications of the ACM, 17 (1974) 218–223.
  4. 4. Dierckx P., Tytgat B., Generating the Bézier points of B-spline curve, Computer Aided Geometric Design, 6 (1989) 279–291.
  5. 5. Farin G. E., Curves, surfaces for CAGD, New York, Academic Press (1996).
  6. 6. Foley T. A., Local control of interval tension using weighted splines, Computer Aided Geometric Design, 3 (1987) 281–294.
  7. 7. Foley T. A., Interpolation with interval and point tension controls using cubic weighted υ-splines, ACM Transactions on Mathematical Software, 13 (1987) 68–96.
  8. 8. Lewis J., B-spline bases for splines under tension, Nu splines, and fractional order splines, Presented at the SIAM-SIGNUM-Meeting, San Francisco, USA, (1975).
  9. 9. Nielson G M., Some piecewise polynomial alternatives to S-splines under tension, Computer aided geometric design, (1974) 209–235.
  10. 10. Nielson G. M., Rectangular υ-splines, IEEE Computer Graphics Application, 6 (1986) 35–40.
  11. 11. Pruess S., Alternatives to the exponential spline in tension, Mathematics of Computation, 33 (1979) 1273–1281.
  12. 12. Sarfraz M., A C2 rational cubic spline alternative to the NURBS, Computers and Graphics 16(1) (1992) 69–78.
  13. 13. Sarfraz M., curves, surfaces for CAD using C2 rational cubic splines. International Journal of Engineering with Computers, 11(2) (1995) 94–102.
  14. 14. Sarfraz M., Freeform rational bicubic spline surfaces with tension control, FACTA UNIVERSITATIS (NIS). Series of Mathematics and Informatics, 9 (1994) 83–93.
  15. 15. Sarfraz M., Cubic spline curves with shape control, International Journal of Computers and Graphics, 18(5) (1994) 707–713.
  16. 16. Sarfraz M., Weighted Nu splines: an alternative to NURBS, advances in geometric modeling, Sarfraz M. (Ed), NewYork: Wiley; ISBN: 0-470-85937-7, (2003) 81–95.
  17. 17. Sarfraz M., Weighted Nu splines with local support basis, Computers and Graphics, 28 (2004) 539–549.
  18. 18. Sarfraz M., Designing objects with a spline, International Journal of Computer Mathematics, 87 (4) (2010) 797–817.
  19. 19. Hussain M. Z., Hussain M. and Waseem A., Shape-preserving trigonometric functions, Computational and Applied Mathematics, 33 (2) (2014) 411–431.
  20. 20. Sarfraz M., Samreen S., Hussain M. Z., (2016), Modeling of 2D objects with weighted-Quadratic Trigonometric Spline, 13th International Conference on Computer Graphics, Imaging and Visualization, Benni Mellall, Morocco, March 29-April 01, 2016, pp. 29–34, ISSN: 978-1-5090-0811-7, IEEE.
  21. 21. Sarfraz M., Samreen S., Hussain M. Z., (2017), A Quadratic Trigonometric Nu Spline with Shape Control, International Journal of Image and Graphics, Vol. 17(3), pp. 01–17, World Scientific.
  22. 22. Sarfraz M., Samreen S., Hussain M. Z., (2017), A Quadratic Trigonometric Weighted Spline with Local Support Basis Functions, Alexandria Engineering Journal, Elsevier, https://doi.org/10.1016/j.aej.2017.02.016.
  23. 23. Sarfraz M., Samreen S., Hussain M. Z., (2018), Designing by a Quadratic Trigonometric Spline with point and Interval Shape Control, The 2018 International Conference on Scientific Computing (CSC’18), Las Vegas, USA, Jul 30- Aug 2, 2018, IEEE (Accepted).
  24. 24. Samreen S., Sarfraz M., Jabeen N., Hussain M. Z., (2017), Computer Aided Design using a Rational Quadratic Trigonometric Spline with Interval Shape Control, International Conference on Computational Science and Computational Intelligence, Las Vegas, USA, Dec 14–16, 2017, pp. 246–251, ISSN: 978-1-5386-2652-8, IEEE.
  25. 25. Matlab, (2018), MathWorks, USA, https://www.mathworks.com/.