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:
parent
f6448a994f
commit
afe4d58cbb
@ -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 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];
|
if(y == x) dp = 1 - sqrt(1/dp);
|
||||||
}
|
|
||||||
for(int x=0; x<GDIM; x++) T[LDIM][x] = 0;
|
for(int z=0; z<GDIM; z++) T[z][x] -= dp * T[z][y];
|
||||||
T[LDIM][LDIM] = 1;
|
|
||||||
}
|
}
|
||||||
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);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user