we must invalidate face_boundaries to take corner changes into account

This commit is contained in:
Sébastien Loriot 2022-10-10 16:44:46 +02:00
parent 276ddda24c
commit 623a5e0814
2 changed files with 9 additions and 10 deletions

View File

@ -443,6 +443,7 @@ bool decimate_impl(const TriangleMesh& tm,
do
{
std::vector< std::vector<Id_pair> > face_boundaries(nb_corners_and_nb_cc.second);
std::vector<bool> face_boundaries_valid(nb_corners_and_nb_cc.second, true);
// collect maximal constrained edges per cc
for(halfedge_descriptor h : halfedges(tm))
{
@ -485,6 +486,9 @@ bool decimate_impl(const TriangleMesh& tm,
triangles.clear();
const std::vector< Id_pair >& csts = face_boundaries[cc_id];
if (!face_boundaries_valid[cc_id]) continue;
if (csts.size()==3)
{
triangles.push_back( make_array(csts[0].first,
@ -529,7 +533,11 @@ bool decimate_impl(const TriangleMesh& tm,
for (halfedge_descriptor h : halfedges_around_target(halfedge(v, tm), tm))
{
if (!is_border(h, tm))
cc_to_handle.set(get(face_cc_ids, face(h, tm)), 1);
{
std::size_t other_cc_id = get(face_cc_ids, face(h, tm));
cc_to_handle.set(other_cc_id, 1);
face_boundaries_valid[ other_cc_id ]=false;
}
}
}
cc_to_handle.set(cc_id, 0);

View File

@ -36,10 +36,7 @@ int main()
// call the decimation function
if (!PMP::remesh_planar_patches(sm))
{
std::cerr << "ERROR: decimate cannot be done correctly\n";
continue;
}
ss=std::stringstream();
ss << "out" << i << ".off";
std::ofstream out(ss.str().c_str());
@ -59,10 +56,7 @@ int main()
// call the decimation function
if (!PMP::remesh_planar_patches(sm, CGAL::parameters::cosinus_threshold(-0.99)))
{
std::cerr << "ERROR: decimate cannot be done correctly\n";
continue;
}
ss=std::stringstream();
ss << "out_a" << i << ".off";
std::ofstream out(ss.str().c_str());
@ -140,10 +134,7 @@ int main()
// call the decimation function
if (!PMP::decimate_with_pca_for_coplanarity(sm, 1e-5, -0.99))
{
std::cerr << "ERROR: decimate cannot be done correctly\n";
continue;
}
ss=std::stringstream();
ss << "out_a_pca" << i << ".off";
std::ofstream out(ss.str().c_str());