1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-21 08:00:25 +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,7 +793,13 @@ 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)
fixmatrix_euclid(T);
else
orthonormalize(T);
}
EX void fixmatrix_euclid(transmatrix& T) {
for(int x=0; x<GDIM; x++) for(int y=0; y<=x; y++) { for(int x=0; x<GDIM; x++) for(int y=0; y<=x; y++) {
ld dp = 0; ld dp = 0;
for(int z=0; z<GDIM; z++) dp += T[z][x] * T[z][y]; for(int z=0; z<GDIM; z++) dp += T[z][x] * T[z][y];
@ -805,7 +811,9 @@ EX void fixmatrix(transmatrix& T) {
for(int x=0; x<GDIM; x++) T[LDIM][x] = 0; for(int x=0; x<GDIM; x++) T[LDIM][x] = 0;
T[LDIM][LDIM] = 1; T[LDIM][LDIM] = 1;
} }
else for(int x=0; x<MDIM; x++) for(int y=0; y<=x; y++) {
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);