# Tag Info

7

Your choice of parameterization is creating problems. Instead of spanning one in $t$ between points, span an amount proportional to the line segment between the two points in $(x,y)$ space. I've created a Python example that demonstrates the issue. It compares a uniform parameterization $(x_t(t),y_t(t))$ (like yours, but mine is scaled so that $t \in [0,1]$...

4

The B-Spline routines in SciPy are wrappers around the spline package by Paul Dierckx (FORTRAN implementation here), although the docs say FITPACK in the first line (which is in fact another package) but then refer to routines from Dierckx. When given a task to find a spline fit to a set of data, you have the choice of giving the routine the knots or by ...

3

No, it's not completely unique. Like @origimbo said, a straight line can have many different representations that describe the same curve. Less trivially, splines can be degree-elevated and have repeated knots inserted and produce an identical curve. Most unconstrained optimization methods are gradient-based. You were right that if you try to find a ...

3

The formula is: $m = n + p + 1$ $m$ number of knots. $n$ number of control points. $p$ degree. You can check the nurbs book chapter 2 for a complete set of definitions. The Shumaker's book is a more readable reference. There is a paragraph on interpolation also on Tom Lyche and Knut Mørgens's lecture notes. Here you shall find that all the entries in ...

3

When I change your code to this: psi[x_] := Piecewise[ {{0, x < -2} , {CubicLagrangeInterpolation[{-3, -2, -1, 0}, {0, 0, 0, 1}, x], -2 <= x <= -1} , {CubicLagrangeInterpolation[{-2, -1, 0, 1}, {0, 0, 1, 0}, x], -1 <= x <= 0} , {CubicLagrangeInterpolation[{-1, 0, 1, 2}, {0, 1, 0, 0}, x], 0 <= x <= 1} , {...

3

s sets a target residual value; s=0 interpolates the data. Use get_residual() to look at the s achieved, and get_knots() to look at the knots, as in the little test below. You see that s=0 has about N = len(x) knots, and increasing s => fewer knots (polynomial pieces). s is the sum of residuals^2, |y - yinterpolated|^2, at the input data points; this ...

2

If you do not have access to the NURBS book by Piegl, then you might look at An Introduction to Polar Forms by Hans-Peter Seidel on pp 38-46 of the 1993 IEEE Computer Graphics & Applications. He diagrams the B-spline computations for the polar form, from which the polynomial coefficient form is a routine conversion. Let me offer one more reference to an ...

2

You may use Curve fitting toolbox which is provided by MATLAB. The function you need is spcol.

1

As your problem is a local regression problem, I would not use a spline fit, but LO(W)ESS. This estimates $f(x)$ at a sample point $x$ by a weighted least squares fit to the points $x_i$ that are the $k$ nearest neighbors of $x$. For details, see Cleveland: "Robust locally weighted regression and smoothing scatterplots." Journal of the American ...

1

You certainly can try using Gauss-Seidel based preconditioning that is relatively easy to construct and is cheap enough (by my assessment) to give it a try. Other choices of algebraic preconditioners (say, incomplete LU) might be too heavy relative to their potential impact. I would also suggest looking into a full sparse direct solution of your problem. ...

1

I think that you should take a look to OpenCascade. It provides with Spline surfaces, and NURBS particularly. It is written in C++ and it is released under LGPL license. Regarding FreeCAD, I don't think that they officially support NURBS, although you can import them (?). But there is a module in development (see also the Forum). The developer has published ...

1

The classic book in B-Splines is de Boor, C. (1978). A Practical Guide to Splines. New York: Springer-Verlag, but I spent many weeks on it and was not able to make his algorithms work. The algorithm in Phillips, G. M., & Taylor, P. J. (1996). Splines and Other Approximations Chapter 6 of Theory and Applications of Numerical Analysis (2nd ed., pp. 131-...

1

Answering your second question first: for $K$ knots, natural cubic splines really have only $K$ degrees of freedom/basis functions. This is quite easy to see if you count degrees of freedom: $K$ knots split the real line into $K+1$ intervals, and a piecewise cubic function in these intervals has $4(K+1)$ degrees of freedom. By matching function value, first ...

1

Fitting together B-splines with a given continuity is a hard problem. This was actually the motivation behind developing a generalization of NURBS called T-splines. There are many articles on T-splines and T-NURCCs that could be helpful to you if you're interested in going that route.

Only top voted, non community-wiki answers of a minimum length are eligible