From 597d95ccc2508847eb26a3dd97fe04eecba442f9 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Fri, 10 Feb 2023 15:02:25 +0100 Subject: [PATCH] rogueviz/smoothcam:: interpolate factored out --- rogueviz/smoothcam.cpp | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/rogueviz/smoothcam.cpp b/rogueviz/smoothcam.cpp index 1ae11dc8..8062dd4c 100644 --- a/rogueviz/smoothcam.cpp +++ b/rogueviz/smoothcam.cpp @@ -445,6 +445,26 @@ void after_interpolation(hyperpoint& h) { h = normalize(h); } +ld interpolate(const vector& times, vector values, ld t) { + int n = isize(values); + print(hlog, "interpolate: ", values); + + for(int ss=1; ss<=n-1; ss++) { + for(int a=0; a ", values[0]); + return values[0]; + } + + void handle_animation(ld t) { ld total_total = 0; @@ -504,20 +524,7 @@ void handle_animation(ld t) { values.push_back(h[i]); } - int n = isize(values); - - for(int ss=1; ss<=n-1; ss++) { - for(int a=0; a