diff --git a/rogueviz/sunflower.cpp b/rogueviz/sunflower.cpp index 42a6d51c..23deb384 100644 --- a/rogueviz/sunflower.cpp +++ b/rogueviz/sunflower.cpp @@ -59,7 +59,7 @@ hyperpoint p(int i) { vector inext, inext2; -vector fibs = {1, 2}; +vector fibs; color_t sunflower1 = 0xC04000FF; color_t sunflower2 = 0xFFD500FF; @@ -104,10 +104,25 @@ bool sunflower_cell(cell *c, shiftmatrix V) { if(outward) qfrac = 0; if(iqty < 0 || iqty > 2000000) return false; + if(fibs.empty()) { + ld best_error = 1; + vector sgns; + for(int i=1; i .5; + if(sgn) v = 1-v; + if(v < best_error) fibs.push_back(i), sgns.push_back(sgn), best_error = v; + } + println(hlog, "fibs = ", fibs); + println(hlog, "sgns = ", sgns); + } + ps.resize(iqty); inext.resize(iqty); inext2.resize(iqty); while(fibs.back() < iqty) { + /* to do: might not work correctly if step_angle is changed */ auto add = fibs.back() + *(fibs.end()-2); fibs.push_back(add); } @@ -204,6 +219,9 @@ int readArgs() { else if(argis("-sunflower-out")) { shift(); outward = argi(); } + else if(argis("-sunflower-angle")) { + shift_arg_formula(step_angle, [] { fibs.clear(); }); + } else if(argis("-sunflower-adj")) { adjust_rug = true; shift_arg_formula(distance_per_rug);