<p>Assume your spline is given as a sequence of cubic polynomial segments defined through their endpoints <span class="math-container">$p_{i}^0, p_{i}^1$</span> and derivatives at those <span class="math-container">$d_{i}^0,d_{i}^1$</span> for <span class="math-container">$1\leq i \leq n$</span>. That is, you can parametrize each piece as the following cubic polynomial curve for <span class="math-container">$t\in [0,1]$</span>:
<span class="math-container">$$u_i(t) = (2t^3 - 3t^2 +1) p_{i}^0+ (t^3 - 2t^2+t) d_{i}^0 + (-2t^3 + 3t^2) p_{i}^1 + (t^3 - t^2) d_{i}^1,$$</span>
and you can parametrize the whole spline as:
<span class="math-container">$$u(t) = u_i(t-(i-1)), \quad t \in [i-1, i].$$</span>
<span class="math-container">$G_1$</span> means that the endpoints between two subsequent segments coincide <span class="math-container">$p_{i}^1=p_{i+1}^0$</span> (i.e. the spline is <span class="math-container">$C_0$</span>), and that the derivatives at the inner nodes are parallel <span class="math-container">$\exists \kappa_i\ne 0, d_{i}^1 = \kappa_i d_{i+1}^0$</span>. Finally, the points <span class="math-container">$p_{1}^0$</span>, <span class="math-container">$p_{n}^1$</span>, and the derivatives <span class="math-container">$d_{1}^0$</span>, <span class="math-container">$d_{n}^1$</span>, can be set as unrelated unless you have a looping curve. To turn this into a <span class="math-container">$C_1$</span> curve you need to make the derivatives equal. There are however infinitely many ways to do so, and none of those are considered canonical as far as I am aware. Let <span class="math-container">$f$</span> be the new tangents, some variants I can suggest are: use a linear combination of both with a fixed global parameter <span class="math-container">$\theta\in[0,1]$</span>: <span class="math-container">$f_i^{1} = f_{i+1}^0 = \theta d_i^1 + (1-\theta)d_{i+1}^0$</span>, e.g. you could take the average by setting <span class="math-container">$\theta = 1/2$</span>. Another option would be to compute the derivative lengths that make the spline as close as possible to a <span class="math-container">$C_2$</span> spline. One way to formulate something like this is to find the spline <span class="math-container">$u$</span> that minimizes the squared gradient magnitude <span class="math-container">$\int_{0}^{n} \|u'(t)\|^2 \, dt$</span> under the constraints that <span class="math-container">$f_{i}^1=f_{i+1}^0 \propto d_i^1$</span>. You can split the integral as a sum of the integrals over all segments, then you can take the derivative of those, take the squared magnitude, and then integrate. Taking into account the constraints this will be a function only of the lengths of the tangents, you can then take the derivatives w.r.t. those and set them equal to zero to get a system for the solution. I believe the system you will get is linear, so this shouldn't be too hard to solve.</p>
<p>Edit: The way I wrote this corresponds to a uniform parametrization, you can make this nonuniform with some modifications.</p>

CC BY-SA 4.0
2023-09-08T08:30:15.637Z
2023-09-08T09:06:36.730Z
2023-09-08T09:06:36.730Z
lightxbulb
<p>I understand <em>what</em> C1 and G1 continuity are (e.g. this is not <a href="https://computergraphics.stackexchange.com/questions/12323/continuity-of-parametric-and-geometric-continuity">Continuity of parametric and geometric continuity</a>).</p>
<p>But let's say I have a list of cubic splines that are, together, G1 continuous. Is there a canonical way of producing a re-parametrization that has C1 continuity? This may be obvious and I have failed to consider it properly.</p>

CC BY-SA 4.0
2023-04-09T09:11:16.650Z
By canonical, do you mean a method that starts at the list of splines and essentially improves" it, rather than solving a seperate equation for the coefficients directly? An idea would then be to seek the zeros of the contraints, which would be a vector function from the spline coefficients to ex: (f_0(x_0)-f_1(x_0), f_0'(x_0)-f_1'(x_0), f_1(x_1)-f_2(x_1), ...)
Mathis
CC BY-SA 4.0
2023-04-10T00:40:40.863Z
@Mathis That is exactly what I want. Maybe I can relax my question slightly: is there an easy way to get *any* C^1 parametrization, i.e. it may no longer be a spline? I guess this must be possible, but is there a simplest way?
anonymouswombat
CC BY-SA 4.0
2023-09-08T17:30:59.023Z
Any reparameterization from G1 to C1 means the splines themselves will change shape, so there are two answers. The theoretical one is "no", and the practical one is "as long as you're okay with the splines changing, then yes". G1 continuity already has the tangents aligned at each transition, C1 just adds the requirements that they have to be identical so you get to decide which control points to move by how much in order to match them up.
Mike 'Pomax' Kamermans
CC BY-SA 4.0
2024-05-08T12:39:26.557Z
Changing the parameter interval corresponding to a given segment will change the lengths of the initial and final derivative vectors (without changing the shape of the curve). So, just adjust the parameter intervals to get equal derivative vector lengths, and your curve is now C1.
bubba
<bezier-curve><spline>
Is there a canonical way to convert G1 continuity to C1 continuity for splines
anonymouswombat
# Is there a canonical way to convert G1 continuity to C1 continuity for splines

(Asked by: username_0 on 2023-04-08)

I understand *what* C1 and G1 continuity are (e.g. this is not [Continuity of parametric and geometric continuity](https://computergraphics.stackexchange.com/questions/12323/continuity-of-parametric-and-geometric-continuity)).

But let's say I have a list of cubic splines that are, together, G1 continuous. Is there a canonical way of producing a re-parametrization that has C1 continuity? This may be obvious and I have failed to consider it properly.

**Tags:** bezier-curve, spline

> **Comments:**
> **username_1**: By canonical, do you mean a method that starts at the list of splines and essentially improves" it, rather than solving a seperate equation for the coefficients directly? An idea would then be to seek the zeros of the contraints, which would be a vector function from the spline coefficients to ex: (f_0(x_0)-f_1(x_0), f_0'(x_0)-f_1'(x_0), f_1(x_1)-f_2(x_1), ...)  
> **username_0**: @username_1 That is exactly what I want. Maybe I can relax my question slightly: is there an easy way to get *any* C^1 parametrization, i.e. it may no longer be a spline? I guess this must be possible, but is there a simplest way?  
> **username_2**: Any reparameterization from G1 to C1 means the splines themselves will change shape, so there are two answers. The theoretical one is "no", and the practical one is "as long as you're okay with the splines changing, then yes". G1 continuity already has the tangents aligned at each transition, C1 just adds the requirements that they have to be identical so you get to decide which control points to move by how much in order to match them up.  
> **username_3**: Changing the parameter interval corresponding to a given segment will change the lengths of the initial and final derivative vectors (without changing the shape of the curve). So, just adjust the parameter intervals to get equal derivative vector lengths, and your curve is now C1.  

---

## 1 answers

### Answer by username_4 on 2023-09-08. Score: 0

Assume your spline is given as a sequence of cubic polynomial segments defined through their endpoints $p\_{i}^0, p\_{i}^1$ and derivatives at those $d\_{i}^0,d\_{i}^1$ for $1\leq i \leq n$. That is, you can parametrize each piece as the following cubic polynomial curve for $t\in [0,1]$:
$$u\_i(t) = (2t^3 - 3t^2 +1) p\_{i}^0+ (t^3 - 2t^2+t) d\_{i}^0 + (-2t^3 + 3t^2) p\_{i}^1 + (t^3 - t^2) d\_{i}^1,$$
and you can parametrize the whole spline as:
$$u(t) = u\_i(t-(i-1)), \quad t \in [i-1, i].$$
$G\_1$ means that the endpoints between two subsequent segments coincide $p\_{i}^1=p\_{i+1}^0$ (i.e. the spline is $C\_0$), and that the derivatives at the inner nodes are parallel $\exists \kappa\_i\ne 0, d\_{i}^1 = \kappa\_i d\_{i+1}^0$. Finally, the points $p\_{1}^0$, $p\_{n}^1$, and the derivatives $d\_{1}^0$, $d\_{n}^1$, can be set as unrelated unless you have a looping curve. To turn this into a $C\_1$ curve you need to make the derivatives equal. There are however infinitely many ways to do so, and none of those are considered canonical as far as I am aware. Let $f$ be the new tangents, some variants I can suggest are: use a linear combination of both with a fixed global parameter $\theta\in[0,1]$: $f\_i^{1} = f\_{i+1}^0 = \theta d\_i^1 + (1-\theta)d\_{i+1}^0$, e.g. you could take the average by setting $\theta = 1/2$. Another option would be to compute the derivative lengths that make the spline as close as possible to a $C\_2$ spline. One way to formulate something like this is to find the spline $u$ that minimizes the squared gradient magnitude $\int\_{0}^{n} \|u'(t)\|^2 \, dt$ under the constraints that $f\_{i}^1=f\_{i+1}^0 \propto d\_i^1$. You can split the integral as a sum of the integrals over all segments, then you can take the derivative of those, take the squared magnitude, and then integrate. Taking into account the constraints this will be a function only of the lengths of the tangents, you can then take the derivatives w.r.t. those and set them equal to zero to get a system for the solution. I believe the system you will get is linear, so this shouldn't be too hard to solve.

Edit: The way I wrote this corresponds to a uniform parametrization, you can make this nonuniform with some modifications.


---

