diff --git a/geometry2.cpp b/geometry2.cpp index ad57307a..93518ec9 100644 --- a/geometry2.cpp +++ b/geometry2.cpp @@ -203,12 +203,9 @@ transmatrix hrmap_standard::relative_matrixh(heptagon *h2, heptagon *h1, const h EX shiftmatrix &ggmatrix(cell *c) { shiftmatrix& t = gmatrix[c]; 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.shift = 0; - if(sl2) { - ld d = twist::get_phase_difference(c, centerover); - t.shift = floor(d / TAU + .5) * TAU; - } } return t; } diff --git a/nonisotropic.cpp b/nonisotropic.cpp index 88a97e68..4db79e41 100644 --- a/nonisotropic.cpp +++ b/nonisotropic.cpp @@ -2465,16 +2465,16 @@ EX namespace twist { 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 { if(c1 == c2) return Id; if(gmatrix0.count(c2) && gmatrix0.count(c1)) return inverse_shift(gmatrix0[c1], gmatrix0[c2]); for(int i=0; itype; i++) if(c1->move(i) == c2) return adj(c1, i); - return inverse_shift(recorded_matrices[c2], recorded_matrices[c1]); - } - - ld get_phase_difference(cell *c2, cell *c1) { - return recorded_matrices.at(c2).shift - recorded_matrices.at(c1).shift; + return inverse_shift(recorded_matrices[c1], recorded_matrices[c2]); } 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 (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)