Hot answers tagged

19 votes
Accepted

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

If my answer for the 2D case lacks detail, it's because Typeset`MakeBoxes is an internal, undocumented function. That makes it hard to say anything authoritative ...
Simon Woods's user avatar
  • 84.4k
19 votes
Accepted

How to calculate the numerical integral more efficiently?

General When given an array of integrands NIntegrate is run separately over each array element. That is not necessary though, the core ...
Anton Antonov's user avatar
13 votes
Accepted

Filling between two B-spline curves

...
march's user avatar
  • 22.7k
12 votes

2D smoothing spline interpolation

Update Since version 12, this functionality in integrated in Mathematica via the Option FitRegularization Following on @Ajasja's answer in the spirit of this answer one can in fact provide ...
chris's user avatar
  • 22.5k
12 votes

How to discretize a BezierCurve?

This was solved with help from Shutao Tang, J.M., Sander Huisman and Eric Rimbey. Why do BezierFunction[pt] and BezierCurve[pt] ...
12 votes
Accepted

Why is DiscretizeGraphics missing points on my curve?

So DiscretizeGraphics seems to always miss the first or last point of a BSplineCurve (it seems to do it with a ...
Jason B.'s user avatar
  • 67k
12 votes
Accepted

Implementation of tensor product formula

This might help you get an idea: ...
J. M.'s lack of A.I.'s user avatar
12 votes
Accepted

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

Here is my approach: ...
xyz's user avatar
  • 555
12 votes
Accepted

Rendering PNG images to spline curves

Extracting a spline from the image is easiest with ImageMesh. I've used the midpoints of the lines on the mesh boundary for the ...
flinty's user avatar
  • 23.1k
11 votes

Implementation of tensor product formula

Update Fully compiling the code to C makes it as fast as the built-in: ...
xzczd's user avatar
  • 62.9k
11 votes
Accepted

How to generate a closed B-spline curve?

The following works for your curve: ...
Dr. belisarius's user avatar
11 votes

Implementation of smoothing splines function

Here is a (simplified) implementation of Reinsch's smoothing spline, which is effectively equivalent to csaps() in MATLAB's Curve Fitting Toolbox. Fancier methods ...
J. M.'s lack of A.I.'s user avatar
11 votes

Why does BezierFunction not follow BezierCurve at npts>4?

BezierCurve normally gives a composition of local 4point-Bezierfunctions. You get equal curves by setting ...
Ulrich Neumann's user avatar
11 votes

What do the arguments of a generated BSplineFunction mean?

Mimicking the spelunking in How to splice together several instances of InterpolatingFunction? We find ...
xzczd's user avatar
  • 62.9k
10 votes

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

I have done this before in some previous spline-related threads, but here it is again: ...
10 votes
Accepted

How to obtain the function of a plotted Bezier curve?

In the documentation for BezierCurve, under Properties & Relations, it is written that a Bezier curve can be constructed from a sum of Bernstein polynomials. ...
C. E.'s user avatar
  • 69.8k
10 votes

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

1. To get "the black curve (to) completely obscure the red curve" You can replace BSplineCurves with Lines using ...
kglr's user avatar
  • 378k
10 votes

What do the arguments of a generated BSplineFunction mean?

This is the full internal representation of BSplineFunction with all relevant parameters. You can fiddle around with the options, then open the information box and ...
Domen's user avatar
  • 18.3k
9 votes
Accepted

smooth spline through airfoil coordinates

After permuting the points so that the cusp is the first point (just like in Gypaets's answer), the methods of this answer can be used: ...
8 votes

Extracting polynomials from a cubic spline function

I've finally decided to write a "modern" re-implementation of the old SplineFit[] routine from NumericalMath`SplineFit`. In the ...
J. M.'s lack of A.I.'s user avatar
8 votes

BSplineFunction derivatives wrong if using weights?

The definition of B-Spline curve $$\vec{C}(u)=\sum _{i=0}^n N_{i,p}(u) \vec{P}_i \text{ }\qquad (0\leq u\leq 1)$$ where, $\vec{P}_i$ is the control point, and the $N_ {i, p} (u)$ are the $p$-th - ...
xyz's user avatar
  • 555
8 votes
Accepted

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

Since there is really something wrong with the BezierCurve, I made this work-around: ...
Jens's user avatar
  • 96.6k
8 votes
Accepted

How to integrate a Bézier function?

Since f[t] yields in effect {x[t], y[t]} and the area under a curve (with y[t] > 0) is ...
Michael E2's user avatar
  • 233k
8 votes

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

Edit: I have reorganized my earlier answer and added a significant amount of new material. Transformed Equations As suggested in the question, the equations are simpler, if ...
bbgodfrey's user avatar
  • 60.4k
8 votes
Accepted

Different results using spline interpolation in Wolfram and MATLAB

Is the "Spline" same as splinetx? No. If not, is there a function in Wolfram like ...
J. M.'s lack of A.I.'s user avatar
8 votes
Accepted

How to draw a colored curved shape

...
kglr's user avatar
  • 378k
8 votes

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

To avoid the issue mentioned by kglr where points are repeated, you can just add another layer of list: ...
Carl Woll's user avatar
  • 129k
8 votes

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

Additional Problem In addition to the two problems I mentioned above, there was a third problem that ...
robjohn's user avatar
  • 1,061
8 votes

Convert interpolating function to a Bezier curve

The function hermiteToBezierPoints[] computes the Bezier control points for BezierCurve from values of the function and its ...
Michael E2's user avatar
  • 233k
7 votes

Why is DiscretizeGraphics missing points on my curve?

An alternate, i suspect faster, way to get your evenly spaced points, using linepoints from here: https://mathematica.stackexchange.com/a/39457/2079 ...
george2079's user avatar
  • 38.7k

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