From ff4d86ee6557cfb61415a28048e552aba72d0435 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sat, 6 Mar 2021 11:46:57 +0100 Subject: [PATCH] rug:: extra variables to report the rug shape --- rug.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/rug.cpp b/rug.cpp index f1b208b0..39145985 100644 --- a/rug.cpp +++ b/rug.cpp @@ -165,6 +165,8 @@ bool rug_hyperbolic() { USING_NATIVE_GEOMETRY; return hyperbolic; } bool rug_sphere() { USING_NATIVE_GEOMETRY; return sphere; } bool rug_elliptic() { USING_NATIVE_GEOMETRY; return elliptic; } +EX map rug_map; + EX rugpoint *addRugpoint(shiftpoint h, double dist) { rugpoint *m = new rugpoint; m->h = h; @@ -560,12 +562,10 @@ EX void buildRug() { celllister cl(centerover ? centerover : cwt.at, get_sightrange(), vertex_limit, NULL); - map vptr; - for(int i=0; itype; j++) try { cell *c2 = c->move(j); - rugpoint *w = vptr.at(c2); + rugpoint *w = rug_map.at(c2); // if(vmodmove(j+1); - rugpoint *w2 = vptr.at(c3); + rugpoint *w2 = rug_map.at(c3); cell *c4 = (cellwalker(c,j) + wstep - 1).cpeek(); @@ -776,7 +776,8 @@ EX void optimize(rugpoint *m, bool do_preset) { force(*m, *m->edges[j].target, m->edges[j].len, false, 1, 0); } -int divides = 0; +EX int divides; +EX int precision_increases; bool stop = false; EX bool subdivide_further() { @@ -794,6 +795,7 @@ EX void subdivide() { stop = true; } else { + precision_increases++; err_zero_current /= 2; println(hlog, "increasing precision to ", err_zero_current); for(auto p: points) enqueue(p); @@ -1182,6 +1184,8 @@ EX void init_model() { qvalid = 0; dt = 0; queueiter = 0; err_zero_current = err_zero; + divides = 0; + precision_increases = 0; #if CAP_CRYSTAL if(cryst && surface::sh == surface::dsNone) { @@ -1238,6 +1242,7 @@ EX void init() { EX void clear_model() { triangles.clear(); for(int i=0; i (); } @@ -1910,6 +1915,8 @@ auto rug_hook = addHook(hooks_args, 100, rugArgs); #endif +auto clear_rug_map = addHook(hooks_clearmemory, 40, [] () { rug_map.clear(); }); + EX } #endif