diff --git a/cell.cpp b/cell.cpp index c3a71c4a..568febcc 100644 --- a/cell.cpp +++ b/cell.cpp @@ -98,6 +98,7 @@ struct hrmap_standard : hrmap { virtual hyperpoint get_corner(cell *c, int cid, ld cf) override; virtual transmatrix master_relative(cell *c, bool get_inverse) override; virtual bool link_alt(heptagon *h, heptagon *alt, hstate firststate, int dir) override; + virtual void on_dim_change(); }; void clearfrom(heptagon*); @@ -118,6 +119,11 @@ struct hrmap_hyperbolic : hrmap_standard { }; #endif +void hrmap_standard::on_dim_change() { + for(auto& p: gp::gp_swapped) swapmatrix(gp::gp_adj[p]); + gp::gp_swapped.clear(); + } + double hrmap::spacedist(cell *c, int i) { return hdist(tile_center(), adj(c, i) * tile_center()); } heptagon *hrmap::create_step(heptagon *h, int direction) { @@ -542,7 +548,11 @@ EX void initcells() { DEBB(DF_INIT, ("initcells")); if(embedded_plane) { + geom3::swap_direction = -1; + for(auto& m: cgi.heptmove) swapmatrix(m); IPF(initcells()); + geom3::swap_direction = +1; + for(auto& m: cgi.heptmove) swapmatrix(m); currentmap->on_dim_change(); return; } diff --git a/goldberg.cpp b/goldberg.cpp index 33591c84..9baf0f94 100644 --- a/goldberg.cpp +++ b/goldberg.cpp @@ -274,6 +274,8 @@ EX namespace gp { if(do_adjm) { get_adj(wcw.at, wcw.spin) = inverse(wc.adjm) * wc1.adjm; get_adj(wcw1.at, wcw1.spin) = inverse(wc1.adjm) * wc.adjm; + if(geom3::flipped) gp_swapped.emplace(wcw.at, wcw.spin); + if(geom3::flipped) gp_swapped.emplace(wcw1.at, wcw1.spin); } } @@ -283,6 +285,7 @@ EX namespace gp { } EX map, transmatrix> gp_adj; + EX set> gp_swapped; EX transmatrix& get_adj(cell *c, int i) { return gp_adj[make_pair(c,i)]; } diff --git a/sphere.cpp b/sphere.cpp index 1d628132..1d7968e2 100644 --- a/sphere.cpp +++ b/sphere.cpp @@ -172,7 +172,10 @@ struct hrmap_spherical : hrmap_standard { return Id; } - void on_dim_change() override { where.clear(); } + void on_dim_change() override { + hrmap_standard::on_dim_change(); + where.clear(); + } transmatrix relative_matrixc(cell *c2, cell *c1, const hyperpoint& hint) override { transmatrix T = iso_inverse(get_where(c1)) * get_where(c2);