Spline Curves Formation Given Extreme Derivatives

: This paper is dedicated to development of mathematical models for polynomial spline curve formation given extreme vector derivatives. This theoretical problem is raised in the view of a wide variety of theoretical and practical problems considering motion of physical objects along certain trajectories with predetermined laws of variation of speed, acceleration, jerk, etc. The analysis of the existing body of work on computational geometry performed by the authors did not reveal any systematic research in mathematical model development dedicated to solution of similar tasks. The established purpose of the research is therefore to develop mathematical models of formation of spline curves based on polynomials of various orders modeling the determined trajectories. The paper presents mathematical models of spline curve formation given extreme derivatives of the initial orders. The paper considers construction of Hermite and B é zier spline curves of various orders consisting of various segments. The acquired mathematical models are generalized for the cases of vector derivatives of higher orders. The presented models are of systematic nature and are universal, i.e., they can be applied in formation of any polynomial spline curves given extreme vector derivatives. The paper provides a number of examples validating the presented models.


Introduction
Formation of composite polynomial spline curves given the initial extreme derivatives at the endpoints of the segments is finding increasing application in solutions to a variety of tasks of science and manufacture. For example, in computer animation, camera motion along a curvilinear trajectory is modeled as motion along a curved line r(t), t 1 ≤ t ≤ t 2 . Camera trajectory calculation is performed with consideration for laws of variation of camera velocity v(t) = dr dt and acceleration a(t) = dv dt = d 2 r dt 2 throughout the trajectory [1]. In machine-building cutting tool trajectory calculation through Hermite cubic spline interpolation is applied in pocket machining of surfaces of arbitrary shape. In this regard, it is noted that that cutting tool acceleration is not continuous, which results in machining defects [2].
One of the main problems in development of high-speed cutting NC systems is achieving seamless cutting tool motion. The models of NC systems developed for this purpose ensure smoothness of acceleration a(t) and continuity of jerk defined by the third vector derivative [3][4][5]: j = da dt = d 3 r dt 3 . The fourth vector derivative is called snap dj dt = d 4 r dt 4 . It is applied, for example, in development of minimum snap trajectory for quadrotors [6].
Papers [7,8] apply the sixth vector derivative in Apophis asteroid trajectory calculation in Earth gravity field.
As follows from the mentioned papers, spline curve formation through extreme derivatives SC There are approaches to development of mathematical models of SC (n) ED formation known from scientific papers on spline curve theory. One should trace the origins of this development to cubic spline interpolation through formation of Hermite segments given first-order extreme derivatives subsequently connected with smoothness C 2 into cubic SC (3) ED [1,[9][10][11][12][13][14][15][16][17][18][19]. The SC (3) ED model later became the basis for development of mathematical model of a Hermite segment SCS (5) ED (spline curve segment) described by a polynomial of the fifth order given the extreme derivatives of the first and the second order [1]. However, in subsequent formation of the SC (5) ED mathematical model, the first and the second vector derivatives at the first point of the first segment and at the final point of the final segment were not initially specified, therefore the mathematical model resulted in a system of linear equations with the number of unknown values exceeding the number of equations. In the course of development of this system, the fact that it is incomplete has been revealed. The author of paper [1] made a decision to reduce the number of unknown values down to the number of equations by assigning values to certain extreme vector derivatives. The resultant approach to solution of the problem of SC (5) formation is of purely theoretical nature. In practice, the more relevant approach is SC (5) ED formation. According to this approach, both the segment SCS (5) ED and the composite curve SC (5) ED acquired through connection of segments with smoothness C 4 are formed through the same mathematical model.
We have to acknowledge the paper of theoretical nature proposing a mathematical model of SC (3) ED and SC (4) ED formation in the form of B-spline curves interpolating discrete arrays of points in the plane [20]. The paper considers vector derivatives of orders one to three as given extreme derivatives. It is noted that the problem of spatial interpolation with consideration for curvature and torsion in order to acquire SC ED does not yet have a solution. In this regard, the authors of the paper [20] provide an explanation that it is virtually impossible to evaluate corresponding directions and magnitudes of vectors of the second and the third derivative in SC ED formation. We were unable to find more modern papers in this area of research. Therefore, with regard for practical requirements in models and algorithms for formation of curves SC (n) ED , n > 3 and taking into account the existing theoretical basis of mathematical models of spline curves, the following purpose of the research is established: to develop mathematical models of formation of polynomial curves SC (n) ED , n > 3 and to validate these models on numeric experiments. Section 2 of the present paper considers the conditions for formation of spline curves given extreme derivatives of the initial orders and provides generalizations for the case of first k vector derivatives. Section 3 considers the mathematical models and many examples for closed and non-closed polynomial spline curves of various orders and consisting of various numbers of segments.

Conditions for Spline Curve Formation Given Extreme Derivatives
At the initial stage of analytical spline curve shaping given extreme derivatives it is essential to know the total number of conditions for shaping. Knowing the total number of conditions allows one to determine the degree of a polynomial describing the segment-or each segment-of the desired spline curve.

Conditions for Hermite Cubic Sspline Curve Shaping
It is known that a cubic spline segment can be constructed given boundary conditions 1 P , 1 P ′ and 2 P , 2 P ′ [1,[9][10][11][12][13][14][15][16][17][18][19] (see Figure 1).  As follows from the intermediate conditions, the point 2 P should be considered double as well as the unknown derivative 2 P ′ at that point. Each boundary and intermediate condition is described by a linear algebraic equation. Simultaneously, these equations unambiguously define the unknown coefficients of the polynomials of the connected segments. A general cubic spline curve consisting of ( 1) j − segments, where j is the number of points of the curve, is formed through a total number of N conditions, where N is obviously defined through formula 4( 1) N j = − . This number is also the total number of the unknown coefficients of all polynomials of the third degree describing the connected segments. In the general case, the order of polynomial describing the segment through extreme derivatives is determined through formula n = 2m + 1, where m represents the number of pairs of extreme derivatives at segment endpoints. As follows from the technique of algebraic definition of polynomial coefficients of cubic spline the existence of four boundary conditions resulting in respective algebraic equations is sufficient for unambiguous definition of four coefficients of the polynomial.
Eight conditions defining four vector coefficients of each polynomial describing a segment are required in order to define a cubic spline curve consisting of two segments. These conditions include the given boundary conditions P 1 , P 1 ; P 3 , P 3 , and intermediate conditions in connection point P 2 (see Figure 2): P 2 = p 1 (t = t 2 ), P 2 = p 2 (t = 0); P 2 = p 1 (t = t 2 ), P 2 = p 2 (t = 0), where p 1 (t) and p 2 (t) are polynomials of respective segments s 1 and s 2 .

Conditions for Hermite Cubic Sspline Curve Shaping
It is known that a cubic spline segment can be constructed given boundary conditions 1 P , 1 P ′ and 2 P , 2 P ′ [1,[9][10][11][12][13][14][15][16][17][18][19] (see Figure 1). In the general case, the order of polynomial describing the segment through extreme derivatives is determined through formula 2 1 n m = + , where m represents the number of pairs of extreme derivatives at segment endpoints. As follows from the technique of algebraic definition of polynomial coefficients of cubic spline the existence of four boundary conditions resulting in respective algebraic equations is sufficient for unambiguous definition of four coefficients of the polynomial. Eight conditions defining four vector coefficients of each polynomial describing a segment are required in order to define a cubic spline curve consisting of two segments.
These conditions include the given boundary conditions 1 P , 1 P ′ ; 3 P , 3 P ′ , and intermediate conditions in connection point 2 P (see Figure 2): 2  As follows from the intermediate conditions, the point 2 P should be considered double as well as the unknown derivative 2 P ′ at that point. Each boundary and intermediate condition is described by a linear algebraic equation. Simultaneously, these equations unambiguously define the unknown coefficients of the polynomials of the connected segments. A general cubic spline curve consisting of ( 1) j − segments, where j is the number of points of the curve, is formed through a total number of N conditions, where N is obviously defined through formula 4( 1) N j = − . This number is also the total number of the unknown coefficients of all polynomials of the third degree describing the connected segments. As follows from the intermediate conditions, the point P 2 should be considered double as well as the unknown derivative P 2 at that point. Each boundary and intermediate condition is described by a linear algebraic equation. Simultaneously, these equations unambiguously define the unknown coefficients of the polynomials of the connected segments. A general cubic spline curve consisting of (j − 1) segments, where j is the number of points of the curve, is formed through a total number of N conditions, where N is obviously defined through formula N = 4(j − 1). This number is also the total number of the unknown coefficients of all polynomials of the third degree describing the connected segments.

Conditions for Formation of a Spline Curve of Segments Described by Polynomials of Higher Degree
A segment with two pairs of extreme derivatives (see Figure 3) is described, according to the formula n = 2m + 1, by a polynomial of the fifth degree Six conditions P 1 , P 1 , P 1 ; P 2 , P 2 , P 2 unambiguously define six coefficients of this polynomial [1].

Degree
A segment with two pairs of extreme derivatives (see Figure 3) is described, according to the formula 2 1 n m = + , by a polynomial of the fifth degree . Six conditions 1 P , 1 P ′ , 1 P ′′ ; 2 P , 2 P ′ , 2 P ′′ unambiguously define six coefficients of this polynomial [1]. Formation of a spline curve consisting of two segments defined by fifth-degree polynomials requires 12 conditions. These conditions include the given boundary conditions  Obviously, the point 2 P should be considered double, as well as the first-and the second-order derivatives at it. The algorithms of formation of Hermite spline curves based on fifth-degree and seventh-degree polynomials are thoroughly considered in Sections 3.1-3.5 respectively. Formation of a general spline curve consisting of ( 1) j − smoothly connected segments defined by fifth-degree polynomials requires the total number of 6( 1) N j = − conditions. This number is also the total number of the unknown coefficients of all fifth-degree polynomials describing ( 1) j − segments.
If we consider two given points 1 P and 2 P , as well as the first k vector derivatives at each point, then, according to the formula 2 1 n m = + , the degree of the polynomial defining a segment with endpoints 1 P and 2 P equals It is possible to define the total number of conditions for formation of a general spline curve consisting of ( 1) j − segments each described by a polynomial of degree 2 1 k + . It is calculated through the Formation of a spline curve consisting of two segments defined by fifth-degree polynomials requires 12 conditions. These conditions include the given boundary conditions P 1 , P 1 , P 1 ; P 3 , P 3 , P 3 ; the intermediate conditions in connection point P 2 (see Figure 4): where p 1 (t) and p 2 (t) are polynomials of the fifth degree of respective segments s 1 and s 2 .
A segment with two pairs of extreme derivatives (see Figure 3) is described, according to the formula 2 1 n m = + , by a polynomial of the fifth degree . Six conditions 1 P , 1 P ′ , 1 P ′′ ; 2 P , 2 P ′ , 2 P ′′ unambiguously define six coefficients of this polynomial [1]. Formation of a spline curve consisting of two segments defined by fifth-degree polynomials requires 12 conditions. These conditions include the given boundary conditions  Obviously, the point 2 P should be considered double, as well as the first-and the second-order derivatives at it. The algorithms of formation of Hermite spline curves based on fifth-degree and seventh-degree polynomials are thoroughly considered in Sections 3.1-3.5 respectively. Formation of a general spline curve consisting of ( 1) j − smoothly connected segments defined by fifth-degree polynomials requires the total number of 6( 1) N j = − conditions. This number is also the total number of the unknown coefficients of all fifth-degree polynomials describing ( 1) j − segments.
If we consider two given points 1 P and 2 P , as well as the first k vector derivatives at each point, then, according to the formula 2 1 n m = + , the degree of the polynomial defining a segment with endpoints 1 P and 2 P equals It is possible to define the total number of conditions for formation of a general spline curve consisting of ( 1) j − segments each described by a polynomial of degree 2 1 k + . It is calculated through the Obviously, the point P 2 should be considered double, as well as the first-and the second-order derivatives at it. The algorithms of formation of Hermite spline curves based on fifth-degree and seventh-degree polynomials are thoroughly considered in Sections 3.1-3.5 respectively.
Formation of a general spline curve consisting of (j − 1) smoothly connected segments defined by fifth-degree polynomials requires the total number of N = 6(j − 1) conditions. This number is also the total number of the unknown coefficients of all fifth-degree polynomials describing (j − 1) segments.
If we consider two given points P 1 and P 2 , as well as the first k vector derivatives at each point, then, according to the formula n = 2m + 1, the degree of the polynomial defining a segment with endpoints P 1 and P 2 equals n = 2k + 1. It is possible to define the total number of conditions for formation of a general spline curve consisting of (j − 1) segments each described by a polynomial of degree 2k + 1. It is calculated through the formula N = 2(k + 1)(j − 1). Thus, for example, if k = 2 and j = 3, N = 12, which correlates to the spline curve depicted on

Conditions for Closed Spline Curve Formation
In order to form a closed spline curve given a discrete array of j points, it is required to fulfill the total number of N = 2(k + 1)j conditions. Here k represents the number of pairs of extreme derivatives of the initial orders at the endpoints of the formed spline curve, j represents the number of segments. For example, given four points P j , j = 1, . . . , 4 with respective derivatives P j , P j it is possible to form a closed Hermite spline curve based on a fifth-degree polynomial (see Figure 5). The resultant curve consists of four segments connected with smoothness C 4 . quired to fulfill the total number of 2( 1) N k j = + conditions. Here k represents the number of pairs of extreme derivatives of the initial orders at the endpoints of the formed spline curve, j represents the number of segments. For example, given four points j P , 1,..., 4 j = with respective derivatives j P ′ , j P ′′ it is possible to form a closed Hermite spline curve based on a fifth-degree polynomial (see Figure 5). The resultant curve consists of four segments connected with smoothness 4 C . Obviously, the total number of conditions defining this spline curve equals 24 N = , i.e., six conditions for each segment of the curve. Let us list them: the boundary (given) conditions conditions in the segments connection points are as follows: Obviously, in formation of a polynomial closed spline curve each point of the given discrete array is considered double, as well as each defined vector derivative at any point of the array. The formation of closed polynomial splines is thoroughly considered on examples in Sections 3.3 and 3.7.

Spline Curve Formation Given Extreme Derivatives
In the following section let us consider the construction of mathematical models of polynomial spline curves consisting of various numbers of smoothly connected segments. The segmental formation of spline curves is based on the concept of a continuous (or smooth) connection of segments at their common point. In the theory of spline curves and spline surfaces two types of smoothness are known: geometric n G and parametric n G [1,9,13]. Within the framework of this work, we use the strict concept of n C smoothness.

Construction of a Hermite Segment Given First-and Second-Order Extreme Derivatives
Let us assume the points 1 1 1 1 ( , , ) P x y z and 2 2 2 2 ( , , ) P x y z , as well as respective boundary conditions 1 P′ , 1 P′′ and 2 P′ , 2 P′′ are given (see Figure 6). Obviously, the total number of conditions defining this spline curve equals N = 24, i.e., six conditions for each segment of the curve. Let us list them: the boundary (given) conditions P 1 , . . . P 4 , whereby P 1 = p 4 (t = t 4 ), the intermediate (sought) conditions in the segments connection points are as follows: Obviously, in formation of a polynomial closed spline curve each point of the given discrete array is considered double, as well as each defined vector derivative at any point of the array. The formation of closed polynomial splines is thoroughly considered on examples in Sections 3.3 and 3.7.

Spline Curve Formation Given Extreme Derivatives
In the following section let us consider the construction of mathematical models of polynomial spline curves consisting of various numbers of smoothly connected segments. The segmental formation of spline curves is based on the concept of a continuous (or smooth) connection of segments at their common point. In the theory of spline curves and spline surfaces two types of smoothness are known: geometric G n and parametric G n [1,9,13]. Within the framework of this work, we use the strict concept of C n smoothness.

Construction of a Hermite Segment Given First-and Second-Order Extreme Derivatives
Let us assume the points P 1 (x 1 , y 1 , z 1 ) and P 2 (x 2 , y 2 , z 2 ), as well as respective boundary conditions P 1 , P 1 and P 2 , P 2 are given (see Figure 6).  Let us construct a Hermite spline curve segment ing through the points 1 P , 2 P and conforming to the given boundary conditions. Given the two endpoints and the initial m pairs of derivatives in the endpoints, it is possible to Let us construct a Hermite spline curve segment through the points P 1 , P 2 and conforming to the given boundary conditions. Given the two endpoints and the initial m pairs of derivatives in the endpoints, it is possible to calculate the interpolating polynomial of order 2m + 1. It is therefore obvious that the sought segment has to be described by a fifth-order polynomial The vectors P 1 , P 2 are the first vector derivatives constituting tangent vectors at the endpoints of the sough segment s, while P 1 , P 2 are the second vector derivatives constituting vectors of acceleration of a point tracing out the segment s. Obviously, the given conditions are sufficient in order to define the vector coefficients A i of the Formula (1).
Let us express the equations for the vector coefficients in the final matrix form The matrix Formula (2) of equations defining the vector coefficients of a fifth-degree polynomial describing a Hermite segment corresponds to the known matrix form by D. Solomon [1]. The Formula (2) is the basis for computational algorithms of spline curve formation considered further in the present paper. By substitution of the values of vector coefficients (2) into the Formula (1) we acquire the sought equation of Hermite spline curve segment with parameterization 0 ≤ t ≤ 1.

3.2.
Construction of a Fifth-Degree Hermite Spline Curve of Two Segments and Generalization for the Case of (j − 1) Segments Let us consider the connection of two Hermite segments s 1 and s 2 (see Figure 7) given the same boundary conditions as for the previously considered case of one segment s. press the polynomial equation of the segments in the following form: At the final point 2 2 ( ) P t of segment 1 s we acquire At the final point 3 3 ( ) P t of segment 2 s we acquire (3), we acquire the expressions for the first three coefficients of the equa- Parameterization of the segments is fulfilled in range t 1 ≤ t ≤ t 2 for the segment s 1 and t 2 ≤ t ≤ t 3 for the segment s 2 . Without loss of generality, we accept that t 1 = 0 at the initial point of segment s 1 and t 2 = 0 at the initial point of segment s 2 . Let us express the Let us express the derivatives of vector function p k (t) For k = 1 at the initial point P 1 (t 1 = 0) of segment s 1 we acquire At the final point P 2 (t 2 ) of segment s 1 we acquire For k = 2 at the initial point P 2 (t 2 = 0) of segment s 2 we acquire At the final point P 3 (t 3 ) of segment s 2 we acquire Thus, through (3), we acquire the expressions for the first three coefficients of the equation for the first segment s 1 : A 6 are determined through the system of three linear equations The expressions of the first three vector coefficients of segment s 2 follow from (4):

and A
(2) 6 are determined through the system of three linear equations The equations for these coefficients are of the following expanded form .
In order to connect segments s 1 and s 2 in point P 2 , it is required to determine vectors P 2 and P 2 . This can be achieved through equality of the third and the fourth derivatives of vector functions of the segments at the connection point: The system of linear Equations (7) and (8), with consideration (5) and (6) allows us to determine the sought vectors P 2 and P 2 . where: . Under the condition of parameterization of segments s 1 : 0 ≤ t ≤ 1 and s 2 : 0 ≤ t ≤ 1 the coefficients k r , n r , r = 1, . . . , 7 and α, β have the following values The mathematical model of two-segment shaping of a spline-curve proposed in this subsection is structurally different from the well-known model [1] due to the assignment of extreme derivatives.
Matrix Formula (2) and Algorithm 1 make it possible to generalize to the case of the formation of a smooth spline Hermite curve from (j − 1) segments. In the generalized representation the matrix of vector coefficients A = [T] · G for the equations of the segments of the Hermitian spline curve of the fifth degree, connected by the smoothness C 4 , has the Formula (12).
In order to construct a spline curve, let us apply the matrix Formula (19) for the case (j − 1) = 3. In this case the vector parameters of the geometric matrix G are determined through a uniquely solvable system of four linear equations in four unknowns. The system can be solved through one of the direct methods known in the field of linear algebra, e.g., the Gauss-Jordan method.  (9) and (10)  The values of curvature and torsion at boundary points j P , 1,..., 4 j = of the connected segments are listed in Table 1.  Algorithm 1 For obtaining a spline curve with polynomial equations of the fifth degree of segments s 1 and s 2 has the following text form: 1. Vector derivatives P 2 and P 2 at the joining point P 2 of segments s 1 and s 2 are determined based on the Formulas (9) and (10).

2.
Determine the vector coefficients A (1) i in the segment equation s 1 based on the matrix (2). In this case, the boundary conditions of the segment s 1 are the given vector derivatives P 1 and P 1 at the knot P 1 and the vector derivatives P 2 and P 2 at the knot P 2 determined according to item 1.

3.
Determine the vector coefficients A (2) i in the segment equation s 2 based on matrix (2). In this case, the boundary conditions of the segment s 2 are the vector derivatives P 2 and P 2 at the knot P 2 determined according to item 1 and the given vector derivatives P 3 and P 3 at the knot P 3 .
The values of curvature and torsion at boundary points P j , j = 1, . . . , 4 of the connected segments are listed in Table 1.
Mathematics 2021, 9, x FOR PEER REVIEW 11 of 31 Example 2. Figure 9 and Table 2 show the result of construction of a fifth-degree Hermite spline curve consisting of seven segments given the following knot points and boundary conditions: The solution of the examples 1 and 2 allow us to generalize the proposed algorithm and solution method for the case of (j − 1) connected segments of fifth-degree Hermite spline curve.
The system of linear equations for the case of unknown P 2 , P 3 , . . . , P j−2 , P j−1 and P 2 , P 3 , . . . , P j−2 , P j−1 is of the following form The generalized system of Equation (13) The generalized system of Equation (13) can be expressed in the following matrix form  j j j P P P P P P P P P P P P P P P P P P P P P The generalized system matrix (parametric matrix) (13) or (14) consists of 2( 2) j − linear equations in 2( 2) j − unknown. It is of size 2( 2) 2( 2) j j − × − and holds real numbers. This matrix is invertible and therefore the system of linear equations is uniquely solvable. It can be solved through Gauss-Jordan method, just as the Example above. The matrix Formula (14) of the generalized system of Equation (13) conforms to this method.

Construction of a Closed Fifth-Degree Hermite Spline Curve
In order to construct a closed Hermite spline curve of i segments subsequently connected in the given j knot points with smoothness 4 C , it is required to fulfill the following boundary conditions at connection points: 1 1 ( 0) Taking these conditions into account the matrix (15) is used to determine the vector coefficients of the segment equations.
The generalized system matrix (parametric matrix) (13) or (14) consists of 2(j − 2) linear equations in 2(j − 2) unknown. It is of size 2(j − 2) × 2(j − 2) and holds real numbers. This matrix is invertible and therefore the system of linear equations is uniquely solvable. It can be solved through Gauss-Jordan method, just as the Example above. The matrix Formula (14) of the generalized system of Equation (13) conforms to this method.

Construction of a Closed Fifth-Degree Hermite Spline Curve
In order to construct a closed Hermite spline curve of i segments subsequently connected in the given j knot points with smoothness C 4 , it is required to fulfill the following boundary conditions at connection points: P 1 = p 1 (t = 0), P 1 = p 1 (t = 0), P 1 = p j (t = 1), P 1 = p j (t = 1). Taking these conditions into account the matrix (15) is used to determine the vector coefficients of the segment equations.
Let us add vectors P 1 , P 1 and P 4 , P 4 to the list of unknown vectors in the system of equations and acquire the system of eight equations in eight unknowns: Let us transform the system (15) into matrix form in order to facilitate the solution through Gauss-Jordan method (16). i , i = 1, . . . , 6. Figure 10 and Table 3 show the result of construction of a closed spline curve of four segments.

The unknown vector coefficients A
Let us transform the system (15) into matrix form in order to facilitate the solution through Gauss-Jordan method (16). . Figure 10 and Table 3 show the result of construction of a closed spline curve of four segments. P P P P P P P P P P k P k P P P P P P P P P P P P P P The system of Equation (15) and the matrix Formula (16) can be generalized for the case of j knot points and j segments of a closed Hermite spline curve. The generalized system of equations is of the following matrix form:   The system of Equation (15) and the matrix Formula (16) can be generalized for the case of j knot points and j segments of a closed Hermite spline curve. The generalized system of equations is of the following matrix form: numbers. It is invertible and therefore the system of linear equations is uniquely solvable. It can also be solved through the Gauss-Jordan method. The matrix Formula (17) conforms to this method. Figure 11 and Table 4  The matrix of generalized system of equations consists of 2j linear equations in 2j unknown P 1 , P 2 , . . . P j−1 , P j ; P 1 , P 2 , . . . P j−1 , P j and is of size 2j × 2j. Its elements are also real numbers. It is invertible and therefore the system of linear equations is uniquely solvable. It can also be solved through the Gauss-Jordan method. The matrix Formula (17) conforms to this method. Figure 11 and Table 4 show the results of construction of a closed Hermite spline curve of 14 segments given the knot points: P 1 (0, 0, 0), P 2 (20, 30, 10), P 3 (50, 30, 20), P 4 (80, 40, 30), P 5 (110, 40, 40), P 6 (140, 50, 30), P 7 (200, 50, 20), P 8 (240, 0, 10), P 9 (200, −50, 0), P 10 (140, −50, 10), P 11 (110, −30, 30), P 12 (80, −40, 40), P 13 (50, −30, 50), P 14 (20, −30, 10). The method and the algorithm are identical to the ones applied in Example 3.

Construction of a Hermite Segment Given Boundary Derivatives of First, Second, and Third Orders
Given points 1 1 1 1 ( , , ) P x y z and 2 2 2 2 ( , , ) P x y z with the respective boundary conditions 1 P′ , 1 P′′ , 1 P ′′′ and 2 P′ , 2 P′′ , 2 P ′′′ (see Figure 12), it is required to construct a segment of a Hermite spline curve. Obviously, a segment of Hermite spline curve has to be described by a polynomial

Construction of a Hermite Segment Given Boundary Derivatives of First, Second, and Third Orders
Given points P 1 (x 1 , y 1 , z 1 ) and P 2 (x 2 , y 2 , z 2 ) with the respective boundary conditions P 1 , P 1 , P 1 and P 2 , P 2 , P 2 (see Figure 12), it is required to construct a segment of a Hermite spline curve.

Construction of a Hermite Segment Given Boundary Derivatives of First, Second, and Third Orders
Given points 1 1 1 1 ( , , ) P x y z and 2 2 2 2 ( , , ) P x y z with the respective boundary conditions 1 P′ , 1 P′′ , 1 P ′′′ and 2 P′ , 2 P′′ , 2 P ′′′ (see Figure 12), it is required to construct a segment of a Hermite spline curve. Obviously, a segment of Hermite spline curve has to be described by a polynomial Obviously, a segment of Hermite spline curve has to be described by a polynomial Vectors P 1 , P 2 are the first vector derivatives constituting tangent vectors at the endpoints of the sought segment s. P 1 , P 2 are the second vector derivatives constituting vectors of acceleration of a point tracing out the segment s and P 1 , P 2 are the third vector derivatives constituting vectors of jerk of a point tracing out the segment s. Obviously, the given conditions are sufficient in order to define the vector coefficients A i of the Formula (18). Let us express the first, the second, and the third derivatives of vector function p(t) We apply parameterization 0 ≤ t ≤ 1. In this case the values of the first four vector coefficients can be acquired The rest of the vector coefficients are determined through the equations that lead us to the system of four linear equations The values of coefficients A 5 , A 6 , A 7 and A 8 follow from the system of Equation (20) A 8 = 20(P 1 − P 2 ) + 10(P 1 + P 2 ) + 2(P 1 − P 2 ) + 1 6 (P 1 + P 2 ).
Let us transform the expressions (19) and (20) into the matrix form If we substitute the expressions of vector coefficients (21) into the Formula (18), we acquire the sought equation of a Hermite spline curve segment.

Construction of a Seventh-Degree Hermite Spline Curve of Two Segments and Generalization for the Case of (j − 1) Segments
Let us consider connection of two segments s 1 and s 2 (see Figure 13) given the same boundary conditions as for the case of one segment s previously considered in Section 3.4. Parameterization of segments is fulfilled in ranges t 1 ≤ t ≤ t 2 and t 2 ≤ t ≤ t 3 for respective segments s 1 and s 2 . Without loss of generality, we accept that t 1 = 0 at the initial point of segment s 1 and t 2 = 0 at the initial point of segment s 2 . Let us express the polynomial equation of the segments in the following form: Let us express the derivatives of vector function p k (t) For k = 2 at the initial point 2 2 ( 0) P t = of segment 2 s we acquire . The re- For k =1 at the initial point P 1 (t 1 = 0) of segment s 1 we acquire (1)

. (22)
At the final point P 2 (t 2 ) of segment s 1 we acquire For k = 2 at the initial point P 2 (t 2 = 0) of segment s 2 we acquire At the final point P 3 (t 3 ) of segment s 2 we acquire Thus, through (22), we acquire the expressions for the first four coefficients of the equation for the first segment s 1 : A (1) 8 are determined through the system of four linear equations The expressions of the first four vector coefficients of segment s 2 follow from (23): Vectors P 2 , P 2 , and P 2 at the knot P 2 of connection of segments s 1 and s 2 are unknown. These vectors are determined through the conditions of equality of fourth, fifth, and sixth derivatives of vector functions at the connection knot: p 1 (t = t 2 ) =p 2 (t = 0), or in expanded form

. (28)
Mathematics 2021, 9,47 18 of 29 The sought vectors P 2 , P 2 , and P 2 are determined through the system of linear Equations (25)-(27) taking into account the Equations (23) and (24) with parameterization 0 ≤ t ≤ 1 for segments s 1 and s 2 The matrix Formula (21) and Algorithm 2 allow us to generalize to the case of the formation of a smooth spline Hermite curve from (j − 1) segments.
In the generalized representation the matrix of vector coefficients A = [T] · G for the equations of (j − 1) segments of the Hermitian spline curve of the seventh-degree, connected by the smoothness C 6 , has the Formula (32).
In order to construct a spline curve, let us apply the matrix Formula (32) for the case (j − 1) = 3. In this case, the vector parameters of the geometric matrix G are determined through a uniquely solvable system of six linear equations in six unknowns. Figure 14 depicts visual rendering of the result of the calculation. It demonstrates the sought three segments and their subsequent connection with order of smoothness C 6 . 3. Determine the vector coefficients (2) i A in the segment equation 2 s based on matrix (21). In this case, the boundary conditions of the segment 2 s are the vector derivatives 2 P′ , 2 P ′′ , and 2 P ′′′ at the knot 2 P determined according to item 1 and the given vector derivatives 3 P′ , 3 P ′′ , and 3 P ′′′ at the knot 3 P . Figure 14. Initial data and the result of connection of three segments of a seventh-degree Hermite spline curve. Table 5 shows the calculation results from Example 5. Algorithm 2 For obtaining a spline curve with polynomial equations of the seventh degree of segments s 1 and s 2 has the following text form: 1.
Vector derivatives P 2 , P 2 , and P 2 at the joining point P 2 of segments s 1 and s 2 are determined based on the Formulas (29)-(31).

Determine the vector coefficients A
(1) i in the segment equation s 1 based on the matrix (20). In this case, the boundary conditions of the segment s 1 are the given vector derivatives P 1 , P 1 , and P 1 at the knot P 1 and the vector derivatives P 2 , P 2 , and P 2 at the knot P 2 determined according to item 1.

3.
Determine the vector coefficients A (2) i in the segment equation s 2 based on matrix (21). In this case, the boundary conditions of the segment s 2 are the vector derivatives P 2 , P 2 , and P 2 at the knot P 2 determined according to item 1 and the given vector derivatives P 3 , P 3 , and P 3 at the knot P 3 . Table 5 shows the calculation results from Example 5. Table 5. Curvature and torsion values at boundary points of the segments.

Segment
Segment Boundary Knot Point P j Curvature Value Torsion Value s 1 : p 1 (t) P 1 , t = 0 1.172603940 0.1818181818 P 2 , t = 1 0.02093508808 −0.09371726576 s 2 : p 2 (t) P 2 , t = 0 0.02093508808 −0.09371726576 The mathematical models of shaping of polynomial spline curves obtained in Sections 3.2-3.5 have scientific novelty and have not been considered in the scientific literature known to the authors.

Construction of a Bézier Spline Curve Segment Given Boundary Derivatives of the First and the Second Order
In works [1,12,13,15,18,21], the theoretical foundations of analytical and geometric models of formation of Bézier spline curves are presented. In this paper we propose the method of segmental shaping of these curves based on the same mathematical model as used for Hermite spline curves in Sections 3.1-3.3.
The points P 1 (x 1 , y 1 , z 1 ) and P 2 (x 2 , y 2 , z 2 ) as well as the respective boundary conditions P 1 , P 1 and P 2 , P 2 are given (see Figure 15). described by the formula [1,10,13] 1 0 where the set of functions forms the Bernstein basis. Let us express the first, the second, the third and the fourth derivatives of vector function ( ) p t Under the given conditions it is possible to construct a Bézier spline curve segment described by the formula [1,10,13] where the set of functions B n i (t) = n! i!(n−i)! t i (1 − t) n−i forms the Bernstein basis. Let us express the first, the second, the third and the fourth derivatives of vector function p(t) Vectors P 1 , P 2 are the first vector derivatives constituting tangent vectors at the endpoints of the sought segment s. Vectors P 1 , P 2 are the second vector derivatives constituting vectors of acceleration of a point tracing out the segment s. Vectors P 1 , P 2 are the third vector derivatives constituting vectors of jerk of a point tracing out the segment s. Vectors P 1 , P 2 are the fourth vector derivatives constituting vectors of snap of a point tracing out the segment s.
This allows us to acquire the values of the first three vector coefficients The three remaining vector coefficients are determined through the equations From the Equation (35) follows the system of three linear equations The expressions for coefficients A 4 , A 5 , and A 6 follow from the system of the Equation (36) The expressions (34) and (36) can be expressed in the matrix form with parameteriza-

Construction of a Fifth-Degree Bézier Spline Curve of Two Segments
Let us consider the connection of two segments of a fifth-degree Bézier spline curve (see Figure 16) given the same boundary conditions as for the case of one segment s previously considered in Section 3.6.
The expressions (34) and (36) can be expressed in the matrix form with parameterization

Construction of a Fifth-Degree Bézier Spline Curve of Two Segments
Let us consider the connection of two segments of a fifth-degree Bézier spline curve (see Figure 16) given the same boundary conditions as for the case of one segment s previously considered in Section 3.6. Let us express the equation of the segments in the following form: For k = 1 at the initial point 1 1 ( 0) P t = of segment 1 s we acquire (1) , For k = 2 at the initial point 2 2 ( 0) P t = of segment 2 s we acquire Let us express the equation of the segments in the following form: 5 and passes through knot points A (k) 6 = P k+1 . For k = 1 at the initial point P 1 (t 1 = 0) of segment s 1 we acquire Mathematics 2021, 9,47 22 of 29 For k = 1 at the final point P 2 (t 2 = 1) of segment s 1 we acquire For k = 2 at the initial point P 2 (t 2 = 0) of segment s 2 we acquire 3 ) At the final point P 3 (t 3 = 1) of segment s 2 we acquire It is required to determine eight vector coefficients corresponding to vectors of the four control points of each segment. At the initial point of segment s 1 and the final point of segment s 2 the following boundary conditions are given: P 1 , P 1 and P 3 , P 3 . Therefore, through (38), we acquire the expressions for the first three vector coefficients of the equation for the first segment s 1 : A (1)

, and A
(1) 6 are determined through the system of three linear equations 3 = 1 20 P 2 + P 2 + 2 5 P 2 . The remaining vector coefficients A In the connection of segments s 1 and s 2 at the point P 2 with smoothness C 4 , vectors P 2 and P 2 are unknown. These vectors are determined through the condition of equality of the third and the fourth derivatives of vector functions of the segments at the connection point: and p 1 (t = 1) =p 2 (t = 0) , or in expanded form The sought vectors P 2 and P 2 are determined through the system of two linear Equations (43) and (44) taking into account the system of Equations (39)-(42) The Equations (44) and (45) in calculation of the unknown vector derivatives P 2 and P 2 at the point of connection of fifth-degree Bézier spline curve segments s 1 and s 2 match the corresponding Equations (9) and (10) of the unknown vector derivatives P 2 and P 2 at the point of connection of fifth-degree Hermite spline curve segments s 1 and s 2 . In this case, in the Formulas (9) and (10), the coefficients k r (t), n r (t), r = 1, . . . , 7; α, β take values according to (11) for 0 ≤ t ≤ 1.
This allows us to speak of universality of the proposed algorithm of determination of the unknown vector derivatives in the tasks of formation of various polynomial curves. Thus, the vector derivatives P 2 and P 2 at the points of connection of fifth-degree Bézier spline curve segments are determined through the Equations (9) and (10) Example 6. The following conditions for the three segments are given: P 1 (0, 50, 0), P 2 (150, 100, 50), P 3 (250, 200, 60), P 4 (300, 300, 0), P 1 (−50, 100, 1), P 4 (301, −210, −1), P 1 (50, −100, 2), P 4 (280, −280, 1). It is required to construct a Bézier spline curve of these segments. The unknown vector derivatives P 2 , P 2 , P 3 and P 3 at the points of connection of the segments are calculated as in the case of a smooth connection of three segments for a Hermite spline curve of the fifth degree consisting of three segments (see Example 1). The unknown vector coefficients   Table 6 lists the values of curvature and torsion at the boundary points j P of the connected segments, where j = 1, …, 4.  The unknown vector derivatives j P′ and j P′′ , j = 1,…,5 are determined through the matrix form of the generalized system of Equation (17). This is due to the fact that the calculation of the unknown vector derivatives j P′ and j P′′ at the connection points of Hermite and Bézier spline segments are formally identical.
The unknown vector derivatives P j and P j , j = 1, . . . ,5 are determined through the matrix form of the generalized system of Equation (17). This is due to the fact that the calculation of the unknown vector derivatives P j and P j at the connection points of Hermite and Bézier spline segments are formally identical.
The system of equations for the unknown vector derivatives for the current example is of the following matrix form: P P P P P P P P P P P P P P P P P P P P P P P P P  Figure 18 and Table 7 present the results of the construction of a closed fifth-degree Bézier spline curve of five segments.   i , i = 1, . . . , 6. Figure 18 and Table 7 present the results of the construction of a closed fifth-degree Bézier spline curve of five segments. P P P P P P P P P P P P P P P P P P P P P P P P P  Figure 18 and Table 7 present the results of the construction of a closed fifth-degree Bézier spline curve of five segments.    The mathematical models of shaping of Bézier spline curves obtained in Sections 3.6 and 3.7 also have scientific novelty. These models were not previously considered in the scientific literature on computational geometry known to the authors.
The considered examples were tested using the software package of the Waterloo Maple computer mathematics system-Maple 2020 Free Trial. Access to the computer code for the examples No.1-No.7 considered in the work is possible by the link: https://www.mapleprimes.com/posts/213421-Spline-Curves-Formation-Given-Extreme-Derivatives?sp=213421.

Discussion
The mathematical models of formation of various polynomial spline curves considered in Section 3 determine the computational algorithms of formation. These algorithms are validated on numerous examples provided in Section 3. The uniformity and systematic nature of the algorithms allows us to present them in the form of a general algorithm of spline curve formation (see Figure 19). The mathematical models of shaping of Bézier spline curves obtained in Sections 3.6 and 3.7 also have scientific novelty. These models were not previously considered in the scientific literature on computational geometry known to the authors.
The considered examples were tested using the software package of the Waterloo Maple computer mathematics system-Maple 2020 Free Trial. Access to the computer code for the examples No.1-No.7 considered in the work is possible by the link: https://www.mapleprimes.com/posts/213421-Spline-Curves-Formation-Given-Extreme-Derivatives?sp=213421.

Discussion
The mathematical models of formation of various polynomial spline curves considered in Section 3 determine the computational algorithms of formation. These algorithms are validated on numerous examples provided in Section 3. The uniformity and systematic nature of the algorithms allows us to present them in the form of a general algorithm of spline curve formation (see Figure 19).  Module 2: Determination of order 2 1 n m = + of the polynomial. Module 3: Conditional step: check whether the curve is closed. The curve is considered closed if the vectors of extreme derivatives at points 1 P and j P are not given as the initial conditions. Module 4: Formation of a matrix of size (( ) ( )) N j N j − × − for the unknown vector derivatives at connection points of a closed spline curve, where N represents the total number of conditions. Module 5: Formation of a matrix of size (( (2 )) ( (2 ))) N m j N m j − + × − + for the unknown vector derivatives at connection points of a non-closed spline curve, where N represents the total number of conditions. Module 6: Calculation of vector derivatives at segment connection points. Module 7: Calculation of polynomial vector coefficients for each spline curve segment.
Module 8: Acquiring the vector equations of spline curve segments. Aside from uniformity, the proposed algorithms are to a certain extent universal and can be applied in solutions to the problems of formation of polynomial spline curves of various types generated through Hermite splines, Bézier splines, B-splines. It has to be mentioned that the Gauss-Jordan method has time complexity  This general algorithm allows us to perform calculation of vector derivatives at points of connection of segments forming a spline curve as well as vector coefficients of polynomials. The algorithm consists of modules providing the following functions: Module 1: Initial conditions input. The initial conditions for spline curve formation include: the number of points of discrete array j; the vectors of discrete array of points P 1 , . . . , P j ; the number of pairs of extreme derivatives m; the vectors of extreme derivatives P 1 , P 1 , P 1 . . . at point P 1 ; the vectors of extreme derivatives P j , P j , P j . . . at point P j .
Module 2: Determination of order n = 2m + 1 of the polynomial. Module 3: Conditional step: check whether the curve is closed. The curve is considered closed if the vectors of extreme derivatives at points P 1 and P j are not given as the initial conditions. Module 4: Formation of a matrix of size ((N − j) × (N − j)) for the unknown vector derivatives at connection points of a closed spline curve, where N represents the total number of conditions. Module 5: Formation of a matrix of size ((N − (2m + j)) × (N − (2m + j))) for the unknown vector derivatives at connection points of a non-closed spline curve, where N represents the total number of conditions. Module 6: Calculation of vector derivatives at segment connection points. Module 7: Calculation of polynomial vector coefficients for each spline curve segment. Module 8: Acquiring the vector equations of spline curve segments. Aside from uniformity, the proposed algorithms are to a certain extent universal and can be applied in solutions to the problems of formation of polynomial spline curves of various types generated through Hermite splines, Bézier splines, B-splines. It has to be mentioned that the Gauss-Jordan method has time complexity O(i 3 + (log p)i), where p is the size of the initial data for solution of a system of i equations in i unknown. These systems are present in every computational algorithm proposed in Section 3.
Analysis of Algorithms 1-3 (Section 3.2, Section 3.5, and Section 3.7, respectively), analysis of matrices for the formation of vector coefficients in the equations of segments of formed spline curves (Sections 3.1-3.7) and analysis of the set of considered numerical examples (examples 1-7, Tables 1-7) allow us to conclude about the scalability of our proposed method of forming spline curves. The scalability of the method is reduced to the obvious scalability of the matrices of vector coefficients of the segment equations, the connection of which, according to a given degree of smoothness, forms a certain spline curve.
The accuracy of the obtained computational results depends on the specified computation accuracy of scalar invariants at the segments junction point and does not depend on the scalability of the proposed computation method. The examples discussed in the work (electronic link on Page 27) support this thesis. For a given accuracy of calculations (100 decimal places) of an open spline of the Hermite curve of the fifth degree, the resulting absolute calculation error is from 10 −99 to 10 −94 . As an example, the formation of a spline curve consisting of 100 knots is considered. In this case, the obtained absolute error in calculating the curvature at the segments joining knots is as follows: knot P 2 : 5.31 · 10 −99 ,..., knot P 50 : 2.4 · 10 −99 ,..., knot P 99 : 3.0 · 10 −100 . The obtained absolute error in the calculation of the torsion at the knots of joining the segments is as follows: knot P 2 : 9.59 · 10 −94 , . . . , knot P 50 : 1.05 · 10 −97 , . . . , knot P 99 : 1.73 · 10 −97 . The accuracy of calculating scalar invariants can be quite high, depending on practical feasibility, as well as on the capabilities of the computer hardware.