# Is there a canonical way to convert G1 continuity to C1 continuity for splines

I understand what C1 and G1 continuity are (e.g. this is not 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.

• 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), ...) Apr 9 at 9:11
• @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? Apr 10 at 0:40
• @anonymouswombat: reparameterization does not change the curve, hence it remains a spline.
– user1703
Apr 12 at 9:08
• 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. Sep 8 at 17:30

What you can try is to enforce the same "travel speed" $$\dfrac{ds}{dt}$$ where two cubic arcs meet. You know the values of $$t,s$$ at these points (though $$s$$ must be obtained by numerical integration), and you want to specify the values of the speeds, i.e. the derivatives. Considering the two endpoints of a cubic arc, that gives you four constraints that can be satisfied by Hermite interpolation in the $$t$$ domain.
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.