Non linear sampling with d3?

I made the exercise to use d3.piecewise, d3.range, d3.interpolateObject, etc. to sample a trajectory (x/y points in time): https://observablehq.com/@severo/trajectory-sampling-with-d3-js

But the interpolation between the points is linear. I wonder if D3.js provides the tools to do other interpolations, such as the ones d3-shape provides for curves

D3 supports basis interpolation:

There’s been discussion about other sorts of splines (monotonic in particular). We might add more.

1 Like

OK ! I will add the spline interpolation to the notebook, thanks

Done! Thanks again

I made a proof of concept of the Catmull-Rom interpolation here: Catmull–Rom spline interpolator / Sylvain Lesage / Observable. See also the doc here: interpolateCatmullRom / Sylvain Lesage / Observable.

An alternative is Cubic Spline / Jacob Rus / Observable