From 0cad3a55f9af57d963782d60460e7fe5011948e2 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sun, 4 Jul 2021 09:32:04 +0200 Subject: [PATCH] arb:: unmirror functionality --- arbitrile.cpp | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/arbitrile.cpp b/arbitrile.cpp index e7bd7574..618f6525 100644 --- a/arbitrile.cpp +++ b/arbitrile.cpp @@ -222,6 +222,41 @@ EX void load_tile(exp_parser& ep, arbi_tiling& c, bool unit) { cc.stretch_shear.resize(cc.size(), make_pair(1, 0)); } +EX bool do_unmirror = true; + +/** \brief for tessellations which contain mirror rules, remove them by taking the orientable double cover */ +EX void unmirror() { + int mirror_rules = 0; + for(auto s: arb::current.shapes) + for(auto t: s.connections) + if(get<2>(t)) + mirror_rules++; + if(!mirror_rules) return; + auto& sh = current.shapes; + int s = isize(sh); + for(int i=0; i(co) ^ (i >= s); + get<2>(co) = false; + if(mirr) { + get<0>(co) += s; + get<1>(co) = isize(sh[get<0>(co)].angles) - 1 - get<1>(co); + } + } + } + } + EX void load(const string& fname, bool after_sliding IS(false)) { fhstream f(fname, "rt"); if(!f.f) throw hr_parse_exception("file " + fname + " does not exist"); @@ -472,6 +507,7 @@ EX void load(const string& fname, bool after_sliding IS(false)) { } } } + if(do_unmirror) unmirror(); if(!after_sliding) slided = current; }