Use the newer more generic sampling and interpolation functions
developed recently instead of the `CurveEval` type. Functions are split
up a bit more internally, to allow a separate mode for supplying the
curve index directly in the future (T92474).
In one basic test, the performance seems mostly unchanged from 3.1.
TODO:
- Fix sample length of zero case (T99370)
- Fix other problems
- Think more about where the logic should be implemented