Preface

Splines are piecewise polynomials that are joined smoothly, and they provide a significant tool for the design of computationally economical curves and surfaces. This, in return, plays a critical role in the construction of various objects like automobiles, ship hulls, airplane fu‐ selages and wings, propeller blades, shoe insoles, bottles, etc. It also contributes in the de‐ scription of geological, physical, statistical, and even medical phenomena. Moreover, spline methods have also proven to be indispensable in a variety of modern industries, including *computer vision*, *robotics*, *signal and image processing*, *visualization*, *textile*, *graphic designs*, *art de‐ signs*, *painting*, *animations in the film industry*, *font designs in publishing*, and even *media*.

The major goals of this book are to stimulate views and provide a source where researchers and practitioners can find the latest developments in the field of splines. Due to speedy sci‐ entific developments, there is a great deal of thirst among the scientific community world‐ wide to be equipped with state-of-the-art theory and practice to get their problems solved in diverse areas of various disciplines. Although a good amount of work has been done by researchers, a tremendous interest is increasing every day due to complicated problems be‐ ing faced in the academia and industry, especially in areas where data are essential for re‐ search.

This book aims to provide a valuable source on splines and their applications. It focuses on some interdisciplinary methods using splines. It targets to provide the user community with a variety of spline techniques and their applications necessary for various real-life problems. It also aims to collect and disseminate information in various disciplines including *computeraided geometric design, computer graphics, data visualization, data fitting, digital signal processing, power systems, clinical and epidemiologic studies, disease detection, regression curves, social media, and biological studies*.

This book has seven chapters consisting of several new advances in the area. These contribu‐ tions provide a modern, up-to-date literature review, theory, techniques, methodology, soft‐ ware developments, and applications. The book is useful for researchers, scientists, practitioners, and many others who seek state-of-the-art techniques and applications using splines. It is also useful for undergraduate senior students as well as graduate students in the areas of computer science, engineering, health science, statistics, and mathematics. An important feature of the book is that each chapter also provides useful information on the software developments and their extensions.

The book begins with an exposition of splines from a numerical analysis point of view. The first chapter entitled "Scalar and Parametric Spline Curves and Surfaces" was prepared by Horacio Florez and Belsay Borges. In the absence of noise, their work tackles passing a curve/surface through a given set of data points. They first focus on the case in which the curve to be constructed can be described as a scalar spline for the manipulation of dataset as scalar data. They describe herein cubic and tension splines, which are powerful interpolants suitable to tackle large datasets. They then introduce a parametric case for a vector-valued curve, and, hence, it is able to represent arbitrary topologies. They explain how to construct piecewise continuous cubic Bèzier curves called "B-splines." They address both interpola‐ tion and approximation problems, the latter denoted as "inverse design." They extend the treatment further to tensor product surfaces that are referred to as piecewise bicubic Bsplines. Applications encompass translational and interpolation surfaces. They briefly intro‐ duce nonuniform rational B-spline (NURBS) curves and surfaces. They present applications such as approximating conic sections. They, finally, introduce Duchon splines that are radial basis functions to interpolate scattered datasets in two or three dimensions.

cell library that accurately and efficiently captures cell behaviors. In this chapter, the MARS method is employed to characterize the gate delay as a function of many parameters including process-voltage-temperature parameters. Due to its ability of capturing essential nonlineari‐ ties and interactions, MARS method helps to achieve significant accuracy improvement.

Preface IX

Complex and massive datasets can be easily accessed using the newly developed data ac‐ quisition technology. In spite of the fact that the smoothing spline ANOVA models have proven to be useful in a variety of fields, these datasets impose the challenges on the appli‐ cations of the models. To address the need for statistical inference in addition to exploring the regression model structures, this is effectively done by casting the spline fitting proce‐ dure in the *reproducing kernel Hilbert space* (RKHS). Jingyi Zhang et al., in Chapter 4 "Smoothing Spline ANOVA Models and Their Applications in Complex and Massive Data‐ sets," present a selected review of the smoothing spline ANOVA models and highlight some challenges and opportunities in massive datasets. They review a heuristic method for the inference and two approaches to significantly reduce the computational costs of fitting the model. The real case studies in social media and biological studies are used to illustrate the

In the next chapter, NA Li describes a "Model Testing Based on Regression Spline" by offer‐ ing an alternative approach to statistical tests of hypotheses based on regression spline. Spe‐ cifically, the methods are developed for testing functional relationships in nonparametric, partial linear, and varying-coefficient models, respectively. These models are more flexible than the linear regression models. They are also more efficient than the other nonparametric kernel-based methods especially in high-dimensional problems. However, one important problem is that if it is useful to use regression spline and fiducial method in order to obtain p-values for testing the linearity and constancy of the nonparametric functions. In the appli‐ cation of spline-based method, the determination of knots is difficult but plays an important role in inferring regression curve. In order to infer the nonparametric regression at different smoothing levels (scales) and locations, multi-scale smoothing methods based on regression spline are developed to test the structures of the regression curve and compare multiple re‐ gression curves. It could sidestep the determination of knots, meanwhile giving a more reli‐

Statistics offers several methods for handling noise in addition to the least squares type of approaches. One of these is to formulate the likelihood structure of the data. Motivated by the use of penalized spline, Chapter 6, "Penalized Spline Joint Models for Longitudinal and Time-to-Event Data" by Huong Thi Thu Pham and Hoa Pham, addresses the issue of joint models for longitudinal and time-to-event data. The joint models for longitudinal data and time-to-event data have recently received numerous attention in clinical and epidemiologic studies. This chapter attracts readers' interest in modeling the relationship between time-toevent outcomes and internal time-dependent covariates. In practice, the longitudinal re‐ sponses often show nonlinear and fluctuated curves. Therefore, the main aim of this chapter is to use penalized splines with a truncated polynomial basis to parameterize the nonlinear longitudinal process. The linear mixed-effects model is applied to subject-specific curves to control the smoothing. The association between the dropout process and longitudinal out‐ comes is modeled through a proportional hazards model. Two types of baseline risk func‐ tions are considered, namely, a Gompertz distribution and a piecewise constant model. The resulting models are referred to as penalized spline joint models, an extension of the stand‐

performance of the reviewed methods.

able result in using the spline-based method.

ard linear joint models.

Splines play an important role in modern signal processing. In addition to providing new insights into the sampling theory, they are also perfect candidates for constructing basis functions such as wavelets for multiresolution processing. A good illustration is given in Chapter 2, "An Algorithm Based on the Continuous Wavelet Transform with Splines for the Automatic Measurement of QT Dispersion: Validation and Application in Chronic Kidney Disease" by María de Lourdes Corzo-Cuesta and Carlos Alvarado-Serrano. Chronic kidney disease (CKD) is considered a risk factor for development of cardiovascular disease. QT in‐ terval is an electrocardiographic parameter that quantifies the duration of ventricular repo‐ larization. An increase of its spatial variability measured from selected leads of a standard electrocardiogram (ECG), named QT dispersion (QTd), is considered a risk factor for malign ventricular arrhythmias and sudden death in the CKD. An algorithm is presented for auto‐ matic measurement of QTd in the ECG leads DI, aVF, and V2 using the continuous wavelet transform with splines. Validation of QRS complex detection has been done on records from MIT-BIH database, and the accuracy has been of 99.5%. Validation of detection of QRS wave onset and T wave end has been done on records from CSE and QT databases, and the meas‐ urements are within the tolerance limits for deviations with respect to the manual measure‐ ments defined by the experts. In this chapter, the algorithm has been applied for two studies. In the first one, QTd is evaluated in normal subjects and patients with CKD. In the second study, QTd is analyzed in patients with CKD before, during, and after the hemodial‐ ysis treatment. In both studies, the algorithm has a good performance for the QTd analysis. This is an example of biomedical signal analysis where data are taken over time.

The next few chapters discuss how to address noise issues when data are obtained as a ran‐ dom sample from certain populations. Chapter 3 discusses multivariate adaptive regression splines (MARS), which is a nonparametric regression method based on a least squares for‐ mulation. It is an adaptive procedure that does not require any prespecified functional forms of the components in the regression model. The model can be additive with only the main effects or interactive involving a set of selected variables. With that said, the model structure of MARS is constructed dynamically and adaptively according to the information derived from the data. Because of its ability to capture essential nonlinearities and interac‐ tions, MARS is considered as a great fit for high-dimensional problems by low-dimensional components such as the main or interactive effects.

The chapter entitled "Multivariate Adaptive Regression Splines in Standard Cell Characteri‐ zation for Nanometer Technology in Semiconductor" by Taizhi Liu illustrates an application of MARS in semiconductor field, more specifically, in standard cell characterization. The ob‐ jective of standard cell characterization is to create a set of high-quality models of a standard cell library that accurately and efficiently captures cell behaviors. In this chapter, the MARS method is employed to characterize the gate delay as a function of many parameters including process-voltage-temperature parameters. Due to its ability of capturing essential nonlineari‐ ties and interactions, MARS method helps to achieve significant accuracy improvement.

curve to be constructed can be described as a scalar spline for the manipulation of dataset as scalar data. They describe herein cubic and tension splines, which are powerful interpolants suitable to tackle large datasets. They then introduce a parametric case for a vector-valued curve, and, hence, it is able to represent arbitrary topologies. They explain how to construct piecewise continuous cubic Bèzier curves called "B-splines." They address both interpola‐ tion and approximation problems, the latter denoted as "inverse design." They extend the treatment further to tensor product surfaces that are referred to as piecewise bicubic Bsplines. Applications encompass translational and interpolation surfaces. They briefly intro‐ duce nonuniform rational B-spline (NURBS) curves and surfaces. They present applications such as approximating conic sections. They, finally, introduce Duchon splines that are radial

Splines play an important role in modern signal processing. In addition to providing new insights into the sampling theory, they are also perfect candidates for constructing basis functions such as wavelets for multiresolution processing. A good illustration is given in Chapter 2, "An Algorithm Based on the Continuous Wavelet Transform with Splines for the Automatic Measurement of QT Dispersion: Validation and Application in Chronic Kidney Disease" by María de Lourdes Corzo-Cuesta and Carlos Alvarado-Serrano. Chronic kidney disease (CKD) is considered a risk factor for development of cardiovascular disease. QT in‐ terval is an electrocardiographic parameter that quantifies the duration of ventricular repo‐ larization. An increase of its spatial variability measured from selected leads of a standard electrocardiogram (ECG), named QT dispersion (QTd), is considered a risk factor for malign ventricular arrhythmias and sudden death in the CKD. An algorithm is presented for auto‐ matic measurement of QTd in the ECG leads DI, aVF, and V2 using the continuous wavelet transform with splines. Validation of QRS complex detection has been done on records from MIT-BIH database, and the accuracy has been of 99.5%. Validation of detection of QRS wave onset and T wave end has been done on records from CSE and QT databases, and the meas‐ urements are within the tolerance limits for deviations with respect to the manual measure‐ ments defined by the experts. In this chapter, the algorithm has been applied for two studies. In the first one, QTd is evaluated in normal subjects and patients with CKD. In the second study, QTd is analyzed in patients with CKD before, during, and after the hemodial‐ ysis treatment. In both studies, the algorithm has a good performance for the QTd analysis.

basis functions to interpolate scattered datasets in two or three dimensions.

VIII Preface

This is an example of biomedical signal analysis where data are taken over time.

components such as the main or interactive effects.

The next few chapters discuss how to address noise issues when data are obtained as a ran‐ dom sample from certain populations. Chapter 3 discusses multivariate adaptive regression splines (MARS), which is a nonparametric regression method based on a least squares for‐ mulation. It is an adaptive procedure that does not require any prespecified functional forms of the components in the regression model. The model can be additive with only the main effects or interactive involving a set of selected variables. With that said, the model structure of MARS is constructed dynamically and adaptively according to the information derived from the data. Because of its ability to capture essential nonlinearities and interac‐ tions, MARS is considered as a great fit for high-dimensional problems by low-dimensional

The chapter entitled "Multivariate Adaptive Regression Splines in Standard Cell Characteri‐ zation for Nanometer Technology in Semiconductor" by Taizhi Liu illustrates an application of MARS in semiconductor field, more specifically, in standard cell characterization. The ob‐ jective of standard cell characterization is to create a set of high-quality models of a standard Complex and massive datasets can be easily accessed using the newly developed data ac‐ quisition technology. In spite of the fact that the smoothing spline ANOVA models have proven to be useful in a variety of fields, these datasets impose the challenges on the appli‐ cations of the models. To address the need for statistical inference in addition to exploring the regression model structures, this is effectively done by casting the spline fitting proce‐ dure in the *reproducing kernel Hilbert space* (RKHS). Jingyi Zhang et al., in Chapter 4 "Smoothing Spline ANOVA Models and Their Applications in Complex and Massive Data‐ sets," present a selected review of the smoothing spline ANOVA models and highlight some challenges and opportunities in massive datasets. They review a heuristic method for the inference and two approaches to significantly reduce the computational costs of fitting the model. The real case studies in social media and biological studies are used to illustrate the performance of the reviewed methods.

In the next chapter, NA Li describes a "Model Testing Based on Regression Spline" by offer‐ ing an alternative approach to statistical tests of hypotheses based on regression spline. Spe‐ cifically, the methods are developed for testing functional relationships in nonparametric, partial linear, and varying-coefficient models, respectively. These models are more flexible than the linear regression models. They are also more efficient than the other nonparametric kernel-based methods especially in high-dimensional problems. However, one important problem is that if it is useful to use regression spline and fiducial method in order to obtain p-values for testing the linearity and constancy of the nonparametric functions. In the appli‐ cation of spline-based method, the determination of knots is difficult but plays an important role in inferring regression curve. In order to infer the nonparametric regression at different smoothing levels (scales) and locations, multi-scale smoothing methods based on regression spline are developed to test the structures of the regression curve and compare multiple re‐ gression curves. It could sidestep the determination of knots, meanwhile giving a more reli‐ able result in using the spline-based method.

Statistics offers several methods for handling noise in addition to the least squares type of approaches. One of these is to formulate the likelihood structure of the data. Motivated by the use of penalized spline, Chapter 6, "Penalized Spline Joint Models for Longitudinal and Time-to-Event Data" by Huong Thi Thu Pham and Hoa Pham, addresses the issue of joint models for longitudinal and time-to-event data. The joint models for longitudinal data and time-to-event data have recently received numerous attention in clinical and epidemiologic studies. This chapter attracts readers' interest in modeling the relationship between time-toevent outcomes and internal time-dependent covariates. In practice, the longitudinal re‐ sponses often show nonlinear and fluctuated curves. Therefore, the main aim of this chapter is to use penalized splines with a truncated polynomial basis to parameterize the nonlinear longitudinal process. The linear mixed-effects model is applied to subject-specific curves to control the smoothing. The association between the dropout process and longitudinal out‐ comes is modeled through a proportional hazards model. Two types of baseline risk func‐ tions are considered, namely, a Gompertz distribution and a piecewise constant model. The resulting models are referred to as penalized spline joint models, an extension of the stand‐ ard linear joint models.

The last chapter is "Application of Cubic Spline Interpolation Technique in Power Systems: A Review" by Akhil Prasad et al. In this chapter, a comprehensive review is made on the application of cubic spline interpolation techniques in the field of power systems. Domains like available transfer capability (ATC), electric arc furnace modeling, static VAR compensa‐ tion, voltage stability margin, and market power determination in deregulated electricity market are taken as samples to illustrate the significance of cubic spline interpolation.

The editors are grateful to the contributors for their valuable efforts toward the completion of this book. A lot of credit is also due to the experts who reviewed the chapters and provid‐ ed helpful feedback. The editors are happy to acknowledge the support of Ms. Martina Usl‐ jebrka, Author Service Manager, IntechOpen, toward the compilation of this book.

> **Prof. Young Kinh-Nhue Truong** The University of North Carolina at Chapel Hill, USA

> > **Prof. Muhammad Sarfraz** Kuwait University, Kuwait

**Chapter 1**

Provisional chapter

**Scalar and Parametric Spline Curves and Surfaces**

DOI: 10.5772/intechopen.74929

A common engineering task consists of interpolating a set of discrete points that arise from measurements and experiments. Another traditional requirement implies creating a curve that mimics a given array of points, namely, a polyline. Any of these problems require building an analytical representation of the given discrete set of points. If the geometrical shape represented by the input polyline is complicated, then we may expect that a global interpolant or polynomial will be of a high degree, to honor all imposed constraints, which makes its use prohibited. Indeed, a global interpolant often experiences inflection points and sudden changes in curvature. To avoid these drawbacks, we often seek solving the interpolation/approximation problem using piecewise polynomial func-

In this chapter, we tackle passing a curve/surface through a given set of data points. We first focus in the case in which the curve to be constructed can be described as S xð Þ¼ ð Þ x; f xð Þ . We refer this data set as scalar data. We describe herein cubic and tension splines, which are powerful interpolants suitable to tackle large data sets. We then introduce a parametric case for a vector-valued curve <sup>S</sup>ð Þ¼ <sup>ξ</sup> ð Þ <sup>x</sup>ð Þ <sup>ξ</sup> ; <sup>y</sup>ð Þ <sup>ξ</sup> <sup>T</sup> and hence, it is able to represent arbitrary topologies. We explain how to construct piecewise continuous cubic Bèzier curves called "B-splines." We cover the interpolation and approximation problems with B-splines, this latter denoted as well as "inverse" design. We extend our treatment to tensor product surfaces that are referred as piecewise bicubic B-splines. Applications encompass translational and interpolation surfaces. We briefly introduce nonuniform rational B-spline curves and surfaces (NURBS).

> © 2016 The Author(s). Licensee InTech. This chapter is distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0), which permits unrestricted use, distribution, and eproduction in any medium, provided the original work is properly cited.

© 2018 The Author(s). Licensee IntechOpen. This chapter is distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0), which permits unrestricted use,

distribution, and reproduction in any medium, provided the original work is properly cited.

Keywords: cubic splines, tension splines, Bèzier curves, B-splines, NURBS

Scalar and Parametric Spline Curves and Surfaces

Horacio Florez and Belsay Borges

Horacio Florez and Belsay Borges

http://dx.doi.org/10.5772/intechopen.74929

Abstract

tions called "splines."

1. Introduction

Additional information is available at the end of the chapter

Additional information is available at the end of the chapter

#### **Scalar and Parametric Spline Curves and Surfaces** Scalar and Parametric Spline Curves and Surfaces

DOI: 10.5772/intechopen.74929

Horacio Florez and Belsay Borges Horacio Florez and Belsay Borges

Additional information is available at the end of the chapter Additional information is available at the end of the chapter

http://dx.doi.org/10.5772/intechopen.74929

#### Abstract

The last chapter is "Application of Cubic Spline Interpolation Technique in Power Systems: A Review" by Akhil Prasad et al. In this chapter, a comprehensive review is made on the application of cubic spline interpolation techniques in the field of power systems. Domains like available transfer capability (ATC), electric arc furnace modeling, static VAR compensa‐ tion, voltage stability margin, and market power determination in deregulated electricity market are taken as samples to illustrate the significance of cubic spline interpolation.

X Preface

The editors are grateful to the contributors for their valuable efforts toward the completion of this book. A lot of credit is also due to the experts who reviewed the chapters and provid‐ ed helpful feedback. The editors are happy to acknowledge the support of Ms. Martina Usl‐

**Prof. Young Kinh-Nhue Truong**

**Prof. Muhammad Sarfraz** Kuwait University, Kuwait

The University of North Carolina at Chapel Hill, USA

jebrka, Author Service Manager, IntechOpen, toward the compilation of this book.

A common engineering task consists of interpolating a set of discrete points that arise from measurements and experiments. Another traditional requirement implies creating a curve that mimics a given array of points, namely, a polyline. Any of these problems require building an analytical representation of the given discrete set of points. If the geometrical shape represented by the input polyline is complicated, then we may expect that a global interpolant or polynomial will be of a high degree, to honor all imposed constraints, which makes its use prohibited. Indeed, a global interpolant often experiences inflection points and sudden changes in curvature. To avoid these drawbacks, we often seek solving the interpolation/approximation problem using piecewise polynomial functions called "splines."

Keywords: cubic splines, tension splines, Bèzier curves, B-splines, NURBS

#### 1. Introduction

In this chapter, we tackle passing a curve/surface through a given set of data points. We first focus in the case in which the curve to be constructed can be described as S xð Þ¼ ð Þ x; f xð Þ . We refer this data set as scalar data. We describe herein cubic and tension splines, which are powerful interpolants suitable to tackle large data sets. We then introduce a parametric case for a vector-valued curve <sup>S</sup>ð Þ¼ <sup>ξ</sup> ð Þ <sup>x</sup>ð Þ <sup>ξ</sup> ; <sup>y</sup>ð Þ <sup>ξ</sup> <sup>T</sup> and hence, it is able to represent arbitrary topologies. We explain how to construct piecewise continuous cubic Bèzier curves called "B-splines." We cover the interpolation and approximation problems with B-splines, this latter denoted as well as "inverse" design. We extend our treatment to tensor product surfaces that are referred as piecewise bicubic B-splines. Applications encompass translational and interpolation surfaces. We briefly introduce nonuniform rational B-spline curves and surfaces (NURBS).

© 2016 The Author(s). Licensee InTech. This chapter is distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0), which permits unrestricted use, distribution, and eproduction in any medium, provided the original work is properly cited. © 2018 The Author(s). Licensee IntechOpen. This chapter is distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

We present applications such as approximating conic sections. We finalize the chapter introducing Duchon splines that are radial basis functions to interpolate scattered data sets in two or three dimensions.

u<sup>1</sup> h<sup>1</sup> h<sup>1</sup> u<sup>2</sup> h<sup>2</sup>

where

h<sup>2</sup> u<sup>3</sup> h<sup>3</sup>

: ::

ui <sup>¼</sup> <sup>2</sup> � ð Þ hi <sup>þ</sup> hi�<sup>1</sup> ; bi <sup>¼</sup> <sup>6</sup>

� ð Þ <sup>κ</sup><sup>i</sup>þ<sup>1</sup> � <sup>κ</sup><sup>i</sup> ; Bi <sup>¼</sup> <sup>κ</sup><sup>i</sup>

Sið Þ¼ x yi þ Ai � ð Þ x � xi

mentioned above, the tension spline satisfies.

of cubic splines, i.e., κ<sup>i</sup> � T00ð Þ xi :

The solution is given by [2]:

½ � x0; xn and T xð Þ¼<sup>i</sup> yi ; i ¼ 0, …, n.

2. On every interval xi ½ � ; xiþ<sup>1</sup> : <sup>T</sup>ð Þ IV � <sup>τ</sup><sup>2</sup> � <sup>T</sup>ð Þ II <sup>¼</sup> 0.

where the coefficients are given by

Ai <sup>¼</sup> <sup>1</sup> 6 � hi

2.2. Tension splines

1. T ∈C<sup>2</sup>

:: :

:: :

hn�<sup>3</sup> un�<sup>2</sup> hn�<sup>2</sup>

hi

<sup>3</sup> <sup>þ</sup> Bi � ð Þ <sup>x</sup> � xi

Once we determine the curvature values κi, by solving Eq. (3), we define the spline function as

<sup>2</sup> ; Ci ¼ � hi

In some problems of adjusting discrete data, it is useful to have a parameter called "tension, τ." When τ has a small value, the resulting curve approaches a cubic spline. When τ tends to þ∞, the resulting curve approaches a linear spline. For the same sequence of sorted point pairs

That is, <sup>T</sup> : <sup>R</sup> ! <sup>R</sup> has continuity <sup>C</sup><sup>4</sup> globally, interpolates to the data, and satisfies certain ordinary differential equation in each subinterval. It is clear that the prescription τ ¼ 0 leads to cubic polynomials when solving the equation. To determine T, we proceed similarly to the case

hn�<sup>2</sup> un�<sup>1</sup>

� yiþ<sup>1</sup> � yi

κ1 κ2 κ3 : : : κ<sup>n</sup>�<sup>2</sup> κ<sup>n</sup>�<sup>1</sup>

v1 v2 v3 : : : vn�<sup>2</sup> vn�<sup>1</sup>

Scalar and Parametric Spline Curves and Surfaces http://dx.doi.org/10.5772/intechopen.74929

, (3)

3

¼

� � ; vi <sup>¼</sup> bi � bi�<sup>1</sup>: (4)

<sup>2</sup> <sup>þ</sup> Ci � ð Þ <sup>x</sup> � xi ; i <sup>¼</sup> <sup>0</sup>,…, n � <sup>1</sup>, (5)

1 hi

� yiþ<sup>1</sup> � yi

� �: (6)

�

<sup>6</sup> � <sup>κ</sup><sup>i</sup>þ<sup>1</sup> � hi

<sup>T</sup>ð Þ IV � <sup>τ</sup> � <sup>T</sup>ð Þ II <sup>¼</sup> <sup>0</sup> ; Txð Þ¼<sup>i</sup> yi ; Txð Þ¼ <sup>i</sup>þ<sup>1</sup> yiþ<sup>1</sup>: (7)

<sup>3</sup> � <sup>κ</sup><sup>i</sup> <sup>þ</sup>

## 2. Scalar splines

We cover herein the scalar case in which a spline function S xð Þ¼ ð Þ x; f xð Þ fits a given set of sorted point pairs. We introduce cubic splines and their specialized version that offers a "tension" parameter that allows attracting the interpolant toward the polyline that connects the input points, i.e., linear spline. We refer to this latter as tension splines. The last section presents a couple of numerical examples.

#### 2.1. Cubic splines

A spline is a piecewise continuous function consisting of several polynomials, each specified in a subinterval, bound themselves by certain continuity conditions. Let x0, …, xn be ð Þ n þ 1 sorted points such that x<sup>0</sup> < x<sup>1</sup> < x<sup>2</sup> < … < xn whose corresponding values are denoted by y0, …, yn. A spline of k degree with knots x0, …, xn is a function S : R ! R such that:


$$S(\mathbf{x}) = \begin{cases} S\_0(\mathbf{x}); \mathbf{x} \in [\mathbf{x}\_0, \mathbf{x}\_i) \\ S\_i(\mathbf{x}); \mathbf{x} \in [\mathbf{x}\_i, \mathbf{x}\_{i+1}) \\ \vdots \\ S\_{n-1}(\mathbf{x}); \mathbf{x} \in [\mathbf{x}\_{n-1}, \mathbf{x}\_n) \end{cases} \tag{1}$$

We thus enforce Cm, m <sup>¼</sup> <sup>0</sup>, …, kð Þ � <sup>1</sup> continuity conditions at the ð Þ <sup>n</sup> � <sup>1</sup> junction points which yields to 4ð Þ n � 2 equations to determine 4n unknown spline coefficients. We omit details herein but refer the reader to [1, 2]. We end up with a tridiagonal system for the unknown curvature values κi, at the junction points:

$$\frac{1}{2} \left( h\_{i-1} \cdot \kappa\_{i-1} + 2 \cdot (h\_i + h\_{i-1}) \cdot \kappa\_i + h\_i \cdot \kappa\_{i+1} = \frac{6}{h\_i} (y\_{i+1} - y\_i) - \frac{6}{h\_{i-1}} (y\_i - y\_{i-1})\_\prime \right) \tag{2}$$

where i ¼ 1, ::, n � 1 and hi ¼ xiþ<sup>1</sup> � xi. The last equation provides a system of ð Þ n � 1 conditions for κ0, …, κn. Since both κ<sup>0</sup> and κ<sup>n</sup> are arbitrary, a logical choice is choosing κ<sup>0</sup> ¼ κ<sup>n</sup> � 0, which we refer as "natural spline." For the latter, we can write in matrix form:

$$
\begin{bmatrix}
\boldsymbol{u}\_{1} & \boldsymbol{h}\_{1} & & & & & \\
& \boldsymbol{h}\_{1} & \boldsymbol{u}\_{2} & \boldsymbol{h}\_{2} & & & \\
& & \boldsymbol{h}\_{2} & \boldsymbol{u}\_{3} & \boldsymbol{h}\_{3} & & \\
& & & \boldsymbol{\lambda} & \cdot & & & \\
& & & & \cdot & \cdot & & \\
& & & & & \cdot & \cdot & & \\
& & & & & \cdot & \cdot & & \\
& & & & & & \cdot & \cdot & \\
& & & & & & \cdot & \cdot & \cdot \\
& & & & & & \boldsymbol{h}\_{n-3} & \boldsymbol{u}\_{n-2} & \boldsymbol{h}\_{n-2} \\
& & & & & & \boldsymbol{h}\_{n-2} & \boldsymbol{u}\_{n-1}
\end{bmatrix}, \quad \begin{bmatrix}
\boldsymbol{\kappa}\_{1} \\
\boldsymbol{\kappa}\_{2} \\
\boldsymbol{\kappa}\_{3} \\
\vdots \\
\boldsymbol{\kappa}\_{3} \\
\vdots \\
\boldsymbol{\kappa}\_{n-2} \\
\boldsymbol{\kappa}\_{n-1}
\end{bmatrix} = \begin{bmatrix}
\boldsymbol{\upsilon}\_{1} \\
\boldsymbol{\upsilon}\_{2} \\
\boldsymbol{\upsilon}\_{3} \\
\vdots \\
\boldsymbol{\upsilon}\_{n} \\
\boldsymbol{\upsilon}\_{n} \\
\boldsymbol{\upsilon}\_{n-2} \\
\boldsymbol{\upsilon}\_{n-1}
\end{bmatrix}, \tag{3}$$

where

We present applications such as approximating conic sections. We finalize the chapter introducing Duchon splines that are radial basis functions to interpolate scattered data sets in two or three

We cover herein the scalar case in which a spline function S xð Þ¼ ð Þ x; f xð Þ fits a given set of sorted point pairs. We introduce cubic splines and their specialized version that offers a "tension" parameter that allows attracting the interpolant toward the polyline that connects the input points, i.e., linear spline. We refer to this latter as tension splines. The last section

A spline is a piecewise continuous function consisting of several polynomials, each specified in a subinterval, bound themselves by certain continuity conditions. Let x0, …, xn be ð Þ n þ 1 sorted points such that x<sup>0</sup> < x<sup>1</sup> < x<sup>2</sup> < … < xn whose corresponding values are denoted by

> S0ð Þx ; x∈ x0; xi ½ Þ Sið Þx ; x ∈ xi ½ Þ ; xiþ<sup>1</sup>

Sn�<sup>1</sup>ð Þx ; x ∈½ Þ xn�<sup>1</sup>; xn

hi

yiþ<sup>1</sup> � yi � � � <sup>6</sup>

hi�<sup>1</sup>

yi � yi�<sup>1</sup>

� �, (2)

We thus enforce Cm, m <sup>¼</sup> <sup>0</sup>, …, kð Þ � <sup>1</sup> continuity conditions at the ð Þ <sup>n</sup> � <sup>1</sup> junction points which yields to 4ð Þ n � 2 equations to determine 4n unknown spline coefficients. We omit details herein but refer the reader to [1, 2]. We end up with a tridiagonal system for the

where i ¼ 1, ::, n � 1 and hi ¼ xiþ<sup>1</sup> � xi. The last equation provides a system of ð Þ n � 1 conditions for κ0, …, κn. Since both κ<sup>0</sup> and κ<sup>n</sup> are arbitrary, a logical choice is choosing κ<sup>0</sup> ¼ κ<sup>n</sup> � 0,

y0, …, yn. A spline of k degree with knots x0, …, xn is a function S : R ! R such that:

2. Two adjacent splines need to have C<sup>0</sup> continuity at the junction points:

S xð Þ¼

unknown curvature values κi, at the junction points:

hi�<sup>1</sup> � <sup>κ</sup><sup>i</sup>�<sup>1</sup> <sup>þ</sup> <sup>2</sup> � ð Þ� hi <sup>þ</sup> hi�<sup>1</sup> <sup>κ</sup><sup>i</sup> <sup>þ</sup> hi � <sup>κ</sup><sup>i</sup>þ<sup>1</sup> <sup>¼</sup> <sup>6</sup>

1. Si is a polynomial of degree ≤ k that is continuous up to kth derivative over xi ½ � ; xiþ<sup>1</sup> .

⋮

8 >>>>><

>>>>>:

which we refer as "natural spline." For the latter, we can write in matrix form:

dimensions.

2. Scalar splines

2 Topics in Splines and Applications

2.1. Cubic splines

presents a couple of numerical examples.

$$u\_i = \mathbf{2} \cdot (h\_i + h\_{i-1}) \; ; \; b\_i = \frac{6}{h\_i} \cdot \left( y\_{i+1} - y\_i \right) \; ; \; v\_i = b\_i - b\_{i-1} \tag{4}$$

Once we determine the curvature values κi, by solving Eq. (3), we define the spline function as

$$\text{S}\_{i}(\mathbf{x}) = y\_{i} + A\_{i} \cdot \left(\mathbf{x} - \mathbf{x}\_{i}\right)^{3} + B\_{i} \cdot \left(\mathbf{x} - \mathbf{x}\_{i}\right)^{2} + C\_{i} \cdot \left(\mathbf{x} - \mathbf{x}\_{i}\right); \ i = 0, \ldots, n - 1,\tag{5}$$

where the coefficients are given by

$$A\_i = \frac{1}{6 \cdot h\_i} \cdot (\kappa\_{i+1} - \kappa\_i) \; ; \; B\_i = \frac{\kappa\_i}{2} \; ; \; \mathbb{C}\_i = -\frac{h\_i}{6} \cdot \kappa\_{i+1} - \frac{h\_i}{3} \cdot \kappa\_i + \frac{1}{h\_i} \cdot (y\_{i+1} - y\_i) . \tag{6}$$

#### 2.2. Tension splines

(1)

In some problems of adjusting discrete data, it is useful to have a parameter called "tension, τ." When τ has a small value, the resulting curve approaches a cubic spline. When τ tends to þ∞, the resulting curve approaches a linear spline. For the same sequence of sorted point pairs mentioned above, the tension spline satisfies.


That is, <sup>T</sup> : <sup>R</sup> ! <sup>R</sup> has continuity <sup>C</sup><sup>4</sup> globally, interpolates to the data, and satisfies certain ordinary differential equation in each subinterval. It is clear that the prescription τ ¼ 0 leads to cubic polynomials when solving the equation. To determine T, we proceed similarly to the case of cubic splines, i.e., κ<sup>i</sup> � T00ð Þ xi :

$$T^{(IV)} - \pi \cdot T^{(II)} = 0 \; ; \; \; T(\mathbf{x}\_i) = y\_i \; ; \; \; T(\mathbf{x}\_{i+1}) = y\_{i+1} \; . \tag{7}$$

The solution is given by [2]:

$$T(\mathbf{x}) = \frac{[\kappa\_i \cdot \sinh(\tau \cdot \widehat{\mathbf{x}}) + \kappa\_{i+1} \cdot \sinh(\tau \cdot \widehat{\mathbf{x}})]}{\tau^2 \cdot \sinh(\tau \cdot h\_i)} + \left(y\_i - \frac{\kappa\_i}{\tau^2}\right) \cdot \frac{\widehat{\mathbf{x}}}{h\_i} + \left(y\_{i+1} - \frac{\kappa\_{i+1}}{\tau^2}\right) \cdot \frac{\widetilde{\mathbf{x}}}{h\_i},\tag{8}$$

where <sup>b</sup><sup>x</sup> <sup>¼</sup> ð Þ xiþ<sup>1</sup> � <sup>x</sup> and <sup>~</sup><sup>x</sup> <sup>¼</sup> ð Þ <sup>x</sup> � xi , and we compute the curvatures by solving the system:

$$a\_{i-1}\kappa\_{i-1} + \left(\beta\_{i-1} + \beta\_i\right) \cdot \kappa\_i + a\_i\kappa\_{i+1} = \left(\gamma\_i - \gamma\_{i-1}\right),\tag{9}$$

and 1 ≤ i ≤ ð Þ n � 1 , and the arguments are (κ<sup>o</sup> ¼ κ<sup>n</sup> ¼ 0):

$$\alpha\_{i} = \frac{1}{h\_{i}} - \frac{\tau}{\sinh(\tau \cdot h\_{i})} \quad ; \quad \beta\_{i} = \frac{\tau \cdot \cosh(\tau \cdot h\_{i})}{\sinh(\tau \cdot h\_{i})} - \frac{1}{h\_{i}} \; ; \quad \gamma\_{i} = \frac{\tau^{2}(y\_{i+1} - y\_{i})}{h\_{i}} . \tag{10}$$

#### 2.3. Numerical examples

#### 2.3.1. Example 1

Fit the following collection of point pairs using a natural cubic spline.


We assume κ<sup>0</sup> ¼ κ<sup>4</sup> � 0; thus ho ¼ x<sup>1</sup> � x<sup>0</sup> ¼ 1 ¼ h<sup>1</sup> ¼ h<sup>2</sup> ¼ h3, and u<sup>1</sup> ¼ 2 � ð Þ¼ h<sup>1</sup> � h<sup>0</sup> 4 ¼ u<sup>2</sup> ¼ u3. The tridiagonal system (3) yields

$$
\begin{bmatrix} 4 & 1 & 0 \\ 1 & 4 & 1 \\ 0 & 1 & 4 \end{bmatrix} \begin{bmatrix} \kappa\_1 \\ \kappa\_2 \\ \kappa\_3 \end{bmatrix} = \begin{bmatrix} 36 \\ 72 \\ 108 \end{bmatrix} \Rightarrow \begin{bmatrix} \kappa\_1 \\ \kappa\_2 \\ \kappa\_3 \end{bmatrix} \cong \begin{bmatrix} 6.4285 \\ 10.2857 \\ 24.4285 \end{bmatrix}. \tag{11}
$$

As an illustration, S2ð Þx is given by

$$\mathcal{S}\_2(\mathbf{x}) = 2.3571 \cdot (\mathbf{x} - \mathbf{2})^3 + 5.1428 \cdot (\mathbf{x} - \mathbf{2})^2 + 11.5 \cdot (\mathbf{x} - \mathbf{2}),\tag{12}$$

2.3.3. Example 3

Figure 1. Discrete velocity profiles that were fitted by splines.

Figure 2. It depicts a car-like profile that we fit by cubic and tension splines.

We finalize the examples by comparing cubic and tension splines. Figure 2 depicts a car-like profile polygon that we would like to interpolate. We try both splines mentioned above. We highlight in red color the cubic spline (top) interpolant, while the tension spline is black (bottom curve). We observe that the cubic spline experiences inflection points because the car-shaped

Scalar and Parametric Spline Curves and Surfaces http://dx.doi.org/10.5772/intechopen.74929 5

for instance, S2ð Þffi 3 18:9999 and S2ð Þffi 2:5 7:3303.

#### 2.3.2. Example 2

Figure 1 depicts radial velocity profiles that represent the laminar fluid flow within a pipeline.

These velocity profiles were obtained by solving the Navier-Stokes equations under simplifying assumptions. The symbols represent the discrete point pairs, the abscissas correspond to the normalized radial coordinate from the center, and the y-coordinates are the normalized radial velocities. We fit all data sets by using natural splines. To solve the system (3), we recommend the Thomas method, i.e., a direct frontal solver for tridiagonal matrixes [1–3]. We also recommend employing a quick-search algorithm to evaluate the piecewise function. Indeed, for an arbitrary x, we need to determine what is the interval where this abscissa lies, i.e., x ∈ xi ½ � ; xiþ<sup>1</sup> .

Figure 1. Discrete velocity profiles that were fitted by splines.

Figure 2. It depicts a car-like profile that we fit by cubic and tension splines.

#### 2.3.3. Example 3

T xð Þ¼ <sup>κ</sup><sup>i</sup> ½ � � sinhð Þþ <sup>τ</sup> � <sup>b</sup><sup>x</sup> <sup>κ</sup><sup>i</sup>þ<sup>1</sup> � sinhð Þ <sup>τ</sup> � <sup>~</sup><sup>x</sup> τ<sup>2</sup> � sinhð Þ τ � hi

and 1 ≤ i ≤ ð Þ n � 1 , and the arguments are (κ<sup>o</sup> ¼ κ<sup>n</sup> ¼ 0):

� <sup>τ</sup> sinhð Þ τ � hi

u<sup>2</sup> ¼ u3. The tridiagonal system (3) yields

As an illustration, S2ð Þx is given by

2 6 4

410 141 014

for instance, S2ð Þffi 3 18:9999 and S2ð Þffi 2:5 7:3303.

3 7 5

2 6 4

κ1 κ2 κ3

<sup>α</sup><sup>i</sup> <sup>¼</sup> <sup>1</sup> hi

2.3. Numerical examples

4 Topics in Splines and Applications

2.3.1. Example 1

2.3.2. Example 2

i.e., x ∈ xi ½ � ; xiþ<sup>1</sup> .

<sup>α</sup><sup>i</sup>�<sup>1</sup>κ<sup>i</sup>�<sup>1</sup> <sup>þ</sup> <sup>β</sup><sup>i</sup>�<sup>1</sup> <sup>þ</sup> <sup>β</sup><sup>i</sup>

Fit the following collection of point pairs using a natural cubic spline.

<sup>þ</sup> yi � <sup>κ</sup><sup>i</sup> τ2 � �

> � 1 hi

where <sup>b</sup><sup>x</sup> <sup>¼</sup> ð Þ xiþ<sup>1</sup> � <sup>x</sup> and <sup>~</sup><sup>x</sup> <sup>¼</sup> ð Þ <sup>x</sup> � xi , and we compute the curvatures by solving the system:

; <sup>β</sup><sup>i</sup> <sup>¼</sup> <sup>τ</sup> � coshð Þ <sup>τ</sup> � hi sinhð Þ τ � hi

x 0 123 4 y �8 �7019 56

We assume κ<sup>0</sup> ¼ κ<sup>4</sup> � 0; thus ho ¼ x<sup>1</sup> � x<sup>0</sup> ¼ 1 ¼ h<sup>1</sup> ¼ h<sup>2</sup> ¼ h3, and u<sup>1</sup> ¼ 2 � ð Þ¼ h<sup>1</sup> � h<sup>0</sup> 4 ¼

Figure 1 depicts radial velocity profiles that represent the laminar fluid flow within a pipeline. These velocity profiles were obtained by solving the Navier-Stokes equations under simplifying assumptions. The symbols represent the discrete point pairs, the abscissas correspond to the normalized radial coordinate from the center, and the y-coordinates are the normalized radial velocities. We fit all data sets by using natural splines. To solve the system (3), we recommend the Thomas method, i.e., a direct frontal solver for tridiagonal matrixes [1–3]. We also recommend employing a quick-search algorithm to evaluate the piecewise function. Indeed, for an arbitrary x, we need to determine what is the interval where this abscissa lies,

κ1 κ2 κ3

<sup>S</sup>2ð Þ¼ <sup>x</sup> <sup>2</sup>:<sup>3571</sup> � ð Þ <sup>x</sup> � <sup>2</sup> <sup>3</sup> <sup>þ</sup> <sup>5</sup>:<sup>1428</sup> � ð Þ <sup>x</sup> � <sup>2</sup> <sup>2</sup> <sup>þ</sup> <sup>11</sup>:<sup>5</sup> � ð Þ <sup>x</sup> � <sup>2</sup> , (12)

6:4285 10:2857 24:4285 3 7

<sup>5</sup>: (11)

2 6 4

2 6 4

36 72 108

2 6 4

� � � <sup>κ</sup><sup>i</sup> <sup>þ</sup> <sup>α</sup>iκ<sup>i</sup>þ<sup>1</sup> <sup>¼</sup> <sup>γ</sup><sup>i</sup> � <sup>γ</sup><sup>i</sup>�<sup>1</sup>

� bx hi <sup>þ</sup> yiþ<sup>1</sup> � <sup>κ</sup><sup>i</sup>þ<sup>1</sup>

; <sup>γ</sup><sup>i</sup> <sup>¼</sup> <sup>τ</sup><sup>2</sup> yiþ<sup>1</sup> � yi

τ2 � �

� �, (9)

� � hi

� ~x hi

, (8)

: (10)

We finalize the examples by comparing cubic and tension splines. Figure 2 depicts a car-like profile polygon that we would like to interpolate. We try both splines mentioned above. We highlight in red color the cubic spline (top) interpolant, while the tension spline is black (bottom curve). We observe that the cubic spline experiences inflection points because the car-shaped polygon is challenging. This latter is the kind of application for tension splines where we seek to attract the spline toward the input polyline. We notice that we achieve that goal herein.

making their use prohibitive. It is therefore beneficial to represent them by using piecewise continuous Bèzier curves called B-spline curves [5]. In fact B-spline curves are a widely utilized representation for geometrical entities in computer-aided geometric design (CAGD) systems. Their convex hull, local support, shape-preserving forms, affine invariance, and variation-

A particular Bèzier curve is set up by its parametric representation; let <sup>B</sup> : <sup>R</sup> ! <sup>R</sup><sup>2</sup> be defined

<sup>i</sup> ð Þt , t∈ I ¼ ½ � 0; 1 , (13)

<sup>i</sup> ð Þt are the Bernstein polynomials, defined

Scalar and Parametric Spline Curves and Surfaces http://dx.doi.org/10.5772/intechopen.74929 7

, k ¼ 0, ::, m, (15)

�, k <sup>¼</sup> <sup>1</sup>, …, m, (16)

<sup>k</sup> points in Eq. (15) are represented by

<sup>i</sup> ðÞ¼ t 1, (14)

diminishing properties are extremely attractive in engineering design applications [4].

bi � <sup>B</sup>ð Þ <sup>m</sup>

<sup>B</sup>ðÞ¼ <sup>t</sup> <sup>X</sup><sup>m</sup>

here, m denotes the order or degree of the curve, Bð Þ <sup>m</sup>

Bð Þ <sup>m</sup> <sup>i</sup> ðÞ¼ t

k

tk <sup>¼</sup> sk sm

which is the well-known chord-length parametrization.

and sudden changes in curvature (see Figure 4, where p

Xm i¼0

bi � <sup>B</sup>ð Þ <sup>m</sup>

; s<sup>0</sup> ¼ 0; sk ¼ sk�<sup>1</sup> þ p

circles). For practical purposes, degrees exceeding 10 are prohibitive [5, 6].

<sup>i</sup> ð Þ¼ tk p

k

� � �

<sup>k</sup> � pk�<sup>1</sup>

� �

where the number of base points equals ð Þ m þ 1 ; we compute the value of the parameter tk by

The last approach is a powerful tool in curve design, but it has a limitation: if the geometry that we model has a complex shape (i.e., a significant number of base points), then its Bèzier curve representation may be of a prohibitively high degree. Since the Bèzier curve is forced to satisfy several constraints according to Eq. (15), the resulting curve may experience inflection points

Such complex geometries can be modeled using piecewise polynomial curves named B-spline curves [5, 6] (see Figure 5). B-spline curves are a set of Bèzier curves of mth degree that must

corresponding base point p

control points as

[6, 7]

i¼0

m! i!ð Þ m � i !

t

<sup>i</sup> � ð Þ <sup>1</sup> � <sup>t</sup> <sup>m</sup>�<sup>i</sup> ; <sup>X</sup><sup>m</sup>

and bi are the control points. Notice in Eq. (14) that Bernstein polynomials satisfy the barycentric property, meaning that they add up to 1, which explains why a given curve cannot be outside its control polygon that is the convex-hull property. The control points of a given BC can be calculated in several ways since the Bèzier curve evaluated in t ¼ tk must provide the

i¼0 Bm

; a linear system of equations can be formed for the unknown

by

as

#### 3. Bèzier, B-spline, and NURBS curves

The appropriate representation and meshing of the computational domain for the physical problem under study are necessary premises for a satisfactory computer simulation. In fact, one of the most demanding computational tasks in a simulation is defining the geometry because it will impact many aspects of the study such as the grid generation process [4]. Therefore, special methods must be applied to fit discrete data without sudden changes in curvature. The approach should be free of inflection points, and at minimum, it must enforce continuity C<sup>2</sup> of the fitted curve. In this chapter, this goal is achieved by using Bèzier, B-spline, and NURBS curves and surfaces [5, 6].

A Bèzier curve (BC), B, shown in Figure 3, is obtained by specifying the coordinates of a series of points in space, such that only the first and last ones fall on the originally given curve. All these points are known as control points, and the polyline resulting from connecting them with straight lines is called control polygon, which mimics the original curve, allowing an easy control of its shape. Although inflection points may be present in Bèzier curves, they are less common than in polynomials or other analytical functions [5, 6].

Global Bèzier curves, i.e., only one curve represents the given polyline, provide a powerful tool in geometry definition; however, complex shapes require a large number of constraints,

Figure 3. Fourth-order Bèzier curve with highlighted control points.

making their use prohibitive. It is therefore beneficial to represent them by using piecewise continuous Bèzier curves called B-spline curves [5]. In fact B-spline curves are a widely utilized representation for geometrical entities in computer-aided geometric design (CAGD) systems. Their convex hull, local support, shape-preserving forms, affine invariance, and variationdiminishing properties are extremely attractive in engineering design applications [4].

polygon is challenging. This latter is the kind of application for tension splines where we seek to

The appropriate representation and meshing of the computational domain for the physical problem under study are necessary premises for a satisfactory computer simulation. In fact, one of the most demanding computational tasks in a simulation is defining the geometry because it will impact many aspects of the study such as the grid generation process [4]. Therefore, special methods must be applied to fit discrete data without sudden changes in curvature. The approach should be free of inflection points, and at minimum, it must enforce continuity C<sup>2</sup> of the fitted curve. In this chapter, this goal is achieved by using Bèzier, B-spline,

A Bèzier curve (BC), B, shown in Figure 3, is obtained by specifying the coordinates of a series of points in space, such that only the first and last ones fall on the originally given curve. All these points are known as control points, and the polyline resulting from connecting them with straight lines is called control polygon, which mimics the original curve, allowing an easy control of its shape. Although inflection points may be present in Bèzier curves, they are less

Global Bèzier curves, i.e., only one curve represents the given polyline, provide a powerful tool in geometry definition; however, complex shapes require a large number of constraints,

attract the spline toward the input polyline. We notice that we achieve that goal herein.

3. Bèzier, B-spline, and NURBS curves

6 Topics in Splines and Applications

and NURBS curves and surfaces [5, 6].

common than in polynomials or other analytical functions [5, 6].

Figure 3. Fourth-order Bèzier curve with highlighted control points.

A particular Bèzier curve is set up by its parametric representation; let <sup>B</sup> : <sup>R</sup> ! <sup>R</sup><sup>2</sup> be defined by

$$\underline{\mathbf{B}}(t) = \sum\_{i=0}^{m} \underline{b}\_{i} \cdot B\_{i}^{(m)}(t), \quad t \in I = [0, 1]. \tag{13}$$

here, m denotes the order or degree of the curve, Bð Þ <sup>m</sup> <sup>i</sup> ð Þt are the Bernstein polynomials, defined as

$$B\_i^{(m)}(t) = \frac{m!}{i!(m-i)!}t^i \cdot (1-t)^{m-i} \quad ; \quad \sum\_{i=0}^m B\_i^m(t) = 1,\tag{14}$$

and bi are the control points. Notice in Eq. (14) that Bernstein polynomials satisfy the barycentric property, meaning that they add up to 1, which explains why a given curve cannot be outside its control polygon that is the convex-hull property. The control points of a given BC can be calculated in several ways since the Bèzier curve evaluated in t ¼ tk must provide the corresponding base point p k ; a linear system of equations can be formed for the unknown control points as

$$\sum\_{i=0}^{m} \underline{b}\_{i} \cdot B\_{i}^{(m)}(t\_{k}) = \underline{p}\_{\underline{k}'} \quad k = 0, \ldots, m,\tag{15}$$

where the number of base points equals ð Þ m þ 1 ; we compute the value of the parameter tk by [6, 7]

$$\mathbf{t}\_{k} = \frac{\mathbf{s}\_{k}}{\mathbf{s}\_{m}}; \quad \mathbf{s}\_{0} = \mathbf{0}; \quad \mathbf{s}\_{k} = \mathbf{s}\_{k-1} + \left\| \underline{p}\_{k} - \underline{p}\_{k-1} \right\|\_{\prime} \quad k = 1, \ldots, m,\tag{16}$$

which is the well-known chord-length parametrization.

The last approach is a powerful tool in curve design, but it has a limitation: if the geometry that we model has a complex shape (i.e., a significant number of base points), then its Bèzier curve representation may be of a prohibitively high degree. Since the Bèzier curve is forced to satisfy several constraints according to Eq. (15), the resulting curve may experience inflection points and sudden changes in curvature (see Figure 4, where p <sup>k</sup> points in Eq. (15) are represented by circles). For practical purposes, degrees exceeding 10 are prohibitive [5, 6].

Such complex geometries can be modeled using piecewise polynomial curves named B-spline curves [5, 6] (see Figure 5). B-spline curves are a set of Bèzier curves of mth degree that must

Figure 4. We interpolated with a Bèzier (black) and a cubic B-spline (red) curves.

Figure 5. A B-spline curve, Cð Þ ξ , is the union of piecewise continuous curves.

satisfy at least the Cð Þ <sup>m</sup>�<sup>1</sup> continuity. A spline curve C is the continuous mapping of a collection of global parameter values <sup>ξ</sup>0, <sup>ξ</sup>1, …, <sup>ξ</sup><sup>L</sup>�<sup>1</sup>, <sup>ξ</sup><sup>L</sup> into <sup>R</sup><sup>2</sup> , where each interval ξi; ξ<sup>i</sup>þ<sup>1</sup> ½ � is mapped onto a polynomial curve segment as shown in Figure 5. We define Ω ¼ ξ<sup>0</sup> ½ � ; ξ<sup>L</sup> as the computational space. A local coordinate t for the interval ξi; ξ<sup>i</sup>þ<sup>1</sup> ½ � can be defined by setting [5]:

$$t = \frac{\xi - \xi\_i}{\xi\_{i+1} - \xi\_i} = \frac{\xi - \xi\_i}{\Delta\_i}, \quad \xi \in [\xi\_i, \xi\_{i+1}].\tag{17}$$

while C<sup>2</sup> conditions require that

<sup>b</sup>3L�<sup>2</sup> <sup>¼</sup> <sup>Δ</sup><sup>L</sup>�<sup>1</sup>

This construction is due to W. Boehm [5].

2. Chord-length parametrization [5]

1. Uniform parametrization

Δ<sup>L</sup>�<sup>2</sup> þ Δ<sup>L</sup>�<sup>1</sup>

3. A parametrization proposed by the author [6]

ξ<sup>0</sup> ¼ 0:0,

ξ<sup>i</sup>þ<sup>1</sup> ¼ ξ<sup>i</sup> þ di � di�<sup>1</sup> 

i ¼ 0, …, L � 1:

<sup>b</sup>3i�<sup>2</sup> <sup>¼</sup> <sup>Δ</sup><sup>i</sup>�<sup>1</sup> <sup>þ</sup> <sup>Δ</sup><sup>i</sup>

<sup>Δ</sup> di�<sup>1</sup> <sup>þ</sup>

Δ<sup>0</sup> þ Δ<sup>1</sup>

Δ<sup>L</sup>�<sup>2</sup> Δ<sup>L</sup>�<sup>2</sup> þ Δ<sup>L</sup>�<sup>1</sup>

<sup>b</sup>3i�<sup>1</sup> <sup>¼</sup> <sup>Δ</sup><sup>i</sup>

where i ¼ 2, …, L � 1, and Δ ¼ Δ<sup>i</sup>�<sup>2</sup> þ Δ<sup>i</sup>�<sup>1</sup> þ Δi. The end points are

dL�<sup>1</sup> þ

For cubic curves more parametrizations are available [5, 6], for instance:

ξ<sup>0</sup> ¼ 0:0; ξ<sup>1</sup> ¼ k k d<sup>1</sup> � d�<sup>1</sup> ,

ξ<sup>i</sup> ¼ ξ<sup>i</sup>�<sup>1</sup> þ di � di�<sup>1</sup> 

ξ<sup>L</sup> ¼ ξ<sup>L</sup>�<sup>1</sup> þ dLþ<sup>1</sup> � dL�<sup>1</sup> 

 þ diþ<sup>1</sup> � di 

<sup>b</sup><sup>0</sup> <sup>¼</sup> <sup>d</sup>�<sup>1</sup> ; <sup>b</sup><sup>1</sup> <sup>¼</sup> <sup>d</sup><sup>0</sup> ; <sup>b</sup><sup>2</sup> <sup>¼</sup> <sup>Δ</sup><sup>1</sup>

Figure 6. A C<sup>2</sup> cubic curve with highlighted de Boor's and junction points.

<sup>Δ</sup> di�<sup>1</sup> <sup>þ</sup>

Δ<sup>i</sup>�<sup>2</sup> <sup>Δ</sup> di ,

Δ0 Δ<sup>0</sup> þ Δ<sup>1</sup>

d1,

dL ; b3L�<sup>1</sup> ¼ dL ; b3<sup>L</sup> ¼ dLþ<sup>1</sup>:

Scalar and Parametric Spline Curves and Surfaces http://dx.doi.org/10.5772/intechopen.74929

ξ<sup>i</sup> ¼ i; i ¼ 0, …, L: (21)

; i ¼ 2, …, L � 1,

 þ diþ<sup>2</sup> � diþ<sup>1</sup> 

,

:

(19)

9

(20)

(22)

(23)

Δ<sup>i</sup>�<sup>2</sup> þ Δ<sup>i</sup>�<sup>1</sup> <sup>Δ</sup> di :

d<sup>0</sup> þ

#### 3.1. C<sup>2</sup> cubic curves

Let d�<sup>1</sup>, d0, …, dL, dLþ<sup>1</sup> be a set of ð Þ L þ 3 points defining the de Boor's polygon that generates L individual cubic curves as shown in Figure 6. The required 3ð Þ L þ 1 Bèzier control points are calculated with the aid of C<sup>1</sup> and C<sup>2</sup> continuity criteria. C<sup>1</sup> conditions lead to

$$\underline{\mathfrak{b}}\_{3i} = \frac{\Delta\_i}{\Delta\_{i-1} + \Delta\_i} \underline{\mathfrak{b}}\_{3i-1} + \frac{\Delta\_{i-1}}{\Delta\_{i-1} + \Delta\_i} \underline{\mathfrak{b}}\_{3i+1}, \quad i = 1, \ldots, L - 1,\tag{18}$$

Figure 6. A C<sup>2</sup> cubic curve with highlighted de Boor's and junction points.

while C<sup>2</sup> conditions require that

$$\begin{aligned} \underline{b}\_{3i-2} &= \frac{\Delta\_{i-1} + \Delta\_{i}}{\Delta} \underline{d}\_{i-1} + \frac{\Delta\_{i-2}}{\Delta} \underline{d}\_{i} \\ \underline{b}\_{3i-1} &= \frac{\Delta\_{i}}{\Delta} \underline{d}\_{i-1} + \frac{\Delta\_{i-2} + \Delta\_{i-1}}{\Delta} \underline{d}\_{i} .\end{aligned} \tag{19}$$

where i ¼ 2, …, L � 1, and Δ ¼ Δ<sup>i</sup>�<sup>2</sup> þ Δ<sup>i</sup>�<sup>1</sup> þ Δi. The end points are

$$\begin{aligned} \underline{b}\_{0} &= \underline{d}\_{-1} \; : \; \underline{b}\_{1} = \underline{d}\_{0} \; : \; \underline{b}\_{2} = \frac{\Delta\_{1}}{\Delta\_{0} + \Delta\_{1}} \underline{d}\_{0} + \frac{\Delta\_{0}}{\Delta\_{0} + \Delta\_{1}} \underline{d}\_{1} \; : \\ \underline{b}\_{3l-2} &= \frac{\Delta\_{l-1}}{\Delta\_{l-2} + \Delta\_{l-1}} \underline{d}\_{l-1} + \frac{\Delta\_{l-2}}{\Delta\_{l-2} + \Delta\_{l-1}} \underline{d}\_{l} \; : \; \underline{b}\_{3l-1} = \underline{d}\_{L} \; : \; \underline{b}\_{3l} = \underline{d}\_{l+1} \; : \end{aligned} \tag{20}$$

This construction is due to W. Boehm [5].

For cubic curves more parametrizations are available [5, 6], for instance:

1. Uniform parametrization

satisfy at least the Cð Þ <sup>m</sup>�<sup>1</sup> continuity. A spline curve C is the continuous mapping of a collection

onto a polynomial curve segment as shown in Figure 5. We define Ω ¼ ξ<sup>0</sup> ½ � ; ξ<sup>L</sup> as the computational space. A local coordinate t for the interval ξi; ξ<sup>i</sup>þ<sup>1</sup> ½ � can be defined by setting [5]:

> <sup>¼</sup> <sup>ξ</sup> � <sup>ξ</sup><sup>i</sup> Δi

Let d�<sup>1</sup>, d0, …, dL, dLþ<sup>1</sup> be a set of ð Þ L þ 3 points defining the de Boor's polygon that generates L individual cubic curves as shown in Figure 6. The required 3ð Þ L þ 1 Bèzier control points are

> Δ<sup>i</sup>�<sup>1</sup> Δ<sup>i</sup>�<sup>1</sup> þ Δ<sup>i</sup>

, where each interval ξi; ξ<sup>i</sup>þ<sup>1</sup> ½ � is mapped

, ξ∈ ξi; ξ<sup>i</sup>þ<sup>1</sup> ½ �: (17)

b3iþ<sup>1</sup>, i ¼ 1, …, L � 1, (18)

of global parameter values <sup>ξ</sup>0, <sup>ξ</sup>1, …, <sup>ξ</sup><sup>L</sup>�<sup>1</sup>, <sup>ξ</sup><sup>L</sup> into <sup>R</sup><sup>2</sup>

Figure 5. A B-spline curve, Cð Þ ξ , is the union of piecewise continuous curves.

Figure 4. We interpolated with a Bèzier (black) and a cubic B-spline (red) curves.

<sup>b</sup>3<sup>i</sup> <sup>¼</sup> <sup>Δ</sup><sup>i</sup>

Δ<sup>i</sup>�<sup>1</sup> þ Δ<sup>i</sup>

3.1. C<sup>2</sup> cubic curves

8 Topics in Splines and Applications

<sup>t</sup> <sup>¼</sup> <sup>ξ</sup> � <sup>ξ</sup><sup>i</sup> ξ<sup>i</sup>þ<sup>1</sup> � ξ<sup>i</sup>

calculated with the aid of C<sup>1</sup> and C<sup>2</sup> continuity criteria. C<sup>1</sup> conditions lead to

b3i�<sup>1</sup> þ

$$\xi\_i = \mathbf{i} \; ; \; i = 0, \ldots, L. \tag{21}$$

2. Chord-length parametrization [5]

$$\begin{aligned} \xi\_0 &= 0.0; & \xi\_1 &= ||\underline{d}\_1 - \underline{d}\_{-1}||. \\ \xi\_i &= \xi\_{i-1} + ||\underline{d}\_i - \underline{d}\_{i-1}||; & i = 2, \dots, L - 1, \\ \xi\_L &= \xi\_{L-1} + ||\underline{d}\_{L+1} - \underline{d}\_{L-1}||. \end{aligned} \tag{22}$$

3. A parametrization proposed by the author [6]

$$\begin{aligned} \xi\_0 &= 0.0, \\ \xi\_{i+1} &= \xi\_i + \left| \left| \underline{d}\_i - \underline{d}\_{i-1} \right| \right| + \left| \left| \underline{d}\_{i+1} - \underline{d}\_i \right| \right| + \left| \left| \underline{d}\_{i+2} - \underline{d}\_{i+1} \right| \right|, \\ \text{i } i &= 0, \dots, L - 1. \end{aligned} \tag{23}$$

If the two Bèzier points b<sup>1</sup> and b3L�<sup>1</sup> are arbitrarily chosen, the following linear system of

<sup>α</sup><sup>L</sup>�<sup>1</sup> <sup>β</sup><sup>L</sup>�<sup>1</sup> <sup>γ</sup><sup>L</sup>�<sup>1</sup>

ri ¼ ð Þ� Δ<sup>i</sup>�<sup>1</sup> þ Δ<sup>i</sup> xi ; i ¼ 1…L � 1,

The points b<sup>1</sup> and b3L�<sup>1</sup> can be calculated from a given end condition. There are two possibil-

dt<sup>2</sup> sL�<sup>1</sup>ð Þ¼ <sup>1</sup> <sup>6</sup> � <sup>b</sup>3<sup>L</sup> � <sup>2</sup>b3L�<sup>1</sup> <sup>þ</sup> <sup>b</sup>3L�<sup>2</sup> <sup>ð</sup> Þ ¼ <sup>0</sup>:

� <sup>d</sup><sup>0</sup> � <sup>Δ</sup><sup>0</sup>

Δ<sup>L</sup>�<sup>2</sup> þ Δ<sup>L</sup>�<sup>1</sup>

� dL � <sup>Δ</sup><sup>L</sup>�<sup>1</sup>

These two equations replace the first and last rows of the linear system of equations given in Eq. (26). Notice that in either case, natural ending conditions or prescribed tangent vectors, the linear system in Eq. (24) is a tridiagonal matrix. Since the coefficient matrix is real and scalar, and the left- and right-hand-side vectors are in fact hypervectors (i.e., an array of vectors), it is recommendable to use a type of Gaussian elimination method against multiple right-hand sides to achieve performance [6, 7]. If we recompute the interpolant in Figure 4 but this time with a B-spline cubic curve, we then obtain a smoother and steadier interpolant free of

NURBS curves are useful when we require an exact geometrical representation of some entities, such as circles, parabolas, ellipses, spheres, cylinders, etc. This is precisely the case in

Δ<sup>0</sup> þ Δ<sup>1</sup>

dt<sup>2</sup> <sup>s</sup>0ð Þ¼ <sup>0</sup> <sup>6</sup> � <sup>b</sup><sup>2</sup> � <sup>2</sup>b<sup>1</sup> <sup>þ</sup> <sup>b</sup><sup>0</sup> <sup>ð</sup> Þ ¼ <sup>0</sup>,

ities for the choice of B-spline ending conditions. A natural spline requires that

<sup>2</sup> � <sup>Δ</sup><sup>1</sup> Δ<sup>0</sup> þ Δ<sup>1</sup> � � 1

d0 d1 ⋮ dL�<sup>1</sup> dL

d�<sup>1</sup> ¼ x0, dLþ<sup>1</sup> ¼ xL: (28)

d<sup>1</sup> ¼ x0,

dL�<sup>1</sup> ¼ xL:

r0 r1 ⋮ rL�<sup>1</sup> rL

Scalar and Parametric Spline Curves and Surfaces http://dx.doi.org/10.5772/intechopen.74929

, (26)

(27)

11

(29)

(30)

equations is obtained [5, 6]:

where

1

α<sup>1</sup> β<sup>1</sup> γ<sup>1</sup>

⋱

r<sup>0</sup> ¼ x0,

rL ¼ xL:

The first and last vertices of the polygon are given by

d2

<sup>2</sup> � <sup>Δ</sup><sup>L</sup>�<sup>2</sup> Δ<sup>L</sup>�<sup>2</sup> þ Δ<sup>L</sup>�<sup>1</sup> � �

d2

Using the relations in Eq. (29), we obtain that

unwelcome inflection points.

3.4. NURBS curves

Figure 7. The inverse design and interpolation problems.

This latest parametrization has the advantage that it yields to a symmetric curve if the control polygon is symmetric as well, which may be interesting for certain applications.

#### 3.2. Inverse design and interpolation problems

A two-dimensional geometric description based on B-spline curves requires the definition of a control polygon (the de Boor's polygon) that mimics the curve. Therefore two approaches are possible. The first method consists of providing the set of the de Boor's points (i.e., define the de Boor's polygon interactively from user's input) that defines the composite curve, which is known as "inverse design," and it has its application in "TrueType" font technology as shown in Figure 7. The second approach consists of defining the set of base points and then solves a linear system of equations for the de Boor's points such that the resulting curve passes through them. This latter is known as the "interpolation" problem.

Figure 7 shows the difference between the above approaches; from left to right, it has the de Boor's control polygon, inverse design, and interpolation problems both taking into account the same polygon as an argument with cubic curves.

#### 3.3. Interpolation with cubic curves

In order to interpolate with cubic B-spline curves, we find unknown junction points such that they pass through a given set of data points x0,…, xL and corresponding parameter values ξ0, ξ1,…, ξ<sup>L</sup>�<sup>1</sup>, ξL. A composite cubic curve C, determined by its de Boor's polygon [4, 5] d�<sup>1</sup>,…, dLþ<sup>1</sup> such that Cð Þ¼ ξ<sup>i</sup> xi, is required. The solution to this problem is obtained by finding the relationship between the data points xi and the control vertices di. This leads to the following linear system of equations for the unknown de Boor's points [5]:

$$
\lambda\_i \cdot \underline{d}\_{i-1} + \beta\_i \cdot \underline{d}\_i + \gamma\_i \cdot \underline{d}\_{i+1} = (\Delta\_{i-1} + \Delta\_i) \cdot \underline{x}\_{\forall} \quad i = 1 \ldots L - 1,\tag{24}
$$

where (with Δ�<sup>1</sup> ¼ Δ<sup>L</sup> ¼ 0)

$$\begin{aligned} \alpha\_i &= \frac{\left(\Delta\_i\right)^2}{\Delta\_{i-2} + \Delta\_{i-1} + \Delta\_i}, \\ \beta\_i &= \frac{\Delta\_i(\Delta\_{i-2} + \Delta\_{i-1})}{\Delta\_{i-2} + \Delta\_{i-1} + \Delta\_i} + \frac{\Delta\_{i-1}(\Delta\_i + \Delta\_{i+1})}{\Delta\_{i-1} + \Delta\_i + \Delta\_{i+1}}, \\ \gamma\_i &= \frac{\left(\Delta\_{i-1}\right)^2}{\Delta\_{i-1} + \Delta\_i + \Delta\_{i+1}}. \end{aligned} \tag{25}$$

If the two Bèzier points b<sup>1</sup> and b3L�<sup>1</sup> are arbitrarily chosen, the following linear system of equations is obtained [5, 6]:

$$
\begin{bmatrix} 1 \\ a\_1 & \beta\_1 & \gamma\_1 \\ & & \ddots \\ & & & a\_{L-1} & \beta\_{L-1} \\ & & & & 1 \end{bmatrix} \cdot \begin{bmatrix} \frac{d\_0}{d\_1} \\ \frac{d\_1}{d\_1} \\ \vdots \\ \frac{d\_{L-1}}{d\_L} \end{bmatrix} = \begin{bmatrix} \frac{\mathcal{L}\_0}{\mathcal{I}\_1} \\ \vdots \\ \frac{\mathcal{L}\_{L-1}}{\mathcal{I}\_{L-1}} \end{bmatrix} \tag{26}
$$

where

This latest parametrization has the advantage that it yields to a symmetric curve if the control

A two-dimensional geometric description based on B-spline curves requires the definition of a control polygon (the de Boor's polygon) that mimics the curve. Therefore two approaches are possible. The first method consists of providing the set of the de Boor's points (i.e., define the de Boor's polygon interactively from user's input) that defines the composite curve, which is known as "inverse design," and it has its application in "TrueType" font technology as shown in Figure 7. The second approach consists of defining the set of base points and then solves a linear system of equations for the de Boor's points such that the resulting curve passes through

Figure 7 shows the difference between the above approaches; from left to right, it has the de Boor's control polygon, inverse design, and interpolation problems both taking into account

In order to interpolate with cubic B-spline curves, we find unknown junction points such that they pass through a given set of data points x0,…, xL and corresponding parameter values ξ0, ξ1,…, ξ<sup>L</sup>�<sup>1</sup>, ξL. A composite cubic curve C, determined by its de Boor's polygon [4, 5] d�<sup>1</sup>,…, dLþ<sup>1</sup> such that Cð Þ¼ ξ<sup>i</sup> xi, is required. The solution to this problem is obtained by finding the relationship between the data points xi and the control vertices di. This leads to

; i ¼ 1…L � 1, (24)

(25)

the following linear system of equations for the unknown de Boor's points [5]: α<sup>i</sup> � di�<sup>1</sup> þ β<sup>i</sup> � di þ γ<sup>i</sup> � diþ<sup>1</sup> ¼ ð Þ� Δ<sup>i</sup>�<sup>1</sup> þ Δ<sup>i</sup> xi

2

2

,

þ

:

Δ<sup>i</sup>�<sup>1</sup>ð Þ Δ<sup>i</sup> þ Δ<sup>i</sup>þ<sup>1</sup> Δ<sup>i</sup>�<sup>1</sup> þ Δ<sup>i</sup> þ Δ<sup>i</sup>þ<sup>1</sup>

,

Δ<sup>i</sup>�<sup>2</sup> þ Δ<sup>i</sup>�<sup>1</sup> þ Δ<sup>i</sup>

Δ<sup>i</sup>�<sup>1</sup> þ Δ<sup>i</sup> þ Δ<sup>i</sup>þ<sup>1</sup>

<sup>β</sup><sup>i</sup> <sup>¼</sup> <sup>Δ</sup>ið Þ <sup>Δ</sup><sup>i</sup>�<sup>2</sup> <sup>þ</sup> <sup>Δ</sup><sup>i</sup>�<sup>1</sup> Δ<sup>i</sup>�<sup>2</sup> þ Δ<sup>i</sup>�<sup>1</sup> þ Δ<sup>i</sup>

<sup>α</sup><sup>i</sup> <sup>¼</sup> ð Þ <sup>Δ</sup><sup>i</sup>

<sup>γ</sup><sup>i</sup> <sup>¼</sup> ð Þ <sup>Δ</sup><sup>i</sup>�<sup>1</sup>

polygon is symmetric as well, which may be interesting for certain applications.

3.2. Inverse design and interpolation problems

Figure 7. The inverse design and interpolation problems.

10 Topics in Splines and Applications

them. This latter is known as the "interpolation" problem.

the same polygon as an argument with cubic curves.

3.3. Interpolation with cubic curves

where (with Δ�<sup>1</sup> ¼ Δ<sup>L</sup> ¼ 0)

$$\underline{\mathbf{x}}\_{0} = \underline{\mathbf{x}}\_{0'}$$

$$\underline{\mathbf{r}}\_{i} = (\Delta\_{i-1} + \Delta\_{i}) \cdot \underline{\mathbf{x}}\_{i} \; ; \; \mathbf{i} = 1...L-1,\tag{27}$$
 $\underline{\mathbf{r}}\_{L} = \underline{\mathbf{x}}\_{L}$ .

The first and last vertices of the polygon are given by

$$
\underline{d}\_{-1} = \underline{\mathbf{x}}\_{0} \cdot \underline{d}\_{l+1} = \underline{\mathbf{x}}\_{l}.\tag{28}
$$

The points b<sup>1</sup> and b3L�<sup>1</sup> can be calculated from a given end condition. There are two possibilities for the choice of B-spline ending conditions. A natural spline requires that

$$\begin{aligned} \frac{d^2}{dt^2} \underline{\mathbf{s}}\_0(0) &= \mathbf{6} \cdot (\underline{\mathbf{b}}\_2 - 2\underline{\mathbf{b}}\_1 + \underline{\mathbf{b}}\_0) = \underline{\mathbf{0}}, \\\\ \frac{d^2}{dt^2} \underline{\mathbf{s}}\_{L-1}(1) &= \mathbf{6} \cdot (\underline{\mathbf{b}}\_{3L} - 2\underline{\mathbf{b}}\_{3L-1} + \underline{\mathbf{b}}\_{3L-2}) = \underline{\mathbf{0}}. \end{aligned} \tag{29}$$

Using the relations in Eq. (29), we obtain that

$$\left[2 - \frac{\Delta\_1}{\Delta\_0 + \Delta\_1}\right] \cdot \underline{d}\_0 - \frac{\Delta\_0}{\Delta\_0 + \Delta\_1} \underline{d}\_1 = \underline{\mathbf{x}}\_{0'} \tag{30}$$

$$\left[2 - \frac{\Delta\_{L-2}}{\Delta\_{L-2} + \Delta\_{L-1}}\right] \cdot \underline{d}\_L - \frac{\Delta\_{L-1}}{\Delta\_{L-2} + \Delta\_{L-1}} \underline{d}\_{L-1} = \underline{\mathbf{x}}\_L \cdot$$

These two equations replace the first and last rows of the linear system of equations given in Eq. (26). Notice that in either case, natural ending conditions or prescribed tangent vectors, the linear system in Eq. (24) is a tridiagonal matrix. Since the coefficient matrix is real and scalar, and the left- and right-hand-side vectors are in fact hypervectors (i.e., an array of vectors), it is recommendable to use a type of Gaussian elimination method against multiple right-hand sides to achieve performance [6, 7]. If we recompute the interpolant in Figure 4 but this time with a B-spline cubic curve, we then obtain a smoother and steadier interpolant free of unwelcome inflection points.

#### 3.4. NURBS curves

NURBS curves are useful when we require an exact geometrical representation of some entities, such as circles, parabolas, ellipses, spheres, cylinders, etc. This is precisely the case in various applications in aerospace and mechanical engineering where NURBS are quite popular [4, 5, 8–10]. For instance, a NURBS curve is defined by its rational representation in Eq. (31):

$$\underline{\mathfrak{R}}(t) = \frac{\sum\_{i=0}^{m} \boldsymbol{w}\_{i} \cdot \boldsymbol{B}\_{i}^{m}(t) \cdot \underline{\mathfrak{b}}\_{i}}{\sum\_{i=0}^{m} \boldsymbol{w}\_{i} \cdot \boldsymbol{B}\_{i}^{m}(t)},\tag{31}$$

In order to interpolate a set of points with a NURBS curve in two or three dimensions, one may follow the same procedure described with B-spline curves except that a mapping to R<sup>4</sup> must be

then the linear system in Eq. (24) with the right boundary conditions can be solved with xi

The latter is a straightforward procedure to reuse the subroutines already developed for

We implemented the proposed approaches in a computer code named "LogProc" which is a graphical user interface application developed with the C++ programming language. LogProc is proprietary software, but a free community version will be available for download from www.logproc.com. All examples were obtained applying the proposed knot sequence (23) to construct cubic composite curves. The empty circles represent de Boor's points (sample inverse designs) or base points (interpolation problems). We utilized the natural end condition in examples in Figures 10 and 11 and the prescribed tangent in the remaining cases. We depict a typical font design application in Figure 10 where we represent some alphabet's letters. Notice that an approach like this is appropriate to construct font outlines because they can be scaled

; ~xi ∈ R<sup>4</sup>

, as defined by the Eq. (32). After solving this system, the solution control

CA � <sup>~</sup>di ; di <sup>∈</sup> <sup>R</sup><sup>3</sup>

1

, (32)

Scalar and Parametric Spline Curves and Surfaces http://dx.doi.org/10.5772/intechopen.74929 13

: (33)

<sup>~</sup>xi <sup>¼</sup> wi � xi yi zi <sup>1</sup> � �<sup>T</sup>

1000 0100 0010

polygon is still in R4, which implies that a mapping back to R<sup>3</sup> is required:

0 B@

di <sup>¼</sup> <sup>1</sup> wi

carried out first. The new input points ~xi are given by

replaced by ~xi

B-spline curves.

3.5. Numerical examples

Figure 10. A typical font design application.

where the weights wi are positive real scalars. The usual B-spline definition is recovered if all those weights equal 1. Generally speaking, the weights play the role of attracting the curve toward its control polygon when we increase their values [5, 8]. It turns out that specific weights lead to exact representation of circles, for instance, as shown in Figure 8, where the real numbers depicted are the given weights. A circle can be exactly represented by three- or four-quadratic arcs (left and right side, respectively, in Figure 8); this latter alternative is more attractive, for instance, to generate a surface of revolution [4, 5, 8]. NURBS also provide exact representation for 3D surfaces such as spheres and cylinders as well as volumes [4, 10]. The reader may refer to [4, 5, 8–11] for further details for this well-established area of computational geometry. We depict an example of practical interest, in the context of geomechanics, in Figure 9. Herein we precisely represent a near-borehole section. To describe the borehole geometry, we employ four line segments and a quadratic arc as shown.

Figure 8. Two exact equivalent representations for a circle (the remaining weights equal 1).

Figure 9. We represent a near borehole "exactly" by NURBS as shown.

In order to interpolate a set of points with a NURBS curve in two or three dimensions, one may follow the same procedure described with B-spline curves except that a mapping to R<sup>4</sup> must be carried out first. The new input points ~xi are given by

$$
\underline{\check{\mathbf{x}}}\_i = \mathbf{w}\_i \cdot \begin{pmatrix} \mathbf{x}\_i & \mathbf{y}\_i & \mathbf{z}\_i & \mathbf{1} \end{pmatrix}^T; \ \underline{\check{\mathbf{x}}}\_i \in \mathbb{R}^4,\tag{32}
$$

then the linear system in Eq. (24) with the right boundary conditions can be solved with xi replaced by ~xi , as defined by the Eq. (32). After solving this system, the solution control polygon is still in R4, which implies that a mapping back to R<sup>3</sup> is required:

$$
\underline{d}\_i = \frac{1}{w\_i} \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \end{pmatrix} \cdot \tilde{\underline{d}}\_i \; ; \; \underline{d}\_i \in \mathbb{R}^3. \tag{33}
$$

The latter is a straightforward procedure to reuse the subroutines already developed for B-spline curves.

#### 3.5. Numerical examples

various applications in aerospace and mechanical engineering where NURBS are quite popular [4, 5, 8–10]. For instance, a NURBS curve is defined by its rational representation in Eq. (31):

wi � Bm

wi � Bm <sup>i</sup> ð Þt

<sup>i</sup> ðÞ� t bi

, (31)

Pm i¼0

Pm i¼0

where the weights wi are positive real scalars. The usual B-spline definition is recovered if all those weights equal 1. Generally speaking, the weights play the role of attracting the curve toward its control polygon when we increase their values [5, 8]. It turns out that specific weights lead to exact representation of circles, for instance, as shown in Figure 8, where the real numbers depicted are the given weights. A circle can be exactly represented by three- or four-quadratic arcs (left and right side, respectively, in Figure 8); this latter alternative is more attractive, for instance, to generate a surface of revolution [4, 5, 8]. NURBS also provide exact representation for 3D surfaces such as spheres and cylinders as well as volumes [4, 10]. The reader may refer to [4, 5, 8–11] for further details for this well-established area of computational geometry. We depict an example of practical interest, in the context of geomechanics, in Figure 9. Herein we precisely represent a near-borehole section. To describe the borehole

RðÞ¼ t

12 Topics in Splines and Applications

geometry, we employ four line segments and a quadratic arc as shown.

Figure 8. Two exact equivalent representations for a circle (the remaining weights equal 1).

Figure 9. We represent a near borehole "exactly" by NURBS as shown.

We implemented the proposed approaches in a computer code named "LogProc" which is a graphical user interface application developed with the C++ programming language. LogProc is proprietary software, but a free community version will be available for download from www.logproc.com. All examples were obtained applying the proposed knot sequence (23) to construct cubic composite curves. The empty circles represent de Boor's points (sample inverse designs) or base points (interpolation problems). We utilized the natural end condition in examples in Figures 10 and 11 and the prescribed tangent in the remaining cases. We depict a typical font design application in Figure 10 where we represent some alphabet's letters. Notice that an approach like this is appropriate to construct font outlines because they can be scaled

Figure 10. A typical font design application.

Figure 11. A pair of petroleum reservoir outlines.

and rotated. This feature is of significant interest in the "TrueType" font technology where outlines that are insensible to the resolution of the physical device in which they will be shown, such as monitors or printers, must be obtained [6]. We added a bonus section on the numerical implementation for computing splines that is available online, https://www.logproc.com/bookchapter-splines. We also include most sample datasets for downloading. We also recommend there suitable open-source libraries that are convenient to use. All vector and raster plots were prepared by logproc which can create high-quality PDF files in Windows 7 and 10, for instance.

Figure 11 shows a zenith view of a pair of petroleum reservoir outlines. Few base points permit to approximate their complex shape. These shapes could be used as arguments to generate an unstructured mesh appropriate to simulate the flow in a porous media [7].

We interpolate a discrete blade geometry approximation in both Figures 12 and 13. A3K7 profiles are constructed in the same way as NACA 65, but they present rounded trailing edges [6]. A3K7's shape is represented by 46 base points and circle arcs both in leading and trailing edges. Therefore the curves that interpolate the data points are tangents to circle arcs to ensure C<sup>1</sup> continuity between these entities. The profiles in the left of Figure 12 were obtained applying Eq. (15) to construct C<sup>1</sup> single Bèzier curves (two curves, each of them approximating to suction and pressure sides, respectively). However, note that the resulting curves have unexpected inflection points on the suction side. The enforcement of continuity conditions

implies a large number of constraints after Eq. (15), which explains this behavior. If we replace the former Bèzier curves by two B-spline curves, computed from Eqs. (24) and (29), we obtain a smooth A3K7 geometry description (see profiles in the right-hand side of Figure 12). Figure 14 zooms in to show that the resulting geometrical description is smooth and free of unwelcome

Let <sup>S</sup>Int : <sup>R</sup><sup>2</sup> ! <sup>R</sup><sup>3</sup> be a two-parameter mapping which represents a given surface. If structured data, i.e., tensor product data, needs to be interpolated, one may expect to come up with tensor product surfaces as well, where two parameters ð Þ ξ; η allow covering two different directions associated with the surface. In the computational space, i.e., in the plane ð Þ ξ; η , the domain,

B-spline tensor product surfaces allow interpolating structured data, and they are defined as

<sup>i</sup>ð Þ <sup>ξ</sup> and <sup>D</sup><sup>l</sup>

where L<sup>ξ</sup> and L<sup>η</sup> are the number of curves in their respective directions.

h i, is a rectangle, and its image is the surface in 3D as shown in Figure 15,

j

ð Þ η , which is

Scalar and Parametric Spline Curves and Surfaces http://dx.doi.org/10.5772/intechopen.74929 15

features such as inflection points.

Figure 14. Details highlighted in Figures 12 and 13.

Figure 13. A3K7 interpolated by B-spline curves.

4. Interpolation surfaces

� � � <sup>η</sup>0; <sup>η</sup>Lv

the tensor product of two families of curves C<sup>k</sup>

Ω ¼ ξ0; ξLu

Figure 12. A3K7 interpolated by Bèzier curves.

Figure 13. A3K7 interpolated by B-spline curves.

and rotated. This feature is of significant interest in the "TrueType" font technology where outlines that are insensible to the resolution of the physical device in which they will be shown, such as monitors or printers, must be obtained [6]. We added a bonus section on the numerical implementation for computing splines that is available online, https://www.logproc.com/bookchapter-splines. We also include most sample datasets for downloading. We also recommend there suitable open-source libraries that are convenient to use. All vector and raster plots were prepared by logproc which can create high-quality PDF files in Windows 7 and 10, for instance. Figure 11 shows a zenith view of a pair of petroleum reservoir outlines. Few base points permit to approximate their complex shape. These shapes could be used as arguments to generate an unstructured mesh appropriate to simulate the flow in a porous media [7].

Figure 11. A pair of petroleum reservoir outlines.

14 Topics in Splines and Applications

Figure 12. A3K7 interpolated by Bèzier curves.

We interpolate a discrete blade geometry approximation in both Figures 12 and 13. A3K7 profiles are constructed in the same way as NACA 65, but they present rounded trailing edges [6]. A3K7's shape is represented by 46 base points and circle arcs both in leading and trailing edges. Therefore the curves that interpolate the data points are tangents to circle arcs to ensure C<sup>1</sup> continuity between these entities. The profiles in the left of Figure 12 were obtained applying Eq. (15) to construct C<sup>1</sup> single Bèzier curves (two curves, each of them approximating to suction and pressure sides, respectively). However, note that the resulting curves have unexpected inflection points on the suction side. The enforcement of continuity conditions

Figure 14. Details highlighted in Figures 12 and 13.

implies a large number of constraints after Eq. (15), which explains this behavior. If we replace the former Bèzier curves by two B-spline curves, computed from Eqs. (24) and (29), we obtain a smooth A3K7 geometry description (see profiles in the right-hand side of Figure 12). Figure 14 zooms in to show that the resulting geometrical description is smooth and free of unwelcome features such as inflection points.
