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:
parent
f6448a994f
commit
afe4d58cbb
@ -793,19 +793,27 @@ EX void fixmatrix(transmatrix& T) {
|
||||
PIU(fixmatrix(T));
|
||||
T = mscale(T, +z);
|
||||
}
|
||||
else if(euclid) {
|
||||
for(int x=0; x<GDIM; x++) for(int y=0; y<=x; y++) {
|
||||
ld dp = 0;
|
||||
for(int z=0; z<GDIM; z++) dp += T[z][x] * T[z][y];
|
||||
else if(euclid)
|
||||
fixmatrix_euclid(T);
|
||||
else
|
||||
orthonormalize(T);
|
||||
}
|
||||
|
||||
if(y == x) dp = 1 - sqrt(1/dp);
|
||||
EX void fixmatrix_euclid(transmatrix& T) {
|
||||
for(int x=0; x<GDIM; x++) for(int y=0; y<=x; y++) {
|
||||
ld dp = 0;
|
||||
for(int z=0; z<GDIM; z++) dp += T[z][x] * T[z][y];
|
||||
|
||||
for(int z=0; z<GDIM; z++) T[z][x] -= dp * T[z][y];
|
||||
}
|
||||
for(int x=0; x<GDIM; x++) T[LDIM][x] = 0;
|
||||
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;
|
||||
for(int z=0; z<MDIM; z++) dp += T[z][x] * T[z][y] * sig(z);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user