fake geometry for hat

This commit is contained in:
Zeno Rogue 2023-03-24 23:16:03 +01:00
parent 8dfa0efbcf
commit 1a97becdf0
2 changed files with 32 additions and 7 deletions

View File

@ -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<hrmap_hat*>(currentmap); }
EX void reshape() {
hrmap_hat *hatmap;
hatmap = FPIU( hat_map() );
hatmap->init();
}
EX color_t hatcolor(cell *c, int mode) {
vector<int> cols;
auto *m = (hrmap_hat*) (currentmap);

View File

@ -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<int, 3> 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() {