Questions tagged [splines]

Questions on the spline-related functions of Mathematica (BezierCurve[], BSplineCurve[], etc.), or related to the theory and use of splines in Mathematica.

Filter by
Sorted by
Tagged with
6 votes
1 answer
158 views

Convert interpolating function to a Bezier curve

I've been wondering, is there a way to convert an interpolation into a sequence of BezierCurve objects that form each step in the interpolation? There is an easy ...
user avatar
  • 219k
1 vote
1 answer
83 views

Recurrence relation for B-spline polynomials

I am trying to get the explicit polynomials of cardinal B-splines. So far I have this implementation (for cardial B-splines of degree 3 on the knots 0, 1, 2, 3): ...
user avatar
1 vote
0 answers
77 views

How does Mathematica's B-Spline NURBS work?

I'm finding that Mathematica is getting hung up on a numerical integration and I suspect I can do it faster myself in C++. I can scoop the control points of the BSplineFunction out of the ...
user avatar
3 votes
1 answer
208 views

Geogebra spline command in Mathematica

Spline(pts, order, Weight Function) Creates a spline with given order through all points. The weight function says what should be the difference of t values for point $P_i$ and $P_{(i+1)}$ given ...
user avatar
  • 5,102
6 votes
1 answer
112 views

Understanding Interpolation with Cubic Splines

My ultimate question: given data, what function is Interpolation with Method->"Spline" creating? I recall from my ...
user avatar
  • 1,705
1 vote
2 answers
93 views

Is task to find intersections of a line and a cubic Bezier curve really so hard?

I wrote formulas for parametric Bezier curves of different orders ...
user avatar
  • 725
3 votes
1 answer
146 views

how to PiecewiseExpand BSplineBasis to get Basis matrices of uniform B-splines presented in the paper?

As we all know, the definition of B-spline contains the B-spline basis function, which has the recursive form $B_{j,k}$ is the j-th degree $k-1$ polynomial. It has nonzeros only in interval $[t_j,t_{...
user avatar
  • 121
2 votes
0 answers
157 views

NURBS model from a entire mesh

I have a mesh in STL file format and imported it into Mathematica. data=Import["mesh.stl"]; or ...
user avatar
4 votes
1 answer
135 views

BSplineFunction returns unevaluated when its degree is equal to the number of control points

Bug fixed in 13.0.0 [CASE:4855260] It seems that BSplineFunction always returns unevaluated without warnings, when its degree is equal to the number of control ...
user avatar
1 vote
1 answer
183 views

Cubic spline fitting

If I have the following data: ...
user avatar
  • 1,531
6 votes
1 answer
128 views

Texture prevents JoinedCurve from closing

Bug introduced in 11.3 or earlier and fixed in 12.1 I am running Mathematica 11.3 and would like to see if this behavior is still present in newer versions of Mathematica before submitting a bug ...
user avatar
  • 1,041
0 votes
0 answers
29 views

Plot a quadratic bezier triangular patch [duplicate]

I need to construct a triangular patch by using the 6 control points: $$\begin{array}{ccc} \left(\frac{1}{2},\frac{\sqrt{3}}{4},1\right) & \left(\frac{1}{4},\frac{\sqrt{3}}{4},2\right) & \...
user avatar
0 votes
1 answer
233 views

Plot a bezier triangle

I have to construct a bezier triangle that interpolates these 4 points: $\qquad (0,0,1),\,(1,0,0),\,(0,1,0),\,(0.5,0.5,0.75)$ However, the surface that I get is so weird. Anyone please can help me to ...
user avatar
0 votes
2 answers
105 views

Access to Interpolation expression of Mathematica's Interpolate command

To reproduce fits which have been done in the framework of a standard, I was reviewing the Interpolation engine of Mathematica (for InterpolationOrder -> 3) to get more information about the ...
user avatar
  • 2,751
12 votes
3 answers
420 views

Why is there a discrepancy between JoinedCurve/FilledCurve and the underlying BSplineCurve segments?

This may be related to How to discretize a BezierCurve?, but this question deals with BSplineCurves with specific SplineWeights, ...
user avatar
  • 1,041
0 votes
0 answers
49 views

Part::partw: error in Custom Spline Algorithm

I am attending a Calculus course where we use Wolfram as a supporting tool, and I was trying the algorithm provided for Spline interpolation and I get the error in the picture: ...
user avatar
4 votes
1 answer
151 views

Find intersection points of arbitrary BSpline curve

I'm researching some computational geometry and am trying to find a method of determining the {x,y} intersection of a circle and BSplineCurve for further processing. ...
user avatar
  • 1,024
4 votes
1 answer
85 views

How can I control the length of the line segments used in rendering a BSplineCurve?

Mathematica seems to render rational Bézier curves (drawn with BSplineCurve) using polylines whose segments can be annoyingly long, while polynomial Bézier curves (...
user avatar
1 vote
0 answers
56 views

Export Basis spline information to matlab

i am new to Mathematica. I have generated the contours of this image with the following code ...
user avatar
11 votes
1 answer
666 views

Rendering PNG images to spline curves

I found something interesting on this page (Generic contour smoothing with shading) that could help me improve my images. Unfortunately, they can only be used with graphics generated by the software ...
user avatar
  • 9,055
4 votes
1 answer
111 views

Why FilledCurve and BezierCurve or BSplineCurve do not fit

I want to draw the outline of a circle (it's actually the glyph period from Cascadia Code font): ...
user avatar
7 votes
4 answers
895 views

Find smallest distance from a point to a Bézier curve

I wish to find the smallest distance from a point to a curved defined via a Bézier function. I want to do this automatically. For particular cases it is not to difficult. Here is a minimum working ...
user avatar
  • 14.8k
5 votes
1 answer
135 views

How to draw a colored curved shape

I can draw a polygon with a curved edge using B-splines or Bézier curves: ...
user avatar
  • 988
2 votes
2 answers
192 views

Best parameter for smoothing splines

I am trying to implement a module to determine the best value for the smoothing parameter of a smoothing spline interpolation of a given dataset. To calculate the cross-validation score of a given ...
user avatar
5 votes
0 answers
93 views

Improving speed performance of 'Fit' with BSplines?

Context In the context of this (vaguely controversial) question, I am stumbling into a performance issue with Fit. Let me illustrate on fitting a set of ...
user avatar
  • 21.8k
9 votes
0 answers
169 views

Dividing by Zero - Unexpected Result [closed]

When I divide this number by zero I get this for an answer. ans = 2345900/0 (* *) What is surprising is that in taking the square root, Mathematica seems to ...
user avatar
  • 6,898
6 votes
1 answer
350 views

Different results using spline interpolation in Wolfram and MATLAB

I use the same data for interpolation in Mathematica and MATLAB, but the result is different. ...
user avatar
  • 63
3 votes
2 answers
487 views

How to make a natural cubic spline of {{x,y}, ...} data

Consider data = {{0, 0}, {1, 0}, {2, 0}, {3, 1}, {4, 0}, {5, 0}, {6, 0}}; f = Interpolation[data, InterpolationOrder -> 3, Method -> "Spline"]; Then the ...
user avatar
  • 6,760
5 votes
1 answer
62 views

Image artifacts while using BSplineCurve

Mathematica provides an example of visualizing a Hilbert curve using splines as a Graphics object in this entry in its documentation system. However, when one attempts to change the thickness, some ...
user avatar
2 votes
2 answers
126 views

Manual ArcLength sampling on spline differs from MeshFunction sampling

Using Michael E2's answer, I performed a manual arclength parameterisation by solving the differential equation (or: finding the inverse of a function whose derivative is known). I compared the ...
user avatar
  • 123
5 votes
1 answer
119 views

What are the automatic settings of a BSplineCurve object?

Consider the following object: spline = BSplineCurve[{{0,1}, {1,1}, {0,1}, {-1,1}, {-1,0}}, SplineClosed->True]; Graphics[spline] What would be an equivalent <...
user avatar
  • 124k
2 votes
2 answers
109 views

Find optimal BezierFunction

For a given set of points (examplary quadrant) n = 5; (* number of inner points*) p = Table[{Cos[φ], Sin[φ]}, {φ, Join[{0}, RandomReal[{0, Pi/2}, n], {Pi/2}]}]; ...
user avatar
3 votes
3 answers
306 views

How to fit spline through points in $ \mathbb{R}^3$?

I have coordinates of points that represent a curve (for example, helix or centerline of moebius strip) in $ \mathbb{R^3}$. I want to fit a Bspline through these points. How to do this in Mathematica? ...
user avatar
6 votes
1 answer
113 views

How to construct BezierFunction for BezierCurve with npts>4 and SplineDegree -> 3?

I would like to use BezierCurve with npts=7 and SplineDegree -> 3 and access its BezierFunction. This code helps: ...
user avatar
  • 193
10 votes
1 answer
169 views

Why does BezierFunction not follow BezierCurve at npts>4?

This example: ...
user avatar
  • 193
8 votes
2 answers
138 views

How to obtain the function of a plotted Bezier curve?

I have some control points and I could just plot the Bezier curve, but I also need to have the function! How can I get the exact function of the plotted Bezier curve?
user avatar
  • 83
3 votes
1 answer
108 views

elegant definition of piecewise linear functions (spline)

As far as I understand, the Spline object is the result of some approximation or interpolation, it is not for directly defining functions. That's a pity, as that ...
user avatar
  • 345
4 votes
0 answers
130 views

BSpline vs natural spline [closed]

The BSpline in mathematica is defined mathematically here. These BSplines constitute basis for any Spline. But how do I define natural splines in mathematica, i.e. splines that are linear left of the ...
user avatar
  • 1,548
2 votes
1 answer
41 views

Help with evaluation of the differential of a BSplineFunction?

It can be useful to generate a smooth random function over $[-L,L]$ with BSplineFunction: ...
user avatar
  • 1,197
2 votes
1 answer
191 views

How to reproduce old SplineFit function? [duplicate]

Prior to version 8, Mathematica included a SplineFit function that could be used, for example, in the form: ...
user avatar
  • 11.4k
4 votes
2 answers
873 views

Integrate an Interpolating function with Integrate command

i'm trying to integrate an Interpolating function, as simple as this ...
user avatar
2 votes
1 answer
78 views

Questions about higher order Bézier Curves

I can generate the same Bézier Curve using my own code as the curve generated by Mathematica's function BezierCurve, but when I increased the order of the curve, it ...
user avatar
2 votes
2 answers
374 views

How to generate a Bézier curve using 4 points(arbitrary), without using the built-in function of Mathematica?

How to generate a Bézier curve using 4 points(arbitrary), without using the built-in function of Mathematica? The main point is that we do not use the built-in function in Mathematica, instead use a ...
user avatar
7 votes
1 answer
243 views

BezierCurve is different from BezierFunction

I am constructing Naca type profiles with Bezier curves. ...
user avatar
2 votes
1 answer
225 views

Integrating an interpolating function: Hermite vs. BSpline

I have an interpolation through a list of points, which I need to integrate. The minimal working example looks as follows: ...
user avatar
  • 171
0 votes
0 answers
138 views

How to write the code for a general B-spline function?

I write the code for B-spline basis and it works very nicely but now I need help to write code for general B-spline functions I would like the code to show the spline segment in this way:
user avatar
3 votes
1 answer
954 views

Generate a smooth random function (2D curve) with endpoints specification?

Here is a PDE example, adapted from Wolfram Documentation: ...
user avatar
  • 981
3 votes
0 answers
117 views

The actual polynomial behind a BezierFunction [duplicate]

Let's say I have the following Mathematica code pts = {{0, 0}, {1, 1}, {2, -1}, {3, 0}}; F = BezierFunction[pts] How can I find the actual polynomial of the <...
user avatar
  • 305
5 votes
2 answers
267 views

Finding inflection points of 2D BSplineFunction

This code creates a jagged line in two dimensions and fits a BSpline function to it. ...
user avatar
2 votes
1 answer
273 views

How to interpolate closed surface

With BSplineSurface, I was trying to interpolate data points belonging to a sphere, but unfortunately I don't get the right geometry closing: ...
user avatar
  • 105