mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-25 01:20:37 +00:00
cth to handle heptspin/cellwalker translations in a nice way
This commit is contained in:
parent
993ef1b164
commit
a04eef75a9
@ -438,7 +438,7 @@ struct hrmap_archimedean : hrmap {
|
|||||||
|
|
||||||
parent_index_of(origin) = DUAL ? 1 : 0;
|
parent_index_of(origin) = DUAL ? 1 : 0;
|
||||||
id_of(origin) = id;
|
id_of(origin) = id;
|
||||||
origin->c7 = newCell(DUAL ? N0/2 : N0, origin);
|
origin->c7 = newCell(N0/DUALMUL, origin);
|
||||||
|
|
||||||
heptagon *alt = NULL;
|
heptagon *alt = NULL;
|
||||||
|
|
||||||
@ -517,7 +517,7 @@ heptagon *build_child(heptspin p, pair<int, int> adj) {
|
|||||||
id_of(h) = adj.first;
|
id_of(h) = adj.first;
|
||||||
parent_index_of(h) = adj.second;
|
parent_index_of(h) = adj.second;
|
||||||
int nei = neighbors_of(h);
|
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;
|
h->distance = p.at->distance + 1;
|
||||||
if(adj.first < 2*current.N && !DUAL) {
|
if(adj.first < 2*current.N && !DUAL) {
|
||||||
int s = 0;
|
int s = 0;
|
||||||
|
2
cell.cpp
2
cell.cpp
@ -1259,7 +1259,7 @@ cdata *getHeptagonCdata(heptagon *h) {
|
|||||||
cdata mydata = *getHeptagonCdata(h->move(0));
|
cdata mydata = *getHeptagonCdata(h->move(0));
|
||||||
|
|
||||||
for(int di=3; di<5; di++) {
|
for(int di=3; di<5; di++) {
|
||||||
heptspin hs; hs.at = h; hs.spin = di;
|
heptspin hs(h, di, false);
|
||||||
int signum = +1;
|
int signum = +1;
|
||||||
while(true) {
|
while(true) {
|
||||||
heptspin hstab[15];
|
heptspin hstab[15];
|
||||||
|
20
complex.cpp
20
complex.cpp
@ -1155,7 +1155,7 @@ namespace mirror {
|
|||||||
heptspin hs1 = hs + i;
|
heptspin hs1 = hs + i;
|
||||||
if(lev == 0) {
|
if(lev == 0) {
|
||||||
if(hs1.at != hs0.at && equal(hs1, hs0, 3)) {
|
if(hs1.at != hs0.at && equal(hs1, hs0, 3)) {
|
||||||
createMirror(cellwalker(hs1.at->c7, hs1.spin, hs1.mirrored), cpid);
|
createMirror(hs1 + cth, cpid);
|
||||||
result++;
|
result++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1165,7 +1165,7 @@ namespace mirror {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void create_archimedean(cellwalker cw, int cpid, bool mirrored) {
|
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;
|
heptspin hsx = hs;
|
||||||
if(mirrored) hsx += wmirror;
|
if(mirrored) hsx += wmirror;
|
||||||
if(create_archimedean_rec(hsx, cpid, hs, 2)) return;
|
if(create_archimedean_rec(hsx, cpid, hs, 2)) return;
|
||||||
@ -1185,9 +1185,7 @@ namespace mirror {
|
|||||||
|
|
||||||
if(GOLDBERG) {
|
if(GOLDBERG) {
|
||||||
for(int i=0; i<cw.at->type; i++) {
|
for(int i=0; i<cw.at->type; i++) {
|
||||||
heptspin hs(cw.at->master, cw.spin, cw.mirrored);
|
createMirror(cw + cth + i + wstep + i - (gp::param.first == gp::param.second ? 1 : 0) + cth, cpid);
|
||||||
hs = hs + i + wstep + i - (gp::param.first == gp::param.second ? 1 : 0);
|
|
||||||
createMirror(cellwalker(hs.at->c7, hs.spin, hs.mirrored), cpid);
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1206,17 +1204,13 @@ namespace mirror {
|
|||||||
}
|
}
|
||||||
if(GOLDBERG && !(S7 & 1)) {
|
if(GOLDBERG && !(S7 & 1)) {
|
||||||
for(int i=0; i<cw.at->type; i++) {
|
for(int i=0; i<cw.at->type; i++) {
|
||||||
heptspin hs(cw.at->master, cw.spin, cw.mirrored);
|
createMirror(cw + cth + i + wstep + 1 + wstep + 1 + (S7/2) - i + 1 + cth, cpid);
|
||||||
hs = hs + i + wstep + 1 + wstep + 1 + (S7/2) - i + 1;
|
|
||||||
createMirror(cellwalker(hs.at->c7, hs.spin, hs.mirrored), cpid);
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(GOLDBERG && (S7 & 1)) {
|
if(GOLDBERG && (S7 & 1)) {
|
||||||
for(int i=0; i<cw.at->type; i++) {
|
for(int i=0; i<cw.at->type; i++) {
|
||||||
heptspin hs(cw.at->master, cw.spin, cw.mirrored);
|
createMirror(cw + cth + i + wstep + (S7/2) + wstep - 2 + wstep + (S7/2) - i + cth, cpid);
|
||||||
hs = hs + i + wstep + (S7/2) + wstep - 2 + wstep + (S7/2) - i;
|
|
||||||
createMirror(cellwalker(hs.at->c7, hs.spin, hs.mirrored), cpid);
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3201,9 +3195,7 @@ namespace windmap {
|
|||||||
auto &v = neighbors.back();
|
auto &v = neighbors.back();
|
||||||
if(NONSTDVAR && !sphere && !archimedean)
|
if(NONSTDVAR && !sphere && !archimedean)
|
||||||
for(int l=0; l<S7; l++) {
|
for(int l=0; l<S7; l++) {
|
||||||
heptspin hs(cw.at->master, cw.spin);
|
v.push_back(getId(cw + cth + l + wstep + cth));
|
||||||
hs = hs + l + wstep;
|
|
||||||
v.push_back(getId(cellwalker(hs.at->c7, hs.spin)));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
for(int l=0; l<cw.at->type; l++) v.push_back(getId(cw+l+wstep));
|
for(int l=0; l<cw.at->type; l++) v.push_back(getId(cw+l+wstep));
|
||||||
|
@ -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]);
|
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) {
|
if(BITRUNCATED || DUAL) {
|
||||||
int mul = DUAL ? 2 : 1;
|
int mul = DUALMUL;
|
||||||
auto &ac = arcm::current;
|
auto &ac = arcm::current;
|
||||||
auto adj = ac.get_adj(c->master, i * mul);
|
auto adj = ac.get_adj(c->master, i * mul);
|
||||||
heptagon h; cell cx; cx.master = &h;
|
heptagon h; cell cx; cx.master = &h;
|
||||||
|
4
hyper.h
4
hyper.h
@ -538,6 +538,10 @@ int heptagon::degree() { if(archimedean) return arcm::degree(this); else return
|
|||||||
typedef walker<heptagon> heptspin;
|
typedef walker<heptagon> heptspin;
|
||||||
typedef walker<cell> cellwalker;
|
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
|
#define BUGCOLORS 3
|
||||||
|
|
||||||
// land completion for shared unlocking
|
// land completion for shared unlocking
|
||||||
|
@ -807,7 +807,7 @@ void optimizeview() {
|
|||||||
if(binarytiling || archimedean) {
|
if(binarytiling || archimedean) {
|
||||||
turn = -1, best = View[2][2];
|
turn = -1, best = View[2][2];
|
||||||
for(int i=0; i<viewctr.at->c7->type; i++) {
|
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);
|
heptagon *h2 = createStep(viewctr.at, i1);
|
||||||
transmatrix T = (binarytiling) ? binary::relative_matrix(h2, viewctr.at) : arcm::relative_matrix(h2, viewctr.at);
|
transmatrix T = (binarytiling) ? binary::relative_matrix(h2, viewctr.at) : arcm::relative_matrix(h2, viewctr.at);
|
||||||
hyperpoint H = View * tC0(T);
|
hyperpoint H = View * tC0(T);
|
||||||
|
Loading…
Reference in New Issue
Block a user