Although the quartic Catmull–Rom spline has shape adjustability because of the free parameters, it should be noted that the shape of the spline can be unsatisfactory if the free parameters are not appropriately selected; see Fig. 3.
In addition, sometimes people may need to determine the free parameters to make the shape of the quartic Catmull–Rom spline meet some specific requirements. Hence, we need to give schemes for optimizing the free parameters according to some objectives. Since the internal energy, the quadratic oscillation in average, and the derivative oscillation have been successfully used to optimize the shape of some parametric curves, we adopt them to optimize the shape of the quartic Catmull–Rom spline and present the schemes in this section.
The spline with minimal internal energy
Three types of commonly used internal energy of a curve are stretch energy, strain energy (also called bending energy), and curvature variation energy (often replaced by Jerk’s energy). For a parametric curve \(\boldsymbol{b}(t)\), its stretch energy, strain energy, and Jerk’s energy are usually approximately described by \(\int _{0}^{1} \Vert \boldsymbol{b'}(t) \Vert ^{2} \,\mathrm{d}t\), \(\int _{0}^{1} \Vert \boldsymbol{b''}(t) \Vert ^{2} \,\mathrm{d}t\), and \(\int _{0}^{1} \Vert \boldsymbol{b'''}(t) \Vert ^{2} \,\mathrm{d}t\), respectively; see [6, 7]. Because the free parameter of each quartic Catmull–Rom spline segment is local, we only need to consider the internal energy of each spline segment but not that of the whole spline. We can approximately express the three internal energies of each quartic Catmull–Rom spline segment as
$$\begin{aligned} E_{i,k}: = \int _{0}^{1} \biggl\Vert \frac{\mathrm{d}^{k}\boldsymbol{R}_{i}(\alpha _{i};t)}{\mathrm{d}t^{k}} \biggr\Vert ^{2} \,\mathrm{d}t \end{aligned}$$
(9)
for any \(\alpha _{i}\), where \(k = 1,2,3\).
From Eqs. (5) and (6) we have
$$\begin{aligned} \boldsymbol{R}_{i}(\alpha;t) = \boldsymbol{r}_{i}(t)\alpha _{i} + \boldsymbol{s}_{i}(t), \end{aligned}$$
(10)
where
$$\begin{aligned} &\boldsymbol{r}_{i}(t): = \frac{1}{2} \bigl( - t(1 - t)^{2}\boldsymbol{q}_{i} + (1 - t) \bigl(2 + 2t - 3t^{2}\bigr)\boldsymbol{q}_{i + 1} + t\bigl(1 + 4t - 3t^{2}\bigr)\boldsymbol{q}_{i + 2} - (1 - t)t^{2} \boldsymbol{q}_{i + 3} \bigr),\\ &\boldsymbol{s}_{i}(t): = t^{2}(1 - t)^{2}( \boldsymbol{q}_{i} - \boldsymbol{q}_{i + 1} - \boldsymbol{q}_{i + 2} + \boldsymbol{q}_{i + 3}). \end{aligned}$$
By substituting Eq. (10) into Eq. (9), we have
$$\begin{aligned} E_{i,k} &= \int _{0}^{1} \bigl\Vert \boldsymbol{r}_{i}^{(k)}(t) \alpha _{i} + \boldsymbol{s}_{i}^{(k)}(t) \bigr\Vert ^{2} \,\mathrm{d}t \\ &= \alpha _{i}^{2} \int _{0}^{1} \bigl\Vert \boldsymbol{r}_{i}^{(k)}(t) \bigr\Vert ^{2} \,\mathrm{d}t + 2\alpha _{i} \int _{0}^{1} \bigl( \boldsymbol{r}_{i}^{(k)}(t) \cdot \boldsymbol{s}_{i}^{(k)}(t) \bigr) \,\mathrm{d}t + \int _{0}^{1} \bigl\Vert \boldsymbol{s}_{i}^{(k)}(t) \bigr\Vert ^{2} \,\mathrm{d}t. \end{aligned}$$
(11)
It is clear that only \(\alpha _{i}\) is a variable to be determined in Eq. (11). Hence, we can get the following model for constructing the quartic Catmull–Rom spline segment with minimal internal energy:
$$\begin{aligned} \min_{\alpha _{i} \in R} \quad E_{i,k}(\alpha _{i}) , \end{aligned}$$
(12)
where \(k = 1,2,3\). Then we can get the following theorem.
Theorem 3
To construct the quartic Catmull–Rom spline segment with minimal internal energy, the free parameter of each spline segment should be taken as
$$\begin{aligned} \alpha _{i} = - \frac{\int _{0}^{1} ( \boldsymbol{r}_{i}^{(k)}(t) \cdot \boldsymbol{s}_{i}^{(k)}(t) ) \,\mathrm{d}t}{\int _{0}^{1} \Vert \boldsymbol{r}_{i}^{(k)}(t) \Vert ^{2} \,\mathrm{d}t}. \end{aligned}$$
(13)
Proof
From Eq. (11) we have
$$\begin{aligned} \frac{\mathrm{d}E_{i,k}(\alpha _{i})}{\mathrm{d}\alpha _{i}} = 2\alpha _{i} \int _{0}^{1} \bigl\Vert \boldsymbol{r}_{i}^{(k)}(t) \bigr\Vert ^{2} \,\mathrm{d}t + 2 \int _{0}^{1} \bigl( \boldsymbol{r}_{i}^{(k)}(t) \cdot \boldsymbol{s}_{i}^{(k)}(t) \bigr) \,\mathrm{d}t. \end{aligned}$$
(14)
To obtain the quartic Catmull–Rom spline segment with minimal internal energy, there should be \(\frac{\mathrm{d}E_{i,k}(\alpha _{i})}{\mathrm{d}\alpha _{i}} = 0\). Since the control points are different, \(\int _{0}^{1} \Vert \boldsymbol{r}_{i}^{(k)}(t) \Vert ^{2} \,\mathrm{d}t \ne 0\) always holds. Then we can get Eq. (13) from Eq. (14). Since the solution of \(\frac{\mathrm{d}E_{i,k}(\alpha _{i})}{\mathrm{d}\alpha _{i}} = 0\) is unique, Eq. (13) must be the global minimum of Eq. (12). □
After determining the free parameter of each spline segment by Eq. (13), we can generate the whole quartic Catmull–Rom spline with minimal internal energy. However, we find that \(\int _{0}^{1} ( \boldsymbol{r}_{i}^{(k)}(t) \cdot \boldsymbol{s}_{i}^{(k)}(t) ) \,\mathrm{d}t \equiv 0\) (\(k = 2,3\)), then the free parameter calculated by Eq. (13) is \(\alpha _{i} = 0\). This means the quartic Catmull–Rom spline with minimal strain energy or Jerk’s energy is exactly the cubic Catmull–Rom spline. Figure 4 shows curves generated by the quartic Catmull–Rom splines with minimal internal energy.
The shape-preserving spline
Let \(\boldsymbol{L}(t): = \boldsymbol{L}_{i}(t) = (1 - t)\boldsymbol{d}_{i} + t\boldsymbol{d}_{i + 1}\), where \(\boldsymbol{d}_{i}\) (\(i = 0,1, \ldots,n\)) are data points in the plane, then \(\boldsymbol{L}(t)\) can be regarded as the simplest shape-preserving interpolation. Based on this, quadratic oscillation in average minimization has been used to construct shape-preserving interpolation; see [17, 18]. Here, we adopt the quadratic oscillation in average minimization to construct the shape-preserving quartic Catmull–Rom spline.
Recall that the quartic Catmull–Rom spline segment \(\boldsymbol{R}_{i}(\alpha _{i};t)\) interpolates at \(\boldsymbol{q}_{i + 1}\) and \(\boldsymbol{q}_{i + 2}\), and the value of the free parameter \(\alpha _{i}\) has an influence on the approximation of \(\boldsymbol{R}_{i}(\alpha _{i};t)\) to \(\boldsymbol{Q}_{i}(t)\), where \(\boldsymbol{Q}_{i}(t): = (1 - t)\boldsymbol{q}_{i + 1} + t\boldsymbol{q}_{i + 2}\); see Fig. 5.
Thereby, we can get the following model:
$$\begin{aligned} \min_{\alpha _{i} \in R} \quad I_{i}(\alpha _{i}) = \int _{0}^{1} \bigl\Vert \boldsymbol{R}_{i}( \alpha _{i};t) - \boldsymbol{Q}_{i}(t) \bigr\Vert ^{2}\,\mathrm{d}t, \end{aligned}$$
(15)
where \(\boldsymbol{Q}_{i}(t): = (1 - t)\boldsymbol{q}_{i + 1} + t\boldsymbol{q}_{i + 2}\), \(i = 0,1, \ldots,n - 3\). Then we can obtain the theorem as follows.
Theorem 4
To construct the shape-preserving quartic Catmull–Rom spline, the free parameter of each spline segment should be taken as
$$\begin{aligned} \alpha _{i} = - \frac{\int _{0}^{1} ( \boldsymbol{r}_{i}(t) \cdot ( \boldsymbol{s}_{i}(t) - \boldsymbol{Q}_{i}(t) ) ) \,\mathrm{d}t}{\int _{0}^{1} \Vert \boldsymbol{r}_{i}(t) \Vert ^{2} \,\mathrm{d}t}. \end{aligned}$$
(16)
Proof
By Eq. (10) we have
$$\begin{aligned} I_{i}(\alpha _{i}) ={}& \int _{0}^{1} \bigl\Vert \boldsymbol{r}_{i}(t) \alpha _{i} + \boldsymbol{s}_{i}(t) - \boldsymbol{Q}_{i}(t) \bigr\Vert ^{2}\,\mathrm{d}t \\ ={}& \alpha _{i}^{2} \int _{0}^{1} \bigl\Vert \boldsymbol{r}_{i}(t) \bigr\Vert ^{2} \,\mathrm{d}t + 2\alpha _{i} \int _{0}^{1} \bigl( \boldsymbol{r}_{i}(t) \cdot \bigl( \boldsymbol{s}_{i}(t) - \boldsymbol{Q}_{i}(t) \bigr) \bigr) \,\mathrm{d}t \\ &{}+ \int _{0}^{1} \bigl\Vert \boldsymbol{s}_{i}(t) - \boldsymbol{Q}_{i}(t) \bigr\Vert ^{2} \,\mathrm{d}t. \end{aligned}$$
(17)
From Eq. (17) we have
$$\begin{aligned} \frac{\mathrm{d}I_{i}(\alpha _{i})}{\mathrm{d}\alpha _{i}} = 2\alpha _{i} \int _{0}^{1} \bigl\Vert \boldsymbol{r}_{i}(t) \bigr\Vert ^{2} \,\mathrm{d}t + 2 \int _{0}^{1} \bigl( \boldsymbol{r}_{i}(t) \cdot \bigl( \boldsymbol{s}_{i}(t) - \boldsymbol{Q}_{i}(t) \bigr) \bigr) \,\mathrm{d}t. \end{aligned}$$
(18)
To make the quartic Catmull–Rom spline shape-preserving, there should be \(\frac{\mathrm{d}I_{i}(\alpha _{i})}{\mathrm{d}\alpha _{i}} = 0\), \(i = 0,1, \ldots,n - 3\). Since the control points are different, \(\int _{0}^{1} \Vert \boldsymbol{r}_{i}(t) \Vert ^{2} \,\mathrm{d}t \ne 0\) always holds. Then we can get Eq. (16) from Eq. (18). Since the solution of \(\frac{\mathrm{d}I_{i}(\alpha _{i})}{\mathrm{d}\alpha _{i}} = 0\) is unique, Eq. (16) must be the global minimum of Eq. (15). □
After determining the free parameter of each spline segment by Eq. (16), we can generate the whole shape-preserving quartic Catmull–Rom spline. Figure 6 shows the cubic Catmull–Rom spline and the shape-preserving quartic Catmull–Rom spline interpolating the following data:
$$\begin{aligned} &(\mathrm{a})\quad x = 0.5, 0.5, 3.5, 6.0, 8.5, 11, 14, 17, 20, 20,\\ &\hphantom{(\mathrm{a})\quad} y = 93, 93, 104, 120, 98, 86, 102, 81, 90, 90, \\ &(\mathrm{b})\quad x = 0, 0, 0.5, 1.5, 3, 4, 7, 8, 8,\qquad y = x\sin x. \end{aligned}$$
We can see from Fig. 6 that the shape-preserving quartic Catmull–Rom spline is closer to the control polygon than the cubic Catmull–Rom spline.
The monotonicity-preserving spline
Given a set of monotonic data points \(\boldsymbol{d}_{i}\) (\(i = 0,1, \ldots,n\)) in the plane, it can be seen that \(\boldsymbol{L'}_{i}(t) = \boldsymbol{d}_{i + 2} - \boldsymbol{d}_{i + 1}\) (\(i = 0,1, \ldots,n - 3\)) reflect the monotonicity of data points. Hence, the derivative oscillation minimization has been considered an effective way to construct monotonicity-preserving interpolation; see [19]. Here, we use the derivative oscillation minimization to construct the monotonicity-preserving quartic Catmull–Rom spline. Then we can get the following model:
$$\begin{aligned} \min_{\alpha _{i} \in R} \quad J_{i}(\alpha _{i}) = \int _{0}^{1} \bigl\Vert \boldsymbol{R'}_{i}( \alpha _{i};t) - \boldsymbol{Q'}_{i}(t) \bigr\Vert ^{2}\,\mathrm{d}t, \end{aligned}$$
(19)
where \(\boldsymbol{Q'}_{i}(t): = \boldsymbol{q}_{i + 2} - \boldsymbol{q}_{i + 1}\), \(i = 0,1, \ldots,n - 3\), \(\boldsymbol{R'}_{i}(\alpha _{i};t)\) represents the derivative of \(\boldsymbol{R}_{i}(\alpha _{i};t)\) about t. Referring to Theorem 4, we give the following theorem without proof.
Theorem 5
To construct the monotonicity-preserving quartic Catmull–Rom spline, the free parameter of each spline segment should be taken as
$$\begin{aligned} \alpha _{i} = - \frac{\int _{0}^{1} ( \boldsymbol{r'}_{i}(t) \cdot ( \boldsymbol{s'}_{i}(t) - \boldsymbol{Q'}_{i}(t) ) ) \,\mathrm{d}t}{\int _{0}^{1} \Vert \boldsymbol{r'}_{i}(t) \Vert ^{2} \,\mathrm{d}t}. \end{aligned}$$
(20)
After determining the free parameter of each spline segment by Eq. (20), we can generate the whole monotonicity-preserving quartic Catmull–Rom spline. Figure 7shows the cubic Catmull–Rom spline and the monotonicity-preserving quartic Catmull–Rom spline interpolating the following monotone data:
$$\begin{aligned} &(\mathrm{a})\quad x = - 3, - 3, - 1, 0, 3, 5, 6, 6,\qquad y = - 3, - 3, - 2, 0, 1, 2, 4, 4, \\ &(\mathrm{b})\quad x = 0.1, 0.1, 0.2, 0.6, 1.0, 1.2, 1.4, 1.4,\qquad y = 1 / x^{2}. \end{aligned}$$
Figure 7 shows that the monotonicity-preserving quartic Catmull–Rom spline is better than the cubic Catmull–Rom spline when approximating the monotone data.