diff --git a/Polyhedron/demo/Polyhedron/MainWindow_remeshing.cpp b/Polyhedron/demo/Polyhedron/MainWindow_remeshing.cpp index ad7f1a5c203..d136abbb936 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow_remeshing.cpp +++ b/Polyhedron/demo/Polyhedron/MainWindow_remeshing.cpp @@ -14,6 +14,7 @@ #include #include +#include void MainWindow::on_actionRemeshing_triggered() { @@ -36,11 +37,45 @@ void MainWindow::on_actionRemeshing_triggered() Tr tr; // 3D-Delaunay triangulation C2t3 c2t3(tr); // 2D-complex in 3D-Delaunay triangulation + // TODO: get parameters using ONE dialog box + // sizing and approximation parameters should be expressed as ratio of + // scene bbox diagonal. + + double diag = scene->len_diagonal(); + + bool ok; + const double angle = + QInputDialog::getDouble(this, "Min triangle angle", + "Angle:", + 25, // default value + 1, // min + 30, // max + 2, // decimals + &ok); + if(!ok) return; + + const double sizing = + QInputDialog::getDouble(this, "Sizing", + "Size:", + diag * 0.1, // default value + diag * 10e-6, // min + diag, // max + 4, // decimals + &ok); + if(!ok) return; + + const double approx = + QInputDialog::getDouble(this, "Approximation error", + "Error:", + diag * 0.01, // default value + diag * 10e-7, // min + diag, // max + 6, // decimals + &ok); + if(!ok) return; + // meshing parameters - CGAL::Surface_mesh_default_criteria_3 - facets_criteria(25.0, // angular bound - 0.01, // mesh sizing - 0.001); // approximation error + CGAL::Surface_mesh_default_criteria_3 facets_criteria(angle,sizing,approx); // AABB tree QTime time; diff --git a/Polyhedron/demo/Polyhedron/Scene.h b/Polyhedron/demo/Polyhedron/Scene.h index 356789a3672..22bac871cac 100644 --- a/Polyhedron/demo/Polyhedron/Scene.h +++ b/Polyhedron/demo/Polyhedron/Scene.h @@ -87,6 +87,16 @@ public: { } }; + + double len_diagonal() + { + Bbox box = bbox(); + double dx = box.xmax - box.xmin; + double dy = box.ymax - box.ymin; + double dz = box.zmax - box.zmin; + return std::sqrt(dx*dx + dy*dy + dz*dz); + } + // defined in Scene_polyhedron_operations.cpp Bbox bbox();