<p>Quoting the comments above for context:</p>
<blockquote>
<p>Just to confirm, are you asking, given a set of <span class="math-container">$N$</span> CatRom control points,
<span class="math-container">$$\{CR_0, CR_1, CR_2, CR_3 ... CR_{n-1}\}$$</span>
forming a piecewise curve, what is the equivalent <span class="math-container">$N$</span> points, <span class="math-container">$$\{B_0,B_1,B_2...B_{n-1}\}$$</span> for a matching piecewise uniform cubic bspline?</p>
</blockquote>
<blockquote>
<p><em>Exactly. That is what I'm looking for. I think conversion to cubic bezier's are easy. But I would like to know if this is even possible/doable with bsplines</em></p>
</blockquote>
<p>I think it's a bit complicated: Using the approach you described above, i.e. <span class="math-container">$$ V_{targetformat} = M_{targetformat}^{-1} . M_{sourceformat}.V_{sourceformat}$$</span>
you can easily go from a sequence of <span class="math-container">$n$</span> control points of Catmull-Rom to  <span class="math-container">$(n-3)$</span> <em>sets</em> of 4 Uniform BSpline control points, i.e. a <em>total</em> of <span class="math-container">$4n-12$</span> control points , but I can't see that this will allow you to stitch them together to obtain just <span class="math-container">$n$</span> points...</p>
<p><em>Assuming</em> I've got the correct matrices for the 'typical' Catmull-Rom,
<span class="math-container">$$M_{CR}=\frac{1}{2}\begin{bmatrix} 
-1 &amp; 3 &amp; -3 &amp; 1\\
2 &amp; -5 &amp; 4 &amp; -1 \\
-1 &amp; 0 &amp; 1 &amp; 0 \\
0 &amp; 2 &amp; 0 &amp; 0\\
 \end{bmatrix}$$</span>
and uniform B-Spline:
<span class="math-container">$$M_{UB}=\frac{1}{6}\begin{bmatrix} 
-1 &amp; 3 &amp; -3 &amp; 1\\
3 &amp; -6 &amp; 3 &amp; 0 \\
-3 &amp; 0 &amp; 3 &amp; 0 \\
1 &amp; 4 &amp; 1 &amp; 0\\
 \end{bmatrix}$$</span>
then <span class="math-container">$M^{-1}_{UB}.M_{CR}$</span> should be <br/>
<em>[UPDATE: Fixed errors in coefficents]</em>
<span class="math-container">$$\frac{1}{6}\begin{bmatrix} 
7 &amp; -4 &amp; 5 &amp; -2\\
-2 &amp; 11 &amp; -4 &amp; 1 \\
1 &amp; -4 &amp; 11 &amp; -2 \\
-4 &amp; 13 &amp; -26 &amp; 11\\
 \end{bmatrix}$$</span></p>
<p>It seems to me that, in any batch of four points, every output vertex thus depends on <em>every</em> input vertex, so it seems the neighbouring points can't be shared.</p>
<p>Having said this, I think perhaps there <em>might</em> be a way of getting an <em>approximate</em> solution (but I've not tried rendering it myself to check it so take with a grain of salt)</p>
<p>We know that a Catmull-Rom spline defined by <span class="math-container">$(CR_A, CR_B, CR_C, CR_D)$</span>, passes through <span class="math-container">$CR_B$</span> and <span class="math-container">$CR_C$</span> at t=0 and t=1 respectively.</p>
<p>Similarly, using <span class="math-container">$\begin{bmatrix}t^3 &amp; t^2 &amp; t &amp; 1\end{bmatrix}.M_{UB}$</span>, we should see that at t=0 and t=1, a B-spline passes through <span class="math-container">$\frac{B_A + 4 B_B + B_C}{6}$</span> and <span class="math-container">$\frac{B_B + 4 B_C + B_D}{6}$</span>.</p>
<p>First consider trying to go from BSpline to CR. If we had a 'loop' formed by N control points one would map from BSpline to CR with...
<span class="math-container">$$\begin{bmatrix}CR_0\\CR_1\\ ...\\CR_{n-1} \end{bmatrix} = M_{NxBtoCR}.\begin{bmatrix}B_0\\B_1\\ ...\\B_{n-1} \end{bmatrix}$$</span>
where
<span class="math-container">$$
M_{NxBtoCR}= \frac{1}{6}.\begin{bmatrix}
4 &amp; 1 &amp; 0 &amp; 0 &amp; ... &amp; 0 &amp; 1\\
1 &amp; 4 &amp; 1 &amp; 0 &amp; ... &amp; 0 &amp; 0\\
0 &amp; 1 &amp; 4 &amp; 1 &amp; ... &amp; 0 &amp; 0\\
: &amp; : &amp;   &amp;   &amp; ... &amp; : &amp; :\\
1 &amp; 0 &amp; 0 &amp; 0 &amp; ... &amp; 1 &amp; 4\\
\end{bmatrix}
$$</span>
If we invert that matrix to get <span class="math-container">$M_{NxBtoCR}^{-1}$</span>, one should then be able to map the other way.</p>
<p>Using a maths package such as Maple, one finds that each row of <span class="math-container">$M_{NxBtoCR}^{-1}$</span> consists of the same set of values, all non-zero, which are progressively offset in each row. If we ignore the smaller terms, it suggests that <span class="math-container">$$B_i \approx 1.732 CR_i -0.464 (CR_{i-1}+CR_{i+1}) + 0.1243 (CR_{i-2}+CR_{i+2}) - 0.033(CR_{i-3}+CR_{i+3}) $$</span></p>
<p>There's probably some nice algebraic expression for this but I hope this might &quot;do the trick&quot;.</p>
<p><em>Update</em> Those weights don't <em>quite</em> sum to 1.0 - you'll need to normalise them slightly.</p>
<p>Obviously, this has assumed the curve is a loop. It's probably possible to adjust the weights for the end points but I'll leave that as an exercise for the reader.</p>

CC BY-SA 4.0
2020-12-02T03:03:32.287Z
Correcting M−1UB.MCR I've tested the matrices using renderings, the top right and bottom left values of the matrix are wrong, they should be negative.
Edwin Fan
CC BY-SA 4.0
2020-12-03T08:54:31.490Z
My apologies.. I must have mistyped copying the values when I used Maple to do the calculations. The error is more than just signs!  Will fix ASAP
Simon F
CC BY-SA 4.0
2018-11-15T09:04:10.937Z
2020-12-03T09:05:43.413Z
2020-12-03T09:05:43.413Z
Simon F
<p>I have a bunch of points that are the control vertices of a cubic catmull-rom spline. I would like to convert these to the control vertices of a cubic bspline.</p>

<p>I believe I can do this using this following relation:
<span class="math-container">$\boldsymbol{t} * \boldsymbol{B}_{\text{catmull}} * \boldsymbol{V}_{\text{catmull}} = \boldsymbol{t} * \boldsymbol{B}_{\text{bspline}} * \boldsymbol{V}_{\text{bspline}}$</span></p>

<p>where <span class="math-container">$\boldsymbol{B}$</span> is the basis matrix and <span class="math-container">$\boldsymbol{V}$</span> is a vector of the control vertices. To get the control vertices of the bspline, the formula just becomes:</p>

<p><span class="math-container">$\boldsymbol{V}_{\text{bspline}} = \boldsymbol{B}^{-1}_{\text{bspline}} * \boldsymbol{B}_{\text{catmull}} * \boldsymbol{V}_{\text{catmull}}$</span></p>

<p>My question is once I process say 4 control vertices of the catmull rom spline, to get 4 vertices of the bspline, how do I process other vertices (i.e the order). If a catmull-rom spline has n-vertices with cubic segments, then we have at the most <span class="math-container">$n-3$</span> segments. So if we have say 5 vertices, <span class="math-container">$v_0, v_1, v_2, v_3$</span> gives us 4 vertices for bspline. How would I go about computing the other curve segment in the bspline?</p>

CC BY-SA 4.0
2018-11-15T08:58:56.197Z
Being pedantic, I guess you meant "uniform cubic b-spline".
Simon F
CC BY-SA 4.0
2018-11-15T15:17:40.860Z
Yes. I forgot to mention that.
sriravic
CC BY-SA 4.0
2018-11-16T10:24:40.647Z
Just to confirm, are you asking, given a set of *N* CatRom cps, {CR0, CR1, CR2, CR3 ... CRn-1}  forming a piecewise curve, what is the equivalent *N* points, {B0,B1,B2...Bn-1} for a matching piecewise uniform cubic bspline?
Simon F
CC BY-SA 4.0
2018-11-16T15:17:24.127Z
Exactly. That is what I'm looking for. I think conversion to cubic bezier's are easy. But I would like to know if this is even possible/doable with bsplines.
sriravic
CC BY-SA 4.0
2018-11-17T16:23:41.740Z
I think it's a little trickier but I think there *may* be an approach. Still trying to work out the details.
Simon F
<curve>
Conversion from cubic catmull-rom spline to cubic b-spline
sriravic
# Conversion from cubic catmull-rom spline to cubic b-spline

(Asked by: username_0 on 2018-11-14)

I have a bunch of points that are the control vertices of a cubic catmull-rom spline. I would like to convert these to the control vertices of a cubic bspline.

I believe I can do this using this following relation:
$\boldsymbol{t} \* \boldsymbol{B}\_{\text{catmull}} \* \boldsymbol{V}\_{\text{catmull}} = \boldsymbol{t} \* \boldsymbol{B}\_{\text{bspline}} \* \boldsymbol{V}\_{\text{bspline}}$

where $\boldsymbol{B}$ is the basis matrix and $\boldsymbol{V}$ is a vector of the control vertices. To get the control vertices of the bspline, the formula just becomes:

$\boldsymbol{V}\_{\text{bspline}} = \boldsymbol{B}^{-1}\_{\text{bspline}} \* \boldsymbol{B}\_{\text{catmull}} \* \boldsymbol{V}\_{\text{catmull}}$

My question is once I process say 4 control vertices of the catmull rom spline, to get 4 vertices of the bspline, how do I process other vertices (i.e the order). If a catmull-rom spline has n-vertices with cubic segments, then we have at the most $n-3$ segments. So if we have say 5 vertices, $v\_0, v\_1, v\_2, v\_3$ gives us 4 vertices for bspline. How would I go about computing the other curve segment in the bspline?

**Tags:** curve

> **Comments:**
> **username_1**: Being pedantic, I guess you meant "uniform cubic b-spline".  
> **username_0**: Yes. I forgot to mention that.  
> **username_1**: Just to confirm, are you asking, given a set of *N* CatRom cps, {CR0, CR1, CR2, CR3 ... CRn-1}  forming a piecewise curve, what is the equivalent *N* points, {B0,B1,B2...Bn-1} for a matching piecewise uniform cubic bspline?  
> **username_0**: Exactly. That is what I'm looking for. I think conversion to cubic bezier's are easy. But I would like to know if this is even possible/doable with bsplines.  
> **username_1**: I think it's a little trickier but I think there *may* be an approach. Still trying to work out the details.  

---

## 1 answers

### Answer by username_1 on 2018-11-15. Score: 4

Quoting the comments above for context:

> Just to confirm, are you asking, given a set of $N$ CatRom control points,
> $$\{CR\_0, CR\_1, CR\_2, CR\_3 ... CR\_{n-1}\}$$
> forming a piecewise curve, what is the equivalent $N$ points, $$\{B\_0,B\_1,B\_2...B\_{n-1}\}$$ for a matching piecewise uniform cubic bspline?

> *Exactly. That is what I'm looking for. I think conversion to cubic bezier's are easy. But I would like to know if this is even possible/doable with bsplines*

I think it's a bit complicated: Using the approach you described above, i.e. $$ V\_{targetformat} = M\_{targetformat}^{-1} . M\_{sourceformat}.V\_{sourceformat}$$
you can easily go from a sequence of $n$ control points of Catmull-Rom to $(n-3)$ *sets* of 4 Uniform BSpline control points, i.e. a *total* of $4n-12$ control points , but I can't see that this will allow you to stitch them together to obtain just $n$ points...

*Assuming* I've got the correct matrices for the 'typical' Catmull-Rom,
$$M\_{CR}=\frac{1}{2}\begin{bmatrix}
-1 & 3 & -3 & 1\\
2 & -5 & 4 & -1 \\
-1 & 0 & 1 & 0 \\
0 & 2 & 0 & 0\\
\end{bmatrix}$$
and uniform B-Spline:
$$M\_{UB}=\frac{1}{6}\begin{bmatrix}
-1 & 3 & -3 & 1\\
3 & -6 & 3 & 0 \\
-3 & 0 & 3 & 0 \\
1 & 4 & 1 & 0\\
\end{bmatrix}$$
then $M^{-1}\_{UB}.M\_{CR}$ should be   
*[UPDATE: Fixed errors in coefficents]*
$$\frac{1}{6}\begin{bmatrix}
7 & -4 & 5 & -2\\
-2 & 11 & -4 & 1 \\
1 & -4 & 11 & -2 \\
-4 & 13 & -26 & 11\\
\end{bmatrix}$$

It seems to me that, in any batch of four points, every output vertex thus depends on *every* input vertex, so it seems the neighbouring points can't be shared.

Having said this, I think perhaps there *might* be a way of getting an *approximate* solution (but I've not tried rendering it myself to check it so take with a grain of salt)

We know that a Catmull-Rom spline defined by $(CR\_A, CR\_B, CR\_C, CR\_D)$, passes through $CR\_B$ and $CR\_C$ at t=0 and t=1 respectively.

Similarly, using $\begin{bmatrix}t^3 & t^2 & t & 1\end{bmatrix}.M\_{UB}$, we should see that at t=0 and t=1, a B-spline passes through $\frac{B\_A + 4 B\_B + B\_C}{6}$ and $\frac{B\_B + 4 B\_C + B\_D}{6}$.

First consider trying to go from BSpline to CR. If we had a 'loop' formed by N control points one would map from BSpline to CR with...
$$\begin{bmatrix}CR\_0\\CR\_1\\ ...\\CR\_{n-1} \end{bmatrix} = M\_{NxBtoCR}.\begin{bmatrix}B\_0\\B\_1\\ ...\\B\_{n-1} \end{bmatrix}$$
where
$$
M\_{NxBtoCR}= \frac{1}{6}.\begin{bmatrix}
4 & 1 & 0 & 0 & ... & 0 & 1\\
1 & 4 & 1 & 0 & ... & 0 & 0\\
0 & 1 & 4 & 1 & ... & 0 & 0\\
: & : & & & ... & : & :\\
1 & 0 & 0 & 0 & ... & 1 & 4\\
\end{bmatrix}
$$
If we invert that matrix to get $M\_{NxBtoCR}^{-1}$, one should then be able to map the other way.

Using a maths package such as Maple, one finds that each row of $M\_{NxBtoCR}^{-1}$ consists of the same set of values, all non-zero, which are progressively offset in each row. If we ignore the smaller terms, it suggests that $$B\_i \approx 1.732 CR\_i -0.464 (CR\_{i-1}+CR\_{i+1}) + 0.1243 (CR\_{i-2}+CR\_{i+2}) - 0.033(CR\_{i-3}+CR\_{i+3}) $$

There's probably some nice algebraic expression for this but I hope this might "do the trick".

*Update* Those weights don't *quite* sum to 1.0 - you'll need to normalise them slightly.

Obviously, this has assumed the curve is a loop. It's probably possible to adjust the weights for the end points but I'll leave that as an exercise for the reader.

> **Comments:**
> **username_2**: Correcting M−1UB.MCR I've tested the matrices using renderings, the top right and bottom left values of the matrix are wrong, they should be negative.  
> **username_1**: My apologies.. I must have mistyped copying the values when I used Maple to do the calculations. The error is more than just signs!  Will fix ASAP  

---

