1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-06-23 13:43:19 +00:00

solv:: fixed lazy inv_exp

This commit is contained in:
Zeno Rogue 2019-07-31 13:12:56 +02:00
parent d4ad45c4da
commit 3ae542b241

View File

@ -125,13 +125,15 @@ namespace solv {
iy *= PRECY-1; iy *= PRECY-1;
iz *= PRECZ-1; iz *= PRECZ-1;
if(lazy) {
auto r = inverse_exp_table[(iz*PRECY+iy)*PRECX+ix];
hyperpoint res = C0; hyperpoint res = C0;
if(lazy) {
auto r = inverse_exp_table[(int(iz)*PRECY+int(iy))*PRECX+int(ix)];
for(int i=0; i<3; i++) res[i] = r[i]; for(int i=0; i<3; i++) res[i] = r[i];
return res;
} }
else {
if(ix >= PRECX-1) ix = PRECX-2; if(ix >= PRECX-1) ix = PRECX-2;
if(iy >= PRECX-1) iy = PRECX-2; if(iy >= PRECX-1) iy = PRECX-2;
if(iz >= PRECZ-1) iz = PRECZ-2; if(iz >= PRECZ-1) iz = PRECZ-2;
@ -148,6 +150,7 @@ namespace solv {
for(int t=0; t<3; t++) for(int t=0; t<3; t++)
res[t] = S2(ax) * (bx-ix) + S2(bx) * (ix-ax); res[t] = S2(ax) * (bx-ix) + S2(bx) * (ix-ax);
}
if(h[2] < 0.) { swap(res[0], res[1]); res[2] = -res[2]; } if(h[2] < 0.) { swap(res[0], res[1]); res[2] = -res[2]; }
if(h[0] < 0.) res[0] = -res[0]; if(h[0] < 0.) res[0] = -res[0];