diff --git a/rogueviz/sunflower.cpp b/rogueviz/sunflower.cpp index b6c2b2f6..910d099f 100644 --- a/rogueviz/sunflower.cpp +++ b/rogueviz/sunflower.cpp @@ -2,8 +2,24 @@ // Copyright (C) 2018 Zeno and Tehora Rogue, see 'hyper.cpp' for details // use: commandline parameter -sunflower -// e.g.: hyper -sunflower 10000 0.01 -// e.g.: hyper -sunflower 5 0.01 +// e.g.: hyper -sunflower-qd 10000 1 +// e.g.: hyper -sunflower-dr 1 4.5 + +// Commandlines for https://twitter.com/ZenoRogue/status/1247900522905886723 : + +// Part 1: +// -geo 1 -sunflower-node 1 -sunflower-qd "1..10..20..60..100..140..180..220..|1000..1040..|2000..2040..|5000..5040..|10000..10040" 1 -zoom "sqrt(1000/(100+sunq))" -animperiod 20000 -shott 0 -back A0E0A0 -lw 16 -shotxy 1000 1000 -shotaa 2 + +// Part 2: +// -rugtsize 8192 -rugon -run -rugv 4000000 -run -sunflower-dr "0.001..0.002..0.005..0.01..0.02..0.04..0.06..0.07..0.08..0.09" 3..4.1..4.5..4.5..4.5..4.5..4.5..4.5..4.5 -lw 4 -sunflower-out 1 -shott 0 -back A0E0A0 -shotxy 1000 1000 -shotaa 2 -sunflower-adj 16 -animrec 600 curv%04d.png +// rotate the rug; press F10; wait until rug has millions of vertices; press F10; animation will be recorded + +// Part 3: +// -rugtsize 8192 -rugon -rugv 1000000 -sunflower-dr .5 4.5 -lw 16 -shott 0 -back A0E0A0 -shotxy 1000 1000 -shotaa 2 -sunflower-adj 6 +// (rotation animation set manually) + +// Part 4: +// -geo 2 -sunflower-dr .1 pi -shott 0 -back A0E0A0 -shotxy 1000 1000 -shotaa 2 -animmove "2*pi" 0 0 #include "rogueviz.h" @@ -13,18 +29,30 @@ namespace sunflower { bool on; -int qty = 100; +bool nodes; + +ld qty = 100; ld density = 1, zdensity; ld range; +ld distance_per_rug; + +bool adjust_rug; + /* which property to infer from the other two: 'd'ensity, 'q'ty or 'r'ange */ char infer; vector ps; +int iqty; + +ld qfrac; + +bool outward = false; + hyperpoint p(int i) { ld step = M_PI * (3 - sqrt(5)); - return spin(i * step) * xpush(sphere ? (i+.5) * density : euclid ? sqrt((i+.5) * density) : acosh(1 + (i+.5) * density)) * C0; + return spin((outward ? i : i-iqty) * step) * xpush(sphere ? (acos(1 - (i+.5+qfrac) * density)) : euclid ? sqrt((i+.5+qfrac) * density) : acosh(1 + (i+.5+qfrac) * density)) * C0; } vector inext, inext2; @@ -39,8 +67,8 @@ bool sunflower_cell(cell *c, transmatrix V) { if(sphere) { if(infer == 'r') - range = qty * density; - else qd = range; + range = qty * density * M_PI/2; + else qd = range * 2/M_PI; } else if(euclid) { if(infer == 'r') @@ -56,19 +84,35 @@ bool sunflower_cell(cell *c, transmatrix V) { if(infer == 'q') qty = qd / density; if(infer == 'd') density = qd / qty; + + if(adjust_rug) { + using namespace rug; + if(rug_perspective) + push_all_points(2, +model_distance); + + model_distance = sqrt(zdensity) * distance_per_rug; + + if(rug_perspective) + push_all_points(2, -model_distance); + } - ps.resize(qty); - inext.resize(qty); - inext2.resize(qty); - while(fibs.back() < qty) { + iqty = qty; + qfrac = qty - iqty; + if(outward) qfrac = 0; + if(iqty < 0 || iqty > 2000000) return false; + + ps.resize(iqty); + inext.resize(iqty); + inext2.resize(iqty); + while(fibs.back() < iqty) { auto add = fibs.back() + *(fibs.end()-2); fibs.push_back(add); } if(c == cwt.at) { - for(int i=0; i(zdensity, 1); tour::slide_backup(infer, 'q'); - + + insert_param(); start_game(); } }}