1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-09 15:39:55 +00:00

sl2:: fixes to ggmatrix

This commit is contained in:
Zeno Rogue 2024-07-15 13:30:27 +02:00
parent 35e48f5eb2
commit 72501c20f6
2 changed files with 8 additions and 11 deletions

View File

@ -203,12 +203,9 @@ transmatrix hrmap_standard::relative_matrixh(heptagon *h2, heptagon *h1, const h
EX shiftmatrix &ggmatrix(cell *c) { EX shiftmatrix &ggmatrix(cell *c) {
shiftmatrix& t = gmatrix[c]; shiftmatrix& t = gmatrix[c];
if(t[LDIM][LDIM] == 0) { if(t[LDIM][LDIM] == 0) {
if(sl2) return t = twist::nmul(shiftless(actual_view_transform * View), twist::relative_shiftmatrix(c, centerover));
t.T = actual_view_transform * View * calc_relative_matrix(c, centerover, C0); t.T = actual_view_transform * View * calc_relative_matrix(c, centerover, C0);
t.shift = 0; t.shift = 0;
if(sl2) {
ld d = twist::get_phase_difference(c, centerover);
t.shift = floor(d / TAU + .5) * TAU;
}
} }
return t; return t;
} }

View File

@ -2465,16 +2465,16 @@ EX namespace twist {
return M = lift_matrix(PIU(currentmap->adj(cw, i))); return M = lift_matrix(PIU(currentmap->adj(cw, i)));
} }
shiftmatrix relative_shiftmatrix(cell *c2, cell *c1) {
return nmul(ninverse(recorded_matrices[c1]), recorded_matrices[c2]);
}
transmatrix relative_matrixc(cell *c2, cell *c1, const hyperpoint& hint) override { transmatrix relative_matrixc(cell *c2, cell *c1, const hyperpoint& hint) override {
if(c1 == c2) return Id; if(c1 == c2) return Id;
if(gmatrix0.count(c2) && gmatrix0.count(c1)) if(gmatrix0.count(c2) && gmatrix0.count(c1))
return inverse_shift(gmatrix0[c1], gmatrix0[c2]); return inverse_shift(gmatrix0[c1], gmatrix0[c2]);
for(int i=0; i<c1->type; i++) if(c1->move(i) == c2) return adj(c1, i); for(int i=0; i<c1->type; i++) if(c1->move(i) == c2) return adj(c1, i);
return inverse_shift(recorded_matrices[c2], recorded_matrices[c1]); return inverse_shift(recorded_matrices[c1], recorded_matrices[c2]);
}
ld get_phase_difference(cell *c2, cell *c1) {
return recorded_matrices.at(c2).shift - recorded_matrices.at(c1).shift;
} }
transmatrix ray_iadj(cell *c1, int i) override { transmatrix ray_iadj(cell *c1, int i) override {
@ -2514,9 +2514,9 @@ EX namespace twist {
} }
} }
EX ld get_phase_difference(cell *c2, cell *c1) { EX shiftmatrix relative_shiftmatrix(cell *c2, cell *c1) {
auto hmap = dynamic_cast<hrmap_twisted*> (currentmap); auto hmap = dynamic_cast<hrmap_twisted*> (currentmap);
return hmap->get_phase_difference(c2, c1); return hmap->relative_shiftmatrix(c2, c1);
} }
/** reinterpret the given point of rotspace as a rotation matrix in the underlying geometry (note: this is the inverse) /** reinterpret the given point of rotspace as a rotation matrix in the underlying geometry (note: this is the inverse)