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
32 votes
3 answers
3k views

Arbitrary precision spline interpolation

The current implementation of Interpolation does not allow arbitrary precision spline interpolation. Yu-Sung Chang says here that "it is not hard to implement it ...
Alexey Popkov's user avatar
12 votes
2 answers
1k views

How to make BSplineFunction pass each data point and naturally smooth?

Old package, works good ...
yanfyon's user avatar
  • 121
34 votes
2 answers
6k views

Joining and interpolating data points

I wonder what is the best practice for interpolating curves? Usually, I'm using BSplineCurve and adjusting SplineWeights so it ...
swish's user avatar
  • 7,591
26 votes
4 answers
6k views

Implementation of smoothing splines function

I have some problems in writing a module for spline smoothing. Actually, I have been trying for about two weeks. My listing is here: ...
jojosthegreat's user avatar
13 votes
1 answer
815 views

How to calculate the numerical integral more efficiently?

Rencently, I ecountered the following numerical intergral: $$ \begin{cases} \mathbf I_1=\displaystyle \int_{t}\mathbf N' {\mathbf N'}^{\text T}{\rm d}t\\ \mathbf I_2=\displaystyle \int_{t}\mathbf N'' {...
xyz's user avatar
  • 555
18 votes
2 answers
2k views

ListSurfacePlot3D generates ugly artifacts

I have a list of $\{x,y,z\}$ pairs representing points in $R^3$. For every unique value of $z$ there are many $\{x,y\}$ pairs defining a polygon/contour in that particular $z$-plane. My dataset looks ...
stathisk's user avatar
  • 3,044
13 votes
3 answers
2k views

Finding "Maxima" and "Minima" on a B-Spline

I need to find the "Maxima" and "Minima" on a B-Spline or more correct the points where the 2nd components of the derivate equal zero. For example: ...
cxkoda's user avatar
  • 305
17 votes
3 answers
3k views

2D smoothing spline interpolation

Does Mathematica have 2D smoothing spline interpolation built in? I requires an interpolation method with smooth first derivatives and cubic bivariate splines fulfill this nicely. In python I would ...
Ajasja's user avatar
  • 13.5k
13 votes
1 answer
948 views

How to discretize a BezierCurve?

Bug introduced in version 10.0 and fixed in version 12.0 DiscretizeGraphics is new in 10.0. I need to create a discretized region from a ...
Szabolcs's user avatar
  • 232k
10 votes
2 answers
906 views

Convert BSplineFunction into two Interpolating Functions

Is there a way to decompose a BSplineFunction output into two functions x[t], y[t] ...
level1807's user avatar
  • 1,670
9 votes
2 answers
730 views

How to deal with the condition $u_i=u_{i+1}$ in B-Spline basis function?

The defintion of B-Spline basis function as shown below: Let $\vec{U}=\{u_0,u_1,\ldots,u_m\}$ a nondecreasing sequence of real numbers,i.e, $u_i\leq u_{i+1}\quad i=0,1,2\ldots m-1$ $$N_{i,0}(u)= \...
xyz's user avatar
  • 555
12 votes
1 answer
399 views

How can I make FilledCurve smoother?

In How can I generate and randomly assign color to annular sectors? J.M. showed an interesting way to create a sector graphic using FilledCurve. Unfortunately it ...
Mr.Wizard's user avatar
  • 269k
10 votes
2 answers
961 views

Stiff BVP of nonlinear ODE, alternative/ enhancement to shooting method

Question: I have been trying to solve this coupled ODE set. \begin{align} ( \frac{ \mu^2}{B} +1 ) \Phi^2 + \frac{1}{A} {\Phi^{\prime 2}} + \frac{1}{2}\lambda \Phi^4 - \frac{A'}{r A^...
Boson Bear's user avatar
4 votes
2 answers
3k views

Extracting polynomials from a cubic spline function

I have this set of three data points and I want the natural cubic spline functions for them: dat = {{-.0247500, .5}, {.3349375, -.25}, {1.101000, 0}}; I tried: ...
Amzoti's user avatar
  • 1,035
11 votes
2 answers
723 views

How to speed up the plotting of B-spline curve?

Three months ago, I asked a quesion about B-Spline basis function here, Today, I used this function to plot B-spline curve. The definition of $N_{i,p}$ ...
xyz's user avatar
  • 555
8 votes
1 answer
700 views

Produce a spline from a set of {{x, y}, z} points and get its parameters/expression

I have produced a set of points in a variable of the type {{x1, y1}, z1},{{x2, y2}, z2}, ,... }, where {x, y} should be the ...
user14679's user avatar
8 votes
2 answers
1k views

Intersection of two splines

I have a collection of sets of points, each set defining the segment of a (nice) curve on the unit sphere $S^2 \subset \mathbb{R}^3$. The points are computed numerically. I now want to compute the ...
user10303's user avatar
7 votes
1 answer
376 views

Length of a curve parallel to a spline

I have constructed a BSplineFunction through a set of random points: ...
Ian Miller's user avatar
6 votes
2 answers
2k views

How to get a uniformly distributed list of points from a B-spline function [duplicate]

I created a spline function from a list of points and made a plot as follows: ...
Kaisey's user avatar
  • 371
10 votes
1 answer
355 views

SplineDegree->1 does not work with BezierFunction?

This works (SplineDegree -> 2) ...
JxB's user avatar
  • 5,031
7 votes
3 answers
458 views

BezierCurve in EdgeShapeFunction fails when used on multiedges graph

I would like to create a network graph with curved edges. To do this, I wrote this function: ...
Michiel van Mens's user avatar
2 votes
2 answers
848 views

How to know form of plotted Bézier function

Simple scenario is to see the Bézier function, but how to know which polynomial approximate it? ...
Pipe's user avatar
  • 1,099
19 votes
1 answer
823 views

How to define a custom 2/3D graphic primitive like built-in?

There are lots of basic graphic-primitives in Mathematica, such as 2D- primitive: Line[], Circle[], Disk[] and 3D-primitive: ...
xyz's user avatar
  • 555
13 votes
2 answers
3k views

How to calculate the control points of a Bézier curve?

To plot a BezierCurve in Mathematica, I need control points. But, I do not know the control points; I only know the points through which the Bézier curve passes. ...
Bob Ueland's user avatar
  • 1,049
12 votes
5 answers
1k views

Joining ordered set of points with splines in spiral

I have a collection of points ...
martin's user avatar
  • 8,102
12 votes
1 answer
261 views

Is there a way to get BSplineFunction beyond MachinePrecision?

I have been using BSplineFunction (Mathematica 8) to generate a smooth representation of some data, which I might then do some further processing on. As I ...
Dan's user avatar
  • 121
8 votes
2 answers
573 views

Implementation of tensor product formula

For the Bézier surface, which owns the following matrix definition: $$\begin{align*} \mathbf S(u,v)&=\sum_{i=0}^m \sum_{j=0}^n \mathbf P_{i,j} B_{m,i}(u) B_{n,j}(v)\\ &=\small \begin{pmatrix}...
xyz's user avatar
  • 555
7 votes
1 answer
418 views

Multidimensional arbitrary precision spline interpolation on the grid

This question is a generalization of the previous one for multiple dimensions. In the answer to that question an implementation for the clamped spline interpolation for 1D case and arbitrary degree of ...
Alexey Popkov's user avatar
7 votes
1 answer
280 views

BezierCurve is different from BezierFunction

I am constructing Naca type profiles with Bezier curves. ...
Maarten Mostert's user avatar
7 votes
0 answers
637 views

How to fit B-splines to unstructured grids (triangulated surfaces)?

As a continuation of trying to calculate curvature tensors on triangulated surfaces (here), I am interested in trying other methods. One approach is to use NURBS. To be more precise I would like to be ...
Dunlop's user avatar
  • 3,893
7 votes
1 answer
1k views

BSplineCurve Interpolation

Can I get interpolated values from this B-spline, (shown in red)? ...
Chris Degnen's user avatar
  • 30.6k
6 votes
4 answers
3k views

How to find a length of a curve constructed using Spline?

By fitting the data using spline, I have created a curve. sp = SplineFit[data1, Cubic] I am trying to divide this curve into small segments of equal length. To ...
sra's user avatar
  • 697
5 votes
2 answers
4k views

Generating x,y coordinates for an edge detection

I'd like to be able to process a number of graphics that have edge contours and output a list of $x$, $y$ coordinates to be used for generating a spline in another program, or in Mathematica, to make ...
Bald Eagle's user avatar
3 votes
2 answers
2k views

Parametric differentiable interpolation of a 2D data set

I have a set of data ...
level1807's user avatar
  • 1,670
3 votes
2 answers
1k 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 ...
Ted Ersek's user avatar
  • 6,954
2 votes
1 answer
251 views

Confusion with SplineFit (Angle calculation)

This question is a continuation to [this other one][1] I am creating polymers (where each monomer is of equal length) using this method: ...
sra's user avatar
  • 697
2 votes
3 answers
274 views

Ways to quicken numeric integral over interpolating spline?

I have an integral of the form $$\int_1^{15000} f_1(k) f_2(k) dk,$$ where $f_1(k)$ is an interpolating function and $f_2(k)$ is some multiplicative function of k. I'm working with the following <...
CAF's user avatar
  • 510
2 votes
2 answers
188 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 ...
johk95's user avatar
  • 123
0 votes
1 answer
377 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 ...
user5836's user avatar
19 votes
5 answers
1k views

BSplineFunction derivatives wrong if using weights?

Bug introduced in 7.0 and persisting through 12.0 or later In my work, I make heavy use of non-uniform rational B-spline (NURBS) functions, defined using the function ...
user7987's user avatar
  • 295
19 votes
2 answers
373 views

Color Blend in BezierCurve

How can I color a BezierCurve from Red into Green just as ...
Murta's user avatar
  • 26k
15 votes
1 answer
616 views

How to specify PDE Boundary condition on a B-spline?

Context I would like to solve a PDE on a boundary which is parametrized as a BSpline. I am trying to solve the force-free Grad-Shafranov equation on a boundary ...
chris's user avatar
  • 22.5k
14 votes
2 answers
436 views

Why is DiscretizeGraphics missing points on my curve?

I have a graphics expression which renders nicely as a closed curve when put in Graphics, I don't understand why I can't get the lines from DiscretizeGraphics or ...
M.R.'s user avatar
  • 31k
13 votes
2 answers
2k views

How to generate a closed B-spline curve?

I wrote a function called deBoor using the Cox-de Boor algorithm to generate a B-spline curve. ...
xyz's user avatar
  • 555
13 votes
2 answers
1k views

smooth spline through airfoil coordinates

I am trying to produce a smooth spline curve through a set of airfoil coordinates. An example for the data I am trying to use is here, and I am reading the file like so to get rid of some extraneous ...
Pirx's user avatar
  • 4,129
12 votes
3 answers
443 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, ...
robjohn's user avatar
  • 1,061
11 votes
1 answer
872 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 ...
LCarvalho's user avatar
  • 9,145
8 votes
1 answer
265 views

Where is the other half of my fourth degree Bézier curve?

Bug introduced in 10.0.0 and fixed in 10.2 When I enter the following command, half of the fourth-degree spline is missing from the graph (i.e. it doesn't touch the last point). Is this a bug in ...
mimuller's user avatar
  • 328
7 votes
1 answer
332 views

How to boost the performance of my own BSplineFunction

In my CAGD package, I implemented a CAGDBSplineFunction[] like built-in BSplineFunction[]. ...
xyz's user avatar
  • 555
6 votes
1 answer
490 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. ...
srtie's user avatar
  • 63