A quadratic trigonometric spline for curve modeling

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.


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 .
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 . 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 G 2 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 GC 2 splines was introduced by Lewis [8]. Nielson [9][10] 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 [12][13][14][15][16][17] 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. [20][21][22][23] 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 C 2 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, endpoint 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.

The proposed spline
To describe the QTS, assume the data points F i �R n at the knots t i , i = 0,1,. . .,n−1, where t 0 <t 1 <,. . .,<t n . For t�[t i ,t i+1 ], i = 0,1,. . .,n−1, let V i ; W i �R n and Also, Then, eventually piecewise QTS behaves like a Hermite CPS. The Hermite CPS, defined for t�[t i ,t i+1 ],t i <t i+1 ,8 i = 0,1,. . .,n−1, with the data points F i and V i , W i �R n , is described by: Also, it can be obviously seen, the CPS fulfills the interpolation properties as in (3).

Error analysis of QTS
The error of QTS function (1) is calculated in this segment while the function F(t)2[t 0 ,t n ] is interpolated. Since the quadratic trigonometric function interpolated locally without losing generality, the error is calculated in the subinterval [t i ,t i+1 ]. Let P(t) be the quadratic trigonometric function of F(t) interpolated in [t i ,t i+1 ] as defined in (1) then by applying the Peano- þ � is the kernel of integral defined for the quadratic trigonometric function given by The proof of the error estimation mainly consisting of two steps; discussing the properties of function u 1 (τ,t) and v 1 (τ,t) and in the second step, computing the absolute values R t t i ju 1 ðt; tÞjdt and R t iþ1 t jv 1 ðt; tÞjdt: Step 1: u 1 (τ,t) and v 1 (τ,t),τ2[t i ,t], are the quadratic trigonometric functions of τ. Also for all y 2 0; p 2 � � , u(t i ,t) = 0 and v(t i+1 ,t) = 0. Now to calculate the roots of u 1 (τ,t) and v 1 (τ,t), put τ = t in Eq (6) as u 1 t; t ð Þ ¼ ðt À tÞ 2 À 2cosyð1 À cosyÞ ðt iþ1 À tÞ 2 À 2h i p ðt iþ1 À tÞ It implies, y � ¼ p 2 À 1: It can easily be observed that, for σ�σ � ,u 1 (t,t)�0 and for σ�σ � ,u 1 (t, t)�0.
ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi Similarly, it can be noted that for σ�σ � ,v 1 (t,t)�0 and for σ�σ � ,v 1 (t,t)�0. To show this sign change behavior rewrite v 1 Step 2: While σ>σ � , u 1 (τ,t)>0 and when σ<σ � , u 1 (τ,t)<0. It can also noted that t i <τ 2 <τ 1 <t.

Formation of C 2 QTS
As seen in Section 2, the QTS is C 1 by its construction. A C 2 QTS can be formed by applying C 2 continuity at the joints of curve segments as follows: From the second order derivative of (1), we simply achieve the followings: and P 00 iÀ 1 ðt i Þ ¼ Let then, the Eqs (16) and (17), respectively, crop to: and Also Thus, using (19), (20) and (21) in (14), a tri-diagonal system of consistency equations is acquired by the followings: The above system can be expressed by the following matrix: . . .
It is supposed that end conditions D 0 and D n are given. One can choose the arbitrary end conditions by choice. Overall, for open curves, the end conditions D 0 and D n are determined using the given data points as follows: For closed curves, the following periodic end conditions D 0 = D n are assumed: 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 Di 0 s and hence a unique solution for QTS. To solve the tri-diagonal system for Di 0 s, it is efficient to accomplish the LUdecomposition method. Thus, the above conversation can be concise as follows: Theorem 2. The C 2 QTS exists and has a unique solution.

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: Step 1:Input control points F i 's.
Step 2:Compute the tangents D i 's, from the data points in Step 1, using system of Eqs (23-26).
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.

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

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: where B j (θ)�0,j = 0,. . .,3, are Bernstein Bézier like functions and P 3 j¼0 B j ðyÞ ¼ 1. Therefore, the QTS curve lies within the convex hull as shown in Fig 2. Proposition 2 (Affine Invariance Property (AIP)): Let PðtÞ ¼ P 3 j¼0 d j B j ðtÞ be the C 2 QTS curve and d j ¼ fF i ; V i ; W i ; F iþ1 g 2 R n be the control points. Then C 2 QTS curve is invariant under affine transformation.

Proposition 3 (Variation Diminishing Property (VDP)): Consider the QTS curve for t2
[t i ,t i+1 ], PðtÞ ¼ P 3 j¼0 d j B j ðtÞ having control points d j ¼ fF i ; V i ; W i ; F iþ1 Þ 2 R n : Then any N−1

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.

Area covered by CPS
The area of the CPS, defined in the interval [t i ,t i+1 ], is derived as follows:

Area covered by QTS
The QTS, defined by (1) in the interval [t i ,t i+1 ], has the area to be derived as follows:

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 e t . The area plots and the area between these two spline curves are demonstrated for area analysis of both splines. In

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.
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.

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.

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
ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi t þ 6 p þ ðt þ 2Þ 2 shown in column 3. The domain of the  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.

Advantages of the proposed QTS
In this paper, a substantial method has been developed to construct a C 2 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 C 2 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.

Conclusion
A C 2 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 S1
QTS has four blending functions in an interval.
4. CPS owns the suitable geometric properties of splines.
QTS has the same geometric properties of splines as that of CPS.
6. The curve represented by CPS has reasonable bulge to represent flexibility.
The curve represented by QTS has more bulge than CPS.
7. The area covered by the CPS is quite reasonable.
The area covered by the QTS is more than CPS.
8. CPS is visually pleasing looking. QTS is visually pleasing looking too and has more flexibility being able to have more bulge in the curve.
9. CPS has reasonable computation error. QTS observes less error of computation as compared to CPS and hence has more accuracy of the spline approximation.
10. CPS elapses more time for execution. The time elapsed by QTS is much smaller than CPS.
11. CPS is economical in computation. QTS is more economical in computation as compared to CPS.
12. CPS is a well-known and recognized spline method used for Curve design.
QTS is a better alternative to CPS and hence expected to be more popular than CPS. https://doi.org/10.1371/journal.pone.0208015.t004