From fbd23aea02e66a93567d1779bfdd6df665517f3a Mon Sep 17 00:00:00 2001 From: David Allemang Date: Sun, 25 Oct 2020 00:53:51 -0400 Subject: [PATCH] introduce set_union wrapper also rename set_difference wrapper --- vis/include/combinations.hpp | 15 ++++++++++++--- vis/src/main.cpp | 18 +++++++++--------- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/vis/include/combinations.hpp b/vis/include/combinations.hpp index f522b2c..615e9e6 100644 --- a/vis/include/combinations.hpp +++ b/vis/include/combinations.hpp @@ -31,14 +31,23 @@ std::set combinations(const V &options, size_t count) { } template -std::set difference(const std::set &a, const std::set &b) { +std::set set_difference(const std::set &a, const std::set &b) { std::set result; - std::set_difference( a.begin(), a.end(), b.begin(), b.end(), std::inserter(result, result.end()) ); - return result; } + +template +std::set set_union(const std::set &a, const std::set &b) { + std::set result; + std::set_union( + a.begin(), a.end(), + b.begin(), b.end(), + std::inserter(result, result.end()) + ); + return result; +} \ No newline at end of file diff --git a/vis/src/main.cpp b/vis/src/main.cpp index fab25bc..a4c30de 100644 --- a/vis/src/main.cpp +++ b/vis/src/main.cpp @@ -67,7 +67,7 @@ public: std::vector symbol = {3, 4, 3, 2}; auto group = tc::schlafli(symbol); auto ctx = generators(group); - auto selected_ctxs = difference( + auto selected_ctxs = set_difference( combinations(ctx, 3), { {0, 1, 2}, @@ -84,20 +84,20 @@ public: std::vector symbol = {3, 4, 3, 2}; auto group = tc::schlafli(symbol); auto ctx = generators(group); - auto selected_ctxs = difference( - combinations(ctx, 3), - { - {0, 1, 2}, - } + + auto selected_ctxs = set_union( + combinations(std::vector{0, 2, 3, 4}, 3), + combinations(std::vector{1, 2, 3, 4}, 3) ); + auto mesh = Mesh<4>::hull(group, ctx, selected_ctxs); auto &slice = slices.emplace_back(group); slice.setMesh(mesh); - slice.root << .50, .02, .02, .02, .02; - slice.color << 0.1, 0.1, 0.9; + slice.root << .80, .02, .02, .03, .04; + slice.color << 0.9, 0.1, 0.1; } - + ren = std::make_unique>(); ubo = std::make_unique>();