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
34
votes
2answers
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 ...
29
votes
3answers
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 ...
25
votes
4answers
5k 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: ...
19
votes
5answers
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 ...
19
votes
1answer
771 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: ...
18
votes
2answers
306 views

Color Blend in BezierCurve

How can I color a BezierCurve from Red into Green just as ...
18
votes
2answers
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 ...
17
votes
3answers
2k 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 ...
15
votes
1answer
505 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 ...
14
votes
2answers
402 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 ...
14
votes
1answer
1k views

Curve fit based on minimal data

Inspired by the fantastic answers here and here, I would like to ask a questions along similar lines. I have 6 curve types that follow these rules: Type A: If point 1 is positive and point 2 is ...
14
votes
1answer
3k views

Fitting a spline to data with FindFit?

I am trying to find a function that fits my almost linear data. A high order polynomial model has too much residual. So I was hoping to use Mathematica to fit splines to the curve. This is what I ...
13
votes
3answers
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: ...
13
votes
1answer
732 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'' {...
13
votes
2answers
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 ...
13
votes
2answers
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. ...
13
votes
1answer
813 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 ...
12
votes
5answers
989 views

Joining ordered set of points with splines in spiral

I have a collection of points ...
12
votes
2answers
2k 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. ...
12
votes
1answer
352 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 ...
12
votes
1answer
243 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 ...
11
votes
3answers
402 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, ...
11
votes
2answers
1k views

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

Old package, works good ...
11
votes
2answers
667 views

Solve a PDE over a region defined by a Bézier patch

I am using NDSolve to find the solution to a PDE over an arbitrary domain. The domain is specified by a Bézier patch. ...
11
votes
2answers
638 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}$ ...
10
votes
1answer
600 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 ...
10
votes
1answer
322 views

SplineDegree->1 does not work with BezierFunction?

This works (SplineDegree -> 2) ...
10
votes
1answer
161 views

Why does BezierFunction not follow BezierCurve at npts>4?

This example: ...
10
votes
2answers
754 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^...
9
votes
3answers
1k views

Getting a custom Bézier curve function to work

In general, the $nth$-degree Bézier curve is defined as: $$\vec{C}(u)=\sum_{i=0}^{n} B_{i,n}(u) \vec{P_i} \qquad 0\leq u\leq1$$ where $B_{i,n}(u)$ is the classical Bernstein polynomial, $$B_{i,n}(u)=\...
9
votes
2answers
779 views

Convert BSplineFunction into two Interpolating Functions

Is there a way to decompose a BSplineFunction output into two functions x[t], y[t] ...
9
votes
2answers
617 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)= \...
9
votes
0answers
162 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 ...
8
votes
2answers
549 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}...
8
votes
1answer
547 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 ...
8
votes
1answer
242 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 ...
8
votes
1answer
232 views

Fixing Spline curves so as to not overlap with themselves - (Diagrams)

Statement of the problem: Conceptually, what I'm trying to achieve is pretty simple. I have some code that generates a set of diagrams from a list of sets of points using BSplineCurve. Certain ...
8
votes
0answers
98 views

Artefact at joints within BSplineCurve of low Opacity

I want to eliminate the dots of higher opacity that occur at the joints within a BSplineCurve of low opacity. Small rectangles of greater opacity, shown below, ...
8
votes
0answers
166 views

Color Snapping When Using VertexColors with a Tube with BSplineCurve as an Argument

I think I've identified a bug in how VertexColors are treated when rendering a Tube object where the underlying data is a ...
7
votes
2answers
1k views

How to create an adjustable Bézier curve?

I tried to create an adjustable Bézier curve with the following simple code. However the curve didn't show up. What is the problem? Please help. ...
7
votes
4answers
684 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 ...
7
votes
3answers
414 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: ...
7
votes
1answer
906 views

BSplineCurve Interpolation

Can I get interpolated values from this B-spline, (shown in red)? ...
7
votes
2answers
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 ...
7
votes
1answer
94 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?
7
votes
1answer
309 views

How to boost the performance of my own BSplineFunction

In my CAGD package, I implemented a CAGDBSplineFunction[] like built-in BSplineFunction[]. ...
7
votes
1answer
319 views

Length of a curve parallel to a spline

I have constructed a BSplineFunction through a set of random points: ...
7
votes
1answer
223 views

Why don't optimization functions like FindMinimum work with functions like BSplineFunction? [duplicate]

Take a simple BSplineFunction and evaluate it at 0.25. ...
7
votes
1answer
519 views

FindGeometricTransform from 3D object external surfaces to a positional point cloud data

I am looking for another way to approach this problem. Any suggestion on how to optimize the computing speed is welcome. I have a BSplineFunction which accurately ...
7
votes
1answer
334 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 ...