reintroduce each_tile and tile.

each_tile produces a vector of mesh parts, and tile produces the merged result.
This commit is contained in:
2020-10-25 00:31:28 -04:00
parent 01043e9bce
commit c1f5163008

View File

@@ -86,7 +86,9 @@ public:
Mesh<N> recontext(std::vector<int> ctx_); Mesh<N> recontext(std::vector<int> ctx_);
std::vector<Mesh<N>> tile(const std::vector<int> &ctx_); Mesh<N> tile(const std::vector<int> &ctx_);
std::vector<Mesh<N>> each_tile(const std::vector<int> &ctx_);
Mesh<N + 1> fan(unsigned root); Mesh<N + 1> fan(unsigned root);
@@ -146,7 +148,12 @@ Mesh<N> Mesh<N>::recontext(std::vector<int> ctx_) {
} }
template<unsigned N> template<unsigned N>
std::vector<Mesh<N>> Mesh<N>::tile(const std::vector<int> &ctx_) { Mesh<N> Mesh<N>::tile(const std::vector<int> &ctx_) {
return merge(each_tile(ctx_));
}
template<unsigned N>
std::vector<Mesh<N>> Mesh<N>::each_tile(const std::vector<int> &ctx_) {
auto base = recontext(ctx_); auto base = recontext(ctx_);
auto table = solve(*g, base.ctx, {}); auto table = solve(*g, base.ctx, {});
@@ -191,7 +198,7 @@ Mesh<N> Mesh<N>::fill(const tc::Group &g, std::vector<int> ctx) {
for (const auto &sub_ctx : combos) { for (const auto &sub_ctx : combos) {
auto base = Mesh<N - 1>::fill(g, sub_ctx); auto base = Mesh<N - 1>::fill(g, sub_ctx);
auto parts = base.tile(ctx); auto parts = base.each_tile(ctx);
parts.erase(parts.begin(), parts.begin() + 1); parts.erase(parts.begin(), parts.begin() + 1);
if (parts.empty()) continue; if (parts.empty()) continue;
@@ -218,7 +225,7 @@ Mesh<N> Mesh<N>::hull(const tc::Group &g, const std::vector<int> ctx, const SC &
std::vector<Mesh<N>> parts; std::vector<Mesh<N>> parts;
for (const auto &sub_ctx : sub_ctxs) { for (const auto &sub_ctx : sub_ctxs) {
auto face = Mesh<N>::fill(g, sub_ctx).tile(ctx); auto face = Mesh<N>::fill(g, sub_ctx).each_tile(ctx);
parts.insert(parts.end(), face.begin(), face.end()); parts.insert(parts.end(), face.begin(), face.end());
} }