Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include "Spline.hpp"
- int main() {
- std::vector<double> X = { -1, -0.5, 0, 0.5, 1 };
- std::vector<double> Y = { 0, 0, 1, 0, 0 };
- tk::spline s;
- s.set_points(X, Y); // X needs to be sorted, strictly increasing
- //double value = s(1.5); // interpolated value at 1.5
- for (double i = -1; i < 1; i += 0.01) {
- std::cout << i << "\t" << s(i) << std::endl;
- }
- return 0;
- }
Advertisement