From d61e498d4b33b5131febb437c616825b3096fa48 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Thu, 15 Dec 2022 23:13:38 +0100 Subject: [PATCH] kite-and-dart working correctly in embedded_plane --- geometry2.cpp | 2 ++ kite.cpp | 21 +++++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/geometry2.cpp b/geometry2.cpp index 4ba6e9da..310b44b7 100644 --- a/geometry2.cpp +++ b/geometry2.cpp @@ -468,6 +468,7 @@ EX ld cellgfxdist(cell *c, int d) { return currentmap->spacedist(c, d); } EX transmatrix ddspin_side(cell *c, int d, ld bonus IS(0)) { if(kite::in()) { + if(embedded_plane) return spin(bonus); hyperpoint h1 = get_corner_position(c, gmod(d, c->type), 3); hyperpoint h2 = get_corner_position(c, gmod(d+1, c->type) , 3); hyperpoint hm = mid(h1, h2); @@ -478,6 +479,7 @@ EX transmatrix ddspin_side(cell *c, int d, ld bonus IS(0)) { EX transmatrix iddspin_side(cell *c, int d, ld bonus IS(0)) { if(kite::in()) { + if(embedded_plane) return spin(bonus); hyperpoint h1 = get_corner_position(c, gmod(d, c->type), 3); hyperpoint h2 = get_corner_position(c, gmod(d+1, c->type) , 3); hyperpoint hm = mid(h1, h2); diff --git a/kite.cpp b/kite.cpp index f15eb8f4..8d086bdf 100644 --- a/kite.cpp +++ b/kite.cpp @@ -19,7 +19,7 @@ enum pshape {pDart, pKite}; #endif transmatrix meuscale(ld z) { - if(euclid) { + if(meuclid) { transmatrix T = Id; T[0][0] = z; T[1][1] = z; @@ -30,7 +30,7 @@ transmatrix meuscale(ld z) { } transmatrix mspin(ld alpha) { - if(euclid) + if(meuclid) return spin(alpha); else return cspin(1, 2, alpha); @@ -39,14 +39,14 @@ transmatrix mspin(ld alpha) { const ld euscale = 0.5; transmatrix meupush(ld x, ld y) { - if(euclid) + if(meuclid) return eupush(euscale * x, euscale * y); else return bt::parabolic3(x, y); } hyperpoint mhpxy(ld x, ld y) { - if(euclid) return hpxy(euscale * x, euscale * y); + if(meuclid) return hpxy(euscale * x, euscale * y); else return bt::parabolic3(x, y) * C0; } @@ -161,7 +161,7 @@ struct hrmap_kite : hrmap { h->s = hstate(s); h->dm4 = h->distance = dist; if(bt::in() || dist == 0) - h->c7 = newCell(euclid ? 4 : s == pKite ? 12 : 10, h); + h->c7 = newCell(meuclid ? 4 : s == pKite ? 12 : 10, h); return h; } @@ -247,7 +247,9 @@ struct hrmap_kite : hrmap { } void make_graphrules() { - if(geom3::flipped) return geom3::in_not_flipped([&] { return make_graphrules(); }); + bool f = geom3::flipped; + bool emb = embedded_plane; + if(emb) geom3::light_flip(true); pKite1 = meupush(-1, kite_center + 0) * mspin(108._deg) * meuscale(rphi) * meupush(0, down - kite_center); pKite2 = meupush(1, kite_center + 0) * mspin(-108._deg) * meuscale(rphi) * meupush(0, down - kite_center); @@ -300,6 +302,13 @@ struct hrmap_kite : hrmap { graphrule(pKite, 9, pKite, 4, pKite1); graphrule(pKite, 10, pDart, 4, pKite3); graphrule(pKite, 11, pDart, 5, ipKite1 * ipDart1 * pDart2 * pDart2 * pDart2); + + if(emb) { + geom3::light_flip(false); + for(auto& g: graphrules) swapmatrix(g.second); + + geom3::light_flip(f); + } } transmatrix adj(cell *c, int dir) override {