From 816320da943f9d137d38aedf60a4d5ecc1cf4277 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Thu, 25 Jul 2019 12:14:18 +0200 Subject: [PATCH] sol:: solmul --- control.cpp | 4 ++-- hyperpoint.cpp | 5 +++++ hypgraph.cpp | 4 ++-- screenshot.cpp | 9 +++++---- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/control.cpp b/control.cpp index f2e996d9..baeb1d44 100644 --- a/control.cpp +++ b/control.cpp @@ -283,10 +283,10 @@ void handlePanning(int sym, int uni) { #if !ISPANDORA if(sym == SDLK_END && DIM == 3) { - View = cpush(2, -0.2*shiftmul) * View, didsomething = true, playermoved = false; + View = solmul(cpush(2, -0.2*shiftmul), View), didsomething = true, playermoved = false; } if(sym == SDLK_HOME && DIM == 3) { - View = cpush(2, 0.2*shiftmul) * View, didsomething = true, playermoved = false; + View = solmul(cpush(2, +0.2*shiftmul), View), didsomething = true, playermoved = false; } if(sym == SDLK_RIGHT) { if(conformal::on) diff --git a/hyperpoint.cpp b/hyperpoint.cpp index 42cdffb8..0b380099 100644 --- a/hyperpoint.cpp +++ b/hyperpoint.cpp @@ -791,4 +791,9 @@ bool asign(ld y1, ld y2) { return signum(y1) != signum(y2); } ld xcross(ld x1, ld y1, ld x2, ld y2) { return x1 + (x2 - x1) * y1 / (y1 - y2); } +transmatrix solmul(transmatrix T, transmatrix V) { + if(sol) return V * eupush(inverse(V) * T * V * C0); + else return T * V; + } + } diff --git a/hypgraph.cpp b/hypgraph.cpp index 7300df76..74f85a7d 100644 --- a/hypgraph.cpp +++ b/hypgraph.cpp @@ -1285,10 +1285,10 @@ void centerpc(ld aspd) { aspd *= (1+R+(shmup::on?1:0)); if(R < aspd) { - View = gpushxto0(H) * View; + View = solmul(gpushxto0(H), View); } else - View = rspintox(H) * xpush(-aspd) * spintox(H) * View; + View = solmul(rspintox(H) * xpush(-aspd) * spintox(H), View); fixmatrix(View); spinEdge(aspd); diff --git a/screenshot.cpp b/screenshot.cpp index 86d7bf55..c9f6ab37 100644 --- a/screenshot.cpp +++ b/screenshot.cpp @@ -598,11 +598,12 @@ void apply() { fullcenter(); View = spin(rand() % 1000) * View; } } - View = cspin(0, DIM-1, movement_angle * degree) * ypush(shift_angle * degree) * xpush(cycle_length * t / period) * ypush(-shift_angle * degree) * - cspin(0, DIM-1, -movement_angle * degree) * View; + View = solmul(cspin(0, DIM-1, movement_angle * degree) * ypush(shift_angle * degree) * xpush(cycle_length * t / period) * ypush(-shift_angle * degree) * + cspin(0, DIM-1, -movement_angle * degree), View); moved(); } break; + case maRotation: if(DIM == 3) { View = spin(-movement_angle * degree) * View; @@ -616,8 +617,8 @@ void apply() { break; case maTranslationRotation: - View = cspin(0, DIM-1, movement_angle * degree) * ypush(shift_angle * degree) * xpush(cycle_length * t / period) * ypush(-shift_angle * degree) * - cspin(0, DIM-1, -movement_angle * degree) * View; + View = solmul(cspin(0, DIM-1, movement_angle * degree) * ypush(shift_angle * degree) * xpush(cycle_length * t / period) * ypush(-shift_angle * degree) * + cspin(0, DIM-1, -movement_angle * degree), View); moved(); View = spin(2 * M_PI * t / period) * View; break;