1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-20 03:54:47 +00:00

when switching dimension in arb/fake, the correct geometry is used for fixmatrix

This commit is contained in:
Zeno Rogue 2021-08-05 13:17:40 +02:00
parent 51ad054012
commit 14afd51049

View File

@ -526,6 +526,13 @@ EX bool use_gmatrix = true;
EX geometry_information *alt_cgip; EX geometry_information *alt_cgip;
EX geometry_information *find_alt_cgip() {
if(alt_cgip) return alt_cgip;
check_cgi();
cgi.require_basics();
return alt_cgip = cgip;
}
struct hrmap_archimedean : hrmap { struct hrmap_archimedean : hrmap {
map<gp::loc, struct cdata> eucdata; map<gp::loc, struct cdata> eucdata;
heptagon *origin; heptagon *origin;
@ -547,17 +554,12 @@ struct hrmap_archimedean : hrmap {
if(hyperbolic) { if(hyperbolic) {
dynamicval<eGeometry> g(geometry, gNormal); dynamicval<eGeometry> g(geometry, gNormal);
dynamicval<eVariation> gv(variation, eVariation::pure); dynamicval<eVariation> gv(variation, eVariation::pure);
if(1) { dynamicval<geometry_information*> gi(cgip, find_alt_cgip());
dynamicval<geometry_information*> gi(cgip, cgip);
check_cgi();
cgi.require_basics();
alt_cgip = cgip;
alt = init_heptagon(S7); alt = init_heptagon(S7);
alt->s = hsOrigin; alt->s = hsOrigin;
alt->alt = alt; alt->alt = alt;
current_altmap = newAltMap(alt); current_altmap = newAltMap(alt);
} }
}
transmatrix T = xpush(.01241) * spin(1.4117) * xpush(0.1241) * Id; transmatrix T = xpush(.01241) * spin(1.4117) * xpush(0.1241) * Id;
archimedean_gmatrix[origin] = make_pair(alt, T); archimedean_gmatrix[origin] = make_pair(alt, T);
@ -601,7 +603,7 @@ struct hrmap_archimedean : hrmap {
if(current_altmap) { if(current_altmap) {
dynamicval<eGeometry> g(geometry, gNormal); dynamicval<eGeometry> g(geometry, gNormal);
dynamicval<eVariation> gv(variation, eVariation::pure); dynamicval<eVariation> gv(variation, eVariation::pure);
dynamicval<geometry_information*> gi(cgip, alt_cgip); dynamicval<geometry_information*> gi(cgip, find_alt_cgip());
delete current_altmap; delete current_altmap;
current_altmap = NULL; current_altmap = NULL;
} }
@ -632,7 +634,7 @@ struct hrmap_archimedean : hrmap {
if(hyperbolic) { if(hyperbolic) {
dynamicval<eGeometry> g(geometry, gNormal); dynamicval<eGeometry> g(geometry, gNormal);
dynamicval<eVariation> gv(variation, eVariation::pure); dynamicval<eVariation> gv(variation, eVariation::pure);
dynamicval<geometry_information*> gi(cgip, alt_cgip); dynamicval<geometry_information*> gi(cgip, find_alt_cgip());
dynamicval<hrmap*> cm(currentmap, current_altmap); dynamicval<hrmap*> cm(currentmap, current_altmap);
U = T; U = T;
current_altmap->virtualRebase(alt, T); current_altmap->virtualRebase(alt, T);
@ -1040,8 +1042,15 @@ auto hook =
#if MAXMDIM >= 4 #if MAXMDIM >= 4
auto hooksw = addHook(hooks_swapdim, 100, [] { auto hooksw = addHook(hooks_swapdim, 100, [] {
dynamicval<eGeometry> g(geometry, gNormal);
dynamicval<eVariation> gv(variation, eVariation::pure);
dynamicval<geometry_information*> gi(cgip, find_alt_cgip());
for(auto& p: altmap) for(auto& pp: p.second) swapmatrix(pp.second); for(auto& p: altmap) for(auto& pp: p.second) swapmatrix(pp.second);
for(auto& p: archimedean_gmatrix) swapmatrix(p.second.second); for(auto& p: archimedean_gmatrix) swapmatrix(p.second.second);
alt_cgip = nullptr;
}); });
#endif #endif