mixed infinite order

This commit is contained in:
Zeno Rogue 2020-01-19 00:13:54 +01:00
parent 4fd196c6d8
commit 24b3d17eb4
6 changed files with 79 additions and 13 deletions

View File

@ -140,12 +140,12 @@ void hrmap::generateAlts(heptagon *h, int levs, bool link_cdata) {
if(h->c7) forCellEx(c2, h->c7) preventbarriers(c2);
if(GOLDBERG)
for(int i=0; i<S7; i++) preventbarriers(createStep(h, i)->c7);
for(int i=0; i<S7; i++)
for(int i=0; i<h->type; i++)
createStep(h->alt, i)->alt = h->alt->alt;
int relspin = -4; // for horocycles it must go the other way
if(quotient) relspin = 0;
else {
for(int j=0; j<S7; j++) for(int i=0; i<S7; i++) {
for(int j=0; j<h->type; j++) for(int i=0; i<h->type; i++) {
createStep(h, i);
if(h->move(i)->alt == h->alt->move(j)) {
relspin = (i-j+S7) % S7;
@ -163,8 +163,9 @@ void hrmap::generateAlts(heptagon *h, int levs, bool link_cdata) {
} }
// h[relspin] matches alt[0]
//printf("{%d~%d}\n", h->distance, h->alt->distance);
for(int i=0; i<S7; i++) {
int ir = (S7+i-relspin)%S7;
if(h->type != h->alt->type) return;
for(int i=0; i<h->type; i++) {
int ir = gmod(i-relspin, h->type);
heptagon *hm = h->alt->move(ir);
heptagon *ho = createStep(h, i);
// printf("[%p:%d ~ %p:%d] %p ~ %p\n",
@ -241,7 +242,7 @@ EX heptagon *createAlternateMap(cell *c, int rad, hstate firststate, int special
if(!polarb50(c)) return NULL;
}
heptagon *alt = tailored_alloc<heptagon> (S7);
heptagon *alt = tailored_alloc<heptagon> (h->type);
allmaps.push_back(newAltMap(alt));
//printf("new alt {%p}\n", alt);
alt->s = firststate;

View File

@ -724,6 +724,7 @@ enum eGeometry {
gTernary, gNIH, gSolN, gInfOrder, gSpace336, gSpace344, gCrystal344,
gArnoldCat, gArbitrary, gInfOrder4, gCrystal534,
gSpace535, gSpace536, gSeifertCover, gSeifertWeber, gHomologySphere,
gInfOrderMixed,
gGUARD};
enum eGeometryClass { gcHyperbolic, gcEuclid, gcSphere, gcSolNIH, gcNil, gcProduct, gcSL2 };
@ -788,6 +789,7 @@ static const flagtype qOPTQ = Flag(19);
static const flagtype qSINGLE = Flag(20);
static const flagtype qDEPRECATED = Flag(21);
static const flagtype qINFMIXED = Flag(22);
// note: dnext assumes that x&7 equals 7
static const int SEE_ALL = 50;
@ -900,6 +902,7 @@ EX vector<geometryinfo> ginf = {
{"{5,3,5}","SWh", "{5,3,5} quotient", "535c", 12, 5, qsSMALLB | qANYQ, giHyperb3, 0x31400, {{7, 2}}, eVariation::pure},
{"{5,3,5}","SW", "Seifert-Weber space", "535s", 12, 5, qsSINGLE, giHyperb3, 0x31400, {{7, 2}}, eVariation::pure},
{"{5,3,3}","SW", "Poincaré homology sphere", "533s", 12, 3, qsSINGLE, giSphere3, 0x31400, {{7, 2}}, eVariation::pure},
{"{?,oo}", "none", "{3/4,∞} (infinite triangles and squares)", "ooxm", 3, OINF, qIDEAL | qINFMIXED, giHyperb2, 0x49400, {{6, 6}}, eVariation::pure},
};
// bits: 9, 10, 15, 16, (reserved for later) 17, 18

View File

@ -667,6 +667,8 @@ void geometry_information::generate_floorshapes() {
#endif
else if(GOLDBERG) { /* will be generated on the fly */ }
else if(inforder::mixed()) { /* will be generated on the fly */ }
#if CAP_BT
else if(kite::in()) {
@ -868,6 +870,34 @@ EX int shvid(cell *c) {
return kite::getshape(c->master);
else if(geometry == gBinary4 || geometry == gTernary)
return c->master->zebraval;
else if(inforder::mixed()) {
int t = c->type;
static vector<bool> computed;
if(isize(computed) <= t) computed.resize(t+1);
if(!computed[t]) {
computed[t] = true;
cell model;
heptagon modelh;
model.type = t;
modelh.type = t;
S7 = t;
for(int i=0; i<S7; i++) {
model.move(i) = &model;
modelh.move(i) = &modelh;
model.c.setspin(i, i, false);
modelh.c.setspin(i, i, false);
}
cgi.tessf = edge_of_triangle_with_angles(0, M_PI/t, M_PI/t);
cgi.crossf = cgi.tessf;
println(hlog, "generating floorshapes for ", t);
cgi.generate_floorshapes_for(t, &model, 0, 0);
cgi.finishshape();
cgi.extra_vertices();
}
return t;
}
else if(PURE)
return 0;
else

View File

@ -66,6 +66,12 @@ namespace gp { extern gp::local_info draw_li; }
#endif
transmatrix hrmap_standard::adj(heptagon *h, int d) {
if(inforder::mixed()) {
int t0 = h->type;
int t1 = h->cmove(d)->type;
int sp = h->c.spin(d);
return spin(-d * 2 * M_PI / t0) * xpush(spacedist(h->c7, d)) * spin(M_PI + 2*M_PI*sp/t1);
}
transmatrix T = cgi.heptmove[d];
if(h->c.mirror(d)) T = T * Mirror;
int sp = h->c.spin(d);
@ -120,7 +126,7 @@ transmatrix hrmap_standard::relative_matrix(heptagon *h2, heptagon *h1, const hy
}
if(bestdist < 1e8) return T;
}
for(int d=0; d<S7; d++) if(h1->move(d) == h2) {
for(int d=0; d<h1->type; d++) if(h1->move(d) == h2) {
return gm * adj(h1, d) * where;
}
if(among(geometry, gFieldQuotient, gBring, gMacbeath)) {
@ -326,7 +332,7 @@ EX bool no_easy_spin() {
ld hrmap_standard::spin_angle(cell *c, int d) {
if(WDIM == 3) return SPIN_NOT_AVAILABLE;
ld hexshift = 0;
if(c == c->master->c7 && (S7 % 2 == 0) && BITRUNCATED) hexshift = cgi.hexshift + 2*M_PI/S7;
if(c == c->master->c7 && (S7 % 2 == 0) && BITRUNCATED) hexshift = cgi.hexshift + 2*M_PI/c->type;
else if(cgi.hexshift && c == c->master->c7) hexshift = cgi.hexshift;
if(IRREGULAR) {
auto id = irr::cellindex[c];
@ -345,6 +351,18 @@ EX ld cellgfxdist(cell *c, int d) { return currentmap->spacedist(c, d); }
double hrmap_standard::spacedist(cell *c, int i) {
if(NONSTDVAR || WDIM == 3) return hrmap::spacedist(c, i);
if(inforder::mixed()) {
int t0 = c->type;
int t1 = c->cmove(i)->type;
auto halfmove = [] (int i) {
if(i == 1) return 0.0;
if(i == 2) return 0.1;
return edge_of_triangle_with_angles(0, M_PI/i, M_PI/i);
};
ld tessf0 = halfmove(t0);
ld tessf1 = halfmove(t1);
return (tessf0 + tessf1) / 2;
}
if(!BITRUNCATED) return cgi.tessf;
if(c->type == S6 && (i&1)) return cgi.hexhexdist;
return cgi.crossf;

View File

@ -994,7 +994,7 @@ EX transmatrix actualV(const heptspin& hs, const transmatrix& V) {
if(bt::in()) return V;
#endif
if(kite::in()) return V;
return (hs.spin || !BITRUNCATED) ? V * spin(hs.spin*2*M_PI/S7 + master_to_c7_angle()) : V;
return (hs.spin || !BITRUNCATED) ? V * spin(hs.spin*2*M_PI/hs.at->type + master_to_c7_angle()) : V;
}
EX bool point_behind(hyperpoint h) {
@ -1231,12 +1231,18 @@ void hrmap_standard::draw() {
bool draw = drawcell_subs(c, actualV(hs, V1));
if(sphere) draw = true;
if(draw) for(int d=0; d<S7; d++) {
if(draw) for(int d=0; d<c->type; d++) {
hstate s2 = transition(s, d);
if(s2 == hsError) continue;
heptspin hs2 = hs + d + wstep;
transmatrix Vd = V * cgi.heptmove[d];
transmatrix Vd;
if(inforder::mixed()) {
int d1 = gmod(hs.spin+d, c->type);
Vd = V * spin(-2*M_PI*d/c->type) * xpush(spacedist(c, d1)) * spin(M_PI);
}
else
Vd = V * cgi.heptmove[d];
bandfixer bf(Vd);
drawn_cells.emplace_back(hs2, s2, Vd, band_shift);
}

View File

@ -13,10 +13,18 @@ namespace hr {
EX namespace inforder {
EX bool in() { return S3 >= OINF; }
EX bool mixed() { return cgflags & qINFMIXED; }
EX int alt_degree;
struct hrmap_inforder : hrmap_hyperbolic {
heptagon *create_step(heptagon *h, int direction) {
auto h1 = tailored_alloc<heptagon> (S7);
int deg = h->type;
if(mixed()) deg = 7 - deg;
auto h1 = tailored_alloc<heptagon> (deg);
bool par = h->s == hsA && direction == 0;
h->c.connect(direction, h1, par ? 1 + hrand(2) : 0, false);
@ -24,7 +32,7 @@ EX namespace inforder {
h1->s = hsA;
h1->cdata = NULL;
h1->distance = h->distance + (par ? -1 : 1);
h1->c7 = newCell(S7, h1);
h1->c7 = newCell(deg, h1);
return h1;
}