What kind of curve is this?

177 Views Asked by At

In fact, I am not good at maths but good at developing software. My current project involves implementing a method, for interpolating a curve.

But I can´t figure out what kind of curve this is. I have analyzed a curve, which I want to "reproduce". Maybe you guys can tell me, which type of curve this is (click to enlarge):

Curve

I've used following control points (don't get me wrong, this curve is generated by a different software, I wan't to reproduce this by implementing the method in my program):

cpx = [0, 9.48732, 37.7707, 53.0929, 83.0766, 124.333,128.004]; 
cpy = [0, -89.9931, 19.9962, -89.9986, 0, -89.9991,0];
3

There are 3 best solutions below

2
On BEST ANSWER

There are several common ways to perform interpolation. The two most common methods use polynomials and splines (usually cubic splines). Both methods are described on this page.

Just from looking at it, I would guess that the example curve you showed is a cubic spline. But that's just a guess.

If you have a choice, I would suggest using cubic splines. If you have $n+1$ points, then, to use a polynomial interpolant, you'd need one of degree $n$. High degree polynomials are expensive to evaluate, and they tend to be "wiggly". Splines don't suffer from either of these problems.

There are plenty of software packages available for constructing cubic splines. A few of them are referenced on this page. The one you choose will depend partly on the programming language you're using.

4
On

Lagrange interpolation theorem states that (in programming parlance) given two arrays of numbers of equal length $n$ there is a polynomial function of degree $n$ or less, such that applying that function to arguments from the first array outputs the second array.

3
On

Like mentioned above, this curve is a bezier curve. What I am trying to figure out is, which contoll points are being calculated.

See, In the program where I am generating this curve above, I am only setting those control points:

cpx = [0, 9.48732, 37.7707, 53.0929, 83.0766, 124.333,128.004]; 
cpy = [0, -89.9931, 19.9962, -89.9986, 0, -89.9991,0];

Then 6 bezier curves are generated. For a bezier curve I need 4 control points.

p0 = cp
p1 = ..
p2 = ..
p3 = cp + 1

I have build a hermite spline with a start derivative and an end derivative and coverted it to bezier:

p0 = cp
p1 = cp + startDervivative / 3
p2 = (cp + 1) - startDervivative / 3
p3 = (cp + 1)

What I need to figure out is, which derivatives are used (how they are calculated)... I know that the start and end derivatives are dependent of the last bezier curve end point, next bezier curve end point and their curve lengths in X direction, but I didn´t found the correct calculation to reproduce the curve...

I have experimented with the start and end derivatives by guesing them. I can generate an acurate curve.

Let me give you an example (I thinks its self explaining): curve