Tag Info

1

My answer here is effectively an answer to this question as well; I'll leave to other people the decision of whether to close this as a dupe. Details on the proceedings can be read in my other answer. Here, I will merely present results: pts = SortBy[{{0., 0.}, {3., 4.}, {-1., 5.}, {-4., 0.}, {-5., -3.}, {-10., -11.}, {-11., -12.}}, First]; m ...

5

The best way (as pointed out by @Guesswhoitis.) is to convert splines into implicit functions. The real issue you are having is that you'd need a second order mesh to get a decent solution. Note that DiscretizeGraphics and DiscretizeRegion create first order meshes. So you'd need to use ToElementMesh. We also would like to have a finer boundary resolution, ...

3

Here is a (simplified) implementation of Reinsch's smoothing spline, which is effectively equivalent to csaps() in MATLAB's Curve Fitting Toolbox. Fancier methods have come along since then (e.g. Wahba's cross-validation splines), but this old workhorse has still proved serviceable: SmoothingSplineFunction[dat_?MatrixQ, p : (_?NumericQ | Automatic) : ...

4

The procedure for doing a weighted B-spline interpolation is not too different from the unweighted case. I'll use the same point set in the docs, and add a weight vector that gives higher weight to the second and fifth points: pts = {{1., 2.}, {0., 1.}, {2., 0.}, {2., 2.}, {3., 3.}, {5., 2.}}; wts = {1, 4, 1, 1, 4, 1}; Here again is Lee's algorithm, which ...

3

You can use bezier from my answer to How to know form of plotted Bezier function to get the formulas: bezier[pts_List] := With[{n = Length[pts] - 1}, Evaluate@ Sum[Binomial[n, i] (1 - #)^(n - i) #^i pts[[i + 1]], {i, 0, n}] &] Following the explanation in the linked answer, we can solve the equation bezier[pp][t] == {x, y} for y in terms of x as ...

2

As OP used in question f = BSplineFunction[data, SplineDegree -> 3, WorkingPrecision -> 8000] So WorkingPrecision is a very useful option in various numerical opertions. In this answer, I will give a function BSplineValue that owns the WorkingPrecision option. The definition of B-Spline curve \vec{C}(u)=\sum _{i=0}^n N_{i,p}(u) \vec{P}_i \qquad ...

1

Edit Based on the latest info from the OP, I offer up the following way to derive a Cartesian function from a suitable Bezier curve using BezierFunction. ctrlPts = { {0., 0., 0.}, {0.002, 0.08942, -0.08942}, {0.008, 0.233889, -0.178706}, {0.018, 0.366918, -0.267724}, {0.031, 0.496136, -0.350769}, {0.049, 0.639568, -0.439999}, {0.07, 0.779356, ...

3

As m_goldberg said in the comment A interpolation function must represent a single-vaued function of one variable. A BSpline is not a function but the parametric representation of a curve To achieve the same interpolation result, I must interpolate the data in two directions. The interpolateCurve function gives the interpolation of curves. ...

3

One does not need a solution as drastic as george's for this case; after all, BSplineBasis[] is a built-in function. You can thus easily fall back on the definition of a NURBS curve: x[t_] = (P[[All, 1]].(W Table[BSplineBasis[{d, kV}, j - 1, t], {j, Length[P]}]))/ (W.Table[BSplineBasis[{d, kV}, j - 1, t], {j, Length[P]}]); y[t_] = (P[[All, 2]].(W ...

6

Although BSplineFunction[] is sadly limited to machine precision results, it's not too hard in this case to make a function that will give exact results for exact input. You've already given the control points, so the task is a whole lot easier than the situation in this related answer. Just as in that answer, we use the strategy of starting with ...

Top 50 recent answers are included