diff --git a/fake.cpp b/fake.cpp index 7d7e2bd2..bc4c3dc1 100644 --- a/fake.cpp +++ b/fake.cpp @@ -73,20 +73,17 @@ EX namespace fake { }); if(WDIM == 2) { - - hyperpoint a1, a2, b1, b2; - - in_underlying([c, d, &a1, &a2, &b1, &b2] { - a1 = get_corner_position(c, d); - a2 = get_corner_position(c, (d+1) % c->type); - - auto c1 = c->move(d); - auto d1 = c->c.spin(d); - b1 = get_corner_position(c1, d1); - b2 = get_corner_position(c1, (d1+1) % c1->type); + + ld dist; + in_underlying([c, d, &dist] { + dist = currentmap->spacedist(c, d); }); - cgi.adjcheck = hdist0(mid(befake(a1), befake(a2))) + hdist0(mid(befake(b1), befake(b2))); + auto& u = *underlying_cgip; + if(dist == u.tessf) cgi.adjcheck = cgi.tessf; + else if(dist == u.crossf) cgi.adjcheck = cgi.crossf; + else if(dist == u.hexhexdist) cgi.adjcheck = cgi.hexhexdist; + else cgi.adjcheck = dist * scale; } return S1 * xpush(cgi.adjcheck) * S2; @@ -159,7 +156,7 @@ EX namespace fake { // for(int i=0; i 1000) continue; - for(int i=0; imove(i)) { + for(int i=0; itype; i++) if(c->move(i)) { enqueue(c->move(i), V * adj(c, i)); } } @@ -290,8 +287,10 @@ EX ld around; /** @brief the value of 'around' which makes the tiling Euclidean */ EX ld compute_euclidean() { + if(WDIM == 2) return 4 / (S7-2.) + 2; + int middle = get_middle(); - + return M_PI / asin(cos(M_PI/middle) / sin(M_PI/underlying_cgip->face)); } @@ -302,11 +301,12 @@ EX void compute_scale() { if(around < 0) around = good; if(abs(good - around) < 1e-6) good = around; + + int s3 = WDIM == 2 ? S3 : underlying_cgip->loop; multiple = false; - for(int k=1; k<10; k++) - if(abs(around - underlying_cgip->loop) < 1e-6) - multiple = true; + int mcount = int(around / s3 + .5); + multiple = abs(around - mcount * s3) < 1e-6; if(around == good) { ginf[gFake].g = WDIM == 3 ? giEuclid3 : giEuclid2; @@ -322,7 +322,11 @@ EX void compute_scale() { ld around_ideal = 1/(1/2. - 1./get_middle()); - if(euclid) scale = 1; + if(WDIM == 2) { + ginf[gFake].tiling_name = lalign(0, "{", S7, ",", around, "}"); + return; + } + else if(euclid) scale = 1; else if(abs(around_ideal - around) < 1e-6) { hyperpoint h0 = underlying_cgip->cellshape[0]; auto s = kleinize(h0); @@ -385,13 +389,17 @@ EX void change_around() { ld range = sightranges[geometry]; if(!fake::in()) { - if(around == cgi.loop) return; /* do nothing */ + if(around == (WDIM == 2 ? S3 : cgi.loop)) return; /* do nothing */ set_gfake(around); } else { compute_scale(); ray::reset_raycaster(); + + /* to compute scale */ + if(WDIM == 2) + cgi.prepare_basics(); } println(hlog, "scale = ", t, " -> ", scale, " range = ", range); diff --git a/geometry.cpp b/geometry.cpp index 3ab57cd9..4dece42e 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -480,6 +480,8 @@ void geometry_information::prepare_basics() { ld ALPHA = 2 * M_PI / S7; ld fmin, fmax; + + ld s3, beta; if(arcm::in() && !prod) ginf[gArchimedean].cclass = gcHyperbolic; @@ -507,12 +509,17 @@ void geometry_information::prepare_basics() { hexhexdist = 0.566256; goto finish; } + + s3 = S3; + if(fake::in()) s3 = fake::around; + + beta = (S3 >= OINF && !fake::in()) ? 0 : 2*M_PI/s3; - tessf = euclid ? 1 : edge_of_triangle_with_angles(S3 >= OINF ? 0 : 2*M_PI/S3, M_PI/S7, M_PI/S7); + tessf = euclid ? 1 : edge_of_triangle_with_angles(beta, M_PI/S7, M_PI/S7); - if(elliptic && S7 == 4) tessf = M_PI/2; + if(elliptic && S7 == 4 && !fake::in()) tessf = M_PI/2; - hcrossf = euclid ? (S3 == 3 ? sqrt(3)/3 : sqrt(2)/2) : edge_of_triangle_with_angles(M_PI/2, M_PI/S7, M_PI/S3); + hcrossf = euclid ? tessf / 2 / sin(M_PI/s3) : edge_of_triangle_with_angles(M_PI/2, M_PI/S7, beta/2); crossf = BITRUNCATED ? hcrossf : tessf; @@ -523,6 +530,22 @@ void geometry_information::prepare_basics() { hyperpoint H1 = spin(2*M_PI/S7) * H; hyperpoint H2 = xpush0(tessf-f); ld v1 = intval(H, H1), v2 = intval(H, H2); + + if(fake::in() && WDIM == 2) { + hexvdist = hdist(xpush0(f), xspinpush0(ALPHA/2, hcrossf)); + v2 = hdist( + spin(M_PI/2/S3) * xpush0(hexvdist), + spin(-M_PI/2/S3) * xpush0(hexvdist) + ); + + v1 = hdist( + spin(M_PI/S7) * xpush0(f), + spin(-M_PI/S7) * xpush0(f) + ); + + println(hlog, f, " : ", tie(v1, v2)); + } + if(v1 < v2) fmin = f; else fmax = f; } hexf = fmin; @@ -546,10 +569,12 @@ void geometry_information::prepare_basics() { for(int d=0; dcrossf * fake::scale; scalefactor = u->scalefactor * fake::scale; @@ -596,6 +632,7 @@ void geometry_information::prepare_basics() { hexf = u->hexf * fake::scale; rhexf = u->rhexf * fake::scale; hexvdist = u->hexvdist * fake::scale; + hcrossf = u->hcrossf * fake::scale; } if(arb::in()) { @@ -960,9 +997,9 @@ EX string cgi_string() { V("VAR", its(int(variation))); if(fake::in()) { - if(hyperbolic) V("H", fts(fake::scale)); - if(euclid) V("E", fts(fake::scale)); - if(sphere) V("S", fts(fake::scale)); + if(hyperbolic) V("H", fts(fake::around)); + if(euclid) V("E", fts(fake::around)); + if(sphere) V("S", fts(fake::around)); V("G", FPIU(cgi_string())); return s; } diff --git a/pattern2.cpp b/pattern2.cpp index 01414f72..f4ec9198 100644 --- a/pattern2.cpp +++ b/pattern2.cpp @@ -839,7 +839,7 @@ EX namespace patterns { if(IRREGULAR || arcm::in() || bt::in() || arb::in() || WDIM == 3) si.symmetries = 1; else if(a46) val46(c, si, sub, pat); else if(a38) val38(c, si, sub, pat); - else if(sphere && S3 == 3) valSibling(c, si, sub, pat); + else if(S7 < 6 && S3 == 3) valSibling(c, si, sub, pat); else if(euc::in(2,4)) valEuclid4(c, si, sub); else if(euc::in(2,6)) valEuclid6(c, si, sub); else if(a4) val457(c, si, sub);