adjust_animation as a separate function

This commit is contained in:
Zeno Rogue 2020-12-24 22:59:44 +01:00
parent 7c2f343960
commit 7c9bfc7719
1 changed files with 22 additions and 19 deletions

View File

@ -1313,6 +1313,26 @@ void settings_menu() {
dialog::display();
}
void adjust_animation(ld part) {
if(solnil) {
hyperpoint sh = pView * C0;
sh = lerp(C0, sh, 1-part);
pView = eupush(sh);
smooth = inverse(pView);
}
else {
transmatrix T = pView * inverse(tView);
hyperpoint vec = inverse_exp(shiftless(tC0(T)));
transmatrix Tspin = gpushxto0(tC0(T)) * T;
ld alpha = atan2(Tspin*xpush0(1));
println(hlog, "vec=", vec, " part = ", part);
pView = spin(alpha * part) * gpushxto0(direct_exp(vec*part)) * pView;
fixmatrix(pView);
View = tView;
smooth = inverse(pView) * cview().T;
}
}
void run() {
clearMessages();
@ -1336,25 +1356,8 @@ void run() {
View = pView;
smooth = Id;
}
else if(solnil) {
ld part = (ticks - last_adjust) * 1. / (when_t - last_adjust);
hyperpoint sh = pView * C0;
sh = lerp(C0, sh, 1-part);
pView = eupush(sh);
smooth = inverse(pView);
}
else {
ld part = (ticks - last_adjust) * 1. / (when_t - last_adjust);
transmatrix T = pView * inverse(tView);
hyperpoint vec = inverse_exp(shiftless(tC0(T)));
transmatrix Tspin = gpushxto0(tC0(T)) * T;
ld alpha = atan2(Tspin*xpush0(1));
pView = spin(alpha * part) * gpushxto0(direct_exp(vec*part)) * pView;
fixmatrix(pView);
View = tView;
smooth = inverse(pView) * cview().T;
// println(hlog, "smooth = ", smooth);
}
else adjust_animation((ticks - last_adjust) * 1. / (when_t - last_adjust));
last_adjust = ticks;
ray::want_use = 2;