1

I have a set of points p1, p2, …, pn , and I want to define a curve that is go through all the point with continuity of order C^2 ( first and second derivative is continuous).

The proposed solution is to construct a complex curve by piecing together several cubic curves:(spline curve). Each curve segment is a cubic polynomial with its own coefficient.

So in 2D for each segment the cubic polynomial function will be:

f_i(x)= a_i +b_i x + c_i x^2 + d_i x^3

Posing the following conditions we will be able to find the coefficient a,b,c,d for each segment:

enter image description here

Now if we move to 3D, the best way is to define a parametric spline curve f(t)=(x(t),y(t),z(t)) where x,y, and z is a function of the parameter t.

enter image description here

Then by assigning to each provided point p1, …, pn the t parameter t1, … tn Then we can find all the coefficient and the problem is solved.

Then my question is: If I want to use a parametric spline curve f(t)=(x(t),y(t),z(t)) still I need to define the t1, … , tn values ? What will be the perfect way to define them?(chord length ?)

Otherwise I have to used an explicit function ( without adding this t parameter) like the way I use it in 2D example above: y=h(x), and z=g(x).

However explicit functions presentation has disadvantages one of them is infinite slope is difficult to represent?

So what do you suggest to do ?

Spektre
  • 49,595
  • 11
  • 110
  • 380
Tiger
  • 43
  • 7
  • There is no perfect way and it depends on the nature of your data. A good option might be to use the relative distance of your control points. – Nico Schertler Nov 28 '16 at 13:36
  • Thanks @NicoSchertler . You mean using a parametric spline curve and defining t1= ||p2-p1||, t2=||p3-p2|| and so on ? if it is the case, what would be the impact of this on the final curve ? – Tiger Nov 28 '16 at 13:46
  • 2
    Well, not exactly. If `L` is the total length of the control poly-line, then: `t1 = 0, t2 = ||p2-p1|| / L, t3=(||p3-p2||+||p2_p1|)|/L, ...` This will make the curve to have approximately uniform velocity. Just try it. The division by `L` is not necessary but just a convenience to get parameters in the [0, 1] range. – Nico Schertler Nov 28 '16 at 13:49
  • Yes this is one solution, I will try it. However, I wonder what will be the impact of this on the final curve because to have a uniform velocity we should calculate t1,t2, ..,tn in term of the arc length and not the euclidean distance { t1= (arc legnth of p1p2) /(arc length of all the curve) }, so what we are doing is an approximation, which seems to be the best things we can do in this case. – Tiger Nov 28 '16 at 14:05
  • 1
    If you really need near-perfect uniform velocity, you can iterate. I.e. start with a guess from the Euclidean distances. Once you have the spline, measure the distance on this and refine the parameters. Loop until convergence. – Nico Schertler Nov 28 '16 at 14:09
  • Thanks a lot @NicoSchertler – Tiger Nov 28 '16 at 14:15
  • see [How can i produce multi point linear interpolation?](http://stackoverflow.com/a/30438865/2521214) and the sublinks especially the last [Interpolation cubic vs. Bezier cubic](http://stackoverflow.com/a/22582447/2521214) may be it will help you a bit – Spektre Nov 29 '16 at 09:08

0 Answers0