Replace ComboIterator with std::set<std::vector<int>> via combinations.hpp

Since the number of generators never exceeds 6, the maximum number of combinations is (6, 3) = 20, so the space optimizations of using an iterator is mute.

Doing this way also allows to use set_difference and set_union to deal with collections of subgroups. This is not easily possible otherwise.
This commit is contained in:
David Allemang
2020-10-24 23:06:52 -04:00
parent 6e3ea1900b
commit 01043e9bce
5 changed files with 55 additions and 108 deletions

View File

@@ -5,7 +5,8 @@
#include <cgl/pipeline.hpp>
#include <geometry.hpp>
#include "mirror.hpp"
#include <mirror.hpp>
#include <combinations.hpp>
struct Matrices {
mat4 proj = mat4::Identity();
@@ -46,13 +47,13 @@ public:
cgl::VertexArray vao;
explicit Slice(const tc::Group &g) : group(g) {
auto gens = generators(group);
auto combos = Combos<int>(gens, 3);
std::vector<std::vector<int>> exclude = {{0, 1, 2}};
auto ctx = generators(group);
auto all_ctxs = combinations(ctx, N - 1);
auto selected_ctxs = difference(all_ctxs, {
{0, 2, 4},
});
auto all_sg_gens = combos;
auto mesh = Mesh<N>::hull(g, generators(g), all_sg_gens);
auto mesh = Mesh<N>::hull(group, ctx, selected_ctxs);
ibo.put(mesh);
vao.ipointer(0, ibo, 4, GL_UNSIGNED_INT);