mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-04-01 00:07:02 +00:00
fake:: works with coxeter
This commit is contained in:
parent
3560bcc3db
commit
81ea3d75f5
5
cell.cpp
5
cell.cpp
@ -85,6 +85,11 @@ struct hrmap {
|
||||
|
||||
/** \brief in 3D honeycombs, returns a vector<bool> v, where v[j] iff faces i and j are adjacent */
|
||||
const vector<char>& dirdist(cellwalker cw) { return get_cellshape(cw.at).dirdist[cw.spin]; }
|
||||
|
||||
/** \brief the sequence of heptagon movement direction to get from c->master to c->move(i)->master; implemented only for reg3 */
|
||||
virtual const vector<int>& get_move_seq(cell *c, int i) {
|
||||
throw hr_exception("get_move_seq not implemented for this map class");
|
||||
}
|
||||
};
|
||||
|
||||
/** hrmaps which are based on regular non-Euclidean 2D tilings, possibly quotient
|
||||
|
25
fake.cpp
25
fake.cpp
@ -34,7 +34,7 @@ EX namespace fake {
|
||||
if(arcm::in() && PURE) return true;
|
||||
if(WDIM == 2) return false;
|
||||
if(among(geometry, gBitrunc3)) return false;
|
||||
if(reg3::in() && !among(variation, eVariation::pure, eVariation::subcubes)) return false;
|
||||
if(reg3::in() && !among(variation, eVariation::pure, eVariation::subcubes, eVariation::coxeter)) return false;
|
||||
return euc::in() || reg3::in();
|
||||
}
|
||||
|
||||
@ -87,18 +87,25 @@ EX namespace fake {
|
||||
transmatrix adj(cell *c, int d) override {
|
||||
transmatrix S1, S2;
|
||||
ld dist;
|
||||
if(variation == eVariation::subcubes && c->master == c->cmove(d)->master) {
|
||||
auto& s1 = get_cellshape(c);
|
||||
auto& s2 = get_cellshape(c->move(d));
|
||||
return s1.from_cellcenter * s2.to_cellcenter;
|
||||
bool impure = reg3::in() && !PURE;
|
||||
vector<int> mseq;
|
||||
if(impure) {
|
||||
mseq = FPIU ( currentmap->get_move_seq(c, d) );
|
||||
if(mseq.empty()) {
|
||||
auto& s1 = get_cellshape(c);
|
||||
auto& s2 = get_cellshape(c->move(d));
|
||||
return s1.from_cellcenter * s2.to_cellcenter;
|
||||
}
|
||||
if(isize(mseq) > 1)
|
||||
throw hr_exception("fake adj not implemented for isize(mseq) > 1");
|
||||
}
|
||||
in_underlying([c, d, &S1, &S2, &dist] {
|
||||
in_underlying([c, d, &S1, &S2, &dist, &impure, &mseq] {
|
||||
#if CAP_ARCM
|
||||
dynamicval<bool> u(arcm::use_gmatrix, false);
|
||||
#endif
|
||||
transmatrix T;
|
||||
if(variation == eVariation::subcubes) {
|
||||
T = currentmap->adj(c->master, d);
|
||||
if(impure) {
|
||||
T = currentmap->adj(c->master, mseq[0]);
|
||||
}
|
||||
else {
|
||||
T = currentmap->adj(c, d);
|
||||
@ -109,7 +116,7 @@ EX namespace fake {
|
||||
S2 = xpush(-dist) * T1;
|
||||
});
|
||||
|
||||
if(variation == eVariation::subcubes) {
|
||||
if(impure) {
|
||||
auto& s1 = get_cellshape(c);
|
||||
auto& s2 = get_cellshape(c->move(d));
|
||||
S1 = s1.from_cellcenter * S1;
|
||||
|
10
reg3.cpp
10
reg3.cpp
@ -717,6 +717,11 @@ EX namespace reg3 {
|
||||
int id = local_id.at(cw.at).first;
|
||||
return cellwalker(cw.at->cmove(j), strafe_data[id][j][cw.spin]);
|
||||
}
|
||||
|
||||
const vector<int>& get_move_seq(cell *c, int i) override {
|
||||
int id = local_id.at(c).first;
|
||||
return move_sequences[id][i];
|
||||
}
|
||||
};
|
||||
|
||||
struct hrmap_quotient3 : hrmap_closed3 { };
|
||||
@ -2022,6 +2027,11 @@ EX namespace reg3 {
|
||||
if(PURE && res1 != res2) println(hlog, "h3: ", res1, " vs ", res2);
|
||||
return res2;
|
||||
}
|
||||
|
||||
const vector<int>& get_move_seq(cell *c, int i) override {
|
||||
int aid = cell_id.at(c);
|
||||
return quotient_map->get_move_seq(quotient_map->acells[aid], i);
|
||||
}
|
||||
};
|
||||
|
||||
struct hrmap_h3_rule_alt : hrmap {
|
||||
|
Loading…
x
Reference in New Issue
Block a user