reset surface patch colors to have the same patch ID everywhere

This commit is contained in:
Jane Tournois 2025-06-16 17:06:53 +02:00
parent 0860e790c4
commit d034ff373c
2 changed files with 29 additions and 0 deletions

View File

@ -252,6 +252,13 @@ QMenu* Scene_c3t3_item::contextMenu()
SIGNAL(triggered()), this,
SLOT(export_facets_in_complex()));
QAction* actionResetSurfacePatches = menu->addAction(tr("Reset surface patches"));
actionResetSurfacePatches->setObjectName("actionResetSurfacePatches");
connect(actionResetSurfacePatches,
SIGNAL(triggered()),
this,
SLOT(reset_surface_patches()));
menu->setProperty(prop_name, true);
}
return menu;
@ -331,6 +338,27 @@ void Scene_c3t3_item::export_facets_in_complex()
this->setVisible(false);
}
void Scene_c3t3_item::reset_surface_patches()
{
if(c3t3().number_of_facets() == 0)
{
CGAL::Three::Three::warning(tr("There are no facets in the complex."));
return;
}
const C3t3::Facet first_facet = *c3t3().facets_in_complex_begin();
const C3t3::Surface_patch_index first_index = c3t3().surface_patch_index(first_facet);
for(auto f : c3t3().facets_in_complex())
{
const auto mf = c3t3().triangulation().mirror_facet(f);
f.first->set_surface_patch_index(f.second, first_index);
mf.first->set_surface_patch_index(mf.second, first_index);
}
this->invalidateOpenGLBuffers();
Q_EMIT itemChanged();
}
void Scene_c3t3_item::drawEdges(Viewer_interface *viewer) const
{
Scene_triangulation_3_item::drawEdges(viewer);

View File

@ -77,6 +77,7 @@ using namespace CGAL::Three;
public Q_SLOTS:
void show_cnc(bool);
void export_facets_in_complex();
void reset_surface_patches();
void initializeBuffers(Viewer_interface *) const override;
void computeElements() const override;
void set_sharp_edges_angle(double d);