diff --git a/vis/include/solver.hpp b/vis/include/solver.hpp index 9034a37..c2a2194 100644 --- a/vis/include/solver.hpp +++ b/vis/include/solver.hpp @@ -13,7 +13,9 @@ /** * Produce a list of all generators for the group context. The range [0..group.rank()). */ -std::vector generators(const tc::Group &context) { +std::vector _generators( + const tc::Group &context +) { std::vector g_gens(context.rank()); std::iota(g_gens.begin(), g_gens.end(), 0); return g_gens; @@ -24,7 +26,12 @@ std::vector generators(const tc::Group &context) { * * For example if g_gens contains {a, b, c, d} and sg_gens contains {b, d, a} then the result is {1, 3, 0} */ -std::vector recontext_gens(std::vector g_gens, std::vector sg_gens) { +std::vector _recontext_gens( + std::vector g_gens, + std::vector sg_gens +) { + auto orig = sg_gens; + for (size_t &gen: sg_gens) { gen = std::distance( g_gens.begin(), @@ -39,9 +46,13 @@ std::vector recontext_gens(std::vector g_gens, std::vector [[nodiscard]] -Indices recontext(Indices prims, const tc::Group &context, const std::vector &g_gens, - const std::vector &sg_gens) { - const auto proper_sg_gens = recontext_gens(g_gens, sg_gens); +Indices recontext( + Indices prims, + const tc::Group &context, + const std::vector &g_gens, + const std::vector &sg_gens +) { + const auto proper_sg_gens = _recontext_gens(g_gens, sg_gens); const auto table = context.sub(g_gens).solve({}); const auto cosets = context.sub(sg_gens).solve({}); @@ -65,7 +76,9 @@ Indices recontext(Indices prims, const tc::Group &context, const std::vect * Union several meshes of the same dimension */ template -Indices merge(const std::vector> &meshes) { +Indices merge( + const std::vector> &meshes +) { size_t cols = 0; for (const auto &mesh: meshes) { cols += mesh.cols(); @@ -84,10 +97,14 @@ Indices merge(const std::vector> &meshes) { template [[nodiscard]] -std::vector> tile(Indices prims, const tc::Group &context, const std::vector &g_gens, - const std::vector &sg_gens) { +std::vector> tile( + Indices prims, + const tc::Group &context, + const std::vector &g_gens, + const std::vector &sg_gens +) { Indices base = recontext(prims, context, g_gens, sg_gens); - const auto proper_sg_gens = recontext_gens(g_gens, sg_gens); + const auto proper_sg_gens = _recontext_gens(g_gens, sg_gens); const auto &table = context.sub(g_gens).solve({}); const auto &cosets = context.sub(g_gens).solve(proper_sg_gens); @@ -111,7 +128,10 @@ std::vector> tile(Indices prims, const tc::Group &context, const s */ template [[nodiscard]] -Indices fan(Indices prims, int root) { +Indices fan( + Indices prims, + int root +) { Indices res(N + 1, prims.cols()); res.topRows(1) = Indices<1>::Constant(1, prims.cols(), root); @@ -124,7 +144,10 @@ Indices fan(Indices prims, int root) { * Produce a mesh of primitives that fill out the volume of the subgroup generated by generators g_gens within the group context */ template -Indices triangulate(const tc::Group &context, const std::vector &g_gens) { +Indices triangulate( + const tc::Group &context, + const std::vector &g_gens +) { if (g_gens.size() + 1 != N) // todo make static assert throw std::logic_error("g_gens size must be one less than N"); @@ -148,7 +171,10 @@ Indices triangulate(const tc::Group &context, const std::vector &g_ge * Single-index primitives should not be further triangulated. */ template<> -Indices<1> triangulate<1>(const tc::Group &context, const std::vector &g_gens) { +Indices<1> triangulate<1>( + const tc::Group &context, + const std::vector &g_gens +) { if (not g_gens.empty()) // todo make static assert throw std::logic_error("g_gens must be empty for a trivial Mesh"); @@ -156,9 +182,13 @@ Indices<1> triangulate<1>(const tc::Group &context, const std::vector &g } template -auto hull(const tc::Group &group, T all_sg_gens, const std::vector> &exclude) { +auto hull( + const tc::Group &group, + T all_sg_gens, + const std::vector> &exclude +) { std::vector> parts; - auto g_gens = generators(group); + auto g_gens = _generators(group); for (const std::vector &sg_gens: all_sg_gens) { bool excluded = false; for (const auto &test: exclude) { diff --git a/vis/src/comps.hpp b/vis/src/comps.hpp index 6e3060d..559c756 100644 --- a/vis/src/comps.hpp +++ b/vis/src/comps.hpp @@ -24,7 +24,7 @@ namespace vis { vec3 color; std::vector> exclude {{0, 1, 2}}; - std::vector> include = combinations(generators(group), 3); + std::vector> include = combinations(_generators(group), 3); }; struct VBOs {