From 5008609b95b8ff2ae6b779c6f2c11f7f33cd7985 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sat, 8 Oct 2022 02:01:25 +0200 Subject: [PATCH] tes;: refactored compute_vertex_valence, also is now able to compute valence in the 'generic' case --- arbitrile.cpp | 88 +++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 75 insertions(+), 13 deletions(-) diff --git a/arbitrile.cpp b/arbitrile.cpp index 3111bec9..e2991f05 100644 --- a/arbitrile.cpp +++ b/arbitrile.cpp @@ -545,13 +545,10 @@ EX void mirror_connection(arb::arbi_tiling& ac, connection_t& co) { } } -EX void compute_vertex_valence(arb::arbi_tiling& ac) { +EX void compute_vertex_valence_prepare(arb::arbi_tiling& ac) { + int tcl = -1; - for(auto& sh: ac.shapes) - sh.cycle_length = isize(sh.vertices) / sh.repeat_value; - - recompute: while(true) { for(auto& sh: ac.shapes) { @@ -593,14 +590,10 @@ EX void compute_vertex_valence(arb::arbi_tiling& ac) { if(new_tcl == tcl) break; tcl = new_tcl; } - - if(!ac.was_unmirrored) for(auto& sh: ac.shapes) if(sh.symmetric_value) return; - for(auto& sh: ac.shapes) for(auto& co: sh.connections) if(co.mirror) return; - - if(cgflags & qAFFINE) return; - if(ac.is_star) return; - ac.have_valence = true; + } +/** returns true if we need to recompute */ +EX bool compute_vertex_valence_flat(arb::arbi_tiling& ac) { for(auto& sh: ac.shapes) { int n = sh.size(); int i = sh.id; @@ -635,7 +628,7 @@ EX void compute_vertex_valence(arb::arbi_tiling& ac) { if(at.sid != i) throw hr_parse_exception("ended at wrong type determining vertex_valence"); if((at.eid - k) % ac.shapes[i].cycle_length) { reduce_gcd(ac.shapes[i].cycle_length, at.eid - k); - goto recompute; + return true; } sh.vertex_valence[k] = qty; sh.vertex_period[k] = pqty; @@ -644,7 +637,76 @@ EX void compute_vertex_valence(arb::arbi_tiling& ac) { if(debugflags & DF_GEOM) println(hlog, "computed vertex_valence of ", i, " as ", ac.shapes[i].vertex_valence); } + return false; + } + +/** returns true if we need to recompute */ +EX bool compute_vertex_valence_generic(arb::arbi_tiling& ac) { + for(auto& sh: ac.shapes) { + int n = sh.size(); + int i = sh.id; + sh.vertex_valence.resize(n); + for(int k=0; k