cth to handle heptspin/cellwalker translations in a nice way

This commit is contained in:
Zeno Rogue 2018-08-30 16:04:28 +02:00
parent 993ef1b164
commit a04eef75a9
6 changed files with 15 additions and 19 deletions

View File

@ -438,7 +438,7 @@ struct hrmap_archimedean : hrmap {
parent_index_of(origin) = DUAL ? 1 : 0;
id_of(origin) = id;
origin->c7 = newCell(DUAL ? N0/2 : N0, origin);
origin->c7 = newCell(N0/DUALMUL, origin);
heptagon *alt = NULL;
@ -517,7 +517,7 @@ heptagon *build_child(heptspin p, pair<int, int> adj) {
id_of(h) = adj.first;
parent_index_of(h) = adj.second;
int nei = neighbors_of(h);
h->c7 = newCell(DUAL ? nei/2 : nei, h);
h->c7 = newCell(nei/DUALMUL, h);
h->distance = p.at->distance + 1;
if(adj.first < 2*current.N && !DUAL) {
int s = 0;

View File

@ -1259,7 +1259,7 @@ cdata *getHeptagonCdata(heptagon *h) {
cdata mydata = *getHeptagonCdata(h->move(0));
for(int di=3; di<5; di++) {
heptspin hs; hs.at = h; hs.spin = di;
heptspin hs(h, di, false);
int signum = +1;
while(true) {
heptspin hstab[15];

View File

@ -1155,7 +1155,7 @@ namespace mirror {
heptspin hs1 = hs + i;
if(lev == 0) {
if(hs1.at != hs0.at && equal(hs1, hs0, 3)) {
createMirror(cellwalker(hs1.at->c7, hs1.spin, hs1.mirrored), cpid);
createMirror(hs1 + cth, cpid);
result++;
}
}
@ -1165,7 +1165,7 @@ namespace mirror {
}
void create_archimedean(cellwalker cw, int cpid, bool mirrored) {
heptspin hs(cw.at->master, cw.spin, cw.mirrored);
heptspin hs = cw + cth;
heptspin hsx = hs;
if(mirrored) hsx += wmirror;
if(create_archimedean_rec(hsx, cpid, hs, 2)) return;
@ -1185,9 +1185,7 @@ namespace mirror {
if(GOLDBERG) {
for(int i=0; i<cw.at->type; i++) {
heptspin hs(cw.at->master, cw.spin, cw.mirrored);
hs = hs + i + wstep + i - (gp::param.first == gp::param.second ? 1 : 0);
createMirror(cellwalker(hs.at->c7, hs.spin, hs.mirrored), cpid);
createMirror(cw + cth + i + wstep + i - (gp::param.first == gp::param.second ? 1 : 0) + cth, cpid);
}
return;
}
@ -1206,17 +1204,13 @@ namespace mirror {
}
if(GOLDBERG && !(S7 & 1)) {
for(int i=0; i<cw.at->type; i++) {
heptspin hs(cw.at->master, cw.spin, cw.mirrored);
hs = hs + i + wstep + 1 + wstep + 1 + (S7/2) - i + 1;
createMirror(cellwalker(hs.at->c7, hs.spin, hs.mirrored), cpid);
createMirror(cw + cth + i + wstep + 1 + wstep + 1 + (S7/2) - i + 1 + cth, cpid);
}
return;
}
if(GOLDBERG && (S7 & 1)) {
for(int i=0; i<cw.at->type; i++) {
heptspin hs(cw.at->master, cw.spin, cw.mirrored);
hs = hs + i + wstep + (S7/2) + wstep - 2 + wstep + (S7/2) - i;
createMirror(cellwalker(hs.at->c7, hs.spin, hs.mirrored), cpid);
createMirror(cw + cth + i + wstep + (S7/2) + wstep - 2 + wstep + (S7/2) - i + cth, cpid);
}
return;
}
@ -3201,9 +3195,7 @@ namespace windmap {
auto &v = neighbors.back();
if(NONSTDVAR && !sphere && !archimedean)
for(int l=0; l<S7; l++) {
heptspin hs(cw.at->master, cw.spin);
hs = hs + l + wstep;
v.push_back(getId(cellwalker(hs.at->c7, hs.spin)));
v.push_back(getId(cw + cth + l + wstep + cth));
}
else
for(int l=0; l<cw.at->type; l++) v.push_back(getId(cw+l+wstep));

View File

@ -515,7 +515,7 @@ hyperpoint farcorner(cell *c, int i, int which) {
return spin(-t.first - M_PI / c->type) * xpush(ac.inradius[id/2] + ac.inradius[id1/2]) * xspinpush0(M_PI + M_PI/n1*(which?3:-3), ac.circumradius[id1/2]);
}
if(BITRUNCATED || DUAL) {
int mul = DUAL ? 2 : 1;
int mul = DUALMUL;
auto &ac = arcm::current;
auto adj = ac.get_adj(c->master, i * mul);
heptagon h; cell cx; cx.master = &h;

View File

@ -538,6 +538,10 @@ int heptagon::degree() { if(archimedean) return arcm::degree(this); else return
typedef walker<heptagon> heptspin;
typedef walker<cell> cellwalker;
static const struct cth_t { cth_t() {}} cth;
heptspin operator+ (cellwalker cw, cth_t) { return heptspin(cw.at->master, cw.spin * DUALMUL, cw.mirrored); }
cellwalker operator+ (heptspin hs, cth_t) { return cellwalker(hs.at->c7, hs.spin / DUALMUL, hs.mirrored); }
#define BUGCOLORS 3
// land completion for shared unlocking

View File

@ -807,7 +807,7 @@ void optimizeview() {
if(binarytiling || archimedean) {
turn = -1, best = View[2][2];
for(int i=0; i<viewctr.at->c7->type; i++) {
int i1 = i * (DUAL ? 2 : 1);
int i1 = i * DUALMUL;
heptagon *h2 = createStep(viewctr.at, i1);
transmatrix T = (binarytiling) ? binary::relative_matrix(h2, viewctr.at) : arcm::relative_matrix(h2, viewctr.at);
hyperpoint H = View * tC0(T);