#include #include #include #include #include #include #include #include template using ProjectiveNf = Eigen::Transform; template using VectorNf = Eigen::Vector; template Eigen::Matrix make_points( const tc::Group &group, const Eigen::Vector &root ) { // todo clean up mirror / plane_intersections / barycentric // ideally barycentric will work in rotors, so that stellations etc. will be possible auto mirrors = mirror(group); auto corners = plane_intersections(mirrors); auto start = barycentric(corners, root); auto cosets = group.solve(); auto verts = cosets.path.walk, VectorNf>(start, mirrors, reflect); Eigen::Matrix points(root.size(), verts.size()); std::copy(verts.begin(), verts.end(), points.colwise().begin()); return points; } template Eigen::Matrix make_cells( const tc::Group &group, const std::vector> &exclude = {} ) { auto gens = generators(group); auto combos = combinations(gens, N - 1); // todo clean up merge(hull(...)) Eigen::Matrix cells = merge(hull(group, combos, exclude)); return cells; } int main() { std::vector symbol = {5, 3, 3}; auto group = tc::schlafli(symbol); vec4 root{0.80, 0.02, 0.02, 0.02}; auto points = make_points(group, root); auto cells = make_cells<3>(group, {{0, 1}}); ml::Mesh mesh(points, cells); // auto transform = ProjectiveNf::Identity(); // transform.translation() << 0, 0.5, 0, 0; // points = (transform * points.colwise().homogeneous()).colwise().hnormalized(); std::cout << points.rows() << " " << points.cols() << std::endl; std::cout << cells.rows() << " " << cells.cols() << std::endl; ml::write(mesh, std::ofstream("dodeca.pak", std::ios::out | std::ios::binary)); return EXIT_SUCCESS; }