mirror of
https://github.com/allemangD/toddcox-visualize.git
synced 2025-11-10 12:02:47 -05:00
Rename "hull" and "fill" to be more descriptive.
This commit is contained in:
@@ -79,10 +79,10 @@ public:
|
|||||||
|
|
||||||
Mesh(const tc::Group &g_, std::vector<int> ctx_, size_t cols);
|
Mesh(const tc::Group &g_, std::vector<int> ctx_, size_t cols);
|
||||||
|
|
||||||
static Mesh<N> fill(const tc::Group &g, std::vector<int> ctx);
|
static Mesh<N> fill(const tc::Group &g, const std::vector<int> &ctx);
|
||||||
|
|
||||||
template<class SC>
|
// template<class SC>
|
||||||
static Mesh<N> hull(const tc::Group &g, std::vector<int> ctx, const SC &sub_ctxs);
|
// static Mesh<N> hull(const tc::Group &g, const std::vector<int> &ctx, const SC &sub_ctxs);
|
||||||
|
|
||||||
Mesh<N> recontext(std::vector<int> ctx_);
|
Mesh<N> recontext(std::vector<int> ctx_);
|
||||||
|
|
||||||
@@ -187,7 +187,7 @@ Mesh<N>::Mesh(const tc::Group &g_, std::vector<int> ctx_, size_t cols)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<unsigned N>
|
template<unsigned N>
|
||||||
Mesh<N> Mesh<N>::fill(const tc::Group &g, std::vector<int> ctx) {
|
Mesh<N> Mesh<N>::fill(const tc::Group &g, const std::vector<int> &ctx) {
|
||||||
if (ctx.size() + 1 != N)
|
if (ctx.size() + 1 != N)
|
||||||
throw std::logic_error("ctx size must be one less than N");
|
throw std::logic_error("ctx size must be one less than N");
|
||||||
|
|
||||||
@@ -212,22 +212,45 @@ Mesh<N> Mesh<N>::fill(const tc::Group &g, std::vector<int> ctx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
Mesh<1> Mesh<1>::fill(const tc::Group &g, std::vector<int> ctx) {
|
Mesh<1> Mesh<1>::fill(const tc::Group &g, const std::vector<int> &ctx) {
|
||||||
if (not ctx.empty())
|
if (not ctx.empty())
|
||||||
throw std::logic_error("ctx must be empty for a trivial Mesh.");
|
throw std::logic_error("ctx must be empty for a trivial Mesh.");
|
||||||
|
|
||||||
return Mesh<1>(g, ctx, 1);
|
return Mesh<1>(g, ctx, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<unsigned N>
|
template<unsigned N, class C, class SC>
|
||||||
template<class SC>
|
Mesh<N> fill_each_tile_merge(const tc::Group &g, const C &ctx, const SC &sub_ctxs) {
|
||||||
Mesh<N> Mesh<N>::hull(const tc::Group &g, const std::vector<int> ctx, const SC &sub_ctxs) {
|
|
||||||
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).each_tile(ctx);
|
auto root = Mesh<N>::fill(g, sub_ctx);
|
||||||
parts.insert(parts.end(), face.begin(), face.end());
|
auto faces = root.each_tile(ctx);
|
||||||
|
parts.insert(parts.end(), faces.begin(), faces.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
return merge(parts);
|
return merge(parts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<unsigned N, class SC>
|
||||||
|
Mesh<N> fill_each_tile_merge(const tc::Group &g, const SC &sub_ctxs) {
|
||||||
|
return fill_each_tile_merge<N>(g, generators(g), sub_ctxs);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<unsigned N, class C, class SC>
|
||||||
|
Mesh<N> fill_each_recontext_merge(const tc::Group &g, const C &ctx, const SC &sub_ctxs) {
|
||||||
|
std::vector<Mesh<N>> parts;
|
||||||
|
|
||||||
|
for (const auto &sub_ctx : sub_ctxs) {
|
||||||
|
auto root = Mesh<N>::fill(g, sub_ctx);
|
||||||
|
auto face = root.recontext(ctx);
|
||||||
|
parts.insert(parts.end(), face);
|
||||||
|
}
|
||||||
|
|
||||||
|
return merge(parts);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<unsigned N, class SC>
|
||||||
|
Mesh<N> fill_each_recontext_merge(const tc::Group &g, const SC &sub_ctxs) {
|
||||||
|
return fill_each_recontext_merge<N>(g, generators(g), sub_ctxs);
|
||||||
|
}
|
||||||
|
|||||||
@@ -50,14 +50,14 @@ public:
|
|||||||
4, 5) {
|
4, 5) {
|
||||||
using namespace nanogui;
|
using namespace nanogui;
|
||||||
|
|
||||||
Window *window = new Window(this, "Sample Window");
|
auto *window = new Window(this, "Sample Window");
|
||||||
window->setPosition(Vector2i(15, 15));
|
window->setPosition(Vector2i(15, 15));
|
||||||
window->setFixedWidth(250);
|
window->setFixedWidth(250);
|
||||||
window->setLayout(new BoxLayout(Orientation::Vertical));
|
window->setLayout(new BoxLayout(Orientation::Vertical));
|
||||||
|
|
||||||
auto pause = new ToolButton(window, ENTYPO_ICON_CONTROLLER_PAUS);
|
// auto pause = new ToolButton(window, ENTYPO_ICON_CONTROLLER_PAUS);
|
||||||
pause->setFlags(Button::ToggleButton);
|
// pause->setFlags(Button::ToggleButton);
|
||||||
pause->setChangeCallback([&](bool value) { this->paused = value; });
|
// pause->setChangeCallback([&](bool value) { this->paused = value; });
|
||||||
|
|
||||||
performLayout();
|
performLayout();
|
||||||
|
|
||||||
@@ -73,31 +73,13 @@ public:
|
|||||||
{0, 1, 2},
|
{0, 1, 2},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
auto mesh = Mesh<4>::hull(group, ctx, selected_ctxs);
|
auto mesh = fill_each_tile_merge<4>(group, selected_ctxs);
|
||||||
|
|
||||||
auto &slice = slices.emplace_back(group);
|
auto &slice = slices.emplace_back(group);
|
||||||
slice.setMesh(mesh);
|
slice.setMesh(mesh);
|
||||||
slice.root << .80, .02, .02, .02, .02;
|
slice.root << .80, .02, .02, .02, .02;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
|
||||||
std::vector<int> symbol = {3, 4, 3, 2};
|
|
||||||
auto group = tc::schlafli(symbol);
|
|
||||||
auto ctx = generators(group);
|
|
||||||
|
|
||||||
auto selected_ctxs = set_union(
|
|
||||||
combinations(std::vector<int>{0, 2, 3, 4}, 3),
|
|
||||||
combinations(std::vector<int>{1, 2, 3, 4}, 3)
|
|
||||||
);
|
|
||||||
|
|
||||||
auto mesh = Mesh<4>::hull(group, ctx, selected_ctxs);
|
|
||||||
|
|
||||||
auto &slice = slices.emplace_back(group);
|
|
||||||
slice.setMesh(mesh);
|
|
||||||
slice.root << .80, .02, .02, .03, .04;
|
|
||||||
slice.color << 0.9, 0.1, 0.1;
|
|
||||||
}
|
|
||||||
|
|
||||||
ren = std::make_unique<SliceRenderer<4>>();
|
ren = std::make_unique<SliceRenderer<4>>();
|
||||||
|
|
||||||
ubo = std::make_unique<cgl::Buffer<Matrices>>();
|
ubo = std::make_unique<cgl::Buffer<Matrices>>();
|
||||||
@@ -134,7 +116,7 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
int main(int argc, char ** argv) {
|
int main(int argc, char **argv) {
|
||||||
try {
|
try {
|
||||||
nanogui::init();
|
nanogui::init();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user