diff --git a/aperiodic-hat.cpp b/aperiodic-hat.cpp index de32986b..c65181da 100644 --- a/aperiodic-hat.cpp +++ b/aperiodic-hat.cpp @@ -402,6 +402,8 @@ struct hrmap_hat : hrmap { void init() { transmatrix T = Id; + hatcorners[0].clear(); + hatcorners[1].clear(); auto move = [&] (ld angle, ld dist) { hatcorners[0].push_back(T * C0); @@ -409,19 +411,29 @@ struct hrmap_hat : hrmap { T = T * xpush(dist); }; + ld q = 6; ld eshort = 0.5; ld elong = sqrt(3) * eshort; + if(fake::in()) q = fake::around; + + if(q != 6) { + eshort = edge_of_triangle_with_angles(M_PI / q, 60._deg, 90._deg); + elong = edge_of_triangle_with_angles(60._deg, M_PI / q, 90._deg); + } + + ld i60 = (M_PI - TAU*2/q)/degree; + ld n60 = (M_PI - TAU*4/q)/degree; move(-90, eshort); move( 60, eshort); move( 0, eshort); - move( 60, eshort); move( 90, elong); move(-60, elong); + move( 60, eshort); move( 90, elong); move(n60, elong); move( 90, eshort); move(-60, eshort); move( 90, elong); - move( 60, elong); move(-90, eshort); move( 60, eshort); - move( 90, elong); move(60, elong); + move(i60, elong); move(-90, eshort); move( 60, eshort); + move( 90, elong); move(i60, elong); - hyperpoint ctr = C0; + hyperpoint ctr = Hypc; for(auto h: hatcorners[0]) ctr += h; ctr /= isize(hatcorners[0]); - normalize(ctr); + ctr = normalize(ctr); for(auto& h: hatcorners[0]) h = gpushxto0(ctr) * h; hatcorners[1] = hatcorners[0]; @@ -586,6 +598,14 @@ struct hrmap_hat : hrmap { EX hrmap *new_map() { return new hrmap_hat; } +hrmap_hat* hat_map() { return dynamic_cast(currentmap); } + +EX void reshape() { + hrmap_hat *hatmap; + hatmap = FPIU( hat_map() ); + hatmap->init(); + } + EX color_t hatcolor(cell *c, int mode) { vector cols; auto *m = (hrmap_hat*) (currentmap); diff --git a/fake.cpp b/fake.cpp index 4c2069e7..67785fc7 100644 --- a/fake.cpp +++ b/fake.cpp @@ -89,7 +89,7 @@ EX namespace fake { hyperpoint get_corner(cell *c, int cid, ld cf=3) override { - if(arcm::in()) { + if(arcm::in() || hat::in()) { return underlying_map->get_corner(c, cid, cf); } @@ -99,6 +99,7 @@ EX namespace fake { } transmatrix adj(cell *c, int d) override { + if(hat::in()) return underlying_map->adj(c, d); if(variation == eVariation::coxeter) { array which; in_underlying([&which, c, d] { @@ -535,8 +536,10 @@ EX ld compute_euclidean() { #if CAP_ARCM if(arcm::in()) return arcm::current.N * 2 / arcm::current.euclidean_angle_sum; #endif + if(underlying == gAperiodicHat) return 6; if(WDIM == 2) return 4 / (S7-2.) + 2; + if(underlying == gRhombic3) return 3; if(underlying == gBitrunc3) return 2.55208; int middle = get_middle(); @@ -551,6 +554,7 @@ EX ld around_orig() { if(arcm::in()) return arcm::current.N; #endif + if(hat::in()) return 6; if(WDIM == 2) return S3; if(underlying == gRhombic3) @@ -655,8 +659,9 @@ void set_gfake(ld _around) { compute_scale(); check_cgi(); cgi.require_basics(); - + if(currentmap) new hrmap_fake(currentmap); + if(hat::in()) hat::reshape(); } EX void change_around() {