diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_mesh_segmentation_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_mesh_segmentation_plugin.cpp index 98a1e6fb3a2..d9850db9051 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_mesh_segmentation_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_mesh_segmentation_plugin.cpp @@ -111,6 +111,7 @@ void Polyhedron_demo_mesh_segmentation_plugin::on_SDF_button_clicked() { // create new item new_item = new Scene_polyhedron_item(*item->polyhedron()); + new_item->setGouraudMode(); item->setVisible(false); index = scene->addItem(new_item); @@ -161,6 +162,7 @@ void Polyhedron_demo_mesh_segmentation_plugin::on_Partition_button_clicked() { // create new item new_item = new Scene_polyhedron_item(*item->polyhedron()); + new_item->setGouraudMode(); item->setVisible(false); index = scene->addItem(new_item); @@ -225,11 +227,7 @@ void Polyhedron_demo_mesh_segmentation_plugin::colorize( if(sdf) { double sdf_value = segmentation.get_sdf_value_of_facet(facet_const_it); - facet_sdf_values.push_back(std::pair(facet_it, sdf_value)); - //int sdf_color = static_cast(255.0 * sdf_value); - // - //color_vector.push_back(QColor(sdf_color,sdf_color,sdf_color)); - //facet_it->set_patch_id(patch_id++); + facet_sdf_values.push_back(std::pair(facet_it, sdf_value)); } else { diff --git a/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation.h b/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation.h index e43161c2f88..fd9aba2a2d7 100644 --- a/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation.h +++ b/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation.h @@ -112,6 +112,11 @@ public: : mesh(mesh), facet_index_map(facet_index_map), is_pmmap_custom(true) { } +// Copy-constructor +// Default, we store facet-to-id in property-map adaptor 'FacetIndexMap'. +// It stores a pointer to std::map instance which is a member variable. +// So default copy constructor is not working since copied property-map adaptor still +// points to std::map instance which exists in copied object (rhs). Surface_mesh_segmentation(const Surface_mesh_segmentation& rhs): mesh(rhs.mesh), sdf_values(rhs.sdf_values), centers(rhs.centers), @@ -123,8 +128,9 @@ public: } } -// use another copy of polyhedron but also copy state of rhs -// main difference between copy constructor is rhs.mesh is not equal to mesh. +// Use another copy of polyhedron but also copy the state of rhs. +// Main difference between copy constructor is rhs.mesh is NOT equal to this->mesh. +// So we cannot copy facet_index_map_internal since facet_iterators of 'this' is different than rhs. Surface_mesh_segmentation(const Polyhedron& mesh, const Surface_mesh_segmentation& rhs) : mesh(mesh), sdf_values(rhs.sdf_values), centers(rhs.centers),