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 + + + + + + + + + + + + +