📐 [Typst] spline-hermite-cubique — Hermite interpolation with f(x) and f'(x)

Small Typst module I made for my own lessons and thought I’d share.

It builds a tensioned cubic Hermite spline (Bézier curves) through a set of points with their derivatives, then gives you f(x) and f’(x) at any x — not just a curve parameterized by Bernstein polynomials in t. The module solves X(t) = x analytically (Cardan’s method) to recover the matching parameter, so you can:

read images and antecedents directly,
plot f and f’ on the same frame,
draw tangents with the right slope (works great with my ctz-plot-helper).
Nothing fancy, just useful to me — sharing in case it helps.

4 Likes