From 801bc2a246444884ccc38731a6d82301c346be23 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sun, 23 Feb 2025 22:07:29 +0100 Subject: [PATCH] rogueviz::fundamental:: colored domains --- rogueviz/fundamental.cpp | 82 ++++++++++++++++++++-------------------- 1 file changed, 40 insertions(+), 42 deletions(-) diff --git a/rogueviz/fundamental.cpp b/rogueviz/fundamental.cpp index 98a09b98..d70b58c4 100644 --- a/rogueviz/fundamental.cpp +++ b/rogueviz/fundamental.cpp @@ -93,6 +93,10 @@ int group_count(cellwalker cw) { return groups; } +map bucket_color; + +int lq = 3, alpha = 32; + void fundamental_marker() { if(!funmode || !quotient) return; same.clear(); @@ -178,57 +182,39 @@ void fundamental_marker() { if(corners0 != corners) println(hlog, "corners=", tie(corners0, corners)); - vector> nearm; - - for(int ci=0; ci cornerpos; - for(auto c: cornerlist) cornerpos.push_back(corner(c)); + vector abs_cornerpos; - for(int ci=0; citype; i++) { - cellwalker cw0(c, i); - if(!is_connected(cw0)) continue; - int v = 0; - for(auto& n: nearm) { - queueline(n.first * inverse_shift(n.second, gm[cw0.at]) * xspinpush0(v, .05), n.first * inverse_shift(n.second, gm[cw0.cpeek()]) * xspinpush0(v, .05), 0xFF8000FF, 0); - v++; - } - queueline(gm[cw0.at] * C0, gm[cw0.cpeek()] * C0, 0xFF0000FF, 0); + set buckets_used; + + for(int i=0; iall_drawn_copies, c)) { + auto V1 = V * inverse_shift(gm[c], gm[starter]); + auto bu = bucketer(unshift(V1*C0)); + if(buckets_used.count(bu)) continue; + buckets_used.insert(bu); + + if(alpha && !bucket_color.count(bu)) { + if(bucket_color.empty()) bucket_color[bu] = 0; + else bucket_color[bu] = hrand(0x1000000); } + + queuecurve_reuse(V1, color1, alpha ? ((bucket_color[bu] << 8) | alpha) : 0, PPR::LINE); } + queuecurve(gm[starter], color2, 0, PPR::LINE); + set visited; int id = 0; @@ -298,6 +284,16 @@ void showMenu() { dialog::add_action([] () { starter = cwt.at; }); + dialog::addBoolItem_action("remove internal lines", fill_faces, 'r'); + dialog::addBoolItem_action("all edges be single", single_edges, 'z'); + dialog::addSelItem("line quality", its(lq), 'w'); + dialog::add_action([] { + dialog::editNumber(lq, 0, 5, 1, 3, "line quality", "line quality"); + }); + dialog::addSelItem("shade alpha", its(alpha), 'w'); + dialog::add_action([] { + dialog::editNumber(alpha, 0, 5, 16, 32, "shade alpha", "shade alpha"); + }); dialog::addBack(); dialog::display(); @@ -329,6 +325,8 @@ int readArgs() { else if(argis("-fundamental-more")) { shift(); single_edges = argi(); shift(); fill_faces = argi(); + shift(); lq = argi(); + shift(); alpha = argi(); } else return 1; return 0;