mesh extraction
The snippet can be accessed without any authentication.
Authored by
Zain Selman
bsp.cpp 743 B
auto extractor = std::make_unique<ob::MeshExtractor<bsp_small_config<geometry_t, int>>>();
extractor->extract(bsp);
extractor->to_polymesh(mesh, mesh_pos);
std::vector<pm::vertex_handle> to_delete;
for (auto s = 0; s < extractor->get_submesh_count(); ++s)
{
if (extractor->submesh_label[s] == bsp_t::node_t::label_in)
continue;
auto h0 = mesh.halfedges()[extractor->submesh_any_halfedge[s]];
for (auto v : pm::vertex_component(h0.vertex_to()))
to_delete.push_back(v);
}
for (auto v : to_delete)
mesh.vertices().remove(v);
for (auto e : mesh.edges())
TG_ASSERT(!e.is_boundary());
pm::deduplicate(mesh, mesh_pos);
mesh.compactify();
for (auto e : mesh.edges()) // failed
TG_ASSERT(!e.is_boundary());
Please register or sign in to comment