From 98754f2e21e212e4de08daeeabb460851549deff Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Thu, 9 Mar 2023 11:15:47 +0100 Subject: [PATCH 01/15] move doc to header --- Mesh_3/doc/Mesh_3/CGAL/Mesh_edge_criteria_3.h | 53 --------------- Mesh_3/doc/Mesh_3/Doxyfile.in | 3 +- Mesh_3/include/CGAL/Mesh_edge_criteria_3.h | 68 +++++++++++++++---- 3 files changed, 58 insertions(+), 66 deletions(-) delete mode 100644 Mesh_3/doc/Mesh_3/CGAL/Mesh_edge_criteria_3.h diff --git a/Mesh_3/doc/Mesh_3/CGAL/Mesh_edge_criteria_3.h b/Mesh_3/doc/Mesh_3/CGAL/Mesh_edge_criteria_3.h deleted file mode 100644 index 3acbda1bd27..00000000000 --- a/Mesh_3/doc/Mesh_3/CGAL/Mesh_edge_criteria_3.h +++ /dev/null @@ -1,53 +0,0 @@ -namespace CGAL { - -/*! -\ingroup PkgMesh3MeshClasses - -The function object class `Mesh_edge_criteria_3` is a model of `MeshEdgeCriteria_3`. It -provides a bound for the size criterion. - -\cgalModels `MeshEdgeCriteria_3` - -\sa `MeshCriteria_3` -\sa `CGAL::Mesh_criteria_3` -\sa `MeshDomainField_3` - -*/ -template< typename Tr > -class Mesh_edge_criteria_3 { -public: - -/// \name Types -/// @{ - -/*! -Numerical type. -*/ -typedef Tr::Geom_traits::FT FT; - -/// @} - -/// \name Creation -/// @{ - -/*! -Returns an object to serve as criteria for edges. -The argument `length_bound` is an upper bound -for the length of the edges which are used to discretize the curves. -Note that if one parameter is set to 0, then its corresponding criteria is ignored. -*/ -Mesh_edge_criteria_3(const FT& length_bound); - -/*! -Returns an object to serve as criteria for edges. The type `SizingField` -must be a model of concept `MeshDomainField_3`. The behavior and semantic of the argument are the same -as above, except that the length -parameter is a functional instead of a constant. -*/ -template -Mesh_edge_criteria_3(const SizingField& length_bound); - -/// @} - -}; /* end Mesh_edge_criteria_3 */ -} /* end namespace CGAL */ diff --git a/Mesh_3/doc/Mesh_3/Doxyfile.in b/Mesh_3/doc/Mesh_3/Doxyfile.in index 13f34ec4653..0093550236d 100644 --- a/Mesh_3/doc/Mesh_3/Doxyfile.in +++ b/Mesh_3/doc/Mesh_3/Doxyfile.in @@ -18,7 +18,8 @@ INPUT += \ ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_facet_topology.h \ ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_vertex_base_3.h \ ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_cell_base_3.h \ - ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Compact_mesh_cell_base_3.h + ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Compact_mesh_cell_base_3.h \ + ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_edge_criteria_3.h PROJECT_NAME = "CGAL ${CGAL_DOC_VERSION} - 3D Mesh Generation" HTML_EXTRA_FILES = ${CGAL_PACKAGE_DOC_DIR}/fig/implicit_domain_3.jpg \ diff --git a/Mesh_3/include/CGAL/Mesh_edge_criteria_3.h b/Mesh_3/include/CGAL/Mesh_edge_criteria_3.h index d45ff426f9f..d059f00a51f 100644 --- a/Mesh_3/include/CGAL/Mesh_edge_criteria_3.h +++ b/Mesh_3/include/CGAL/Mesh_edge_criteria_3.h @@ -85,41 +85,83 @@ namespace internal { } // end namespace internal } // end namespace Mesh_3 +/*! +\ingroup PkgMesh3MeshClasses + +The function object class `Mesh_edge_criteria_3` is a model of `MeshEdgeCriteria_3`. It +provides a bound for the size criterion. + +\cgalModels `MeshEdgeCriteria_3` + +\sa `MeshCriteria_3` +\sa `CGAL::Mesh_criteria_3` +\sa `MeshDomainField_3` + +*/ template < typename Tr > class Mesh_edge_criteria_3 { +private: typedef Mesh_edge_criteria_3 Self; + typedef typename Tr::Geom_traits Gt; public: - typedef typename Tr::Vertex::Index Index; - typedef typename Tr::Geom_traits Gt; - typedef typename Gt::FT FT; - typedef typename Tr::Bare_point Point_3; + /// \name Types + /// @{ + /*! + Numerical type. + */ + typedef typename Tr::Geom_traits::FT FT; + typedef typename Tr::Vertex::Index Index; + typedef typename Tr::Bare_point Point_3; - /// Constructors - Mesh_edge_criteria_3(const FT& value) + /// @} + + + /// \name Creation + /// @{ + /*! + * Returns an object to serve as criteria for edges. + * The argument `length_bound` is an upper bound + * for the length of the edges which are used to discretize the curves. + * Note that if one parameter is set to 0, then its corresponding criteria is ignored. + */ + Mesh_edge_criteria_3(const FT& length_bound) : p_size_(new Mesh_3::internal::Sizing_field_container< Mesh_constant_domain_field_3 , FT, Point_3, - Index>(value)) + Index>(length_bound)) {} // Nb: SFINAE to avoid wrong matches with built-in numerical types // as int. - template < typename Sizing_field > + /*! + * @tparam SizingField a model of `MeshDomainField_3` + * + * Returns an object to serve as criteria for edges. + * The behavior and semantic of the argument are the same + * as above, except that the `length_bound` + * parameter is a functional instead of a constant. + */ + template < typename SizingField > Mesh_edge_criteria_3 ( - const Sizing_field& size, - std::enable_if_t::value>* = 0 + const SizingField& length_bound +#ifndef DOXYGEN_RUNNING + , std::enable_if_t::value>* = 0 +#endif ) { - p_size_ = new Mesh_3::internal::Sizing_field_container(size); + Index>(length_bound); } + /// @} + +#ifndef DOXYGEN_RUNNING Mesh_edge_criteria_3(const Self& rhs) : p_size_(rhs.p_size_->clone()) {} @@ -133,6 +175,8 @@ public: FT sizing_field(const Point_3& p, const int dim, const Index& index) const { return (*p_size_)(p,dim,index); } +#endif + private: typedef Mesh_3::internal::Sizing_field_interface Sizing_field_interface; From 818b08f331bc94a31fea7ef6dade12333ec69d2c Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Thu, 9 Mar 2023 14:04:55 +0100 Subject: [PATCH 02/15] add edge_min_size to constrain protecting balls placement to insert no feature smaller than the given bound --- Mesh_3/include/CGAL/Mesh_criteria_3.h | 3 +- Mesh_3/include/CGAL/Mesh_edge_criteria_3.h | 18 ++++- Mesh_3/include/CGAL/make_mesh_3.h | 2 +- Mesh_3/test/Mesh_3/CMakeLists.txt | 6 +- Mesh_3/test/Mesh_3/test_min_edge_length.cpp | 71 +++++++++++++++++++ .../internal/parameters_interface.h | 1 + 6 files changed, 95 insertions(+), 6 deletions(-) create mode 100644 Mesh_3/test/Mesh_3/test_min_edge_length.cpp diff --git a/Mesh_3/include/CGAL/Mesh_criteria_3.h b/Mesh_3/include/CGAL/Mesh_criteria_3.h index c7dcfeb33ab..cbb61b8ba50 100644 --- a/Mesh_3/include/CGAL/Mesh_criteria_3.h +++ b/Mesh_3/include/CGAL/Mesh_criteria_3.h @@ -72,7 +72,8 @@ public: Mesh_criteria_3_impl(const CGAL_NP_CLASS& np) :edge_criteria_(parameters::choose_parameter(parameters::get_parameter(np, internal_np::edge_size_param), parameters::choose_parameter(parameters::get_parameter_reference(np, internal_np::edge_sizing_field_param), - parameters::choose_parameter(parameters::get_parameter(np, internal_np::sizing_field_param), FT(DBL_MAX))))), + parameters::choose_parameter(parameters::get_parameter(np, internal_np::sizing_field_param), FT(DBL_MAX)))), + parameters::choose_parameter(parameters::get_parameter(np, internal_np::edge_min_size_param), FT(0))), facet_criteria_(parameters::choose_parameter(parameters::get_parameter(np, internal_np::facet_angle_param), FT(0)), parameters::choose_parameter(parameters::get_parameter(np, internal_np::facet_size_param), parameters::choose_parameter(parameters::get_parameter_reference(np, internal_np::facet_sizing_field_param), diff --git a/Mesh_3/include/CGAL/Mesh_edge_criteria_3.h b/Mesh_3/include/CGAL/Mesh_edge_criteria_3.h index d059f00a51f..8f8fdefa6e1 100644 --- a/Mesh_3/include/CGAL/Mesh_edge_criteria_3.h +++ b/Mesh_3/include/CGAL/Mesh_edge_criteria_3.h @@ -126,12 +126,14 @@ public: * for the length of the edges which are used to discretize the curves. * Note that if one parameter is set to 0, then its corresponding criteria is ignored. */ - Mesh_edge_criteria_3(const FT& length_bound) + Mesh_edge_criteria_3(const FT& length_bound, + const FT& min_length_bound = 0.) : p_size_(new Mesh_3::internal::Sizing_field_container< Mesh_constant_domain_field_3 , FT, Point_3, Index>(length_bound)) + , min_length_bound_(min_length_bound) {} // Nb: SFINAE to avoid wrong matches with built-in numerical types @@ -147,11 +149,13 @@ public: template < typename SizingField > Mesh_edge_criteria_3 ( - const SizingField& length_bound + const SizingField& length_bound, + const FT& min_length_bound = 0. #ifndef DOXYGEN_RUNNING , std::enable_if_t::value>* = 0 #endif ) + : min_length_bound_(min_length_bound) { p_size_ = new Mesh_3::internal::Sizing_field_containerclone()) {} + : p_size_(rhs.p_size_->clone()) + , min_length_bound_(rhs.min_length_bound_) + {} /// Destructor ~Mesh_edge_criteria_3() @@ -175,6 +181,11 @@ public: FT sizing_field(const Point_3& p, const int dim, const Index& index) const { return (*p_size_)(p,dim,index); } +public: + const FT& min_length_bound() const + { + return min_length_bound_; + } #endif private: @@ -184,6 +195,7 @@ private: // A pointer to Sizing_field_interface to handle dynamic wrapping of // real Sizing_field type Sizing_field_interface* p_size_; + const FT min_length_bound_; }; } // end namespace CGAL diff --git a/Mesh_3/include/CGAL/make_mesh_3.h b/Mesh_3/include/CGAL/make_mesh_3.h index 7160b9944d4..f19ac1df4e7 100644 --- a/Mesh_3/include/CGAL/make_mesh_3.h +++ b/Mesh_3/include/CGAL/make_mesh_3.h @@ -111,7 +111,7 @@ void init_c3t3_with_features(C3T3& c3t3, protect_edges(c3t3, domain, Sizing_field(criteria.edge_criteria_object()), - typename Edge_criteria::FT(), + criteria.edge_criteria_object().min_length_bound(), maximal_number_of_vertices, pointer_to_error_code #ifndef CGAL_NO_ATOMIC diff --git a/Mesh_3/test/Mesh_3/CMakeLists.txt b/Mesh_3/test/Mesh_3/CMakeLists.txt index e1bc8829add..de75c59a614 100644 --- a/Mesh_3/test/Mesh_3/CMakeLists.txt +++ b/Mesh_3/test/Mesh_3/CMakeLists.txt @@ -52,6 +52,7 @@ create_single_source_cgal_program( "test_mesh_3_issue_1554.cpp" ) create_single_source_cgal_program( "test_mesh_polyhedral_domain_with_features_deprecated.cpp" ) create_single_source_cgal_program( "test_meshing_with_one_step.cpp" ) create_single_source_cgal_program( "test_mesh_cell_base_3.cpp") +create_single_source_cgal_program( "test_min_edge_length.cpp") foreach(target test_boost_has_xxx @@ -80,7 +81,9 @@ foreach(target test_mesh_3_issue_1554 test_mesh_polyhedral_domain_with_features_deprecated test_mesh_cell_base_3 - test_meshing_with_one_step.cpp) + test_meshing_with_one_step + test_min_edge_length + ) if(TARGET ${target}) target_link_libraries(${target} PUBLIC CGAL::Eigen3_support) endif() @@ -103,6 +106,7 @@ if(TARGET CGAL::TBB_support) test_mesh_3_issue_1554 test_mesh_polyhedral_domain_with_features_deprecated test_mesh_cell_base_3 + test_min_edge_length ) if(TARGET ${target}) target_link_libraries(${target} PUBLIC CGAL::TBB_support) diff --git a/Mesh_3/test/Mesh_3/test_min_edge_length.cpp b/Mesh_3/test/Mesh_3/test_min_edge_length.cpp new file mode 100644 index 00000000000..359b5e846d2 --- /dev/null +++ b/Mesh_3/test/Mesh_3/test_min_edge_length.cpp @@ -0,0 +1,71 @@ +#include + +#include +#include +#include +#include + +#include +#include + +template +struct Tester { + // Domain + typedef CGAL::Polyhedral_mesh_domain_with_features_3 Mesh_domain; + + + // Triangulation + typedef typename CGAL::Mesh_triangulation_3::type Tr; + + typedef CGAL::Mesh_complex_3_in_triangulation_3 C3t3; + + // Criteria + typedef CGAL::Mesh_criteria_3 Mesh_criteria; + + int operator()(const std::string fname, const std::string out_fname) + { + std::ifstream input(fname); + using namespace CGAL::parameters; + + Polyhedron polyhedron; + input >> polyhedron; + if (input.fail()) { + std::cerr << "Error: Cannot read file " << fname << std::endl; + return EXIT_FAILURE; + } + + if (!CGAL::is_triangle_mesh(polyhedron)) { + std::cerr << "Input geometry is not triangulated." << std::endl; + return EXIT_FAILURE; + } + + // Create domain + Mesh_domain domain(polyhedron); + + domain.detect_features(); + + // Mesh criteria + Mesh_criteria criteria(edge_size = 0.2, + edge_min_size = 0.1, + facet_distance = 0.02, + cell_radius_edge_ratio = 3); + + // Mesh generation + C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria); + + // Output + CGAL::dump_c3t3(c3t3, out_fname); + + return EXIT_SUCCESS; + } +}; + +int main(int argc, char* argv[]) +{ + const std::string fname = (argc > 1) ? argv[1] : CGAL::data_file_path("meshes/star.off"); + + typedef CGAL::Exact_predicates_inexact_constructions_kernel K; + typedef CGAL::Surface_mesh Surface_mesh; + + return Tester()(fname, "out-star"); +} diff --git a/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h b/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h index 478cedf5340..fea2ae9c4b1 100644 --- a/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h +++ b/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h @@ -327,6 +327,7 @@ CGAL_add_named_parameter_with_compatibility(surface_patch_index_t, surface_patch CGAL_add_named_parameter_with_compatibility_ref_only(weights_param_t, weights_param, weights) CGAL_add_named_parameter_with_compatibility(edge_size_param_t, edge_size_param, edge_size) +CGAL_add_named_parameter_with_compatibility(edge_min_size_param_t, edge_min_size_param, edge_min_size) CGAL_add_named_parameter_with_compatibility_ref_only(edge_sizing_field_param_t, edge_sizing_field_param, edge_sizing_field) CGAL_add_named_parameter_with_compatibility(facet_angle_param_t, facet_angle_param, facet_angle) CGAL_add_named_parameter_with_compatibility(facet_size_param_t, facet_size_param, facet_size) From 61b4201242c4e28f6a68f0599a55b0f2321c153c Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Thu, 9 Mar 2023 15:57:21 +0100 Subject: [PATCH 03/15] add edge_min_size in demo --- .../Plugins/Mesh_3/Mesh_3_plugin.cpp | 38 ++++++++++ .../Mesh_3/Mesh_3_plugin_cgal_code.cpp | 28 ++++++-- .../Plugins/Mesh_3/Mesh_3_plugin_cgal_code.h | 4 ++ .../Polyhedron/Plugins/Mesh_3/Mesh_function.h | 20 +++--- .../Plugins/Mesh_3/Meshing_dialog.ui | 72 ++++++++++++------- 5 files changed, 122 insertions(+), 40 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp index e1b3770c225..8799998fe52 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp @@ -70,6 +70,7 @@ class Mesh_3_plugin : READ get_sharp_edges_angle_bound WRITE set_sharp_edges_angle_bound) Q_PROPERTY(double edges_sizing READ get_edges_sizing WRITE set_edges_sizing) + Q_PROPERTY(double edges_min_sizing READ get_edges_min_sizing WRITE set_edges_min_sizing) Q_PROPERTY(double facets_sizing READ get_facets_sizing WRITE set_facets_sizing) Q_PROPERTY(double approx READ get_approx WRITE set_approx) Q_PROPERTY(double tets_sizing READ get_tets_sizing WRITE set_tets_sizing) @@ -155,6 +156,7 @@ public Q_SLOTS: sharp_edges_angle_bound = v; } void set_edges_sizing(const double v) { edges_sizing = v; }; + void set_edges_min_sizing(const double v) { edges_min_sizing = v; }; void set_facets_sizing(const double v) { facets_sizing = v; }; void set_approx(const double v) { approx = v; }; void set_tets_sizing(const double v) { tets_sizing = v; }; @@ -167,6 +169,7 @@ public Q_SLOTS: double get_angle() { return angle; }; double get_sharp_edges_angle_bound() { return sharp_edges_angle_bound; } double get_edges_sizing() { return edges_sizing; }; + double get_edges_min_sizing() { return edges_min_sizing; }; double get_facets_sizing() { return facets_sizing; }; double get_approx() { return approx; }; double get_tets_sizing() { return tets_sizing; }; @@ -202,6 +205,7 @@ private: double approx; int approx_decimals; double edges_sizing; + double edges_min_sizing; double facets_sizing; double tets_sizing; double tets_shape; @@ -396,6 +400,7 @@ void Mesh_3_plugin::set_defaults() { double diag = CGAL::sqrt((bbox.xmax()-bbox.xmin())*(bbox.xmax()-bbox.xmin()) + (bbox.ymax()-bbox.ymin())*(bbox.ymax()-bbox.ymin()) + (bbox.zmax()-bbox.zmin())*(bbox.zmax()-bbox.zmin())); facets_sizing = get_approximate(diag * 0.05, 2, sizing_decimals); edges_sizing = facets_sizing; + edges_min_sizing = 0.1 * facets_sizing; tets_sizing = facets_sizing; angle = 25.; sharp_edges_angle_bound = 60.; @@ -478,6 +483,7 @@ void Mesh_3_plugin::mesh_3(const Mesh_type mesh_type, ui.tetShape, SLOT(setEnabled(bool))); + //edge sizing connect(ui.protect, SIGNAL(toggled(bool)), ui.noEdgeSizing, @@ -498,6 +504,28 @@ void Mesh_3_plugin::mesh_3(const Mesh_type mesh_type, ui.edgeSizing, SLOT(setEnabled(bool))); + //edge min sizing + connect(ui.protect, + SIGNAL(toggled(bool)), + ui.noEdgeMinSizing, + SLOT(setEnabled(bool))); + + connect(ui.protect, + SIGNAL(toggled(bool)), + ui.noEdgeMinSizing, + SLOT(setChecked(bool))); + + connect(ui.noEdgeMinSizing, + SIGNAL(toggled(bool)), + ui.edgeMinSizingLabel, + SLOT(setEnabled(bool))); + + connect(ui.noEdgeMinSizing, + SIGNAL(toggled(bool)), + ui.edgeMinSizing, + SLOT(setEnabled(bool))); + + //sharp edges connect(ui.protect, SIGNAL(toggled(bool)), ui.sharpEdgesAngle, @@ -531,6 +559,7 @@ void Mesh_3_plugin::mesh_3(const Mesh_type mesh_type, diag); // max ui.facetSizing->setValue(facets_sizing); ui.edgeSizing->setValue(edges_sizing); + ui.edgeMinSizing->setValue(edges_min_sizing); ui.tetSizing->setRange(diag * 10e-6, // min diag); // max @@ -568,8 +597,11 @@ void Mesh_3_plugin::mesh_3(const Mesh_type mesh_type, " automatically")); } ui.noEdgeSizing->setChecked(ui.protect->isChecked()); + ui.noEdgeMinSizing->setChecked(false); ui.edgeLabel->setEnabled(ui.noEdgeSizing->isChecked()); ui.edgeSizing->setEnabled(ui.noEdgeSizing->isChecked()); + ui.edgeMinSizingLabel->setEnabled(ui.noEdgeMinSizing->isChecked()); + ui.edgeMinSizing->setEnabled(ui.noEdgeMinSizing->isChecked()); if (features_protection_available) { if (items->which() == POLYHEDRAL_MESH_ITEMS) { @@ -625,6 +657,8 @@ void Mesh_3_plugin::mesh_3(const Mesh_type mesh_type, std::cerr << "sharp_edges_angle_bound: " << sharp_edges_angle_bound << '\n'; edges_sizing = !ui.noEdgeSizing->isChecked() ? DBL_MAX : ui.edgeSizing->value(); + edges_min_sizing = + !ui.noEdgeMinSizing->isChecked() ? 0. : ui.edgeMinSizing->value(); facets_sizing = !ui.noFacetSizing->isChecked() ? 0 : ui.facetSizing->value(); approx = !ui.noApprox->isChecked() ? 0 : ui.approx->value(); tets_shape = !ui.noTetShape->isChecked() ? 0 : ui.tetShape->value(); @@ -701,6 +735,7 @@ void Mesh_3_plugin::mesh_3(const Mesh_type mesh_type, approx, tets_sizing, edges_sizing, + edges_min_sizing, tets_shape, protect_features, protect_borders, @@ -719,6 +754,7 @@ void Mesh_3_plugin::mesh_3(const Mesh_type mesh_type, approx, tets_sizing, edges_sizing, + edges_min_sizing, tets_shape, protect_features, protect_borders, @@ -743,6 +779,7 @@ void Mesh_3_plugin::mesh_3(const Mesh_type mesh_type, approx, tets_sizing, edges_sizing, + edges_min_sizing, tets_shape, manifold, mesh_type == Mesh_type::SURFACE_ONLY); @@ -779,6 +816,7 @@ void Mesh_3_plugin::mesh_3(const Mesh_type mesh_type, approx, tets_sizing, edges_sizing, + edges_min_sizing, tets_shape, protect_features, manifold, diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.cpp index c4f59578610..b1df533198a 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.cpp @@ -40,6 +40,7 @@ Meshing_thread* cgal_code_mesh_3(QList pMeshes, const double facet_approx, const double tet_sizing, const double edge_size, + const double edge_min_size, const double tet_shape, bool protect_features, bool protect_borders, @@ -52,6 +53,7 @@ Meshing_thread* cgal_code_mesh_3(QList pMeshes, std::cerr << "Meshing file \"" << qPrintable(filename) << "\"\n"; std::cerr << " angle: " << facet_angle << std::endl << " edge size bound: " << edge_size << std::endl + << " edge min size bound: " << edge_min_size << std::endl << " facets size bound: " << facet_sizing << std::endl << " approximation bound: " << facet_approx << std::endl; if (!surface_only) @@ -101,10 +103,12 @@ Meshing_thread* cgal_code_mesh_3(QList pMeshes, "
    " "
  • Angle: %1
  • " "
  • Edge size bound: %2
  • " - "
  • Facets size bound: %3
  • " - "
  • Approximation bound: %4
  • ") + "
  • Edge min size bound: %3
  • " + "
  • Facets size bound: %4
  • " + "
  • Approximation bound: %5
  • ") .arg(facet_angle) .arg(edge_size) + .arg(edge_min_size) .arg(facet_sizing) .arg(facet_approx); if (!surface_only) @@ -120,6 +124,7 @@ Meshing_thread* cgal_code_mesh_3(QList pMeshes, param.tet_sizing = tet_sizing; param.tet_shape = tet_shape; param.edge_sizing = edge_size; + param.edge_min_sizing = edge_min_size; param.manifold = manifold; param.protect_features = protect_features || protect_borders; param.use_sizing_field_with_aabb_tree = polylines.empty() && protect_features; @@ -139,6 +144,7 @@ Meshing_thread* cgal_code_mesh_3(const QList pMeshes, const double facet_approx, const double tet_sizing, const double edge_size, + const double edge_min_size, const double tet_shape, bool protect_features, bool protect_borders, @@ -151,6 +157,7 @@ Meshing_thread* cgal_code_mesh_3(const QList pMeshes, std::cerr << "Meshing file \"" << qPrintable(filename) << "\"\n"; std::cerr << " angle: " << facet_angle << std::endl << " edge size bound: " << edge_size << std::endl + << " edge min size bound: " << edge_min_size << std::endl << " facets size bound: " << facet_sizing << std::endl << " approximation bound: " << facet_approx << std::endl; if (!surface_only) @@ -195,10 +202,12 @@ Meshing_thread* cgal_code_mesh_3(const QList pMeshes, "
      " "
    • Angle: %1
    • " "
    • Edge size bound: %2
    • " - "
    • Facets size bound: %3
    • " - "
    • Approximation bound: %4
    • ") + "
    • Edge min size bound :%3
    • " + "
    • Facets size bound: %4
    • " + "
    • Approximation bound: %5
    • ") .arg(facet_angle) .arg(edge_size) + .arg(edge_min_size) .arg(facet_sizing) .arg(facet_approx); if (!surface_only) @@ -214,6 +223,7 @@ Meshing_thread* cgal_code_mesh_3(const QList pMeshes, param.tet_sizing = tet_sizing; param.tet_shape = tet_shape; param.edge_sizing = edge_size; + param.edge_min_sizing = edge_min_size; param.manifold = manifold; param.protect_features = protect_features || protect_borders; param.use_sizing_field_with_aabb_tree = protect_features; @@ -234,6 +244,7 @@ Meshing_thread* cgal_code_mesh_3(const Implicit_function_interface* pfunction, const double facet_approx, const double tet_sizing, const double edge_size, + const double edge_min_size, const double tet_shape, const int manifold, const bool surface_only) @@ -263,6 +274,7 @@ Meshing_thread* cgal_code_mesh_3(const Implicit_function_interface* pfunction, param.tet_sizing = tet_sizing; param.tet_shape = tet_shape; param.edge_sizing = edge_size; + param.edge_min_sizing = edge_min_size; param.manifold = manifold; param.detect_connected_components = false; // to avoid random values // in the debug displays @@ -290,6 +302,7 @@ Meshing_thread* cgal_code_mesh_3(const Image* pImage, const double facet_approx, const double tet_sizing, const double edge_size, + const double edge_min_size, const double tet_shape, bool protect_features, const int manifold, @@ -314,6 +327,7 @@ Meshing_thread* cgal_code_mesh_3(const Image* pImage, param.facet_approx = facet_approx; param.tet_sizing = tet_sizing; param.edge_sizing = edge_size; + param.edge_min_sizing = edge_min_size; param.tet_shape = tet_shape; param.manifold = manifold; param.image_3_ptr = pImage; @@ -324,10 +338,12 @@ Meshing_thread* cgal_code_mesh_3(const Image* pImage, "
        " "
      • Angle: %1
      • " "
      • Edge size bound: %2
      • " - "
      • Facets size bound: %3
      • " - "
      • Approximation bound: %4
      • ") + "
      • Edge min size bound: %3
      • " + "
      • Facets size bound: %4
      • " + "
      • Approximation bound: %5
      • ") .arg(facet_angle) .arg(edge_size) + .arg(edge_min_size) .arg(facet_sizing) .arg(facet_approx); if (!surface_only) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.h b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.h index 4928982cf1e..68916d34dc7 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.h +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.h @@ -29,6 +29,7 @@ Meshing_thread* cgal_code_mesh_3(QList pMeshes, const double facet_approx, const double tet_sizing, const double edge_size, + const double edge_min_size, const double tet_shape, bool protect_features, bool protect_border, @@ -44,6 +45,7 @@ Meshing_thread* cgal_code_mesh_3(const QList pMeshes, const double facet_approx, const double tet_sizing, const double edge_size, + const double edge_min_size, const double tet_shape, bool protect_features, bool protect_border, @@ -58,6 +60,7 @@ Meshing_thread* cgal_code_mesh_3(const Implicit_function_interface* pfunction, const double facet_approx, const double tet_sizing, const double edge_size, + const double edge_min_size, const double tet_shape, const int manifold, const bool surface_only); @@ -71,6 +74,7 @@ Meshing_thread* cgal_code_mesh_3(const CGAL::Image_3* pImage, const double facet_approx, const double tet_sizing, const double edge_size, + const double edge_min_size, const double tet_shape, bool protect_features, const int manifold, diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_function.h b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_function.h index db87cc01bfd..2394b4b3818 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_function.h +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_function.h @@ -49,6 +49,7 @@ struct Mesh_parameters double tet_shape; double tet_sizing; double edge_sizing; + double edge_min_sizing; bool protect_features; bool detect_connected_components; int manifold; @@ -108,8 +109,8 @@ private: void initialize(const Mesh_criteria& criteria, Mesh_fnt::Domain_tag); void initialize(const Mesh_criteria& criteria, Mesh_fnt::Labeled_image_domain_tag); - Edge_criteria edge_criteria(double b, Mesh_fnt::Domain_tag); - Edge_criteria edge_criteria(double b, Mesh_fnt::Polyhedral_domain_tag); + Edge_criteria edge_criteria(double b, double minb, Mesh_fnt::Domain_tag); + Edge_criteria edge_criteria(double b, double minb, Mesh_fnt::Polyhedral_domain_tag); void tweak_criteria(Mesh_criteria&, Mesh_fnt::Domain_tag) {} void tweak_criteria(Mesh_criteria&, Mesh_fnt::Polyhedral_domain_tag); @@ -137,6 +138,7 @@ log() const { return QStringList() << QString("edge max size: %1").arg(edge_sizing) + << QString("edge min size: %1").arg(edge_min_sizing) << QString("facet min angle: %1").arg(facet_angle) << QString("facet max size: %1").arg(facet_sizing) << QString("facet approx error: %1").arg(facet_approx) @@ -238,9 +240,9 @@ initialize(const Mesh_criteria& criteria, Mesh_fnt::Domain_tag) template < typename D_, typename Tag > typename Mesh_function::Edge_criteria Mesh_function:: -edge_criteria(double b, Mesh_fnt::Domain_tag) +edge_criteria(double b, double minb, Mesh_fnt::Domain_tag) { - return Edge_criteria(b); + return Edge_criteria(b, minb); } #include @@ -249,7 +251,7 @@ edge_criteria(double b, Mesh_fnt::Domain_tag) template < typename D_, typename Tag > typename Mesh_function::Edge_criteria Mesh_function:: -edge_criteria(double edge_size, Mesh_fnt::Polyhedral_domain_tag) +edge_criteria(double edge_size, double minb, Mesh_fnt::Polyhedral_domain_tag) { if(p_.use_sizing_field_with_aabb_tree) { typedef typename Domain::Surface_patch_index_set Set_of_patch_ids; @@ -277,9 +279,9 @@ edge_criteria(double edge_size, Mesh_fnt::Polyhedral_domain_tag) QSharedPointer(patches_ids_vector_p)); std::cerr << "Note: Mesh_3 is using a sizing field based on AABB tree.\n"; - return Edge_criteria(*sizing_field_ptr); + return Edge_criteria(*sizing_field_ptr, minb); } else { - return Edge_criteria(edge_size); + return Edge_criteria(edge_size, minb); } } @@ -293,7 +295,9 @@ launch() #endif // Create mesh criteria - Mesh_criteria criteria(edge_criteria(p_.edge_sizing, Tag()), + Mesh_criteria criteria(edge_criteria(p_.edge_sizing, + p_.edge_min_sizing, + Tag()), Facet_criteria(p_.facet_angle, p_.facet_sizing, p_.facet_approx), diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Meshing_dialog.ui b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Meshing_dialog.ui index 776adbc8766..a8f0fe63da1 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Meshing_dialog.ui +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Meshing_dialog.ui @@ -9,8 +9,8 @@ 0 0 - 568 - 1049 + 780 + 1295 @@ -101,22 +101,15 @@ Sharp features - - + + - 60.00 + 0.0 - - - - - - - true - - + + @@ -134,15 +127,22 @@ - - + + - + 60.00 - - + + + + + + + true + + @@ -157,13 +157,6 @@ - - - - 0.0 - - - @@ -177,6 +170,33 @@ + + + + + + + + + + + Edge min size + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + + + From 3ab8f7223dd0d9663ad81cb0e48e01c20776f4f7 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Fri, 10 Mar 2023 16:12:34 +0100 Subject: [PATCH 04/15] dragknob is better for testing edge_min_size there are 2 very close feature polylines --- Mesh_3/test/Mesh_3/test_min_edge_length.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Mesh_3/test/Mesh_3/test_min_edge_length.cpp b/Mesh_3/test/Mesh_3/test_min_edge_length.cpp index 359b5e846d2..9472b8f7f49 100644 --- a/Mesh_3/test/Mesh_3/test_min_edge_length.cpp +++ b/Mesh_3/test/Mesh_3/test_min_edge_length.cpp @@ -42,16 +42,19 @@ struct Tester { // Create domain Mesh_domain domain(polyhedron); - domain.detect_features(); + domain.detect_features(40); // Mesh criteria - Mesh_criteria criteria(edge_size = 0.2, + Mesh_criteria criteria(edge_size = 0.074, edge_min_size = 0.1, - facet_distance = 0.02, - cell_radius_edge_ratio = 3); + facet_distance = 0.0074, + facet_angle = 25, + facet_size = 0.074, + cell_radius_edge_ratio = 3, + cell_size = 0.074); // Mesh generation - C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria); + C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, no_perturb(), no_exude()); // Output CGAL::dump_c3t3(c3t3, out_fname); @@ -62,10 +65,10 @@ struct Tester { int main(int argc, char* argv[]) { - const std::string fname = (argc > 1) ? argv[1] : CGAL::data_file_path("meshes/star.off"); + const std::string fname = (argc > 1) ? argv[1] : CGAL::data_file_path("meshes/dragknob.off"); typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef CGAL::Surface_mesh Surface_mesh; - return Tester()(fname, "out-star"); + return Tester()(fname, "out-dragknob"); } From 9f7eaca7af750a3f6a7485423b884c8d3445bf8e Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Tue, 14 Mar 2023 16:39:08 +0100 Subject: [PATCH 05/15] improve test --- Mesh_3/test/Mesh_3/test_min_edge_length.cpp | 31 +++++++++++++-------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/Mesh_3/test/Mesh_3/test_min_edge_length.cpp b/Mesh_3/test/Mesh_3/test_min_edge_length.cpp index 9472b8f7f49..fa25c3c29d1 100644 --- a/Mesh_3/test/Mesh_3/test_min_edge_length.cpp +++ b/Mesh_3/test/Mesh_3/test_min_edge_length.cpp @@ -8,21 +8,26 @@ #include #include -template -struct Tester { +#include + + +template +struct Tester +{ // Domain typedef CGAL::Polyhedral_mesh_domain_with_features_3 Mesh_domain; - // Triangulation - typedef typename CGAL::Mesh_triangulation_3::type Tr; + typedef typename CGAL::Mesh_triangulation_3::type Tr; typedef CGAL::Mesh_complex_3_in_triangulation_3 C3t3; // Criteria typedef CGAL::Mesh_criteria_3 Mesh_criteria; - int operator()(const std::string fname, const std::string out_fname) + void operator()(const std::string fname, const std::string out_fname) { std::ifstream input(fname); using namespace CGAL::parameters; @@ -31,12 +36,12 @@ struct Tester { input >> polyhedron; if (input.fail()) { std::cerr << "Error: Cannot read file " << fname << std::endl; - return EXIT_FAILURE; + return; } if (!CGAL::is_triangle_mesh(polyhedron)) { std::cerr << "Input geometry is not triangulated." << std::endl; - return EXIT_FAILURE; + return; } // Create domain @@ -44,8 +49,10 @@ struct Tester { domain.detect_features(40); + Sizing_field_with_aabb_tree sf(0.074, domain.aabb_tree(), domain); + // Mesh criteria - Mesh_criteria criteria(edge_size = 0.074, + Mesh_criteria criteria(edge_size = sf, edge_min_size = 0.1, facet_distance = 0.0074, facet_angle = 25, @@ -58,8 +65,6 @@ struct Tester { // Output CGAL::dump_c3t3(c3t3, out_fname); - - return EXIT_SUCCESS; } }; @@ -70,5 +75,9 @@ int main(int argc, char* argv[]) typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef CGAL::Surface_mesh Surface_mesh; - return Tester()(fname, "out-dragknob"); + Tester()(fname, "out-dragknob-sequential"); + + Tester()(fname, "out-dragknob-parallel"); + + return EXIT_SUCCESS; } From b099befbaa4794ad4977e8aef37eeb3e60c8a7a4 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Mon, 20 Mar 2023 12:39:56 +0100 Subject: [PATCH 06/15] do not add the extra topo criterion when edge_min_size is required it may not succeed when edge_min_size is used --- Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_function.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_function.h b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_function.h index 2394b4b3818..df45473e105 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_function.h +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_function.h @@ -346,8 +346,9 @@ tweak_criteria(Mesh_criteria& c, Mesh_fnt::Polyhedral_domain_tag) { typedef CGAL::Mesh_3::Facet_topological_criterion_with_adjacency New_topo_adj_crit; - if((int(c.facet_criteria_object().topology()) & + if(((int(c.facet_criteria_object().topology()) & CGAL::FACET_VERTICES_ON_SAME_SURFACE_PATCH_WITH_ADJACENCY_CHECK) != 0) + && c.edge_criteria_object().min_length_bound() == 0) { c.add_facet_criterion(new New_topo_adj_crit(this->domain_)); } From 6ae2f004e72fe95f0fc2a9c0b157d3de141acfa4 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Mon, 20 Mar 2023 12:57:20 +0100 Subject: [PATCH 07/15] doc in Mesh_criteria_3 --- Mesh_3/include/CGAL/Mesh_criteria_3.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Mesh_3/include/CGAL/Mesh_criteria_3.h b/Mesh_3/include/CGAL/Mesh_criteria_3.h index cbb61b8ba50..996eae2ada1 100644 --- a/Mesh_3/include/CGAL/Mesh_criteria_3.h +++ b/Mesh_3/include/CGAL/Mesh_criteria_3.h @@ -254,6 +254,16 @@ typedef Mesh_cell_criteria_3 Cell_criteria; * upper bound for the lengths of curve edges. This parameter has to be set to a positive * value when 1-dimensional features protection is used.} * \cgalParamNEnd + * \cgalParamNBegin{edge_min_size} + * \cgalParamDescription{a uniform lower-bound for the lengths of curve edges. + * Only feature edges with a length larger than this bound will be refined. + * If a feature edge is too small with respect to this criterion, + * it will not be refined however the other criteria are met or not.} + * \cgalParamExtra{If this criterion is applied during the meshing process, + * the feature protection algorithm correctness is not guaranteed anymore, + * and the output mesh may contain incorrect polyline features, + * or have missing polyline features.} + * \cgalParamNEnd * \cgalParamNBegin{facet_angle} * \cgalParamDescription{a lower bound for the angles (in degrees) of the * surface mesh facets.} From 2f591dedd92c3442d92c62cf248a96bb1b4fd226 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Mon, 20 Mar 2023 13:03:12 +0100 Subject: [PATCH 08/15] doc --- Mesh_3/include/CGAL/Mesh_edge_criteria_3.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Mesh_3/include/CGAL/Mesh_edge_criteria_3.h b/Mesh_3/include/CGAL/Mesh_edge_criteria_3.h index 8f8fdefa6e1..ffc5d8c5f2e 100644 --- a/Mesh_3/include/CGAL/Mesh_edge_criteria_3.h +++ b/Mesh_3/include/CGAL/Mesh_edge_criteria_3.h @@ -122,9 +122,15 @@ public: /// @{ /*! * Returns an object to serve as criteria for edges. - * The argument `length_bound` is an upper bound + * \param length_bound is an upper bound * for the length of the edges which are used to discretize the curves. - * Note that if one parameter is set to 0, then its corresponding criteria is ignored. + * \param min_length_bound is a lower bound + * for the length of the edges which are used to discretize the curves. + * Only edges that are longer than this bound will be refined. Using + * this lower bound can be handy on some domains, but using it may + * break all the surface topology guarantees of the meshing algorithm. + * + * Note that if one parameter is set to 0, then its corresponding criterion is ignored. */ Mesh_edge_criteria_3(const FT& length_bound, const FT& min_length_bound = 0.) From 7f0087ee721ff7c6128f96a506393aaf0adcc77b Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Fri, 24 Mar 2023 14:10:39 +0100 Subject: [PATCH 09/15] doc --- Mesh_3/include/CGAL/Mesh_criteria_3.h | 4 +++- Mesh_3/include/CGAL/Mesh_edge_criteria_3.h | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Mesh_3/include/CGAL/Mesh_criteria_3.h b/Mesh_3/include/CGAL/Mesh_criteria_3.h index 996eae2ada1..2aadffa6e8a 100644 --- a/Mesh_3/include/CGAL/Mesh_criteria_3.h +++ b/Mesh_3/include/CGAL/Mesh_criteria_3.h @@ -255,7 +255,7 @@ typedef Mesh_cell_criteria_3 Cell_criteria; * value when 1-dimensional features protection is used.} * \cgalParamNEnd * \cgalParamNBegin{edge_min_size} - * \cgalParamDescription{a uniform lower-bound for the lengths of curve edges. + * \cgalParamDescription{a desired uniform lower-bound for the lengths of curve edges. * Only feature edges with a length larger than this bound will be refined. * If a feature edge is too small with respect to this criterion, * it will not be refined however the other criteria are met or not.} @@ -263,6 +263,8 @@ typedef Mesh_cell_criteria_3 Cell_criteria; * the feature protection algorithm correctness is not guaranteed anymore, * and the output mesh may contain incorrect polyline features, * or have missing polyline features.} + * \cgalParamExtra{Note it may not be respected everywhere in the output mesh, + * to keep the feature graph valid.} * \cgalParamNEnd * \cgalParamNBegin{facet_angle} * \cgalParamDescription{a lower bound for the angles (in degrees) of the diff --git a/Mesh_3/include/CGAL/Mesh_edge_criteria_3.h b/Mesh_3/include/CGAL/Mesh_edge_criteria_3.h index ffc5d8c5f2e..34c5cfdd33c 100644 --- a/Mesh_3/include/CGAL/Mesh_edge_criteria_3.h +++ b/Mesh_3/include/CGAL/Mesh_edge_criteria_3.h @@ -124,11 +124,12 @@ public: * Returns an object to serve as criteria for edges. * \param length_bound is an upper bound * for the length of the edges which are used to discretize the curves. - * \param min_length_bound is a lower bound + * \param min_length_bound is a desired lower bound * for the length of the edges which are used to discretize the curves. * Only edges that are longer than this bound will be refined. Using * this lower bound can be handy on some domains, but using it may * break all the surface topology guarantees of the meshing algorithm. + * It is not guaranteed to be exactly respected in the output mesh. * * Note that if one parameter is set to 0, then its corresponding criterion is ignored. */ From 90ce49893c1004947fb5b9b7f33781a3d16b076e Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Fri, 24 Mar 2023 14:25:02 +0100 Subject: [PATCH 10/15] add cout --- Mesh_3/test/Mesh_3/test_min_edge_length.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Mesh_3/test/Mesh_3/test_min_edge_length.cpp b/Mesh_3/test/Mesh_3/test_min_edge_length.cpp index fa25c3c29d1..5f65c365218 100644 --- a/Mesh_3/test/Mesh_3/test_min_edge_length.cpp +++ b/Mesh_3/test/Mesh_3/test_min_edge_length.cpp @@ -75,8 +75,10 @@ int main(int argc, char* argv[]) typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef CGAL::Surface_mesh Surface_mesh; + std::cout << "Sequential test" << std::endl; Tester()(fname, "out-dragknob-sequential"); + std::cout << "Parallel test" << std::endl; Tester()(fname, "out-dragknob-parallel"); return EXIT_SUCCESS; From ffd9c8574c1981c742306d296138d388de1f1b25 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Fri, 24 Mar 2023 14:31:21 +0100 Subject: [PATCH 11/15] CHANGES.md --- Installation/CHANGES.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Installation/CHANGES.md b/Installation/CHANGES.md index 6baa48451f2..8d89724c727 100644 --- a/Installation/CHANGES.md +++ b/Installation/CHANGES.md @@ -45,6 +45,8 @@ for automatic detection and protection of 1D-curves that lie at the intersection of three or more subdomains, extracted from labeled images. +- Added new meshing criterion `edge_min_size` to avoid subdividing sharp edges that are shorter than the prescribed size bound. + ### [Shape Detection](https://doc.cgal.org/5.6/Manual/packages.html#PkgShapeDetection) (breaking change, major changes) - **Breaking change**: The region growing part of the package have been reworked to fix design issues introduced with the handling `FaceGraph` models. From ad7acbde932594a5f4ffc2979e6f1711c186f0ac Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Fri, 24 Mar 2023 15:04:39 +0100 Subject: [PATCH 12/15] fix usage of "features" option in the demo for polyhedral surfaces --- .../Plugins/Mesh_3/Mesh_3_plugin.cpp | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp index 19088c92a9f..cb8915194c0 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp @@ -701,12 +701,23 @@ void Mesh_3_plugin::mesh_3(const Mesh_type mesh_type, tets_sizing = !ui.noTetSizing->isChecked() ? 0 : ui.tetSizing->value(); const int pe_ci = ui.protectEdges->currentIndex(); - protect_borders = ui.protect->isChecked() - && ( pe_ci == ui.protectEdges->findText(on_cube, Qt::MatchContains) - || pe_ci == ui.protectEdges->findText(boundary_only, Qt::MatchContains)); - protect_features = ui.protect->isChecked() - && ( pe_ci == ui.protectEdges->findText(triple_lines, Qt::MatchContains) - || pe_ci == ui.protectEdges->findText(sharp_and_boundary, Qt::MatchContains)); + if (items->which() == IMAGE_MESH_ITEMS) + { + protect_borders = ui.protect->isChecked() + && ( pe_ci == ui.protectEdges->findText(on_cube, Qt::MatchContains) + || pe_ci == ui.protectEdges->findText(boundary_only, Qt::MatchContains)); + protect_features = ui.protect->isChecked() + && ( pe_ci == ui.protectEdges->findText(triple_lines, Qt::MatchContains) + || pe_ci == ui.protectEdges->findText(sharp_and_boundary, Qt::MatchContains)); + } + else if (items->which() == POLYHEDRAL_MESH_ITEMS) + { + protect_borders = ui.protect->isChecked() + && ( pe_ci == ui.protectEdges->findText(sharp_and_boundary, Qt::MatchContains) + || pe_ci == ui.protectEdges->findText(boundary_only, Qt::MatchContains)); + protect_features = ui.protect->isChecked() + && ( pe_ci == ui.protectEdges->findText(sharp_edges, Qt::MatchContains)); + } const bool detect_connected_components = ui.detectComponents->isChecked(); const int manifold = (ui.manifoldCheckBox->isChecked() ? 1 : 0) + From 327527d666de1b918e4e7e3bb57cc9252ace5160 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Fri, 31 Mar 2023 14:51:58 +0200 Subject: [PATCH 13/15] Apply suggestions from code review Co-authored-by: Mael --- Mesh_3/include/CGAL/Mesh_criteria_3.h | 2 +- Mesh_3/include/CGAL/Mesh_edge_criteria_3.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Mesh_3/include/CGAL/Mesh_criteria_3.h b/Mesh_3/include/CGAL/Mesh_criteria_3.h index 2aadffa6e8a..9bc3a678bcf 100644 --- a/Mesh_3/include/CGAL/Mesh_criteria_3.h +++ b/Mesh_3/include/CGAL/Mesh_criteria_3.h @@ -258,7 +258,7 @@ typedef Mesh_cell_criteria_3 Cell_criteria; * \cgalParamDescription{a desired uniform lower-bound for the lengths of curve edges. * Only feature edges with a length larger than this bound will be refined. * If a feature edge is too small with respect to this criterion, - * it will not be refined however the other criteria are met or not.} + * it will not be refined whether the other criteria are met or not.} * \cgalParamExtra{If this criterion is applied during the meshing process, * the feature protection algorithm correctness is not guaranteed anymore, * and the output mesh may contain incorrect polyline features, diff --git a/Mesh_3/include/CGAL/Mesh_edge_criteria_3.h b/Mesh_3/include/CGAL/Mesh_edge_criteria_3.h index 34c5cfdd33c..8846555dc6b 100644 --- a/Mesh_3/include/CGAL/Mesh_edge_criteria_3.h +++ b/Mesh_3/include/CGAL/Mesh_edge_criteria_3.h @@ -134,7 +134,7 @@ public: * Note that if one parameter is set to 0, then its corresponding criterion is ignored. */ Mesh_edge_criteria_3(const FT& length_bound, - const FT& min_length_bound = 0.) + const FT& min_length_bound = 0) : p_size_(new Mesh_3::internal::Sizing_field_container< Mesh_constant_domain_field_3 , FT, @@ -157,7 +157,7 @@ public: Mesh_edge_criteria_3 ( const SizingField& length_bound, - const FT& min_length_bound = 0. + const FT& min_length_bound = 0 #ifndef DOXYGEN_RUNNING , std::enable_if_t::value>* = 0 #endif From 2559bb67781a28141fd1107911288ed2a5c178e9 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Mon, 17 Apr 2023 16:35:01 +0200 Subject: [PATCH 14/15] Update Mesh_criteria_3.h (the note) --- Mesh_3/include/CGAL/Mesh_criteria_3.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mesh_3/include/CGAL/Mesh_criteria_3.h b/Mesh_3/include/CGAL/Mesh_criteria_3.h index 9bc3a678bcf..5b18ef903c8 100644 --- a/Mesh_3/include/CGAL/Mesh_criteria_3.h +++ b/Mesh_3/include/CGAL/Mesh_criteria_3.h @@ -263,7 +263,7 @@ typedef Mesh_cell_criteria_3 Cell_criteria; * the feature protection algorithm correctness is not guaranteed anymore, * and the output mesh may contain incorrect polyline features, * or have missing polyline features.} - * \cgalParamExtra{Note it may not be respected everywhere in the output mesh, + * \cgalParamExtra{Note this lower-bound may not be respected everywhere in the output mesh, * to keep the feature graph valid.} * \cgalParamNEnd * \cgalParamNBegin{facet_angle} From 8e9889567882dfc7b0580a469ad640d3b7f66df4 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Mon, 17 Apr 2023 16:46:38 +0200 Subject: [PATCH 15/15] update concept MeshEdgeCriteria_3 --- Mesh_3/doc/Mesh_3/Concepts/MeshEdgeCriteria_3.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Mesh_3/doc/Mesh_3/Concepts/MeshEdgeCriteria_3.h b/Mesh_3/doc/Mesh_3/Concepts/MeshEdgeCriteria_3.h index 29ad69bc395..4c044751069 100644 --- a/Mesh_3/doc/Mesh_3/Concepts/MeshEdgeCriteria_3.h +++ b/Mesh_3/doc/Mesh_3/Concepts/MeshEdgeCriteria_3.h @@ -50,6 +50,12 @@ Returns the value of the sizing field (i.e.\ the maximum edge length) at point ` */ FT sizing_field(const Point_3& p); +/*! +Returns the lower bound on edge length, set by the user. +The lower bound is ignored when its value is 0. +*/ +const FT& min_length_bound() const; + /// @} }; /* end MeshEdgeCriteria_3 */