1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-25 01:20:37 +00:00

compute_vertex_valence no longer crashes with -arb-unmirror 0 -- we just ignore vertex valence in this case, we do not use it for now

This commit is contained in:
Zeno Rogue 2022-10-06 14:52:22 +02:00
parent 8b758bded9
commit f3427c4968

View File

@ -538,13 +538,22 @@ EX void compute_vertex_valence(arb::arbi_tiling& ac) {
println(hlog, "ik = ", tie(i,k), " co=", co, "co1=", co1, " cl=", sh.cycle_length); println(hlog, "ik = ", tie(i,k), " co=", co, "co1=", co1, " cl=", sh.cycle_length);
throw hr_parse_exception("connection error #2 in compute_vertex_valence"); throw hr_parse_exception("connection error #2 in compute_vertex_valence");
} }
if(co.mirror && ac.shapes[co.sid].symmetric_value) {
co.eid = gmod(ac.shapes[co.sid].symmetric_value - co.eid, ac.shapes[co.sid].cycle_length);
co.mirror = !co.mirror;
}
reduce_gcd(ac.shapes[co.sid].cycle_length, co.eid - co1.eid); reduce_gcd(ac.shapes[co.sid].cycle_length, co.eid - co1.eid);
} }
for(int k=0; k<n; k++) { for(int k=0; k<n; k++) {
auto co = sh.connections[k]; auto co = sh.connections[k];
auto co0 = co;
co = ac.shapes[co.sid].connections[co.eid]; co = ac.shapes[co.sid].connections[co.eid];
if(co.sid != i) throw hr_parse_exception("connection error in compute_vertex_valence"); if(co.sid != i) throw hr_parse_exception("connection error in compute_vertex_valence");
if((co.mirror ^ co0.mirror) && ac.shapes[co.sid].symmetric_value) {
co.eid = gmod(ac.shapes[co.sid].symmetric_value - co.eid, ac.shapes[co.sid].cycle_length);
co.mirror = !co.mirror;
}
reduce_gcd(sh.cycle_length, k-co.eid); reduce_gcd(sh.cycle_length, k-co.eid);
} }
if(debugflags & DF_GEOM) if(debugflags & DF_GEOM)
@ -562,6 +571,9 @@ EX void compute_vertex_valence(arb::arbi_tiling& ac) {
tcl = new_tcl; 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(cgflags & qAFFINE) return;
if(ac.is_star) return; if(ac.is_star) return;
ac.have_valence = true; ac.have_valence = true;