Skip to content
Snippets Groups Projects

mesh extraction

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    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());
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment