From 14afd51049995e99d84615405a74c332615faf2e Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Thu, 5 Aug 2021 13:17:40 +0200 Subject: [PATCH] when switching dimension in arb/fake, the correct geometry is used for fixmatrix --- archimedean.cpp | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/archimedean.cpp b/archimedean.cpp index a2978117..e59eac96 100644 --- a/archimedean.cpp +++ b/archimedean.cpp @@ -526,6 +526,13 @@ EX bool use_gmatrix = true; 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 { map eucdata; heptagon *origin; @@ -547,16 +554,11 @@ struct hrmap_archimedean : hrmap { if(hyperbolic) { dynamicval g(geometry, gNormal); dynamicval gv(variation, eVariation::pure); - if(1) { - dynamicval gi(cgip, cgip); - check_cgi(); - cgi.require_basics(); - alt_cgip = cgip; - alt = init_heptagon(S7); - alt->s = hsOrigin; - alt->alt = alt; - current_altmap = newAltMap(alt); - } + dynamicval gi(cgip, find_alt_cgip()); + alt = init_heptagon(S7); + alt->s = hsOrigin; + alt->alt = alt; + current_altmap = newAltMap(alt); } transmatrix T = xpush(.01241) * spin(1.4117) * xpush(0.1241) * Id; @@ -601,7 +603,7 @@ struct hrmap_archimedean : hrmap { if(current_altmap) { dynamicval g(geometry, gNormal); dynamicval gv(variation, eVariation::pure); - dynamicval gi(cgip, alt_cgip); + dynamicval gi(cgip, find_alt_cgip()); delete current_altmap; current_altmap = NULL; } @@ -632,7 +634,7 @@ struct hrmap_archimedean : hrmap { if(hyperbolic) { dynamicval g(geometry, gNormal); dynamicval gv(variation, eVariation::pure); - dynamicval gi(cgip, alt_cgip); + dynamicval gi(cgip, find_alt_cgip()); dynamicval cm(currentmap, current_altmap); U = T; current_altmap->virtualRebase(alt, T); @@ -1040,8 +1042,15 @@ auto hook = #if MAXMDIM >= 4 auto hooksw = addHook(hooks_swapdim, 100, [] { + + dynamicval g(geometry, gNormal); + dynamicval gv(variation, eVariation::pure); + dynamicval gi(cgip, find_alt_cgip()); + for(auto& p: altmap) for(auto& pp: p.second) swapmatrix(pp.second); for(auto& p: archimedean_gmatrix) swapmatrix(p.second.second); + + alt_cgip = nullptr; }); #endif