conditions on control points for continuous curvature
continuity of derivatives
I defined Bézier curves by
$$
\mathbf B_i(t) = (1-t)^3 \mathbf K_{i} +
3(1-t)^2t \mathbf P_{1,i} +
3(1-t)t^2 \mathbf P_{2,i} +
t^3 \mathbf K_{i+1} , \quad t\in [0,1], i \in \{ 0, \dots, n-1\}
$$
For a closed curve, \(\mathbf K_n =K_0 \) and there are \(n\) independent knots. For an open curve, there are \(n+1\) knots.
open curve
I choose to statisfy
$$
\begin{align}
{ w_{i} \over w_{i-1} } \mathbf B_{i-1}'(1) &= \mathbf B_{i}'(0) \\
\left( w_{i} \over w_{i-1} \right)^2 \mathbf B_{i-1}''(1)&= \mathbf B_{i}''(0)
&\quad i \in \{ 1, \dots, n-1\}
\\
\mathbf{B}”_0(0)&=0 \\
\mathbf{B}”_{n-1}(1)&=0
\end{align}
$$
with
$$
w_{i} =
{ \lVert \mathbf{K}_{i} - \mathbf{K}_{i+1} \rVert } \quad i \in \{ 0, \dots, n-1\}\\
$$
which leads to
$$
{ (- \mathbf P_{2,i-1} + \mathbf K_{i} )\over w_{i-1}} =
{ {\mathbf B_{i-1}'(1) \over 3w_{i-1}} }=
{{ \mathbf B_{i}'(0) \over 3w_{i}} }
= {(- \mathbf K_{i} + \mathbf P_{1,i} )\over w_{i}} \quad\quad\quad i \in \{ 1, \dots, n-1\}\quad (5)
$$
and to
$$
{( \mathbf P_{1,i-1} - 2 \mathbf P_{2,i-1} + \mathbf K_{i}) \over w_{i-1}^2} =
{ \mathbf B_{i-1}''(1)\over 6w_{i-1}^2} =
{\mathbf B_i''(0) \over 6w_{i}^2} =
{( \mathbf K_i - 2 \mathbf P_{1,i} + \mathbf P_{2,i} ) \over w_{i}^2}
\quad\quad\quad i \in \{ 1, \dots, n-1\}\quad (6)
$$
Using equation (5), we can substitute \(\mathbf P_{2,i}\) and \( \mathbf P_{2,i-1} = (1+w_{i-1}/w_{i})\mathbf K_i - w_{i-1}/w_{i} \mathbf P_{1,i}\) in equation (6), and obtain:
$$
\mathbf P_{1,i-1} + 2\left( {w_{i-1} \over w_{i}} + \left({w_{i-1} \over w_{i}}\right)^2\right) \mathbf P_{1,i}+
\left({w_{i-1} \over w_{i}}\right)^2 {w_{i}\over w_{i+1}} \mathbf P_{1,i+1} \\
=
\left( {w_{i-1} \over w_{i}}+1\right)^2 \mathbf K_{i} +
\left({w_{i-1} \over w_{i}}\right)^2 \left(1+{w_{i}\over w_{i+1}} \right) \mathbf K_{i+1}
\quad i \in \{ 1, \dots, n-1\}
\quad\quad\quad (7)
$$
The condition
\( \mathbf{B}”_0(0)=0 \) leads to
$$
0 = {\mathbf B_0''(0) \over 6 }= \mathbf K_0 - 2 \mathbf P_{1,0} + \mathbf P_{2,0} =
\mathbf K_0 - 2 \mathbf P_{1,0} + \mathbf K_1 \left(1+ {w_{0} \over w_{1}} \right) - { w_{0} \over w_{1} } \mathbf P_{1,1}
\quad\quad\quad (8)
$$
So far, I have eliminated \(\mathbf P_{2,i}\) for \(i \in \{0,1,...,n-2\}\).
If I choose
$$ w_{n} > 0
$$
(for example, \( w_n = w_{n-1} \)), I can define \( \mathbf P_{1,n} \) by
$$
\begin{align}
{{- \mathbf P_{2,n-1} + \mathbf K_n } \over w_{n-1}}&= {{\mathbf P_{1,n} - \mathbf K_n } \over w_{n}} \\
\end{align}
$$
\(\mathbf P_{1,n}\) is never used as a control point (the last spline is between \(\mathbf K_{n-1} \) and \(\mathbf K_{n} \) ) but
I find convenient to replace \( \mathbf P_{2,n-1}\) by \( \mathbf P_{1,n} \).
So I can write
$$
0 = {\mathbf{B}”_{n-1}(1) \over 6}=
\mathbf P_{1,n-1} - 2 \mathbf P_{2,n-1} + \mathbf K_n
= \mathbf P_{1,n-1} - \left(1 +2{w_{n-1}\over w_{n}} \right) \mathbf K_n + 2{w_{n-1}\over w_{n}} \mathbf P_{1,n}
\quad\quad\quad (9)
$$
These equations can be put in a 3-diagonal matrix.
The equation can then be solved by Gaussian elimination.
Because only the entries on 3 diagonals are non-zero, the system can be solved in an algorithm of order n in stead of n2. (Thomas algorithm).
closed loop
For a spline that forms a loop through \(n\) knots \(\mathbf K_i \) with \(i \in \{0,1,\dots,n-1\}\), we replace equations \((8)\) and \((9)\) by
$$
{ (- \mathbf P_{2,n-1} + \mathbf K_{0} )\over w_{n-1}} =
{ {\mathbf B_{n-1}'(1) \over 3w_{n-1}} }=
{{ \mathbf B_{0}'(0) \over 3w_{0}} }
= {(- \mathbf K_{0} + \mathbf P_{1,0} )\over w_{0}}
\quad\quad\quad (10)
$$
and
$$
{( \mathbf P_{1,n-1} - 2 \mathbf P_{2,n-1} + \mathbf K_{0}) \over w_{n-1}^2} =
{ \mathbf B_{n-1}''(1)\over 6w_{n-1}^2} =
{\mathbf B_{0}''(0) \over 6w_{0}^2} =
{( \mathbf K_0 - 2 \mathbf P_{1,0} + \mathbf P_{2,0} ) \over w_{0}^2}
\quad\quad\quad (11)
$$
Equation \((10)\) can be written as \(\mathbf P_{2,n-1}= (1+w_{n-1}/w_{0})\mathbf K_0 - w_{n-1}/w_{0} \mathbf P_{1,1}\).
\(\mathbf P_{2,0}\) can be found from equation \((5)\).
Substituting for \(\mathbf P_{2,n-1}\) and \(\mathbf P_{2,0}\) in equation \((11)\), we obtain
$$
\mathbf P_{1,n-1} + 2\left( {w_{n-1} \over w_{0}} + \left({w_{n-1} \over w_{0}}\right)^2\right) \mathbf P_{1,0}+
\left({w_{n-1} \over w_{0}}\right)^2 {w_{0}\over w_{1}} \mathbf P_{1,1} \\
=
\left( {w_{n-1} \over w_{0}}+1\right)^2 \mathbf K_{0} +
\left({w_{n-1} \over w_{0}}\right)^2 \left(1+{w_{0}\over w_{1}} \right) \mathbf K_{1}
\quad\quad\quad (12)
$$
Equations \((7)\) and \((12)\) can be combined in a matrix equation. The matrix will have entries on 3 diagonals and in the corners.
This equation can be solved by an algorithm of order n.
Previous
Next