1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2026-03-14 00:59:43 +00:00

solv:: fixmatrix

This commit is contained in:
Zeno Rogue
2019-07-30 13:02:24 +02:00
parent 3b7d80bb17
commit bbabd47ad0
3 changed files with 13 additions and 1 deletions

10
sol.cpp
View File

@@ -315,6 +315,16 @@ namespace solv {
transmatrix push_back = eupush( tC0(inverse(V)) );
transmatrix space_to_view = V * push_back;
for(int x=0; x<3; x++) for(int y=0; y<=x; y++) {
auto& T = space_to_view;
ld dp = 0;
for(int z=0; z<3; z++) dp += T[z][x] * T[z][y];
if(y == x) dp = 1 - sqrt(1/dp);
for(int z=0; z<3; z++) T[z][x] -= dp * T[z][y];
}
transmatrix view_to_space = inverse(space_to_view);
using namespace hyperpoint_vec;
hyperpoint shift = /* inverse(V) * T * V * C0; */ view_to_space * T * C0;