1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-20 23:50:27 +00:00

split fixmatrix into cases

This commit is contained in:
Zeno Rogue 2020-05-15 22:53:24 +02:00
parent f6448a994f
commit afe4d58cbb

View File

@ -793,19 +793,27 @@ EX void fixmatrix(transmatrix& T) {
PIU(fixmatrix(T)); PIU(fixmatrix(T));
T = mscale(T, +z); T = mscale(T, +z);
} }
else if(euclid) { else if(euclid)
for(int x=0; x<GDIM; x++) for(int y=0; y<=x; y++) { fixmatrix_euclid(T);
ld dp = 0; else
for(int z=0; z<GDIM; z++) dp += T[z][x] * T[z][y]; orthonormalize(T);
}
if(y == x) dp = 1 - sqrt(1/dp);
EX void fixmatrix_euclid(transmatrix& T) {
for(int z=0; z<GDIM; z++) T[z][x] -= dp * T[z][y]; for(int x=0; x<GDIM; x++) for(int y=0; y<=x; y++) {
} ld dp = 0;
for(int x=0; x<GDIM; x++) T[LDIM][x] = 0; for(int z=0; z<GDIM; z++) dp += T[z][x] * T[z][y];
T[LDIM][LDIM] = 1;
if(y == x) dp = 1 - sqrt(1/dp);
for(int z=0; z<GDIM; z++) T[z][x] -= dp * T[z][y];
} }
else for(int x=0; x<MDIM; x++) for(int y=0; y<=x; y++) { for(int x=0; x<GDIM; x++) T[LDIM][x] = 0;
T[LDIM][LDIM] = 1;
}
EX void orthonormalize(transmatrix& T) {
for(int x=0; x<MDIM; x++) for(int y=0; y<=x; y++) {
ld dp = 0; ld dp = 0;
for(int z=0; z<MDIM; z++) dp += T[z][x] * T[z][y] * sig(z); for(int z=0; z<MDIM; z++) dp += T[z][x] * T[z][y] * sig(z);