mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-02-24 23:10:09 +00:00
fixed the combinations of Archimedean, fake, and embedding
This commit is contained in:
parent
e68cd6736e
commit
59dd09173a
@ -432,7 +432,6 @@ void archimedean_tiling::compute_geometry() {
|
||||
if(gg.kind == gcHyperbolic) arr[gArchimedean].g = arr[gNormal].g;
|
||||
set_flag(arr[gArchimedean].flags, qCLOSED, gg.kind == gcSphere);
|
||||
}
|
||||
if(geom3::flipped) swap(geom3::ginf_backup[gArchimedean].g, ginf[gArchimedean].g);
|
||||
|
||||
DEBB(DF_GEOM, (format("euclidean_angle_sum = %f\n", float(euclidean_angle_sum))));
|
||||
|
||||
@ -573,13 +572,14 @@ EX bool use_gmatrix = true;
|
||||
* not used by arcm itself, but used in fake arcm
|
||||
*/
|
||||
|
||||
EX geometry_information *alt_cgip;
|
||||
EX geometry_information *alt_cgip[2];
|
||||
|
||||
EX geometry_information *find_alt_cgip() {
|
||||
if(alt_cgip) return alt_cgip;
|
||||
auto& galt_cgip = alt_cgip[embedded_plane];
|
||||
if(galt_cgip) return galt_cgip;
|
||||
check_cgi();
|
||||
cgi.require_basics();
|
||||
return alt_cgip = cgip;
|
||||
return galt_cgip = cgip;
|
||||
}
|
||||
|
||||
struct hrmap_archimedean : hrmap {
|
||||
@ -601,16 +601,24 @@ struct hrmap_archimedean : hrmap {
|
||||
heptagon *alt = NULL;
|
||||
|
||||
if(hyperbolic) {
|
||||
dynamicval<eGeometry> g(geometry, gNormal);
|
||||
dynamicval<eVariation> gv(variation, eVariation::pure);
|
||||
dynamicval<geometry_information*> gi(cgip, find_alt_cgip());
|
||||
alt = init_heptagon(S7);
|
||||
alt->s = hsOrigin;
|
||||
alt->alt = alt;
|
||||
current_altmap = newAltMap(alt);
|
||||
bool f = geom3::flipped;
|
||||
if(f) geom3::light_flip(false);
|
||||
if(1) {
|
||||
dynamicval<eGeometry> g(geometry, gNormal);
|
||||
dynamicval<eVariation> gv(variation, eVariation::pure);
|
||||
dynamicval<geometry_information*> gi(cgip, find_alt_cgip());
|
||||
alt = init_heptagon(S7);
|
||||
alt->s = hsOrigin;
|
||||
alt->alt = alt;
|
||||
current_altmap = newAltMap(alt);
|
||||
}
|
||||
if(f) geom3::light_flip(true);
|
||||
}
|
||||
|
||||
bool f = geom3::flipped;
|
||||
if(f) geom3::light_flip(false);
|
||||
transmatrix T = lxpush(.01241) * spin(1.4117) * lxpush(0.1241) * Id;
|
||||
if(f) geom3::light_flip(true);
|
||||
archimedean_gmatrix[origin] = make_pair(alt, T);
|
||||
altmap[alt].emplace_back(origin, T);
|
||||
|
||||
@ -661,6 +669,19 @@ struct hrmap_archimedean : hrmap {
|
||||
|
||||
heptagon *create_step(heptagon *h, int d) override {
|
||||
|
||||
bool f = geom3::flipped;
|
||||
if(f) {
|
||||
dynamicval<int> uc(cgip->use_count, cgip->use_count+1);
|
||||
auto bcgip = cgip;
|
||||
geom3::light_flip(false);
|
||||
check_cgi();
|
||||
cgi.require_basics();
|
||||
auto h1 = create_step(h, d);
|
||||
geom3::light_flip(true);
|
||||
cgip = bcgip;
|
||||
return h1;
|
||||
}
|
||||
|
||||
DEBB(DF_GEOM, (heptspin(h,d), " ~ ?"));
|
||||
|
||||
dynamicval<geometryinfo1> gi(ginf[geometry].g, ginf[gArchimedean].g);
|
||||
@ -672,15 +693,16 @@ struct hrmap_archimedean : hrmap {
|
||||
auto& t1 = current.get_triangle(hi);
|
||||
|
||||
// * spin(-tri[id][pi+i].first) * lxpush(t.second) * pispin * spin(tri[id'][p'+d'].first)
|
||||
|
||||
|
||||
auto& p1 = archimedean_gmatrix[h];
|
||||
|
||||
heptagon *alt = p1.first;
|
||||
|
||||
transmatrix T = p1.second * spin(-t1.first) * lxpush(t1.second);
|
||||
transmatrix U = Id;
|
||||
|
||||
|
||||
if(hyperbolic) {
|
||||
dynamicval<int> uc(cgip->use_count, cgip->use_count+1);
|
||||
dynamicval<eGeometry> g(geometry, gNormal);
|
||||
dynamicval<eVariation> gv(variation, eVariation::pure);
|
||||
dynamicval<geometry_information*> gi(cgip, find_alt_cgip());
|
||||
@ -1096,12 +1118,17 @@ auto hooksw = addHook(hooks_swapdim, 100, [] {
|
||||
|
||||
dynamicval<eGeometry> g(geometry, gNormal);
|
||||
dynamicval<eVariation> gv(variation, eVariation::pure);
|
||||
|
||||
alt_cgip[0] = nullptr;
|
||||
alt_cgip[1] = nullptr;
|
||||
|
||||
dynamicval<geometry_information*> 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;
|
||||
alt_cgip[0] = nullptr;
|
||||
alt_cgip[1] = nullptr;
|
||||
});
|
||||
#endif
|
||||
|
||||
|
2
cell.cpp
2
cell.cpp
@ -554,8 +554,10 @@ EX void initcells() {
|
||||
|
||||
if(embedded_plane) {
|
||||
geom3::swap_direction = -1;
|
||||
check_cgi();
|
||||
for(auto& m: cgi.heptmove) swapmatrix(m);
|
||||
IPF(initcells());
|
||||
check_cgi();
|
||||
geom3::swap_direction = +1;
|
||||
for(auto& m: cgi.heptmove) swapmatrix(m);
|
||||
currentmap->on_dim_change();
|
||||
|
@ -132,13 +132,30 @@ EX namespace geom3 {
|
||||
|
||||
EX geometry_information* unflipped;
|
||||
|
||||
EX void light_flip_geom() {
|
||||
indenter ind(2);
|
||||
swap(ginf[geometry].g, geom3::ginf_backup[geometry].g);
|
||||
swap(ginf[geometry].flags, geom3::ginf_backup[geometry].flags);
|
||||
if(fake::in()) {
|
||||
// println(hlog, "warning: flipping while still in fake");
|
||||
FPIU(light_flip_geom());
|
||||
}
|
||||
// hyperbolic arcm needs gNormal for cdata. Also swap gSphere and gEuclid for compute_geometry
|
||||
else if(arcm::in()) {
|
||||
dynamicval<eGeometry> g(geometry, gNormal); light_flip_geom();
|
||||
geometry = gSphere; light_flip_geom();
|
||||
geometry = gEuclid; light_flip_geom();
|
||||
}
|
||||
}
|
||||
|
||||
EX void light_flip(bool f) {
|
||||
if(f != flipped) {
|
||||
if(!flipped) cgip->use_count++;
|
||||
if(!flipped) unflipped = cgip;
|
||||
swap(ginf[geometry].g, geom3::ginf_backup[geometry].g);
|
||||
swap(ginf[geometry].flags, geom3::ginf_backup[geometry].flags);
|
||||
if(!flipped) cgip = unflipped;
|
||||
light_flip_geom();
|
||||
flipped = f;
|
||||
if(!flipped) cgip = unflipped;
|
||||
if(!flipped) cgip->use_count--;
|
||||
}
|
||||
}
|
||||
|
||||
@ -165,40 +182,43 @@ EX namespace geom3 {
|
||||
}
|
||||
if(vid.always3 && ginf_backup.empty()) {
|
||||
ginf_backup = ginf;
|
||||
for(geometryinfo& gi: ginf) {
|
||||
auto &g = gi.g;
|
||||
if(vid.always3 && g.gameplay_dimension == 2 && g.graphical_dimension == 2) {
|
||||
/* same-in-same by default */
|
||||
auto og = g;
|
||||
g.graphical_dimension++;
|
||||
g.homogeneous_dimension++;
|
||||
g.sig[3] = g.sig[2];
|
||||
g.sig[2] = g.sig[1];
|
||||
for(geometryinfo& gi: ginf)
|
||||
apply_always3_to(gi);
|
||||
}
|
||||
}
|
||||
|
||||
bool ieuclid = g.kind == gcEuclid;
|
||||
bool isphere = g.kind == gcSphere;
|
||||
bool ieuc_or_binary = ieuclid || (gi.flags & qBINARY);
|
||||
EX void apply_always3_to(geometryinfo& gi) {
|
||||
auto &g = gi.g;
|
||||
if(vid.always3 && g.gameplay_dimension == 2 && g.graphical_dimension == 2) {
|
||||
/* same-in-same by default */
|
||||
auto og = g;
|
||||
g.graphical_dimension++;
|
||||
g.homogeneous_dimension++;
|
||||
g.sig[3] = g.sig[2];
|
||||
g.sig[2] = g.sig[1];
|
||||
|
||||
if(spatial_embedding == seProduct && !ieuclid) g = giProduct, g.sig[2] = og.sig[2];
|
||||
if(spatial_embedding == seProductH && ieuclid) g = giProductH;
|
||||
if(spatial_embedding == seProductS && ieuclid) g = giProductS;
|
||||
if(spatial_embedding == seLowerCurvature) g = (isphere ? giEuclid3 : giHyperb3);
|
||||
if(spatial_embedding == seMuchLowerCurvature) g = giHyperb3;
|
||||
if(spatial_embedding == seNil && ieuclid) g = giNil;
|
||||
if(spatial_embedding == seCliffordTorus && ieuclid) g = giSphere3;
|
||||
if(spatial_embedding == seSol && ieuc_or_binary) g = giSol;
|
||||
if(spatial_embedding == seNIH && ieuc_or_binary) g = giNIH;
|
||||
if(spatial_embedding == seSolN && ieuc_or_binary) g = giSolN;
|
||||
if(spatial_embedding == seSL2 && ieuclid) g = giSL2;
|
||||
if(spatial_embedding == seCylinderH && ieuclid) g = giHyperb3;
|
||||
if(spatial_embedding == seCylinderHE && ieuclid) g = giProductH;
|
||||
if(spatial_embedding == seCylinderHoro && ieuclid) g = giProductH;
|
||||
if(spatial_embedding == seCylinderNil && ieuclid) g = giNil;
|
||||
if(spatial_embedding == seCylinderSL2 && ieuclid) g = giSL2;
|
||||
|
||||
g.gameplay_dimension = 2;
|
||||
}
|
||||
}
|
||||
bool ieuclid = g.kind == gcEuclid;
|
||||
bool isphere = g.kind == gcSphere;
|
||||
bool ieuc_or_binary = ieuclid || (gi.flags & qBINARY);
|
||||
|
||||
if(spatial_embedding == seProduct && !ieuclid) g = giProduct, g.sig[2] = og.sig[2];
|
||||
if(spatial_embedding == seProductH && ieuclid) g = giProductH;
|
||||
if(spatial_embedding == seProductS && ieuclid) g = giProductS;
|
||||
if(spatial_embedding == seLowerCurvature) g = (isphere ? giEuclid3 : giHyperb3);
|
||||
if(spatial_embedding == seMuchLowerCurvature) g = giHyperb3;
|
||||
if(spatial_embedding == seNil && ieuclid) g = giNil;
|
||||
if(spatial_embedding == seCliffordTorus && ieuclid) g = giSphere3;
|
||||
if(spatial_embedding == seSol && ieuc_or_binary) g = giSol;
|
||||
if(spatial_embedding == seNIH && ieuc_or_binary) g = giNIH;
|
||||
if(spatial_embedding == seSolN && ieuc_or_binary) g = giSolN;
|
||||
if(spatial_embedding == seSL2 && ieuclid) g = giSL2;
|
||||
if(spatial_embedding == seCylinderH && ieuclid) g = giHyperb3;
|
||||
if(spatial_embedding == seCylinderHE && ieuclid) g = giProductH;
|
||||
if(spatial_embedding == seCylinderHoro && ieuclid) g = giProductH;
|
||||
if(spatial_embedding == seCylinderNil && ieuclid) g = giNil;
|
||||
if(spatial_embedding == seCylinderSL2 && ieuclid) g = giSL2;
|
||||
|
||||
g.gameplay_dimension = 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
20
fake.cpp
20
fake.cpp
@ -54,6 +54,7 @@ EX namespace fake {
|
||||
dynamicval<hrmap*> gpm(pmap, this);
|
||||
dynamicval<eGeometry> gag(actual_geometry, geometry);
|
||||
dynamicval<eGeometry> g(geometry, underlying);
|
||||
dynamicval<int> uc(cgip->use_count, cgip->use_count+1);
|
||||
dynamicval<geometry_information*> gc(cgip, underlying_cgip);
|
||||
dynamicval<hrmap*> gu(currentmap, underlying_map);
|
||||
return t();
|
||||
@ -90,6 +91,13 @@ EX namespace fake {
|
||||
|
||||
hyperpoint get_corner(cell *c, int cid, ld cf=3) override {
|
||||
|
||||
if(embedded_plane) {
|
||||
geom3::light_flip(true);
|
||||
hyperpoint h = get_corner(c, cid, cf);
|
||||
geom3::light_flip(false);
|
||||
return cgi.emb->base_to_actual(h);
|
||||
}
|
||||
|
||||
if(arcm::in() || hat::in()) {
|
||||
return underlying_map->get_corner(c, cid, cf);
|
||||
}
|
||||
@ -100,6 +108,12 @@ EX namespace fake {
|
||||
}
|
||||
|
||||
transmatrix adj(cell *c, int d) override {
|
||||
if(embedded_plane) {
|
||||
geom3::light_flip(true);
|
||||
transmatrix T = adj(c, d);
|
||||
geom3::light_flip(false);
|
||||
return cgi.emb->base_to_actual(T);
|
||||
}
|
||||
if(hat::in()) return underlying_map->adj(c, d);
|
||||
if(variation == eVariation::coxeter) {
|
||||
array<int, 3> which;
|
||||
@ -592,12 +606,16 @@ EX void compute_scale() {
|
||||
|
||||
ginf[gFake].g = geometry_of_curvature(good - around, WDIM);
|
||||
|
||||
geom3::apply_always3();
|
||||
ld around_ideal = 1/(1/2. - 1./get_middle());
|
||||
|
||||
bool have_ideal = abs(around_ideal - around) < 1e-6;
|
||||
if(underlying == gRhombic3 || underlying == gBitrunc3) have_ideal = false;
|
||||
|
||||
finalizer f([&] {if(vid.always3 && WDIM == 2) {
|
||||
geom3::ginf_backup[gFake] = ginf[gFake];
|
||||
geom3::apply_always3_to(ginf[gFake]);
|
||||
}});
|
||||
|
||||
if(arcm::in()) {
|
||||
ginf[gFake].tiling_name = "(" + ginf[gArchimedean].tiling_name + ")^" + fts(around / around_orig());
|
||||
return;
|
||||
|
@ -1092,6 +1092,7 @@ EX void ensure_floorshape_generated(int id, cell *c) {
|
||||
hpcshape nul; nul.s = -1;
|
||||
sizeto(cgi.shFloor.b, id, nul);
|
||||
if(cgi.shFloor.b[id].s == -1) {
|
||||
cgi.require_shapes();
|
||||
if(BITRUNCATED)
|
||||
cgi.generate_floorshapes_for(id, c, !arcm::pseudohept(c), arcm::pseudohept(c) ? 0 : 1^(id&1));
|
||||
else if(geosupport_football() == 2)
|
||||
|
@ -1335,7 +1335,8 @@ EX void check_cgi() {
|
||||
if(mhybrid) hybrid::underlying_cgip->timestamp = ntimestamp;
|
||||
if(fake::in()) fake::underlying_cgip->timestamp = ntimestamp;
|
||||
#if CAP_ARCM
|
||||
if(arcm::alt_cgip) arcm::alt_cgip->timestamp = ntimestamp;
|
||||
if(arcm::alt_cgip[0]) arcm::alt_cgip[0]->timestamp = ntimestamp;
|
||||
if(arcm::alt_cgip[1]) arcm::alt_cgip[1]->timestamp = ntimestamp;
|
||||
#endif
|
||||
|
||||
int limit = 4;
|
||||
|
Loading…
x
Reference in New Issue
Block a user