WIP: Add todo comments

This commit is contained in:
David Allemang
2022-02-24 17:32:19 -05:00
parent 7a95155919
commit 4ec96cd155
2 changed files with 14 additions and 0 deletions

View File

@@ -14,6 +14,8 @@
* Produce a list of all generators for the group context. The range [0..group.ngens). * Produce a list of all generators for the group context. The range [0..group.ngens).
*/ */
std::vector<int> generators(const tc::Group &context) { std::vector<int> generators(const tc::Group &context) {
// todo if tc::Group has 'global' generators, then this will be a member of tc::Group.
// std::iota would populate a 'default' list of names, if names are not provided.
std::vector<int> g_gens(context.ngens); std::vector<int> g_gens(context.ngens);
std::iota(g_gens.begin(), g_gens.end(), 0); std::iota(g_gens.begin(), g_gens.end(), 0);
return g_gens; return g_gens;
@@ -26,6 +28,7 @@ std::vector<int> recontext_gens(
const tc::Group &context, const tc::Group &context,
std::vector<int> g_gens, std::vector<int> g_gens,
std::vector<int> sg_gens) { std::vector<int> sg_gens) {
// todo ideally tc::Group will deal in 'global' generators so this stell will be unecessary.
std::sort(g_gens.begin(), g_gens.end()); std::sort(g_gens.begin(), g_gens.end());
@@ -52,6 +55,7 @@ tc::Cosets solve(
const std::vector<int> &g_gens, const std::vector<int> &g_gens,
const std::vector<int> &sg_gens const std::vector<int> &sg_gens
) { ) {
// todo this should also be handled with 'global' generators.
const auto proper_sg_gens = recontext_gens(context, g_gens, sg_gens); const auto proper_sg_gens = recontext_gens(context, g_gens, sg_gens);
return context.subgroup(g_gens).solve(proper_sg_gens); return context.subgroup(g_gens).solve(proper_sg_gens);
} }
@@ -78,6 +82,7 @@ Prims<N> recontext(
const std::vector<int> &g_gens, const std::vector<int> &g_gens,
const std::vector<int> &sg_gens const std::vector<int> &sg_gens
) { ) {
// todo this will be simpler with 'global' gens, but it's still not free...
const auto proper_sg_gens = recontext_gens(context, g_gens, sg_gens); const auto proper_sg_gens = recontext_gens(context, g_gens, sg_gens);
const auto table = solve(context, g_gens, {}); const auto table = solve(context, g_gens, {});
const auto path = solve(context, sg_gens, {}).path; const auto path = solve(context, sg_gens, {}).path;
@@ -100,6 +105,7 @@ Prims<N> recontext(
*/ */
template<unsigned N> template<unsigned N>
Prims<N> merge(const std::vector<Prims<N>> &meshes) { Prims<N> merge(const std::vector<Prims<N>> &meshes) {
// todo (?) might be possible with NullaryExpr
size_t cols = 0; size_t cols = 0;
for (const auto &mesh: meshes) { for (const auto &mesh: meshes) {
cols += mesh.cols(); cols += mesh.cols();
@@ -124,6 +130,8 @@ std::vector<Prims<N>> tile(
const std::vector<int> &g_gens, const std::vector<int> &g_gens,
const std::vector<int> &sg_gens const std::vector<int> &sg_gens
) { ) {
// todo convert to nullaryexpr.
// some stuff will be easier with global generators, but not all.
Prims<N> base = recontext<N>(prims, context, g_gens, sg_gens); Prims<N> base = recontext<N>(prims, context, g_gens, sg_gens);
const auto proper_sg_gens = recontext_gens(context, g_gens, sg_gens); const auto proper_sg_gens = recontext_gens(context, g_gens, sg_gens);
@@ -149,6 +157,7 @@ std::vector<Prims<N>> tile(
template<unsigned N> template<unsigned N>
[[nodiscard]] [[nodiscard]]
Prims<N + 1> fan(Prims<N> prims, int root) { Prims<N + 1> fan(Prims<N> prims, int root) {
// todo convert to nullaryexpr.
Prims<N + 1> res(N + 1, prims.cols()); Prims<N + 1> res(N + 1, prims.cols());
res.topRows(1) = Prims<1>::Constant(1, prims.cols(), root); res.topRows(1) = Prims<1>::Constant(1, prims.cols(), root);
@@ -165,6 +174,8 @@ Prims<N> triangulate(
const tc::Group &context, const tc::Group &context,
const std::vector<int> &g_gens const std::vector<int> &g_gens
) { ) {
// todo (?) might be possible with nullaryexpr
// not so sure, though.
if (g_gens.size() + 1 != N) // todo make static assert if (g_gens.size() + 1 != N) // todo make static assert
throw std::logic_error("g_gens size must be one less than N"); throw std::logic_error("g_gens size must be one less than N");

View File

@@ -20,6 +20,8 @@ Eigen::Matrix<float, N, Eigen::Dynamic> make_points(
const tc::Group &group, const tc::Group &group,
const Eigen::Vector<float, N> &root const Eigen::Vector<float, N> &root
) { ) {
// todo clean up mirror / plane_intersections / barycentric
// ideally barycentric will work in rotors, so that stellations etc. will be possible
auto mirrors = mirror<N>(group); auto mirrors = mirror<N>(group);
auto corners = plane_intersections(mirrors); auto corners = plane_intersections(mirrors);
auto start = barycentric(corners, root); auto start = barycentric(corners, root);
@@ -42,6 +44,7 @@ Eigen::Matrix<unsigned, N, Eigen::Dynamic> make_cells(
auto gens = generators(group); auto gens = generators(group);
auto combos = combinations(gens, N - 1); auto combos = combinations(gens, N - 1);
// todo clean up merge(hull(...))
Eigen::Matrix<unsigned, N, Eigen::Dynamic> cells = merge<N>(hull<N>(group, combos, exclude)); Eigen::Matrix<unsigned, N, Eigen::Dynamic> cells = merge<N>(hull<N>(group, combos, exclude));
return cells; return cells;