1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-20 23:50:27 +00:00

fixed Archimedean and Penrose

This commit is contained in:
Zeno Rogue 2019-11-28 23:59:16 +01:00
parent 2b62b23888
commit 5585831b27
5 changed files with 19 additions and 10 deletions

View File

@ -637,7 +637,11 @@ struct hrmap_archimedean : hrmap {
} }
} }
transmatrix relative_matrix(heptagon *h2, heptagon *h1) { transmatrix adj(cell *c, int dir) override {
return calc_relative_matrix(c->cmove(dir), c, C0);
}
transmatrix relative_matrix(heptagon *h2, heptagon *h1, const hyperpoint& hint) override {
if(gmatrix0.count(h2->c7) && gmatrix0.count(h1->c7)) if(gmatrix0.count(h2->c7) && gmatrix0.count(h1->c7))
return inverse(gmatrix0[h1->c7]) * gmatrix0[h2->c7]; return inverse(gmatrix0[h1->c7]) * gmatrix0[h2->c7];
transmatrix gm = Id, where = Id; transmatrix gm = Id, where = Id;

View File

@ -860,7 +860,7 @@ EX cdata *arcmCdata(cell *c) {
} }
EX int getCdata(cell *c, int j) { EX int getCdata(cell *c, int j) {
if(euclid) return getEuclidCdata(euc2_coordinates(c))->val[j]; if(euclid && !archimedean && !penrose) return getEuclidCdata(euc2_coordinates(c))->val[j];
else if(archimedean && euclid) else if(archimedean && euclid)
return getEuclidCdata(pseudocoords(c))->val[j]; return getEuclidCdata(pseudocoords(c))->val[j];
else if(archimedean && hyperbolic) else if(archimedean && hyperbolic)
@ -877,7 +877,7 @@ EX int getCdata(cell *c, int j) {
} }
EX int getBits(cell *c) { EX int getBits(cell *c) {
if(euclid) return getEuclidCdata(euc2_coordinates(c))->bits; if(euclid && !archimedean && !penrose) return getEuclidCdata(euc2_coordinates(c))->bits;
else if(archimedean && euclid) else if(archimedean && euclid)
return getEuclidCdata(pseudocoords(c))->bits; return getEuclidCdata(pseudocoords(c))->bits;
else if(archimedean && (hyperbolic || sl2)) else if(archimedean && (hyperbolic || sl2))
@ -1012,7 +1012,7 @@ EX int celldistance(cell *c1, cell *c2) {
if(cryst) return crystal::precise_distance(c1, c2); if(cryst) return crystal::precise_distance(c1, c2);
#endif #endif
if(euclid && WDIM == 2) { if(euclid && WDIM == 2 && !penrose && !archimedean) {
return cyldist(euc2_coordinates(c1), euc2_coordinates(c2)); return cyldist(euc2_coordinates(c1), euc2_coordinates(c2));
} }

View File

@ -655,7 +655,9 @@ void geometry_information::generate_floorshapes() {
dynamicval<bool> ncor(approx_nearcorner, true); dynamicval<bool> ncor(approx_nearcorner, true);
for(int i=0; i<2; i++) { for(int i=0; i<2; i++) {
modelh.s = hstate(i); /* kite/dart shape */ modelh.s = hstate(i); /* kite/dart shape */
kite::no_adj = true;
generate_floorshapes_for(i, &model, 0, 0); generate_floorshapes_for(i, &model, 0, 0);
kite::no_adj = false;
} }
} }
#endif #endif

View File

@ -381,7 +381,7 @@ EX int fieldval_uniq(cell *c) {
if(ctof(c)) return c->master->fieldval; if(ctof(c)) return c->master->fieldval;
else return createMov(c, 0)->master->fieldval + 256 * createMov(c,2)->master->fieldval + (1<<16) * createMov(c,4)->master->fieldval; else return createMov(c, 0)->master->fieldval + 256 * createMov(c,2)->master->fieldval + (1<<16) * createMov(c,4)->master->fieldval;
} }
else if(euclid) { else if(euclid && !penrose && !archimedean) {
auto p = euc2_coordinates(c); auto p = euc2_coordinates(c);
if(bounded) return p.first + (p.second << 16); if(bounded) return p.first + (p.second << 16);
return gmod(p.first - 22 * p.second, 3*127); return gmod(p.first - 22 * p.second, 3*127);
@ -829,8 +829,8 @@ EX namespace patterns {
else if(a46) val46(c, si, sub, pat); else if(a46) val46(c, si, sub, pat);
else if(a38) val38(c, si, sub, pat); else if(a38) val38(c, si, sub, pat);
else if(sphere && S3 == 3) valSibling(c, si, sub, pat); else if(sphere && S3 == 3) valSibling(c, si, sub, pat);
else if(euclid4) valEuclid4(c, si, sub); else if(euclid4 && !penrose && !archimedean) valEuclid4(c, si, sub);
else if(euclid) valEuclid6(c, si, sub); else if(euclid6 && !penrose && !archimedean) valEuclid6(c, si, sub);
else if(a4) val457(c, si, sub); else if(a4) val457(c, si, sub);
else si.symmetries = ctof(c) ? 1 : 2; else si.symmetries = ctof(c) ? 1 : 2;
} }
@ -911,7 +911,7 @@ EX namespace patterns {
val_warped(c, si); val_warped(c, si);
else { else {
si.id = pseudohept(c) ? 1 : 0; si.id = pseudohept(c) ? 1 : 0;
if(euclid) { if(euclid && !penrose && !archimedean) {
si.dir = ishex1(c) ? 0 : 3; si.dir = ishex1(c) ? 0 : 3;
if(ctof(c)) si.symmetries = 3; if(ctof(c)) si.symmetries = 3;
if(subpattern_flags & SPF_EXTRASYM) if(subpattern_flags & SPF_EXTRASYM)

View File

@ -135,6 +135,8 @@ EX pair<vector<vector<hyperpoint>>, vector<vector<ld>>> make_walls() {
inline void print(hstream& hs, pshape sh) { print(hs, sh == pKite ? "pKite" : "pDart"); } inline void print(hstream& hs, pshape sh) { print(hs, sh == pKite ? "pKite" : "pDart"); }
EX bool no_adj;
struct hrmap_kite : hrmap { struct hrmap_kite : hrmap {
transmatrix pKite1, pKite2, pKite3, pDart1, pDart2, ipKite1, ipKite2, ipKite3, ipDart1, ipDart2; transmatrix pKite1, pKite2, pKite3, pDart1, pDart2, ipKite1, ipKite2, ipKite3, ipDart1, ipDart2;
@ -294,7 +296,8 @@ struct hrmap_kite : hrmap {
graphrule(pKite, 11, pDart, 5, ipKite1 * ipDart1 * pDart2 * pDart2 * pDart2); graphrule(pKite, 11, pDart, 5, ipKite1 * ipDart1 * pDart2 * pDart2 * pDart2);
} }
const transmatrix& tmatrix(cell *c, int dir) { transmatrix adj(cell *c, int dir) override {
if(no_adj) return Id;
auto c1 = c->cmove(dir); auto c1 = c->cmove(dir);
auto code = encode(getshape(c->master), dir, getshape(c1->master), c->c.spin(dir)); auto code = encode(getshape(c->master), dir, getshape(c1->master), c->c.spin(dir));
if(!graphrules.count(code)) { if(!graphrules.count(code)) {
@ -355,7 +358,7 @@ struct hrmap_kite : hrmap {
drawcell(c, V); drawcell(c, V);
for(int i=0; i<c->type; i++) for(int i=0; i<c->type; i++)
dq::enqueue(c->cmove(i)->master, V * tmatrix(c, i)); dq::enqueue(c->cmove(i)->master, V * adj(c, i));
/* /*
ld err = hdist(where[h->c7->cmove(i)->master] * C0, where[h] * M * C0); ld err = hdist(where[h->c7->cmove(i)->master] * C0, where[h] * M * C0);
if(err > -.01) if(err > -.01)