From ef7279aaeb258cccbc829eb5ec85459906af716a Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Tue, 24 Jul 2018 11:02:57 +0200 Subject: [PATCH 001/193] WIP --- .../Polyhedron/Plugins/PMP/CMakeLists.txt | 4 + .../Plugins/PMP/Engrave_dock_widget.ui | 73 +++++++ .../Plugins/PMP/Engrave_text_plugin.cpp | 186 ++++++++++++++++++ 3 files changed, 263 insertions(+) create mode 100644 Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui create mode 100644 Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/PMP/CMakeLists.txt index a626bc567d9..757e710dd18 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/CMakeLists.txt @@ -170,3 +170,7 @@ target_link_libraries(extrude_poly_plugin PUBLIC scene_polyhedron_item scene_pol polyhedron_demo_plugin(extrude_sm_plugin Extrude_plugin) target_link_libraries(extrude_sm_plugin PUBLIC scene_surface_mesh_item scene_surface_mesh_selection_item) target_compile_definitions(extrude_sm_plugin PUBLIC "-DUSE_SURFACE_MESH" ) + +qt5_wrap_ui( engravUI_FILES Engrave_dock_widget.ui ) +polyhedron_demo_plugin(engrave_text_plugin Engrave_text_plugin ${engravUI_FILES}) +target_link_libraries(engrave_text_plugin PUBLIC scene_surface_mesh_item scene_surface_mesh_selection_item scene_polylines_item) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui new file mode 100644 index 00000000000..fcbf8b313cd --- /dev/null +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui @@ -0,0 +1,73 @@ + + + EngraveWidget + + + + 0 + 0 + 400 + 300 + + + + Engraving + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Visualize + + + + + + + An Example Text + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + false + + + Engrave + + + + + + + + + diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp new file mode 100644 index 00000000000..11f745b6fdd --- /dev/null +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp @@ -0,0 +1,186 @@ +//General Plugin Data +#include +#include + +#include "ui_Engrave_dock_widget.h" +//Items +#include "Scene_surface_mesh_item.h" +#include "Scene_polyhedron_selection_item.h" +#include "Scene_polylines_item.h" + +//Actual code reqs +#include +#include + +#include +#include +#include +#include + +#include + + +using namespace CGAL::Three; + +class EngraveWidget : + public QDockWidget, + public Ui::EngraveWidget +{ +public: + EngraveWidget(QString name, QWidget *parent) + :QDockWidget(name,parent) + { + setupUi(this); + } +}; + +class Q_DECL_EXPORT Engrave_text_plugin : + public QObject, + public Polyhedron_demo_plugin_helper +{ + Q_OBJECT + Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") +public : + void init(QMainWindow* , CGAL::Three::Scene_interface* , Messages_interface*) Q_DECL_OVERRIDE{ + //get refs + this->scene = Three::scene(); + this->mw = Three::mainWindow(); + + //action + QAction* actionFitText= new QAction("Fit Text", mw); + if(actionFitText) { + connect(actionFitText, SIGNAL(triggered()), + this, SLOT(showWidget())); + _actions << actionFitText; + //widget + dock_widget = new EngraveWidget("Engraving", mw); + dock_widget->setVisible(false); // do not show at the beginning + addDockWidget(dock_widget); + connect(dock_widget->visualizeButton, &QPushButton::clicked, + this, &Engrave_text_plugin::visualize); + connect(dock_widget->engraveButton, &QPushButton::clicked, + this, &Engrave_text_plugin::engrave); + + //items + visu_item = NULL; + + } + } + bool applicable(QAction*) const Q_DECL_OVERRIDE + { + return qobject_cast + (scene->item(scene->mainSelectionIndex())); + } + QList actions() const Q_DECL_OVERRIDE{ + return _actions; + } +public Q_SLOTS: + void showWidget() + { + dock_widget->setVisible(!dock_widget->isVisible()); + } + + void visualize() { + + // read text file + std::vector< std::vector > polylines; + int nb_pts = 0; + while( text_in >> nb_pts) + { + polylines.push_back( std::vector() ); + polylines.back().reserve(nb_pts); + double x, y, z; + for (int i=0; i> x >> y >> z; + if (z!=0) + std::cerr << "z-coordinate of a point is not 0: " << z << "\n"; + polylines.back().push_back( Point_3(x,y,z) ); + } + } + dock_widget->engraveButton->setEnabled(true); + dock_widget->visualizeButton->setEnabled(false); + } + + void engrave() { + if(!visu_item) + return; + + namespace SMP = CGAL::Surface_mesh_parameterization; + typedef CGAL::Surface_mesh_shortest_path_traits SP_traits; + typedef CGAL::Surface_mesh_shortest_path Surface_mesh_shortest_path; + typedef Surface_mesh_shortest_path::Face_location Face_location; + typedef CGAL::AABB_face_graph_triangle_primitive Primitive; + typedef CGAL::AABB_traits Tree_traits; + typedef CGAL::AABB_tree Tree; + SMesh& sm = *qobject_cast + (scene->item(scene->mainSelectionIndex()))->polyhedron(); + SMesh::Halfedge_index hd = + CGAL::Polygon_mesh_processing::longest_border(sm).first; + SMesh::Property_map uv_map = + sm.add_property_map("v:uv").first; + + // Parameterized bool pmap + boost::unordered_set vs; + SMP::internal::Bool_property_map< boost::unordered_set > vpm(vs); + + // Parameterizer + SMP::ARAP_parameterizer_3 parameterizer; + + SMP::Error_code status = parameterizer.parameterize(sm, hd, uv_map, get(boost::vertex_index, sm), vpm); + if(status != SMP::OK) { + std::cout << "Encountered a problem: " << status << std::endl; + return ; + } + + std::cout << "Parameterized with ARAP (SM)!" << std::endl; + + SMesh::Property_map uv_map_3 = + sm.add_property_map("v:uv3").first; + for(SMesh::Vertex_index v : sm.vertices()) + uv_map_3[v] = Point_3(uv_map[v][0], uv_map[v] + [1], 0); + +/* // debug to print 2d mesh + std::ofstream out("param_out.off"); + out << "OFF\n" << sm.number_of_vertices() << " " << sm.number_of_faces() << " 0\n"; + for(Surface_mesh::Vertex_index v : sm.vertices()) + out << uv_map_3[v] << "\n"; + for(Surface_mesh::Face_index f : faces(sm)) + { + Surface_mesh::Halfedge_index h = sm.halfedge(f); + out << "3 " << (unsigned) sm.target(h) << " " + << (unsigned) sm.target(sm.next(h)) << " " + << (unsigned) sm.source(h) << "\n"; + } + */ + + + // build AABB-tree for face location queries + Tree aabb_tree(faces(sm).first, faces(sm).second, sm, uv_map_3); + + // compute 3D coordinates + BOOST_FOREACH(const std::vector& polyline, visu_item->polylines().front()); + { + BOOST_FOREACH(const Point_3& p, polyline) + { + Face_location loc = Surface_mesh_shortest_path::locate(p, aabb_tree, sm, uv_map_3); + } + } + + scene->erase(scene->item_id(visu_item)); + visu_item = NULL; + dock_widget->engraveButton->setEnabled(false); + dock_widget->visualizeButton->setEnabled(true); + } + void closure()Q_DECL_OVERRIDE + { + dock_widget->hide(); + } +private: + QList _actions; + EngraveWidget* dock_widget; + Scene_polylines_item* visu_item; +}; +#include "Engrave_text_plugin.moc" From 17b691b2d77344ebd602ed3aa7b16feef0f46a60 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 25 Jul 2018 09:38:47 +0200 Subject: [PATCH 002/193] WIP --- .../Plugins/PMP/Engrave_dock_widget.ui | 64 ++++-- .../Plugins/PMP/Engrave_text_plugin.cpp | 185 ++++++++++++------ 2 files changed, 172 insertions(+), 77 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui index fcbf8b313cd..3a9b866c170 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui @@ -15,7 +15,7 @@ - + Qt::Horizontal @@ -28,17 +28,13 @@ - - - - Visualize + + + + false - - - - - - An Example Text + + Engrave @@ -56,15 +52,51 @@ - - - false - + - Engrave + Visualize + + + + An Example Text + + + + + + + + + -> + + + + + + + <- + + + + + + + <-R + + + + + + + R-> + + + + + diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp index 11f745b6fdd..8886941d1ec 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp @@ -18,6 +18,7 @@ #include #include +#include using namespace CGAL::Three; @@ -65,7 +66,31 @@ public : //items visu_item = NULL; + //transfo + angle = 0.0; + translation = EPICK::Vector_2(0,0); + connect(dock_widget->t_left_pushButton, &QPushButton::clicked, + [this](){ + translation -= EPICK::Vector_2(1,0); + visualize(); + }); + + connect(dock_widget->t_right_pushButton, &QPushButton::clicked, + [this](){ + translation += EPICK::Vector_2(1,0); + visualize(); + }); } + connect(dock_widget->r_right_pushButton, &QPushButton::clicked, + [this](){ + angle += 0.15; + visualize(); + }); + connect(dock_widget->r_left_pushButton, &QPushButton::clicked, + [this](){ + angle -= 0.15; + visualize(); + }); } bool applicable(QAction*) const Q_DECL_OVERRIDE { @@ -82,9 +107,14 @@ public Q_SLOTS: } void visualize() { - + + if(visu_item) + scene->erase(scene->item_id(visu_item)); + visu_item = NULL; + typedef EPICK::Point_3 Point_3; // read text file - std::vector< std::vector > polylines; + std::ifstream text_in("/home/gimeno/Data/Polylines/text.polylines.txt"); + Scene_polylines_item::Polylines_container polylines; int nb_pts = 0; while( text_in >> nb_pts) { @@ -99,13 +129,6 @@ public Q_SLOTS: polylines.back().push_back( Point_3(x,y,z) ); } } - dock_widget->engraveButton->setEnabled(true); - dock_widget->visualizeButton->setEnabled(false); - } - - void engrave() { - if(!visu_item) - return; namespace SMP = CGAL::Surface_mesh_parameterization; typedef CGAL::Surface_mesh_shortest_path_traits SP_traits; @@ -114,73 +137,113 @@ public Q_SLOTS: typedef CGAL::AABB_face_graph_triangle_primitive Primitive; typedef CGAL::AABB_traits Tree_traits; typedef CGAL::AABB_tree Tree; - SMesh& sm = *qobject_cast - (scene->item(scene->mainSelectionIndex()))->polyhedron(); + typedef EPICK::Point_3 Point_3; + Scene_polyhedron_selection_item* sel_item = + qobject_cast + (scene->item(scene->mainSelectionIndex())); + Point_3 basis_3[3]; + int i=0; + for(Scene_polyhedron_selection_item::Selection_set_vertex::iterator it + = sel_item->selected_vertices.begin(); + it != sel_item->selected_vertices.end(); + ++it) + { + basis_3[(i++)%3] = sel_item->polyhedron()->point( + *it); + } + SMesh sm; + sel_item->export_selected_facets_as_polyhedron(&sm); SMesh::Halfedge_index hd = - CGAL::Polygon_mesh_processing::longest_border(sm).first; - SMesh::Property_map uv_map = + CGAL::Polygon_mesh_processing::longest_border(sm).first; + SMesh::Property_map uv_map = sm.add_property_map("v:uv").first; - // Parameterized bool pmap - boost::unordered_set vs; - SMP::internal::Bool_property_map< boost::unordered_set > vpm(vs); + // Parameterized bool pmap + boost::unordered_set vs; + SMP::internal::Bool_property_map< boost::unordered_set > vpm(vs); - // Parameterizer - SMP::ARAP_parameterizer_3 parameterizer; + // Parameterizer + SMP::ARAP_parameterizer_3 parameterizer; - SMP::Error_code status = parameterizer.parameterize(sm, hd, uv_map, get(boost::vertex_index, sm), vpm); - if(status != SMP::OK) { - std::cout << "Encountered a problem: " << status << std::endl; - return ; + SMP::Error_code status = parameterizer.parameterize(sm, hd, uv_map, get(boost::vertex_index, sm), vpm); + if(status != SMP::OK) { + std::cout << "Encountered a problem: " << status << std::endl; + return ; + } + + std::cout << "Parameterized with ARAP (SM)!" << std::endl; + + + SMesh::Property_map uv_map_3 = + sm.add_property_map("v:uv3").first; + for(SMesh::Vertex_index v : sm.vertices()) + uv_map_3[v] = Point_3(uv_map[v][0], uv_map[v] + [1], 0); + // build AABB-tree for face location queries + Tree aabb_tree(faces(sm).first, faces(sm).second, sm, uv_map_3); + + //get 2D basis + EPICK::Vector_2 basis_2[3]; + for(int i=0; i<3; ++i) + { + Surface_mesh_shortest_path::Face_location coord = Surface_mesh_shortest_path::locate(basis_3[i], aabb_tree, sm, uv_map_3); + EPICK::Point_2 face_points[3]; + SMesh::Face_index f = SMesh::Face_index(coord.first); + face_points[0] = uv_map[source(halfedge(f,sm),sm)]; + face_points[1] = uv_map[target(halfedge(f,sm),sm)]; + face_points[2] = uv_map[target(next(halfedge(f,sm),sm),sm)]; + + basis_2[i] = EPICK::Vector_2( + coord.second[0]*face_points[0].x() + +coord.second[1]*face_points[1].x() + +coord.second[2]*face_points[2].x(), + coord.second[0]*face_points[0].y() + +coord.second[1]*face_points[1].y() + +coord.second[2]*face_points[2].y()); + } + + Scene_polylines_item* visu_item = new Scene_polylines_item; + // compute 3D coordinates + EPICK::Aff_transformation_2 transfo = + EPICK::Aff_transformation_2(CGAL::ROTATION,sin(angle), cos(angle)) * EPICK::Aff_transformation_2(CGAL::TRANSLATION, translation); + BOOST_FOREACH(const std::vector& polyline, polylines) + { + visu_item->polylines.push_back(std::vector()); + BOOST_FOREACH(const Point_3& p, polyline) + { + EPICK::Vector_2 p_2 = transfo.transform(basis_2[0]+basis_2[1]*p.x()+basis_2[2]*p.y()); + + Face_location loc = Surface_mesh_shortest_path::locate( + Point_3(p_2.x(), p_2.y(), 0), + aabb_tree, sm, uv_map_3); + visu_item->polylines.back().push_back(Surface_mesh_shortest_path::point(loc.first, loc.second, sm, sm.points())); } + } + visu_item->setName("Text"); + visu_item->setColor(QColor(Qt::red)); + scene->addItem(visu_item); + //dock_widget->engraveButton->setEnabled(true); + //dock_widget->visualizeButton->setEnabled(false); + } + + void engrave() { + if(!visu_item) + return; - std::cout << "Parameterized with ARAP (SM)!" << std::endl; - SMesh::Property_map uv_map_3 = - sm.add_property_map("v:uv3").first; - for(SMesh::Vertex_index v : sm.vertices()) - uv_map_3[v] = Point_3(uv_map[v][0], uv_map[v] - [1], 0); - -/* // debug to print 2d mesh - std::ofstream out("param_out.off"); - out << "OFF\n" << sm.number_of_vertices() << " " << sm.number_of_faces() << " 0\n"; - for(Surface_mesh::Vertex_index v : sm.vertices()) - out << uv_map_3[v] << "\n"; - for(Surface_mesh::Face_index f : faces(sm)) - { - Surface_mesh::Halfedge_index h = sm.halfedge(f); - out << "3 " << (unsigned) sm.target(h) << " " - << (unsigned) sm.target(sm.next(h)) << " " - << (unsigned) sm.source(h) << "\n"; - } - */ - - - // build AABB-tree for face location queries - Tree aabb_tree(faces(sm).first, faces(sm).second, sm, uv_map_3); - - // compute 3D coordinates - BOOST_FOREACH(const std::vector& polyline, visu_item->polylines().front()); - { - BOOST_FOREACH(const Point_3& p, polyline) - { - Face_location loc = Surface_mesh_shortest_path::locate(p, aabb_tree, sm, uv_map_3); - } - } - - scene->erase(scene->item_id(visu_item)); - visu_item = NULL; dock_widget->engraveButton->setEnabled(false); dock_widget->visualizeButton->setEnabled(true); } void closure()Q_DECL_OVERRIDE - { - dock_widget->hide(); - } + { + dock_widget->hide(); + } private: QList _actions; EngraveWidget* dock_widget; Scene_polylines_item* visu_item; + double angle; + EPICK::Vector_2 translation; }; #include "Engrave_text_plugin.moc" + From 91610ccf3f488f1ff900c6b232706ebef8ad6961 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Mon, 30 Jul 2018 09:47:49 +0200 Subject: [PATCH 003/193] WIP Create Text Polyline --- .../Plugins/PMP/Engrave_text_plugin.cpp | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp index 8886941d1ec..8c2a5aaede4 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp @@ -19,7 +19,7 @@ #include #include - +#include using namespace CGAL::Three; @@ -107,8 +107,23 @@ public Q_SLOTS: } void visualize() { - - if(visu_item) + Viewer_interface* viewer = static_cast(CGAL::QGLViewer::QGLViewerPool().first()); + QPainterPath path; + QFont font; + font.setPointSize(15); + path.addText(QPointF(viewer->width()/2,viewer->height()/2), font, dock_widget->lineEdit->text()); + viewer->getPainter()->begin(viewer); + viewer->getPainter()->drawPath(path); + viewer->getPainter()->end(); + QPolygonF poly = path.toFillPolygon(); + Scene_polylines_item* new_poly = new Scene_polylines_item(); + new_poly->polylines.push_back(Scene_polylines_item::Polyline()); + Q_FOREACH(QPointF pf, poly) + { + new_poly->polylines.front().push_back(Point_3(pf.x(), pf.y(), 0)); + } + scene->addItem(new_poly); + /* if(visu_item) scene->erase(scene->item_id(visu_item)); visu_item = NULL; typedef EPICK::Point_3 Point_3; @@ -224,6 +239,7 @@ public Q_SLOTS: scene->addItem(visu_item); //dock_widget->engraveButton->setEnabled(true); //dock_widget->visualizeButton->setEnabled(false); + */ } void engrave() { From 8c438f882152d72d3f03de1c0cbacad96604d875 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Mon, 30 Jul 2018 14:44:37 +0200 Subject: [PATCH 004/193] WIP positionning text --- .../Plugins/PMP/Engrave_text_plugin.cpp | 163 +++++++++--------- 1 file changed, 82 insertions(+), 81 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp index 8c2a5aaede4..1472456e337 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp @@ -11,7 +11,7 @@ //Actual code reqs #include #include - +#include #include #include #include @@ -70,24 +70,24 @@ public : angle = 0.0; translation = EPICK::Vector_2(0,0); connect(dock_widget->t_left_pushButton, &QPushButton::clicked, - [this](){ - translation -= EPICK::Vector_2(1,0); + this, [this](){ + translation -= EPICK::Vector_2(0.1,0); visualize(); }); connect(dock_widget->t_right_pushButton, &QPushButton::clicked, - [this](){ - translation += EPICK::Vector_2(1,0); + this, [this](){ + translation += EPICK::Vector_2(0.1,0); visualize(); }); } connect(dock_widget->r_right_pushButton, &QPushButton::clicked, - [this](){ + this, [this](){ angle += 0.15; visualize(); }); connect(dock_widget->r_left_pushButton, &QPushButton::clicked, - [this](){ + this, [this](){ angle -= 0.15; visualize(); }); @@ -107,43 +107,16 @@ public Q_SLOTS: } void visualize() { - Viewer_interface* viewer = static_cast(CGAL::QGLViewer::QGLViewerPool().first()); - QPainterPath path; - QFont font; - font.setPointSize(15); - path.addText(QPointF(viewer->width()/2,viewer->height()/2), font, dock_widget->lineEdit->text()); - viewer->getPainter()->begin(viewer); - viewer->getPainter()->drawPath(path); - viewer->getPainter()->end(); - QPolygonF poly = path.toFillPolygon(); - Scene_polylines_item* new_poly = new Scene_polylines_item(); - new_poly->polylines.push_back(Scene_polylines_item::Polyline()); - Q_FOREACH(QPointF pf, poly) - { - new_poly->polylines.front().push_back(Point_3(pf.x(), pf.y(), 0)); - } - scene->addItem(new_poly); - /* if(visu_item) + Scene_polyhedron_selection_item* sel_item = + qobject_cast + (scene->item(scene->mainSelectionIndex())); + if(!sel_item) + return; + if(sel_item->selected_facets.empty()) + return; + if(visu_item) scene->erase(scene->item_id(visu_item)); visu_item = NULL; - typedef EPICK::Point_3 Point_3; - // read text file - std::ifstream text_in("/home/gimeno/Data/Polylines/text.polylines.txt"); - Scene_polylines_item::Polylines_container polylines; - int nb_pts = 0; - while( text_in >> nb_pts) - { - polylines.push_back( std::vector() ); - polylines.back().reserve(nb_pts); - double x, y, z; - for (int i=0; i> x >> y >> z; - if (z!=0) - std::cerr << "z-coordinate of a point is not 0: " << z << "\n"; - polylines.back().push_back( Point_3(x,y,z) ); - } - } namespace SMP = CGAL::Surface_mesh_parameterization; typedef CGAL::Surface_mesh_shortest_path_traits SP_traits; @@ -153,19 +126,6 @@ public Q_SLOTS: typedef CGAL::AABB_traits Tree_traits; typedef CGAL::AABB_tree Tree; typedef EPICK::Point_3 Point_3; - Scene_polyhedron_selection_item* sel_item = - qobject_cast - (scene->item(scene->mainSelectionIndex())); - Point_3 basis_3[3]; - int i=0; - for(Scene_polyhedron_selection_item::Selection_set_vertex::iterator it - = sel_item->selected_vertices.begin(); - it != sel_item->selected_vertices.end(); - ++it) - { - basis_3[(i++)%3] = sel_item->polyhedron()->point( - *it); - } SMesh sm; sel_item->export_selected_facets_as_polyhedron(&sm); SMesh::Halfedge_index hd = @@ -187,37 +147,78 @@ public Q_SLOTS: } std::cout << "Parameterized with ARAP (SM)!" << std::endl; - - SMesh::Property_map uv_map_3 = sm.add_property_map("v:uv3").first; + float xmin(std::numeric_limits::max()), xmax(std::numeric_limits::min()), + ymin(std::numeric_limits::max()), ymax(std::numeric_limits::min()); for(SMesh::Vertex_index v : sm.vertices()) + { uv_map_3[v] = Point_3(uv_map[v][0], uv_map[v] [1], 0); + if(uv_map[v][0] > xmax) + xmax = uv_map[v][0]; + if(uv_map[v][0] < xmin) + xmin = uv_map[v][0]; + + if(uv_map[v][1] > ymax) + ymax = uv_map[v][1]; + if(uv_map[v][1] < ymin) + ymin = uv_map[v][1]; + } + std::cout<<"xmax = "<(CGAL::QGLViewer::QGLViewerPool().first()); + QPainterPath path; + QFont font; + font.setPointSize(15); + + path.addText(QPoint(xmin,-ymin), font, dock_widget->lineEdit->text()); + viewer->getPainter()->begin(viewer); + viewer->getPainter()->drawPath(path); + viewer->getPainter()->end(); + QTransform trans; + + QList polys = path.toFillPolygons(); + //Scene_polylines_item* new_poly = new Scene_polylines_item(); + Scene_polylines_item::Polylines_container polylines; + QFontMetrics fm(font); + int width=fm.width(dock_widget->lineEdit->text()); + int height=fm.height(); + std::cout<<"width = "<addItem(visu_item); //dock_widget->engraveButton->setEnabled(true); //dock_widget->visualizeButton->setEnabled(false); - */ } void engrave() { From d7c67dfcdf9a1ac47307f2f12db8724d0582a4b3 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Mon, 30 Jul 2018 16:04:47 +0200 Subject: [PATCH 005/193] WIP engrave --- .../Plugins/PMP/Engrave_dock_widget.ui | 36 ++- .../Plugins/PMP/Engrave_text_plugin.cpp | 220 ++++++++++++++++-- 2 files changed, 222 insertions(+), 34 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui index 3a9b866c170..63aa67f94a5 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui @@ -67,13 +67,6 @@ - - - - -> - - - @@ -81,17 +74,38 @@ - + + + + R-> + + + + + + + -> + + + + <-R - - + + - R-> + ^ + + + + + + + V diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp index 1472456e337..d4ddd028b6f 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp @@ -16,6 +16,13 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -70,24 +77,36 @@ public : angle = 0.0; translation = EPICK::Vector_2(0,0); connect(dock_widget->t_left_pushButton, &QPushButton::clicked, - this, [this](){ - translation -= EPICK::Vector_2(0.1,0); + this, [this](){ + translation -= EPICK::Vector_2(0.05,0); + visualize(); + }); + + connect(dock_widget->t_up_pushButton, &QPushButton::clicked, + this, [this](){ + translation -= EPICK::Vector_2(0,-0.05); + visualize(); + }); + + connect(dock_widget->t_down_pushButton, &QPushButton::clicked, + this, [this](){ + translation -= EPICK::Vector_2(0,0.05); visualize(); }); connect(dock_widget->t_right_pushButton, &QPushButton::clicked, - this, [this](){ - translation += EPICK::Vector_2(0.1,0); + this, [this](){ + translation += EPICK::Vector_2(0.05,0); visualize(); }); } connect(dock_widget->r_right_pushButton, &QPushButton::clicked, - this, [this](){ + this, [this](){ angle += 0.15; visualize(); }); connect(dock_widget->r_left_pushButton, &QPushButton::clicked, - this, [this](){ + this, [this](){ angle -= 0.15; visualize(); }); @@ -150,7 +169,7 @@ public Q_SLOTS: SMesh::Property_map uv_map_3 = sm.add_property_map("v:uv3").first; float xmin(std::numeric_limits::max()), xmax(std::numeric_limits::min()), - ymin(std::numeric_limits::max()), ymax(std::numeric_limits::min()); + ymin(std::numeric_limits::max()), ymax(std::numeric_limits::min()); for(SMesh::Vertex_index v : sm.vertices()) { uv_map_3[v] = Point_3(uv_map[v][0], uv_map[v] @@ -168,16 +187,16 @@ public Q_SLOTS: std::cout<<"xmax = "<getPainter()->end(); QTransform trans; - QList polys = path.toFillPolygons(); + QList polys = path.toSubpathPolygons(); //Scene_polylines_item* new_poly = new Scene_polylines_item(); Scene_polylines_item::Polylines_container polylines; QFontMetrics fm(font); @@ -221,7 +240,7 @@ public Q_SLOTS: visu_item = new Scene_polylines_item; // compute 3D coordinates EPICK::Aff_transformation_2 transfo = - EPICK::Aff_transformation_2(CGAL::ROTATION,sin(angle), cos(angle)) * EPICK::Aff_transformation_2(CGAL::TRANSLATION, translation); + EPICK::Aff_transformation_2(CGAL::ROTATION,sin(angle), cos(angle)) * EPICK::Aff_transformation_2(CGAL::TRANSLATION, translation); BOOST_FOREACH(const std::vector& polyline, polylines) { visu_item->polylines.push_back(std::vector()); @@ -232,22 +251,86 @@ public Q_SLOTS: Face_location loc = Surface_mesh_shortest_path::locate( Point_3(p_2.x(), p_2.y(), 0), aabb_tree, sm, uv_map_3); - visu_item->polylines.back().push_back(//Point_3(p_2.x(), p_2.y(), 0)); - Surface_mesh_shortest_path::point(loc.first, loc.second, sm, sm.points())); + visu_item->polylines.back().push_back(//p); + Surface_mesh_shortest_path::point(loc.first, loc.second, sm, sm.points())); } } visu_item->setName("Text"); visu_item->setColor(QColor(Qt::red)); scene->addItem(visu_item); - //dock_widget->engraveButton->setEnabled(true); - //dock_widget->visualizeButton->setEnabled(false); + dock_widget->engraveButton->setEnabled(true); + dock_widget->visualizeButton->setEnabled(false); } void engrave() { if(!visu_item) return; + typedef CGAL::Projection_traits_xy_3 Gt; + typedef CGAL::Delaunay_mesh_vertex_base_2 Vb; + typedef CGAL::Delaunay_mesh_face_base_2 Fm; + typedef CGAL::Triangulation_face_base_with_info_2 Fb; + typedef CGAL::Triangulation_data_structure_2 TDS; + typedef CGAL::No_intersection_tag Tag; + typedef CGAL::Constrained_Delaunay_triangulation_2 CDT; + typedef CGAL::Delaunay_mesh_size_criteria_2 Criteria; + typedef CGAL::Delaunay_mesher_2 Mesher; + + CDT cdt; + try{ + Q_FOREACH(const std::vector& points, + visu_item->polylines) + cdt.insert_constraint(points.begin(),points.end()); + }catch(std::runtime_error&) + { + QApplication::restoreOverrideCursor(); + throw; + } + if (cdt.dimension()!=2){ + QApplication::restoreOverrideCursor(); + std::cout << "Triangulation is not of dimension 2" << std::endl; + return; + } + Scene_item::Bbox bbox= visu_item->bbox(); + float diag = CGAL::sqrt( + (bbox.xmax()-bbox.xmin())*(bbox.xmax()-bbox.xmin()) + +(bbox.ymax()-bbox.ymin())*(bbox.ymax()-bbox.ymin()) + +(bbox.zmax()-bbox.zmax()) *(bbox.zmax()-bbox.zmax()) + ); + float zmax = bbox.zmax(), + zmin = bbox.zmin(); + //project to z=zmin for mesh_2 + BOOST_FOREACH(Scene_polylines_item::Polyline poly, visu_item->polylines) + { + BOOST_FOREACH(EPICK::Point_3& p, poly) + { + p = EPICK::Point_3(p.x(), p.y(), zmin); + } + } + // start by marking the domain to mesh + Criteria criteria(0.125, 0.05 * diag); + Mesher mesher(cdt, criteria); + + mark_nested_domains(cdt); + for(typename CDT::All_faces_iterator fit=cdt.all_faces_begin(), + fit_end=cdt.all_faces_end(); + fit!=fit_end;++fit) + { + fit->set_in_domain(fit->info().in_domain()); + } + mesher.init(true); + mesher.refine_mesh(); + SMesh text_mesh_bottom, text_mesh_complete; + cdt2_to_face_graph(cdt, + text_mesh_bottom, + 2, + zmin); + PMP::extrude_mesh(text_mesh_bottom, text_mesh_complete,EPICK::Vector_3(0,0,zmax-zmin)); + + Scene_surface_mesh_item* text_item = new Scene_surface_mesh_item(text_mesh_complete); + text_item->setColor(QColor(Qt::green)); + scene->addItem(text_item); dock_widget->engraveButton->setEnabled(false); dock_widget->visualizeButton->setEnabled(true); } @@ -256,6 +339,97 @@ public Q_SLOTS: dock_widget->hide(); } private: + + struct FaceInfo2 + { + FaceInfo2(){} + int nesting_level; + bool in_domain(){ + return nesting_level%2 == 1; + } + }; + + template + void + mark_domains(CDT& ct, + typename CDT::Face_handle start, + int index, + std::list& border ) + { + if(start->info().nesting_level != -1){ + return; + } + std::list queue; + queue.push_back(start); + while(! queue.empty()){ + typename CDT::Face_handle fh = queue.front(); + queue.pop_front(); + if(fh->info().nesting_level == -1){ + fh->info().nesting_level = index; + for(int i = 0; i < 3; i++){ + typename CDT::Edge e(fh,i); + typename CDT::Face_handle n = fh->neighbor(i); + if(n->info().nesting_level == -1){ + if(ct.is_constrained(e)) border.push_back(e); + else queue.push_back(n); + } + } + } + } + } + + + template + void + mark_nested_domains(CDT& cdt) + { + for(typename CDT::All_faces_iterator it = cdt.all_faces_begin(); it != cdt.all_faces_end(); ++it){ + it->info().nesting_level = -1; + } + std::list border; + mark_domains(cdt, cdt.infinite_face(), 0, border); + while(! border.empty()){ + typename CDT::Edge e = border.front(); + border.pop_front(); + typename CDT::Face_handle n = e.first->neighbor(e.second); + if(n->info().nesting_level == -1){ + mark_domains(cdt, n, e.first->info().nesting_level+1, border); + } + } + } + + template + void cdt2_to_face_graph(const CDT& cdt, TriangleMesh& tm, int constant_coordinate_index, double constant_coordinate) + { + typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; + + typedef std::map Map; + Map descriptors; + for (typename CDT::Finite_faces_iterator fit=cdt.finite_faces_begin(), + fit_end=cdt.finite_faces_end(); + fit!=fit_end; ++fit) + { + if (!fit->is_in_domain()) continue; + CGAL::cpp11::array vds; + for(int i=0; i<3; ++i) + { + typename Map::iterator it; + bool insert_ok; + boost::tie(it,insert_ok) = + descriptors.insert(std::make_pair(fit->vertex(i),vertex_descriptor())); + if (insert_ok){ + const Kernel::Point_3& pt=fit->vertex(i)->point(); + double coords[3] = {pt[0], pt[1], pt[2]}; + coords[2]=constant_coordinate; + it->second = add_vertex(Kernel::Point_3(coords[0],coords[1],coords[2]), tm); + } + vds[i]=it->second; + } + + CGAL::Euler::add_face(vds, tm); + } + } + QList _actions; EngraveWidget* dock_widget; Scene_polylines_item* visu_item; From 01bef6fa22986a80212f9004dd1c56719354a26b Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Mon, 30 Jul 2018 16:43:51 +0200 Subject: [PATCH 006/193] WIP engraving --- .../Plugins/PMP/Engrave_text_plugin.cpp | 40 +++++++++++++++---- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp index d4ddd028b6f..b668767af9b 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp @@ -7,20 +7,24 @@ #include "Scene_surface_mesh_item.h" #include "Scene_polyhedron_selection_item.h" #include "Scene_polylines_item.h" +#include "Nef_type.h" //Actual code reqs +#include + #include #include #include +#include +#include #include #include #include #include -#include +#include #include #include #include -#include #include #include @@ -133,6 +137,8 @@ public Q_SLOTS: return; if(sel_item->selected_facets.empty()) return; + if(!CGAL::is_closed(*sel_item->polyhedron())) + return; if(visu_item) scene->erase(scene->item_id(visu_item)); visu_item = NULL; @@ -259,12 +265,22 @@ public Q_SLOTS: visu_item->setColor(QColor(Qt::red)); scene->addItem(visu_item); dock_widget->engraveButton->setEnabled(true); - dock_widget->visualizeButton->setEnabled(false); + // dock_widget->visualizeButton->setEnabled(false); } void engrave() { if(!visu_item) return; + Scene_polyhedron_selection_item* sel_item = + qobject_cast + (scene->item(scene->mainSelectionIndex())); + if(!sel_item) + return; + if(sel_item->selected_facets.empty()) + return; + if(!CGAL::is_closed(*sel_item->polyhedron())) + return; + typedef CGAL::Projection_traits_xy_3 Gt; typedef CGAL::Delaunay_mesh_vertex_base_2 Vb; typedef CGAL::Delaunay_mesh_face_base_2 Fm; @@ -324,13 +340,21 @@ public Q_SLOTS: SMesh text_mesh_bottom, text_mesh_complete; cdt2_to_face_graph(cdt, text_mesh_bottom, - 2, zmin); PMP::extrude_mesh(text_mesh_bottom, text_mesh_complete,EPICK::Vector_3(0,0,zmax-zmin)); - Scene_surface_mesh_item* text_item = new Scene_surface_mesh_item(text_mesh_complete); - text_item->setColor(QColor(Qt::green)); - scene->addItem(text_item); + CGAL::Surface_mesh exact_text, + exact_target; + CGAL::copy_face_graph(text_mesh_complete, exact_text); + CGAL::copy_face_graph(*sel_item->polyhedron(), exact_target); + Nef_polyhedron nef_text(exact_text); + Nef_polyhedron nef_target(exact_target); + Nef_polyhedron new_nef = nef_target - nef_text; + SMesh result; + CGAL::convert_nef_polyhedron_to_polygon_mesh(new_nef, result); + CGAL::Polygon_mesh_processing::triangulate_faces(result); + Scene_surface_mesh_item* result_item = new Scene_surface_mesh_item(result); + scene->addItem(result_item); dock_widget->engraveButton->setEnabled(false); dock_widget->visualizeButton->setEnabled(true); } @@ -399,7 +423,7 @@ private: } template - void cdt2_to_face_graph(const CDT& cdt, TriangleMesh& tm, int constant_coordinate_index, double constant_coordinate) + void cdt2_to_face_graph(const CDT& cdt, TriangleMesh& tm, double constant_coordinate) { typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; From 70f2d2d7b31993a0e97d7323509f9b9105a59015 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Tue, 31 Jul 2018 08:45:36 +0200 Subject: [PATCH 007/193] WIP --- .../Plugins/PMP/Engrave_dock_widget.ui | 126 +++-- .../Plugins/PMP/Engrave_text_plugin.cpp | 434 ++++++++++++++---- 2 files changed, 398 insertions(+), 162 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui index 63aa67f94a5..8062175b83e 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui @@ -6,67 +6,24 @@ 0 0 - 400 - 300 + 278 + 372 Engraving - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - false - - - Engrave - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Visualize - - - - - - - An Example Text - - - + + + + + V + + + @@ -81,6 +38,13 @@ + + + + ^ + + + @@ -95,22 +59,56 @@ - - - - ^ + + + + + + An Example Text + + + + + + + + + Qt::Horizontal - + + + 40 + 20 + + + - - - - V - - + + + + + + Visualize + + + + + + + false + + + Engrave + + + + + + + diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp index b668767af9b..02a687407fb 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp @@ -30,9 +30,207 @@ #include #include + #include +#include +#include + +#include using namespace CGAL::Three; +namespace SMP = CGAL::Surface_mesh_parameterization; +typedef EPICK::Point_2 Point_2; + +typedef boost::graph_traits:: +edge_descriptor edge_descriptor; +typedef boost::graph_traits:: +halfedge_descriptor halfedge_descriptor; +typedef boost::graph_traits:: +vertex_descriptor vertex_descriptor; + +typedef boost::unordered_set:: +face_descriptor> Component; + +struct FaceInfo2 +{ + FaceInfo2(){} + int nesting_level; + bool in_domain(){ + return nesting_level%2 == 1; + } +}; + +typedef EPICK Gt; +typedef CGAL::Delaunay_mesh_vertex_base_2 Vb; +typedef CGAL::Delaunay_mesh_face_base_2 Fm; +typedef CGAL::Triangulation_face_base_with_info_2 Fb; +typedef CGAL::Triangulation_data_structure_2 TDS; +typedef CGAL::No_intersection_tag Tag; +typedef CGAL::Constrained_Delaunay_triangulation_2 CDT; +typedef CGAL::Delaunay_mesh_size_criteria_2 Criteria; +typedef CGAL::Delaunay_mesher_2 Mesher; + +//Parameterization and text displaying +class ParamItem : public QGraphicsItem +{ +public : + ParamItem(Component* component, + const std::vector > &polylines, + EPICK::Aff_transformation_2 transfo, + SMesh* graph, + QRectF brect) + : + QGraphicsItem(), + bounding_rect(brect), + component(component), + polylines(polylines), + graph(graph), + transfo(transfo){} + + ~ParamItem() + { + delete component; + delete graph; + } + + QRectF boundingRect() const + { + return bounding_rect; + } + + void set_transfo(EPICK::Aff_transformation_2 t){ transfo = t;} + + void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) + { + QPen pen; + QBrush brush; + brush.setColor(QColor(100, 100, 255)); + brush.setStyle(Qt::SolidPattern); + pen.setColor(Qt::black); + pen.setWidth(0); + painter->setPen(pen); + painter->setBrush(brush); + SMesh::Property_map > uv; + uv = graph->add_property_map >("h:uv",std::make_pair(0.0f,0.0f)).first; + for( Component::iterator + fi = component->begin(); + fi != component->end(); + ++fi) + { + boost::graph_traits::face_descriptor f(*fi); + QPointF points[3]; + boost::graph_traits::halfedge_descriptor h = halfedge(f, *graph);; + points[0] = QPointF(get(uv, h).first, get(uv, h).second); + h = next(halfedge(f, *graph), *graph); + points[1] = QPointF(get(uv, h).first, get(uv, h).second); + h = next(next(halfedge(f, *graph), *graph), *graph); + points[2] = QPointF(get(uv, h).first, get(uv, h).second); + painter->drawPolygon(points,3); + } + + pen.setColor(Qt::red); + pen.setWidth(0); + painter->setPen(pen); + for(std::size_t i =0; i points; + points.reserve(polylines[i].size()); + for(std::size_t j =0; jdrawPolyline(points.data(), points.size()); + } + + + + } + +private: + QString texMesh_name; + QRectF bounding_rect; + Component* component; + const std::vector >& polylines; + SMesh* graph; + EPICK::Aff_transformation_2 transfo; +}; + +class Navigation : public CGAL::Qt::GraphicsViewNavigation +{ +public: + Navigation() + :CGAL::Qt::GraphicsViewNavigation(), + prev_pos(QPoint(0,0)) + { } + +protected: + bool eventFilter(QObject *obj, QEvent *ev) + { + QGraphicsView* v = qobject_cast(obj); + if(v == NULL) { + QWidget* viewport = qobject_cast(obj); + if(viewport == NULL) { + return false; + } + v = qobject_cast(viewport->parent()); + if(v == NULL) { + return false; + } + } + switch(ev->type()) + { + case QEvent::MouseMove: { + QMouseEvent* me = static_cast(ev); + if(is_dragging) + { + qreal dir[2] = {v->mapToScene(me->pos()).x() - prev_pos.x(), + v->mapToScene(me->pos()).y() - prev_pos.y()}; + + v->translate(dir[0],dir[1]); + v->update(); + } + prev_pos = v->mapToScene(me->pos()); + break; + } + + case QEvent::MouseButtonPress: { + is_dragging = true; + break; + } + case QEvent::MouseButtonRelease: { + is_dragging = false; + break; + } + case QEvent::Wheel: { + QWheelEvent* event = static_cast(ev); + QPointF old_pos = v->mapToScene(event->pos()); + if(event->delta() <0) + v->scale(1.2, 1.2); + else + v->scale(0.8, 0.8); + QPointF new_pos = v->mapToScene(event->pos()); + QPointF delta = new_pos - old_pos; + v->translate(delta.x(), delta.y()); + v->update(); + break; + } + + case QEvent::MouseButtonDblClick: { + v->fitInView(v->scene()->itemsBoundingRect(), Qt::KeepAspectRatio); + break; + } + default: + CGAL::Qt::GraphicsViewNavigation::eventFilter(obj, ev); + } + return false; + } +private: + bool is_dragging; + QPointF prev_pos; +}; + class EngraveWidget : public QDockWidget, @@ -53,7 +251,18 @@ class Q_DECL_EXPORT Engrave_text_plugin : Q_OBJECT Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + +private: + typedef CGAL::Surface_mesh_shortest_path_traits SP_traits; + typedef CGAL::Surface_mesh_shortest_path Surface_mesh_shortest_path; + typedef Surface_mesh_shortest_path::Face_location Face_location; + typedef CGAL::AABB_face_graph_triangle_primitive Primitive; + typedef CGAL::AABB_traits Tree_traits; + typedef CGAL::AABB_tree Tree; + typedef EPICK::Point_3 Point_3; + public : + void init(QMainWindow* , CGAL::Three::Scene_interface* , Messages_interface*) Q_DECL_OVERRIDE{ //get refs this->scene = Three::scene(); @@ -76,6 +285,7 @@ public : //items visu_item = NULL; + sel_item = NULL; //transfo angle = 0.0; @@ -83,37 +293,49 @@ public : connect(dock_widget->t_left_pushButton, &QPushButton::clicked, this, [this](){ translation -= EPICK::Vector_2(0.05,0); + scene->setSelectedItem(scene->item_id(sel_item)); visualize(); }); connect(dock_widget->t_up_pushButton, &QPushButton::clicked, this, [this](){ - translation -= EPICK::Vector_2(0,-0.05); + translation -= EPICK::Vector_2(0,0.05); + scene->setSelectedItem(scene->item_id(sel_item)); visualize(); }); connect(dock_widget->t_down_pushButton, &QPushButton::clicked, this, [this](){ - translation -= EPICK::Vector_2(0,0.05); + translation += EPICK::Vector_2(0,0.05); + scene->setSelectedItem(scene->item_id(sel_item)); visualize(); }); connect(dock_widget->t_right_pushButton, &QPushButton::clicked, this, [this](){ translation += EPICK::Vector_2(0.05,0); + scene->setSelectedItem(scene->item_id(sel_item)); visualize(); }); } connect(dock_widget->r_right_pushButton, &QPushButton::clicked, this, [this](){ angle += 0.15; + scene->setSelectedItem(scene->item_id(sel_item)); visualize(); }); connect(dock_widget->r_left_pushButton, &QPushButton::clicked, this, [this](){ angle -= 0.15; + scene->setSelectedItem(scene->item_id(sel_item)); visualize(); }); + graphics_scene = new QGraphicsScene(dock_widget); + dock_widget->graphicsView->setScene(graphics_scene); + dock_widget->graphicsView->setRenderHints(QPainter::Antialiasing); + navigation = new Navigation(); + dock_widget->graphicsView->installEventFilter(navigation); + dock_widget->graphicsView->viewport()->installEventFilter(navigation); } bool applicable(QAction*) const Q_DECL_OVERRIDE { @@ -130,33 +352,27 @@ public Q_SLOTS: } void visualize() { - Scene_polyhedron_selection_item* sel_item = - qobject_cast - (scene->item(scene->mainSelectionIndex())); + if(!sel_item) + sel_item = + qobject_cast + (scene->item(scene->mainSelectionIndex())); if(!sel_item) return; if(sel_item->selected_facets.empty()) return; if(!CGAL::is_closed(*sel_item->polyhedron())) - return; + return; if(visu_item) scene->erase(scene->item_id(visu_item)); visu_item = NULL; - namespace SMP = CGAL::Surface_mesh_parameterization; - typedef CGAL::Surface_mesh_shortest_path_traits SP_traits; - typedef CGAL::Surface_mesh_shortest_path Surface_mesh_shortest_path; - typedef Surface_mesh_shortest_path::Face_location Face_location; - typedef CGAL::AABB_face_graph_triangle_primitive Primitive; - typedef CGAL::AABB_traits Tree_traits; - typedef CGAL::AABB_tree Tree; - typedef EPICK::Point_3 Point_3; - SMesh sm; - sel_item->export_selected_facets_as_polyhedron(&sm); + + SMesh *sm = new SMesh(); + sel_item->export_selected_facets_as_polyhedron(sm); SMesh::Halfedge_index hd = - CGAL::Polygon_mesh_processing::longest_border(sm).first; + CGAL::Polygon_mesh_processing::longest_border(*sm).first; SMesh::Property_map uv_map = - sm.add_property_map("v:uv").first; + sm->add_property_map("v:uv").first; // Parameterized bool pmap boost::unordered_set vs; @@ -165,18 +381,18 @@ public Q_SLOTS: // Parameterizer SMP::ARAP_parameterizer_3 parameterizer; - SMP::Error_code status = parameterizer.parameterize(sm, hd, uv_map, get(boost::vertex_index, sm), vpm); + SMP::Error_code status = parameterizer.parameterize(*sm, hd, uv_map, get(boost::vertex_index, *sm), vpm); if(status != SMP::OK) { std::cout << "Encountered a problem: " << status << std::endl; return ; } std::cout << "Parameterized with ARAP (SM)!" << std::endl; - SMesh::Property_map uv_map_3 = - sm.add_property_map("v:uv3").first; + uv_map_3 = + sm->add_property_map("v:uv3").first; float xmin(std::numeric_limits::max()), xmax(std::numeric_limits::min()), ymin(std::numeric_limits::max()), ymax(std::numeric_limits::min()); - for(SMesh::Vertex_index v : sm.vertices()) + for(SMesh::Vertex_index v : sm->vertices()) { uv_map_3[v] = Point_3(uv_map[v][0], uv_map[v] [1], 0); @@ -193,15 +409,15 @@ public Q_SLOTS: std::cout<<"xmax = "<number_of_vertices() << " " << sm->number_of_faces() << " 0\n"; + for(SMesh::Vertex_index v : sm->vertices()) out << uv_map_3[v] << "\n"; - for(SMesh::Face_index f : faces(sm)) + for(SMesh::Face_index f : faces(*sm)) { - SMesh::Halfedge_index h = sm.halfedge(f); - out << "3 " << (unsigned) sm.target(h) << " " - << (unsigned) sm.target(sm.next(h)) << " " - << (unsigned) sm.source(h) << "\n"; + SMesh::Halfedge_index h = sm->halfedge(f); + out << "3 " << (unsigned) sm->target(h) << " " + << (unsigned) sm->target(sm->next(h)) << " " + << (unsigned) sm->source(h) << "\n"; } @@ -219,53 +435,89 @@ public Q_SLOTS: QTransform trans; QList polys = path.toSubpathPolygons(); - //Scene_polylines_item* new_poly = new Scene_polylines_item(); - Scene_polylines_item::Polylines_container polylines; QFontMetrics fm(font); int width=fm.width(dock_widget->lineEdit->text()); int height=fm.height(); std::cout<<"width = "<setColor(QColor(Qt::red)); scene->addItem(visu_item); dock_widget->engraveButton->setEnabled(true); - // dock_widget->visualizeButton->setEnabled(false); + + if(graphics_scene->items().empty()) + { + Component* component = new Component(); + face_iterator bfit; + for(bfit = faces(*sm).begin(); + bfit != faces(*sm).end(); + ++bfit) + { + component->insert(*bfit); + } + SMesh::Property_map > uv; + uv = sm->add_property_map >( + "h:uv",std::make_pair(0.0f,0.0f)).first; + SMesh::Halfedge_iterator it; + for(it = sm->halfedges_begin(); + it != sm->halfedges_end(); + ++it) + { + halfedge_descriptor hd(*it); + EPICK::FT u = uv_map[target(hd, *sm)].x(); + EPICK::FT v = uv_map[target(hd, *sm)].y(); + put(uv, *it, std::make_pair(static_cast(u),static_cast(v))); + } + + //ParamItem takes ownership of text_mesh_bottom + ParamItem *param_item= new ParamItem(component, polylines, transfo, sm, + QRectF(QPointF(xmin, ymin), QPointF(xmax, ymax))); + graphics_scene->addItem(param_item); + dock_widget->graphicsView->fitInView(param_item->boundingRect(), Qt::KeepAspectRatio); + } + else + { + ParamItem* param_item = static_cast(graphics_scene->items().first()); + param_item->set_transfo(transfo); + dock_widget->graphicsView->activateWindow(); + graphics_scene->update(); + } + // dock_widget->visualizeButton->setEnabled(false); } void engrave() { @@ -279,22 +531,12 @@ public Q_SLOTS: if(sel_item->selected_facets.empty()) return; if(!CGAL::is_closed(*sel_item->polyhedron())) - return; + return; - typedef CGAL::Projection_traits_xy_3 Gt; - typedef CGAL::Delaunay_mesh_vertex_base_2 Vb; - typedef CGAL::Delaunay_mesh_face_base_2 Fm; - typedef CGAL::Triangulation_face_base_with_info_2 Fb; - typedef CGAL::Triangulation_data_structure_2 TDS; - typedef CGAL::No_intersection_tag Tag; - typedef CGAL::Constrained_Delaunay_triangulation_2 CDT; - typedef CGAL::Delaunay_mesh_size_criteria_2 Criteria; - typedef CGAL::Delaunay_mesher_2 Mesher; - - CDT cdt; + /* CDT cdt; try{ - Q_FOREACH(const std::vector& points, - visu_item->polylines) + Q_FOREACH(const std::vector& points, + polylines) cdt.insert_constraint(points.begin(),points.end()); }catch(std::runtime_error&) { @@ -306,22 +548,16 @@ public Q_SLOTS: std::cout << "Triangulation is not of dimension 2" << std::endl; return; } - Scene_item::Bbox bbox= visu_item->bbox(); + CGAL::Bbox_2 bbox= CGAL::bbox_2(polylines.front().begin(), polylines.front().end(), EPICK()); + Q_FOREACH(const std::vector& points, + polylines) + { + bbox += CGAL::bbox_2(points.begin(), points.end(), EPICK()); + } float diag = CGAL::sqrt( (bbox.xmax()-bbox.xmin())*(bbox.xmax()-bbox.xmin()) +(bbox.ymax()-bbox.ymin())*(bbox.ymax()-bbox.ymin()) - +(bbox.zmax()-bbox.zmax()) *(bbox.zmax()-bbox.zmax()) ); - float zmax = bbox.zmax(), - zmin = bbox.zmin(); - //project to z=zmin for mesh_2 - BOOST_FOREACH(Scene_polylines_item::Polyline poly, visu_item->polylines) - { - BOOST_FOREACH(EPICK::Point_3& p, poly) - { - p = EPICK::Point_3(p.x(), p.y(), zmin); - } - } // start by marking the domain to mesh Criteria criteria(0.125, 0.05 * diag); Mesher mesher(cdt, criteria); @@ -337,13 +573,13 @@ public Q_SLOTS: mesher.refine_mesh(); - SMesh text_mesh_bottom, text_mesh_complete; + SMesh* text_mesh_bottom = new SMesh(); cdt2_to_face_graph(cdt, - text_mesh_bottom, - zmin); - PMP::extrude_mesh(text_mesh_bottom, text_mesh_complete,EPICK::Vector_3(0,0,zmax-zmin)); + sm, + *text_mesh_bottom);*/ + // PMP::extrude_mesh(text_mesh_bottom, text_mesh_complete,EPICK::Vector_3(0,0,0.3)); - CGAL::Surface_mesh exact_text, + /*CGAL::Surface_mesh exact_text, exact_target; CGAL::copy_face_graph(text_mesh_complete, exact_text); CGAL::copy_face_graph(*sel_item->polyhedron(), exact_target); @@ -352,9 +588,10 @@ public Q_SLOTS: Nef_polyhedron new_nef = nef_target - nef_text; SMesh result; CGAL::convert_nef_polyhedron_to_polygon_mesh(new_nef, result); - CGAL::Polygon_mesh_processing::triangulate_faces(result); - Scene_surface_mesh_item* result_item = new Scene_surface_mesh_item(result); - scene->addItem(result_item); + CGAL::Polygon_mesh_processing::triangulate_faces(result);*/ + //Scene_surface_mesh_item* result_item = new Scene_surface_mesh_item(text_mesh_bottom); + //result); + //scene->addItem(result_item); dock_widget->engraveButton->setEnabled(false); dock_widget->visualizeButton->setEnabled(true); } @@ -364,15 +601,6 @@ public Q_SLOTS: } private: - struct FaceInfo2 - { - FaceInfo2(){} - int nesting_level; - bool in_domain(){ - return nesting_level%2 == 1; - } - }; - template void mark_domains(CDT& ct, @@ -423,15 +651,19 @@ private: } template - void cdt2_to_face_graph(const CDT& cdt, TriangleMesh& tm, double constant_coordinate) + void cdt2_to_face_graph(const CDT& cdt, + SMesh sm, + TriangleMesh& tm) { + + Tree aabb_tree(faces(sm).first, faces(sm).second, sm, uv_map_3); typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; - + typedef std::map Map; Map descriptors; for (typename CDT::Finite_faces_iterator fit=cdt.finite_faces_begin(), - fit_end=cdt.finite_faces_end(); - fit!=fit_end; ++fit) + fit_end=cdt.finite_faces_end(); + fit!=fit_end; ++fit) { if (!fit->is_in_domain()) continue; CGAL::cpp11::array vds; @@ -440,16 +672,17 @@ private: typename Map::iterator it; bool insert_ok; boost::tie(it,insert_ok) = - descriptors.insert(std::make_pair(fit->vertex(i),vertex_descriptor())); + descriptors.insert(std::make_pair(fit->vertex(i),vertex_descriptor())); if (insert_ok){ - const Kernel::Point_3& pt=fit->vertex(i)->point(); - double coords[3] = {pt[0], pt[1], pt[2]}; - coords[2]=constant_coordinate; - it->second = add_vertex(Kernel::Point_3(coords[0],coords[1],coords[2]), tm); + const Kernel::Point_2& pt=fit->vertex(i)->point(); + Face_location loc = Surface_mesh_shortest_path::locate( + Point_3(pt.x(), pt.y(), 0), + aabb_tree, sm, uv_map_3); + it->second = add_vertex(Surface_mesh_shortest_path::point(loc.first, loc.second, sm, sm.points()), tm); } vds[i]=it->second; } - + CGAL::Euler::add_face(vds, tm); } } @@ -457,8 +690,13 @@ private: QList _actions; EngraveWidget* dock_widget; Scene_polylines_item* visu_item; + Scene_polyhedron_selection_item* sel_item; double angle; EPICK::Vector_2 translation; + std::vector > polylines; + SMesh::Property_map uv_map_3; + QGraphicsScene *graphics_scene; + Navigation* navigation; }; #include "Engrave_text_plugin.moc" From 433bd7499c40d60d256f56bee26676240e9d4ce5 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Tue, 31 Jul 2018 15:50:21 +0200 Subject: [PATCH 008/193] Working version --- .../Plugins/PMP/Engrave_dock_widget.ui | 50 ++-- .../Plugins/PMP/Engrave_text_plugin.cpp | 214 ++++++++++++------ 2 files changed, 171 insertions(+), 93 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui index 8062175b83e..53e9d44e056 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui @@ -14,7 +14,7 @@ Engraving - + @@ -24,20 +24,6 @@ - - - - <- - - - - - - - R-> - - - @@ -45,10 +31,10 @@ - - + + - -> + <- @@ -59,6 +45,34 @@ + + + + R-> + + + + + + + -> + + + + + + + ->.<- + + + + + + + <-.-> + + + diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp index 02a687407fb..89dda6bd452 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp @@ -60,6 +60,33 @@ struct FaceInfo2 } }; +template +struct Bot +{ + Bot(MAP map):map(map){} + template + void operator()(const T&,VD vd) const + { + put(map, vd, get(map, vd)+Kernel::Vector_3(0.0,0.0,-0.01)); + } + MAP map; + +}; + +template +struct Top +{ + Top(MAP map):map(map){} + + template + void operator()(const T&, VD vd) const + { + put(map, vd, get(map, vd)+Kernel::Vector_3(0.0,0.0,0.01)); + } + + MAP map; +}; + typedef EPICK Gt; typedef CGAL::Delaunay_mesh_vertex_base_2 Vb; typedef CGAL::Delaunay_mesh_face_base_2 Fm; @@ -127,7 +154,7 @@ public : points[2] = QPointF(get(uv, h).first, get(uv, h).second); painter->drawPolygon(points,3); } - + pen.setColor(Qt::red); pen.setWidth(0); painter->setPen(pen); @@ -143,9 +170,13 @@ public : } painter->drawPolyline(points.data(), points.size()); } - - - + pen.setColor(Qt::green); + pen.setWidth(0); + painter->setPen(pen); + painter->drawPoint(QPointF(0,0)); + + + } private: @@ -270,54 +301,68 @@ public : //action QAction* actionFitText= new QAction("Fit Text", mw); - if(actionFitText) { - connect(actionFitText, SIGNAL(triggered()), - this, SLOT(showWidget())); - _actions << actionFitText; - //widget - dock_widget = new EngraveWidget("Engraving", mw); - dock_widget->setVisible(false); // do not show at the beginning - addDockWidget(dock_widget); - connect(dock_widget->visualizeButton, &QPushButton::clicked, - this, &Engrave_text_plugin::visualize); - connect(dock_widget->engraveButton, &QPushButton::clicked, - this, &Engrave_text_plugin::engrave); - - //items - visu_item = NULL; - sel_item = NULL; - - //transfo - angle = 0.0; - translation = EPICK::Vector_2(0,0); - connect(dock_widget->t_left_pushButton, &QPushButton::clicked, - this, [this](){ - translation -= EPICK::Vector_2(0.05,0); - scene->setSelectedItem(scene->item_id(sel_item)); - visualize(); - }); - - connect(dock_widget->t_up_pushButton, &QPushButton::clicked, - this, [this](){ - translation -= EPICK::Vector_2(0,0.05); - scene->setSelectedItem(scene->item_id(sel_item)); - visualize(); - }); - - connect(dock_widget->t_down_pushButton, &QPushButton::clicked, - this, [this](){ - translation += EPICK::Vector_2(0,0.05); - scene->setSelectedItem(scene->item_id(sel_item)); - visualize(); - }); - - connect(dock_widget->t_right_pushButton, &QPushButton::clicked, - this, [this](){ - translation += EPICK::Vector_2(0.05,0); - scene->setSelectedItem(scene->item_id(sel_item)); - visualize(); - }); - } + connect(actionFitText, SIGNAL(triggered()), + this, SLOT(showWidget())); + _actions << actionFitText; + //widget + dock_widget = new EngraveWidget("Engraving", mw); + dock_widget->setVisible(false); // do not show at the beginning + addDockWidget(dock_widget); + connect(dock_widget->visualizeButton, &QPushButton::clicked, + this, &Engrave_text_plugin::visualize); + connect(dock_widget->engraveButton, &QPushButton::clicked, + this, &Engrave_text_plugin::engrave); + + //items + visu_item = nullptr; + sel_item = nullptr; + sm = nullptr; + + //transfo + angle = 0.0; + scaling=1.0; + translation = EPICK::Vector_2(0,0); + connect(dock_widget->t_left_pushButton, &QPushButton::clicked, + this, [this](){ + translation -= EPICK::Vector_2(0.05,0); + scene->setSelectedItem(scene->item_id(sel_item)); + visualize(); + }); + + connect(dock_widget->s_large_pushButton, &QPushButton::clicked, + this, [this](){ + scaling += 0.1; + scene->setSelectedItem(scene->item_id(sel_item)); + visualize(); + }); + + connect(dock_widget->s_small_pushButton, &QPushButton::clicked, + this, [this](){ + scaling -= 0.1; + scene->setSelectedItem(scene->item_id(sel_item)); + visualize(); + }); + + connect(dock_widget->t_up_pushButton, &QPushButton::clicked, + this, [this](){ + translation -= EPICK::Vector_2(0,0.05); + scene->setSelectedItem(scene->item_id(sel_item)); + visualize(); + }); + + connect(dock_widget->t_down_pushButton, &QPushButton::clicked, + this, [this](){ + translation += EPICK::Vector_2(0,0.05); + scene->setSelectedItem(scene->item_id(sel_item)); + visualize(); + }); + + connect(dock_widget->t_right_pushButton, &QPushButton::clicked, + this, [this](){ + translation += EPICK::Vector_2(0.05,0); + scene->setSelectedItem(scene->item_id(sel_item)); + visualize(); + }); connect(dock_widget->r_right_pushButton, &QPushButton::clicked, this, [this](){ angle += 0.15; @@ -366,9 +411,11 @@ public Q_SLOTS: scene->erase(scene->item_id(visu_item)); visu_item = NULL; - - SMesh *sm = new SMesh(); - sel_item->export_selected_facets_as_polyhedron(sm); + if(!sm) + { + sm = new SMesh(); + sel_item->export_selected_facets_as_polyhedron(sm); + } SMesh::Halfedge_index hd = CGAL::Polygon_mesh_processing::longest_border(*sm).first; SMesh::Property_map uv_map = @@ -438,7 +485,7 @@ public Q_SLOTS: QFontMetrics fm(font); int width=fm.width(dock_widget->lineEdit->text()); int height=fm.height(); - std::cout<<"width = "< vs; - SMP::internal::Bool_property_map< boost::unordered_set > vpm(vs); - - // Parameterizer - SMP::ARAP_parameterizer_3 parameterizer; - - SMP::Error_code status = parameterizer.parameterize(*sm, hd, uv_map, get(boost::vertex_index, *sm), vpm); - if(status != SMP::OK) { - std::cout << "Encountered a problem: " << status << std::endl; - return ; - } - - std::cout << "Parameterized with ARAP (SM)!" << std::endl; - uv_map_3 = - sm->add_property_map("v:uv3").first; - float xmin(std::numeric_limits::max()), xmax(std::numeric_limits::min()), - ymin(std::numeric_limits::max()), ymax(std::numeric_limits::min()); - for(SMesh::Vertex_index v : sm->vertices()) - { - uv_map_3[v] = Point_3(uv_map[v][0], uv_map[v] - [1], 0); - if(uv_map[v][0] > xmax) - xmax = uv_map[v][0]; - if(uv_map[v][0] < xmin) - xmin = uv_map[v][0]; + SMesh::Halfedge_index hd = + CGAL::Polygon_mesh_processing::longest_border(*sm).first; + SMesh::Property_map uv_map = + sm->add_property_map("v:uv").first; - if(uv_map[v][1] > ymax) - ymax = uv_map[v][1]; - if(uv_map[v][1] < ymin) - ymin = uv_map[v][1]; - } - std::cout<<"xmax = "<number_of_vertices() << " " << sm->number_of_faces() << " 0\n"; - for(SMesh::Vertex_index v : sm->vertices()) - out << uv_map_3[v] << "\n"; - for(SMesh::Face_index f : faces(*sm)) - { - SMesh::Halfedge_index h = sm->halfedge(f); - out << "3 " << (unsigned) sm->target(h) << " " - << (unsigned) sm->target(sm->next(h)) << " " - << (unsigned) sm->source(h) << "\n"; - } - - + // Parameterized bool pmap + boost::unordered_set vs; + SMP::internal::Bool_property_map< boost::unordered_set > vpm(vs); + + // Parameterizer + SMP::ARAP_parameterizer_3 parameterizer; + + SMP::Error_code status = parameterizer.parameterize(*sm, hd, uv_map, get(boost::vertex_index, *sm), vpm); + if(status != SMP::OK) { + std::cout << "Encountered a problem: " << status << std::endl; + return ; + } + + std::cout << "Parameterized with ARAP (SM)!" << std::endl; + xmin = std::numeric_limits::max(); + xmax = std::numeric_limits::min(); + ymin = std::numeric_limits::max(); + ymax = std::numeric_limits::min(); + uv_map_3 = + sm->add_property_map("v:uv3").first; + for(SMesh::Vertex_index v : sm->vertices()) + { + uv_map_3[v] = Point_3(uv_map[v][0], uv_map[v] + [1], 0); + if(uv_map[v][0] > xmax) + xmax = uv_map[v][0]; + if(uv_map[v][0] < xmin) + xmin = uv_map[v][0]; + + if(uv_map[v][1] > ymax) + ymax = uv_map[v][1]; + if(uv_map[v][1] < ymin) + ymin = uv_map[v][1]; + } + + + } //create Text Polyline - typedef EPICK::Point_3 Point_3; - Viewer_interface* viewer = static_cast(CGAL::QGLViewer::QGLViewerPool().first()); QPainterPath path; QFont font; font.setPointSize(15); path.addText(QPoint(xmin,-ymin), font, dock_widget->lineEdit->text()); - viewer->getPainter()->begin(viewer); - viewer->getPainter()->drawPath(path); - viewer->getPainter()->end(); - QTransform trans; - QList polys = path.toSubpathPolygons(); QFontMetrics fm(font); int width=fm.width(dock_widget->lineEdit->text()); int height=fm.height(); - + polylines.clear(); Q_FOREACH(QPolygonF poly, polys){ polylines.push_back(std::vector()); Q_FOREACH(QPointF pf, poly) @@ -497,8 +472,6 @@ public Q_SLOTS: } } - - // build AABB-tree for face location queries Tree aabb_tree(faces(*sm).first, faces(*sm).second, *sm, uv_map_3); @@ -521,8 +494,8 @@ public Q_SLOTS: Face_location loc = Surface_mesh_shortest_path::locate( Point_3(p_2.x(), p_2.y(), 0), aabb_tree, *sm, uv_map_3); - visu_item->polylines.back().push_back(//p); - Surface_mesh_shortest_path::point(loc.first, loc.second, *sm, sm->points())); + visu_item->polylines.back().push_back( + Surface_mesh_shortest_path::point(loc.first, loc.second, *sm, sm->points())); } } visu_item->setName("Text"); @@ -544,6 +517,8 @@ public Q_SLOTS: uv = sm->add_property_map >( "h:uv",std::make_pair(0.0f,0.0f)).first; SMesh::Halfedge_iterator it; + SMesh::Property_map uv_map = + sm->property_map("v:uv").first; for(it = sm->halfedges_begin(); it != sm->halfedges_end(); ++it) @@ -554,9 +529,9 @@ public Q_SLOTS: put(uv, *it, std::make_pair(static_cast(u),static_cast(v))); } - //ParamItem takes ownership of text_mesh_bottom + //ParamItem does not take ownership of text_mesh_bottom ParamItem *param_item= new ParamItem(component, polylines, transfo, sm, - QRectF(QPointF(xmin, ymin), QPointF(xmax, ymax))); + QRectF(QPointF(xmin, -ymax), QPointF(xmax, -ymin))); graphics_scene->addItem(param_item); dock_widget->graphicsView->fitInView(param_item->boundingRect(), Qt::KeepAspectRatio); } @@ -573,16 +548,13 @@ public Q_SLOTS: void engrave() { if(!visu_item) return; - Scene_polyhedron_selection_item* sel_item = - qobject_cast - (scene->item(scene->mainSelectionIndex())); if(!sel_item) return; if(sel_item->selected_facets.empty()) return; if(!CGAL::is_closed(*sel_item->polyhedron())) return; - + QApplication::setOverrideCursor(Qt::WaitCursor); CDT cdt; try{ for(std::size_t i = 0; @@ -651,8 +623,16 @@ public Q_SLOTS: CGAL::Polygon_mesh_processing::triangulate_faces(result); Scene_surface_mesh_item* result_item = new Scene_surface_mesh_item( - result); + result); scene->addItem(result_item); + graphics_scene->clear(); + scene->erase(scene->item_id(sel_item)); + sel_item =nullptr; + delete sm; + sm = nullptr; + scene->erase(scene->item_id(visu_item)); + visu_item = nullptr; + QApplication::restoreOverrideCursor(); dock_widget->engraveButton->setEnabled(false); dock_widget->visualizeButton->setEnabled(true); } @@ -758,6 +738,7 @@ private: std::vector > polylines; SMesh::Property_map uv_map_3; SMesh* sm; + float xmin, xmax, ymin, ymax; QGraphicsScene *graphics_scene; Navigation* navigation; From 6fe03d37d4b5b385f34fa9a0916965b06ff1ec69 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Tue, 31 Jul 2018 17:36:49 +0200 Subject: [PATCH 010/193] Better UI and fix bug nef_3. (just find n appropriate normal instead of always Z) --- .../Plugins/PMP/Engrave_dock_widget.ui | 120 ++++++++++++++---- .../Plugins/PMP/Engrave_text_plugin.cpp | 51 ++++---- 2 files changed, 123 insertions(+), 48 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui index 53e9d44e056..6d11dcf77ca 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui @@ -6,8 +6,8 @@ 0 0 - 278 - 372 + 295 + 421 @@ -16,60 +16,127 @@ - - - - - V + + + + + -179 + + + 179 + + + Qt::Horizontal + + + + + + + 300 + + + 1 + + + 100 + + + 100 + + + Qt::Horizontal - ^ + + + + + :/cgal/icons/resources/up.png:/cgal/icons/resources/up.png - <- + + + + + :/cgal/icons/resources/left_arrow.png:/cgal/icons/resources/left_arrow.png - - + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + - <-R + Rotation degree: - - + + - R-> + Scaling factor: + + + + + + + + + + + :/cgal/icons/resources/down.png:/cgal/icons/resources/down.png - -> + + + + + :/cgal/icons/resources/right_arrow.png:/cgal/icons/resources/right_arrow.png - - - - ->.<- + + + + 6 + + + 0.000000000000000 + + + 0.100000000000000 - - + + - <-.-> + Engraving depth: @@ -126,6 +193,11 @@ - + + + + + + diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp index db60335ba4e..bedf874738e 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp @@ -17,7 +17,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -64,12 +66,18 @@ struct FaceInfo2 template struct Bot { - Bot(MAP map):map(map){} + Bot(const EPICK::Vector_3& n, + double d, + MAP map):d(d), + n(n), + map(map){} template void operator()(const T&,VD vd) const { - put(map, vd, get(map, vd)+Kernel::Vector_3(0.0,0.0,-0.01)); + put(map, vd, get(map, vd)-d*n); } + double d; + const EPICK::Vector_3& n; MAP map; }; @@ -77,14 +85,15 @@ struct Bot template struct Top { - Top(MAP map):map(map){} + Top(const EPICK::Vector_3& n, + MAP map):n(n),map(map){} template void operator()(const T&, VD vd) const { - put(map, vd, get(map, vd)+Kernel::Vector_3(0.0,0.0,0.01)); + put(map, vd, get(map, vd)+0.01*n); } - + const EPICK::Vector_3& n; MAP map; }; @@ -322,16 +331,9 @@ public : visualize(); }); - connect(dock_widget->s_large_pushButton, &QPushButton::clicked, + connect(dock_widget->scal_slider, &QSlider::valueChanged, this, [this](){ - scaling += 0.1; - scene->setSelectedItem(scene->item_id(sel_item)); - visualize(); - }); - - connect(dock_widget->s_small_pushButton, &QPushButton::clicked, - this, [this](){ - scaling -= 0.1; + scaling = dock_widget->scal_slider->value()/100.0; scene->setSelectedItem(scene->item_id(sel_item)); visualize(); }); @@ -356,15 +358,9 @@ public : scene->setSelectedItem(scene->item_id(sel_item)); visualize(); }); - connect(dock_widget->r_right_pushButton, &QPushButton::clicked, + connect(dock_widget->rot_slider, &QSlider::valueChanged, this, [this](){ - angle += 0.15; - scene->setSelectedItem(scene->item_id(sel_item)); - visualize(); - }); - connect(dock_widget->r_left_pushButton, &QPushButton::clicked, - this, [this](){ - angle -= 0.15; + angle = dock_widget->rot_slider->value() * CGAL_PI/180.0; scene->setSelectedItem(scene->item_id(sel_item)); visualize(); }); @@ -607,8 +603,15 @@ public Q_SLOTS: cdt2_to_face_graph(cdt, text_mesh_bottom); typedef typename boost::property_map::type VPMap; - Bot bot(get(CGAL::vertex_point, text_mesh_complete)); - Top top(get(CGAL::vertex_point, text_mesh_complete)); + EPICK::Vector_3 normal(0,0,0); + BOOST_FOREACH(face_descriptor f, sel_item->selected_facets) + { + normal += CGAL::Polygon_mesh_processing::compute_face_normal(f, *sel_item->polyhedron()); + } + normal/=CGAL::sqrt(normal.squared_length()); + + Bot bot(normal, dock_widget->depth_spinBox->value(),get(CGAL::vertex_point, text_mesh_complete)); + Top top(normal, get(CGAL::vertex_point, text_mesh_complete)); PMP::extrude_mesh(text_mesh_bottom, text_mesh_complete, bot, top); CGAL::Surface_mesh exact_text, From 9213f46d92376f793eeff20afabed966f7d5f283 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Thu, 2 Aug 2018 15:51:32 +0200 Subject: [PATCH 011/193] Fix rotation and enhance initial position of the text if the parameterization is globally vertical. --- .../Plugins/PMP/Engrave_dock_widget.ui | 264 +++++++++--------- .../Plugins/PMP/Engrave_text_plugin.cpp | 141 +++++++--- 2 files changed, 244 insertions(+), 161 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui index 6d11dcf77ca..9a8276089d8 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui @@ -15,133 +15,6 @@ - - - - - - -179 - - - 179 - - - Qt::Horizontal - - - - - - - 300 - - - 1 - - - 100 - - - 100 - - - Qt::Horizontal - - - - - - - - - - - :/cgal/icons/resources/up.png:/cgal/icons/resources/up.png - - - - - - - - - - - :/cgal/icons/resources/left_arrow.png:/cgal/icons/resources/left_arrow.png - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Rotation degree: - - - - - - - Scaling factor: - - - - - - - - - - - :/cgal/icons/resources/down.png:/cgal/icons/resources/down.png - - - - - - - - - - - :/cgal/icons/resources/right_arrow.png:/cgal/icons/resources/right_arrow.png - - - - - - - 6 - - - 0.000000000000000 - - - 0.100000000000000 - - - - - - - Engraving depth: - - - - - @@ -183,10 +56,147 @@ + + + + Reset + + + + + + + + + Scaling factor: + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + :/cgal/icons/resources/left_arrow.png:/cgal/icons/resources/left_arrow.png + + + + + + + + + + + :/cgal/icons/resources/up.png:/cgal/icons/resources/up.png + + + + + + + 300 + + + 1 + + + 100 + + + 100 + + + Qt::Horizontal + + + + + + + + + + + :/cgal/icons/resources/right_arrow.png:/cgal/icons/resources/right_arrow.png + + + + + + + -179 + + + 179 + + + Qt::Horizontal + + + + + + + Rotation degree: + + + + + + + Engraving depth: + + + + + + + + + + + :/cgal/icons/resources/down.png:/cgal/icons/resources/down.png + + + + + + + 6 + + + 0.000001000000000 + + + 0.100000000000000 + + + 0.010000000000000 + + + + + diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp index bedf874738e..9ecaa9a0737 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp @@ -323,38 +323,42 @@ public : //transfo angle = 0.0; scaling=1.0; - translation = EPICK::Vector_2(0,0); - connect(dock_widget->t_left_pushButton, &QPushButton::clicked, - this, [this](){ - translation -= EPICK::Vector_2(0.05,0); - scene->setSelectedItem(scene->item_id(sel_item)); - visualize(); - }); - + translation = EPICK::Vector_2(0,0); connect(dock_widget->scal_slider, &QSlider::valueChanged, this, [this](){ scaling = dock_widget->scal_slider->value()/100.0; scene->setSelectedItem(scene->item_id(sel_item)); visualize(); }); + connect(dock_widget->reset_button, &QPushButton::clicked, + this, [this](){ + cleanup(); + }); connect(dock_widget->t_up_pushButton, &QPushButton::clicked, this, [this](){ - translation += EPICK::Vector_2(0,0.05); + translation += EPICK::Vector_2(0,0.005); scene->setSelectedItem(scene->item_id(sel_item)); visualize(); }); connect(dock_widget->t_down_pushButton, &QPushButton::clicked, this, [this](){ - translation -= EPICK::Vector_2(0,0.05); + translation -= EPICK::Vector_2(0,0.005); scene->setSelectedItem(scene->item_id(sel_item)); visualize(); }); connect(dock_widget->t_right_pushButton, &QPushButton::clicked, this, [this](){ - translation += EPICK::Vector_2(0.05,0); + translation += EPICK::Vector_2(0.005,0); + scene->setSelectedItem(scene->item_id(sel_item)); + visualize(); + }); + + connect(dock_widget->t_left_pushButton, &QPushButton::clicked, + this, [this](){ + translation -= EPICK::Vector_2(0.005,0); scene->setSelectedItem(scene->item_id(sel_item)); visualize(); }); @@ -393,12 +397,18 @@ public Q_SLOTS: if(!sel_item) return; if(sel_item->selected_facets.empty()) + { + cleanup(); return; + } if(!CGAL::is_closed(*sel_item->polyhedron())) + { + cleanup(); return; + } if(visu_item) scene->erase(scene->item_id(visu_item)); - visu_item = NULL; + visu_item = nullptr; if(!sm) { @@ -419,6 +429,7 @@ public Q_SLOTS: SMP::Error_code status = parameterizer.parameterize(*sm, hd, uv_map, get(boost::vertex_index, *sm), vpm); if(status != SMP::OK) { std::cout << "Encountered a problem: " << status << std::endl; + cleanup(); return ; } @@ -445,41 +456,75 @@ public Q_SLOTS: } - } + } //create Text Polyline QPainterPath path; QFont font; font.setPointSize(15); - - path.addText(QPoint(xmin,-ymin), font, dock_widget->lineEdit->text()); + path.addText(QPoint(xmin,ymin), font, dock_widget->lineEdit->text()); QList polys = path.toSubpathPolygons(); - QFontMetrics fm(font); - int width=fm.width(dock_widget->lineEdit->text()); - int height=fm.height(); polylines.clear(); + float pxmin(8000),pxmax(-8000), + pymin(8000), pymax(-8000); + Q_FOREACH(QPolygonF poly, polys){ - polylines.push_back(std::vector()); Q_FOREACH(QPointF pf, poly) { EPICK::Point_2 v = EPICK::Point_2(pf.x(),-pf.y()); - polylines.back().push_back(EPICK::Point_2(v.x()*(xmax-xmin)/width +xmin , - v.y()*(ymax-ymin)/height+ymin - )); + if(v.x() < pxmin) + pxmin = v.x(); + if(v.x() > pxmax) + pxmax = v.x(); + if(v.y() < pymin) + pymin = v.y(); + if(v.y() > pymax) + pymax = v.y(); + } + } + if(ymax-ymin > xmax - xmin) + { + Q_FOREACH(QPolygonF poly, polys){ + polylines.push_back(std::vector()); + Q_FOREACH(QPointF pf, poly) + { + EPICK::Point_2 v = EPICK::Point_2(pf.x(),-pf.y()); + polylines.back().push_back(EPICK::Point_2(v.x()*(xmax-xmin)/(pxmax-pxmin) +xmin , + v.y()*(ymax-ymin)/(pymax-pymin)+ymin + )); + } + } + } + else + { + EPICK::Aff_transformation_2 rota = EPICK::Aff_transformation_2(CGAL::TRANSLATION, EPICK::Vector_2((pxmax+pxmin)/2, + (pymax+pymin)/2)) + * EPICK::Aff_transformation_2(CGAL::ROTATION,1,0) + * EPICK::Aff_transformation_2(CGAL::TRANSLATION, EPICK::Vector_2(-(pxmax+pxmin)/2, + -(pymax+pymin)/2)); + + Q_FOREACH(QPolygonF poly, polys){ + polylines.push_back(std::vector()); + Q_FOREACH(QPointF pf, poly) + { + EPICK::Point_2 v = rota.transform(EPICK::Point_2(pf.x(),-pf.y())); + polylines.back().push_back(EPICK::Point_2(v.x()*(xmax-xmin)/(pxmax-pxmin) +xmin , + v.y()*(ymax-ymin)/(pymax-pymin)+ymin + )); + } } } - // build AABB-tree for face location queries Tree aabb_tree(faces(*sm).first, faces(*sm).second, *sm, uv_map_3); visu_item = new Scene_polylines_item; // compute 3D coordinates transfo = - EPICK::Aff_transformation_2(CGAL::TRANSLATION, EPICK::Vector_2((xmax-xmin)/2, - (ymax-ymin)/2)+ translation) + EPICK::Aff_transformation_2(CGAL::TRANSLATION, EPICK::Vector_2((xmax-xmin)/2+xmin, + (ymax-ymin)/2+ymin)+ translation) * EPICK::Aff_transformation_2(CGAL::SCALING,scaling) * EPICK::Aff_transformation_2(CGAL::ROTATION,sin(angle), cos(angle)) - * EPICK::Aff_transformation_2(CGAL::TRANSLATION, EPICK::Vector_2(-(xmax-xmin)/2, - -(ymax-ymin)/2)); + * EPICK::Aff_transformation_2(CGAL::TRANSLATION, EPICK::Vector_2(-(xmax-xmin)/2-xmin, + -(ymax-ymin)/2-ymin)); BOOST_FOREACH(const std::vector& polyline, polylines) { visu_item->polylines.push_back(std::vector()); @@ -609,7 +654,20 @@ public Q_SLOTS: normal += CGAL::Polygon_mesh_processing::compute_face_normal(f, *sel_item->polyhedron()); } normal/=CGAL::sqrt(normal.squared_length()); - + while(normal == EPICK::Vector_3(0,0,0)) + { + QDialog dialog; + QLayout *layout = dialog.layout(); + QDoubleSpinBox xbox, ybox, zbox; + layout->addWidget(&xbox); + layout->addWidget(&ybox); + layout->addWidget(&zbox); + dialog.setLayout(layout); + dialog.exec(); + normal = EPICK::Vector_3(xbox.value(), + ybox.value(), + zbox.value()); + } Bot bot(normal, dock_widget->depth_spinBox->value(),get(CGAL::vertex_point, text_mesh_complete)); Top top(normal, get(CGAL::vertex_point, text_mesh_complete)); PMP::extrude_mesh(text_mesh_bottom, text_mesh_complete, bot, top); @@ -629,12 +687,7 @@ public Q_SLOTS: result); scene->addItem(result_item); graphics_scene->clear(); - scene->erase(scene->item_id(sel_item)); - sel_item =nullptr; - delete sm; - sm = nullptr; - scene->erase(scene->item_id(visu_item)); - visu_item = nullptr; + cleanup(); QApplication::restoreOverrideCursor(); dock_widget->engraveButton->setEnabled(false); dock_widget->visualizeButton->setEnabled(true); @@ -730,6 +783,26 @@ private: } } + void cleanup() + { + graphics_scene->clear(); + if(sel_item) + { + scene->erase(scene->item_id(sel_item)); + sel_item =nullptr; + } + if(sm) + { + delete sm; + sm = nullptr; + } + if(visu_item) + { + scene->erase(scene->item_id(visu_item)); + visu_item = nullptr; + } + + } QList _actions; EngraveWidget* dock_widget; Scene_polylines_item* visu_item; From 86580763d47584d0b949968709579e153c31a921 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Fri, 3 Aug 2018 11:10:43 +0200 Subject: [PATCH 012/193] Small Enhancements --- .../demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui | 6 +++--- .../demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp | 8 ++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui index 9a8276089d8..400a30c9cc7 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui @@ -114,16 +114,16 @@ - 300 + 2000 1 - 100 + 1000 - 100 + 1000 Qt::Horizontal diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp index 9ecaa9a0737..2909f30c1ab 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp @@ -326,7 +326,7 @@ public : translation = EPICK::Vector_2(0,0); connect(dock_widget->scal_slider, &QSlider::valueChanged, this, [this](){ - scaling = dock_widget->scal_slider->value()/100.0; + scaling = dock_widget->scal_slider->value()/1000.0; scene->setSelectedItem(scene->item_id(sel_item)); visualize(); }); @@ -481,7 +481,7 @@ public Q_SLOTS: pymax = v.y(); } } - if(ymax-ymin > xmax - xmin) + if(ymax-ymin <= xmax - xmin) { Q_FOREACH(QPolygonF poly, polys){ polylines.push_back(std::vector()); @@ -785,6 +785,10 @@ private: void cleanup() { + dock_widget->scal_slider->setValue(1000); + dock_widget->rot_slider->setValue(0); + translation = EPICK::Vector_2(0,0); + uv_map_3.reset(); graphics_scene->clear(); if(sel_item) { From 0e32abf5d6e46150039b962d83128a8ca6cac057 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Fri, 3 Aug 2018 11:49:28 +0200 Subject: [PATCH 013/193] Split Scaling in X and Y to get better customization with longer texts. --- .../Plugins/PMP/Engrave_dock_widget.ui | 149 ++++++++++-------- .../Plugins/PMP/Engrave_text_plugin.cpp | 27 +++- 2 files changed, 105 insertions(+), 71 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui index 400a30c9cc7..b25fd5b6328 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui @@ -6,7 +6,7 @@ 0 0 - 295 + 305 421 @@ -69,37 +69,6 @@ - - - - Scaling factor: - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - :/cgal/icons/resources/left_arrow.png:/cgal/icons/resources/left_arrow.png - - - @@ -111,19 +80,20 @@ - - + + + + Engraving depth: + + + + + + + -179 + - 2000 - - - 1 - - - 1000 - - - 1000 + 179 Qt::Horizontal @@ -141,30 +111,35 @@ - - - - -179 - - - 179 - + + Qt::Horizontal - - - - - - Rotation degree: + + + 40 + 20 + - + - - - - Engraving depth: + + + + 2000 + + + 1 + + + 1000 + + + 1000 + + + Qt::Horizontal @@ -179,6 +154,31 @@ + + + + Scaling factor in X: + + + + + + + + + + + :/cgal/icons/resources/left_arrow.png:/cgal/icons/resources/left_arrow.png + + + + + + + Rotation degree: + + + @@ -195,6 +195,29 @@ + + + + 2000 + + + 10 + + + 1000 + + + Qt::Horizontal + + + + + + + Scaling factor in Y: + + + diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp index 2909f30c1ab..cf812cad6f0 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp @@ -322,11 +322,18 @@ public : //transfo angle = 0.0; - scaling=1.0; + scalX=1.0; + scalY=1.0; translation = EPICK::Vector_2(0,0); - connect(dock_widget->scal_slider, &QSlider::valueChanged, + connect(dock_widget->scalX_slider, &QSlider::valueChanged, this, [this](){ - scaling = dock_widget->scal_slider->value()/1000.0; + scalX = dock_widget->scalX_slider->value()/1000.0; + scene->setSelectedItem(scene->item_id(sel_item)); + visualize(); + }); + connect(dock_widget->scalY_slider, &QSlider::valueChanged, + this, [this](){ + scalY = dock_widget->scalY_slider->value()/1000.0; scene->setSelectedItem(scene->item_id(sel_item)); visualize(); }); @@ -517,12 +524,14 @@ public Q_SLOTS: Tree aabb_tree(faces(*sm).first, faces(*sm).second, *sm, uv_map_3); visu_item = new Scene_polylines_item; + + // compute 3D coordinates transfo = EPICK::Aff_transformation_2(CGAL::TRANSLATION, EPICK::Vector_2((xmax-xmin)/2+xmin, (ymax-ymin)/2+ymin)+ translation) - * EPICK::Aff_transformation_2(CGAL::SCALING,scaling) - * EPICK::Aff_transformation_2(CGAL::ROTATION,sin(angle), cos(angle)) + * EPICK::Aff_transformation_2(CGAL::ROTATION,sin(angle), cos(angle)) + * EPICK::Aff_transformation_2(scalX, 0.0,0.0,scalY) * EPICK::Aff_transformation_2(CGAL::TRANSLATION, EPICK::Vector_2(-(xmax-xmin)/2-xmin, -(ymax-ymin)/2-ymin)); BOOST_FOREACH(const std::vector& polyline, polylines) @@ -785,7 +794,8 @@ private: void cleanup() { - dock_widget->scal_slider->setValue(1000); + dock_widget->scalX_slider->setValue(1000); + dock_widget->scalY_slider->setValue(1000); dock_widget->rot_slider->setValue(0); translation = EPICK::Vector_2(0,0); uv_map_3.reset(); @@ -805,14 +815,15 @@ private: scene->erase(scene->item_id(visu_item)); visu_item = nullptr; } - } + QList _actions; EngraveWidget* dock_widget; Scene_polylines_item* visu_item; Scene_polyhedron_selection_item* sel_item; double angle; - double scaling; + double scalX; + double scalY; EPICK::Vector_2 translation; EPICK::Aff_transformation_2 transfo; std::vector > polylines; From f84bbca9a6ed5719ae3e5cdcdf01badf3914741f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 20 Aug 2018 11:44:42 +0200 Subject: [PATCH 014/193] add missing include directive --- Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp index cf812cad6f0..d809fd88b76 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include From 5782c9b6c2fae2cdb0af690b3685bec045ee02e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 20 Aug 2018 13:24:35 +0200 Subject: [PATCH 015/193] using corefinement instead of Nef + check for preconditions --- .../Plugins/PMP/Engrave_text_plugin.cpp | 39 ++++++++++++------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp index d809fd88b76..fa7ab190e7d 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp @@ -7,10 +7,7 @@ #include "Scene_surface_mesh_item.h" #include "Scene_polyhedron_selection_item.h" #include "Scene_polylines_item.h" -#include "Nef_type.h" - -//Actual code reqs -#include +#include "Messages_interface.h" #include #include @@ -18,6 +15,8 @@ #include #include #include +#include +#include #include #include #include @@ -294,14 +293,16 @@ private: typedef CGAL::AABB_traits Tree_traits; typedef CGAL::AABB_tree Tree; typedef EPICK::Point_3 Point_3; + Messages_interface* messages; public : - void init(QMainWindow* , CGAL::Three::Scene_interface* , Messages_interface*) Q_DECL_OVERRIDE{ + void init(QMainWindow* , CGAL::Three::Scene_interface* , Messages_interface* m) Q_DECL_OVERRIDE{ //get refs this->scene = Three::scene(); this->mw = Three::mainWindow(); - + messages = m; + //action QAction* actionFitText= new QAction("Fit Text", mw); connect(actionFitText, SIGNAL(triggered()), @@ -441,7 +442,7 @@ public Q_SLOTS: return ; } - std::cout << "Parameterized with ARAP (SM)!" << std::endl; + std::cout << "Parameterized with ARAP (SM) computed." << std::endl; xmin = std::numeric_limits::max(); xmax = std::numeric_limits::min(); ymin = std::numeric_limits::max(); @@ -682,15 +683,23 @@ public Q_SLOTS: Top top(normal, get(CGAL::vertex_point, text_mesh_complete)); PMP::extrude_mesh(text_mesh_bottom, text_mesh_complete, bot, top); - CGAL::Surface_mesh exact_text, - exact_target; - CGAL::copy_face_graph(text_mesh_complete, exact_text); - CGAL::copy_face_graph(*sel_item->polyhedron(), exact_target); - Nef_polyhedron nef_text(exact_text); - Nef_polyhedron nef_target(exact_target); - Nef_polyhedron new_nef = nef_target - nef_text; + if (PMP::does_self_intersect(text_mesh_complete)) + { + QApplication::restoreOverrideCursor(); + messages->information("Error: text mesh self-intersects!"); + return; + } + SMesh result; - CGAL::convert_nef_polyhedron_to_polygon_mesh(new_nef, result); + CGAL::copy_face_graph(*sel_item->polyhedron(), result); + bool OK = PMP::corefine_and_compute_difference(result, text_mesh_complete, result); + + if (!OK) + { + QApplication::restoreOverrideCursor(); + messages->information("Error: the output mesh is not manifold!"); + return; + } CGAL::Polygon_mesh_processing::triangulate_faces(result); Scene_surface_mesh_item* result_item = new Scene_surface_mesh_item( From 6e060e499df62f7421c021b4998219aa00ed72bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 20 Aug 2018 13:36:53 +0200 Subject: [PATCH 016/193] no need for Mesh_2 --- .../Plugins/PMP/Engrave_text_plugin.cpp | 36 ++++--------------- 1 file changed, 7 insertions(+), 29 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp index fa7ab190e7d..6befbf2be8a 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp @@ -24,10 +24,7 @@ #include #include #include -#include -#include -#include -#include +#include #include #include @@ -98,14 +95,12 @@ struct Top }; typedef EPICK Gt; -typedef CGAL::Delaunay_mesh_vertex_base_2 Vb; -typedef CGAL::Delaunay_mesh_face_base_2 Fm; -typedef CGAL::Triangulation_face_base_with_info_2 Fb; +typedef CGAL::Triangulation_vertex_base_2 Vb; +typedef CGAL::Triangulation_face_base_with_info_2 Fbb; +typedef CGAL::Constrained_triangulation_face_base_2 Fb; typedef CGAL::Triangulation_data_structure_2 TDS; typedef CGAL::No_intersection_tag Tag; typedef CGAL::Constrained_Delaunay_triangulation_2 CDT; -typedef CGAL::Delaunay_mesh_size_criteria_2 Criteria; -typedef CGAL::Delaunay_mesher_2 Mesher; //Parameterization and text displaying class ParamItem : public QGraphicsItem @@ -636,25 +631,8 @@ public Q_SLOTS: { bbox += CGAL::bbox_2(points.begin(), points.end(), EPICK()); } - float diag = CGAL::sqrt( - (bbox.xmax()-bbox.xmin())*(bbox.xmax()-bbox.xmin()) - +(bbox.ymax()-bbox.ymin())*(bbox.ymax()-bbox.ymin()) - ); - // start by marking the domain to mesh - Criteria criteria(0.125, 0.05 * diag); - Mesher mesher(cdt, criteria); - mark_nested_domains(cdt); - for(typename CDT::All_faces_iterator fit=cdt.all_faces_begin(), - fit_end=cdt.all_faces_end(); - fit!=fit_end;++fit) - { - fit->set_in_domain(fit->info().in_domain()); - } - mesher.init(true); - - - mesher.refine_mesh(); + SMesh text_mesh_bottom, text_mesh_complete; cdt2_to_face_graph(cdt, text_mesh_bottom); @@ -700,7 +678,7 @@ public Q_SLOTS: messages->information("Error: the output mesh is not manifold!"); return; } - + CGAL::Polygon_mesh_processing::triangulate_faces(result); Scene_surface_mesh_item* result_item = new Scene_surface_mesh_item( result); @@ -780,7 +758,7 @@ private: fit_end=cdt.finite_faces_end(); fit!=fit_end; ++fit) { - if (!fit->is_in_domain()) continue; + if (!fit->info().in_domain()) continue; CGAL::cpp11::array vds; for(int i=0; i<3; ++i) { From da57904ccdd4877368ce073f545224f1f058f042 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 20 Aug 2018 13:40:06 +0200 Subject: [PATCH 017/193] remove trailing whitespaces --- .../Plugins/PMP/Engrave_text_plugin.cpp | 126 +++++++++--------- 1 file changed, 63 insertions(+), 63 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp index 6befbf2be8a..541a82d9d30 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp @@ -76,7 +76,7 @@ struct Bot double d; const EPICK::Vector_3& n; MAP map; - + }; template @@ -84,7 +84,7 @@ struct Top { Top(const EPICK::Vector_3& n, MAP map):n(n),map(map){} - + template void operator()(const T&, VD vd) const { @@ -118,19 +118,19 @@ public : polylines(polylines), graph(graph), transfo(transfo){} - + ~ParamItem() { delete component; } - + QRectF boundingRect() const { return bounding_rect; } - + void set_transfo(EPICK::Aff_transformation_2 t){ transfo = t;} - + void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) { QPen pen; @@ -158,7 +158,7 @@ public : points[2] = QPointF(get(uv, h).first, -get(uv, h).second); painter->drawPolygon(points,3); } - + pen.setColor(Qt::red); pen.setWidth(0); painter->setPen(pen); @@ -169,13 +169,13 @@ public : for(std::size_t j =0; jdrawPolyline(points.data(), points.size()); } } - + private: QString texMesh_name; QRectF bounding_rect; @@ -192,7 +192,7 @@ public: :CGAL::Qt::GraphicsViewNavigation(), prev_pos(QPoint(0,0)) { } - + protected: bool eventFilter(QObject *obj, QEvent *ev) { @@ -215,14 +215,14 @@ protected: { qreal dir[2] = {v->mapToScene(me->pos()).x() - prev_pos.x(), v->mapToScene(me->pos()).y() - prev_pos.y()}; - + v->translate(dir[0],dir[1]); v->update(); } prev_pos = v->mapToScene(me->pos()); break; } - + case QEvent::MouseButtonPress: { is_dragging = true; break; @@ -244,7 +244,7 @@ protected: v->update(); break; } - + case QEvent::MouseButtonDblClick: { v->fitInView(v->scene()->itemsBoundingRect(), Qt::KeepAspectRatio); break; @@ -279,7 +279,7 @@ class Q_DECL_EXPORT Engrave_text_plugin : Q_OBJECT Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") - + private: typedef CGAL::Surface_mesh_shortest_path_traits SP_traits; typedef CGAL::Surface_mesh_shortest_path Surface_mesh_shortest_path; @@ -289,9 +289,9 @@ private: typedef CGAL::AABB_tree Tree; typedef EPICK::Point_3 Point_3; Messages_interface* messages; - + public : - + void init(QMainWindow* , CGAL::Three::Scene_interface* , Messages_interface* m) Q_DECL_OVERRIDE{ //get refs this->scene = Three::scene(); @@ -311,17 +311,17 @@ public : this, &Engrave_text_plugin::visualize); connect(dock_widget->engraveButton, &QPushButton::clicked, this, &Engrave_text_plugin::engrave); - + //items visu_item = nullptr; sel_item = nullptr; sm = nullptr; - + //transfo angle = 0.0; scalX=1.0; scalY=1.0; - translation = EPICK::Vector_2(0,0); + translation = EPICK::Vector_2(0,0); connect(dock_widget->scalX_slider, &QSlider::valueChanged, this, [this](){ scalX = dock_widget->scalX_slider->value()/1000.0; @@ -338,28 +338,28 @@ public : this, [this](){ cleanup(); }); - + connect(dock_widget->t_up_pushButton, &QPushButton::clicked, this, [this](){ translation += EPICK::Vector_2(0,0.005); scene->setSelectedItem(scene->item_id(sel_item)); visualize(); }); - + connect(dock_widget->t_down_pushButton, &QPushButton::clicked, this, [this](){ translation -= EPICK::Vector_2(0,0.005); scene->setSelectedItem(scene->item_id(sel_item)); visualize(); }); - + connect(dock_widget->t_right_pushButton, &QPushButton::clicked, this, [this](){ translation += EPICK::Vector_2(0.005,0); scene->setSelectedItem(scene->item_id(sel_item)); visualize(); }); - + connect(dock_widget->t_left_pushButton, &QPushButton::clicked, this, [this](){ translation -= EPICK::Vector_2(0.005,0); @@ -392,10 +392,10 @@ public Q_SLOTS: { dock_widget->setVisible(!dock_widget->isVisible()); } - + void visualize() { if(!sel_item) - sel_item = + sel_item = qobject_cast (scene->item(scene->mainSelectionIndex())); if(!sel_item) @@ -413,7 +413,7 @@ public Q_SLOTS: if(visu_item) scene->erase(scene->item_id(visu_item)); visu_item = nullptr; - + if(!sm) { sm = new SMesh(); @@ -422,21 +422,21 @@ public Q_SLOTS: CGAL::Polygon_mesh_processing::longest_border(*sm).first; SMesh::Property_map uv_map = sm->add_property_map("v:uv").first; - + // Parameterized bool pmap boost::unordered_set vs; SMP::internal::Bool_property_map< boost::unordered_set > vpm(vs); - + // Parameterizer SMP::ARAP_parameterizer_3 parameterizer; - + SMP::Error_code status = parameterizer.parameterize(*sm, hd, uv_map, get(boost::vertex_index, *sm), vpm); if(status != SMP::OK) { std::cout << "Encountered a problem: " << status << std::endl; cleanup(); return ; } - + std::cout << "Parameterized with ARAP (SM) computed." << std::endl; xmin = std::numeric_limits::max(); xmax = std::numeric_limits::min(); @@ -452,14 +452,14 @@ public Q_SLOTS: xmax = uv_map[v][0]; if(uv_map[v][0] < xmin) xmin = uv_map[v][0]; - + if(uv_map[v][1] > ymax) ymax = uv_map[v][1]; if(uv_map[v][1] < ymin) ymin = uv_map[v][1]; } - - + + } //create Text Polyline QPainterPath path; @@ -470,7 +470,7 @@ public Q_SLOTS: polylines.clear(); float pxmin(8000),pxmax(-8000), pymin(8000), pymax(-8000); - + Q_FOREACH(QPolygonF poly, polys){ Q_FOREACH(QPointF pf, poly) { @@ -493,7 +493,7 @@ public Q_SLOTS: { EPICK::Point_2 v = EPICK::Point_2(pf.x(),-pf.y()); polylines.back().push_back(EPICK::Point_2(v.x()*(xmax-xmin)/(pxmax-pxmin) +xmin , - v.y()*(ymax-ymin)/(pymax-pymin)+ymin + v.y()*(ymax-ymin)/(pymax-pymin)+ymin )); } } @@ -502,29 +502,29 @@ public Q_SLOTS: { EPICK::Aff_transformation_2 rota = EPICK::Aff_transformation_2(CGAL::TRANSLATION, EPICK::Vector_2((pxmax+pxmin)/2, (pymax+pymin)/2)) - * EPICK::Aff_transformation_2(CGAL::ROTATION,1,0) + * EPICK::Aff_transformation_2(CGAL::ROTATION,1,0) * EPICK::Aff_transformation_2(CGAL::TRANSLATION, EPICK::Vector_2(-(pxmax+pxmin)/2, -(pymax+pymin)/2)); - + Q_FOREACH(QPolygonF poly, polys){ polylines.push_back(std::vector()); Q_FOREACH(QPointF pf, poly) { EPICK::Point_2 v = rota.transform(EPICK::Point_2(pf.x(),-pf.y())); polylines.back().push_back(EPICK::Point_2(v.x()*(xmax-xmin)/(pxmax-pxmin) +xmin , - v.y()*(ymax-ymin)/(pymax-pymin)+ymin + v.y()*(ymax-ymin)/(pymax-pymin)+ymin )); } } } // build AABB-tree for face location queries Tree aabb_tree(faces(*sm).first, faces(*sm).second, *sm, uv_map_3); - + visu_item = new Scene_polylines_item; - - + + // compute 3D coordinates - transfo = + transfo = EPICK::Aff_transformation_2(CGAL::TRANSLATION, EPICK::Vector_2((xmax-xmin)/2+xmin, (ymax-ymin)/2+ymin)+ translation) * EPICK::Aff_transformation_2(CGAL::ROTATION,sin(angle), cos(angle)) @@ -537,7 +537,7 @@ public Q_SLOTS: BOOST_FOREACH(const EPICK::Point_2& p, polyline) { EPICK::Point_2 p_2 = transfo.transform(p); - + Face_location loc = Surface_mesh_shortest_path::locate( Point_3(p_2.x(), p_2.y(), 0), aabb_tree, *sm, uv_map_3); @@ -549,7 +549,7 @@ public Q_SLOTS: visu_item->setColor(QColor(Qt::red)); scene->addItem(visu_item); dock_widget->engraveButton->setEnabled(true); - + if(graphics_scene->items().empty()) { Component* component = new Component(); @@ -575,10 +575,10 @@ public Q_SLOTS: EPICK::FT v = uv_map[target(hd, *sm)].y(); put(uv, *it, std::make_pair(static_cast(u),static_cast(v))); } - + //ParamItem does not take ownership of text_mesh_bottom ParamItem *param_item= new ParamItem(component, polylines, transfo, sm, - QRectF(QPointF(xmin, -ymax), QPointF(xmax, -ymin))); + QRectF(QPointF(xmin, -ymax), QPointF(xmax, -ymin))); graphics_scene->addItem(param_item); dock_widget->graphicsView->fitInView(param_item->boundingRect(), Qt::KeepAspectRatio); } @@ -591,7 +591,7 @@ public Q_SLOTS: } // dock_widget->visualizeButton->setEnabled(false); } - + void engrave() { if(!visu_item) return; @@ -619,7 +619,7 @@ public Q_SLOTS: { QApplication::restoreOverrideCursor(); throw; - } + } if (cdt.dimension()!=2){ QApplication::restoreOverrideCursor(); std::cout << "Triangulation is not of dimension 2" << std::endl; @@ -645,7 +645,7 @@ public Q_SLOTS: normal/=CGAL::sqrt(normal.squared_length()); while(normal == EPICK::Vector_3(0,0,0)) { - QDialog dialog; + QDialog dialog; QLayout *layout = dialog.layout(); QDoubleSpinBox xbox, ybox, zbox; layout->addWidget(&xbox); @@ -653,14 +653,14 @@ public Q_SLOTS: layout->addWidget(&zbox); dialog.setLayout(layout); dialog.exec(); - normal = EPICK::Vector_3(xbox.value(), + normal = EPICK::Vector_3(xbox.value(), ybox.value(), zbox.value()); } Bot bot(normal, dock_widget->depth_spinBox->value(),get(CGAL::vertex_point, text_mesh_complete)); Top top(normal, get(CGAL::vertex_point, text_mesh_complete)); PMP::extrude_mesh(text_mesh_bottom, text_mesh_complete, bot, top); - + if (PMP::does_self_intersect(text_mesh_complete)) { QApplication::restoreOverrideCursor(); @@ -694,7 +694,7 @@ public Q_SLOTS: dock_widget->hide(); } private: - + template void mark_domains(CDT& ct, @@ -723,8 +723,8 @@ private: } } } - - + + template void mark_nested_domains(CDT& cdt) @@ -743,15 +743,15 @@ private: } } } - + template - void cdt2_to_face_graph(const CDT& cdt, + void cdt2_to_face_graph(const CDT& cdt, TriangleMesh& tm) { - + Tree aabb_tree(faces(*sm).first, faces(*sm).second, *sm, uv_map_3); typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; - + typedef std::map Map; Map descriptors; for (typename CDT::Finite_faces_iterator fit=cdt.finite_faces_begin(), @@ -775,11 +775,11 @@ private: } vds[i]=it->second; } - + CGAL::Euler::add_face(vds, tm); } } - + void cleanup() { dock_widget->scalX_slider->setValue(1000); @@ -804,7 +804,7 @@ private: visu_item = nullptr; } } - + QList _actions; EngraveWidget* dock_widget; Scene_polylines_item* visu_item; @@ -818,9 +818,9 @@ private: SMesh::Property_map uv_map_3; SMesh* sm; float xmin, xmax, ymin, ymax; - + QGraphicsScene *graphics_scene; Navigation* navigation; -}; +}; #include "Engrave_text_plugin.moc" From a5dd34acf4d8e1122915f1a086e734b4c0c38c21 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 22 Aug 2018 10:29:23 +0200 Subject: [PATCH 018/193] Use one normal per vertex for extrusion --- .../Plugins/PMP/Engrave_text_plugin.cpp | 76 +++++++++---------- 1 file changed, 36 insertions(+), 40 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp index 541a82d9d30..60e15bdfeea 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp @@ -60,38 +60,44 @@ struct FaceInfo2 } }; -template +template struct Bot { - Bot(const EPICK::Vector_3& n, + Bot(NMAP nmap, double d, - MAP map):d(d), - n(n), - map(map){} + PMAP pmap):d(d), + pmap(pmap), + nmap(nmap){} template - void operator()(const T&,VD vd) const + void operator()(const T& v1,VD v2) const { - put(map, vd, get(map, vd)-d*n); + put(pmap, v2, get(pmap, v2)-d*get(nmap, v1)); } double d; - const EPICK::Vector_3& n; - MAP map; + PMAP pmap; + NMAP nmap; }; -template +template struct Top { - Top(const EPICK::Vector_3& n, - MAP map):n(n),map(map){} + Top(NMAP nmap, + PMAP pmap, + double d):d(d), + nmap(nmap), + pmap(pmap){} template - void operator()(const T&, VD vd) const + void operator()(const T& v1, VD v2) const { - put(map, vd, get(map, vd)+0.01*n); + put(pmap, v2, get(pmap, v2)+(std::min)(0.01, d)*get(nmap, v1)); } - const EPICK::Vector_3& n; - MAP map; + double d; + NMAP nmap; + PMAP pmap; }; typedef EPICK Gt; @@ -636,31 +642,21 @@ public Q_SLOTS: SMesh text_mesh_bottom, text_mesh_complete; cdt2_to_face_graph(cdt, text_mesh_bottom); - typedef typename boost::property_map::type VPMap; - EPICK::Vector_3 normal(0,0,0); - BOOST_FOREACH(face_descriptor f, sel_item->selected_facets) - { - normal += CGAL::Polygon_mesh_processing::compute_face_normal(f, *sel_item->polyhedron()); - } - normal/=CGAL::sqrt(normal.squared_length()); - while(normal == EPICK::Vector_3(0,0,0)) - { - QDialog dialog; - QLayout *layout = dialog.layout(); - QDoubleSpinBox xbox, ybox, zbox; - layout->addWidget(&xbox); - layout->addWidget(&ybox); - layout->addWidget(&zbox); - dialog.setLayout(layout); - dialog.exec(); - normal = EPICK::Vector_3(xbox.value(), - ybox.value(), - zbox.value()); - } - Bot bot(normal, dock_widget->depth_spinBox->value(),get(CGAL::vertex_point, text_mesh_complete)); - Top top(normal, get(CGAL::vertex_point, text_mesh_complete)); + typedef boost::property_map::type VPMap; + typedef SMesh::Property_map NPMAP; + NPMAP vnormals = + text_mesh_bottom.add_property_map("v:normal").first; + + + CGAL::Polygon_mesh_processing::compute_vertex_normals(text_mesh_bottom, vnormals); + + + Bot bot(vnormals, dock_widget->depth_spinBox->value(), + get(CGAL::vertex_point, text_mesh_complete)); + Top top(vnormals, get(CGAL::vertex_point, text_mesh_complete), + dock_widget->depth_spinBox->value()); PMP::extrude_mesh(text_mesh_bottom, text_mesh_complete, bot, top); - if (PMP::does_self_intersect(text_mesh_complete)) { QApplication::restoreOverrideCursor(); From ca2fa5e4215b6046e47ed9ff8437c55102eb55e2 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 22 Aug 2018 12:04:36 +0200 Subject: [PATCH 019/193] Fix transformation of polylines and add option to generate text_mesh_item. --- .../Plugins/PMP/Engrave_dock_widget.ui | 10 + .../Plugins/PMP/Engrave_text_plugin.cpp | 199 +++++++++++------- 2 files changed, 128 insertions(+), 81 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui index b25fd5b6328..c848d03e71d 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui @@ -56,6 +56,16 @@ + + + + false + + + Generate Text Mesh + + + diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp index 60e15bdfeea..bb0cb7610cd 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp @@ -68,7 +68,7 @@ struct Bot double d, PMAP pmap):d(d), pmap(pmap), - nmap(nmap){} + nmap(nmap){} template void operator()(const T& v1,VD v2) const { @@ -77,7 +77,7 @@ struct Bot double d; PMAP pmap; NMAP nmap; - + }; template void operator()(const T& v1, VD v2) const { @@ -124,19 +124,19 @@ public : polylines(polylines), graph(graph), transfo(transfo){} - + ~ParamItem() { delete component; } - + QRectF boundingRect() const { return bounding_rect; } - + void set_transfo(EPICK::Aff_transformation_2 t){ transfo = t;} - + void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) { QPen pen; @@ -148,7 +148,8 @@ public : painter->setPen(pen); painter->setBrush(brush); SMesh::Property_map > uv; - uv = graph->add_property_map >("h:uv",std::make_pair(0.0f,0.0f)).first; + uv = graph->add_property_map > + ("h:uv",std::make_pair(0.0f,0.0f)).first; for( Component::iterator fi = component->begin(); fi != component->end(); @@ -164,7 +165,7 @@ public : points[2] = QPointF(get(uv, h).first, -get(uv, h).second); painter->drawPolygon(points,3); } - + pen.setColor(Qt::red); pen.setWidth(0); painter->setPen(pen); @@ -181,7 +182,7 @@ public : painter->drawPolyline(points.data(), points.size()); } } - + private: QString texMesh_name; QRectF bounding_rect; @@ -198,7 +199,7 @@ public: :CGAL::Qt::GraphicsViewNavigation(), prev_pos(QPoint(0,0)) { } - + protected: bool eventFilter(QObject *obj, QEvent *ev) { @@ -221,14 +222,14 @@ protected: { qreal dir[2] = {v->mapToScene(me->pos()).x() - prev_pos.x(), v->mapToScene(me->pos()).y() - prev_pos.y()}; - + v->translate(dir[0],dir[1]); v->update(); } prev_pos = v->mapToScene(me->pos()); break; } - + case QEvent::MouseButtonPress: { is_dragging = true; break; @@ -250,7 +251,7 @@ protected: v->update(); break; } - + case QEvent::MouseButtonDblClick: { v->fitInView(v->scene()->itemsBoundingRect(), Qt::KeepAspectRatio); break; @@ -285,7 +286,7 @@ class Q_DECL_EXPORT Engrave_text_plugin : Q_OBJECT Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") - + private: typedef CGAL::Surface_mesh_shortest_path_traits SP_traits; typedef CGAL::Surface_mesh_shortest_path Surface_mesh_shortest_path; @@ -295,15 +296,17 @@ private: typedef CGAL::AABB_tree Tree; typedef EPICK::Point_3 Point_3; Messages_interface* messages; - + public : - - void init(QMainWindow* , CGAL::Three::Scene_interface* , Messages_interface* m) Q_DECL_OVERRIDE{ + + void init(QMainWindow*, + CGAL::Three::Scene_interface*, + Messages_interface* m) Q_DECL_OVERRIDE{ //get refs this->scene = Three::scene(); this->mw = Three::mainWindow(); messages = m; - + //action QAction* actionFitText= new QAction("Fit Text", mw); connect(actionFitText, SIGNAL(triggered()), @@ -317,12 +320,14 @@ public : this, &Engrave_text_plugin::visualize); connect(dock_widget->engraveButton, &QPushButton::clicked, this, &Engrave_text_plugin::engrave); - + connect(dock_widget->text_meshButton, &QPushButton::clicked, + this, &Engrave_text_plugin::generateTextItem); + //items visu_item = nullptr; sel_item = nullptr; sm = nullptr; - + //transfo angle = 0.0; scalX=1.0; @@ -344,28 +349,28 @@ public : this, [this](){ cleanup(); }); - + connect(dock_widget->t_up_pushButton, &QPushButton::clicked, this, [this](){ translation += EPICK::Vector_2(0,0.005); scene->setSelectedItem(scene->item_id(sel_item)); visualize(); }); - + connect(dock_widget->t_down_pushButton, &QPushButton::clicked, this, [this](){ translation -= EPICK::Vector_2(0,0.005); scene->setSelectedItem(scene->item_id(sel_item)); visualize(); }); - + connect(dock_widget->t_right_pushButton, &QPushButton::clicked, this, [this](){ translation += EPICK::Vector_2(0.005,0); scene->setSelectedItem(scene->item_id(sel_item)); visualize(); }); - + connect(dock_widget->t_left_pushButton, &QPushButton::clicked, this, [this](){ translation -= EPICK::Vector_2(0.005,0); @@ -398,7 +403,7 @@ public Q_SLOTS: { dock_widget->setVisible(!dock_widget->isVisible()); } - + void visualize() { if(!sel_item) sel_item = @@ -419,7 +424,7 @@ public Q_SLOTS: if(visu_item) scene->erase(scene->item_id(visu_item)); visu_item = nullptr; - + if(!sm) { sm = new SMesh(); @@ -428,21 +433,22 @@ public Q_SLOTS: CGAL::Polygon_mesh_processing::longest_border(*sm).first; SMesh::Property_map uv_map = sm->add_property_map("v:uv").first; - + // Parameterized bool pmap boost::unordered_set vs; SMP::internal::Bool_property_map< boost::unordered_set > vpm(vs); - + // Parameterizer SMP::ARAP_parameterizer_3 parameterizer; - - SMP::Error_code status = parameterizer.parameterize(*sm, hd, uv_map, get(boost::vertex_index, *sm), vpm); + + SMP::Error_code status = parameterizer.parameterize(*sm, hd, uv_map, + get(boost::vertex_index, *sm), vpm); if(status != SMP::OK) { std::cout << "Encountered a problem: " << status << std::endl; cleanup(); return ; } - + std::cout << "Parameterized with ARAP (SM) computed." << std::endl; xmin = std::numeric_limits::max(); xmax = std::numeric_limits::min(); @@ -458,25 +464,25 @@ public Q_SLOTS: xmax = uv_map[v][0]; if(uv_map[v][0] < xmin) xmin = uv_map[v][0]; - + if(uv_map[v][1] > ymax) ymax = uv_map[v][1]; if(uv_map[v][1] < ymin) ymin = uv_map[v][1]; } - - + + } //create Text Polyline QPainterPath path; QFont font; font.setPointSize(15); - path.addText(QPoint(xmin,ymin), font, dock_widget->lineEdit->text()); + path.addText(QPoint(xmin,ymin), font, dock_widget->lineEdit->text()); QList polys = path.toSubpathPolygons(); polylines.clear(); float pxmin(8000),pxmax(-8000), pymin(8000), pymax(-8000); - + Q_FOREACH(QPolygonF poly, polys){ Q_FOREACH(QPointF pf, poly) { @@ -498,7 +504,7 @@ public Q_SLOTS: Q_FOREACH(QPointF pf, poly) { EPICK::Point_2 v = EPICK::Point_2(pf.x(),-pf.y()); - polylines.back().push_back(EPICK::Point_2(v.x()*(xmax-xmin)/(pxmax-pxmin) +xmin , + polylines.back().push_back(EPICK::Point_2(v.x()*(xmax-xmin)/(pxmax-pxmin) +xmin, v.y()*(ymax-ymin)/(pymax-pymin)+ymin )); } @@ -506,12 +512,13 @@ public Q_SLOTS: } else { - EPICK::Aff_transformation_2 rota = EPICK::Aff_transformation_2(CGAL::TRANSLATION, EPICK::Vector_2((pxmax+pxmin)/2, - (pymax+pymin)/2)) - * EPICK::Aff_transformation_2(CGAL::ROTATION,1,0) - * EPICK::Aff_transformation_2(CGAL::TRANSLATION, EPICK::Vector_2(-(pxmax+pxmin)/2, - -(pymax+pymin)/2)); - + EPICK::Aff_transformation_2 rota = + EPICK::Aff_transformation_2(CGAL::TRANSLATION, EPICK::Vector_2((pxmax+pxmin)/2, + (pymax+pymin)/2)) + * EPICK::Aff_transformation_2(CGAL::ROTATION,1,0) + * EPICK::Aff_transformation_2(CGAL::TRANSLATION, EPICK::Vector_2(-(pxmax+pxmin)/2, + -(pymax+pymin)/2)); + Q_FOREACH(QPolygonF poly, polys){ polylines.push_back(std::vector()); Q_FOREACH(QPointF pf, poly) @@ -525,25 +532,27 @@ public Q_SLOTS: } // build AABB-tree for face location queries Tree aabb_tree(faces(*sm).first, faces(*sm).second, *sm, uv_map_3); - + visu_item = new Scene_polylines_item; - - + + // compute 3D coordinates transfo = - EPICK::Aff_transformation_2(CGAL::TRANSLATION, EPICK::Vector_2((xmax-xmin)/2+xmin, - (ymax-ymin)/2+ymin)+ translation) + EPICK::Aff_transformation_2(CGAL::TRANSLATION, + EPICK::Vector_2((xmax-xmin)/2+xmin, + (ymax-ymin)/2+ymin)+ translation) * EPICK::Aff_transformation_2(CGAL::ROTATION,sin(angle), cos(angle)) * EPICK::Aff_transformation_2(scalX, 0.0,0.0,scalY) - * EPICK::Aff_transformation_2(CGAL::TRANSLATION, EPICK::Vector_2(-(xmax-xmin)/2-xmin, - -(ymax-ymin)/2-ymin)); + * EPICK::Aff_transformation_2(CGAL::TRANSLATION, + EPICK::Vector_2(-(xmax-xmin)/2-xmin, + -(ymax-ymin)/2-ymin)); BOOST_FOREACH(const std::vector& polyline, polylines) { visu_item->polylines.push_back(std::vector()); BOOST_FOREACH(const EPICK::Point_2& p, polyline) { EPICK::Point_2 p_2 = transfo.transform(p); - + Face_location loc = Surface_mesh_shortest_path::locate( Point_3(p_2.x(), p_2.y(), 0), aabb_tree, *sm, uv_map_3); @@ -555,7 +564,8 @@ public Q_SLOTS: visu_item->setColor(QColor(Qt::red)); scene->addItem(visu_item); dock_widget->engraveButton->setEnabled(true); - + dock_widget->text_meshButton->setEnabled(true); + if(graphics_scene->items().empty()) { Component* component = new Component(); @@ -581,7 +591,7 @@ public Q_SLOTS: EPICK::FT v = uv_map[target(hd, *sm)].y(); put(uv, *it, std::make_pair(static_cast(u),static_cast(v))); } - + //ParamItem does not take ownership of text_mesh_bottom ParamItem *param_item= new ParamItem(component, polylines, transfo, sm, QRectF(QPointF(xmin, -ymax), QPointF(xmax, -ymin))); @@ -597,8 +607,9 @@ public Q_SLOTS: } // dock_widget->visualizeButton->setEnabled(false); } - - void engrave() { + + void create_text_mesh(SMesh& text_mesh) + { if(!visu_item) return; if(!sel_item) @@ -607,13 +618,15 @@ public Q_SLOTS: return; if(!CGAL::is_closed(*sel_item->polyhedron())) return; - QApplication::setOverrideCursor(Qt::WaitCursor); CDT cdt; + //polylines is duplicated so the transformation is only performed once + std::vector > local_polylines + = polylines; try{ for(std::size_t i = 0; - i < polylines.size(); ++i) + i < local_polylines.size(); ++i) { - std::vector& points = polylines[i]; + std::vector& points = local_polylines[i]; for(std::size_t j = 0; j< points.size(); ++j) { Point_2 &p = points[j]; @@ -631,15 +644,17 @@ public Q_SLOTS: std::cout << "Triangulation is not of dimension 2" << std::endl; return; } - CGAL::Bbox_2 bbox= CGAL::bbox_2(polylines.front().begin(), polylines.front().end(), EPICK()); + CGAL::Bbox_2 bbox= CGAL::bbox_2(local_polylines.front().begin(), + local_polylines.front().end(), + EPICK()); Q_FOREACH(const std::vector& points, - polylines) + local_polylines) { bbox += CGAL::bbox_2(points.begin(), points.end(), EPICK()); } mark_nested_domains(cdt); - - SMesh text_mesh_bottom, text_mesh_complete; + + SMesh text_mesh_bottom; cdt2_to_face_graph(cdt, text_mesh_bottom); typedef boost::property_map::type VPMap; @@ -653,28 +668,35 @@ public Q_SLOTS: Bot bot(vnormals, dock_widget->depth_spinBox->value(), - get(CGAL::vertex_point, text_mesh_complete)); - Top top(vnormals, get(CGAL::vertex_point, text_mesh_complete), + get(CGAL::vertex_point, text_mesh)); + Top top(vnormals, get(CGAL::vertex_point, text_mesh), dock_widget->depth_spinBox->value()); - PMP::extrude_mesh(text_mesh_bottom, text_mesh_complete, bot, top); + PMP::extrude_mesh(text_mesh_bottom, text_mesh, bot, top); + } + + void engrave() { + QApplication::setOverrideCursor(Qt::WaitCursor); + SMesh text_mesh_complete; + create_text_mesh(text_mesh_complete); + if (PMP::does_self_intersect(text_mesh_complete)) { QApplication::restoreOverrideCursor(); messages->information("Error: text mesh self-intersects!"); return; } - + SMesh result; CGAL::copy_face_graph(*sel_item->polyhedron(), result); bool OK = PMP::corefine_and_compute_difference(result, text_mesh_complete, result); - + if (!OK) { QApplication::restoreOverrideCursor(); messages->information("Error: the output mesh is not manifold!"); return; } - + CGAL::Polygon_mesh_processing::triangulate_faces(result); Scene_surface_mesh_item* result_item = new Scene_surface_mesh_item( result); @@ -683,14 +705,27 @@ public Q_SLOTS: cleanup(); QApplication::restoreOverrideCursor(); dock_widget->engraveButton->setEnabled(false); + dock_widget->text_meshButton->setEnabled(false); dock_widget->visualizeButton->setEnabled(true); } + + void generateTextItem() + { + QApplication::setOverrideCursor(Qt::WaitCursor); + SMesh text_mesh; + create_text_mesh(text_mesh); + Scene_surface_mesh_item* textMesh = new Scene_surface_mesh_item(text_mesh); + textMesh->setName("Extruded Text"); + scene->addItem(textMesh); + QApplication::restoreOverrideCursor(); + } + void closure()Q_DECL_OVERRIDE { dock_widget->hide(); } + private: - template void mark_domains(CDT& ct, @@ -719,13 +754,14 @@ private: } } } - - + + template void mark_nested_domains(CDT& cdt) { - for(typename CDT::All_faces_iterator it = cdt.all_faces_begin(); it != cdt.all_faces_end(); ++it){ + for(typename CDT::All_faces_iterator it = cdt.all_faces_begin(); it != + cdt.all_faces_end(); ++it){ it->info().nesting_level = -1; } std::list border; @@ -739,15 +775,15 @@ private: } } } - + template void cdt2_to_face_graph(const CDT& cdt, TriangleMesh& tm) { - + Tree aabb_tree(faces(*sm).first, faces(*sm).second, *sm, uv_map_3); typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; - + typedef std::map Map; Map descriptors; for (typename CDT::Finite_faces_iterator fit=cdt.finite_faces_begin(), @@ -767,15 +803,16 @@ private: Face_location loc = Surface_mesh_shortest_path::locate( Point_3(pt.x(), pt.y(), 0), aabb_tree, *sm, uv_map_3); - it->second = add_vertex(Surface_mesh_shortest_path::point(loc.first, loc.second, *sm, sm->points()), tm); + it->second = add_vertex(Surface_mesh_shortest_path::point(loc.first, loc.second, + *sm, sm->points()), tm); } vds[i]=it->second; } - + CGAL::Euler::add_face(vds, tm); } } - + void cleanup() { dock_widget->scalX_slider->setValue(1000); @@ -800,7 +837,7 @@ private: visu_item = nullptr; } } - + QList _actions; EngraveWidget* dock_widget; Scene_polylines_item* visu_item; @@ -814,7 +851,7 @@ private: SMesh::Property_map uv_map_3; SMesh* sm; float xmin, xmax, ymin, ymax; - + QGraphicsScene *graphics_scene; Navigation* navigation; }; From 625b5cb586d862058229fa5ce7ee409e03b9d2a1 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 22 Aug 2018 12:34:07 +0200 Subject: [PATCH 020/193] Edit existing textmesh item if possible. --- .../Plugins/PMP/Engrave_text_plugin.cpp | 29 +++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp index bb0cb7610cd..d8b18c1a5f3 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp @@ -326,6 +326,7 @@ public : //items visu_item = nullptr; sel_item = nullptr; + textMesh = nullptr; sm = nullptr; //transfo @@ -703,6 +704,10 @@ public Q_SLOTS: scene->addItem(result_item); graphics_scene->clear(); cleanup(); + if(textMesh) + { + textMesh->setVisible(false); + } QApplication::restoreOverrideCursor(); dock_widget->engraveButton->setEnabled(false); dock_widget->text_meshButton->setEnabled(false); @@ -712,11 +717,24 @@ public Q_SLOTS: void generateTextItem() { QApplication::setOverrideCursor(Qt::WaitCursor); - SMesh text_mesh; - create_text_mesh(text_mesh); - Scene_surface_mesh_item* textMesh = new Scene_surface_mesh_item(text_mesh); - textMesh->setName("Extruded Text"); - scene->addItem(textMesh); + + if(textMesh) + { + textMesh->face_graph()->clear(); + create_text_mesh(*textMesh->face_graph()); + textMesh->invalidateOpenGLBuffers(); + } + else + { + SMesh text_mesh; + create_text_mesh(text_mesh); + textMesh = new Scene_surface_mesh_item(text_mesh); + connect(textMesh, &Scene_surface_mesh_item::aboutToBeDestroyed, + this, [this](){ + textMesh = nullptr;}); + textMesh->setName("Extruded Text"); + scene->addItem(textMesh); + } QApplication::restoreOverrideCursor(); } @@ -842,6 +860,7 @@ private: EngraveWidget* dock_widget; Scene_polylines_item* visu_item; Scene_polyhedron_selection_item* sel_item; + Scene_surface_mesh_item* textMesh; double angle; double scalX; double scalY; From ebf374970a4eeca0bcbdacd06bcd98094b54a514 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 22 Aug 2018 16:23:53 +0200 Subject: [PATCH 021/193] Enhancements --- .../Plugins/PMP/Engrave_dock_widget.ui | 199 ++++++++++++------ .../Plugins/PMP/Engrave_text_plugin.cpp | 78 ++++--- 2 files changed, 179 insertions(+), 98 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui index c848d03e71d..ca5772821a9 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui @@ -6,23 +6,23 @@ 0 0 - 305 - 421 + 282 + 488 Engraving - - + + An Example Text - + @@ -90,14 +90,7 @@ - - - - Engraving depth: - - - - + -179 @@ -134,7 +127,43 @@ - + + + + + + + + :/cgal/icons/resources/down.png:/cgal/icons/resources/down.png + + + + + + + Scaling factor in X: + + + + + + + + + + + :/cgal/icons/resources/left_arrow.png:/cgal/icons/resources/left_arrow.png + + + + + + + Rotation degree: + + + + 2000 @@ -153,59 +182,7 @@ - - - - - - - - :/cgal/icons/resources/down.png:/cgal/icons/resources/down.png - - - - - - - Scaling factor in X: - - - - - - - - - - - :/cgal/icons/resources/left_arrow.png:/cgal/icons/resources/left_arrow.png - - - - - - - Rotation degree: - - - - - - - 6 - - - 0.000001000000000 - - - 0.100000000000000 - - - 0.010000000000000 - - - - + 2000 @@ -221,18 +198,104 @@ - + Scaling factor in Y: + + + + 1 + + + 15 + + + Qt::Horizontal + + + + + + + Text Precision + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Engraving Depth + + + + + + Inside depth: + + + + + + + Outside depth: + + + + + + + 10000 + + + 1000 + + + Qt::Horizontal + + + + + + + 10000 + + + 1000 + + + Qt::Horizontal + + + + + + + + diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp index d8b18c1a5f3..5c97fd4dcdf 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -93,7 +94,7 @@ struct Top template void operator()(const T& v1, VD v2) const { - put(pmap, v2, get(pmap, v2)+(std::min)(0.01, d)*get(nmap, v1)); + put(pmap, v2, get(pmap, v2)+d*get(nmap, v1)); } double d; NMAP nmap; @@ -334,6 +335,14 @@ public : scalX=1.0; scalY=1.0; translation = EPICK::Vector_2(0,0); + pointsize = 15; + locked = false; + connect(dock_widget->text_prec_slider, &QSlider::valueChanged, + this, [this](){ + pointsize = dock_widget->text_prec_slider->value(); + scene->setSelectedItem(scene->item_id(sel_item)); + visualize(); + }); connect(dock_widget->scalX_slider, &QSlider::valueChanged, this, [this](){ scalX = dock_widget->scalX_slider->value()/1000.0; @@ -346,6 +355,19 @@ public : scene->setSelectedItem(scene->item_id(sel_item)); visualize(); }); + + connect(dock_widget->bot_slider, &QSlider::valueChanged, + this, [this](){ + if(textMesh) + generateTextItem(); + }); + + connect(dock_widget->top_slider, &QSlider::valueChanged, + this, [this](){ + if(textMesh) + generateTextItem(); + }); + connect(dock_widget->reset_button, &QPushButton::clicked, this, [this](){ cleanup(); @@ -381,8 +403,11 @@ public : connect(dock_widget->rot_slider, &QSlider::valueChanged, this, [this](){ angle = dock_widget->rot_slider->value() * CGAL_PI/180.0; - scene->setSelectedItem(scene->item_id(sel_item)); - visualize(); + if(!locked) + { + scene->setSelectedItem(scene->item_id(sel_item)); + visualize(); + } }); graphics_scene = new QGraphicsScene(dock_widget); dock_widget->graphicsView->setScene(graphics_scene); @@ -472,12 +497,25 @@ public Q_SLOTS: ymin = uv_map[v][1]; } + CGAL::linear_least_squares_fitting_2( + uv_map.begin(), + uv_map.end(), + bf_line, + CGAL::Dimension_tag<0>()); + Kernel::Vector_2 A(bf_line.to_vector()), + B(Kernel::Point_2(0,0), + Kernel::Point_2(0,1)); + double cosangle = CGAL::scalar_product(A,B)/CGAL::sqrt(A.squared_length()); + + locked = true; + dock_widget->rot_slider->setSliderPosition(acos(abs(cosangle))*180.0/CGAL_PI); + locked = false; } //create Text Polyline QPainterPath path; QFont font; - font.setPointSize(15); + font.setPointSize(pointsize); path.addText(QPoint(xmin,ymin), font, dock_widget->lineEdit->text()); QList polys = path.toSubpathPolygons(); polylines.clear(); @@ -498,39 +536,17 @@ public Q_SLOTS: pymax = v.y(); } } - if(ymax-ymin <= xmax - xmin) - { Q_FOREACH(QPolygonF poly, polys){ polylines.push_back(std::vector()); Q_FOREACH(QPointF pf, poly) { EPICK::Point_2 v = EPICK::Point_2(pf.x(),-pf.y()); - polylines.back().push_back(EPICK::Point_2(v.x()*(xmax-xmin)/(pxmax-pxmin) +xmin, - v.y()*(ymax-ymin)/(pymax-pymin)+ymin - )); - } - } - } - else - { - EPICK::Aff_transformation_2 rota = - EPICK::Aff_transformation_2(CGAL::TRANSLATION, EPICK::Vector_2((pxmax+pxmin)/2, - (pymax+pymin)/2)) - * EPICK::Aff_transformation_2(CGAL::ROTATION,1,0) - * EPICK::Aff_transformation_2(CGAL::TRANSLATION, EPICK::Vector_2(-(pxmax+pxmin)/2, - -(pymax+pymin)/2)); - - Q_FOREACH(QPolygonF poly, polys){ - polylines.push_back(std::vector()); - Q_FOREACH(QPointF pf, poly) - { - EPICK::Point_2 v = rota.transform(EPICK::Point_2(pf.x(),-pf.y())); polylines.back().push_back(EPICK::Point_2(v.x()*(xmax-xmin)/(pxmax-pxmin) +xmin , v.y()*(ymax-ymin)/(pymax-pymin)+ymin )); } } - } + // build AABB-tree for face location queries Tree aabb_tree(faces(*sm).first, faces(*sm).second, *sm, uv_map_3); @@ -668,10 +684,10 @@ public Q_SLOTS: CGAL::Polygon_mesh_processing::compute_vertex_normals(text_mesh_bottom, vnormals); - Bot bot(vnormals, dock_widget->depth_spinBox->value(), + Bot bot(vnormals, dock_widget->bot_slider->value()/100000.0, get(CGAL::vertex_point, text_mesh)); Top top(vnormals, get(CGAL::vertex_point, text_mesh), - dock_widget->depth_spinBox->value()); + dock_widget->top_slider->value()/100000.0); PMP::extrude_mesh(text_mesh_bottom, text_mesh, bot, top); } @@ -870,7 +886,9 @@ private: SMesh::Property_map uv_map_3; SMesh* sm; float xmin, xmax, ymin, ymax; - + int pointsize; + bool locked; + Kernel::Line_2 bf_line; QGraphicsScene *graphics_scene; Navigation* navigation; }; From adafa919576e1df9cfbdfbedd706b45daaf42a54 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 22 Aug 2018 17:18:18 +0200 Subject: [PATCH 022/193] Add a mode for uniform normals per letter. --- .../Plugins/PMP/Engrave_dock_widget.ui | 39 +++++++++++-------- .../Plugins/PMP/Engrave_text_plugin.cpp | 39 +++++++++++++++++-- 2 files changed, 58 insertions(+), 20 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui index ca5772821a9..a893a256196 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui @@ -6,8 +6,8 @@ 0 0 - 282 - 488 + 293 + 515 @@ -251,20 +251,6 @@ Engraving Depth - - - - Inside depth: - - - - - - - Outside depth: - - - @@ -291,6 +277,27 @@ + + + + Inside depth: + + + + + + + Outside depth: + + + + + + + Uniform letter mode + + + diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp index 5c97fd4dcdf..91c26c38eaa 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp @@ -30,6 +30,8 @@ #include #include +#include + #include #include #include @@ -323,6 +325,8 @@ public : this, &Engrave_text_plugin::engrave); connect(dock_widget->text_meshButton, &QPushButton::clicked, this, &Engrave_text_plugin::generateTextItem); + connect(dock_widget->letter_checkBox, &QCheckBox::toggled, + this, &Engrave_text_plugin::generateTextItem); //items visu_item = nullptr; @@ -680,10 +684,37 @@ public Q_SLOTS: text_mesh_bottom.add_property_map("v:normal").first; - - CGAL::Polygon_mesh_processing::compute_vertex_normals(text_mesh_bottom, vnormals); - - + if(!dock_widget->letter_checkBox->isChecked()) + { + CGAL::Polygon_mesh_processing::compute_vertex_normals(text_mesh_bottom, vnormals); + } + else{ + // \todo Computing normals before the final + // mesh would be better. + + //foreach CC + SMesh::Property_map fcmap = + text_mesh_bottom.add_property_map("f:cc", 0).first; + std::size_t nb_cc = PMP::connected_components(text_mesh_bottom, + fcmap); + for(std::size_t cc = 0; cc fmesh(text_mesh_bottom, + cc, + fcmap); + BOOST_FOREACH(vertex_descriptor vd, vertices(fmesh)) + { + normal += CGAL::Polygon_mesh_processing::compute_vertex_normal(vd, fmesh); + } + normal /= CGAL::sqrt(normal.squared_length()); + BOOST_FOREACH(vertex_descriptor vd, vertices(fmesh)) + { + put(vnormals, vd, normal); + } + } + } Bot bot(vnormals, dock_widget->bot_slider->value()/100000.0, get(CGAL::vertex_point, text_mesh)); Top top(vnormals, get(CGAL::vertex_point, text_mesh), From 9291d7aefbb1df9759b620329e50a4f5d1cf1c54 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 22 Aug 2018 18:26:35 +0200 Subject: [PATCH 023/193] Fix rotation init --- .../Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp index 91c26c38eaa..36e13a32c58 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp @@ -191,6 +191,7 @@ private: QRectF bounding_rect; Component* component; const std::vector >& polylines; + SMesh* graph; EPICK::Aff_transformation_2 transfo; }; @@ -406,9 +407,9 @@ public : }); connect(dock_widget->rot_slider, &QSlider::valueChanged, this, [this](){ - angle = dock_widget->rot_slider->value() * CGAL_PI/180.0; if(!locked) { + angle = dock_widget->rot_slider->value() * CGAL_PI/180.0; scene->setSelectedItem(scene->item_id(sel_item)); visualize(); } @@ -509,11 +510,14 @@ public Q_SLOTS: Kernel::Vector_2 A(bf_line.to_vector()), B(Kernel::Point_2(0,0), - Kernel::Point_2(0,1)); - double cosangle = CGAL::scalar_product(A,B)/CGAL::sqrt(A.squared_length()); + Kernel::Point_2(1,0)); + if (A.x()<0) A=-A; + angle = std::acos(A.x()/CGAL::sqrt(A.squared_length())); + if ( A.y()<0 ) angle+=3*CGAL_PI/2.; + if (angle>2*CGAL_PI) angle-=CGAL_PI; locked = true; - dock_widget->rot_slider->setSliderPosition(acos(abs(cosangle))*180.0/CGAL_PI); + dock_widget->rot_slider->setSliderPosition(angle*180.0/CGAL_PI); locked = false; } //create Text Polyline From 3434244ca5cf55dcdce96f0b24ab185c0af176b1 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Thu, 23 Aug 2018 10:04:45 +0200 Subject: [PATCH 024/193] Fix modulo in init --- Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp index 36e13a32c58..08d6199826d 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp @@ -514,7 +514,7 @@ public Q_SLOTS: if (A.x()<0) A=-A; angle = std::acos(A.x()/CGAL::sqrt(A.squared_length())); if ( A.y()<0 ) angle+=3*CGAL_PI/2.; - if (angle>2*CGAL_PI) angle-=CGAL_PI; + if (angle>2*CGAL_PI) angle-=2*CGAL_PI; locked = true; dock_widget->rot_slider->setSliderPosition(angle*180.0/CGAL_PI); From 345434afe5610bc24feeb60854699d42233d22b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Wed, 3 Oct 2018 15:56:18 +0200 Subject: [PATCH 025/193] Added a comment to clarify some code --- Mesh_3/include/CGAL/Mesh_3/Mesher_level.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Mesh_3/include/CGAL/Mesh_3/Mesher_level.h b/Mesh_3/include/CGAL/Mesh_3/Mesher_level.h index dc629bd5b20..2b5d5506068 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Mesher_level.h +++ b/Mesh_3/include/CGAL/Mesh_3/Mesher_level.h @@ -1042,6 +1042,11 @@ public: { // Lock the element area on the grid Element element = derivd.extract_element_from_container_value(ce); + + // This is safe to do with the concurrent compact container because even if the element `ce` + // gets removed from the TDS at this point, it is not actually deleted in the cells container and + // `ce->vertex(0-3)` still points to a vertex of the vertices container whose `.point()` + // can be safely accessed (even if that vertex has itself also been removed from the TDS). bool locked = derivd.try_lock_element(element, FIRST_GRID_LOCK_RADIUS); if( locked ) From e2b06830307fa7516421d5b198c5a10c1cf98264 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Wed, 3 Oct 2018 15:57:40 +0200 Subject: [PATCH 026/193] Fixed not checking 'hint' validity in the parallel insertion of a range of WPs --- .../include/CGAL/Regular_triangulation_3.h | 77 +++++++++++++++++-- 1 file changed, 71 insertions(+), 6 deletions(-) diff --git a/Triangulation_3/include/CGAL/Regular_triangulation_3.h b/Triangulation_3/include/CGAL/Regular_triangulation_3.h index 8692371ebb2..0f0d27406c3 100644 --- a/Triangulation_3/include/CGAL/Regular_triangulation_3.h +++ b/Triangulation_3/include/CGAL/Regular_triangulation_3.h @@ -1324,14 +1324,48 @@ namespace CGAL { #endif Vertex_handle &hint = m_tls_hint.local(); + for( size_t i_point = r.begin() ; i_point != r.end() ; ++i_point) { bool success = false; const Weighted_point &p = m_points[i_point]; while(!success) { - if (m_rt.try_lock_vertex(hint) && m_rt.try_lock_point(p)) + // The 'hint' is unsafe to use immediately because we are in a regular triangulation, + // and the insertion of a (weighted) point in another thread might have hidden (deleted) + // the hint. +#define CGAL_RT3_IGNORE_TDS_CONCEPT +#ifdef CGAL_RT3_IGNORE_TDS_CONCEPT + if(!m_rt.tds().vertices().is_used(hint)) +#else + if(!m_rt.tds().is_vertex(hint)) +#endif { + hint = m_rt.finite_vertices_begin(); + continue; + } + + // We need to make sure that while are locking the position P1 := hint->point(), 'hint' + // does not get its position changed to P2 != P1. + const Weighted_point hint_point_mem = hint->point(); + + if(m_rt.try_lock_point(hint_point_mem) && m_rt.try_lock_point(p)) + { + // Make sure that the hint is still valid (so that we can safely take hint->cell()) and + // that its position hasn't changed to ensure that we will start the locate from where + // we have locked. +#ifdef CGAL_RT3_IGNORE_TDS_CONCEPT + if(!m_rt.tds().vertices().is_used(hint) || +#else + if(!m_rt.tds().is_vertex(hint) || +#endif + hint->point() != hint_point_mem) + { + hint = m_rt.finite_vertices_begin(); + m_rt.unlock_all_elements(); + continue; + } + bool could_lock_zone; Locate_type lt; int li, lj; @@ -1418,14 +1452,46 @@ namespace CGAL { const Weighted_point &p = m_points[i_point]; while (!success) { - if (m_rt.try_lock_vertex(hint) && m_rt.try_lock_point(p)) + // The 'hint' is unsafe to use immediately because we are in a regular triangulation, + // and the insertion of a (weighted) point in another thread might have hidden (deleted) + // the hint. +#define CGAL_RT3_IGNORE_TDS_CONCEPT +#ifdef CGAL_RT3_IGNORE_TDS_CONCEPT + if(!m_rt.tds().vertices().is_used(hint)) +#else + if(!m_rt.tds().is_vertex(hint)) +#endif { + hint = m_rt.finite_vertices_begin(); + continue; + } + + // We need to make sure that while are locking the position P1 := hint->point(), 'hint' + // does not get its position changed to P2 != P1. + const Weighted_point hint_point_mem = hint->point(); + + if(m_rt.try_lock_point(hint_point_mem) && m_rt.try_lock_point(p)) + { + // Make sure that the hint is still valid (so that we can safely take hint->cell()) and + // that its position hasn't changed to ensure that we will start the locate from where + // we have locked. +#ifdef CGAL_RT3_IGNORE_TDS_CONCEPT + if(!m_rt.tds().vertices().is_used(hint) || +#else + if(!m_rt.tds().is_vertex(hint) || +#endif + hint->point() != hint_point_mem) + { + hint = m_rt.finite_vertices_begin(); + m_rt.unlock_all_elements(); + continue; + } + bool could_lock_zone; Locate_type lt; int li, lj; - Cell_handle c = m_rt.locate(p, lt, li, lj, hint->cell(), - &could_lock_zone); + Cell_handle c = m_rt.locate(p, lt, li, lj, hint->cell(), &could_lock_zone); Vertex_handle v; if (could_lock_zone) v = m_rt.insert(p, lt, c, li, lj, &could_lock_zone); @@ -1504,8 +1570,7 @@ namespace CGAL { bool could_lock_zone, needs_to_be_done_sequentially; do { - needs_to_be_done_sequentially = - !m_rt.remove(v, &could_lock_zone); + needs_to_be_done_sequentially = !m_rt.remove(v, &could_lock_zone); m_rt.unlock_all_elements(); } while (!could_lock_zone); From e1122cef5c33b128ca6e2adbf2316679565c1d4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Wed, 3 Oct 2018 15:58:59 +0200 Subject: [PATCH 027/193] Fixed deadlocks in parallel removal of a range of weighted points --- .../include/CGAL/Regular_triangulation_3.h | 88 +++++++++++++++---- 1 file changed, 72 insertions(+), 16 deletions(-) diff --git a/Triangulation_3/include/CGAL/Regular_triangulation_3.h b/Triangulation_3/include/CGAL/Regular_triangulation_3.h index 0f0d27406c3..3eba767d11c 100644 --- a/Triangulation_3/include/CGAL/Regular_triangulation_3.h +++ b/Triangulation_3/include/CGAL/Regular_triangulation_3.h @@ -2453,40 +2453,96 @@ namespace CGAL { template < class Gt, class Tds, class Lds > bool - Regular_triangulation_3:: - remove(Vertex_handle v, bool *could_lock_zone) + Regular_triangulation_3:: + remove(Vertex_handle v, bool *could_lock_zone) { bool removed = true; // Locking vertex v... - if (!this->try_lock_vertex(v)) + if(!this->try_lock_vertex(v)) { *could_lock_zone = false; } else { - Vertex_handle hint = (v->cell()->vertex(0) == v ? - v->cell()->vertex(1) : v->cell()->vertex(0)); + // Check that the vertex hasn't be deleted from the TDS while we were locking it +#ifdef CGAL_RT3_IGNORE_TDS_CONCEPT + if(!tds().vertices().is_used(v)) +#else + if(!tds().is_vertex(v)) +#endif + return true; // vertex is already gone from the TDS, nothing to do + + Vertex_handle hint = v->cell()->vertex(0) == v ? v->cell()->vertex(1) : v->cell()->vertex(0); Self tmp; Vertex_remover remover(tmp); removed = Tr_Base::remove(v, remover, could_lock_zone); - if (*could_lock_zone && removed) + if(*could_lock_zone && removed) { - // Re-insert the points that v was hiding. - for (typename Vertex_remover::Hidden_points_iterator - hi = remover.hidden_points_begin(); - hi != remover.hidden_points_end(); ++hi) + // The vertex has been removed, try to re-insert the points that 'v' was hiding + + // Start by unlocking the area of the removed vertex to avoid deadlocks + this->unlock_all_elements(); + + for(typename Vertex_remover::Hidden_points_iterator + hi = remover.hidden_points_begin(); + hi != remover.hidden_points_end(); ++hi) { - bool could_lock_zone = false; - Vertex_handle hv; - while (!could_lock_zone) + const Weighted_point& wp = *hi; + + // try to lock the positions of the hint and the hidden point + bool success = false; + while(!success) { - hv = insert (*hi, hint, &could_lock_zone); + // The 'hint' is unsafe to use immediately because we are in a regular triangulation, + // and the insertion of a (weighted) point in another thread might have hidden (deleted) + // the hint. +#ifdef CGAL_RT3_IGNORE_TDS_CONCEPT + if(!tds().vertices().is_used(hint)) +#else + if(!tds().is_vertex(hint)) +#endif + { + hint = finite_vertices_begin(); + continue; + } + + // We need to make sure that while are locking the position P1 := hint->point(), 'hint' + // does not get its position changed to P2 != P1. + const Weighted_point hint_point_mem = hint->point(); + + if(this->try_lock_point(hint_point_mem) && this->try_lock_point(wp)) + { + // Make sure that the hint is still valid (so that we can safely take hint->cell()) and + // that its position hasn't changed to ensure that we will start the locate from where + // we have locked. +#ifdef CGAL_RT3_IGNORE_TDS_CONCEPT + if(!tds().vertices().is_used(hint) || +#else + if(!tds().is_vertex(hint) || +#endif + hint->point() != hint_point_mem) + { + hint = finite_vertices_begin(); + this->unlock_all_elements(); + continue; + } + + Vertex_handle hv = insert(wp, hint, could_lock_zone); + + if(*could_lock_zone) + { + success = true; + if(hv != Vertex_handle()) + hint = hv; + } + } + + // This unlocks everything in all cases: partial lock failure, failed insertion, successful insertion + this->unlock_all_elements(); } - if (hv != Vertex_handle()) - hint = hv; } CGAL_triangulation_expensive_postcondition (is_valid()); } From 8a7b11f34411ca20cb2ba4fd18ef3ef3520f5021 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Wed, 3 Oct 2018 16:05:18 +0200 Subject: [PATCH 028/193] Use actual weighted points in parallel regular triangulation tests --- .../CGAL/_test_cls_parallel_triangulation_3.h | 68 +++++++++++++++---- .../test/Triangulation_3/test_regular_3.cpp | 5 +- 2 files changed, 57 insertions(+), 16 deletions(-) diff --git a/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_parallel_triangulation_3.h b/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_parallel_triangulation_3.h index 59abb7b6da2..80e5dbb9181 100644 --- a/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_parallel_triangulation_3.h +++ b/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_parallel_triangulation_3.h @@ -27,42 +27,82 @@ #include +template +struct PTR_random_pts_generator +{ + typedef typename Parallel_triangulation::Point Point; + + void operator()(const int num, CGAL::Random& rnd, std::vector& points) const + { + CGAL::Random_points_in_cube_3 gen(1., rnd); + + points.reserve(num); + for(int i=0; i!=num; ++i) + points.push_back(*gen++); + } +}; + +template +struct PTR_random_pts_generator +{ + typedef typename Parallel_triangulation::Bare_point Bare_point; + typedef typename Parallel_triangulation::Weighted_point Weighted_point; + + void operator()(const int num, CGAL::Random& rnd, std::vector& points) const + { + CGAL::Random_points_in_cube_3 gen(1., rnd); + + points.reserve(num); + for(int i=0; i!=num; ++i) + points.push_back(Weighted_point(*gen++, rnd.get_double(-1., 1.))); + } +}; + template void _test_cls_parallel_triangulation_3(const Parallel_triangulation &) { - const int NUM_INSERTED_POINTS = 5000; - typedef Parallel_triangulation Cls; typedef typename Cls::Vertex_handle Vertex_handle; typedef typename Cls::Point Point; - CGAL::Random_points_in_cube_3 rnd(1.); + typedef std::vector Point_container; + + CGAL::Random rnd; + std::cout << "Seed: " << rnd.get_seed() << std::endl; + + const int num_insert = 5000; + Point_container points; + PTR_random_pts_generator points_gen; + points_gen(num_insert, rnd, points); - // Construction from a vector of points - std::vector points; - points.reserve(NUM_INSERTED_POINTS); - for (int i = 0; i != NUM_INSERTED_POINTS; ++i) - points.push_back(*rnd++); - // Construct the locking data-structure, using the bounding-box of the points - typename Cls::Lock_data_structure locking_ds( - CGAL::Bbox_3(-1., -1., -1., 1., 1., 1.), 50); + typename Cls::Lock_data_structure locking_ds(CGAL::Bbox_3(-1., -1., -1., 1., 1., 1.), 50); + // Contruct the triangulation in parallel std::cout << "Construction and parallel insertion" << std::endl; Cls tr(points.begin(), points.end(), &locking_ds); + std::cout << "Triangulation has " << tr.number_of_vertices() << " vertices" << std::endl; + assert(tr.is_valid()); std::cout << "Parallel removal" << std::endl; - // Remove the first 100,000 vertices std::vector vertices_to_remove; typename Cls::Finite_vertices_iterator vit = tr.finite_vertices_begin(); - for (int i = 0 ; i < NUM_INSERTED_POINTS/10 ; ++i) + + const int num_remove = tr.number_of_vertices() / 10; + std::cout << "Removing " << num_remove << " from " << tr.number_of_vertices() << " vertices" << std::endl; + + for(int i=0 ; i Tds_parallel; typedef CGAL::Regular_triangulation_3< traits, Tds_parallel, Lock_ds> RT_parallel; - // The following test won't do things in parallel since it doesn't provide - // a lock data structure + + // The following test won't do things in parallel since it doesn't provide a lock data structure test_RT(); + // This test performs parallel operations _test_cls_parallel_triangulation_3( RT_parallel() ); #endif From 8500add791c314c7399568583e87142d0ffc5551 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Wed, 3 Oct 2018 16:31:42 +0200 Subject: [PATCH 029/193] There is no 'try'! --- Triangulation_3/include/CGAL/Regular_triangulation_3.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Triangulation_3/include/CGAL/Regular_triangulation_3.h b/Triangulation_3/include/CGAL/Regular_triangulation_3.h index 3eba767d11c..e8cc970b0fa 100644 --- a/Triangulation_3/include/CGAL/Regular_triangulation_3.h +++ b/Triangulation_3/include/CGAL/Regular_triangulation_3.h @@ -2481,7 +2481,7 @@ namespace CGAL { if(*could_lock_zone && removed) { - // The vertex has been removed, try to re-insert the points that 'v' was hiding + // The vertex has been removed, re-insert the points that 'v' was hiding // Start by unlocking the area of the removed vertex to avoid deadlocks this->unlock_all_elements(); From aa1e0acbeef802a1ae8cbdfeaec2f0808211d4d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Wed, 10 Oct 2018 13:08:14 +0200 Subject: [PATCH 030/193] Replaced macro with a legal vertex handle validity checker --- .../include/CGAL/Regular_triangulation_3.h | 68 +++++++++---------- 1 file changed, 31 insertions(+), 37 deletions(-) diff --git a/Triangulation_3/include/CGAL/Regular_triangulation_3.h b/Triangulation_3/include/CGAL/Regular_triangulation_3.h index e8cc970b0fa..8c01c687981 100644 --- a/Triangulation_3/include/CGAL/Regular_triangulation_3.h +++ b/Triangulation_3/include/CGAL/Regular_triangulation_3.h @@ -1291,6 +1291,25 @@ namespace CGAL { } }; + // In parallel operations, we need to be able to check the health of the 'hint' vertex handle, + // which might be invalided by other threads. One way to do that is the 'is_vertex()' function + // of the TDS, but it runs in O(sqrt(n)) complexity. When we are using our TDS, we can use + // a lower level function from the compact container, which runs in constant time. + template + struct Vertex_validity_checker + { + bool operator()(const typename TDS_::Vertex_handle vh_, const TDS_& tds_) { return tds_.is_vertex(vh_); } + }; + + template + struct Vertex_validity_checker > + { + typedef CGAL::Triangulation_data_structure_3 TDS_; + + bool operator()(const typename TDS_::Vertex_handle vh_, const TDS_& tds_) { + return tds_.vertices().is_used(vh_); } + }; + // Functor for parallel insert(begin, end) function template class Insert_point @@ -1324,6 +1343,7 @@ namespace CGAL { #endif Vertex_handle &hint = m_tls_hint.local(); + Vertex_validity_checker vertex_validity_check; for( size_t i_point = r.begin() ; i_point != r.end() ; ++i_point) { @@ -1334,12 +1354,7 @@ namespace CGAL { // The 'hint' is unsafe to use immediately because we are in a regular triangulation, // and the insertion of a (weighted) point in another thread might have hidden (deleted) // the hint. -#define CGAL_RT3_IGNORE_TDS_CONCEPT -#ifdef CGAL_RT3_IGNORE_TDS_CONCEPT - if(!m_rt.tds().vertices().is_used(hint)) -#else - if(!m_rt.tds().is_vertex(hint)) -#endif + if(!vertex_validity_check(hint, m_rt.tds())) { hint = m_rt.finite_vertices_begin(); continue; @@ -1354,11 +1369,7 @@ namespace CGAL { // Make sure that the hint is still valid (so that we can safely take hint->cell()) and // that its position hasn't changed to ensure that we will start the locate from where // we have locked. -#ifdef CGAL_RT3_IGNORE_TDS_CONCEPT - if(!m_rt.tds().vertices().is_used(hint) || -#else - if(!m_rt.tds().is_vertex(hint) || -#endif + if(!vertex_validity_check(hint, m_rt.tds()) || hint->point() != hint_point_mem) { hint = m_rt.finite_vertices_begin(); @@ -1445,6 +1456,8 @@ namespace CGAL { #endif Vertex_handle &hint = m_tls_hint.local(); + Vertex_validity_checker vertex_validity_check; + for (size_t i_idx = r.begin() ; i_idx != r.end() ; ++i_idx) { bool success = false; @@ -1455,12 +1468,7 @@ namespace CGAL { // The 'hint' is unsafe to use immediately because we are in a regular triangulation, // and the insertion of a (weighted) point in another thread might have hidden (deleted) // the hint. -#define CGAL_RT3_IGNORE_TDS_CONCEPT -#ifdef CGAL_RT3_IGNORE_TDS_CONCEPT - if(!m_rt.tds().vertices().is_used(hint)) -#else - if(!m_rt.tds().is_vertex(hint)) -#endif + if(!vertex_validity_check(hint, m_rt.tds())) { hint = m_rt.finite_vertices_begin(); continue; @@ -1475,11 +1483,7 @@ namespace CGAL { // Make sure that the hint is still valid (so that we can safely take hint->cell()) and // that its position hasn't changed to ensure that we will start the locate from where // we have locked. -#ifdef CGAL_RT3_IGNORE_TDS_CONCEPT - if(!m_rt.tds().vertices().is_used(hint) || -#else - if(!m_rt.tds().is_vertex(hint) || -#endif + if(!vertex_validity_check(hint, m_rt.tds()) || hint->point() != hint_point_mem) { hint = m_rt.finite_vertices_begin(); @@ -2465,12 +2469,10 @@ namespace CGAL { } else { + Vertex_validity_checker vertex_validity_check; + // Check that the vertex hasn't be deleted from the TDS while we were locking it -#ifdef CGAL_RT3_IGNORE_TDS_CONCEPT - if(!tds().vertices().is_used(v)) -#else - if(!tds().is_vertex(v)) -#endif + if(!vertex_validity_check(v, tds())) return true; // vertex is already gone from the TDS, nothing to do Vertex_handle hint = v->cell()->vertex(0) == v ? v->cell()->vertex(1) : v->cell()->vertex(0); @@ -2499,11 +2501,7 @@ namespace CGAL { // The 'hint' is unsafe to use immediately because we are in a regular triangulation, // and the insertion of a (weighted) point in another thread might have hidden (deleted) // the hint. -#ifdef CGAL_RT3_IGNORE_TDS_CONCEPT - if(!tds().vertices().is_used(hint)) -#else - if(!tds().is_vertex(hint)) -#endif + if(!vertex_validity_check(hint, tds())) { hint = finite_vertices_begin(); continue; @@ -2518,11 +2516,7 @@ namespace CGAL { // Make sure that the hint is still valid (so that we can safely take hint->cell()) and // that its position hasn't changed to ensure that we will start the locate from where // we have locked. -#ifdef CGAL_RT3_IGNORE_TDS_CONCEPT - if(!tds().vertices().is_used(hint) || -#else - if(!tds().is_vertex(hint) || -#endif + if(!vertex_validity_check(hint, tds()) || hint->point() != hint_point_mem) { hint = finite_vertices_begin(); From 0d376fa5ebb2f9d13c8a408fa43ea59d9b63b641 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Thu, 11 Oct 2018 13:39:16 +0200 Subject: [PATCH 031/193] Add an action to save a scene --- Polyhedron/demo/Polyhedron/MainWindow.cpp | 73 +++++++++++++++++++++++ Polyhedron/demo/Polyhedron/MainWindow.h | 1 + Polyhedron/demo/Polyhedron/MainWindow.ui | 6 ++ Three/include/CGAL/Three/Scene_item.h | 3 +- 4 files changed, 82 insertions(+), 1 deletion(-) diff --git a/Polyhedron/demo/Polyhedron/MainWindow.cpp b/Polyhedron/demo/Polyhedron/MainWindow.cpp index 805f71468e3..c79c8046eda 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.cpp +++ b/Polyhedron/demo/Polyhedron/MainWindow.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #ifdef QT_SCRIPT_LIB # include # ifdef QT_SCRIPTTOOLS_LIB @@ -2303,3 +2304,75 @@ void MainWindow::propagate_action() } } } + +void MainWindow::on_actionSa_ve_Scene_as_Script_triggered() +{ + QString filename = + QFileDialog::getSaveFileName(this, + "Save the Scene as a Script File", + last_saved_dir, + "*.js"); + std::ofstream os(filename.toUtf8()); + if(!os) + return; + std::vector names; + std::vector loaders; + std::vector colors; + std::vector rendering_modes; + for(int i = 0; i < scene->numberOfEntries(); ++i) + { + Scene_item* item = scene->item(i); + QString loader = item->property("loader_name").toString(); + QString source = item->property("source filename").toString(); + if(loader.isEmpty()) + continue; + names.push_back(source); + loaders.push_back(loader); + colors.push_back(item->color()); + rendering_modes.push_back(item->renderingMode()); + } + //path + os << "var camera = \""<dumpCameraCoordinates().toStdString()<<"\";\n"; + os << "var items = ["; + for(std::size_t i = 0; i< names.size() -1; ++i) + { + os << "\'" << names[i].toStdString() << "\', "; + } + os<<"\'"< + @@ -551,6 +552,11 @@ Set Transparency &Pass Number + + + Sa&ve the Scene as a Script File... + + diff --git a/Three/include/CGAL/Three/Scene_item.h b/Three/include/CGAL/Three/Scene_item.h index 1b00fea5fc4..3d668298688 100644 --- a/Three/include/CGAL/Three/Scene_item.h +++ b/Three/include/CGAL/Three/Scene_item.h @@ -316,7 +316,7 @@ public Q_SLOTS: virtual void setColor(QColor c) { color_ = c;} //!Setter for the RGB color of the item. Calls setColor(QColor). //!@see setColor(QColor c) - void setRbgColor(int r, int g, int b) { setColor(QColor(r, g, b)); } + virtual void setRgbColor(int r, int g, int b) { setColor(QColor(r, g, b)); } //!Sets the name of the item. virtual void setName(QString n) { name_ = n; } //!Sets the visibility of the item. @@ -325,6 +325,7 @@ public Q_SLOTS: //!This function is called by `Scene::changeGroup` and should not be //!called manually. virtual void moveToGroup(Scene_group_item* group); + void setRenderingMode(int m) { setRenderingMode((RenderingMode)m);} //!Sets the rendering mode of the item. //!@see RenderingMode virtual void setRenderingMode(RenderingMode m) { From 73291165a15c2e2ae29537cb76835e30411e528b Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Thu, 11 Oct 2018 13:53:55 +0200 Subject: [PATCH 032/193] Remove virtual. --- Three/include/CGAL/Three/Scene_item.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Three/include/CGAL/Three/Scene_item.h b/Three/include/CGAL/Three/Scene_item.h index 3d668298688..6db0e047f38 100644 --- a/Three/include/CGAL/Three/Scene_item.h +++ b/Three/include/CGAL/Three/Scene_item.h @@ -316,7 +316,7 @@ public Q_SLOTS: virtual void setColor(QColor c) { color_ = c;} //!Setter for the RGB color of the item. Calls setColor(QColor). //!@see setColor(QColor c) - virtual void setRgbColor(int r, int g, int b) { setColor(QColor(r, g, b)); } + void setRgbColor(int r, int g, int b) { setColor(QColor(r, g, b)); } //!Sets the name of the item. virtual void setName(QString n) { name_ = n; } //!Sets the visibility of the item. From 7e75a8a243b629b6fbfbf8c563afe76cdf6d1299 Mon Sep 17 00:00:00 2001 From: Mael Date: Wed, 17 Oct 2018 09:24:46 +0200 Subject: [PATCH 033/193] Fixed indentation (Thanks for the suggestion @MaelRL !) --- .../include/CGAL/_test_cls_parallel_triangulation_3.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_parallel_triangulation_3.h b/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_parallel_triangulation_3.h index 80e5dbb9181..2b1314a4066 100644 --- a/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_parallel_triangulation_3.h +++ b/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_parallel_triangulation_3.h @@ -96,7 +96,7 @@ _test_cls_parallel_triangulation_3(const Parallel_triangulation &) for(int i=0 ; i Date: Tue, 16 Oct 2018 12:32:11 +0200 Subject: [PATCH 034/193] Create an "empty" CMakeLists.txt to fix the testsuite --- Three/demo/Three/CMakeLists.txt | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Three/demo/Three/CMakeLists.txt diff --git a/Three/demo/Three/CMakeLists.txt b/Three/demo/Three/CMakeLists.txt new file mode 100644 index 00000000000..2209285ac71 --- /dev/null +++ b/Three/demo/Three/CMakeLists.txt @@ -0,0 +1,27 @@ +# Created by the script cgal_create_cmake_script +# This is the CMake script for compiling a CGAL application. + + +project( Three_test ) + +cmake_minimum_required(VERSION 2.8.10) + +set(CMAKE_CXX_STANDARD 14) + +find_package(CGAL QUIET COMPONENTS Core ) + +if ( CGAL_FOUND ) + + include( ${CGAL_USE_FILE} ) + + include( CGAL_CreateSingleSourceCGALProgram ) + + include_directories (BEFORE "../../include") + + +else() + + message(STATUS "This program requires the CGAL library, and will not be compiled.") + +endif() + From 6893d8960f1bcb4cd01776f053cdf9046c1a95ac Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Tue, 16 Oct 2018 12:33:39 +0200 Subject: [PATCH 035/193] Check for CMakeLists.txt also in demos --- .../demo/Circular_kernel_2/data/circle_grid.cgal | 0 .../demo/Circular_kernel_2/data/circles_21.cgal | 0 .../demo/Triangulation_2/data/butterfly | 0 .../demo/Triangulation_2/data/fish | 0 .../demo/Triangulation_2/data/norway.edg | 0 .../demo/Triangulation_2/data/poisson | 0 {Triangulation_2 => GraphicsView}/demo/Triangulation_2/data/tr | 0 .../demo/Triangulation_2/data/triangulation.cgal | 0 Scripts/developer_scripts/test_merge_of_branch | 2 +- Three/demo/Three/CMakeLists.txt | 2 +- 10 files changed, 2 insertions(+), 2 deletions(-) rename {Circular_kernel_2 => GraphicsView}/demo/Circular_kernel_2/data/circle_grid.cgal (100%) rename {Circular_kernel_2 => GraphicsView}/demo/Circular_kernel_2/data/circles_21.cgal (100%) rename {Triangulation_2 => GraphicsView}/demo/Triangulation_2/data/butterfly (100%) rename {Triangulation_2 => GraphicsView}/demo/Triangulation_2/data/fish (100%) rename {Triangulation_2 => GraphicsView}/demo/Triangulation_2/data/norway.edg (100%) rename {Triangulation_2 => GraphicsView}/demo/Triangulation_2/data/poisson (100%) rename {Triangulation_2 => GraphicsView}/demo/Triangulation_2/data/tr (100%) rename {Triangulation_2 => GraphicsView}/demo/Triangulation_2/data/triangulation.cgal (100%) diff --git a/Circular_kernel_2/demo/Circular_kernel_2/data/circle_grid.cgal b/GraphicsView/demo/Circular_kernel_2/data/circle_grid.cgal similarity index 100% rename from Circular_kernel_2/demo/Circular_kernel_2/data/circle_grid.cgal rename to GraphicsView/demo/Circular_kernel_2/data/circle_grid.cgal diff --git a/Circular_kernel_2/demo/Circular_kernel_2/data/circles_21.cgal b/GraphicsView/demo/Circular_kernel_2/data/circles_21.cgal similarity index 100% rename from Circular_kernel_2/demo/Circular_kernel_2/data/circles_21.cgal rename to GraphicsView/demo/Circular_kernel_2/data/circles_21.cgal diff --git a/Triangulation_2/demo/Triangulation_2/data/butterfly b/GraphicsView/demo/Triangulation_2/data/butterfly similarity index 100% rename from Triangulation_2/demo/Triangulation_2/data/butterfly rename to GraphicsView/demo/Triangulation_2/data/butterfly diff --git a/Triangulation_2/demo/Triangulation_2/data/fish b/GraphicsView/demo/Triangulation_2/data/fish similarity index 100% rename from Triangulation_2/demo/Triangulation_2/data/fish rename to GraphicsView/demo/Triangulation_2/data/fish diff --git a/Triangulation_2/demo/Triangulation_2/data/norway.edg b/GraphicsView/demo/Triangulation_2/data/norway.edg similarity index 100% rename from Triangulation_2/demo/Triangulation_2/data/norway.edg rename to GraphicsView/demo/Triangulation_2/data/norway.edg diff --git a/Triangulation_2/demo/Triangulation_2/data/poisson b/GraphicsView/demo/Triangulation_2/data/poisson similarity index 100% rename from Triangulation_2/demo/Triangulation_2/data/poisson rename to GraphicsView/demo/Triangulation_2/data/poisson diff --git a/Triangulation_2/demo/Triangulation_2/data/tr b/GraphicsView/demo/Triangulation_2/data/tr similarity index 100% rename from Triangulation_2/demo/Triangulation_2/data/tr rename to GraphicsView/demo/Triangulation_2/data/tr diff --git a/Triangulation_2/demo/Triangulation_2/data/triangulation.cgal b/GraphicsView/demo/Triangulation_2/data/triangulation.cgal similarity index 100% rename from Triangulation_2/demo/Triangulation_2/data/triangulation.cgal rename to GraphicsView/demo/Triangulation_2/data/triangulation.cgal diff --git a/Scripts/developer_scripts/test_merge_of_branch b/Scripts/developer_scripts/test_merge_of_branch index 8915bc8b8af..c81c501734b 100755 --- a/Scripts/developer_scripts/test_merge_of_branch +++ b/Scripts/developer_scripts/test_merge_of_branch @@ -85,7 +85,7 @@ fi #check cmake scripts of tests, examples are present echo '.. Checking if all CMakeLists.txt are present...' -for i in `ls -d ^build*/examples/*/ ^build*/test/*/`; do +for i in `ls -d ^build*/examples/*/ ^build*/test/*/ ^build*/demo/^(icons|resources)/`; do if ! [ -f $i/CMakeLists.txt ]; then echo "Error: $i/CMakeLists.txt does not exist!" exit 1 diff --git a/Three/demo/Three/CMakeLists.txt b/Three/demo/Three/CMakeLists.txt index 2209285ac71..ef680b5d109 100644 --- a/Three/demo/Three/CMakeLists.txt +++ b/Three/demo/Three/CMakeLists.txt @@ -2,7 +2,7 @@ # This is the CMake script for compiling a CGAL application. -project( Three_test ) +project( Three_Demo ) cmake_minimum_required(VERSION 2.8.10) From cb81c3897e6d6f228137c2986bb72098e0144da9 Mon Sep 17 00:00:00 2001 From: Marc Glisse Date: Tue, 16 Oct 2018 15:10:05 +0200 Subject: [PATCH 036/193] Pasto --- Scripts/developer_scripts/test_merge_of_branch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scripts/developer_scripts/test_merge_of_branch b/Scripts/developer_scripts/test_merge_of_branch index c81c501734b..fca78d160d2 100755 --- a/Scripts/developer_scripts/test_merge_of_branch +++ b/Scripts/developer_scripts/test_merge_of_branch @@ -130,7 +130,7 @@ fi echo '.. Checking $Id$ tag presence in header files...' file_without_Id_tag=$(for pkg in `find */package_info -name 'license.txt' | awk -F "/" '{print $1}'`; do if [ -e ${pkg}/include ]; then find ${pkg}/include -type f \( -name '*.h' -o -name '*.hpp' \) | xargs -r grep -L '$Id\$'; fi; done) if [ -n "${file_without_Id_tag}" ]; then - echo 'The following files do not have a $URL$ tag:' + echo 'The following files do not have a $Id$ tag:' echo ${file_without_Id_tag} exit 1 fi From 428bdc6d1c3ff4ef38d1fcf1f4606165b3b0c37b Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 17 Oct 2018 16:09:31 +0200 Subject: [PATCH 037/193] WIP read plugin metadata before loading --- Polyhedron/demo/Polyhedron/MainWindow.cpp | 20 ++++++++++++++++++- .../Plugins/PCA/Basic_generator_plugin.cpp | 2 +- .../Plugins/PCA/basic_generator_plugin.json | 1 + 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 Polyhedron/demo/Polyhedron/Plugins/PCA/basic_generator_plugin.json diff --git a/Polyhedron/demo/Polyhedron/MainWindow.cpp b/Polyhedron/demo/Polyhedron/MainWindow.cpp index d0c414edc51..3c1a175e0bb 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.cpp +++ b/Polyhedron/demo/Polyhedron/MainWindow.cpp @@ -562,8 +562,26 @@ bool MainWindow::load_plugin(QString fileName, bool blacklisted) qdebug << "### Loading \"" << fileName.toUtf8().data() << "\"... "; QPluginLoader loader; loader.setFileName(fileinfo.absoluteFilePath()); + QJsonArray keywords = loader.metaData().value("MetaData").toObject().value("Keywords").toArray(); + QStringList s_keywords; + for(int i = 0; i < keywords.size(); ++i) + { + s_keywords.append(keywords[i].toString()); + } QObject *obj = loader.instance(); - if(obj) { + + QStringList accepted_keywords; + accepted_keywords << "Test1"; + bool do_load = false; + Q_FOREACH(QString k, s_keywords) + { + if(accepted_keywords.contains(k)) + { + do_load = true; + break; + } + } + if(do_load && obj) { obj->setObjectName(name); bool init1 = initPlugin(obj); bool init2 = initIOPlugin(obj); diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Basic_generator_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PCA/Basic_generator_plugin.cpp index 3fde5e826fa..bd481688a95 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/Basic_generator_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/Basic_generator_plugin.cpp @@ -40,7 +40,7 @@ class Q_DECL_EXPORT Basic_generator_plugin : { Q_OBJECT Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "basic_generator_plugin.json") public : void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/basic_generator_plugin.json b/Polyhedron/demo/Polyhedron/Plugins/PCA/basic_generator_plugin.json new file mode 100644 index 00000000000..0ae408f4388 --- /dev/null +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/basic_generator_plugin.json @@ -0,0 +1 @@ +{ "Keywords": [ "PolygonMesh", "BidonTest"]} From 6ed8213ac3fe7b13243348ed3a54e87cbaf84e47 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Thu, 18 Oct 2018 12:26:08 +0200 Subject: [PATCH 038/193] WIP Metadata --- Polyhedron/demo/Polyhedron/CMakeLists.txt | 2 +- Polyhedron/demo/Polyhedron/Details.ui | 83 ++++++++++++++ Polyhedron/demo/Polyhedron/MainWindow.cpp | 102 ++++++++++++------ Polyhedron/demo/Polyhedron/MainWindow.h | 5 +- .../Polyhedron/Plugins/PCA/CMakeLists.txt | 2 +- .../Plugins/PCA/basic_generator_plugin.json | 1 - Polyhedron/demo/Polyhedron/Preferences.ui | 33 +++++- .../Polyhedron/polyhedron_demo_macros.cmake | 34 +++++- 8 files changed, 218 insertions(+), 44 deletions(-) create mode 100644 Polyhedron/demo/Polyhedron/Details.ui delete mode 100644 Polyhedron/demo/Polyhedron/Plugins/PCA/basic_generator_plugin.json diff --git a/Polyhedron/demo/Polyhedron/CMakeLists.txt b/Polyhedron/demo/Polyhedron/CMakeLists.txt index 4e949955731..234aa1c9cf6 100644 --- a/Polyhedron/demo/Polyhedron/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/CMakeLists.txt @@ -132,7 +132,7 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND ) qt5_wrap_ui( statisticsUI_FILES Statistics_on_item_dialog.ui) qt5_wrap_ui( FileLoaderDialogUI_files FileLoaderDialog.ui ) qt5_wrap_ui( Show_point_dialogUI_FILES Show_point_dialog.ui ) - qt5_wrap_ui( PreferencesUI_FILES Preferences.ui ) + qt5_wrap_ui( PreferencesUI_FILES Preferences.ui Details.ui) qt5_wrap_ui( Show_point_dialogUI_FILES Show_point_dialog.ui ) qt5_wrap_ui( ViewerUI_FILES LightingDialog.ui) qt5_generate_moc( "File_loader_dialog.h" "${CMAKE_CURRENT_BINARY_DIR}/File_loader_dialog_moc.cpp" ) diff --git a/Polyhedron/demo/Polyhedron/Details.ui b/Polyhedron/demo/Polyhedron/Details.ui new file mode 100644 index 00000000000..3604c07a41c --- /dev/null +++ b/Polyhedron/demo/Polyhedron/Details.ui @@ -0,0 +1,83 @@ + + + DetailsDialog + + + + 0 + 0 + 790 + 326 + + + + Dialog + + + + + + + 1 + + + + + + + + + 16777215 + 70 + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Close + + + + + + + + + buttonBox + accepted() + DetailsDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + DetailsDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/Polyhedron/demo/Polyhedron/MainWindow.cpp b/Polyhedron/demo/Polyhedron/MainWindow.cpp index 3c1a175e0bb..a4729f98382 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.cpp +++ b/Polyhedron/demo/Polyhedron/MainWindow.cpp @@ -31,8 +31,6 @@ #include #include #include -#include -#include #include #include #include @@ -55,6 +53,7 @@ #include #include "ui_MainWindow.h" #include "ui_Preferences.h" +#include "ui_Details.h" #include "ui_Statistics_on_item_dialog.h" #include "Show_point_dialog.h" #include "File_loader_dialog.h" @@ -551,9 +550,10 @@ bool MainWindow::load_plugin(QString fileName, bool blacklisted) if(blacklisted) { if ( plugin_blacklist.contains(name) ){ - pluginsStatus_map[name] = QString("ignored"); + pluginsStatus_map[name] = QString("Blacklisted."); + ignored_map[name] = true; //qDebug("### Ignoring plugin \"%s\".", qPrintable(fileName)); - PathNames_map[fileinfo.absoluteDir().absolutePath()].push_back(name); + PathNames_map[name].push_back(fileinfo.absoluteDir().absolutePath()); return true; } } @@ -563,15 +563,17 @@ bool MainWindow::load_plugin(QString fileName, bool blacklisted) QPluginLoader loader; loader.setFileName(fileinfo.absoluteFilePath()); QJsonArray keywords = loader.metaData().value("MetaData").toObject().value("Keywords").toArray(); + QString date = loader.metaData().value("MetaData").toObject().value("ConfigDate").toString(); QStringList s_keywords; for(int i = 0; i < keywords.size(); ++i) { s_keywords.append(keywords[i].toString()); } + plugin_metadata_map[name] = qMakePair(s_keywords, date); QObject *obj = loader.instance(); QStringList accepted_keywords; - accepted_keywords << "Test1"; + accepted_keywords << "PolygonMesh"; bool do_load = false; Q_FOREACH(QString k, s_keywords) { @@ -594,12 +596,17 @@ bool MainWindow::load_plugin(QString fileName, bool blacklisted) //qdebug << "success"; pluginsStatus_map[name] = QString("success"); } - else { + else if(!do_load) + { + pluginsStatus_map[name]="Wrong Keywords."; + ignored_map[name] = true; + } + else{ //qdebug << "error: " << qPrintable(loader.errorString()); pluginsStatus_map[name] = loader.errorString(); } - PathNames_map[fileinfo.absoluteDir().absolutePath()].push_back(name); + PathNames_map[name].push_back(fileinfo.absoluteDir().absolutePath()); return true; } return false; @@ -1906,43 +1913,68 @@ void MainWindow::on_actionPreferences_triggered() this, [](const QString& text){ CGAL::Three::Three::s_defaultPSRM = CGAL::Three::Three::modeFromName(text); }); + std::vector items; QBrush successBrush(Qt::green), errorBrush(Qt::red), ignoredBrush(Qt::lightGray); //add blacklisted plugins - Q_FOREACH (QString path, PathNames_map.keys()) + Q_FOREACH (QString name, PathNames_map.keys()) { - QTreeWidgetItem* pluginItem = new QTreeWidgetItem(prefdiag.treeWidget); - pluginItem->setText(1, path); - prefdiag.treeWidget->setItemExpanded(pluginItem, true); - QFont boldFont = pluginItem->font(1); - boldFont.setBold(true); - pluginItem->setFont(1, boldFont); - Q_FOREACH(QString name, PathNames_map[path]) - { - QTreeWidgetItem *item = new QTreeWidgetItem(pluginItem); - item->setText(1, name); - if(plugin_blacklist.contains(name)){ - item->setCheckState(0, Qt::Checked); - } - else{ - item->setCheckState(0, Qt::Unchecked); - } - if(pluginsStatus_map[name] == QString("success")) - item->setBackground(1, successBrush); - else if(pluginsStatus_map[name] == QString("ignored")){ - item->setBackground(1, ignoredBrush); - item->setToolTip(1, QString("This plugin is currently blacklisted, so it has been ignored.")); - } - else{ - item->setBackground(1, errorBrush); - item->setToolTip(1, pluginsStatus_map[name]); - } - items.push_back(item); + QTreeWidgetItem *item = new QTreeWidgetItem(prefdiag.treeWidget); + item->setText(1, name); + if(plugin_blacklist.contains(name)){ + item->setCheckState(0, Qt::Checked); } + else{ + item->setCheckState(0, Qt::Unchecked); + } + if(pluginsStatus_map[name] == QString("success")) + item->setBackground(1, successBrush); + else if(ignored_map[name]){ + item->setBackground(1, ignoredBrush); + } + else{ + item->setBackground(1, errorBrush); + } + items.push_back(item); } + connect(prefdiag.detailsPushButton, &QPushButton::clicked, + this, [this, prefdiag](){ + QStringList titles; + titles << "Name" << "Keywords" << "ConfigDate"; + QDialog dialog(this); + Ui::DetailsDialog detdiag; + detdiag.setupUi(&dialog); + QTreeWidgetItem *header = new QTreeWidgetItem(titles); + detdiag.treeWidget->setHeaderItem(header); + Q_FOREACH(QTreeWidgetItem* plugin_item, prefdiag.treeWidget->selectedItems()) + { + QString name = plugin_item->text(1); + QString keywords = plugin_metadata_map[name].first.join(", "); + QString date = plugin_metadata_map[name].second; + QStringList values; + values << name << keywords << date; + new QTreeWidgetItem(detdiag.treeWidget, values); + } + for(int i=0; i<3; ++i) + { + detdiag.treeWidget->resizeColumnToContents(i); + } + connect(detdiag.treeWidget, &QTreeWidget::clicked, + this, [this, detdiag](){ + if(detdiag.treeWidget->selectedItems().isEmpty()) + detdiag.textBrowser->setText(""); + else { + QString name = detdiag.treeWidget->selectedItems().first()->text(0); + QString status = pluginsStatus_map[name]; + QString path = PathNames_map[name]; + detdiag.textBrowser->setText(QString("Path: %1 \nStatus: %2").arg(path).arg(status)); + } + }); + dialog.exec(); + }); dialog.exec(); if ( dialog.result() ) diff --git a/Polyhedron/demo/Polyhedron/MainWindow.h b/Polyhedron/demo/Polyhedron/MainWindow.h index d286160b8f9..b5570034d72 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.h +++ b/Polyhedron/demo/Polyhedron/MainWindow.h @@ -16,6 +16,7 @@ #include #include #include +#include #include class Scene; class Viewer; @@ -394,7 +395,7 @@ private: void setMenus(QString, QString, QAction *a); /// plugin black-list QSet plugin_blacklist; - QMap > PathNames_map; //For each non-empty plugin directory, contains a vector of plugin names + QMap PathNames_map; //For each non-empty plugin directory, contains a vector of plugin names QMap pluginsStatus_map; //For each non-empty plugin directory, contains a vector of plugin names Scene* scene; Viewer* viewer; @@ -440,6 +441,8 @@ private: QLineEdit operationSearchBar; QWidgetAction* searchAction; QString def_save_dir; + QMap >plugin_metadata_map; + QMap ignored_map; }; #endif // ifndef MAINWINDOW_H diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/PCA/CMakeLists.txt index 02660fb8bfd..b04d0a77fa1 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/CMakeLists.txt @@ -18,5 +18,5 @@ polyhedron_demo_plugin(create_bbox_mesh_plugin Create_bbox_mesh_plugin) target_link_libraries(create_bbox_mesh_plugin PUBLIC scene_surface_mesh_item) qt5_wrap_ui( volumesUI_FILES Basic_generator_widget.ui) -polyhedron_demo_plugin(basic_generator_plugin Basic_generator_plugin ${volumesUI_FILES}) +polyhedron_demo_plugin(basic_generator_plugin Basic_generator_plugin ${volumesUI_FILES} KEYWORDS PolygonMesh) target_link_libraries(basic_generator_plugin PUBLIC scene_surface_mesh_item scene_points_with_normal_item scene_polylines_item) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/basic_generator_plugin.json b/Polyhedron/demo/Polyhedron/Plugins/PCA/basic_generator_plugin.json deleted file mode 100644 index 0ae408f4388..00000000000 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/basic_generator_plugin.json +++ /dev/null @@ -1 +0,0 @@ -{ "Keywords": [ "PolygonMesh", "BidonTest"]} diff --git a/Polyhedron/demo/Polyhedron/Preferences.ui b/Polyhedron/demo/Polyhedron/Preferences.ui index 0435444e306..15972abadd9 100644 --- a/Polyhedron/demo/Polyhedron/Preferences.ui +++ b/Polyhedron/demo/Polyhedron/Preferences.ui @@ -7,7 +7,7 @@ 0 0 631 - 631 + 526 @@ -60,7 +60,7 @@ 0 0 278 - 537 + 432 @@ -245,7 +245,10 @@ false - QAbstractItemView::NoSelection + QAbstractItemView::MultiSelection + + + QAbstractItemView::SelectRows true @@ -268,6 +271,30 @@ + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Details + + + + + diff --git a/Polyhedron/demo/Polyhedron/polyhedron_demo_macros.cmake b/Polyhedron/demo/Polyhedron/polyhedron_demo_macros.cmake index 852c81448cc..b198ca87326 100644 --- a/Polyhedron/demo/Polyhedron/polyhedron_demo_macros.cmake +++ b/Polyhedron/demo/Polyhedron/polyhedron_demo_macros.cmake @@ -2,10 +2,11 @@ include(AddFileDependencies) include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) macro(polyhedron_demo_plugin plugin_name plugin_implementation_base_name) - list_split(option ARGN_TAIL ${ARGN} ) + cmake_parse_arguments(ARG "" "" "KEYWORDS" ${ARGN}) + list_split(option ARGN_TAIL ${ARG_UNPARSED_ARGUMENTS} ) if(NOT ${option} STREQUAL "EXCLUDE_FROM_ALL") if(NOT ${option} STREQUAL "NO_MOC") - set(other_sources ${ARGN}) + set(other_sources ${ARG_UNPARSED_ARGUMENTS}) set(option "") else() set(other_sources ${ARGN_TAIL}) @@ -42,4 +43,33 @@ include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) if(TARGET Polyhedron_3) add_dependencies( ${plugin_name} Polyhedron_3 ) endif() + #metadata management + #create "${plugin_implementation_base_name}.json" in BINARY_DIR + STRING(TOLOWER "${plugin_implementation_base_name}.json" base_name) + SET(filename "${CMAKE_CURRENT_BINARY_DIR}/${base_name}") + LIST(LENGTH ARG_KEYWORDS size) + if(${size} GREATER 0) + FILE(WRITE ${filename} "{ \"Keywords\" : [") + foreach(keyword ${ARG_KEYWORDS}) + LIST(APPEND keywords "\"${keyword}\", ") + if(NOT TARGET ${keyword}) + add_custom_target(${keyword}) + endif() + add_dependencies( ${keyword} ${plugin_name}) + endforeach() + LIST(LENGTH keywords size) + math(EXPR size "${size} - 1") + LIST(GET keywords -1 last_element) + LIST(REMOVE_AT keywords ${size}) + STRING(LENGTH ${last_element} size) + math(EXPR size "${size} - 2") + STRING(SUBSTRING ${last_element} 0 ${size} last_element) + LIST(APPEND keywords ${last_element}) + foreach(keyword ${keywords}) + file(APPEND ${filename} ${keyword}) + endforeach() + file(APPEND ${filename} "], \n") + string(TIMESTAMP VERSION "%Y-%m-%d %H:%M") + file(APPEND ${filename} "\"ConfigDate\" : \"${VERSION}\" }") + endif() endmacro(polyhedron_demo_plugin) From 6d0d3b091e0373061329891ba17a7ddefe59c7b9 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Thu, 18 Oct 2018 13:02:49 +0200 Subject: [PATCH 039/193] Add parser and arguments to define keywords in the app. --- Polyhedron/demo/Polyhedron/MainWindow.cpp | 21 ++++++++++--------- Polyhedron/demo/Polyhedron/MainWindow.h | 3 ++- .../demo/Polyhedron/Polyhedron_demo.cpp | 13 ++++++++++-- Polyhedron/demo/Polyhedron/Polyhedron_demo.h | 4 +++- 4 files changed, 27 insertions(+), 14 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/MainWindow.cpp b/Polyhedron/demo/Polyhedron/MainWindow.cpp index a4729f98382..189366b659a 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.cpp +++ b/Polyhedron/demo/Polyhedron/MainWindow.cpp @@ -131,8 +131,9 @@ MainWindow::~MainWindow() delete ui; delete statistics_ui; } -MainWindow::MainWindow(bool verbose, QWidget* parent) - : CGAL::Qt::DemosMainWindow(parent) +MainWindow::MainWindow(const QStringList &keywords, bool verbose, QWidget* parent) + : CGAL::Qt::DemosMainWindow(parent), + accepted_keywords(keywords) { ui = new Ui::MainWindow; ui->setupUi(this); @@ -571,16 +572,16 @@ bool MainWindow::load_plugin(QString fileName, bool blacklisted) } plugin_metadata_map[name] = qMakePair(s_keywords, date); QObject *obj = loader.instance(); - - QStringList accepted_keywords; - accepted_keywords << "PolygonMesh"; - bool do_load = false; - Q_FOREACH(QString k, s_keywords) + bool do_load = accepted_keywords.empty(); + if(!do_load) { - if(accepted_keywords.contains(k)) + Q_FOREACH(QString k, s_keywords) { - do_load = true; - break; + if(accepted_keywords.contains(k)) + { + do_load = true; + break; + } } } if(do_load && obj) { diff --git a/Polyhedron/demo/Polyhedron/MainWindow.h b/Polyhedron/demo/Polyhedron/MainWindow.h index b5570034d72..4b7a9011a75 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.h +++ b/Polyhedron/demo/Polyhedron/MainWindow.h @@ -71,7 +71,7 @@ public: * Then it creates and initializes the scene and do the * connexions with the UI. Finally it loads the plugins.*/ - MainWindow(bool verbose = false,QWidget* parent = 0); + MainWindow(const QStringList& keywords, bool verbose = false,QWidget* parent = 0); ~MainWindow(); /*! Finds an IO plugin. @@ -443,6 +443,7 @@ private: QString def_save_dir; QMap >plugin_metadata_map; QMap ignored_map; + const QStringList& accepted_keywords; }; #endif // ifndef MAINWINDOW_H diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo.cpp index f489df44bb9..c0e957bd645 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo.cpp @@ -19,7 +19,8 @@ struct Polyhedron_demo_impl { Polyhedron_demo::Polyhedron_demo(int& argc, char **argv, QString application_name, - QString main_window_title) + QString main_window_title, + QStringList input_keywords) : QApplication(argc, argv) , d_ptr_is_initialized(false) , d_ptr(new Polyhedron_demo_impl) @@ -43,6 +44,11 @@ Polyhedron_demo::Polyhedron_demo(int& argc, char **argv, QCommandLineParser parser; parser.addHelpOption(); + + QCommandLineOption use_keyword("keyword", + tr("Only loads the plugins associated with the following keyword. Can be called multiple times."), + "keyword"); + parser.addOption(use_keyword); QCommandLineOption use_meta("use-meta", tr("Use the [Meta] key to move frames, instead of [Tab].")); @@ -67,7 +73,10 @@ Polyhedron_demo::Polyhedron_demo(int& argc, char **argv, parser.addOption(old); parser.addPositionalArgument("files", tr("Files to open"), "[files...]"); parser.process(*this); - d_ptr->mainWindow.reset(new MainWindow(parser.isSet(verbose))); + QStringList keywords = input_keywords; + QStringList parser_keywords = parser.values(use_keyword); + keywords.append(parser_keywords); + d_ptr->mainWindow.reset(new MainWindow(keywords, parser.isSet(verbose))); MainWindow& mainWindow = *d_ptr->mainWindow; mainWindow.setWindowTitle(main_window_title); diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo.h b/Polyhedron/demo/Polyhedron/Polyhedron_demo.h index b6baa4a84bf..1cc498aa314 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo.h +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo.h @@ -7,6 +7,7 @@ #include #include +#include struct Polyhedron_demo_impl; @@ -20,7 +21,8 @@ public: */ Polyhedron_demo(int& argc, char **argv, QString application_name = "Polyhedron_3 demo", - QString main_window_title = "CGAL Polyhedron demo"); + QString main_window_title = "CGAL Polyhedron demo", + QStringList input_keywords = QStringList()); ~Polyhedron_demo(); From 2d385fc2f248f4c993c5dd3ea6733276deb5f897 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Thu, 18 Oct 2018 14:30:07 +0200 Subject: [PATCH 040/193] Finalize metadata plugins mechanism. Create the IO group. --- Polyhedron/demo/Polyhedron/Details.ui | 3 ++ .../demo/Polyhedron/Plugins/IO/CMakeLists.txt | 27 +++++----- .../Polyhedron/Plugins/IO/GOCAD_io_plugin.cpp | 4 +- .../IO/Implicit_function_io_plugin.cpp | 2 +- .../Polyhedron/Plugins/IO/LAS_io_plugin.cpp | 2 +- .../Polyhedron/Plugins/IO/Nef_io_plugin.cpp | 2 +- .../Polyhedron/Plugins/IO/OFF_io_plugin.cpp | 2 +- .../Plugins/IO/OFF_to_nef_io_plugin.cpp | 2 +- .../Polyhedron/Plugins/IO/PLY_io_plugin.cpp | 2 +- .../Plugins/IO/Polylines_io_plugin.cpp | 2 +- .../Polyhedron/Plugins/IO/STL_io_plugin.cpp | 2 +- .../Plugins/IO/Selection_io_plugin.cpp | 50 ------------------- .../Polyhedron/Plugins/IO/Surf_io_plugin.cpp | 2 +- .../Polyhedron/Plugins/IO/VTK_io_plugin.cpp | 2 +- .../Polyhedron/Plugins/IO/XYZ_io_plugin.cpp | 2 +- .../Polyhedron/Plugins/PMP/CMakeLists.txt | 2 +- .../Plugins/PMP/Selection_plugin.cpp | 42 ++++++++++++++-- Polyhedron/demo/Polyhedron/Preferences.ui | 4 +- .../Polyhedron/polyhedron_demo_macros.cmake | 1 + 19 files changed, 71 insertions(+), 84 deletions(-) delete mode 100644 Polyhedron/demo/Polyhedron/Plugins/IO/Selection_io_plugin.cpp diff --git a/Polyhedron/demo/Polyhedron/Details.ui b/Polyhedron/demo/Polyhedron/Details.ui index 3604c07a41c..459cc4ce2c6 100644 --- a/Polyhedron/demo/Polyhedron/Details.ui +++ b/Polyhedron/demo/Polyhedron/Details.ui @@ -16,6 +16,9 @@ + + true + 1 diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/IO/CMakeLists.txt index 45ecd036a1c..d4003050c8f 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/IO/CMakeLists.txt @@ -1,32 +1,29 @@ include( polyhedron_demo_macros ) -polyhedron_demo_plugin(gocad_plugin GOCAD_io_plugin) +polyhedron_demo_plugin(gocad_plugin GOCAD_io_plugin KEYWORDS IO) target_link_libraries(gocad_plugin PUBLIC scene_surface_mesh_item) qt5_wrap_ui( funcUI_FILES Function_dialog.ui ) -polyhedron_demo_plugin(io_implicit_function_plugin Implicit_function_io_plugin ${funcUI_FILES}) +polyhedron_demo_plugin(io_implicit_function_plugin Implicit_function_io_plugin ${funcUI_FILES} KEYWORDS IO) target_link_libraries(io_implicit_function_plugin PUBLIC scene_implicit_function_item) -polyhedron_demo_plugin(nef_io_plugin Nef_io_plugin) +polyhedron_demo_plugin(nef_io_plugin Nef_io_plugin KEYWORDS IO) target_link_libraries(nef_io_plugin PUBLIC scene_nef_polyhedron_item) -polyhedron_demo_plugin(off_plugin OFF_io_plugin) +polyhedron_demo_plugin(off_plugin OFF_io_plugin KEYWORDS IO) target_link_libraries(off_plugin PUBLIC scene_polygon_soup_item scene_points_with_normal_item scene_surface_mesh_item) -polyhedron_demo_plugin(off_to_nef_plugin OFF_to_nef_io_plugin) +polyhedron_demo_plugin(off_to_nef_plugin OFF_to_nef_io_plugin KEYWORDS IO) target_link_libraries(off_to_nef_plugin PUBLIC scene_nef_polyhedron_item) -polyhedron_demo_plugin(polylines_io_plugin Polylines_io_plugin) +polyhedron_demo_plugin(polylines_io_plugin Polylines_io_plugin KEYWORDS IO) target_link_libraries(polylines_io_plugin PUBLIC scene_polylines_item) -polyhedron_demo_plugin(selection_io_plugin Selection_io_plugin) -target_link_libraries(selection_io_plugin PUBLIC scene_selection_item selection_plugin) - -polyhedron_demo_plugin(stl_plugin STL_io_plugin) +polyhedron_demo_plugin(stl_plugin STL_io_plugin KEYWORDS IO) target_link_libraries(stl_plugin PUBLIC scene_surface_mesh_item scene_polygon_soup_item) -polyhedron_demo_plugin(surf_io_plugin Surf_io_plugin) +polyhedron_demo_plugin(surf_io_plugin Surf_io_plugin KEYWORDS IO) target_link_libraries(surf_io_plugin PUBLIC scene_surface_mesh_item) @@ -37,7 +34,7 @@ if (VTK_FOUND) include(${VTK_USE_FILE}) if ("${VTK_VERSION_MAJOR}" GREATER "5") if(VTK_LIBRARIES) - polyhedron_demo_plugin(vtk_plugin VTK_io_plugin) + polyhedron_demo_plugin(vtk_plugin VTK_io_plugin KEYWORDS IO) target_link_libraries(vtk_plugin PUBLIC scene_surface_mesh_item scene_polylines_item scene_c3t3_item vtkCommonCore vtkIOCore vtkIOLegacy vtkIOXML vtkFiltersCore vtkFiltersSources) @@ -51,7 +48,7 @@ if (VTK_FOUND) else() message(STATUS "NOTICE : the vtk IO plugin needs VTK 6.0 or greater and will not be compiled.") endif() -polyhedron_demo_plugin(xyz_plugin XYZ_io_plugin) +polyhedron_demo_plugin(xyz_plugin XYZ_io_plugin KEYWORDS IO) target_link_libraries(xyz_plugin PUBLIC scene_points_with_normal_item) list(FIND CMAKE_CXX_COMPILE_FEATURES cxx_rvalue_references has_cxx_rvalues) @@ -62,12 +59,12 @@ if(has_cxx_rvalues LESS 0 OR has_cxx_variadic LESS 0) else() set(needed_cxx_features cxx_rvalue_references cxx_variadic_templates) - polyhedron_demo_plugin(ply_plugin PLY_io_plugin) + polyhedron_demo_plugin(ply_plugin PLY_io_plugin KEYWORDS IO) target_link_libraries(ply_plugin PUBLIC scene_points_with_normal_item scene_polygon_soup_item scene_surface_mesh_item scene_polygon_soup_item) target_compile_features(ply_plugin PRIVATE ${needed_cxx_features}) if (LASLIB_FOUND) - polyhedron_demo_plugin(las_plugin LAS_io_plugin) + polyhedron_demo_plugin(las_plugin LAS_io_plugin KEYWORDS IO) target_link_libraries(las_plugin PUBLIC scene_points_with_normal_item ${LASLIB_LIBRARIES}) target_compile_features(las_plugin PRIVATE ${needed_cxx_features}) else() diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/GOCAD_io_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/IO/GOCAD_io_plugin.cpp index 243f3f947a7..d5316ad04f6 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/GOCAD_io_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/IO/GOCAD_io_plugin.cpp @@ -22,8 +22,8 @@ class Polyhedron_demo_gocad_plugin : { Q_OBJECT Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface CGAL::Three::Polyhedron_demo_io_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0") + Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "gocad_io_plugin.json") + Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0" ) public: void init(QMainWindow* mainWindow, diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/Implicit_function_io_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/IO/Implicit_function_io_plugin.cpp index d6502c608d4..928e974cf8b 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/Implicit_function_io_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/IO/Implicit_function_io_plugin.cpp @@ -47,7 +47,7 @@ class Io_implicit_function_plugin : { Q_OBJECT Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "implicit_function_io_plugin.json") public: Io_implicit_function_plugin(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/LAS_io_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/IO/LAS_io_plugin.cpp index bd7fef56910..37878451544 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/LAS_io_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/IO/LAS_io_plugin.cpp @@ -9,7 +9,7 @@ class Polyhedron_demo_las_plugin : { Q_OBJECT Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0") + Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0" FILE "las_io_plugin.json") public: QString name() const { return "las_plugin"; } diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/Nef_io_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/IO/Nef_io_plugin.cpp index 9a18386d813..499b2f7db4b 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/Nef_io_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/IO/Nef_io_plugin.cpp @@ -11,7 +11,7 @@ class Polyhedron_demo_io_nef_plugin : { Q_OBJECT Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "nef_io_plugin.json") public: QString nameFilters() const; diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/OFF_io_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/IO/OFF_io_plugin.cpp index aa064d2952f..c2cbb3c5684 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/OFF_io_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/IO/OFF_io_plugin.cpp @@ -21,7 +21,7 @@ class Polyhedron_demo_off_plugin : { Q_OBJECT Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0") + Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0" FILE "off_io_plugin.json") public: bool isDefaultLoader(const Scene_item *item) const diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/OFF_to_nef_io_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/IO/OFF_to_nef_io_plugin.cpp index 0ac3e1f8b0e..cd557823bd8 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/OFF_to_nef_io_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/IO/OFF_to_nef_io_plugin.cpp @@ -10,7 +10,7 @@ class Polyhedron_demo_off_to_nef_plugin : { Q_OBJECT Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0") + Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0" FILE "off_to_nef_io_plugin.json") public: QString name() const { return "off_to_nef_plugin"; } diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/PLY_io_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/IO/PLY_io_plugin.cpp index ed37933d0e4..0a57fac8fee 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/PLY_io_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/IO/PLY_io_plugin.cpp @@ -19,7 +19,7 @@ class Polyhedron_demo_ply_plugin : { Q_OBJECT Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0") + Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0" FILE "ply_io_plugin.json") public: bool isDefaultLoader(const CGAL::Three::Scene_item *item) const diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/Polylines_io_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/IO/Polylines_io_plugin.cpp index e4997939f80..0c4a3308503 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/Polylines_io_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/IO/Polylines_io_plugin.cpp @@ -16,7 +16,7 @@ class Polyhedron_demo_polylines_io_plugin : { Q_OBJECT Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface CGAL::Three::Polyhedron_demo_io_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "polylines_io_plugin.json") Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0") diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/STL_io_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/IO/STL_io_plugin.cpp index 0bcfbaba51a..4591567722f 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/STL_io_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/IO/STL_io_plugin.cpp @@ -29,7 +29,7 @@ class Polyhedron_demo_stl_plugin : { Q_OBJECT Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface CGAL::Three::Polyhedron_demo_io_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "stl_io_plugin.json") Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0") public: diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/Selection_io_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/IO/Selection_io_plugin.cpp deleted file mode 100644 index bbbfe24bf58..00000000000 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/Selection_io_plugin.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include "Scene_polyhedron_selection_item.h" -#include -#include -#include -using namespace CGAL::Three; -class Polyhedron_demo_selection_io_plugin : - public QObject, - public Polyhedron_demo_io_plugin_interface -{ - Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") -public: - - QString name() const { return "selection_io_sm_plugin"; } - QString nameFilters() const { return "Selection files(*.selection.txt)"; } - - bool canLoad() const { - Scene_facegraph_item* sel_item = qobject_cast(CGAL::Three::Three::scene()->item( - CGAL::Three::Three::scene()->mainSelectionIndex())); - if(sel_item) - return true; - return false; - } - CGAL::Three::Scene_item* load(QFileInfo fileinfo) { - if(fileinfo.suffix().toLower() != "txt") return 0; - // There will be no actual loading at this step. - // Polyhedron_demo_selection_plugin will trigger load when item in new_item_created - Scene_polyhedron_selection_item* item = new Scene_polyhedron_selection_item(); - if(!item->load(fileinfo.filePath().toStdString())) { - delete item; - return NULL; - } - item->setName(fileinfo.baseName()); - return item; - } - - bool canSave(const CGAL::Three::Scene_item* scene_item) { - return qobject_cast(scene_item); - } - bool save(const CGAL::Three::Scene_item* scene_item, QFileInfo fileinfo) { - const Scene_polyhedron_selection_item* item = qobject_cast(scene_item); - if(item == NULL) { return false; } - - return item->save(fileinfo.filePath().toStdString()); - } -}; - -#include -#include "Selection_io_plugin.moc" diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/Surf_io_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/IO/Surf_io_plugin.cpp index becb78272b1..87b7e5c5a4e 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/Surf_io_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/IO/Surf_io_plugin.cpp @@ -24,7 +24,7 @@ class Surf_io_plugin: { Q_OBJECT Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface CGAL::Three::Polyhedron_demo_io_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "surf_io_plugin.json") Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0") public: diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/VTK_io_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/IO/VTK_io_plugin.cpp index 29d0217948b..dc0b4712f5f 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/VTK_io_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/IO/VTK_io_plugin.cpp @@ -271,7 +271,7 @@ class Polyhedron_demo_vtk_plugin : { Q_OBJECT Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0") + Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0" FILE "vtk_io_plugin.json") public: typedef boost::graph_traits::vertex_descriptor vertex_descriptor; diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/XYZ_io_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/IO/XYZ_io_plugin.cpp index 3228bf27d90..17873a0081f 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/XYZ_io_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/IO/XYZ_io_plugin.cpp @@ -15,7 +15,7 @@ class Polyhedron_demo_xyz_plugin : { Q_OBJECT Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0") + Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0" FILE "xyz_io_plugin.json") public: diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/PMP/CMakeLists.txt index 9be832c313a..558f9aa2539 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/CMakeLists.txt @@ -64,7 +64,7 @@ polyhedron_demo_plugin(polyhedron_stitching_plugin Polyhedron_stitching_plugin) target_link_libraries(polyhedron_stitching_plugin PUBLIC scene_surface_mesh_item scene_polylines_item) qt5_wrap_ui( selectionUI_FILES Selection_widget.ui) -add_library(selection_plugin SHARED Selection_plugin.cpp ${selectionUI_FILES}) +polyhedron_demo_plugin(selection_plugin Selection_plugin ${selectionUI_FILES} KEYWORDS PolygonMesh IO) target_link_libraries(selection_plugin PUBLIC scene_selection_item scene_points_with_normal_item scene_polylines_item) polyhedron_demo_plugin(self_intersection_plugin Self_intersection_plugin) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Selection_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Selection_plugin.cpp index 95e2fbd401f..1fbaeb2dfd2 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Selection_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Selection_plugin.cpp @@ -11,6 +11,8 @@ #include #include +#include +#include #include "ui_Selection_widget.h" #include @@ -66,12 +68,46 @@ struct Polyline_visitor using namespace CGAL::Three; class Polyhedron_demo_selection_plugin : public QObject, - public Polyhedron_demo_plugin_helper + public Polyhedron_demo_plugin_helper, + public Polyhedron_demo_io_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface CGAL::Three::Polyhedron_demo_io_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "selection_plugin.json") + Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0") public: + QString nameFilters() const { return "Selection files(*.selection.txt)"; } + QString name() const { return "selection_sm_plugin"; } + + bool canLoad() const { + Scene_facegraph_item* sel_item = qobject_cast(CGAL::Three::Three::scene()->item( + CGAL::Three::Three::scene()->mainSelectionIndex())); + if(sel_item) + return true; + return false; + } + CGAL::Three::Scene_item* load(QFileInfo fileinfo) { + if(fileinfo.suffix().toLower() != "txt") return 0; + // There will be no actual loading at this step. + Scene_polyhedron_selection_item* item = new Scene_polyhedron_selection_item(); + if(!item->load(fileinfo.filePath().toStdString())) { + delete item; + return NULL; + } + item->setName(fileinfo.baseName()); + return item; + } + + bool canSave(const CGAL::Three::Scene_item* scene_item) { + return qobject_cast(scene_item); + } + bool save(const CGAL::Three::Scene_item* scene_item, QFileInfo fileinfo) { + const Scene_polyhedron_selection_item* item = qobject_cast(scene_item); + if(item == NULL) { return false; } + + return item->save(fileinfo.filePath().toStdString()); + } + bool applicable(QAction*) const { return qobject_cast(scene->item(scene->mainSelectionIndex())) || qobject_cast(scene->item(scene->mainSelectionIndex())); diff --git a/Polyhedron/demo/Polyhedron/Preferences.ui b/Polyhedron/demo/Polyhedron/Preferences.ui index 15972abadd9..032ad976422 100644 --- a/Polyhedron/demo/Polyhedron/Preferences.ui +++ b/Polyhedron/demo/Polyhedron/Preferences.ui @@ -242,10 +242,10 @@ - false + true - QAbstractItemView::MultiSelection + QAbstractItemView::ExtendedSelection QAbstractItemView::SelectRows diff --git a/Polyhedron/demo/Polyhedron/polyhedron_demo_macros.cmake b/Polyhedron/demo/Polyhedron/polyhedron_demo_macros.cmake index b198ca87326..303b9922f0e 100644 --- a/Polyhedron/demo/Polyhedron/polyhedron_demo_macros.cmake +++ b/Polyhedron/demo/Polyhedron/polyhedron_demo_macros.cmake @@ -49,6 +49,7 @@ include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) SET(filename "${CMAKE_CURRENT_BINARY_DIR}/${base_name}") LIST(LENGTH ARG_KEYWORDS size) if(${size} GREATER 0) + SET(keywords ) FILE(WRITE ${filename} "{ \"Keywords\" : [") foreach(keyword ${ARG_KEYWORDS}) LIST(APPEND keywords "\"${keyword}\", ") From 4a837907867faaf83c70c278f4852d8a5453d852 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Fri, 19 Oct 2018 14:03:47 +0200 Subject: [PATCH 041/193] Add an executable for a Mesh_3 demo derived from the polyhedron_demo --- Polyhedron/demo/Polyhedron/CMakeLists.txt | 8 ++++- Polyhedron/demo/Polyhedron/Mesh_3.cpp | 29 +++++++++++++++++++ .../demo/Polyhedron/Plugins/IO/CMakeLists.txt | 8 ++--- .../Plugins/Mesh_3/C3t3_io_plugin.cpp | 2 +- .../Mesh_3/C3t3_rib_exporter_plugin.cpp | 2 +- .../Polyhedron/Plugins/Mesh_3/CMakeLists.txt | 10 +++---- .../Plugins/Mesh_3/Io_image_plugin.cpp | 2 +- .../Plugins/Mesh_3/Mesh_3_plugin.cpp | 2 +- .../Plugins/Mesh_3/Optimization_plugin.cpp | 2 +- .../implicit_functions/CMakeLists.txt | 6 ++-- .../Klein_implicit_function.cpp | 2 +- .../Sphere_implicit_function.cpp | 2 +- .../Tanglecube_implicit_function.cpp | 2 +- 13 files changed, 56 insertions(+), 21 deletions(-) create mode 100644 Polyhedron/demo/Polyhedron/Mesh_3.cpp diff --git a/Polyhedron/demo/Polyhedron/CMakeLists.txt b/Polyhedron/demo/Polyhedron/CMakeLists.txt index 234aa1c9cf6..79896a75808 100644 --- a/Polyhedron/demo/Polyhedron/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/CMakeLists.txt @@ -344,7 +344,13 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND ) add_subdirectory( implicit_functions ) - +# +# EXECUTABLES +# +add_executable ( CGAL_Mesh_3 Mesh_3.cpp ) +add_dependencies(CGAL_Mesh_3 Mesh_3) +target_link_libraries( CGAL_Mesh_3 PRIVATE polyhedron_demo ) +add_to_cached_list( CGAL_EXECUTABLE_TARGETS CGAL_Mesh_3 ) # # Exporting # diff --git a/Polyhedron/demo/Polyhedron/Mesh_3.cpp b/Polyhedron/demo/Polyhedron/Mesh_3.cpp new file mode 100644 index 00000000000..10070f21a59 --- /dev/null +++ b/Polyhedron/demo/Polyhedron/Mesh_3.cpp @@ -0,0 +1,29 @@ +#include "Polyhedron_demo.h" +#include +#include +#include + + +/*! + * \brief Defines the entry point of the demo. + * Creates the application and sets a main window. + */ +int main(int argc, char **argv) +{ + QSurfaceFormat fmt; + + fmt.setVersion(4, 3); + fmt.setRenderableType(QSurfaceFormat::OpenGL); + fmt.setProfile(QSurfaceFormat::CoreProfile); + fmt.setOption(QSurfaceFormat::DebugContext); + QSurfaceFormat::setDefaultFormat(fmt); + QStringList keywords; + keywords << "Mesh_3"; + Polyhedron_demo app(argc, argv, + "Mesh_3 demo", + "CGAL Mesh_3 Demo", + keywords); + //We set the locale to avoid any trouble with VTK + std::setlocale(LC_ALL, "C"); + return app.try_exec(); +} diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/IO/CMakeLists.txt index d4003050c8f..4a642daba09 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/IO/CMakeLists.txt @@ -4,19 +4,19 @@ polyhedron_demo_plugin(gocad_plugin GOCAD_io_plugin KEYWORDS IO) target_link_libraries(gocad_plugin PUBLIC scene_surface_mesh_item) qt5_wrap_ui( funcUI_FILES Function_dialog.ui ) -polyhedron_demo_plugin(io_implicit_function_plugin Implicit_function_io_plugin ${funcUI_FILES} KEYWORDS IO) +polyhedron_demo_plugin(io_implicit_function_plugin Implicit_function_io_plugin ${funcUI_FILES} KEYWORDS IO Mesh_3) target_link_libraries(io_implicit_function_plugin PUBLIC scene_implicit_function_item) polyhedron_demo_plugin(nef_io_plugin Nef_io_plugin KEYWORDS IO) target_link_libraries(nef_io_plugin PUBLIC scene_nef_polyhedron_item) -polyhedron_demo_plugin(off_plugin OFF_io_plugin KEYWORDS IO) +polyhedron_demo_plugin(off_plugin OFF_io_plugin KEYWORDS IO Mesh_3) target_link_libraries(off_plugin PUBLIC scene_polygon_soup_item scene_points_with_normal_item scene_surface_mesh_item) polyhedron_demo_plugin(off_to_nef_plugin OFF_to_nef_io_plugin KEYWORDS IO) target_link_libraries(off_to_nef_plugin PUBLIC scene_nef_polyhedron_item) -polyhedron_demo_plugin(polylines_io_plugin Polylines_io_plugin KEYWORDS IO) +polyhedron_demo_plugin(polylines_io_plugin Polylines_io_plugin KEYWORDS IO Mesh_3) target_link_libraries(polylines_io_plugin PUBLIC scene_polylines_item) polyhedron_demo_plugin(stl_plugin STL_io_plugin KEYWORDS IO) @@ -34,7 +34,7 @@ if (VTK_FOUND) include(${VTK_USE_FILE}) if ("${VTK_VERSION_MAJOR}" GREATER "5") if(VTK_LIBRARIES) - polyhedron_demo_plugin(vtk_plugin VTK_io_plugin KEYWORDS IO) + polyhedron_demo_plugin(vtk_plugin VTK_io_plugin KEYWORDS IO Mesh_3) target_link_libraries(vtk_plugin PUBLIC scene_surface_mesh_item scene_polylines_item scene_c3t3_item vtkCommonCore vtkIOCore vtkIOLegacy vtkIOXML vtkFiltersCore vtkFiltersSources) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/C3t3_io_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/C3t3_io_plugin.cpp index f71a15aff64..b3009ddef89 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/C3t3_io_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/C3t3_io_plugin.cpp @@ -17,7 +17,7 @@ class Polyhedron_demo_c3t3_binary_io_plugin : Q_OBJECT Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface) Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "c3t3_io_plugin.json") public: void init(QMainWindow*, CGAL::Three::Scene_interface* sc, Messages_interface*) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/C3t3_rib_exporter_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/C3t3_rib_exporter_plugin.cpp index 35c1bfd2529..6bfb5b7e468 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/C3t3_rib_exporter_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/C3t3_rib_exporter_plugin.cpp @@ -36,7 +36,7 @@ class C3t3_rib_exporter_plugin : { Q_OBJECT Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "c3t3_rib_exporter_plugin.json") public: C3t3_rib_exporter_plugin(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt index 7b420f5c6a3..641279dce31 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt @@ -8,7 +8,7 @@ if ( Boost_VERSION GREATER 103400 ) qt5_wrap_ui( meshingUI_FILES Meshing_dialog.ui Smoother_dialog.ui Local_optimizers_dialog.ui ) polyhedron_demo_plugin(mesh_3_plugin Mesh_3_plugin Mesh_3_plugin_cgal_code.cpp Meshing_thread.cpp split_polylines.cpp - ${meshingUI_FILES}) + ${meshingUI_FILES} KEYWORDS Mesh_3) target_link_libraries(mesh_3_plugin PUBLIC scene_polygon_soup_item scene_polylines_item scene_implicit_function_item scene_image_item scene_surface_mesh_item scene_c3t3_item ${OPENGL_gl_LIBRARY} ) @@ -32,7 +32,7 @@ if ( Boost_VERSION GREATER 103400 ) endif() if(Boost_FILESYSTEM_FOUND) qt5_wrap_ui( imgUI_FILES Image_res_dialog.ui raw_image.ui) - polyhedron_demo_plugin(io_image_plugin Io_image_plugin Volume_plane_intersection.cpp Raw_image_dialog.cpp ${imgUI_FILES} ${VOLUME_MOC_OUTFILES}) + polyhedron_demo_plugin(io_image_plugin Io_image_plugin Volume_plane_intersection.cpp Raw_image_dialog.cpp ${imgUI_FILES} ${VOLUME_MOC_OUTFILES} KEYWORDS IO Mesh_3) target_link_libraries(io_image_plugin PUBLIC scene_image_item ${VTK_LIBS} ) target_link_libraries(io_image_plugin PUBLIC CGAL::CGAL_ImageIO) else() @@ -40,19 +40,19 @@ if ( Boost_VERSION GREATER 103400 ) endif() polyhedron_demo_plugin(mesh_3_optimization_plugin Optimization_plugin Optimization_plugin_cgal_code.cpp Optimizer_thread.cpp - ${meshingUI_FILES}) + ${meshingUI_FILES} KEYWORDS Mesh_3) target_link_libraries(mesh_3_optimization_plugin PUBLIC scene_c3t3_item scene_surface_mesh_item scene_image_item scene_implicit_function_item ) - polyhedron_demo_plugin(c3t3_io_plugin C3t3_io_plugin) + polyhedron_demo_plugin(c3t3_io_plugin C3t3_io_plugin KEYWORDS IO Mesh_3) target_link_libraries(c3t3_io_plugin PUBLIC scene_c3t3_item) else( Boost_VERSION GREATER 103400 ) message(STATUS "warning: the plugin mesh_3_plugin requires Boost>=1.34.1 and will not be compiled.") endif( Boost_VERSION GREATER 103400 ) qt5_wrap_ui( ribUI_FILES Rib_dialog.ui) -polyhedron_demo_plugin(c3t3_rib_exporter_plugin C3t3_rib_exporter_plugin ${ribUI_FILES}) +polyhedron_demo_plugin(c3t3_rib_exporter_plugin C3t3_rib_exporter_plugin ${ribUI_FILES} KEYWORDS Mesh_3) target_link_libraries(c3t3_rib_exporter_plugin PUBLIC scene_c3t3_item) if(TBB_FOUND) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp index de932675d50..daa59d5f61e 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp @@ -202,7 +202,7 @@ class Io_image_plugin : Q_OBJECT Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface) Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0") + Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0" FILE "io_image_plugin.json") public: 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 f249bb1455b..0aa08236a39 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp @@ -45,7 +45,7 @@ class Mesh_3_plugin : { Q_OBJECT Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "mesh_3_plugin.json") public: void init(QMainWindow* mainWindow, diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Optimization_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Optimization_plugin.cpp index 43a63d2df36..344ab89ad0d 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Optimization_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Optimization_plugin.cpp @@ -79,7 +79,7 @@ class Mesh_3_optimization_plugin : { Q_OBJECT Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "optimization_plugin.json") typedef Polyhedron_demo_plugin_interface Base; public: diff --git a/Polyhedron/demo/Polyhedron/implicit_functions/CMakeLists.txt b/Polyhedron/demo/Polyhedron/implicit_functions/CMakeLists.txt index 4b2382a5315..1640cbea6ac 100644 --- a/Polyhedron/demo/Polyhedron/implicit_functions/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/implicit_functions/CMakeLists.txt @@ -39,9 +39,9 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND) include(AddFileDependencies) remove_definitions(-DQT_STATICPLUGIN) - polyhedron_demo_plugin(p_sphere_function_plugin Sphere_implicit_function) - polyhedron_demo_plugin(p_tanglecube_function_plugin Tanglecube_implicit_function) - polyhedron_demo_plugin(p_klein_function_plugin Klein_implicit_function) + polyhedron_demo_plugin(p_sphere_function_plugin Sphere_implicit_function KEYWORDS Mesh_3) + polyhedron_demo_plugin(p_tanglecube_function_plugin Tanglecube_implicit_function KEYWORDS Mesh_3) + polyhedron_demo_plugin(p_klein_function_plugin Klein_implicit_function KEYWORDS Mesh_3) else (CGAL_Qt5_FOUND AND Qt5_FOUND) diff --git a/Polyhedron/demo/Polyhedron/implicit_functions/Klein_implicit_function.cpp b/Polyhedron/demo/Polyhedron/implicit_functions/Klein_implicit_function.cpp index 650b249bcb8..ec6b2c66a78 100644 --- a/Polyhedron/demo/Polyhedron/implicit_functions/Klein_implicit_function.cpp +++ b/Polyhedron/demo/Polyhedron/implicit_functions/Klein_implicit_function.cpp @@ -32,7 +32,7 @@ class Klein_implicit_function : { Q_OBJECT Q_INTERFACES(Implicit_function_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.Mesh3Demo.Implicit_function_interface/1.0") + Q_PLUGIN_METADATA(IID "com.geometryfactory.Mesh3Demo.Implicit_function_interface/1.0" FILE "klein_implicit_function.json") public: virtual QString name() const { return "Klein function"; } diff --git a/Polyhedron/demo/Polyhedron/implicit_functions/Sphere_implicit_function.cpp b/Polyhedron/demo/Polyhedron/implicit_functions/Sphere_implicit_function.cpp index 5d1f62cef17..d5b5de4980a 100644 --- a/Polyhedron/demo/Polyhedron/implicit_functions/Sphere_implicit_function.cpp +++ b/Polyhedron/demo/Polyhedron/implicit_functions/Sphere_implicit_function.cpp @@ -35,7 +35,7 @@ class Sphere_implicit_function : { Q_OBJECT Q_INTERFACES(Implicit_function_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.Mesh3Demo.Implicit_function_interface/1.0") + Q_PLUGIN_METADATA(IID "com.geometryfactory.Mesh3Demo.Implicit_function_interface/1.0" FILE "sphere_implicit_function.json") public: virtual QString name() const { return "Sphere function"; } diff --git a/Polyhedron/demo/Polyhedron/implicit_functions/Tanglecube_implicit_function.cpp b/Polyhedron/demo/Polyhedron/implicit_functions/Tanglecube_implicit_function.cpp index bf2223f43f1..4d7a04fee30 100644 --- a/Polyhedron/demo/Polyhedron/implicit_functions/Tanglecube_implicit_function.cpp +++ b/Polyhedron/demo/Polyhedron/implicit_functions/Tanglecube_implicit_function.cpp @@ -35,7 +35,7 @@ class Tanglecube_implicit_function : { Q_OBJECT Q_INTERFACES(Implicit_function_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.Mesh3Demo.Implicit_function_interface/1.0") + Q_PLUGIN_METADATA(IID "com.geometryfactory.Mesh3Demo.Implicit_function_interface/1.0" FILE "tanglecube_implicit_function.json") public: virtual QString name() const { return "Tanglecube function"; } From 71d98ffbdb3ad97cb650d96d2617041065a8149b Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Mon, 5 Nov 2018 13:27:11 +0100 Subject: [PATCH 042/193] Fix remaining "setRbgColor" --- .../demo/Polyhedron/Plugins/PMP/Hole_filling_plugin.cpp | 4 ++-- .../Plugins/Point_set/Point_set_shape_detection_plugin.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Hole_filling_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Hole_filling_plugin.cpp index 5199a7fe048..88523da2286 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Hole_filling_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Hole_filling_plugin.cpp @@ -125,9 +125,9 @@ public: else { it->polyline->setWidth(3); } if(selected_holes.find(it) != selected_holes.end()) - { it->polyline->setRbgColor(255, 0, 0); } + { it->polyline->setRgbColor(255, 0, 0); } else - { it->polyline->setRbgColor(0, 0, 255); } + { it->polyline->setRgbColor(0, 0, 255); } it->polyline->drawEdges(viewer); } diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.cpp index 1f138064785..c433fa2ebec 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.cpp @@ -346,7 +346,7 @@ private: g = static_cast(64 + rand.get_int(0, 192)); b = static_cast(64 + rand.get_int(0, 192)); - point_item->setRbgColor(r, g, b); + point_item->setRgbColor(r, g, b); std::size_t nb_colored_pts = 0; if (dialog.generate_colored_point_set()) From bb19c965f9e39ca067fa64c3a0aa4c0e59d32b9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 11 Oct 2018 10:05:37 +0200 Subject: [PATCH 043/193] Moved helper struct outside of TBB macros to fix sequential compilation --- .../include/CGAL/Regular_triangulation_3.h | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/Triangulation_3/include/CGAL/Regular_triangulation_3.h b/Triangulation_3/include/CGAL/Regular_triangulation_3.h index 8c01c687981..36ea66b4765 100644 --- a/Triangulation_3/include/CGAL/Regular_triangulation_3.h +++ b/Triangulation_3/include/CGAL/Regular_triangulation_3.h @@ -763,6 +763,25 @@ namespace CGAL { return std::copy(vertices.begin(), vertices.end(), res); } + // In parallel operations, we need to be able to check the health of the 'hint' vertex handle, + // which might be invalided by other threads. One way to do that is the 'is_vertex()' function + // of the TDS, but it runs in O(sqrt(n)) complexity. When we are using our TDS, we can use + // a lower level function from the compact container, which runs in constant time. + template + struct Vertex_validity_checker + { + bool operator()(const typename TDS_::Vertex_handle vh_, const TDS_& tds_) { return tds_.is_vertex(vh_); } + }; + + template + struct Vertex_validity_checker > + { + typedef CGAL::Triangulation_data_structure_3 TDS_; + + bool operator()(const typename TDS_::Vertex_handle vh_, const TDS_& tds_) { + return tds_.vertices().is_used(vh_); } + }; + void remove (Vertex_handle v); // Concurrency-safe // See Triangulation_3::remove for more information @@ -1291,25 +1310,6 @@ namespace CGAL { } }; - // In parallel operations, we need to be able to check the health of the 'hint' vertex handle, - // which might be invalided by other threads. One way to do that is the 'is_vertex()' function - // of the TDS, but it runs in O(sqrt(n)) complexity. When we are using our TDS, we can use - // a lower level function from the compact container, which runs in constant time. - template - struct Vertex_validity_checker - { - bool operator()(const typename TDS_::Vertex_handle vh_, const TDS_& tds_) { return tds_.is_vertex(vh_); } - }; - - template - struct Vertex_validity_checker > - { - typedef CGAL::Triangulation_data_structure_3 TDS_; - - bool operator()(const typename TDS_::Vertex_handle vh_, const TDS_& tds_) { - return tds_.vertices().is_used(vh_); } - }; - // Functor for parallel insert(begin, end) function template class Insert_point From 82e458da80106dadbd7eae6b230fc699ed9b6172 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Wed, 14 Nov 2018 07:57:07 +0100 Subject: [PATCH 044/193] Replaced TDS template specialization with tag-based detection --- .../CGAL/Triangulation_data_structure_3.h | 6 ++++- .../include/CGAL/Regular_triangulation_3.h | 25 ++++++++++++++----- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/TDS_3/include/CGAL/Triangulation_data_structure_3.h b/TDS_3/include/CGAL/Triangulation_data_structure_3.h index 09981b25aa3..54b0a7cb213 100644 --- a/TDS_3/include/CGAL/Triangulation_data_structure_3.h +++ b/TDS_3/include/CGAL/Triangulation_data_structure_3.h @@ -77,9 +77,13 @@ class Triangulation_data_structure_3 typedef Triangulation_data_structure_3 Tds; public: - typedef Concurrency_tag_ Concurrency_tag; + // This tag is used in the parallel operations of RT_3 to access some functions + // of the TDS (tds.vertices().is_used(Vertex_handle)) that are much more efficient + // than what is exposed by the TDS concept (tds.is_vertex(Vertex_handle)). + typedef CGAL::Tag_true Is_CGAL_TDS_3; + // Tools to change the Vertex and Cell types of the TDS. template < typename Vb2 > struct Rebind_vertex { diff --git a/Triangulation_3/include/CGAL/Regular_triangulation_3.h b/Triangulation_3/include/CGAL/Regular_triangulation_3.h index 36ea66b4765..a351e78ae33 100644 --- a/Triangulation_3/include/CGAL/Regular_triangulation_3.h +++ b/Triangulation_3/include/CGAL/Regular_triangulation_3.h @@ -767,19 +767,32 @@ namespace CGAL { // which might be invalided by other threads. One way to do that is the 'is_vertex()' function // of the TDS, but it runs in O(sqrt(n)) complexity. When we are using our TDS, we can use // a lower level function from the compact container, which runs in constant time. + BOOST_MPL_HAS_XXX_TRAIT_DEF(Is_CGAL_TDS_3) + + template ::value> + struct Is_CGAL_TDS_3 : public CGAL::Tag_false + { }; + template + struct Is_CGAL_TDS_3 : public CGAL::Boolean_tag + { }; + + template ::value> struct Vertex_validity_checker { - bool operator()(const typename TDS_::Vertex_handle vh_, const TDS_& tds_) { return tds_.is_vertex(vh_); } + bool operator()(const typename TDS_::Vertex_handle vh_, const TDS_& tds_) { + return tds_.is_vertex(vh_); + } }; - template - struct Vertex_validity_checker > + template + struct Vertex_validity_checker { - typedef CGAL::Triangulation_data_structure_3 TDS_; - bool operator()(const typename TDS_::Vertex_handle vh_, const TDS_& tds_) { - return tds_.vertices().is_used(vh_); } + return tds_.vertices().is_used(vh_); + } }; void remove (Vertex_handle v); From 66961f56f6cb4e3fc331efb521c2468845d9e9a8 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 14 Nov 2018 11:48:03 +0100 Subject: [PATCH 045/193] Add a way to ignore dataChanged() calls of the Scene to optimize big selection manipulation. Use it to make the visibility change of a selection of items instant instead of possibly very long. --- Polyhedron/demo/Polyhedron/MainWindow.cpp | 97 +++++++++++++--------- Polyhedron/demo/Polyhedron/MainWindow.h | 2 + Polyhedron/demo/Polyhedron/Scene.cpp | 12 ++- Polyhedron/demo/Polyhedron/Scene.h | 9 +- Three/include/CGAL/Three/Scene_interface.h | 13 ++- 5 files changed, 89 insertions(+), 44 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/MainWindow.cpp b/Polyhedron/demo/Polyhedron/MainWindow.cpp index c7bffa69bd3..551f8376fe4 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.cpp +++ b/Polyhedron/demo/Polyhedron/MainWindow.cpp @@ -134,6 +134,7 @@ MainWindow::~MainWindow() MainWindow::MainWindow(bool verbose, QWidget* parent) : CGAL::Qt::DemosMainWindow(parent) { + bbox_need_update = true; ui = new Ui::MainWindow; ui->setupUi(this); menuBar()->setNativeMenuBar(false); @@ -207,7 +208,7 @@ MainWindow::MainWindow(bool verbose, QWidget* parent) this, SLOT(removeManipulatedFrame(CGAL::Three::Scene_item*))); connect(scene, SIGNAL(updated_bbox(bool)), - this, SLOT(updateViewerBBox(bool))); + this, SLOT(invalidate_bbox())); connect(scene, SIGNAL(selectionChanged(int)), this, SLOT(selectSceneItem(int))); @@ -863,50 +864,54 @@ void MainWindow::error(QString text) { void MainWindow::updateViewerBBox(bool recenter = true) { - const Scene::Bbox bbox = scene->bbox(); + if(bbox_need_update) + { + const Scene::Bbox bbox = scene->bbox(); CGAL::qglviewer::Vec center = viewer->camera()->pivotPoint(); - const double xmin = bbox.xmin(); - const double ymin = bbox.ymin(); - const double zmin = bbox.zmin(); - const double xmax = bbox.xmax(); - const double ymax = bbox.ymax(); - const double zmax = bbox.zmax(); - - - CGAL::qglviewer::Vec - vec_min(xmin, ymin, zmin), - vec_max(xmax, ymax, zmax), - bbox_center((xmin+xmax)/2, (ymin+ymax)/2, (zmin+zmax)/2); - CGAL::qglviewer::Vec offset(0,0,0); - double l_dist = (std::max)((std::abs)(bbox_center.x - viewer->offset().x), - (std::max)((std::abs)(bbox_center.y - viewer->offset().y), - (std::abs)(bbox_center.z - viewer->offset().z))); - if((std::log2)(l_dist) > 13.0 ) - for(int i=0; i<3; ++i) + const double xmin = bbox.xmin(); + const double ymin = bbox.ymin(); + const double zmin = bbox.zmin(); + const double xmax = bbox.xmax(); + const double ymax = bbox.ymax(); + const double zmax = bbox.zmax(); + + + CGAL::qglviewer::Vec + vec_min(xmin, ymin, zmin), + vec_max(xmax, ymax, zmax), + bbox_center((xmin+xmax)/2, (ymin+ymax)/2, (zmin+zmax)/2); + CGAL::qglviewer::Vec offset(0,0,0); + double l_dist = (std::max)((std::abs)(bbox_center.x - viewer->offset().x), + (std::max)((std::abs)(bbox_center.y - viewer->offset().y), + (std::abs)(bbox_center.z - viewer->offset().z))); + if((std::log2)(l_dist) > 13.0 ) + for(int i=0; i<3; ++i) + { + offset[i] = -bbox_center[i]; + + } + if(offset != viewer->offset()) { - offset[i] = -bbox_center[i]; - + viewer->setOffset(offset); + for(int i=0; inumberOfEntries(); ++i) + { + scene->item(i)->invalidateOpenGLBuffers(); + scene->item(i)->itemChanged(); + } } - if(offset != viewer->offset()) - { - viewer->setOffset(offset); - for(int i=0; inumberOfEntries(); ++i) + + + viewer->setSceneBoundingBox(vec_min, + vec_max); + if(recenter) { - scene->item(i)->invalidateOpenGLBuffers(); - scene->item(i)->itemChanged(); + viewer->camera()->showEntireScene(); } - } - - - viewer->setSceneBoundingBox(vec_min, - vec_max); - if(recenter) - { - viewer->camera()->showEntireScene(); - } - else - { - viewer->camera()->setPivotPoint(center); + else + { + viewer->camera()->setPivotPoint(center); + } + bbox_need_update = false; } } @@ -1644,6 +1649,7 @@ void MainWindow::on_actionLoad_triggered() scene->item(scene->numberOfEntries()-1)->setColor(colors_[++nb_item]); } } + updateViewerBBox(true); } void MainWindow::on_actionSaveAs_triggered() @@ -1817,13 +1823,17 @@ void MainWindow::on_actionDuplicate_triggered() void MainWindow::on_actionShowHide_triggered() { + scene->cutDataUpdate(true); Q_FOREACH(QModelIndex index, sceneView->selectionModel()->selectedRows()) { int i = scene->getIdFromModelIndex(proxyModel->mapToSource(index)); CGAL::Three::Scene_item* item = scene->item(i); item->setVisible(!item->visible()); - scene->itemChanged(i); + item->redraw(); } + scene->cutDataUpdate(false); + scene->allItemsChanged(); + updateViewerBBox(false); } void MainWindow::on_actionSetPolyhedronA_triggered() @@ -2407,3 +2417,8 @@ void MainWindow::setDefaultSaveDir() QSettings settings; settings.setValue("default_saveas_dir", def_save_dir); } + +void MainWindow::invalidate_bbox() +{ + bbox_need_update = true; +} diff --git a/Polyhedron/demo/Polyhedron/MainWindow.h b/Polyhedron/demo/Polyhedron/MainWindow.h index cc543525563..0f5757030bf 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.h +++ b/Polyhedron/demo/Polyhedron/MainWindow.h @@ -436,11 +436,13 @@ public: public Q_SLOTS: void toggleFullScreen(); void setDefaultSaveDir(); + void invalidate_bbox(); private: QList visibleDockWidgets; QLineEdit operationSearchBar; QWidgetAction* searchAction; QString def_save_dir; + bool bbox_need_update; }; #endif // ifndef MAINWINDOW_H diff --git a/Polyhedron/demo/Polyhedron/Scene.cpp b/Polyhedron/demo/Polyhedron/Scene.cpp index 7e4e0fcf240..6cc9803391d 100644 --- a/Polyhedron/demo/Polyhedron/Scene.cpp +++ b/Polyhedron/demo/Polyhedron/Scene.cpp @@ -42,6 +42,7 @@ Scene::Scene(QObject* parent) this, SLOT(adjustIds(Scene_interface::Item_id))); picked = false; gl_init = false; + dont_emit_changes = false; } Scene::Item_id @@ -1175,6 +1176,8 @@ void Scene::itemChanged() void Scene::itemChanged(Item_id i) { + if(dont_emit_changes) + return; if(i < 0 || i >= m_entries.size()) return; @@ -1182,7 +1185,14 @@ void Scene::itemChanged(Item_id i) this->createIndex(i, LastColumn)); } -void Scene::itemChanged(CGAL::Three::Scene_item*) +void Scene::itemChanged(CGAL::Three::Scene_item*item ) +{ + if(dont_emit_changes) + return; + itemChanged(item_id(item)); +} + +void Scene::allItemsChanged() { Q_EMIT dataChanged(this->createIndex(0, 0), this->createIndex(m_entries.size() - 1, LastColumn)); diff --git a/Polyhedron/demo/Polyhedron/Scene.h b/Polyhedron/demo/Polyhedron/Scene.h index aa778970fb7..a605bef1b74 100644 --- a/Polyhedron/demo/Polyhedron/Scene.h +++ b/Polyhedron/demo/Polyhedron/Scene.h @@ -136,7 +136,11 @@ public: void zoomToPosition(QPoint point, CGAL::Three::Viewer_interface*) Q_DECL_OVERRIDE; - + void cutDataUpdate(bool b) Q_DECL_OVERRIDE + { + dont_emit_changes = b; + } + public Q_SLOTS: //!Specifies a group as Expanded for the Geometric Objects view void setExpanded(QModelIndex); @@ -146,6 +150,7 @@ public Q_SLOTS: void itemChanged(); void itemChanged(int i) Q_DECL_OVERRIDE; void itemChanged(CGAL::Three::Scene_item*) Q_DECL_OVERRIDE; + void allItemsChanged() Q_DECL_OVERRIDE; //!Transmits a CGAL::Three::Scene_item::itemVisibilityChanged() signal to the scene. void itemVisibilityChanged(); void itemVisibilityChanged(CGAL::Three::Scene_item*) Q_DECL_OVERRIDE; @@ -280,6 +285,8 @@ private: QOpenGLShaderProgram program; QOpenGLVertexArrayObject* vao; mutable QOpenGLBuffer vbo[2]; + //the scene will ignore the itemChanged() signals while this is true. + bool dont_emit_changes; }; // end class Scene diff --git a/Three/include/CGAL/Three/Scene_interface.h b/Three/include/CGAL/Three/Scene_interface.h index b6e39f9feb6..7dae3452615 100644 --- a/Three/include/CGAL/Three/Scene_interface.h +++ b/Three/include/CGAL/Three/Scene_interface.h @@ -144,11 +144,22 @@ public: //! Updates the information about `item` in the //! Geometric Objects list and redraws the scene. virtual void itemChanged(CGAL::Three::Scene_item* item) = 0; + //! + //! \brief Updates all the items in the SceneView. + //! + virtual void allItemsChanged() = 0; //! Re computes the scene Bbox without recentering it. virtual void itemVisibilityChanged(CGAL::Three::Scene_item*) = 0; //! Clears the current selection then sets the selected item to the target index. //! Used to update the selection in the Geometric Objects view. - virtual void setSelectedItem(Item_id) = 0; + virtual void setSelectedItem(Item_id) = 0; + //! \brief ignore data updating. + //! + //! This will ignore all the individual calls to `itemChanged()` until + //! `cutDataUpdate()` is called whith `b` being `false`. + //! Activate this when you know you will call allItemsChanged() after a loop. + //! + virtual void cutDataUpdate(bool b) =0; }; // end interface Scene_interface } } From cb168754cdac322eacaf6d83f31ccf1ddfc01595 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 15 Nov 2018 20:13:25 +0100 Subject: [PATCH 046/193] fix indentation --- Polyhedron/demo/Polyhedron/Scene.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Scene.cpp b/Polyhedron/demo/Polyhedron/Scene.cpp index 6cc9803391d..dbfaea95a7c 100644 --- a/Polyhedron/demo/Polyhedron/Scene.cpp +++ b/Polyhedron/demo/Polyhedron/Scene.cpp @@ -1178,8 +1178,8 @@ void Scene::itemChanged(Item_id i) { if(dont_emit_changes) return; - if(i < 0 || i >= m_entries.size()) - return; + if(i < 0 || i >= m_entries.size()) + return; Q_EMIT dataChanged(this->createIndex(i, 0), this->createIndex(i, LastColumn)); From f3e4183e60520e77f44c7892cc557a173b1c6472 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Mon, 19 Nov 2018 12:00:00 +0100 Subject: [PATCH 047/193] Rename functions. --- Polyhedron/demo/Polyhedron/MainWindow.cpp | 5 ++--- Polyhedron/demo/Polyhedron/Scene.h | 4 +++- Three/include/CGAL/Three/Scene_interface.h | 13 ++++++------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/MainWindow.cpp b/Polyhedron/demo/Polyhedron/MainWindow.cpp index 551f8376fe4..e77ec3a4e12 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.cpp +++ b/Polyhedron/demo/Polyhedron/MainWindow.cpp @@ -1823,7 +1823,7 @@ void MainWindow::on_actionDuplicate_triggered() void MainWindow::on_actionShowHide_triggered() { - scene->cutDataUpdate(true); + scene->setUpdatesEnabled(false); Q_FOREACH(QModelIndex index, sceneView->selectionModel()->selectedRows()) { int i = scene->getIdFromModelIndex(proxyModel->mapToSource(index)); @@ -1831,8 +1831,7 @@ void MainWindow::on_actionShowHide_triggered() item->setVisible(!item->visible()); item->redraw(); } - scene->cutDataUpdate(false); - scene->allItemsChanged(); + scene->setUpdatesEnabled(true); updateViewerBBox(false); } diff --git a/Polyhedron/demo/Polyhedron/Scene.h b/Polyhedron/demo/Polyhedron/Scene.h index a605bef1b74..3d83ffc1653 100644 --- a/Polyhedron/demo/Polyhedron/Scene.h +++ b/Polyhedron/demo/Polyhedron/Scene.h @@ -136,9 +136,11 @@ public: void zoomToPosition(QPoint point, CGAL::Three::Viewer_interface*) Q_DECL_OVERRIDE; - void cutDataUpdate(bool b) Q_DECL_OVERRIDE + void setUpdatesEnabled(bool b) Q_DECL_OVERRIDE { dont_emit_changes = b; + if(b) + allItemsChanged(); } public Q_SLOTS: diff --git a/Three/include/CGAL/Three/Scene_interface.h b/Three/include/CGAL/Three/Scene_interface.h index 7dae3452615..71d772a3263 100644 --- a/Three/include/CGAL/Three/Scene_interface.h +++ b/Three/include/CGAL/Three/Scene_interface.h @@ -144,10 +144,6 @@ public: //! Updates the information about `item` in the //! Geometric Objects list and redraws the scene. virtual void itemChanged(CGAL::Three::Scene_item* item) = 0; - //! - //! \brief Updates all the items in the SceneView. - //! - virtual void allItemsChanged() = 0; //! Re computes the scene Bbox without recentering it. virtual void itemVisibilityChanged(CGAL::Three::Scene_item*) = 0; //! Clears the current selection then sets the selected item to the target index. @@ -156,10 +152,13 @@ public: //! \brief ignore data updating. //! //! This will ignore all the individual calls to `itemChanged()` until - //! `cutDataUpdate()` is called whith `b` being `false`. - //! Activate this when you know you will call allItemsChanged() after a loop. + //! `setUpdatesEnabled()` is called whith `b` being `true`. //! - virtual void cutDataUpdate(bool b) =0; + virtual void setUpdatesEnabled(bool b) =0; + //! + //! \brief Updates all the items in the SceneView. + //! + virtual void allItemsChanged() = 0; }; // end interface Scene_interface } } From 6f5ba0ddfa49fc1b81eb7dfa1cc8578377e0c551 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 19 Nov 2018 14:26:05 +0100 Subject: [PATCH 048/193] handle clipping with clipper on border edge --- .../Corefinement/Face_graph_output_builder.h | 166 +++++++++++++----- .../Polygon_mesh_processing/test_pmp_clip.cpp | 22 +++ 2 files changed, 144 insertions(+), 44 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h index 5913eb21694..d9c52616549 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h @@ -504,11 +504,6 @@ public: halfedge_descriptor h2 = epp_it->second.first[&tm2]; halfedge_descriptor h2_opp = opposite(h2, tm2); - if (is_border_edge(h1,tm1) || is_border_edge(h2,tm2)){ - ++epp_it; - continue; - } - //vertices from tm1 vertex_descriptor p1 = target(next(h1_opp, tm1), tm1); vertex_descriptor p2 = target(next(h1, tm1), tm1); @@ -521,41 +516,53 @@ public: Node_id index_q2 = get_node_id(q2, vertex_to_node_id2); // set boolean for the position of p1 wrt to q1 and q2 - bool p1_eq_q1=false, p1_eq_q2=false; + bool p1_eq_q1=is_border(h1_opp, tm1), p1_eq_q2=p1_eq_q1; if (!is_border(h1_opp, tm1) && index_p1!=NID) { if (!is_border(h2_opp, tm2)) + { p1_eq_q1 = index_p1 == index_q1; + if (p1_eq_q1) + { + //mark coplanar facets if any + tm1_coplanar_faces.set(get(fids1, face(h1_opp, tm1))); + tm2_coplanar_faces.set(get(fids2, face(h2_opp, tm2))); + } + } if (!is_border(h2, tm2)) + { p1_eq_q2 = index_p1 == index_q2; + if (p1_eq_q2) + { + //mark coplanar facets if any + tm1_coplanar_faces.set(get(fids1, face(h1_opp, tm1))); + tm2_coplanar_faces.set(get(fids2, face(h2, tm2))); + } + } } // set boolean for the position of p2 wrt to q1 and q2 - bool p2_eq_q1=false, p2_eq_q2=false; + bool p2_eq_q1=is_border(h1, tm1), p2_eq_q2=p2_eq_q1; if (!is_border(h1, tm1) && index_p2!=NID) { if (!is_border(h2_opp, tm2)) + { p2_eq_q1 = index_p2 == index_q1; + if (p2_eq_q1){ + //mark coplanar facets if any + tm1_coplanar_faces.set(get(fids1, face(h1, tm1))); + tm2_coplanar_faces.set(get(fids2, face(h2_opp, tm2))); + } + } if (!is_border(h2, tm2)) + { p2_eq_q2 = index_p2 == index_q2; - } - - //mark coplanar facets if any - if (p1_eq_q1){ - tm1_coplanar_faces.set(get(fids1, face(h1_opp, tm1))); - tm2_coplanar_faces.set(get(fids2, face(h2_opp, tm2))); - } - if (p1_eq_q2){ - tm1_coplanar_faces.set(get(fids1, face(h1_opp, tm1))); - tm2_coplanar_faces.set(get(fids2, face(h2, tm2))); - } - if (p2_eq_q1){ - tm1_coplanar_faces.set(get(fids1, face(h1, tm1))); - tm2_coplanar_faces.set(get(fids2, face(h2_opp, tm2))); - } - if (p2_eq_q2){ - tm1_coplanar_faces.set(get(fids1, face(h1, tm1))); - tm2_coplanar_faces.set(get(fids2, face(h2, tm2))); + if (p2_eq_q2){ + //mark coplanar facets if any + tm1_coplanar_faces.set(get(fids1, face(h1, tm1))); + tm2_coplanar_faces.set(get(fids2, face(h2, tm2))); + } + } } if ( (p1_eq_q1 || p1_eq_q2) && (p2_eq_q1 || p2_eq_q2) ) @@ -565,6 +572,48 @@ public: an_edge_per_polyline.erase(it_to_rm); inter_edges_to_remove1.insert(edge(h1,tm1)); inter_edges_to_remove2.insert(edge(h2,tm2)); + + // on the border, we can have a degree 2 node so prev/next + // halfedge should be also considered for removal + // (as the coplanar edge will not be reported in an_edge_per_polyline + // and thus not removed from intersection_edges[12]) + if ( !is_border(h1, tm1) ) + { + h1 = opposite(h1, tm1); + h2 = opposite(h2, tm2); + } + if ( is_border(h1, tm1) ) + { + if ( opposite(next(h1, tm1), tm1) == prev(opposite(h1, tm1), tm1) ) + { + inter_edges_to_remove1.insert(edge(next(h1, tm1),tm1)); + inter_edges_to_remove1.insert(edge(next(h2, tm2),tm2)); + } + if ( opposite(prev(h1, tm1), tm1) == next(opposite(h1, tm1), tm1) ) + { + inter_edges_to_remove1.insert(edge(prev(h1, tm1), tm1)); + inter_edges_to_remove1.insert(edge(prev(h2, tm2), tm2)); + } + } + // same but for h2 + if ( !is_border(h2, tm2) ) + { + h1 = opposite(h1, tm1); + h2 = opposite(h2, tm2); + } + if ( is_border(h2, tm2) ) + { + if ( opposite(next(h2, tm2), tm2) == prev(opposite(h2, tm2), tm2) ) + { + inter_edges_to_remove1.insert(edge(next(h1, tm1),tm1)); + inter_edges_to_remove1.insert(edge(next(h2, tm2),tm2)); + } + if ( opposite(prev(h2, tm2), tm2) == next(opposite(h2, tm2), tm2) ) + { + inter_edges_to_remove1.insert(edge(prev(h1, tm1), tm1)); + inter_edges_to_remove1.insert(edge(prev(h2, tm2), tm2)); + } + } } else ++epp_it; @@ -677,11 +726,55 @@ public: impossible_operation.set(); return; } + else + { + //Sort the three triangle faces around their common edge + // we assume that the exterior of the volume is indicated by + // counterclockwise oriented faces + // (corrected by is_tmi_inside_tmi). + halfedge_descriptor h = is_border(h1, tm1) ? opposite(h1, tm1) : h1; + vertex_descriptor p = target(next(h,tm1),tm1); + // when looking from the side of indices.second, + // the interior of the first triangle mesh is described + // by turning counterclockwise from p1 to p2 + vertex_descriptor q1=target(next(opposite(h2,tm2),tm2),tm2); + vertex_descriptor q2=target(next(h2,tm2),tm2); + // when looking from the side of indices.second, + // the interior of the second volume is described + // by turning from q1 to q2 + + //check if the third point of each triangular face is an original point (stay NID) + //or a intersection point (in that case we need the index of the corresponding node to + //have the exact value of the point) + Node_id index_p = get_node_id(p, vertex_to_node_id1); + Node_id index_q1 = get_node_id(q1, vertex_to_node_id2); + Node_id index_q2 = get_node_id(q2, vertex_to_node_id2); + + std::size_t patch_id_p=tm1_patch_ids[ get(fids1, face(h,tm1)) ]; + std::size_t patch_id_q1=tm2_patch_ids[ get(fids2, face(opposite(h2,tm2),tm2)) ]; + std::size_t patch_id_q2=tm2_patch_ids[ get(fids2, face(h2,tm2)) ]; + + //indicates that patch status will be updated + patch_status_not_set_tm1.reset(patch_id_p); + patch_status_not_set_tm2.reset(patch_id_q1); + patch_status_not_set_tm2.reset(patch_id_q2); + + bool p_is_between_q1q2 = sorted_around_edge( + ids.first, ids.second, + index_q1, index_q2, index_p, + q1, q2, p, + vpm2, vpm1, + nodes); + + if (p_is_between_q1q2) + is_patch_inside_tm2.set(patch_id_p); + } } } else if ( is_border_edge(h2,tm2) ) { + CGAL_assertion(!used_to_clip_a_surface); //Ambiguous, we do nothing impossible_operation.set(); return; @@ -1000,25 +1093,10 @@ public: else if( position == ON_BOUNDARY) { - if (tm1_coplanar_faces.test(get(fids1, f))) - { - coplanar_patches_of_tm1.set(patch_id); - coplanar_patches_of_tm1_for_union_and_intersection.set(patch_id); - } - else - { - vertex_descriptor vn = source(halfedge(f, tm1), tm1); - Bounded_side other_position = inside_tm2( get(vpm1, vn) ); - if (other_position==ON_BOUNDARY) - { - // \todo improve this part which is not robust with a kernel - // with inexact constructions. - other_position = inside_tm2(midpoint(get(vpm1, vn), - get(vpm1, v) )); - } - if ( other_position == in_tm2 ) - is_patch_inside_tm2.set(patch_id); - } + CGAL_assertion(input_have_coplanar_faces); + // The patch is a coplanar patch because it is "free" from filtered polyline intersection + coplanar_patches_of_tm1.set(patch_id); + coplanar_patches_of_tm1_for_union_and_intersection.set(patch_id); } if ( patch_status_not_set_tm1.none() ) break; } diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_clip.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_clip.cpp index 3dae87fb73c..f34b517dde9 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_clip.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_clip.cpp @@ -216,6 +216,28 @@ void test() PMP::clip(tm1, K::Plane_3(-1, 0, 0, 2)); assert(vertices(tm1).size()==3); CGAL::clear(tm1); + + // test with clipper on border edge + make_triangle( K::Point_3(0, 0, 0), K::Point_3(0, 1, 0), K::Point_3(1, 0, 0), tm1 ); + PMP::clip(tm1, K::Plane_3(0, 1, 0 , 0)); + assert(vertices(tm1).size()==0); + CGAL::clear(tm1); + + make_triangle( K::Point_3(0, 0, 0), K::Point_3(0, 1, 0), K::Point_3(1, 0, 0), tm1 ); + PMP::clip(tm1, K::Plane_3(0, -1, 0 , 0)); + assert(vertices(tm1).size()==4); + CGAL::clear(tm1); + + // test with clipper on border edge: full triangle + make_triangle( K::Point_3(0, 0, 0), K::Point_3(0, 4, 0), K::Point_3(4, 0, 0), tm1 ); + PMP::clip(tm1, K::Plane_3(0, 0, 1, 0), params::use_compact_clipper(true)); + assert(vertices(tm1).size()!=0); + CGAL::clear(tm1); + + make_triangle( K::Point_3(0, 0, 0), K::Point_3(0, 4, 0), K::Point_3(4, 0, 0), tm1 ); + PMP::clip(tm1, K::Plane_3(0, 0, 1, 0), params::use_compact_clipper(false)); + assert(vertices(tm1).size()==0); + CGAL::clear(tm1); } int main() From c28c0a4b2d82d8342af73d705ee004bc18441303 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Mon, 19 Nov 2018 14:33:54 +0100 Subject: [PATCH 049/193] Fix a bug with CTest in non-header-only The pull-request https://github.com/CGAL/cgal/pull/3413 has introduced a side-effect: CTest was broken when `CGAL_HEADER_ONLY=OFF`, for all tests using a `.cin` or `.cmd` file. That is due to the variable `CGAL_CURRENT_SOURCE_DIR` that was only filled by `UseCGAL.cmake`. Now that we forbid CGAL directories without `CMakeLists.txt`, that variable `CGAL_CURRENT_SOURCE_DIR` is now useless, and can be removed: `CMAKE_CURRENT_SOURCE_DIR` is sufficient. That fixes the bug with CTest, and also makes the CMake code a bit simpler. --- .../test/Arrangement_on_surface_2/cgal_test.cmake | 2 +- Installation/cmake/modules/CGAL_add_test.cmake | 14 +++++++------- Installation/cmake/modules/UseCGAL.cmake | 5 ----- Installation/lib/cmake/CGAL/CGALConfig.cmake | 5 ----- 4 files changed, 8 insertions(+), 18 deletions(-) diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake index 1baad5bed5f..fc61895ed77 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake @@ -197,7 +197,7 @@ function(run_test_alt name datafile) set(command ${name} ${datafile} ${ARGN}) string(MAKE_C_IDENTIFIER "${name} ${ARGV4} ${ARGV5}" test_name) add_test(NAME ${test_name} COMMAND ${command} - WORKING_DIRECTORY ${CGAL_CURRENT_SOURCE_DIR}) + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) set_property(TEST "${test_name}" APPEND PROPERTY DEPENDS "compilation_of__${name}") if(POLICY CMP0066) # CMake 3.7 or later diff --git a/Installation/cmake/modules/CGAL_add_test.cmake b/Installation/cmake/modules/CGAL_add_test.cmake index 79bef011112..2f0aec7163a 100644 --- a/Installation/cmake/modules/CGAL_add_test.cmake +++ b/Installation/cmake/modules/CGAL_add_test.cmake @@ -42,7 +42,7 @@ endif() # Process a list, and replace items contains a file pattern (like # `*.off`) by the sublist that corresponds to the globbing of the -# pattern in the directory `${CGAL_CURRENT_SOURCE_DIR}`. +# pattern in the directory `${CMAKE_CURRENT_SOURCE_DIR}`. # # # For example: the `file @@ -71,7 +71,7 @@ function(expand_list_with_globbing list_name) list(GET input_list ${n} item_n) # message(STATUS "argument ${n} is ${item_n}") if(item_n MATCHES ".*\\*.*") - file(GLOB files RELATIVE ${CGAL_CURRENT_SOURCE_DIR} ${item_n}) + file(GLOB files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${item_n}) list(APPEND output_list ${files}) else() list(APPEND output_list ${item_n}) @@ -97,7 +97,7 @@ function(cgal_setup_test_properties test_name) endif() set_property(TEST "${test_name}" APPEND PROPERTY LABELS "${PROJECT_NAME}") - # message(STATUS " working dir: ${CGAL_CURRENT_SOURCE_DIR}") + # message(STATUS " working dir: ${CMAKE_CURRENT_SOURCE_DIR}") set_property(TEST "${test_name}" PROPERTY WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) if(exe_name) @@ -198,7 +198,7 @@ function(cgal_add_test exe_name) return() endif() # message("Add test ${test_name}") - set(cin_file "${CGAL_CURRENT_SOURCE_DIR}/${exe_name}.cin") + set(cin_file "${CMAKE_CURRENT_SOURCE_DIR}/${exe_name}.cin") if(NOT ARGS AND EXISTS ${cin_file}) add_test(NAME ${test_name} COMMAND ${TIME_COMMAND} ${CMAKE_COMMAND} @@ -213,11 +213,11 @@ function(cgal_add_test exe_name) else() if(NOT ARGS AND NOT cgal_add_test_TEST_NAME) if(ARGC GREATER 2 AND ARGV2) - set(cmd_file "${CGAL_CURRENT_SOURCE_DIR}/${ARGV2}.cmd") + set(cmd_file "${CMAKE_CURRENT_SOURCE_DIR}/${ARGV2}.cmd") elseif(ARGC GREATER 1 AND ARGV1 AND NOT EXISTS ${cmd_file}) - set(cmd_file "${CGAL_CURRENT_SOURCE_DIR}/${ARGV1}.cmd") + set(cmd_file "${CMAKE_CURRENT_SOURCE_DIR}/${ARGV1}.cmd") elseif(NOT EXISTS ${cmd_file}) - set(cmd_file "${CGAL_CURRENT_SOURCE_DIR}/${exe_name}.cmd") + set(cmd_file "${CMAKE_CURRENT_SOURCE_DIR}/${exe_name}.cmd") endif() if(EXISTS ${cmd_file}) file(STRINGS "${cmd_file}" CMD_LINES) diff --git a/Installation/cmake/modules/UseCGAL.cmake b/Installation/cmake/modules/UseCGAL.cmake index 5128023cc5d..0187802b524 100644 --- a/Installation/cmake/modules/UseCGAL.cmake +++ b/Installation/cmake/modules/UseCGAL.cmake @@ -9,11 +9,6 @@ include(${CGAL_MODULES_DIR}/CGAL_Macros.cmake) cgal_setup_module_path() -# Save the current source directory. That variable can be changed by -# a `CMakeLists.txt`, for `CMakeLists.txt` files that are created in -# the binary directory. -set(CGAL_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) - if(NOT USE_CGAL_FILE_INCLUDED) set(USE_CGAL_FILE_INCLUDED 1) diff --git a/Installation/lib/cmake/CGAL/CGALConfig.cmake b/Installation/lib/cmake/CGAL/CGALConfig.cmake index 486f1ff6746..958dcee2454 100644 --- a/Installation/lib/cmake/CGAL/CGALConfig.cmake +++ b/Installation/lib/cmake/CGAL/CGALConfig.cmake @@ -11,11 +11,6 @@ get_filename_component(CGAL_CONFIG_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) set(CGAL_HEADER_ONLY TRUE) -# Save the current source directory. That variable can be changed by -# a `CMakeLists.txt`, for `CMakeLists.txt` files that are created in -# the binary directory. -set(CGAL_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) - function(cgal_detect_branch_build VAR_NAME) if(IS_DIRECTORY ${CGAL_CONFIG_DIR}/../../../../Installation/package_info/Installation/) set(${VAR_NAME} TRUE PARENT_SCOPE) From 6e06f20382b1c81bdf5762f152cf14f168c9bcc2 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Mon, 19 Nov 2018 14:37:08 +0100 Subject: [PATCH 050/193] Small improvement to that script I hijack the PR to slip a small improvement to that script. --- Scripts/developer_scripts/git-show-content | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Scripts/developer_scripts/git-show-content b/Scripts/developer_scripts/git-show-content index 5ccd986a7ac..72051e849c2 100755 --- a/Scripts/developer_scripts/git-show-content +++ b/Scripts/developer_scripts/git-show-content @@ -5,7 +5,8 @@ set -e git=git -base=${1:-HEAD} +commit=${1:-HEAD} +base=${2:-cgal/master} function reset() { git update-ref -d refs/cgal/git-show-content @@ -14,7 +15,7 @@ function reset() { trap reset ERR EXIT KILL TERM INT -for c in $(git log --pretty='%h' --first-parent cgal/master..$base); do +for c in $(git log --pretty='%h' --first-parent ${base}..${commit}); do git update-ref refs/cgal/git-show-content $c git bundle create bundle ${c}^..refs/cgal/git-show-content > /dev/null 2>&1 gzip -f bundle From ab67b0cc34b6dfddaee7e817a1d67661bdfb757f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Mon, 19 Nov 2018 16:00:29 +0100 Subject: [PATCH 051/193] Fixed conversion warning --- .../include/CGAL/_test_cls_parallel_triangulation_3.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_parallel_triangulation_3.h b/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_parallel_triangulation_3.h index 2b1314a4066..facbd70f2d7 100644 --- a/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_parallel_triangulation_3.h +++ b/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_parallel_triangulation_3.h @@ -91,10 +91,10 @@ _test_cls_parallel_triangulation_3(const Parallel_triangulation &) std::vector vertices_to_remove; typename Cls::Finite_vertices_iterator vit = tr.finite_vertices_begin(); - const int num_remove = tr.number_of_vertices() / 10; + const std::size_t num_remove = tr.number_of_vertices() / 10; std::cout << "Removing " << num_remove << " from " << tr.number_of_vertices() << " vertices" << std::endl; - for(int i=0 ; i Date: Tue, 20 Nov 2018 10:41:37 +0100 Subject: [PATCH 052/193] register vertex -> node_id upon creation The former method relied on intersection edges which did not have isolated vertices --- .../Corefinement/Face_graph_output_builder.h | 42 +++++++++---------- .../Output_builder_for_autorefinement.h | 17 +++++--- .../internal/Corefinement/Visitor.h | 12 +++++- .../internal/Corefinement/face_graph_utils.h | 5 +++ 4 files changed, 46 insertions(+), 30 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h index d9c52616549..e91717c0285 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h @@ -127,6 +127,9 @@ class Face_graph_output_builder const VpmOutTuple& output_vpms; EdgeMarkMapTuple& out_edge_mark_maps; UserVisitor& user_visitor; + // mapping vertex to node id + Node_id_map vertex_to_node_id1, vertex_to_node_id2; + // output meshes const cpp11::array, 4>& requested_output; // input meshes closed ? @@ -445,6 +448,17 @@ public: } } + void set_vertex_id(vertex_descriptor v, Node_id node_id, const TriangleMesh& tm) + { + if (&tm == &tm1) + vertex_to_node_id1.insert( std::make_pair(v, node_id) ); + else + { + CGAL_assertion(&tm == &tm2); + vertex_to_node_id2.insert( std::make_pair(v, node_id) ); + } + } + template void operator()( const Nodes_vector& nodes, @@ -452,30 +466,12 @@ public: const boost::dynamic_bitset<>& is_node_of_degree_one, const Mesh_to_map_node&) { - // first build an unordered_map mapping a vertex to its node id + CGAL_assertion( vertex_to_node_id1.size() == vertex_to_node_id2.size()); + CGAL_assertion( vertex_to_node_id1.size() == nodes.size()); + + // TODO check if Intersection_edge_map needs to be so complicated (id stored...) Intersection_edge_map& intersection_edges1 = mesh_to_intersection_edges[&tm1]; - Node_id_map vertex_to_node_id1; - - for (typename Intersection_edge_map::iterator - it=intersection_edges1.begin(), - it_end=intersection_edges1.end(); it!=it_end; ++it) - { - vertex_to_node_id1[source(it->first,tm1)]=it->second.first; - vertex_to_node_id1[target(it->first,tm1)]=it->second.second; - } - Intersection_edge_map& intersection_edges2 = mesh_to_intersection_edges[&tm2]; - Node_id_map vertex_to_node_id2; - - for (typename Intersection_edge_map::iterator - it=intersection_edges2.begin(), - it_end=intersection_edges2.end(); it!=it_end; ++it) - { - vertex_to_node_id2[source(it->first,tm2)]=it->second.first; - vertex_to_node_id2[target(it->first,tm2)]=it->second.second; - } - - CGAL_assertion(intersection_edges1.size()==intersection_edges2.size()); // this will initialize face indices if the face index map is writable. helpers::init_face_indices(tm1, fids1); @@ -650,7 +646,7 @@ public: .face_index_map(fids2)); std::vector tm2_patch_sizes(nb_patches_tm2, 0); - BOOST_FOREACH(std::size_t i, tm2_patch_ids) + BOOST_FOREACH(Node_id i, tm2_patch_ids) if(i!=NID) ++tm2_patch_sizes[i]; diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Output_builder_for_autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Output_builder_for_autorefinement.h index ba32b8948f2..0b04ec00e8b 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Output_builder_for_autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Output_builder_for_autorefinement.h @@ -110,6 +110,7 @@ class Output_builder_for_autorefinement const VertexPointMap &vpm; const FaceIdMap &fids; Ecm& ecm; + Node_id_map vertex_to_node_id; // input meshes closed ? bool is_tm_closed; // orientation of input surface mesh @@ -208,6 +209,13 @@ public: all_intersection_edges_map[indices].add(hedge); } + void set_vertex_id(vertex_descriptor v, Node_id node_id, const TriangleMesh& tm_) + { + CGAL_USE(tm_); + CGAL_assertion(&tm_==&tm); + vertex_to_node_id.insert( std::make_pair(v, node_id) ); + } + template void operator()( const Nodes_vector& nodes, @@ -220,7 +228,6 @@ public: // first build an unordered_map mapping a vertex to its node id + a set // of all intersection edges - Node_id_map vertex_to_node_id; typedef boost::unordered_set Intersection_edge_map; Intersection_edge_map intersection_edges; @@ -233,10 +240,10 @@ public: // and will be discarded later if (p.second.h2==boost::graph_traits::null_halfedge()) continue; - vertex_to_node_id[source(p.second.h1, tm)] = p.first.first; - vertex_to_node_id[target(p.second.h1, tm)] = p.first.second; - vertex_to_node_id[source(p.second.h2, tm)] = p.first.first; - vertex_to_node_id[target(p.second.h2, tm)] = p.first.second; + CGAL_assertion( vertex_to_node_id[source(p.second.h1, tm)] == p.first.first); + CGAL_assertion( vertex_to_node_id[target(p.second.h1, tm)] == p.first.second); + CGAL_assertion( vertex_to_node_id[source(p.second.h2, tm)] == p.first.first); + CGAL_assertion( vertex_to_node_id[target(p.second.h2, tm)] == p.first.second); intersection_edges.insert(edge(p.second.h1, tm)); intersection_edges.insert(edge(p.second.h2, tm)); } diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Visitor.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Visitor.h index 7b73309e1c9..68866f70c7c 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Visitor.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Visitor.h @@ -96,6 +96,8 @@ struct No_extra_output_from_corefinement void set_edge_per_polyline(G& /*tm*/, Node_id_pair /*indices*/, halfedge_descriptor /*hedge*/){} + template + void set_vertex_id(vertex_descriptor, Node_id, const G&){} template void operator()( @@ -359,6 +361,7 @@ public: node_id_to_vertex[node_id]=target(h_2,tm2); all_incident_faces_got_a_node_as_vertex(h_2,node_id,*tm2_ptr); // check_node_on_non_manifold_vertex(node_id,h_2,tm2); + output_builder.set_vertex_id(target(h_2, tm2), node_id, tm2); } break; default: @@ -376,6 +379,8 @@ public: node_id_to_vertex.resize(node_id+1,Graph_traits::null_vertex()); node_id_to_vertex[node_id]=target(h_1,tm1); all_incident_faces_got_a_node_as_vertex(h_1,node_id, *tm1_ptr); + // register the vertex in the output builder + output_builder.set_vertex_id(target(h_1, tm1), node_id, tm1); // check_node_on_non_manifold_vertex(node_id,h_1,tm1); } else{ @@ -388,6 +393,8 @@ public: node_id_to_vertex.resize(node_id+1,Graph_traits::null_vertex()); node_id_to_vertex[node_id]=source(h_1,tm1); all_incident_faces_got_a_node_as_vertex(h_1_opp,node_id, *tm1_ptr); + // register the vertex in the output builder + output_builder.set_vertex_id(source(h_1, tm1), node_id, tm1); // check_node_on_non_manifold_vertex(node_id,h_1_opp,tm1); } else{ @@ -752,7 +759,8 @@ public: vertex_descriptor vnew=target(hnew,tm); // user_visitor.new_vertex_added(node_id, vnew, tm); // NODE_VISITOR_TAG nodes.call_put(vpm, vnew, node_id, tm); - + // register the new vertex in the output builder + output_builder.set_vertex_id(vnew, node_id, tm); node_id_to_vertex[node_id]=vnew; if (first){ first=false; @@ -996,7 +1004,7 @@ public: // import the triangle in `cdt` in the face `f` of `tm` triangulate_a_face(f, tm, nodes, node_ids, node_id_to_vertex, - edge_to_hedge, cdt, vpm, user_visitor); + edge_to_hedge, cdt, vpm, output_builder, user_visitor); // TODO Here we do the update only for internal edges. // Update for border halfedges could be done during the split diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/face_graph_utils.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/face_graph_utils.h index be442040d31..ff7b54ae717 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/face_graph_utils.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/face_graph_utils.h @@ -263,6 +263,7 @@ template < class TriangleMesh, class Node_id, class Node_vector, class CDT, + class OutputBuilder, class UserVisitor> void triangulate_a_face( @@ -277,6 +278,7 @@ triangulate_a_face( ::halfedge_descriptor>& edge_to_hedge, const CDT& cdt, const VertexPointMap& vpm, + OutputBuilder& output_builder, UserVisitor& user_visitor) { typedef boost::graph_traits GT; @@ -292,6 +294,9 @@ triangulate_a_face( vertex_descriptor v=add_vertex(tm); // user_visitor.new_vertex_added(node_id, v, tm); // NODE_VISITOR_TAG nodes.call_put(vpm, v, node_id, tm); + // register the new vertex in the output builder + output_builder.set_vertex_id(v, node_id, tm); + CGAL_assertion(node_id_to_vertex.size()>node_id); node_id_to_vertex[node_id]=v; } From aabd798126d0b25a740b81d7665a171d42721038 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Tue, 20 Nov 2018 10:47:37 +0100 Subject: [PATCH 053/193] Fix warnings std::size_t to int --- .../demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp index 737311166b6..6cad4ed03c9 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp @@ -182,7 +182,7 @@ public : points.push_back(QPointF(transfo_point.x(), -transfo_point.y())); } - painter->drawPolyline(points.data(), points.size()); + painter->drawPolyline(points.data(), static_cast(points.size())); } } @@ -706,7 +706,7 @@ public Q_SLOTS: //compute the average normal for the cc give it to every vertex EPICK::Vector_3 normal(0,0,0); CGAL::Face_filtered_graph fmesh(text_mesh_bottom, - cc, + static_cast(cc), fcmap); BOOST_FOREACH(vertex_descriptor vd, vertices(fmesh)) { From 7d19fe6940e9d334875b8afb694458cf73bf0b8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 20 Nov 2018 10:50:32 +0100 Subject: [PATCH 054/193] be more robust in case of tangency --- .../Corefinement/Face_graph_output_builder.h | 113 ++++++++++++------ .../Polygon_mesh_processing/test_pmp_clip.cpp | 32 +++++ 2 files changed, 110 insertions(+), 35 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h index e91717c0285..6733e2561f6 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h @@ -1078,22 +1078,51 @@ public: BOOST_FOREACH(face_descriptor f, faces(tm1)) { - std::size_t patch_id=tm1_patch_ids[ get(fids1, f) ]; + const std::size_t f_id = get(fids1, f); + const std::size_t patch_id = tm1_patch_ids[ f_id ]; if ( patch_status_not_set_tm1.test( patch_id ) ) { patch_status_not_set_tm1.reset( patch_id ); - vertex_descriptor v = target(halfedge(f, tm1), tm1); - Bounded_side position = inside_tm2( get(vpm1, v)); - if ( position == in_tm2 ) - is_patch_inside_tm2.set(patch_id); - else - if( position == ON_BOUNDARY) + halfedge_descriptor h = halfedge(f, tm1); + Node_id index_p1 = get_node_id(target(h, tm1), vertex_to_node_id1); + if (index_p1 != NID) + { + h=next(h, tm1); + index_p1 = get_node_id(target(h, tm1), vertex_to_node_id1); + if (index_p1 != NID) + { + h=next(h, tm1); + index_p1 = get_node_id(target(h, tm1), vertex_to_node_id1); + } + } + if (index_p1 != NID) + { + if (tm1_coplanar_faces.test(f_id)) { - CGAL_assertion(input_have_coplanar_faces); - // The patch is a coplanar patch because it is "free" from filtered polyline intersection coplanar_patches_of_tm1.set(patch_id); coplanar_patches_of_tm1_for_union_and_intersection.set(patch_id); } + else + { + // triangle which is tangent at its 3 vertices + // \todo improve this part which is not robust with a kernel + // with inexact constructions. + Bounded_side position = inside_tm2(midpoint(get(vpm1, source(h, tm1)), + get(vpm1, target(h, tm1)) )); + CGAL_assertion( position != ON_BOUNDARY); + if ( position == in_tm2 ) + is_patch_inside_tm2.set(patch_id); + } + } + else + { + // TODO: tm2 might have been modified and an inexact vpm will + // provide a non-robust result. + Bounded_side position = inside_tm2( get(vpm1, target(h, tm1))); + CGAL_assertion( position != ON_BOUNDARY); + if ( position == in_tm2 ) + is_patch_inside_tm2.set(patch_id); + } if ( patch_status_not_set_tm1.none() ) break; } } @@ -1109,37 +1138,51 @@ public: Inside_poly_test inside_tm1(tm1, vpm1); BOOST_FOREACH(face_descriptor f, faces(tm2)) { - std::size_t patch_id=tm2_patch_ids[ get(fids2, f) ]; + const std::size_t f_id = get(fids2, f); + std::size_t patch_id=tm2_patch_ids[ f_id ]; if ( patch_status_not_set_tm2.test( patch_id ) ) { patch_status_not_set_tm2.reset( patch_id ); - vertex_descriptor v = target(halfedge(f, tm2), tm2); - Bounded_side position = inside_tm1( get(vpm2, v)); - if ( position == in_tm1 ) - is_patch_inside_tm1.set(patch_id); - else - if( position == ON_BOUNDARY) + halfedge_descriptor h = halfedge(f, tm2); + Node_id index_p2 = get_node_id(target(h, tm2), vertex_to_node_id2); + if (index_p2 != NID) + { + h=next(h, tm2); + index_p2 = get_node_id(target(h, tm2), vertex_to_node_id2); + if (index_p2 != NID) { - if (tm2_coplanar_faces.test(get(fids2, f))) - { - coplanar_patches_of_tm2.set(patch_id); - coplanar_patches_of_tm2_for_union_and_intersection.set(patch_id); - } - else - { - vertex_descriptor vn = source(halfedge(f, tm2), tm2); - Bounded_side other_position = inside_tm1( get(vpm2, vn) ); - if (other_position==ON_BOUNDARY) - { - // \todo improve this part which is not robust with a kernel - // with inexact constructions. - other_position = inside_tm1(midpoint(get(vpm2, vn), - get(vpm2, v) )); - } - if ( other_position == in_tm1 ) - is_patch_inside_tm1.set(patch_id); - } + h=next(h, tm2); + index_p2 = get_node_id(target(h, tm2), vertex_to_node_id2); } + } + if (index_p2 != NID) + { + if (tm2_coplanar_faces.test(f_id)) + { + coplanar_patches_of_tm2.set(patch_id); + coplanar_patches_of_tm2_for_union_and_intersection.set(patch_id); + } + else + { + // triangle which is tangent at its 3 vertices + // \todo improve this part which is not robust with a kernel + // with inexact constructions. + Bounded_side position = inside_tm1(midpoint(get(vpm2, source(h, tm2)), + get(vpm2, target(h, tm2)) )); + CGAL_assertion( position != ON_BOUNDARY); + if ( position == in_tm1 ) + is_patch_inside_tm1.set(patch_id); + } + } + else + { + // TODO: tm1 might have been modified and an inexact vpm will + // provide a non-robust result. + Bounded_side position = inside_tm1( get(vpm2, target(h, tm2))); + CGAL_assertion( position != ON_BOUNDARY); + if ( position == in_tm1 ) + is_patch_inside_tm1.set(patch_id); + } if ( patch_status_not_set_tm2.none() ) break; } } diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_clip.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_clip.cpp index f34b517dde9..91a59e0cdb1 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_clip.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_clip.cpp @@ -238,6 +238,38 @@ void test() PMP::clip(tm1, K::Plane_3(0, 0, 1, 0), params::use_compact_clipper(false)); assert(vertices(tm1).size()==0); CGAL::clear(tm1); + + // test tangencies + make_triangle( K::Point_3(0, 0, 0), K::Point_3(0, 2, 0), K::Point_3(1, 1, 0), tm1 ); + PMP::clip(tm1, K::Plane_3(1, 0, 0, -1)); + assert(vertices(tm1).size()==3); + CGAL::clear(tm1); + + make_triangle( K::Point_3(0, 0, 0), K::Point_3(0, 2, 0), K::Point_3(1, 1, 0), tm1 ); + PMP::clip(tm1, K::Plane_3(-1, 0, 0, 1)); + assert(vertices(tm1).size()==0); + CGAL::clear(tm1); + + make_triangle( K::Point_3(0.5, 0, 0.5), K::Point_3(1, 0.5, 0.5), K::Point_3(0.5, 1, 0.5), tm1 ); + input.open("data-coref/cube.off"); + input >> tm2; + input.close(); + PMP::clip(tm1, tm2, params::face_index_map(get(CGAL::dynamic_face_property_t(), tm1)), + params::face_index_map(get(CGAL::dynamic_face_property_t(), tm2))); + assert(vertices(tm1).size()==3); + CGAL::clear(tm1); + CGAL::clear(tm2); + + make_triangle( K::Point_3(0.5, 0, 0.5), K::Point_3(1, 0.5, 0.5), K::Point_3(0.5, 1, 0.5), tm1 ); + input.open("data-coref/cube.off"); + input >> tm2; + input.close(); + PMP::reverse_face_orientations(tm2); + PMP::clip(tm1, tm2, params::face_index_map(get(CGAL::dynamic_face_property_t(), tm1)), + params::face_index_map(get(CGAL::dynamic_face_property_t(), tm2))); + assert(vertices(tm1).size()==0); + CGAL::clear(tm1); + CGAL::clear(tm2); } int main() From 0ecbdbea4bff87df35c9c6ba262e9ce114882911 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 20 Nov 2018 13:10:14 +0100 Subject: [PATCH 055/193] handle case when clipping plane hit an extended bbox corner --- .../CGAL/Polygon_mesh_processing/clip.h | 51 ++++++++++++------- 1 file changed, 32 insertions(+), 19 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/clip.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/clip.h index 1c2ac748d32..078097a4ebf 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/clip.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/clip.h @@ -119,34 +119,47 @@ clip_to_bbox(const Plane_3& plane, int current_id = face_indices[4*i + k]; int next_id = face_indices[4*i + (k+1)%4]; - if ( orientations[ current_id ] != ON_POSITIVE_SIDE ) + switch(orientations[ current_id ]) { - all_out=false; - // point on or on the negative side - output_faces[i].push_back( current_id ); - in_point_ids.insert( output_faces[i].back() ); - // check for intersection of the edge - if (orientations[ current_id ] == ON_NEGATIVE_SIDE && - orientations[ next_id ] == ON_POSITIVE_SIDE) + case ON_NEGATIVE_SIDE: { - output_faces[i].push_back( - inter_pt_index(current_id, next_id, plane, corners, id_map) ); + all_out=false; + // point on or on the negative side + output_faces[i].push_back( current_id ); in_point_ids.insert( output_faces[i].back() ); + // check for intersection of the edge + if (orientations[ next_id ] == ON_POSITIVE_SIDE) + { + output_faces[i].push_back( + inter_pt_index(current_id, next_id, plane, corners, id_map) ); + in_point_ids.insert( output_faces[i].back() ); + } + break; } - } - else - { - all_in = false; - // check for intersection of the edge - if ( orientations[ next_id ] == ON_NEGATIVE_SIDE ) + case ON_POSITIVE_SIDE: { - output_faces[i].push_back( - inter_pt_index(current_id, next_id, plane, corners, id_map) ); + all_in = false; + // check for intersection of the edge + if ( orientations[ next_id ] == ON_NEGATIVE_SIDE ) + { + output_faces[i].push_back( + inter_pt_index(current_id, next_id, plane, corners, id_map) ); + in_point_ids.insert( output_faces[i].back() ); + } + break; + } + case ON_ORIENTED_BOUNDARY: + { + output_faces[i].push_back( current_id ); in_point_ids.insert( output_faces[i].back() ); } } } - CGAL_assertion( output_faces[i].empty() || output_faces[i].size() >= 3 ); + if (output_faces[i].size() < 3){ + CGAL_assertion(output_faces[i].empty() || + (output_faces[i].front()<8 && output_faces[i].back()<8) ); + output_faces[i].clear(); // edge of the bbox included in the plane + } } // the intersection is the full bbox From 3a1516e9401b8cc2007855e56950df1098bb8781 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 20 Nov 2018 13:47:16 +0100 Subject: [PATCH 056/193] add missing Reference and uniformize ref man group declaration --- Classification/doc/Classification/PackageDescription.txt | 4 ++-- Cone_spanners_2/doc/Cone_spanners_2/PackageDescription.txt | 2 -- Point_set_3/doc/Point_set_3/PackageDescription.txt | 4 ++-- .../doc/Point_set_processing_3/PackageDescription.txt | 5 ++--- .../doc/Point_set_shape_detection_3/PackageDescription.txt | 4 ++-- .../doc/Subdivision_method_3/PackageDescription.txt | 2 +- Surface_mesh/doc/Surface_mesh/PackageDescription.txt | 1 - .../doc/Surface_mesh_shortest_path/PackageDescription.txt | 2 -- Three/doc/Three/PackageDescription.txt | 2 +- Triangulation/doc/Triangulation/PackageDescription.txt | 2 +- 10 files changed, 11 insertions(+), 17 deletions(-) diff --git a/Classification/doc/Classification/PackageDescription.txt b/Classification/doc/Classification/PackageDescription.txt index b1a3dafe536..6452aa25b39 100644 --- a/Classification/doc/Classification/PackageDescription.txt +++ b/Classification/doc/Classification/PackageDescription.txt @@ -1,6 +1,6 @@ -/*! -\defgroup PkgClassificationRef Classification Reference +/// \defgroup PkgClassificationRef Classification Reference +/*! \defgroup PkgClassificationConcepts Concepts \ingroup PkgClassificationRef diff --git a/Cone_spanners_2/doc/Cone_spanners_2/PackageDescription.txt b/Cone_spanners_2/doc/Cone_spanners_2/PackageDescription.txt index 5833bf7e4ae..94e5022fa37 100644 --- a/Cone_spanners_2/doc/Cone_spanners_2/PackageDescription.txt +++ b/Cone_spanners_2/doc/Cone_spanners_2/PackageDescription.txt @@ -1,5 +1,3 @@ -// PRETTY PACKAGE NAME should equal the project title in Doxyfile.in - /// \defgroup PkgConeSpanners2Ref Cone-Based Spanners Reference /*! diff --git a/Point_set_3/doc/Point_set_3/PackageDescription.txt b/Point_set_3/doc/Point_set_3/PackageDescription.txt index 9353b29bc54..2c2a538ef71 100644 --- a/Point_set_3/doc/Point_set_3/PackageDescription.txt +++ b/Point_set_3/doc/Point_set_3/PackageDescription.txt @@ -1,6 +1,6 @@ -/*! -\defgroup PkgPointSet3Ref 3D Point Set Reference +/// \defgroup PkgPointSet3Ref 3D Point Set Reference +/*! \cgalPkgDescriptionBegin{3D Point Set, PkgPointSet3} \cgalPkgPicture{point_set_3.png} \cgalPkgSummaryBegin diff --git a/Point_set_processing_3/doc/Point_set_processing_3/PackageDescription.txt b/Point_set_processing_3/doc/Point_set_processing_3/PackageDescription.txt index fd9ed9c57b9..a14dd5e1df7 100644 --- a/Point_set_processing_3/doc/Point_set_processing_3/PackageDescription.txt +++ b/Point_set_processing_3/doc/Point_set_processing_3/PackageDescription.txt @@ -1,7 +1,6 @@ +/// \defgroup PkgPointSetProcessing3Ref Point Set Processing Reference + /*! - -\defgroup PkgPointSetProcessing3Ref Point Set Processing Reference - \defgroup PkgPointSetProcessing3Algorithms Algorithms \ingroup PkgPointSetProcessing3Ref diff --git a/Point_set_shape_detection_3/doc/Point_set_shape_detection_3/PackageDescription.txt b/Point_set_shape_detection_3/doc/Point_set_shape_detection_3/PackageDescription.txt index e9a6eda262e..71989dbe994 100644 --- a/Point_set_shape_detection_3/doc/Point_set_shape_detection_3/PackageDescription.txt +++ b/Point_set_shape_detection_3/doc/Point_set_shape_detection_3/PackageDescription.txt @@ -1,6 +1,6 @@ -/*! -\defgroup PkgPointSetShapeDetection3Ref Point Set Shape Detection Reference +/// \defgroup PkgPointSetShapeDetection3Ref Point Set Shape Detection Reference +/*! \defgroup PkgPointSetShapeDetection3Concepts Concepts \ingroup PkgPointSetShapeDetection3Ref diff --git a/Subdivision_method_3/doc/Subdivision_method_3/PackageDescription.txt b/Subdivision_method_3/doc/Subdivision_method_3/PackageDescription.txt index dda0dc2db38..830d48b36c3 100644 --- a/Subdivision_method_3/doc/Subdivision_method_3/PackageDescription.txt +++ b/Subdivision_method_3/doc/Subdivision_method_3/PackageDescription.txt @@ -1,4 +1,4 @@ -/// \defgroup PkgSurfaceSubdivisionMethod3Ref 3D Surface Subdivision Methods +/// \defgroup PkgSurfaceSubdivisionMethod3Ref 3D Surface Subdivision Methods Reference /// \defgroup PkgSurfaceSubdivisionMethod3Concepts Concepts /// \ingroup PkgSurfaceSubdivisionMethod3Ref diff --git a/Surface_mesh/doc/Surface_mesh/PackageDescription.txt b/Surface_mesh/doc/Surface_mesh/PackageDescription.txt index 4fecf7ee900..af323cdd4a7 100644 --- a/Surface_mesh/doc/Surface_mesh/PackageDescription.txt +++ b/Surface_mesh/doc/Surface_mesh/PackageDescription.txt @@ -1,4 +1,3 @@ - /// \defgroup PkgSurface_mesh Surface Mesh Reference /*! Draw. diff --git a/Surface_mesh_shortest_path/doc/Surface_mesh_shortest_path/PackageDescription.txt b/Surface_mesh_shortest_path/doc/Surface_mesh_shortest_path/PackageDescription.txt index 97fe67ef39b..d174e2cc7d5 100644 --- a/Surface_mesh_shortest_path/doc/Surface_mesh_shortest_path/PackageDescription.txt +++ b/Surface_mesh_shortest_path/doc/Surface_mesh_shortest_path/PackageDescription.txt @@ -1,5 +1,3 @@ -// Triangulated Surface Mesh Geodesic Shortest Paths - /// \defgroup PkgSurfaceMeshShortestPathRef Triangulated Surface Mesh Geodesic Shortest Paths Reference /// \defgroup PkgSurfaceMeshShortestPathConcepts Concepts diff --git a/Three/doc/Three/PackageDescription.txt b/Three/doc/Three/PackageDescription.txt index 72012cfaaae..4b83fd601ca 100644 --- a/Three/doc/Three/PackageDescription.txt +++ b/Three/doc/Three/PackageDescription.txt @@ -1,4 +1,4 @@ -/// \defgroup PkgThreeRef Three +/// \defgroup PkgThreeRef Three Reference /// /*! \addtogroup PkgThreeRef diff --git a/Triangulation/doc/Triangulation/PackageDescription.txt b/Triangulation/doc/Triangulation/PackageDescription.txt index bc863b04bc8..bee59fb6c26 100644 --- a/Triangulation/doc/Triangulation/PackageDescription.txt +++ b/Triangulation/doc/Triangulation/PackageDescription.txt @@ -1,4 +1,4 @@ -/// \defgroup PkgTriangulationsRef dD Triangulations +/// \defgroup PkgTriangulationsRef dD Triangulations Reference /// \defgroup PkgTriangulationsConcepts Concepts /// \ingroup PkgTriangulationsRef From 0027fc7a4ef04266fdae21366dd1490f6dc287b2 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Tue, 20 Nov 2018 15:42:48 +0100 Subject: [PATCH 057/193] Add a usage --- Scripts/developer_scripts/git-show-content | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Scripts/developer_scripts/git-show-content b/Scripts/developer_scripts/git-show-content index 72051e849c2..deb2c942270 100755 --- a/Scripts/developer_scripts/git-show-content +++ b/Scripts/developer_scripts/git-show-content @@ -3,7 +3,21 @@ zmodload zsh/stat set -e -git=git +if [ "x$1" = "x--help" -o "x$1" = "x-h" ]; then + cat < Date: Tue, 20 Nov 2018 17:23:28 +0100 Subject: [PATCH 058/193] close --- Documentation/doc/resources/1.8.13/header.html | 2 +- Documentation/doc/resources/1.8.13/header_package.html | 2 +- Documentation/doc/resources/1.8.14/header.html | 2 +- Documentation/doc/resources/1.8.14/header_package.html | 2 +- Documentation/doc/resources/1.8.4/header.html | 2 +- Documentation/doc/resources/1.8.4/header_package.html | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Documentation/doc/resources/1.8.13/header.html b/Documentation/doc/resources/1.8.13/header.html index 5edbcbc3ec0..ea550ad48c8 100644 --- a/Documentation/doc/resources/1.8.13/header.html +++ b/Documentation/doc/resources/1.8.13/header.html @@ -2,7 +2,7 @@ - + diff --git a/Documentation/doc/resources/1.8.13/header_package.html b/Documentation/doc/resources/1.8.13/header_package.html index a70e9ff6742..c8e2578351f 100644 --- a/Documentation/doc/resources/1.8.13/header_package.html +++ b/Documentation/doc/resources/1.8.13/header_package.html @@ -2,7 +2,7 @@ - + diff --git a/Documentation/doc/resources/1.8.14/header.html b/Documentation/doc/resources/1.8.14/header.html index 5edbcbc3ec0..ea550ad48c8 100644 --- a/Documentation/doc/resources/1.8.14/header.html +++ b/Documentation/doc/resources/1.8.14/header.html @@ -2,7 +2,7 @@ - + diff --git a/Documentation/doc/resources/1.8.14/header_package.html b/Documentation/doc/resources/1.8.14/header_package.html index a70e9ff6742..7adad539ace 100644 --- a/Documentation/doc/resources/1.8.14/header_package.html +++ b/Documentation/doc/resources/1.8.14/header_package.html @@ -2,7 +2,7 @@ - + diff --git a/Documentation/doc/resources/1.8.4/header.html b/Documentation/doc/resources/1.8.4/header.html index b125e40186c..890229ec02c 100644 --- a/Documentation/doc/resources/1.8.4/header.html +++ b/Documentation/doc/resources/1.8.4/header.html @@ -1,7 +1,7 @@ - + $projectname: $title diff --git a/Documentation/doc/resources/1.8.4/header_package.html b/Documentation/doc/resources/1.8.4/header_package.html index 65b3e1d9eac..051c01002f6 100644 --- a/Documentation/doc/resources/1.8.4/header_package.html +++ b/Documentation/doc/resources/1.8.4/header_package.html @@ -1,7 +1,7 @@ - + $projectname: $title From 06b7cd42ba76960d18e31e4d92bce12ae2df245a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 21 Nov 2018 09:47:22 +0100 Subject: [PATCH 059/193] fix urls in bib --- Documentation/doc/biblio/cgal_manual.bib | 46 ++++++++++++------------ Documentation/doc/biblio/geom.bib | 32 +++++++---------- 2 files changed, 35 insertions(+), 43 deletions(-) diff --git a/Documentation/doc/biblio/cgal_manual.bib b/Documentation/doc/biblio/cgal_manual.bib index 70004c3a6e8..1955782a43a 100644 --- a/Documentation/doc/biblio/cgal_manual.bib +++ b/Documentation/doc/biblio/cgal_manual.bib @@ -102,7 +102,7 @@ ,howpublished = {American National Standards Institute, 11 West 42nd Street, New York 10036} ,year = 1998 - ,url = "http://webstore.ansi.org/" + ,url = "https://webstore.ansi.org/" ,update = "04.03 kettner, 01.06 hoffmann" } @@ -281,8 +281,8 @@ Boissonnat} ,author = {Gavin Bell and Anthony Parisi and Mark Pesce} ,title = {VRML The Virtual Reality Modeling Language: Version 1.0 Specification} - ,howpublished = {\url{http://www.web3d.org/x3d/specifications/vrml/VRML1.0/index.html}} - ,url = "http://www.web3d.org/x3d/specifications/vrml/VRML1.0/index.html" + ,howpublished = {\url{http://www.web3d.org/standards}} + ,url = "http://www.web3d.org/standards" ,month = {May 26} ,year = 1995 ,update = "13.04 lrineau" @@ -314,7 +314,7 @@ Boissonnat} ,school = "Universit\'e de {Nice-Sophia Antipolis}" ,address = "France" ,year = 2010 - ,url = "http://tel.archives-ouvertes.fr/tel-00552215/" + ,url = "https://tel.archives-ouvertes.fr/tel-00552215/" } @article{cgal:cc-rgbss-78 @@ -437,7 +437,7 @@ note="Conference version: Symp. on Geometry Processing 2003" , year = 2009 , volume = 5757 , pages = "37--48" -, note = "Full version available as INRIA Research Report 6823 \url{http://hal.inria.fr/inria-00356871}" +, note = "Full version available as INRIA Research Report 6823 \url{https://hal.inria.fr/inria-00356871}" } @inproceedings{cgal:pt-rs-14, @@ -596,7 +596,7 @@ Mourrain and Monique Teillaud" , nickname = "ALENEX '03" , year = 2003 , pages = "37--44" - , url = "http://hal.inria.fr/inria-00344517/" + , url = "https://hal.inria.fr/inria-00344517/" } @article{ cgal:dpt-wt-02 @@ -615,7 +615,7 @@ Teillaud" , author = "Olivier Devillers and Monique Teillaud" , title = "Perturbations and Vertex Removal in a {3D Delaunay} Triangulation" , booktitle = "Proc. 14th ACM-SIAM Sympos. Discrete Algorithms (SODA)" - , url = "http://hal.inria.fr/inria-00166710/" + , url = "https://hal.inria.fr/inria-00166710/" , year = 2003 , pages = "313-319" } @@ -1502,7 +1502,7 @@ ABSTRACT = {We present the first complete, exact and efficient C++ implementatio ,title = {The {LEDA} {U}ser {M}anual} ,organization = {Algorithmic Solutions} ,address = {66123 Saarbr\"ucken, Germany} - ,url = {http://www.algorithmic-solutions.info/leda_manual/manual.html} + ,url = {http://www.algorithmic-solutions.info/leda_manual/MANUAL.html} } @article{ cgal:mog-vbcfe-11 @@ -1560,7 +1560,7 @@ ABSTRACT = {We present the first complete, exact and efficient C++ implementatio title = {{MPFR} - The Multiple Precision Floating-Point Reliable Library}, howpublished = {The {MPFR} Team}, - url = {http://mpfr.org}, + url = {https://mpfr.org}, update = "09.11 penarand" } @@ -1741,7 +1741,6 @@ ABSTRACT = {We present the first complete, exact and efficient C++ implementatio key = {RS}, title = {{RS - A} Software for real solving of algebraic systems}, howpublished = {{R}ouillier, {F}abrice}, - url = {http://www.loria.fr/equipes/vegas/rs/}, update = "09.11 penarand" } @@ -1875,7 +1874,6 @@ ABSTRACT = {We present the first complete, exact and efficient C++ implementatio @misc{ cgal:sgcsi-stlpg-97 ,author = {{Silicon Graphics Computer Systems{,} Inc.}} ,title = {Standard Template Library Programmer's Guide} - ,url = {http://www.sgi.com/Technology/STL/} ,year = 1997 ,annote = {Web reference to the STL from SGI. recommended C++ and STL reference material.} @@ -1917,7 +1915,7 @@ ABSTRACT = {We present the first complete, exact and efficient C++ implementatio ,month = dec ,year = {2000} ,issn = {0946-011X} - ,url = {http://www.mpi-sb.mpg.de/~mehlhorn/ftp/InfiFrames.ps} + ,url = {https://www.mpi-sb.mpg.de/~mehlhorn/ftp/InfiFrames.ps} } @InProceedings{cgal:sp-mrbee-05 @@ -2007,7 +2005,7 @@ location = {Salt Lake City, Utah, USA} , pages = "75:1-75:9" , note = "SIGGRAPH '2009 Conference Proceedings" , volume = "28(3)" -, url = "http://hal.inria.fr/inria-00359288" +, url = "https://hal.inria.fr/inria-00359288" , geombib = "not yet" , x-editorial-board = {yes} , x-proceedings = {yes} @@ -2140,7 +2138,7 @@ location = {Salt Lake City, Utah, USA} howpublished = {Stefan Walk (ETH Zurich, Department of Civil, Environmental and Geomatic Engineering, Institute of Geodesy and Photogrammetry)}, - url = {http://www.prs.igp.ethz.ch/research/Source_code_and_datasets.html}, + url = {https://www.prs.igp.ethz.ch/research/Source_code_and_datasets.html}, year = 2014 } @@ -2208,7 +2206,7 @@ location = {Salt Lake City, Utah, USA} editor = "L{\'{a}}szl{\'{o}} Szirmay Kalos", pages = "210--218", year = "1998", - url = "citeseer.ist.psu.edu/article/felkel98straight.html" + url = "http://citeseer.ist.psu.edu/article/felkel98straight.html" } @inproceedings{ cgal:ee-rrccpp-98, @@ -2217,7 +2215,7 @@ location = {Salt Lake City, Utah, USA} booktitle = "Symposium on Computational Geometry", pages = "58--67", year = "1998", - url = "citeseer.ist.psu.edu/eppstein98raising.html" + url = "http://citeseer.ist.psu.edu/eppstein98raising.html" } @inproceedings{ cgal:ld-agrm-03, @@ -2270,7 +2268,7 @@ pages = {69-79}, ee = {http://link.springer.de/link/service/series/0558/bibs/1766/17660069.htm}, crossref = {cgal:jlm-isgp-98}, bibsource = {DBLP, http://dblp.uni-trier.de}, -url = "http://www.boost.org/community/exception_safety.html" +url = "https://www.boost.org/community/exception_safety.html" } @misc{ cgal:asprs-lasf-13 @@ -2278,7 +2276,7 @@ url = "http://www.boost.org/community/exception_safety.html" ,title = "LASer ({LAS}) File Format Exchange Activities" ,howpublished = {American Society for Photogrammetry \& Remote Sensing} ,year = 2013 - ,url = "https://www.asprs.org/committee-general/laser-las-file-format-exchange-activities.html" + ,url = "https://www.asprs.org/divisions-committees/lidar-division/laser-las-file-format-exchange-activities" } @article{cgal:as-solri-92 @@ -2412,7 +2410,7 @@ author = "Pedro M.M. de Castro and Frederic Cazals and Sebastien Loriot and Moni AUTHOR = {Otfried Cheong}, EDITION = {6.0pre32}, YEAR = {2009}, - URL = {http://tclab.kaist.ac.kr/ipe/} + URL = {http://ipe.otfried.org/} } @misc{cgal:t-ocdl-05, @@ -2430,7 +2428,7 @@ author = "Pedro M.M. de Castro and Frederic Cazals and Sebastien Loriot and Moni editor = "Jacob E. Goodman, J\'anos Pach and Emo Welzl", year = {2005}, pages = {439-458}, - URL = {http://www.msri.org/communications/books/Book52/files/23liu.pdf}, + URL = {http://library.msri.org/books/Book52/files/23liu.pdf}, publisher = {MSRI Publications} } @@ -2443,7 +2441,7 @@ author = "Pedro M.M. de Castro and Frederic Cazals and Sebastien Loriot and Moni , volume = "40" , number = "1" , pages = "61-78" -, url = "http://hal.inria.fr/inria-00344310/" +, url = "https://hal.inria.fr/inria-00344310/" , doi = "10.1016/j.comgeo.2007.06.003" , x-international-audience = "yes" , x-editorial-board = "yes" @@ -2463,7 +2461,7 @@ author = "Pedro M.M. de Castro and Frederic Cazals and Sebastien Loriot and Moni , title = "Complexity of {Delaunay} triangulation for points on lower-dimensional polyhedra" , booktitle = "Proc. 18th ACM-SIAM Sympos. Discrete Algorithms" , nickname = "SODA" -, url = "http://hal.inria.fr/inria-00182835/" +, url = "https://hal.inria.fr/inria-00182835/" , year = 2007 , pages = "1106--1113" } @@ -2589,7 +2587,7 @@ ADDRESS = "Saarbr{\"u}cken, Germany" author={Sorkine, Olga}, year={2009}, pages={1-6}, - howpublished = {http://igl.ethz.ch/projects/ARAP/} + url = {https://igl.ethz.ch/projects/ARAP/} @book{cgal:bc:m-dbc-27, Address = {Leipzig}, @@ -2735,7 +2733,7 @@ pages = "207--221" journal = {CoRR}, year = {2014}, volume = {abs/1403.3905}, - url = {http://arxiv.org/abs/1403.3905}, + url = {https://arxiv.org/abs/1403.3905}, timestamp = {Wed, 17 Sep 2014 16:30:16 +0200}, biburl = {http://dblp.uni-trier.de/rec/bib/journals/corr/BungiuHHHK14}, bibsource = {dblp computer science bibliography, http://dblp.org} diff --git a/Documentation/doc/biblio/geom.bib b/Documentation/doc/biblio/geom.bib index 801a459f83e..b6602668758 100644 --- a/Documentation/doc/biblio/geom.bib +++ b/Documentation/doc/biblio/geom.bib @@ -7010,7 +7010,6 @@ cell neighborhood in $O(m)$ time." , type = "Research {Report}" , institution = "Xerox PARC" , year = 1997 -, url = "http://www.geom.umn.edu/~nina/papers/crust.ps.gz" , precedes = "abe-cbscc-98" , update = "00.03 devillers, 98.03 devillers" } @@ -11387,7 +11386,7 @@ method that uses very different techniques." , address = "BP93, 06902 Sophia-Antipolis, France" , month = jun , year = 1993 -, url = "http://www.inria.fr/cgi-bin/wais_ra_sophia?question=1990" +, url = "https://hal.inria.fr/inria-00074682" , keywords = "parallel algorithms, hypercube, multisearching, point location" , update = "95.09 devillers, 95.01 devillers, 93.09 devillers+milone+mitchell" } @@ -19005,7 +19004,6 @@ $O(n^2)$ in the plane." , address = "Berlin" , year = 1997 , isbn = "3-540-61270-X" -, url = "http://www.cs.ruu.nl/geobook/" , keywords = "textbook" , update = "98.03 agarwal+mitchell, 97.11 oostrum+orourke" } @@ -19734,7 +19732,7 @@ $O(n^2)$ in the plane." , booktitle = "Proc. 11th Canad. Conf. Comput. Geom." , year = 1999 , pages = "13--16" -, note = "Full version: http://arXiv.org/abs/cs/9908003/" +, note = "Full version: https://arXiv.org/abs/cs/9908003/" , url = "http://www.cs.ubc.ca/conferences/CCCG/elec_proc/elecproc.html" , update = "01.11 orourke, 00.03 orourke" } @@ -24218,7 +24216,7 @@ must lie in the halfplanes delimited by the query lines." , volume = 8 , year = 1992 , pages = "51--71" -, url = "http://www-sop.inria.fr/prisme/publis/bdsty-arsol-92.ps.gz" +, url = "https://hal.inria.fr/inria-00090675" , keywords = "randomized algorithms, Delaunay triangulation, semi-dynamic algorithms, arrangement of line-segments" , succeeds = "bdsty-olgag-91i" , update = "99.11 bibrelex, 99.07 devillers, 98.07 bibrelex, 97.03 devillers, 96.01 devillers, 95.09 devillers, 95.01 devillers" @@ -24669,7 +24667,6 @@ present a polynomial-time exact algorithm to solve this problem." , address = "UK" , year = 1998 , note = "Translated by Herv{\'e} Br{\"o}nnimann" -, url = "http://www.cup.cam.ac.uk/Scripts/webbook.asp?isbn=0521563224" , succeeds = "by-ga-95" , update = "99.11 devillers, 99.07 devillers, 99.03 bibrelex+devillers, 98.07 devillers" , annote = "translated from {\cite{by-ga-95}} by Herv{\'e} Br{\"o}nnimann" @@ -24681,7 +24678,6 @@ present a polynomial-time exact algorithm to solve this problem." , publisher = "Ediscience international" , address = "Paris" , year = 1995 -, url = "http://www-sop.inria.fr/prisme/personnel/yvinec/livre.html" , precedes = "by-ag-98" , update = "99.07 devillers, 99.03 bibrelex, 98.07 devillers, 96.01 devillers" } @@ -27495,7 +27491,7 @@ and solids on dynamically evolving grids without remeshing." , year = 1999 , pages = "173--197" , note = "Special Issue on Real Numbers and Computers" -, url = "http://www-sop.inria.fr/prisme/personnel/pion/publis/TCS.ps.gz" +, url = "https://hal.inria.fr/inria-00344324" , succeeds = "bepp-cegpu-97" , update = "99.07 devillers" } @@ -44299,7 +44295,7 @@ Contains C code." , booktitle = "Proc. 14th Annu. ACM Sympos. Comput. Geom." , year = 1998 , pages = "106--115" -, url = "http://www-sop.inria.fr/prisme/publis/d-iirdt-98.ps.gz" +, url = "https://hal.inria.fr/hal-01179446" , archive = "XXX:cs.CG/9907024" , update = "99.11 bibrelex+devillers, 99.07 devillers, 98.11 devillers" , abstract = "We propose a new data structure to compute the Delaunay triangulation of a set of points in the plane. It combines good worst case complexity, fast behavior on real data, and small memory occupation. The location structure is organized into several levels. The lowest level just consists of the triangulation, then each level contains the triangulation of a small sample of the levels below. Point location is done by marching in a triangulation to determine the nearest neighbor of the query at that level, then the march restarts from that neighbor at the level below. Using a small sample (3 {\%}) allows a small memory occupation; the march and the use of the nearest neighbor to change levels quickly locate the query." @@ -44337,7 +44333,7 @@ Contains C code." , year = 2009 , type = "Research Report" , number = 7104 -, url = "http://hal.inria.fr/inria-00433107/" +, url = "https://hal.inria.fr/inria-00433107/" } @inproceedings{d-ddt-99 @@ -44363,7 +44359,7 @@ Contains C code." , number = 1 , year = 1992 , pages = "97--111" -, url = "http://www-sop.inria.fr/prisme/publis/d-rysoa-92.ps.gz" +, url = "https://hal.inria.fr/inria-00167206" , archive = "XXX:cs.CG/9810007" , keywords = "randomized algorithms, Delaunay triangulation, skeleton, medial axis, minimum spanning tree, simple polygon" , succeeds = "d-sroa-91" @@ -44583,7 +44579,7 @@ respectively, we obtain a speedup of $\frac p{\log p}$." , number = 3 , year = 1995 , pages = "157--164" -, url = "http://www-sop.inria.fr/prisme/biblio/search.html" +, url = "https://hal.inria.fr/inria-00074391" , succeeds = "dg-iafch-94" , cites = "a-dcgp-85, bcddy-acchs-92, r-chada-92" , update = "99.11 devillers, 99.07 devillers, 96.01 devillers" @@ -44838,7 +44834,7 @@ respectively, we obtain a speedup of $\frac p{\log p}$." , volume = 20 , year = 1998 , pages = "523--547" -, url = "http://www-sop.inria.fr/prisme/publis/dp-papaf-98.ps.gz" +, url = "https://hal.inria.fr/inria-00090653" , archive = "XXX:cs.CG/9907029" , succeeds = "dp-papaf-96" , cites = "b-g-87, bkmnsu-egcl-95, bms-hcvdl-94, fv-eeacg-93, lpt-rpqiv-96, mn-iga-94, y-tegc-97" @@ -52318,7 +52314,6 @@ library." , month = jan , year = 1994 , pages = "43--72" -, url = "https://users.cs.duke.edu/~edels/Papers/1994-J-04-3DAlphaShapes.pdf" , comments = "Software in \url{ftp://cs.uiuc.edu/pub/edels/geometry/alpha-2.1a.tar.Z}" , update = "94.09 orourke" } @@ -68865,7 +68860,7 @@ generated in O(dn2d+1) time. We present a simple proof that the (d - @misc{g-ggmpa , author = "Torbj{\"o}rn Granlund" , title = "{GMP}, The {GNU} Multiple Precision Arithmetic Library" -, url = "http://gmplib.org/" +, url = "https://gmplib.org/" , update = "02.03 devillers" } @@ -85658,7 +85653,7 @@ fitting method." , title = "The {CORE} Library Project" , edition = "1.2" , year = 1999 -, url = "http://www.cs.nyu.edu/exact/core/" +, url = "https://www.cs.nyu.edu/exact/core/" , update = "00.03 devillers" } @@ -140391,7 +140386,7 @@ code." , publisher = "INRIA Sophia-Antipolis" , year = 1999 , pages = "175--178" -, url = "ftp://ftp-sop.inria.fr/geometrica/publis/t-3tc-99.pdf" +, url = "https://hal.inria.fr/inria-00167199" , update = "00.03 bibrelex+devillers, 99.07 bibrelex" } @@ -150728,7 +150723,6 @@ This improves previous bound of $O(mt+m\log m)$ in , address = "Singapore" , year = 1995 , pages = "452--492" -, url = "http://cs.nyu.edu/cs/faculty/yap/papers/paradigm.ps" , keywords = "survey paper, numeral computing, exact compuation, fixed-precision, multiprecision number packages" , update = "98.07 icking+vismara, 97.11 icking, 97.03 devillers+pocchiola" , abstract = "A survey of the approaches to non-robustness of geometric algorithms, and especially the exact computation approach. Also surveys available big-number packages." @@ -151944,7 +151938,7 @@ pages = {179--189} , number = "RR-8467" , month = "Feb" , year = "2014" -, url = "http://hal.inria.fr/hal-00943409" +, url = "https://hal.inria.fr/hal-00943409" } @article{XinWang2009improvingchenandhan, From 4275495292ae046fec5961e5e4d2650270f454c4 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 21 Nov 2018 13:49:37 +0100 Subject: [PATCH 060/193] List items that could not be saved and fix filter in save dialog --- Polyhedron/demo/Polyhedron/MainWindow.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Polyhedron/demo/Polyhedron/MainWindow.cpp b/Polyhedron/demo/Polyhedron/MainWindow.cpp index d5ab2608d76..49f7f004a39 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.cpp +++ b/Polyhedron/demo/Polyhedron/MainWindow.cpp @@ -2373,7 +2373,7 @@ void MainWindow::on_actionSa_ve_Scene_as_Script_triggered() QFileDialog::getSaveFileName(this, "Save the Scene as a Script File", last_saved_dir, - "*.js"); + "Qt Script files (*.js)"); std::ofstream os(filename.toUtf8()); if(!os) return; @@ -2381,13 +2381,17 @@ void MainWindow::on_actionSa_ve_Scene_as_Script_triggered() std::vector loaders; std::vector colors; std::vector rendering_modes; + QStringList not_saved; for(int i = 0; i < scene->numberOfEntries(); ++i) { Scene_item* item = scene->item(i); QString loader = item->property("loader_name").toString(); QString source = item->property("source filename").toString(); if(loader.isEmpty()) + { + not_saved.push_back(item->name()); continue; + } names.push_back(source); loaders.push_back(loader); colors.push_back(item->color()); @@ -2437,6 +2441,11 @@ void MainWindow::on_actionSa_ve_Scene_as_Script_triggered() os << "});\n"; os << "viewer.moveCameraToCoordinates(camera, 0.05);\n"; os.close(); + if(!not_saved.empty()) + QMessageBox::warning(this, + "Items Not Saved", + QString("The following items could not be saved: %1").arg( + not_saved.join(", "))); } void MainWindow::setTransparencyPasses(int val) From 1137fa73135f8f1c64585b6de7d5e3e1d47f6ff8 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 21 Nov 2018 16:10:17 +0100 Subject: [PATCH 061/193] Quiet compiler. Tomorrow's testsuite will show if we apply it everywhere --- Mesh_2/test/Mesh_2/test_double_map.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mesh_2/test/Mesh_2/test_double_map.cpp b/Mesh_2/test/Mesh_2/test_double_map.cpp index a8e1597cf75..b10368878f5 100644 --- a/Mesh_2/test/Mesh_2/test_double_map.cpp +++ b/Mesh_2/test/Mesh_2/test_double_map.cpp @@ -71,7 +71,7 @@ int main(int argc, char** argv) std::cerr << "Assignment f2=f...\n"; f2 = f; // check the assignment std::cerr << "Auto-assignment f=f...\n"; - f2 = f2; // check the auto-assignment + void(f2 = f2); // check the auto-assignment std::cerr << "Copy-construction...\n"; Map f3(f); // check the copy constructor From d6cfa1a8689d305660f8029ac1fa7603d9e71964 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 21 Nov 2018 16:17:39 +0100 Subject: [PATCH 062/193] Fix CMake warnings about CMP for Visual 2017 --- .../demo/Arrangement_on_surface_2/CMakeLists.txt | 4 ++++ CGAL_ImageIO/examples/CGALimageIO/CMakeLists.txt | 4 ++++ CGAL_ImageIO/test/CGAL_ImageIO/CMakeLists.txt | 4 ++++ Circular_kernel_3/demo/Circular_kernel_3/CMakeLists.txt | 4 ++++ GraphicsView/demo/Alpha_shapes_2/CMakeLists.txt | 4 ++++ GraphicsView/demo/Apollonius_graph_2/CMakeLists.txt | 4 ++++ GraphicsView/demo/Bounding_volumes/CMakeLists.txt | 4 ++++ GraphicsView/demo/Circular_kernel_2/CMakeLists.txt | 4 ++++ GraphicsView/demo/Generator/CMakeLists.txt | 4 ++++ GraphicsView/demo/GraphicsView/CMakeLists.txt | 4 ++++ GraphicsView/demo/L1_Voronoi_diagram_2/CMakeLists.txt | 4 ++++ GraphicsView/demo/Largest_empty_rect_2/CMakeLists.txt | 4 ++++ GraphicsView/demo/Periodic_2_triangulation_2/CMakeLists.txt | 4 ++++ GraphicsView/demo/Polygon/CMakeLists.txt | 4 ++++ GraphicsView/demo/Segment_Delaunay_graph_2/CMakeLists.txt | 4 ++++ .../demo/Segment_Delaunay_graph_Linf_2/CMakeLists.txt | 4 ++++ GraphicsView/demo/Snap_rounding_2/CMakeLists.txt | 4 ++++ GraphicsView/demo/Spatial_searching_2/CMakeLists.txt | 4 ++++ GraphicsView/demo/Stream_lines_2/CMakeLists.txt | 4 ++++ .../examples/Linear_cell_complex/CMakeLists.txt | 4 ++++ Mesh_3/examples/Mesh_3/CMakeLists.txt | 4 ++++ Mesh_3/test/Mesh_3/CMakeLists.txt | 3 +++ .../Optimal_transportation_reconstruction_2/CMakeLists.txt | 4 ++++ .../demo/Periodic_3_triangulation_3/CMakeLists.txt | 4 ++++ .../demo/Polyhedron/Plugins/Surface_mesh/CMakeLists.txt | 4 ++++ Polyhedron/demo/Polyhedron/implicit_functions/CMakeLists.txt | 4 ++++ Polyhedron/examples/Polyhedron/CMakeLists.txt | 4 ++++ .../demo/Polyline_simplification_2/CMakeLists.txt | 4 ++++ .../demo/Principal_component_analysis/CMakeLists.txt | 4 ++++ Surface_mesher/demo/Surface_mesher/CMakeLists.txt | 4 ++++ Surface_mesher/examples/Surface_mesher/CMakeLists.txt | 4 ++++ Triangulation_2/examples/Triangulation_2/CMakeLists.txt | 4 ++++ Triangulation_3/examples/Triangulation_3/CMakeLists.txt | 4 ++++ 33 files changed, 131 insertions(+) diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/CMakeLists.txt b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/CMakeLists.txt index 31b49747cf8..449c2d25303 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/CMakeLists.txt +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/CMakeLists.txt @@ -8,6 +8,10 @@ if(NOT POLICY CMP0070 AND POLICY CMP0053) cmake_policy(SET CMP0053 OLD) endif() +if(POLICY CMP0071) + cmake_policy(SET CMP0071 NEW) +endif() + find_package(CGAL COMPONENTS Core Qt5 ) find_package( Qt5 QUIET COMPONENTS Gui Widgets) diff --git a/CGAL_ImageIO/examples/CGALimageIO/CMakeLists.txt b/CGAL_ImageIO/examples/CGALimageIO/CMakeLists.txt index abf713eb1c8..3dcdf8d8c3d 100644 --- a/CGAL_ImageIO/examples/CGALimageIO/CMakeLists.txt +++ b/CGAL_ImageIO/examples/CGALimageIO/CMakeLists.txt @@ -5,6 +5,10 @@ project( CGALimageIO_Examples ) cmake_minimum_required(VERSION 3.1) +if(POLICY CMP0074) + cmake_policy(SET CMP0074 NEW) +endif() + find_package(CGAL QUIET COMPONENTS ImageIO ) if(CGAL_ImageIO_FOUND) diff --git a/CGAL_ImageIO/test/CGAL_ImageIO/CMakeLists.txt b/CGAL_ImageIO/test/CGAL_ImageIO/CMakeLists.txt index 7b39be42ee8..81eec777452 100644 --- a/CGAL_ImageIO/test/CGAL_ImageIO/CMakeLists.txt +++ b/CGAL_ImageIO/test/CGAL_ImageIO/CMakeLists.txt @@ -6,6 +6,10 @@ project( CGAL_ImageIO_Tests ) cmake_minimum_required(VERSION 3.1) +if(POLICY CMP0074) + cmake_policy(SET CMP0074 NEW) +endif() + find_package(CGAL QUIET COMPONENTS ImageIO ) if ( CGAL_FOUND ) diff --git a/Circular_kernel_3/demo/Circular_kernel_3/CMakeLists.txt b/Circular_kernel_3/demo/Circular_kernel_3/CMakeLists.txt index 7b855adddbf..f66a1c8c7b7 100644 --- a/Circular_kernel_3/demo/Circular_kernel_3/CMakeLists.txt +++ b/Circular_kernel_3/demo/Circular_kernel_3/CMakeLists.txt @@ -6,6 +6,10 @@ if(NOT POLICY CMP0070 AND POLICY CMP0053) cmake_policy(SET CMP0053 OLD) endif() +if(POLICY CMP0071) + cmake_policy(SET CMP0071 NEW) +endif() + find_package(CGAL COMPONENTS Qt5) find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL) diff --git a/GraphicsView/demo/Alpha_shapes_2/CMakeLists.txt b/GraphicsView/demo/Alpha_shapes_2/CMakeLists.txt index af389e5aa20..37dde3bd982 100644 --- a/GraphicsView/demo/Alpha_shapes_2/CMakeLists.txt +++ b/GraphicsView/demo/Alpha_shapes_2/CMakeLists.txt @@ -9,6 +9,10 @@ if(NOT POLICY CMP0070 AND POLICY CMP0053) cmake_policy(SET CMP0053 OLD) endif() +if(POLICY CMP0071) + cmake_policy(SET CMP0071 NEW) +endif() + find_package(CGAL COMPONENTS Qt5) find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg) diff --git a/GraphicsView/demo/Apollonius_graph_2/CMakeLists.txt b/GraphicsView/demo/Apollonius_graph_2/CMakeLists.txt index 1a858439904..81032979285 100644 --- a/GraphicsView/demo/Apollonius_graph_2/CMakeLists.txt +++ b/GraphicsView/demo/Apollonius_graph_2/CMakeLists.txt @@ -9,6 +9,10 @@ if(NOT POLICY CMP0070 AND POLICY CMP0053) cmake_policy(SET CMP0053 OLD) endif() +if(POLICY CMP0071) + cmake_policy(SET CMP0071 NEW) +endif() + find_package(CGAL COMPONENTS Qt5) find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg) diff --git a/GraphicsView/demo/Bounding_volumes/CMakeLists.txt b/GraphicsView/demo/Bounding_volumes/CMakeLists.txt index 2ac22c9815b..3226cd34f12 100644 --- a/GraphicsView/demo/Bounding_volumes/CMakeLists.txt +++ b/GraphicsView/demo/Bounding_volumes/CMakeLists.txt @@ -9,6 +9,10 @@ if(NOT POLICY CMP0070 AND POLICY CMP0053) cmake_policy(SET CMP0053 OLD) endif() +if(POLICY CMP0071) + cmake_policy(SET CMP0071 NEW) +endif() + find_package(CGAL COMPONENTS Qt5) find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg) diff --git a/GraphicsView/demo/Circular_kernel_2/CMakeLists.txt b/GraphicsView/demo/Circular_kernel_2/CMakeLists.txt index 60a6c359d4c..42b93286ba8 100644 --- a/GraphicsView/demo/Circular_kernel_2/CMakeLists.txt +++ b/GraphicsView/demo/Circular_kernel_2/CMakeLists.txt @@ -9,6 +9,10 @@ if(NOT POLICY CMP0070 AND POLICY CMP0053) cmake_policy(SET CMP0053 OLD) endif() +if(POLICY CMP0071) + cmake_policy(SET CMP0071 NEW) +endif() + find_package(CGAL COMPONENTS Qt5) diff --git a/GraphicsView/demo/Generator/CMakeLists.txt b/GraphicsView/demo/Generator/CMakeLists.txt index 53b33e71048..bd373d9f2f8 100644 --- a/GraphicsView/demo/Generator/CMakeLists.txt +++ b/GraphicsView/demo/Generator/CMakeLists.txt @@ -8,6 +8,10 @@ if(NOT POLICY CMP0070 AND POLICY CMP0053) cmake_policy(SET CMP0053 OLD) endif() +if(POLICY CMP0071) + cmake_policy(SET CMP0071 NEW) +endif() + find_package(CGAL COMPONENTS Qt5) find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg) diff --git a/GraphicsView/demo/GraphicsView/CMakeLists.txt b/GraphicsView/demo/GraphicsView/CMakeLists.txt index 5f92ac528dc..68f0d001b0a 100644 --- a/GraphicsView/demo/GraphicsView/CMakeLists.txt +++ b/GraphicsView/demo/GraphicsView/CMakeLists.txt @@ -8,6 +8,10 @@ if(NOT POLICY CMP0070 AND POLICY CMP0053) cmake_policy(SET CMP0053 OLD) endif() +if(POLICY CMP0071) + cmake_policy(SET CMP0071 NEW) +endif() + find_package(CGAL COMPONENTS Qt5) find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg) diff --git a/GraphicsView/demo/L1_Voronoi_diagram_2/CMakeLists.txt b/GraphicsView/demo/L1_Voronoi_diagram_2/CMakeLists.txt index 9903f9ca190..1b901707799 100644 --- a/GraphicsView/demo/L1_Voronoi_diagram_2/CMakeLists.txt +++ b/GraphicsView/demo/L1_Voronoi_diagram_2/CMakeLists.txt @@ -9,6 +9,10 @@ if(NOT POLICY CMP0070 AND POLICY CMP0053) cmake_policy(SET CMP0053 OLD) endif() +if(POLICY CMP0071) + cmake_policy(SET CMP0071 NEW) +endif() + find_package(CGAL COMPONENTS Qt5) find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg) diff --git a/GraphicsView/demo/Largest_empty_rect_2/CMakeLists.txt b/GraphicsView/demo/Largest_empty_rect_2/CMakeLists.txt index 1faba1f18d0..13abece7acf 100644 --- a/GraphicsView/demo/Largest_empty_rect_2/CMakeLists.txt +++ b/GraphicsView/demo/Largest_empty_rect_2/CMakeLists.txt @@ -9,6 +9,10 @@ if(NOT POLICY CMP0070 AND POLICY CMP0053) cmake_policy(SET CMP0053 OLD) endif() +if(POLICY CMP0071) + cmake_policy(SET CMP0071 NEW) +endif() + find_package(CGAL COMPONENTS Qt5) find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg) diff --git a/GraphicsView/demo/Periodic_2_triangulation_2/CMakeLists.txt b/GraphicsView/demo/Periodic_2_triangulation_2/CMakeLists.txt index 6e2d6348e65..f10f7bc0b63 100644 --- a/GraphicsView/demo/Periodic_2_triangulation_2/CMakeLists.txt +++ b/GraphicsView/demo/Periodic_2_triangulation_2/CMakeLists.txt @@ -6,6 +6,10 @@ if(NOT POLICY CMP0070 AND POLICY CMP0053) cmake_policy(SET CMP0053 OLD) endif() +if(POLICY CMP0071) + cmake_policy(SET CMP0071 NEW) +endif() + find_package(CGAL COMPONENTS Qt5) diff --git a/GraphicsView/demo/Polygon/CMakeLists.txt b/GraphicsView/demo/Polygon/CMakeLists.txt index 0e4e0a01d38..33e16c25117 100644 --- a/GraphicsView/demo/Polygon/CMakeLists.txt +++ b/GraphicsView/demo/Polygon/CMakeLists.txt @@ -9,6 +9,10 @@ if(NOT POLICY CMP0070 AND POLICY CMP0053) cmake_policy(SET CMP0053 OLD) endif() +if(POLICY CMP0071) + cmake_policy(SET CMP0071 NEW) +endif() + find_package(CGAL COMPONENTS Qt5 Core) find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater) diff --git a/GraphicsView/demo/Segment_Delaunay_graph_2/CMakeLists.txt b/GraphicsView/demo/Segment_Delaunay_graph_2/CMakeLists.txt index a2fd30a9230..97af016cffd 100644 --- a/GraphicsView/demo/Segment_Delaunay_graph_2/CMakeLists.txt +++ b/GraphicsView/demo/Segment_Delaunay_graph_2/CMakeLists.txt @@ -9,6 +9,10 @@ if(NOT POLICY CMP0070 AND POLICY CMP0053) cmake_policy(SET CMP0053 OLD) endif() +if(POLICY CMP0071) + cmake_policy(SET CMP0071 NEW) +endif() + find_package(CGAL COMPONENTS Qt5 Core) set( QT_USE_QTXML TRUE ) diff --git a/GraphicsView/demo/Segment_Delaunay_graph_Linf_2/CMakeLists.txt b/GraphicsView/demo/Segment_Delaunay_graph_Linf_2/CMakeLists.txt index 03685cdbfef..556e8577984 100644 --- a/GraphicsView/demo/Segment_Delaunay_graph_Linf_2/CMakeLists.txt +++ b/GraphicsView/demo/Segment_Delaunay_graph_Linf_2/CMakeLists.txt @@ -9,6 +9,10 @@ if(NOT POLICY CMP0070 AND POLICY CMP0053) cmake_policy(SET CMP0053 OLD) endif() +if(POLICY CMP0071) + cmake_policy(SET CMP0071 NEW) +endif() + find_package(CGAL COMPONENTS Qt5 Core) set( QT_USE_QTXML TRUE ) diff --git a/GraphicsView/demo/Snap_rounding_2/CMakeLists.txt b/GraphicsView/demo/Snap_rounding_2/CMakeLists.txt index d19002e1bd4..2d0631da561 100644 --- a/GraphicsView/demo/Snap_rounding_2/CMakeLists.txt +++ b/GraphicsView/demo/Snap_rounding_2/CMakeLists.txt @@ -9,6 +9,10 @@ if(NOT POLICY CMP0070 AND POLICY CMP0053) cmake_policy(SET CMP0053 OLD) endif() +if(POLICY CMP0071) + cmake_policy(SET CMP0071 NEW) +endif() + find_package(CGAL COMPONENTS Qt5) find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg) diff --git a/GraphicsView/demo/Spatial_searching_2/CMakeLists.txt b/GraphicsView/demo/Spatial_searching_2/CMakeLists.txt index b3aaa8bd452..63f2a37ffe5 100644 --- a/GraphicsView/demo/Spatial_searching_2/CMakeLists.txt +++ b/GraphicsView/demo/Spatial_searching_2/CMakeLists.txt @@ -9,6 +9,10 @@ if(NOT POLICY CMP0070 AND POLICY CMP0053) cmake_policy(SET CMP0053 OLD) endif() +if(POLICY CMP0071) + cmake_policy(SET CMP0071 NEW) +endif() + find_package(CGAL COMPONENTS Qt5) find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg) diff --git a/GraphicsView/demo/Stream_lines_2/CMakeLists.txt b/GraphicsView/demo/Stream_lines_2/CMakeLists.txt index 999e107fbbf..a9bf93ac1fe 100644 --- a/GraphicsView/demo/Stream_lines_2/CMakeLists.txt +++ b/GraphicsView/demo/Stream_lines_2/CMakeLists.txt @@ -9,6 +9,10 @@ if(NOT POLICY CMP0070 AND POLICY CMP0053) cmake_policy(SET CMP0053 OLD) endif() +if(POLICY CMP0071) + cmake_policy(SET CMP0071 NEW) +endif() + find_package(CGAL COMPONENTS Qt5) diff --git a/Linear_cell_complex/examples/Linear_cell_complex/CMakeLists.txt b/Linear_cell_complex/examples/Linear_cell_complex/CMakeLists.txt index 653f6e2bc8b..4ed3f8f2f2c 100644 --- a/Linear_cell_complex/examples/Linear_cell_complex/CMakeLists.txt +++ b/Linear_cell_complex/examples/Linear_cell_complex/CMakeLists.txt @@ -9,6 +9,10 @@ if(NOT POLICY CMP0070 AND POLICY CMP0053) cmake_policy(SET CMP0053 OLD) endif() +if(POLICY CMP0071) + cmake_policy(SET CMP0071 NEW) +endif() + find_package(CGAL COMPONENTS Qt5) if(CGAL_Qt5_FOUND) diff --git a/Mesh_3/examples/Mesh_3/CMakeLists.txt b/Mesh_3/examples/Mesh_3/CMakeLists.txt index 73911e50fc1..40112d910f1 100644 --- a/Mesh_3/examples/Mesh_3/CMakeLists.txt +++ b/Mesh_3/examples/Mesh_3/CMakeLists.txt @@ -14,6 +14,10 @@ if ( MESH_3_VERBOSE ) add_definitions(-DCGAL_MESH_3_VERBOSE) endif() +if(POLICY CMP0074) + cmake_policy(SET CMP0074 NEW) +endif() + find_package(CGAL COMPONENTS ImageIO) if ( CGAL_FOUND ) diff --git a/Mesh_3/test/Mesh_3/CMakeLists.txt b/Mesh_3/test/Mesh_3/CMakeLists.txt index 61800ebca61..1dd4729c042 100644 --- a/Mesh_3/test/Mesh_3/CMakeLists.txt +++ b/Mesh_3/test/Mesh_3/CMakeLists.txt @@ -6,6 +6,9 @@ project( Mesh_3_Tests ) cmake_minimum_required(VERSION 3.1) +if(POLICY CMP0074) + cmake_policy(SET CMP0074 NEW) +endif() find_package(CGAL QUIET COMPONENTS ImageIO) diff --git a/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/CMakeLists.txt b/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/CMakeLists.txt index 347644cd409..86f1b6be942 100644 --- a/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/CMakeLists.txt +++ b/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/CMakeLists.txt @@ -8,6 +8,10 @@ if(NOT POLICY CMP0070 AND POLICY CMP0053) cmake_policy(SET CMP0053 OLD) endif() +if(POLICY CMP0071) + cmake_policy(SET CMP0071 NEW) +endif() + # Include this package's headers first include_directories( BEFORE ./ ./include ) diff --git a/Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/CMakeLists.txt b/Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/CMakeLists.txt index 78cf24b1e25..b3b8b63f561 100644 --- a/Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/CMakeLists.txt +++ b/Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/CMakeLists.txt @@ -10,6 +10,10 @@ if(NOT POLICY CMP0070 AND POLICY CMP0053) cmake_policy(SET CMP0053 OLD) endif() +if(POLICY CMP0071) + cmake_policy(SET CMP0071 NEW) +endif() + # Find CGAL find_package(CGAL COMPONENTS Qt5) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/CMakeLists.txt index fae7ac22136..c5e5d006a23 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/CMakeLists.txt @@ -1,5 +1,9 @@ include( polyhedron_demo_macros ) +if(POLICY CMP0074) + cmake_policy(SET CMP0074 NEW) +endif() + if(EIGEN3_FOUND) find_package(CGAL COMPONENTS Core) diff --git a/Polyhedron/demo/Polyhedron/implicit_functions/CMakeLists.txt b/Polyhedron/demo/Polyhedron/implicit_functions/CMakeLists.txt index 47dfb9ba3d3..071dba98d86 100644 --- a/Polyhedron/demo/Polyhedron/implicit_functions/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/implicit_functions/CMakeLists.txt @@ -10,6 +10,10 @@ if(NOT POLICY CMP0070 AND POLICY CMP0053) cmake_policy(SET CMP0053 OLD) endif() +if(POLICY CMP0074) + cmake_policy(SET CMP0074 NEW) +endif() + # Let plugins be compiled in the same directory as the executable. set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") diff --git a/Polyhedron/examples/Polyhedron/CMakeLists.txt b/Polyhedron/examples/Polyhedron/CMakeLists.txt index c190c02a009..e5574f90c81 100644 --- a/Polyhedron/examples/Polyhedron/CMakeLists.txt +++ b/Polyhedron/examples/Polyhedron/CMakeLists.txt @@ -11,6 +11,10 @@ if(NOT POLICY CMP0070 AND POLICY CMP0053) cmake_policy(SET CMP0053 OLD) endif() +if(POLICY CMP0071) + cmake_policy(SET CMP0071 NEW) +endif() + find_package(CGAL COMPONENTS Qt5) if(CGAL_Qt5_FOUND) diff --git a/Polyline_simplification_2/demo/Polyline_simplification_2/CMakeLists.txt b/Polyline_simplification_2/demo/Polyline_simplification_2/CMakeLists.txt index 5ff66f49e79..4017702ca44 100644 --- a/Polyline_simplification_2/demo/Polyline_simplification_2/CMakeLists.txt +++ b/Polyline_simplification_2/demo/Polyline_simplification_2/CMakeLists.txt @@ -9,6 +9,10 @@ if(NOT POLICY CMP0070 AND POLICY CMP0053) cmake_policy(SET CMP0053 OLD) endif() +if(POLICY CMP0071) + cmake_policy(SET CMP0071 NEW) +endif() + find_package(CGAL COMPONENTS Qt5) find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Widgets Svg) diff --git a/Principal_component_analysis/demo/Principal_component_analysis/CMakeLists.txt b/Principal_component_analysis/demo/Principal_component_analysis/CMakeLists.txt index fc970ec50e6..a5ef7c1c906 100644 --- a/Principal_component_analysis/demo/Principal_component_analysis/CMakeLists.txt +++ b/Principal_component_analysis/demo/Principal_component_analysis/CMakeLists.txt @@ -8,6 +8,10 @@ if(NOT POLICY CMP0070 AND POLICY CMP0053) cmake_policy(SET CMP0053 OLD) endif() +if(POLICY CMP0071) + cmake_policy(SET CMP0071 NEW) +endif() + foreach(INCDIR ../../../STL_Extension/include ../../../GraphicsView/include ../../../filtered_kernel/include ) if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${INCDIR}") include_directories (BEFORE "${CMAKE_CURRENT_SOURCE_DIR}/${INCDIR}") diff --git a/Surface_mesher/demo/Surface_mesher/CMakeLists.txt b/Surface_mesher/demo/Surface_mesher/CMakeLists.txt index 6644c8d37ff..3bc6c16965c 100644 --- a/Surface_mesher/demo/Surface_mesher/CMakeLists.txt +++ b/Surface_mesher/demo/Surface_mesher/CMakeLists.txt @@ -21,6 +21,10 @@ if(POLICY CMP0072) cmake_policy(SET CMP0072 NEW) endif() +if(POLICY CMP0074) + cmake_policy(SET CMP0074 NEW) +endif() + set(PACKAGE_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../..) # Add several CGAL packages to the include and link paths, diff --git a/Surface_mesher/examples/Surface_mesher/CMakeLists.txt b/Surface_mesher/examples/Surface_mesher/CMakeLists.txt index 589ad5d54c7..3446a487e88 100644 --- a/Surface_mesher/examples/Surface_mesher/CMakeLists.txt +++ b/Surface_mesher/examples/Surface_mesher/CMakeLists.txt @@ -5,6 +5,10 @@ project( Surface_mesher_Examples ) cmake_minimum_required(VERSION 3.1) +if(POLICY CMP0074) + cmake_policy(SET CMP0074 NEW) +endif() + find_package(CGAL QUIET COMPONENTS ImageIO) if ( CGAL_FOUND AND CGAL_ImageIO_FOUND ) diff --git a/Triangulation_2/examples/Triangulation_2/CMakeLists.txt b/Triangulation_2/examples/Triangulation_2/CMakeLists.txt index b6972c19b0a..20ef6aa9331 100644 --- a/Triangulation_2/examples/Triangulation_2/CMakeLists.txt +++ b/Triangulation_2/examples/Triangulation_2/CMakeLists.txt @@ -11,6 +11,10 @@ if(NOT POLICY CMP0070 AND POLICY CMP0053) cmake_policy(SET CMP0053 OLD) endif() +if(POLICY CMP0071) + cmake_policy(SET CMP0071 NEW) +endif() + find_package(CGAL COMPONENTS Qt5) if(CGAL_Qt5_FOUND) diff --git a/Triangulation_3/examples/Triangulation_3/CMakeLists.txt b/Triangulation_3/examples/Triangulation_3/CMakeLists.txt index 371b8c62fb2..121d27795ca 100644 --- a/Triangulation_3/examples/Triangulation_3/CMakeLists.txt +++ b/Triangulation_3/examples/Triangulation_3/CMakeLists.txt @@ -7,6 +7,10 @@ if(NOT POLICY CMP0070 AND POLICY CMP0053) cmake_policy(SET CMP0053 OLD) endif() +if(POLICY CMP0071) + cmake_policy(SET CMP0071 NEW) +endif() + find_package(CGAL COMPONENTS Qt5) if(CGAL_Qt5_FOUND) From f3a0fe0d8b2bda487fe0767d9bbd791ec4eeeeda Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Thu, 22 Nov 2018 09:17:45 +0000 Subject: [PATCH 063/193] Try another workaround --- Mesh_2/test/Mesh_2/test_double_map.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mesh_2/test/Mesh_2/test_double_map.cpp b/Mesh_2/test/Mesh_2/test_double_map.cpp index b10368878f5..7d05a3f7cfc 100644 --- a/Mesh_2/test/Mesh_2/test_double_map.cpp +++ b/Mesh_2/test/Mesh_2/test_double_map.cpp @@ -71,7 +71,7 @@ int main(int argc, char** argv) std::cerr << "Assignment f2=f...\n"; f2 = f; // check the assignment std::cerr << "Auto-assignment f=f...\n"; - void(f2 = f2); // check the auto-assignment + f2 = (Map&)f2; // check the auto-assignment std::cerr << "Copy-construction...\n"; Map f3(f); // check the copy constructor From c8514f669ada49fd9236e7e5e028aa6bdf54050e Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Thu, 22 Nov 2018 12:42:37 +0100 Subject: [PATCH 064/193] Set CMP0074 for polyhedron demo --- Polyhedron/demo/Polyhedron/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Polyhedron/demo/Polyhedron/CMakeLists.txt b/Polyhedron/demo/Polyhedron/CMakeLists.txt index b3f3f88a19b..81acdb46d7b 100644 --- a/Polyhedron/demo/Polyhedron/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/CMakeLists.txt @@ -15,6 +15,11 @@ if(POLICY CMP0072) cmake_policy(SET CMP0072 NEW) endif() +if(POLICY CMP0074) + cmake_policy(SET CMP0074 NEW) +endif() + + # Find includes in corresponding build directories set(CMAKE_INCLUDE_CURRENT_DIR ON) From f070af9a70bc70180a0d78a1c564d6defd01bd94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 22 Nov 2018 13:38:31 +0100 Subject: [PATCH 065/193] workaround when interseciont polyline goes to the border --- .../Corefinement/Face_graph_output_builder.h | 74 +++++++++++++++++++ .../data-clip/clipper_1.off | 16 ++++ .../data-clip/tm_1.off | 19 +++++ .../Polygon_mesh_processing/test_pmp_clip.cpp | 13 ++++ 4 files changed, 122 insertions(+) create mode 100644 Polygon_mesh_processing/test/Polygon_mesh_processing/data-clip/clipper_1.off create mode 100644 Polygon_mesh_processing/test/Polygon_mesh_processing/data-clip/tm_1.off diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h index 6733e2561f6..70310d43fd6 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h @@ -1553,6 +1553,80 @@ public: patches_of_tm1_used[inplace_operation_tm1], patches_of_tm2_used[inplace_operation_tm1], fids1, fids2, tm1, tm2); + + if (used_to_clip_a_surface) + { + // The following code is here to handle the case when an intersection polyline + // contains some border edges of tm1 that should be considered as an independant polyline. + // This polyline removal should be handled by remove_unused_polylines. + // However, since all nodes are of degree 2 the polyline is not split at + // the correct point and trouble happen. Here the workaround consists in + // removing border edges of patches to be removed that are not in a + // polyline schedule for removal. + std::set edges_removed_later; + boost::dynamic_bitset<> patches_to_remove = ~patches_of_tm1_used[inplace_operation_tm1]; + if (patches_to_remove.any() && polylines.to_skip_in_tm1.any()) + { + for (std::size_t poly_id = polylines.to_skip_in_tm1.find_first(); + poly_id < polylines.to_skip_in_tm1.npos; + poly_id = polylines.to_skip_in_tm1.find_next(poly_id)) + { + std::size_t nb_segments = polylines.lengths[poly_id]; + halfedge_descriptor h = polylines.tm1[poly_id]; + edges_removed_later.insert(edge(h, tm1)); + for (std::size_t i=1; i::iterator Hedge_iterator; + std::vector< Hedge_iterator > to_rm; + for (Hedge_iterator it = patches_of_tm1[i].shared_edges.begin(); + it!= patches_of_tm1[i].shared_edges.end(); + ++it) + { + if ( is_border(opposite(*it, tm1), tm1) && + edges_removed_later.count(edge(*it, tm1))==0 ) + { + to_rm.push_back(it); + } + } + if (!to_rm.empty()) + { + std::reverse(to_rm.begin(), to_rm.end()); + BOOST_FOREACH(Hedge_iterator it, to_rm) + { + patches_of_tm1[i].interior_edges.push_back(*it); + if (it!=cpp11::prev(patches_of_tm1[i].shared_edges.end())) + std::swap(patches_of_tm1[i].shared_edges.back(), *it); + patches_of_tm1[i].shared_edges.pop_back(); + } + //now update interior vertices + std::set border_vertices; + BOOST_FOREACH(halfedge_descriptor h, patches_of_tm1[i].shared_edges) + { + border_vertices.insert( target(h,tm1) ); + border_vertices.insert( source(h,tm1) ); + } + + BOOST_FOREACH(halfedge_descriptor h, patches_of_tm1[i].interior_edges) + { + if ( !border_vertices.count( target(h,tm1) ) ) + patches_of_tm1[i].interior_vertices.insert( target(h,tm1) ); + if ( !border_vertices.count( source(h,tm1) ) ) + patches_of_tm1[i].interior_vertices.insert( source(h,tm1) ); + } + } + } + } + #define CGAL_COREF_FUNCTION_CALL_DEF(BO_type) \ compute_inplace_operation( \ tm1, tm2, \ diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/data-clip/clipper_1.off b/Polygon_mesh_processing/test/Polygon_mesh_processing/data-clip/clipper_1.off new file mode 100644 index 00000000000..9cb3aa719fb --- /dev/null +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/data-clip/clipper_1.off @@ -0,0 +1,16 @@ +OFF +6 8 0 +-0.98999999999999977 10 0.99999999999999978 +-0.98999999999999999 -2.4671622769447923e-19 2.4671622769447923e-19 +-0.98999999999999999 10 10 +-0.99999999999999978 10 0.99999999999999978 +-1 0 0 +-1 10 10 +3 2 0 1 +3 4 3 5 +3 5 3 0 +3 0 2 5 +3 3 4 1 +3 1 0 3 +3 4 5 2 +3 2 1 4 diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/data-clip/tm_1.off b/Polygon_mesh_processing/test/Polygon_mesh_processing/data-clip/tm_1.off new file mode 100644 index 00000000000..be60022538b --- /dev/null +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/data-clip/tm_1.off @@ -0,0 +1,19 @@ +OFF +9 8 0 +-0.99999999999999978 10 0.99999999999999978 +-10 0 1 +0 0 1 +-1 0 1 +-0.98999999999999999 1 1 +-0.98999999999999999 1.1102230246251566e-19 1 +-0.99899999999999989 1.1102230246251564e-20 1 +-0.99099999999999988 1 1 +-1 1 1 +3 0 8 7 +3 0 1 8 +3 8 1 3 +3 0 4 2 +3 5 6 2 +3 4 5 2 +3 6 3 2 +3 0 7 4 diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_clip.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_clip.cpp index 91a59e0cdb1..d1c11f037dd 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_clip.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_clip.cpp @@ -270,6 +270,19 @@ void test() assert(vertices(tm1).size()==0); CGAL::clear(tm1); CGAL::clear(tm2); + + // test special case + input.open("data-clip/tm_1.off"); + input >> tm1; + input.close(); + input.open("data-clip/clipper_1.off"); + input >> tm2; + input.close(); + PMP::clip(tm1, tm2, params::face_index_map(get(CGAL::dynamic_face_property_t(), tm1)), + params::face_index_map(get(CGAL::dynamic_face_property_t(), tm2))); + assert(is_valid_polygon_mesh(tm1)); + CGAL::clear(tm1); + CGAL::clear(tm2); } int main() From 293f54dc2557057572670df149fc317694cf8440 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 22 Nov 2018 14:08:20 +0100 Subject: [PATCH 066/193] no need to consider polylines to skip they are not really used in remove_used_polylines and a polyline might be written as to skip while only a portion is (if the dangling part is the one edge per polyline) --- .../Corefinement/Face_graph_output_builder.h | 23 +------------------ 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h index 70310d43fd6..ed2e208ce71 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h @@ -1563,25 +1563,7 @@ public: // the correct point and trouble happen. Here the workaround consists in // removing border edges of patches to be removed that are not in a // polyline schedule for removal. - std::set edges_removed_later; boost::dynamic_bitset<> patches_to_remove = ~patches_of_tm1_used[inplace_operation_tm1]; - if (patches_to_remove.any() && polylines.to_skip_in_tm1.any()) - { - for (std::size_t poly_id = polylines.to_skip_in_tm1.find_first(); - poly_id < polylines.to_skip_in_tm1.npos; - poly_id = polylines.to_skip_in_tm1.find_next(poly_id)) - { - std::size_t nb_segments = polylines.lengths[poly_id]; - halfedge_descriptor h = polylines.tm1[poly_id]; - edges_removed_later.insert(edge(h, tm1)); - for (std::size_t i=1; i Date: Thu, 22 Nov 2018 13:20:05 +0000 Subject: [PATCH 067/193] Remove lines added by error one year ago --- GraphicsView/demo/Periodic_2_triangulation_2/CMakeLists.txt | 6 ------ 1 file changed, 6 deletions(-) diff --git a/GraphicsView/demo/Periodic_2_triangulation_2/CMakeLists.txt b/GraphicsView/demo/Periodic_2_triangulation_2/CMakeLists.txt index f10f7bc0b63..7e1d94d806e 100644 --- a/GraphicsView/demo/Periodic_2_triangulation_2/CMakeLists.txt +++ b/GraphicsView/demo/Periodic_2_triangulation_2/CMakeLists.txt @@ -34,12 +34,6 @@ qt5_add_resources ( CGAL_Qt5_RESOURCE_FILES ./Periodic_2_triangulation_2.qrc ) qt5_generate_moc( Periodic_2_Delaunay_triangulation_2.cpp Periodic_2_triangulation_2.moc ) # find header files for projects that can show them - -cmake_minimum_required(VERSION 3.1) -if(NOT POLICY CMP0070 AND POLICY CMP0053) - # Only set CMP0053 to OLD with CMake<3.10, otherwise there is a warning. - cmake_policy(SET CMP0053 OLD) -endif() file(GLOB headers "*.h") file(GLOB QT_headers "include/CGAL/Qt/*.h") file(GLOB P2T2_headers "../../../include/CGAL/*.h") From 78e375f15c7ba09b78c4c25d345e8db4c215a36d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 22 Nov 2018 16:14:18 +0100 Subject: [PATCH 068/193] add a special handling for degenerate faces on the border --- .../CGAL/Polygon_mesh_processing/repair.h | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair.h index 64f83de0869..0005edca6ac 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair.h @@ -900,9 +900,53 @@ bool remove_degenerate_faces( TriangleMesh& tmesh, } #endif + // Then, remove triangles made of 3 collinear points std::set degenerate_face_set; degenerate_faces(tmesh, std::inserter(degenerate_face_set, degenerate_face_set.begin()), np); + +// start by filtering out border faces + std::set border_deg_faces; + BOOST_FOREACH(face_descriptor f, degenerate_face_set) + { + halfedge_descriptor h = halfedge(f, tmesh); + for (int i=0; i<3; ++i) + { + if ( is_border( opposite(h, tmesh), tmesh) ) + { + border_deg_faces.insert(f); + break; + } + h = next(h, tmesh); + } + } + + while( !border_deg_faces.empty() ) + { + face_descriptor f_to_rm = *border_deg_faces.begin(); + border_deg_faces.erase(border_deg_faces.begin()); + + halfedge_descriptor h = halfedge(f_to_rm, tmesh); + for (int i=0; i<3; ++i) + { + if (is_border(h, tmesh) ) + { + face_descriptor f = face(opposite(h, tmesh), tmesh); + if (is_degenerate_triangle_face(f, tmesh, np) ) + border_deg_faces.insert(f); + } + h = next(h, tmesh); + } + + while( !is_border(opposite(h, tmesh), tmesh) ) + { + h = next(h, tmesh); + } + + degenerate_face_set .erase(f_to_rm); + Euler::remove_face(h, tmesh); + } + // Ignore faces with null edges if (!all_removed) { From ae9659539ef7b74acbe96825db7a22088e5acebe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 22 Nov 2018 16:58:13 +0100 Subject: [PATCH 069/193] simplify type --- .../Corefinement/Face_graph_output_builder.h | 12 ++++-------- .../internal/Corefinement/face_graph_utils.h | 4 +--- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h index ed2e208ce71..c9eed95cef6 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h @@ -103,8 +103,7 @@ class Face_graph_output_builder // Internal typedefs typedef std::size_t Node_id; typedef std::pair Node_id_pair; - typedef boost::unordered_map Intersection_edge_map; + typedef boost::unordered_set Intersection_edge_map; // to maintain a halfedge on each polyline per TriangleMesh + pair // with first = "is the key (pair) was reversed?" and // second is the number of edges -1 in the polyline @@ -313,9 +312,8 @@ class Face_graph_output_builder { std::vector edges; edges.reserve(edge_map.size()); - typedef std::pair Pair; - BOOST_FOREACH(const Pair& p, edge_map) - edges.push_back(p.first); + BOOST_FOREACH(edge_descriptor ed, edge_map) + edges.push_back(ed); CGAL_assertion(tuple_id < 4 && tuple_id >= 0); switch (tuple_id) @@ -430,8 +428,7 @@ public: //register an intersection halfedge // It is important here not to use operator[] since a two edges might be // equals while the indices are reversed - mesh_to_intersection_edges[&tm]. - insert(std::make_pair(edge(hedge, tm), indices)); + mesh_to_intersection_edges[&tm].insert(edge(hedge, tm)); if (indices.first>indices.second) { @@ -469,7 +466,6 @@ public: CGAL_assertion( vertex_to_node_id1.size() == vertex_to_node_id2.size()); CGAL_assertion( vertex_to_node_id1.size() == nodes.size()); - // TODO check if Intersection_edge_map needs to be so complicated (id stored...) Intersection_edge_map& intersection_edges1 = mesh_to_intersection_edges[&tm1]; Intersection_edge_map& intersection_edges2 = mesh_to_intersection_edges[&tm2]; diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/face_graph_utils.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/face_graph_utils.h index ff7b54ae717..22e785a8246 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/face_graph_utils.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/face_graph_utils.h @@ -383,12 +383,10 @@ triangulate_a_face( template class Border_edge_map { - typedef std::size_t Node_id; typedef boost::graph_traits GT; typedef typename GT::halfedge_descriptor halfedge_descriptor; typedef typename GT::edge_descriptor edge_descriptor; - typedef boost::unordered_map > Intersection_edge_map; + typedef boost::unordered_set Intersection_edge_map; const Intersection_edge_map* intersection_edges; const PolygonMesh* tm; public: From 76069002c8adc7a09d1c0f633a2209ea9ca2117f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Sat, 24 Nov 2018 10:37:38 +0100 Subject: [PATCH 070/193] fix initialization warning --- .../CGAL/Algebraic_kernel_d/Curve_pair_analysis_2.h | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Curve_pair_analysis_2.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Curve_pair_analysis_2.h index cc8ba6b58cb..8c338f83e35 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Curve_pair_analysis_2.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Curve_pair_analysis_2.h @@ -1524,17 +1524,11 @@ compute_intermediate_values_and_slices() const { #if CGAL_ACK_DEBUG_FLAG CGAL_ACK_DEBUG_PRINT << "Prepare intermediate slices.." << std::flush; #endif + std::size_t size = event_x_coordinates().size()+1; this->ptr()->intermediate_values=std::vector(); this->ptr()->intermediate_slices=std::vector(); - - for(size_type i=0; - i<=static_cast(event_x_coordinates().size()); - i++) { - this->ptr()->intermediate_values.get().push_back(Lazy_bound()); - this->ptr()->intermediate_slices.get().push_back - (Lazy_status_line_CPA_1()); - } - + this->ptr()->intermediate_values.get().resize(size); + this->ptr()->intermediate_slices.get().resize(size); #if CGAL_ACK_DEBUG_FLAG CGAL_ACK_DEBUG_PRINT << "done" << std::endl; #endif From cd7ae286fe92e1c585c26f0c7ee14c741c3e023f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Sat, 24 Nov 2018 13:42:07 +0100 Subject: [PATCH 071/193] fix warning in a probably not acceptable way warnings trigger when compiling: - skin_surface_subdiv - skin_surface_subdiv_with_normals - union_of_balls_subdiv - nef_2_polylines This comes from a call in the incremental builder to `current_face = decorator.faces_push_back( Face());` in `begin_facet()` --- STL_Extension/include/CGAL/In_place_list.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/STL_Extension/include/CGAL/In_place_list.h b/STL_Extension/include/CGAL/In_place_list.h index face144af5e..25c8aed4c57 100644 --- a/STL_Extension/include/CGAL/In_place_list.h +++ b/STL_Extension/include/CGAL/In_place_list.h @@ -58,6 +58,10 @@ public: template < class T > class In_place_list_base { public: + In_place_list_base() + : next_link(NULL), prev_link(NULL) + {} + T* next_link; // forward pointer T* prev_link; // backwards pointer //friend class internal::In_place_list_iterator; From c2f7814f19de8616915660ee2cb56acee29128ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Sat, 24 Nov 2018 14:42:26 +0100 Subject: [PATCH 072/193] prevent maybe-uninitialized warnings they were triggered by `l1 = t.line_walk(POINT(xr_left, yr_top), POINT(xr_right, yr_top), hface1);` in `CGAL/apply_to_range.h` Seen when compiling targets: Constrained_Delaunay_triangulation_2 Polyline_simplification_2 Delaunay_triangulation_2 --- .../include/CGAL/Triangulation_line_face_circulator_2.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Triangulation_2/include/CGAL/Triangulation_line_face_circulator_2.h b/Triangulation_2/include/CGAL/Triangulation_line_face_circulator_2.h index 12d7220fdbc..2572e4fdbc2 100644 --- a/Triangulation_2/include/CGAL/Triangulation_line_face_circulator_2.h +++ b/Triangulation_2/include/CGAL/Triangulation_line_face_circulator_2.h @@ -266,7 +266,7 @@ Triangulation_line_face_circulator_2(const Point& pp, int in; switch(pqs) { case LEFT_TURN: - *this = Line_face_circulator(); + pos = Face_handle(); return; case COLLINEAR: fn = fc->neighbor(i); @@ -306,7 +306,7 @@ Triangulation_line_face_circulator_2(const Point& pp, // if line (p,q) does not intersect the convex hull in an edge // the circulator has a singular value - *this=Line_face_circulator(); + pos=Face_handle(); return; } @@ -368,7 +368,7 @@ Triangulation_line_face_circulator_2(const Point& pp, return; } else { // singular value - *this = Line_face_circulator(); + pos=Face_handle(); return; } case LEFT_TURN : From 82d4479d2176827b5a08bdeed1f6e0d413a6e6cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Sat, 24 Nov 2018 14:48:37 +0100 Subject: [PATCH 073/193] fix maybe uninit warning triggered when compiling target Bounding_volumes --- Bounding_volumes/include/CGAL/Min_ellipse_2.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Bounding_volumes/include/CGAL/Min_ellipse_2.h b/Bounding_volumes/include/CGAL/Min_ellipse_2.h index 3a15bef505b..4348f8a5f80 100644 --- a/Bounding_volumes/include/CGAL/Min_ellipse_2.h +++ b/Bounding_volumes/include/CGAL/Min_ellipse_2.h @@ -360,7 +360,20 @@ class Min_ellipse_2 { // default constructor inline - Min_ellipse_2( const Traits& traits = Traits()) + Min_ellipse_2() + : n_support_points( 0) + { + // allocate support points' array + support_points = new Point[ 5]; + + // initialize ellipse + tco.ellipse.set(); + + CGAL_optimisation_postcondition( is_empty()); + } + + inline + Min_ellipse_2( const Traits& traits ) : tco( traits), n_support_points( 0) { // allocate support points' array From 75aca45157ffba2d3d0ce1e1302b6287ebd6fc3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Sat, 24 Nov 2018 18:40:15 +0100 Subject: [PATCH 074/193] do no ignore user provided traits --- BGL/include/CGAL/boost/graph/named_params_helper.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/named_params_helper.h b/BGL/include/CGAL/boost/graph/named_params_helper.h index 517a750d901..cbf5a2fedce 100644 --- a/BGL/include/CGAL/boost/graph/named_params_helper.h +++ b/BGL/include/CGAL/boost/graph/named_params_helper.h @@ -325,11 +325,17 @@ namespace CGAL { template class GetK { - typedef typename boost::property_traits< - typename GetPointMap::type - >::value_type Point; + typedef typename GetPointMap::type Vpm; + typedef typename Kernel_traits< + typename boost::property_traits::value_type + >::Kernel Default_kernel; + public: - typedef typename CGAL::Kernel_traits::Kernel Kernel; + typedef typename boost::lookup_named_param_def < + internal_np::geom_traits_t, + NamedParameters, + Default_kernel + > ::type Kernel; }; template From 6c3e3252a953609d33a9eb77f3958c77cbba0bd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Sat, 24 Nov 2018 15:00:02 +0100 Subject: [PATCH 075/193] brute force fix for uninitialize warning --- Generator/include/CGAL/point_generators_d.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Generator/include/CGAL/point_generators_d.h b/Generator/include/CGAL/point_generators_d.h index 1cc01033b5d..e082cf42cce 100644 --- a/Generator/include/CGAL/point_generators_d.h +++ b/Generator/include/CGAL/point_generators_d.h @@ -156,6 +156,9 @@ generate_point() { coord[i]=RT(this->d_range * ( 2 * this->_rnd.get_double() - 1.0)); P p(dimension, coord.begin(), coord.end() ); + #ifdef BOOST_GCC + #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" + #endif this->d_item = p; } From ad48763b6d6f6f035d6e873dbebb76437cdbe242 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Mon, 26 Nov 2018 09:23:54 +0100 Subject: [PATCH 076/193] Add missing call to computeItemColorVectorAutomatically() --- .../Polyhedron/Plugins/PMP/Join_and_split_polyhedra_plugin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Join_and_split_polyhedra_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Join_and_split_polyhedra_plugin.cpp index a04801e613c..fc681f37cde 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Join_and_split_polyhedra_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Join_and_split_polyhedra_plugin.cpp @@ -228,7 +228,7 @@ void Polyhedron_demo_join_and_split_polyhedra_plugin::on_actionColorConnectedCom PatchIDMap pidmap = get(CGAL::face_patch_id_t(), *item->face_graph()); int nb_patch_ids = CGAL::Polygon_mesh_processing::connected_components(*item->face_graph(), pidmap); - + item->computeItemColorVectorAutomatically(true); item->invalidateOpenGLBuffers(); item->setProperty("NbPatchIds", nb_patch_ids); scene->itemChanged(item); From eb688df5e0d6d297d9b07b7731aa4bd821fe2b0a Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Mon, 26 Nov 2018 15:00:07 +0100 Subject: [PATCH 077/193] BGL: Fix doc of Face_filtered_graph Fix typo in documentation. --- BGL/include/CGAL/boost/graph/Face_filtered_graph.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/Face_filtered_graph.h b/BGL/include/CGAL/boost/graph/Face_filtered_graph.h index 472583030bd..9a869d8a250 100644 --- a/BGL/include/CGAL/boost/graph/Face_filtered_graph.h +++ b/BGL/include/CGAL/boost/graph/Face_filtered_graph.h @@ -129,7 +129,7 @@ struct Face_filtered_graph * a property map containing an index for each face initialized from 0 to `num_vertices(graph)` * \cgalParamEnd * \cgalParamBegin{vertex_index_map} - * a property map containing an index for each vertex initialized 0 to `num_vertices(vertex)` + * a property map containing an index for each vertex initialized 0 to `num_vertices(graph)` * \cgalParamEnd * \cgalParamBegin{halfedge_index_map} * a property map containing an index for each halfedge initialized 0 to `num_halfedges(graph)` @@ -189,7 +189,7 @@ struct Face_filtered_graph * a property map containing an index for each face initialized from 0 to `num_vertices(graph)` * \cgalParamEnd * \cgalParamBegin{vertex_index_map} - * a property map containing an index for each vertex initialized 0 to `num_vertices(vertex)` + * a property map containing an index for each vertex initialized 0 to `num_vertices(graph)` * \cgalParamEnd * \cgalParamBegin{halfedge_index_map} * a property map containing an index for each halfedge initialized 0 to `num_halfedges(graph)` @@ -236,7 +236,7 @@ struct Face_filtered_graph * a property map containing an index for each face initialized from 0 to `num_vertices(graph)` * \cgalParamEnd * \cgalParamBegin{vertex_index_map} - * a property map containing an index for each vertex initialized 0 to `num_vertices(vertex)` + * a property map containing an index for each vertex initialized 0 to `num_vertices(graph)` * \cgalParamEnd * \cgalParamBegin{halfedge_index_map} * a property map containing an index for each halfedge initialized 0 to `num_halfedges(graph)` From d4e3416c8bbb8407cc45367ccb0f1343c14ad057 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Mon, 26 Nov 2018 15:44:17 +0100 Subject: [PATCH 078/193] has_sloop() -> has_shalfloop() --- Nef_S2/include/CGAL/Nef_polyhedron_S2.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Nef_S2/include/CGAL/Nef_polyhedron_S2.h b/Nef_S2/include/CGAL/Nef_polyhedron_S2.h index 7a5dc5ffc9d..e4036996f70 100644 --- a/Nef_S2/include/CGAL/Nef_polyhedron_S2.h +++ b/Nef_S2/include/CGAL/Nef_polyhedron_S2.h @@ -375,7 +375,7 @@ public: SHalfedge_iterator e; CGAL_forall_svertices(v,D) v->mark() = false; CGAL_forall_sedges(e,D) e->mark() = false; - if ( D.has_sloop() ) D.shalfloop()->mark() = false; + if ( D.has_shalfloop() ) D.shalfloop()->mark() = false; D.simplify(); } @@ -390,7 +390,7 @@ public: CGAL_forall_svertices(v,D) v->mark() = true; CGAL_forall_sedges(e,D) e->mark() = true; CGAL_forall_sfaces(f,D) f->mark() = false; - if ( D.has_sloop() ) D.shalfloop()->mark() = D.shalfoop()->twin() = true; + if ( D.has_shalfloop() ) D.shalfloop()->mark() = D.shalfoop()->twin() = true; D.simplify(); } From 8297e2b849dfff112847abc654706dd57f3a2fba Mon Sep 17 00:00:00 2001 From: Guillaume Damiand Date: Mon, 26 Nov 2018 16:33:39 +0100 Subject: [PATCH 079/193] Start to update the LCC demo, in order to re-use LCC basic viewer. --- .../demo/Linear_cell_complex/CMakeLists.txt | 2 +- .../demo/Linear_cell_complex/MainWindow.cpp | 4 +- .../demo/Linear_cell_complex/Viewer.cpp | 716 +----------------- .../demo/Linear_cell_complex/Viewer.h | 76 +- .../include/CGAL/draw_linear_cell_complex.h | 63 +- 5 files changed, 85 insertions(+), 776 deletions(-) diff --git a/Linear_cell_complex/demo/Linear_cell_complex/CMakeLists.txt b/Linear_cell_complex/demo/Linear_cell_complex/CMakeLists.txt index 108432031ff..54cd0213f7e 100644 --- a/Linear_cell_complex/demo/Linear_cell_complex/CMakeLists.txt +++ b/Linear_cell_complex/demo/Linear_cell_complex/CMakeLists.txt @@ -46,7 +46,7 @@ if ( NOT (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND ) ) else() -add_definitions(-DQT_NO_KEYWORDS) +add_definitions(-DCGAL_USE_BASIC_VIEWER -DQT_NO_KEYWORDS) # ui file, created wih Qt Designer qt5_wrap_ui(uis MainWindow.ui CreateMesh.ui CreateMenger.ui diff --git a/Linear_cell_complex/demo/Linear_cell_complex/MainWindow.cpp b/Linear_cell_complex/demo/Linear_cell_complex/MainWindow.cpp index a78780d3e78..113baed1ae6 100644 --- a/Linear_cell_complex/demo/Linear_cell_complex/MainWindow.cpp +++ b/Linear_cell_complex/demo/Linear_cell_complex/MainWindow.cpp @@ -39,7 +39,7 @@ void subdivide_lcc_pqq (LCC & m); #define DELAY_STATUSMSG 1500 -MainWindow::MainWindow (QWidget * parent):CGAL::Qt::DemosMainWindow (parent), +MainWindow::MainWindow (QWidget * parent) : CGAL::Qt::DemosMainWindow (parent), nbcube (0), dialogmesh (this), dialogmenger(this), @@ -78,7 +78,7 @@ MainWindow::MainWindow (QWidget * parent):CGAL::Qt::DemosMainWindow (parent), QObject::connect(&dialogmesh, SIGNAL(accepted()), this, SLOT(onCreateMeshOk())); - this->viewer->setScene(&scene); + // this->viewer->setScene(&scene); connect_actions (); this->addAboutDemo (":/cgal/help/about_Linear_cell_complex_3.html"); diff --git a/Linear_cell_complex/demo/Linear_cell_complex/Viewer.cpp b/Linear_cell_complex/demo/Linear_cell_complex/Viewer.cpp index 3bef476f899..b45fc2a8945 100644 --- a/Linear_cell_complex/demo/Linear_cell_complex/Viewer.cpp +++ b/Linear_cell_complex/demo/Linear_cell_complex/Viewer.cpp @@ -25,92 +25,11 @@ #include #include #include - #include #include -//Vertex source code -const char vertex_source[] = - { - "#version 120 \n" - "attribute highp vec4 vertex;\n" - "attribute highp vec3 normal;\n" - "attribute highp vec3 color;\n" - - "uniform highp mat4 mvp_matrix;\n" - "uniform highp mat4 mv_matrix; \n" - "uniform highp float point_size; \n" - - "varying highp vec4 fP; \n" - "varying highp vec3 fN; \n" - "varying highp vec4 fColor; \n" - "void main(void)\n" - "{\n" - " gl_PointSize = point_size; \n" - " fP = mv_matrix * vertex; \n" - " fN = mat3(mv_matrix)* normal; \n" - " fColor = vec4(color, 1.0); \n" - " gl_Position = mvp_matrix * vertex;\n" - "}" - }; - -//Vertex source code -const char fragment_source[] = - { - "#version 120 \n" - "varying highp vec4 fP; \n" - "varying highp vec3 fN; \n" - "varying highp vec4 fColor; \n" - "uniform vec4 light_pos; \n" - "uniform vec4 light_diff; \n" - "uniform vec4 light_spec; \n" - "uniform vec4 light_amb; \n" - "uniform float spec_power ; \n" - - "void main(void) { \n" - - " vec3 L = light_pos.xyz - fP.xyz; \n" - " vec3 V = -fP.xyz; \n" - - " vec3 N = normalize(fN); \n" - " L = normalize(L); \n" - " V = normalize(V); \n" - - " vec3 R = reflect(-L, N); \n" - " vec4 diffuse = max(dot(N,L), 0.0) * light_diff * fColor; \n" - " vec4 specular = pow(max(dot(R,V), 0.0), spec_power) * light_spec; \n" - - "gl_FragColor = light_amb*fColor + diffuse ; \n" - "} \n" - "\n" - }; - -//Vertex source code -const char vertex_source_p_l[] = - { - "#version 120 \n" - "attribute highp vec4 vertex;\n" - "uniform highp mat4 mvp_matrix;\n" - "uniform highp float point_size; \n" - "void main(void)\n" - "{\n" - " gl_PointSize = point_size; \n" - " gl_Position = mvp_matrix * vertex;\n" - "}" - }; -//Vertex source code -const char fragment_source_p_l[] = - { - "#version 120 \n" - "uniform highp vec4 color; \n" - "void main(void) { \n" - "gl_FragColor = color; \n" - "} \n" - "\n" - }; - -Viewer::Viewer(QWidget* parent) - : CGAL::QGLViewer(parent), +Viewer::Viewer(QWidget* parent) : + Base(parent, NULL, ""), wireframe(false), flatShading(true), edges(true), @@ -119,553 +38,21 @@ Viewer::Viewer(QWidget* parent) size_points(7.), size_edges(3.1), ambient(0.6f, 0.5f, 0.5f, 0.5f), - m_previous_scene_empty(true), - are_buffers_initialized(false) -{ -} + m_previous_scene_empty(true) +{} Viewer::~Viewer() -{ - for (int i=0; icompileSourceCode(vertex_source)) - { - std::cerr<<"Compiling vertex source FAILED"<compileSourceCode(fragment_source)) - { - std::cerr<<"Compiling fragmentsource FAILED"<compileSourceCode(vertex_source_p_l)) - { - std::cerr<<"Compiling vertex source FAILED"<compileSourceCode(fragment_source_p_l)) - { - std::cerr<<"Compiling fragmentsource FAILED"<(pos_facets.size()*sizeof(float))); - vertexLocation[0] = rendering_program.attributeLocation("vertex"); - rendering_program.bind(); - rendering_program.enableAttributeArray(vertexLocation[0]); - rendering_program.setAttributeBuffer(vertexLocation[0],GL_FLOAT,0,3); - rendering_program.release(); - buffers[0].release(); - - //normals of the facets - buffers[1].bind(); - buffers[1].allocate(flat_normals.data(), - static_cast(flat_normals.size()*sizeof(float))); - normalsLocation = rendering_program.attributeLocation("normal"); - rendering_program.bind(); - rendering_program.enableAttributeArray(normalsLocation); - rendering_program.setAttributeBuffer(normalsLocation,GL_FLOAT,0,3); - buffers[1].release(); - - //colors of the facets - buffers[2].bind(); - buffers[2].allocate(colors.data(), - static_cast(colors.size()*sizeof(float))); - colorsLocation = rendering_program.attributeLocation("color"); - rendering_program.bind(); - rendering_program.enableAttributeArray(colorsLocation); - rendering_program.setAttributeBuffer(colorsLocation,GL_FLOAT,0,3); - buffers[2].release(); - rendering_program.release(); - - vao[0].release(); - vao[1].bind(); - - //points of the facets - buffers[3].bind(); - buffers[3].allocate(pos_facets.data(), static_cast(pos_facets.size()*sizeof(float))); - vertexLocation[0] = rendering_program.attributeLocation("vertex"); - rendering_program.bind(); - rendering_program.enableAttributeArray(vertexLocation[0]); - rendering_program.setAttributeBuffer(vertexLocation[0],GL_FLOAT,0,3); - rendering_program.release(); - buffers[3].release(); - - //normals of the facets - buffers[4].bind(); - buffers[4].allocate(smooth_normals.data(), - static_cast(smooth_normals.size()*sizeof(float))); - normalsLocation = rendering_program.attributeLocation("normal"); - rendering_program.bind(); - rendering_program.enableAttributeArray(normalsLocation); - rendering_program.setAttributeBuffer(normalsLocation,GL_FLOAT,0,3); - buffers[4].release(); - - //colors of the facets - buffers[5].bind(); - buffers[5].allocate(colors.data(), static_cast(colors.size()*sizeof(float))); - colorsLocation = rendering_program.attributeLocation("color"); - rendering_program.bind(); - rendering_program.enableAttributeArray(colorsLocation); - rendering_program.setAttributeBuffer(colorsLocation,GL_FLOAT,0,3); - buffers[5].release(); - rendering_program.release(); - - vao[1].release(); - - //The lines - vao[2].bind(); - buffers[6].bind(); - buffers[6].allocate(pos_lines.data(), static_cast(pos_lines.size()*sizeof(float))); - vertexLocation[2] = rendering_program_p_l.attributeLocation("vertex"); - rendering_program_p_l.bind(); - rendering_program_p_l.enableAttributeArray(vertexLocation[2]); - rendering_program_p_l.setAttributeBuffer(vertexLocation[2],GL_FLOAT,0,3); - buffers[6].release(); - rendering_program_p_l.release(); - vao[2].release(); - - //The points - vao[3].bind(); - buffers[7].bind(); - buffers[7].allocate(pos_points.data(), static_cast(pos_points.size()*sizeof(float))); - vertexLocation[2] = rendering_program_p_l.attributeLocation("vertex"); - rendering_program_p_l.bind(); - rendering_program_p_l.enableAttributeArray(vertexLocation[2]); - rendering_program_p_l.setAttributeBuffer(vertexLocation[2],GL_FLOAT,0,3); - buffers[7].release(); - rendering_program_p_l.release(); - vao[3].release(); - - are_buffers_initialized = true; -} - -void Viewer::compute_face(Dart_handle dh, LCC::size_type markface) -{ - LCC &lcc = *scene->lcc; - - CGAL::mark_cell(lcc, dh, markface); - - double r = (double)lcc.info<3>(dh).color().r()/255.0; - double g = (double)lcc.info<3>(dh).color().g()/255.0; - double b = (double)lcc.info<3>(dh).color().b()/255.0; - if ( !lcc.is_free(dh, 3) ) - { - r += (double)lcc.info<3>(lcc.beta(dh,3)).color().r()/255.0; - g += (double)lcc.info<3>(lcc.beta(dh,3)).color().g()/255.0; - b += (double)lcc.info<3>(lcc.beta(dh,3)).color().b()/255.0; - r /= 2; g /= 2; b /= 2; - } - - //compute flat normals - LCC::Vector normal = CGAL::compute_normal_of_cell_2(lcc,dh); - normal = normal/(CGAL::sqrt(normal*normal)); - if (inverse_normal) - normal=normal*-1; - - if (lcc.beta<1,1,1>(dh)!=dh) - { - try // Try catch to avoir crash of triangulation - { - P_traits cdt_traits(normal); - CDT cdt(cdt_traits); - - // Iterates on the vector of facet handles - CDT::Vertex_handle previous = NULL, first = NULL; - for (LCC::Dart_of_orbit_range<1>::const_iterator - he_circ = lcc.darts_of_orbit<1>(dh).begin(), - he_circ_end = lcc.darts_of_orbit<1>(dh).end(); - he_circ!=he_circ_end; ++he_circ) - { - CDT::Vertex_handle vh = cdt.insert(lcc.point(he_circ)); - if(first == NULL) - { first = vh; } - vh->info().v = CGAL::compute_normal_of_cell_0(lcc, he_circ); - if (inverse_normal) vh->info().v=vh->info().v*-1; - if(previous!=NULL && previous != vh) - { cdt.insert_constraint(previous, vh); } - previous = vh; - } - if (previous!=NULL) - cdt.insert_constraint(previous, first); - - // sets mark is_external - for(CDT::All_faces_iterator fit = cdt.all_faces_begin(), - fitend = cdt.all_faces_end(); fit!=fitend; ++fit) - { - fit->info().is_external = true; - fit->info().is_process = false; - } - //check if the facet is external or internal - std::queue face_queue; - CDT::Face_handle face_internal = NULL; - face_queue.push(cdt.infinite_vertex()->face()); - while(! face_queue.empty() ) - { - CDT::Face_handle fh = face_queue.front(); - face_queue.pop(); - if(!fh->info().is_process) - { - fh->info().is_process = true; - for(int i = 0; i <3; ++i) - { - if(!cdt.is_constrained(std::make_pair(fh, i))) - { - face_queue.push(fh->neighbor(i)); - } - else if (face_internal==NULL) - { - face_internal = fh->neighbor(i); - } - } - } - } - - if ( face_internal!=NULL ) - face_queue.push(face_internal); - - while(! face_queue.empty() ) - { - CDT::Face_handle fh = face_queue.front(); - face_queue.pop(); - if(!fh->info().is_process) - { - fh->info().is_process = true; - fh->info().is_external = false; - for(int i = 0; i <3; ++i) - { - if(!cdt.is_constrained(std::make_pair(fh, i))) - { - face_queue.push(fh->neighbor(i)); - } - } - } - } - - //iterates on the internal faces to add the vertices to the positions - //and the normals to the appropriate vectors - for(CDT::Finite_faces_iterator ffit = cdt.finite_faces_begin(), - ffitend = cdt.finite_faces_end(); ffit != ffitend; ++ffit) - { - if(!ffit->info().is_external) - { - flat_normals.push_back(normal.x()); - flat_normals.push_back(normal.y()); - flat_normals.push_back(normal.z()); - - flat_normals.push_back(normal.x()); - flat_normals.push_back(normal.y()); - flat_normals.push_back(normal.z()); - - flat_normals.push_back(normal.x()); - flat_normals.push_back(normal.y()); - flat_normals.push_back(normal.z()); - - smooth_normals.push_back(ffit->vertex(0)->info().v.x()); - smooth_normals.push_back(ffit->vertex(0)->info().v.y()); - smooth_normals.push_back(ffit->vertex(0)->info().v.z()); - - smooth_normals.push_back(ffit->vertex(1)->info().v.x()); - smooth_normals.push_back(ffit->vertex(1)->info().v.y()); - smooth_normals.push_back(ffit->vertex(1)->info().v.z()); - - smooth_normals.push_back(ffit->vertex(2)->info().v.x()); - smooth_normals.push_back(ffit->vertex(2)->info().v.y()); - smooth_normals.push_back(ffit->vertex(2)->info().v.z()); - - pos_facets.push_back(ffit->vertex(0)->point().x()); - pos_facets.push_back(ffit->vertex(0)->point().y()); - pos_facets.push_back(ffit->vertex(0)->point().z()); - - pos_facets.push_back(ffit->vertex(1)->point().x()); - pos_facets.push_back(ffit->vertex(1)->point().y()); - pos_facets.push_back(ffit->vertex(1)->point().z()); - - pos_facets.push_back(ffit->vertex(2)->point().x()); - pos_facets.push_back(ffit->vertex(2)->point().y()); - pos_facets.push_back(ffit->vertex(2)->point().z()); - - colors.push_back(r);colors.push_back(g);colors.push_back(b); - colors.push_back(r);colors.push_back(g);colors.push_back(b); - colors.push_back(r);colors.push_back(g);colors.push_back(b); - } - } - } - catch(...) - { // Triangulation crash: the face is not filled - } - } - else - { // The face is a triangle - colors.push_back(r);colors.push_back(g);colors.push_back(b); - colors.push_back(r);colors.push_back(g);colors.push_back(b); - colors.push_back(r);colors.push_back(g);colors.push_back(b); - - flat_normals.push_back(normal.x()); - flat_normals.push_back(normal.y()); - flat_normals.push_back(normal.z()); - - flat_normals.push_back(normal.x()); - flat_normals.push_back(normal.y()); - flat_normals.push_back(normal.z()); - - flat_normals.push_back(normal.x()); - flat_normals.push_back(normal.y()); - flat_normals.push_back(normal.z()); - - for (LCC::Dart_of_orbit_range<1>::const_iterator - orbitIter = lcc.darts_of_orbit<1>(dh).begin(); - orbitIter.cont(); ++orbitIter) - { - //compute Smooth normals - LCC::Vector normal = CGAL::compute_normal_of_cell_0(lcc,orbitIter); - normal = normal/(CGAL::sqrt(normal*normal)); - if (inverse_normal) normal=normal*-1; - - smooth_normals.push_back(normal.x()); - smooth_normals.push_back(normal.y()); - smooth_normals.push_back(normal.z()); - - const LCC::Point& p = lcc.point(orbitIter); - pos_facets.push_back(p.x()); - pos_facets.push_back(p.y()); - pos_facets.push_back(p.z()); - } - } -} - -void Viewer::compute_edge(Dart_handle dh, LCC::size_type markedge) -{ - LCC &lcc = *scene->lcc; - - CGAL::mark_cell(lcc, dh, markedge); - - const LCC::Point& p = lcc.point(dh); - Dart_handle d2 = lcc.other_extremity(dh); - if ( d2!=NULL ) - { - const LCC::Point& p2 = lcc.point(d2); - pos_lines.push_back(p.x()); - pos_lines.push_back(p.y()); - pos_lines.push_back(p.z()); - - pos_lines.push_back(p2.x()); - pos_lines.push_back(p2.y()); - pos_lines.push_back(p2.z()); - } -} - -void Viewer::compute_vertex(Dart_handle dh, LCC::size_type markvertex, bool& empty) -{ - LCC &lcc = *scene->lcc; - - CGAL::mark_cell(lcc, dh, markvertex); - - const LCC::Point& p = lcc.point(dh); - pos_points.push_back(p.x()); - pos_points.push_back(p.y()); - pos_points.push_back(p.z()); - - if ( empty ) - { - bb = p.bbox(); - empty = false; - } - else - bb = bb + p.bbox(); -} - -void Viewer::compute_elements() -{ - LCC &lcc = *scene->lcc; - - pos_facets.clear(); - flat_normals.clear(); - smooth_normals.clear(); - colors.clear(); - pos_lines.clear(); - pos_points.clear(); - - if ( lcc.is_empty() ) - { - bb = LCC::Point(CGAL::ORIGIN).bbox(); - bb = bb + LCC::Point(1,1,1).bbox(); // To avoid a warning from Qglviewer - return; - } - - LCC::size_type markvertex = lcc.get_new_mark(); - LCC::size_type markedge = lcc.get_new_mark(); - LCC::size_type markface = lcc.get_new_mark(); - - bool empty = true; - for (LCC::Attribute_range<3>::type::iterator it=lcc.attributes<3>().begin(), - itend=lcc.attributes<3>().end(); it!=itend; ++it ) - { - if ( it->info().is_visible() ) - { - for(LCC::Dart_of_cell_range<3>::iterator - dartIter=lcc.darts_of_cell<3>(lcc.dart_of_attribute<3>(it)).begin(); - dartIter.cont(); ++dartIter) - { - if ( it->info().is_filled() && !lcc.is_marked(dartIter, markface) ) - compute_face(dartIter, markface); - - if ( !lcc.is_marked(dartIter, markedge) ) - compute_edge(dartIter, markedge); - - if ( !lcc.is_marked(dartIter, markvertex) ) - compute_vertex(dartIter, markvertex, empty); - } - } - } - - if ( empty ) - { - bb = LCC::Point(CGAL::ORIGIN).bbox(); - bb = bb + LCC::Point(1,1,1).bbox(); // To avoid a warning from Qglviewer - } - - for (LCC::Dart_range::iterator it=lcc.darts().begin(), - itend=lcc.darts().end(); it!=itend; ++it ) - { - lcc.unmark(it, markvertex); - lcc.unmark(it, markedge); - lcc.unmark(it, markface); - } - - lcc.free_mark(markvertex); - lcc.free_mark(markedge); - lcc.free_mark(markface); -} - -void Viewer::attrib_buffers(CGAL::QGLViewer* viewer) -{ - QMatrix4x4 mvpMatrix; - QMatrix4x4 mvMatrix; - double mat[16]; - viewer->camera()->getModelViewProjectionMatrix(mat); - for(int i=0; i < 16; i++) - { - mvpMatrix.data()[i] = (float)mat[i]; - } - viewer->camera()->getModelViewMatrix(mat); - for(int i=0; i < 16; i++) - { - mvMatrix.data()[i] = (float)mat[i]; - } - // define material - QVector4D diffuse( 0.9f, - 0.9f, - 0.9f, - 0.9f ); - - QVector4D specular( 0.0f, - 0.0f, - 0.0f, - 1.0f ); - - - QVector4D position((bb.xmax()-bb.xmin())/2, (bb.ymax()-bb.ymin())/2,bb.zmax(), 0.0 ); - GLfloat shininess = 1.0f; - - rendering_program.bind(); - mvpLocation[0] = rendering_program.uniformLocation("mvp_matrix"); - mvLocation = rendering_program.uniformLocation("mv_matrix"); - lightLocation[0] = rendering_program.uniformLocation("light_pos"); - lightLocation[1] = rendering_program.uniformLocation("light_diff"); - lightLocation[2] = rendering_program.uniformLocation("light_spec"); - lightLocation[3] = rendering_program.uniformLocation("light_amb"); - lightLocation[4] = rendering_program.uniformLocation("spec_power"); - - rendering_program.setUniformValue(lightLocation[0], position); - rendering_program.setUniformValue(lightLocation[1], diffuse); - rendering_program.setUniformValue(lightLocation[2], specular); - rendering_program.setUniformValue(lightLocation[3], ambient); - rendering_program.setUniformValue(lightLocation[4], shininess); - rendering_program.setUniformValue(mvpLocation[0], mvpMatrix); - rendering_program.setUniformValue(mvLocation, mvMatrix); - - rendering_program.release(); - rendering_program_p_l.bind(); - mvpLocation[1] = rendering_program_p_l.uniformLocation("mvp_matrix"); - colorLocation = rendering_program_p_l.uniformLocation("color"); - rendering_program.setUniformValue(mvpLocation[1], mvpMatrix); - rendering_program_p_l.release(); -} +{} void Viewer::sceneChanged() { - compute_elements(); + Base::compute_elements(); this->camera()->setSceneBoundingBox(CGAL::qglviewer::Vec(bb.xmin(), bb.ymin(), bb.zmin()), CGAL::qglviewer::Vec(bb.xmax(), bb.ymax(), bb.zmax())); - are_buffers_initialized = false; - if (m_previous_scene_empty) this->showEntireScene(); else @@ -674,97 +61,6 @@ void Viewer::sceneChanged() m_previous_scene_empty = scene->lcc->is_empty(); // for the next call to sceneChanged } -void Viewer::draw() -{ - if(scene) - { - glEnable(GL_DEPTH_TEST); - if(!are_buffers_initialized) - initialize_buffers(); - - QColor color; - if ( !wireframe ) - { - if(flatShading) - { - vao[0].bind(); - attrib_buffers(this); - rendering_program.bind(); - glDrawArrays(GL_TRIANGLES, 0, static_cast(pos_facets.size()/3)); - rendering_program.release(); - vao[0].release(); - } - else - { - vao[1].bind(); - attrib_buffers(this); - rendering_program.bind(); - glDrawArrays(GL_TRIANGLES, 0, static_cast(pos_facets.size()/3)); - rendering_program.release(); - vao[1].release(); - } - } - if(edges) - { - vao[2].bind(); - attrib_buffers(this); - color.setRgbF(0.2f, 0.2f, 0.7f); - rendering_program_p_l.bind(); - rendering_program_p_l.setAttributeValue(colorLocation,color); - glLineWidth(size_edges); - glDrawArrays(GL_LINES, 0, static_cast(pos_lines.size()/3)); - rendering_program_p_l.release(); - vao[2].release(); - } - if(vertices) - { - vao[3].bind(); - attrib_buffers(this); - color.setRgbF(.2f,.2f,.6f); - rendering_program_p_l.bind(); - rendering_program_p_l.setAttributeValue(colorLocation,color); - rendering_program_p_l.setUniformValue("point_size", GLfloat(size_points)); - glDrawArrays(GL_POINTS, 0, static_cast(pos_points.size()/3)); - rendering_program_p_l.release(); - vao[3].release(); - } - } -} -void Viewer::init() -{ - // Restore previous viewer state. - restoreStateFromFile(); - initializeOpenGLFunctions(); - // Define 'Control+Q' as the new exit shortcut (default was 'Escape') - setShortcut(CGAL::qglviewer::EXIT_VIEWER, Qt::CTRL+Qt::Key_Q); - - // Add custom key description (see keyPressEvent). - setKeyDescription(Qt::Key_W, "Toggles wire frame display"); - setKeyDescription(Qt::Key_F, "Toggles flat shading display"); - setKeyDescription(Qt::Key_E, "Toggles edges display"); - setKeyDescription(Qt::Key_V, "Toggles vertices display"); - setKeyDescription(Qt::Key_N, "Inverse direction of normals"); - setKeyDescription(Qt::Key_Plus, "Increase size of edges"); - setKeyDescription(Qt::Key_Minus, "Decrease size of edges"); - setKeyDescription(Qt::Key_Plus+Qt::ShiftModifier, "Increase size of vertices"); - setKeyDescription(Qt::Key_Minus+Qt::ShiftModifier, "Decrease size of vertices"); - setKeyDescription(Qt::Key_PageDown, "Increase light (all colors, use shift/alt/ctrl for one rgb component)"); - setKeyDescription(Qt::Key_PageUp, "Decrease light (all colors, use shift/alt/ctrl for one rgb component)"); - - // Light default parameters - glLineWidth(size_edges); - glEnable(GL_POLYGON_OFFSET_FILL); - glPolygonOffset(1.0f,1.0f); - glClearColor(1.0f,1.0f,1.0f,0.0f); - - glDisable(GL_BLEND); - glDisable(GL_LINE_SMOOTH); - glDisable(GL_POLYGON_SMOOTH_HINT); - glBlendFunc(GL_ONE, GL_ZERO); - glHint(GL_LINE_SMOOTH_HINT, GL_FASTEST); - compile_shaders(); -} - void Viewer::keyPressEvent(QKeyEvent *e) { const Qt::KeyboardModifiers modifiers = e->modifiers(); diff --git a/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h b/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h index 894ec46eaa3..f52f21d20d8 100644 --- a/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h +++ b/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h @@ -24,37 +24,43 @@ #include "typedefs.h" +#include #include #include -#include -#include -#include -#include -#include -#include -#define NB_VBO_BUFFERS 8 -#define NB_VAO_BUFFERS 4 -class Viewer : public CGAL::QGLViewer +// #include +// #include +// #include +// #include +// #include +// #include + +// #define NB_VBO_BUFFERS 8 +// #define NB_VAO_BUFFERS 4 + +class Viewer : public CGAL::SimpleLCCViewerQt // CGAL::QGLViewer { Q_OBJECT + typedef CGAL::SimpleLCCViewerQt Base; typedef LCC::Dart_handle Dart_handle; typedef LCC::Dart_const_handle Dart_const_handle; public: Viewer(QWidget* parent); - ~Viewer(); void setScene(Scene* scene_) - { scene = scene_; } + { + scene = scene_; + set_lcc(scene->lcc); + } public: - void draw(); + // void draw(); - virtual void init(); + // virtual void init(); void keyPressEvent(QKeyEvent *e); @@ -65,14 +71,14 @@ public Q_SLOTS: void sceneChanged(); private: - void initialize_buffers(); - void attrib_buffers(CGAL::QGLViewer*); - void compile_shaders(); + // void initialize_buffers(); + // void attrib_buffers(CGAL::QGLViewer*); + // void compile_shaders(); - void compute_elements(); + /* void compute_elements(); void compute_face(Dart_handle dh, LCC::size_type markface); void compute_edge(Dart_handle dh, LCC::size_type markedge); - void compute_vertex(Dart_handle dh, LCC::size_type markvertex, bool& empty); + void compute_vertex(Dart_handle dh, LCC::size_type markvertex, bool& empty); */ private: Scene* scene; @@ -92,25 +98,25 @@ private: bool are_buffers_initialized; //Shaders elements - int vertexLocation[3]; - int normalsLocation; - int mvpLocation[2]; - int mvLocation; - int colorLocation; - int colorsLocation; - int lightLocation[5]; + // int vertexLocation[3]; + // int normalsLocation; + // int mvpLocation[2]; + // int mvLocation; + // int colorLocation; + // int colorsLocation; + // int lightLocation[5]; - std::vector pos_points; - std::vector pos_lines; - std::vector pos_facets; - std::vector smooth_normals; - std::vector flat_normals; - std::vector colors; + // std::vector pos_points; + // std::vector pos_lines; + // std::vector pos_facets; + // std::vector smooth_normals; + // std::vector flat_normals; + // std::vector colors; - QGLBuffer buffers[NB_VBO_BUFFERS]; - QOpenGLVertexArrayObject vao[NB_VAO_BUFFERS]; - QOpenGLShaderProgram rendering_program; - QOpenGLShaderProgram rendering_program_p_l; + // QGLBuffer buffers[NB_VBO_BUFFERS]; + // QOpenGLVertexArrayObject vao[NB_VAO_BUFFERS]; + // QOpenGLShaderProgram rendering_program; + // QOpenGLShaderProgram rendering_program_p_l; CGAL::Bbox_3 bb; }; diff --git a/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h b/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h index 70249fd05f6..1139d22dca5 100644 --- a/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h +++ b/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h @@ -89,7 +89,7 @@ public: /// @param anofaces if true, do not draw faces (faces are not computed; this can be /// usefull for very big object where this time could be long) SimpleLCCViewerQt(QWidget* parent, - const LCC& alcc, + const LCC* alcc=NULL, const char* title="Basic LCC Viewer", bool anofaces=false, const ColorFunctor& fcolor=ColorFunctor()) : @@ -103,6 +103,12 @@ public: } protected: + void set_lcc(const LCC* alcc) + { + lcc=alcc; + compute_elements(); + } + void compute_face(Dart_const_handle dh) { // We fill only closed faces. @@ -110,21 +116,21 @@ protected: Dart_const_handle min=dh; do { - if (!lcc.is_next_exist(cur)) return; // open face=>not filled + if (!lcc->is_next_exist(cur)) return; // open face=>not filled if (curnext(cur); } while(cur!=dh); - CGAL::Color c=m_fcolor.run(lcc, dh); + CGAL::Color c=m_fcolor.run(*lcc, dh); face_begin(c); cur=dh; do { - add_point_in_face(lcc.point(cur), LCC_geom_utils:: - get_vertex_normal(lcc, cur)); - cur=lcc.next(cur); + add_point_in_face(lcc->point(cur), LCC_geom_utils:: + get_vertex_normal(*lcc, cur)); + cur=lcc->next(cur); } while(cur!=dh); @@ -133,48 +139,49 @@ protected: void compute_edge(Dart_const_handle dh) { - Point p1 = lcc.point(dh); - Dart_const_handle d2 = lcc.other_extremity(dh); + Point p1 = lcc->point(dh); + Dart_const_handle d2 = lcc->other_extremity(dh); if (d2!=NULL) - { add_segment(p1, lcc.point(d2)); } + { add_segment(p1, lcc->point(d2)); } } void compute_vertex(Dart_const_handle dh) - { add_point(lcc.point(dh)); } + { add_point(lcc->point(dh)); } void compute_elements() { clear(); + if (lcc==NULL) return; + + typename LCC::size_type markfaces = lcc->get_new_mark(); + typename LCC::size_type markedges = lcc->get_new_mark(); + typename LCC::size_type markvertices = lcc->get_new_mark(); - typename LCC::size_type markfaces = lcc.get_new_mark(); - typename LCC::size_type markedges = lcc.get_new_mark(); - typename LCC::size_type markvertices = lcc.get_new_mark(); - - for (typename LCC::Dart_range::const_iterator it=lcc.darts().begin(), - itend=lcc.darts().end(); it!=itend; ++it ) + for (typename LCC::Dart_range::const_iterator it=lcc->darts().begin(), + itend=lcc->darts().end(); it!=itend; ++it ) { - if ( !m_nofaces && !lcc.is_marked(it, markfaces) ) + if ( !m_nofaces && !lcc->is_marked(it, markfaces) ) { compute_face(it); - CGAL::mark_cell(lcc, it, markfaces); + CGAL::mark_cell(*lcc, it, markfaces); } - if ( !lcc.is_marked(it, markedges) ) + if ( !lcc->is_marked(it, markedges) ) { compute_edge(it); - CGAL::mark_cell(lcc, it, markedges); + CGAL::mark_cell(*lcc, it, markedges); } - if ( !lcc.is_marked(it, markvertices) ) + if ( !lcc->is_marked(it, markvertices) ) { compute_vertex(it); - CGAL::mark_cell(lcc, it, markvertices); + CGAL::mark_cell(*lcc, it, markvertices); } } - lcc.free_mark(markfaces); - lcc.free_mark(markedges); - lcc.free_mark(markvertices); + lcc->free_mark(markfaces); + lcc->free_mark(markedges); + lcc->free_mark(markvertices); } virtual void keyPressEvent(QKeyEvent *e) @@ -194,7 +201,7 @@ protected: } protected: - const LCC& lcc; + const LCC* lcc; bool m_nofaces; const ColorFunctor& m_fcolor; }; @@ -217,7 +224,7 @@ void draw(const LCC& alcc, const char* argv[2]={"lccviewer","\0"}; QApplication app(argc,const_cast(argv)); SimpleLCCViewerQt mainwindow(app.activeWindow(), - alcc, + &alcc, title, nofill, fcolor); From 263a5715f2eddc64c12784f36935d3f50baa5727 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Mon, 26 Nov 2018 16:29:16 +0100 Subject: [PATCH 080/193] Try to use LEDA without -ffriend-injection --- Installation/cmake/modules/CGAL_UseLEDA.cmake | 3 --- Installation/cmake/modules/FindLEDA.cmake | 5 ----- 2 files changed, 8 deletions(-) diff --git a/Installation/cmake/modules/CGAL_UseLEDA.cmake b/Installation/cmake/modules/CGAL_UseLEDA.cmake index ead5900736c..70474f24a29 100644 --- a/Installation/cmake/modules/CGAL_UseLEDA.cmake +++ b/Installation/cmake/modules/CGAL_UseLEDA.cmake @@ -21,9 +21,6 @@ if ( LEDA_FOUND AND NOT LEDA_SETUP ) link_libraries( ${LEDA_LIBRARIES} ) endif() - if (LEDA_CGAL_FRIEND_INJECTION) - message( STATUS "${LEDA_CGAL_FRIEND_INJECTION}" ) - endif() if (LEDA_CGAL_NO_STRICT_ALIASING) message( STATUS "${LEDA_CGAL_NO_STRICT_ALIASING}" ) endif() diff --git a/Installation/cmake/modules/FindLEDA.cmake b/Installation/cmake/modules/FindLEDA.cmake index 1fc99eeecc3..9c50f51807a 100644 --- a/Installation/cmake/modules/FindLEDA.cmake +++ b/Installation/cmake/modules/FindLEDA.cmake @@ -92,11 +92,6 @@ if ( LEDA_INCLUDE_DIR AND LEDA_LIBRARIES) if ( CMAKE_COMPILER_IS_GNUCXX ) get_dependency_version (GCC) - if ( NOT "${GCC_VERSION}" VERSION_LESS "4.1" ) - set(LEDA_CGAL_FRIEND_INJECTION TRUE) - typed_cache_set( INTERNAL "Add -ffriend-injection on gcc >= 4.1" LEDA_CGAL_FRIEND_INJECTION "Using LEDA with gcc version 4.1 or later: Adding -ffriend-injection") - uniquely_add_flags (LEDA_CXX_FLAGS "-ffriend-injection") - endif() if ( NOT "${GCC_VERSION}" VERSION_LESS "4.4" ) set(LEDA_CGAL_NO_STRICT_ALIASING TRUE) typed_cache_set( INTERNAL "Add -fno-strict-aliasing on gcc >= 4.4" LEDA_CGAL_NO_STRICT_ALIASING "Using LEDA with gcc version 4.4 or later: Adding -fno-strict-aliasing") From 9c3faed5c5ee1d2dba5b1d634e8aa444f7bd90d6 Mon Sep 17 00:00:00 2001 From: Guillaume Damiand Date: Mon, 26 Nov 2018 22:06:13 +0100 Subject: [PATCH 081/193] Bug fixes; nyf --- GraphicsView/include/CGAL/Qt/Basic_viewer_qt.h | 2 +- .../demo/Linear_cell_complex/MainWindow.cpp | 2 +- .../demo/Linear_cell_complex/Viewer.cpp | 12 ++++++------ .../demo/Linear_cell_complex/Viewer.h | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/GraphicsView/include/CGAL/Qt/Basic_viewer_qt.h b/GraphicsView/include/CGAL/Qt/Basic_viewer_qt.h index de17e0d32f5..f3079abcda5 100644 --- a/GraphicsView/include/CGAL/Qt/Basic_viewer_qt.h +++ b/GraphicsView/include/CGAL/Qt/Basic_viewer_qt.h @@ -966,7 +966,7 @@ protected: return text; } -private: +protected: bool m_draw_vertices; bool m_draw_edges; bool m_draw_faces; diff --git a/Linear_cell_complex/demo/Linear_cell_complex/MainWindow.cpp b/Linear_cell_complex/demo/Linear_cell_complex/MainWindow.cpp index 113baed1ae6..86f1c351576 100644 --- a/Linear_cell_complex/demo/Linear_cell_complex/MainWindow.cpp +++ b/Linear_cell_complex/demo/Linear_cell_complex/MainWindow.cpp @@ -78,7 +78,7 @@ MainWindow::MainWindow (QWidget * parent) : CGAL::Qt::DemosMainWindow (parent), QObject::connect(&dialogmesh, SIGNAL(accepted()), this, SLOT(onCreateMeshOk())); - // this->viewer->setScene(&scene); + this->viewer->setScene(&scene); connect_actions (); this->addAboutDemo (":/cgal/help/about_Linear_cell_complex_3.html"); diff --git a/Linear_cell_complex/demo/Linear_cell_complex/Viewer.cpp b/Linear_cell_complex/demo/Linear_cell_complex/Viewer.cpp index b45fc2a8945..cd5db7c9130 100644 --- a/Linear_cell_complex/demo/Linear_cell_complex/Viewer.cpp +++ b/Linear_cell_complex/demo/Linear_cell_complex/Viewer.cpp @@ -47,12 +47,12 @@ Viewer::~Viewer() void Viewer::sceneChanged() { Base::compute_elements(); - this->camera()->setSceneBoundingBox(CGAL::qglviewer::Vec(bb.xmin(), - bb.ymin(), - bb.zmin()), - CGAL::qglviewer::Vec(bb.xmax(), - bb.ymax(), - bb.zmax())); + this->camera()->setSceneBoundingBox(CGAL::qglviewer::Vec(m_bounding_box.xmin(), + m_bounding_box.ymin(), + m_bounding_box.zmin()), + CGAL::qglviewer::Vec(m_bounding_box.xmax(), + m_bounding_box.ymax(), + m_bounding_box.zmax())); if (m_previous_scene_empty) this->showEntireScene(); else diff --git a/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h b/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h index f52f21d20d8..4d600cf0f05 100644 --- a/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h +++ b/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h @@ -60,7 +60,7 @@ public: public: // void draw(); - // virtual void init(); + // virtual void init(); void keyPressEvent(QKeyEvent *e); @@ -118,7 +118,7 @@ private: // QOpenGLShaderProgram rendering_program; // QOpenGLShaderProgram rendering_program_p_l; - CGAL::Bbox_3 bb; + // CGAL::Bbox_3 bb; }; #endif From 5d7723af4a9733d75119931769e600f34d278051 Mon Sep 17 00:00:00 2001 From: Guillaume Damiand Date: Tue, 27 Nov 2018 09:10:03 +0100 Subject: [PATCH 082/193] Update LCC demo --- .../demo/Linear_cell_complex/CMakeLists.txt | 2 +- .../Linear_cell_complex_3_demo.cpp | 2 +- .../demo/Linear_cell_complex/MainWindow.cpp | 2 +- .../demo/Linear_cell_complex/Viewer.cpp | 11 +++++------ Linear_cell_complex/demo/Linear_cell_complex/Viewer.h | 8 ++++---- .../include/CGAL/draw_linear_cell_complex.h | 3 ++- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Linear_cell_complex/demo/Linear_cell_complex/CMakeLists.txt b/Linear_cell_complex/demo/Linear_cell_complex/CMakeLists.txt index 54cd0213f7e..d23afa5eb3d 100644 --- a/Linear_cell_complex/demo/Linear_cell_complex/CMakeLists.txt +++ b/Linear_cell_complex/demo/Linear_cell_complex/CMakeLists.txt @@ -64,7 +64,7 @@ add_executable(Linear_cell_complex_3_demo add_to_cached_list(CGAL_EXECUTABLE_TARGETS Linear_cell_complex_3_demo) -target_link_libraries(Linear_cell_complex_3_demo PRIVATE +target_link_libraries(Linear_cell_complex_3_demo PUBLIC CGAL::CGAL CGAL::CGAL_Qt5 Qt5::Gui Qt5::OpenGL) include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) diff --git a/Linear_cell_complex/demo/Linear_cell_complex/Linear_cell_complex_3_demo.cpp b/Linear_cell_complex/demo/Linear_cell_complex/Linear_cell_complex_3_demo.cpp index 4b39885f450..7069e069760 100644 --- a/Linear_cell_complex/demo/Linear_cell_complex/Linear_cell_complex_3_demo.cpp +++ b/Linear_cell_complex/demo/Linear_cell_complex/Linear_cell_complex_3_demo.cpp @@ -39,7 +39,7 @@ int main(int argc, char** argv) application.setApplicationName("3D Linear Cell Complex"); //for windows #if (QT_VERSION >= QT_VERSION_CHECK(5, 3, 0)) - application.setAttribute(Qt::AA_UseDesktopOpenGL); + // application.setAttribute(Qt::AA_UseDesktopOpenGL); #endif // Import resources from libCGALQt5 diff --git a/Linear_cell_complex/demo/Linear_cell_complex/MainWindow.cpp b/Linear_cell_complex/demo/Linear_cell_complex/MainWindow.cpp index 86f1c351576..e2713d93608 100644 --- a/Linear_cell_complex/demo/Linear_cell_complex/MainWindow.cpp +++ b/Linear_cell_complex/demo/Linear_cell_complex/MainWindow.cpp @@ -78,7 +78,7 @@ MainWindow::MainWindow (QWidget * parent) : CGAL::Qt::DemosMainWindow (parent), QObject::connect(&dialogmesh, SIGNAL(accepted()), this, SLOT(onCreateMeshOk())); - this->viewer->setScene(&scene); + this->viewer->setScene(&scene, false); connect_actions (); this->addAboutDemo (":/cgal/help/about_Linear_cell_complex_3.html"); diff --git a/Linear_cell_complex/demo/Linear_cell_complex/Viewer.cpp b/Linear_cell_complex/demo/Linear_cell_complex/Viewer.cpp index cd5db7c9130..2bb7c75c737 100644 --- a/Linear_cell_complex/demo/Linear_cell_complex/Viewer.cpp +++ b/Linear_cell_complex/demo/Linear_cell_complex/Viewer.cpp @@ -37,8 +37,8 @@ Viewer::Viewer(QWidget* parent) : inverse_normal(false), size_points(7.), size_edges(3.1), - ambient(0.6f, 0.5f, 0.5f, 0.5f), m_previous_scene_empty(true) +// ambient(0.6f, 0.5f, 0.5f, 0.5f), {} Viewer::~Viewer() @@ -53,10 +53,9 @@ void Viewer::sceneChanged() CGAL::qglviewer::Vec(m_bounding_box.xmax(), m_bounding_box.ymax(), m_bounding_box.zmax())); + Base::redraw(); if (m_previous_scene_empty) this->showEntireScene(); - else - this->update(); m_previous_scene_empty = scene->lcc->is_empty(); // for the next call to sceneChanged } @@ -132,7 +131,7 @@ void Viewer::keyPressEvent(QKeyEvent *e) displayMessage(QString("Size of points=%1.").arg(size_points)); update(); } - else if ((e->key()==Qt::Key_PageUp) && (modifiers==Qt::NoButton)) +/* else if ((e->key()==Qt::Key_PageUp) && (modifiers==Qt::NoButton)) { ambient.setX(ambient.x()+.1); if (ambient.x()>1.) ambient.setX(1.); @@ -203,9 +202,9 @@ void Viewer::keyPressEvent(QKeyEvent *e) displayMessage(QString("Light color=(%1 %2 %3)."). arg(ambient.x()).arg(ambient.y()).arg(ambient.z())); update(); - } + }*/ else - CGAL::QGLViewer::keyPressEvent(e); + Base::keyPressEvent(e); } QString Viewer::helpString() const diff --git a/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h b/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h index 4d600cf0f05..b189c78d6e9 100644 --- a/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h +++ b/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h @@ -51,10 +51,10 @@ public: Viewer(QWidget* parent); ~Viewer(); - void setScene(Scene* scene_) + void setScene(Scene* scene_, bool doredraw=true) { scene = scene_; - set_lcc(scene->lcc); + set_lcc(scene->lcc, doredraw); } public: @@ -92,10 +92,10 @@ private: double size_points; double size_edges; - QVector4D ambient; + // QVector4D ambient; bool m_previous_scene_empty; - bool are_buffers_initialized; + // bool are_buffers_initialized; //Shaders elements // int vertexLocation[3]; diff --git a/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h b/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h index 1139d22dca5..1bc5cdd5611 100644 --- a/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h +++ b/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h @@ -103,10 +103,11 @@ public: } protected: - void set_lcc(const LCC* alcc) + void set_lcc(const LCC* alcc, bool doredraw=true) { lcc=alcc; compute_elements(); + if (doredraw) { redraw(); } } void compute_face(Dart_const_handle dh) From 7ac3dcd63ba209b3364e92d832e88d85be463c15 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 27 Nov 2018 10:04:32 +0100 Subject: [PATCH 083/193] Add write_wrl() for FaceGraph --- BGL/doc/BGL/PackageDescription.txt | 1 + BGL/include/CGAL/boost/graph/io.h | 88 ++++++++++++++++++++++++++++++ BGL/test/BGL/CMakeLists.txt | 2 + BGL/test/BGL/test_wrl.cpp | 18 ++++++ 4 files changed, 109 insertions(+) create mode 100644 BGL/test/BGL/test_wrl.cpp diff --git a/BGL/doc/BGL/PackageDescription.txt b/BGL/doc/BGL/PackageDescription.txt index 6ba2f1ba2d6..d069c70ee55 100644 --- a/BGL/doc/BGL/PackageDescription.txt +++ b/BGL/doc/BGL/PackageDescription.txt @@ -708,6 +708,7 @@ user might encounter. ## I/O Functions ## - \link PkgBGLIOFct CGAL::read_off() \endlink - \link PkgBGLIOFct CGAL::write_off() \endlink +- \link PkgBGLIOFct CGAL::write_wrl() \endlink */ diff --git a/BGL/include/CGAL/boost/graph/io.h b/BGL/include/CGAL/boost/graph/io.h index 2ad04ff8fe8..f5775e63662 100644 --- a/BGL/include/CGAL/boost/graph/io.h +++ b/BGL/include/CGAL/boost/graph/io.h @@ -36,6 +36,94 @@ #include namespace CGAL { + /*! + \ingroup PkgBGLIOFct + writes the graph `g` in the wrl format (VRML 2.0). + + \cgalNamedParamsBegin + * \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `g`. + * If this parameter is omitted, an internal property map for + * `CGAL::vertex_point_t` should be available in `FaceGraph`\cgalParamEnd + * \cgalNamedParamsEnd + */ +template +bool write_wrl(std::ostream& os, + const FaceGraph& g, + const NamedParameters& np) +{ + typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; + typedef typename boost::graph_traits::face_descriptor face_descriptor; + typedef typename boost::graph_traits::vertices_size_type vertices_size_type; + typedef typename boost::graph_traits::faces_size_type faces_size_type; + + + typename Polygon_mesh_processing::GetVertexPointMap::const_type + vpm = choose_param(get_param(np, internal_np::vertex_point), + get_const_property_map(CGAL::vertex_point, g)); + + vertices_size_type nv = static_cast(std::distance(vertices(g).first, vertices(g).second)); + faces_size_type nf = static_cast(std::distance(faces(g).first, faces(g).second)); + + boost::container::flat_map reindex; + int n = 0; + + os << "#VRML V2.0 utf8\n" + "Group {\n" + "children [\n" + "Shape {\n" + "appearance DEF A1 Appearance {\n" + "material Material {\n" + "diffuseColor .6 .5 .9\n" + "}\n" + "}\n" + "appearance\n" + "Appearance {\n" + "material DEF Material Material {}\n" + "}\n" + "}\n" + "Group {\n" + "children [\n" + "Shape {\n" + "appearance Appearance { material USE Material }\n" + "geometry IndexedFaceSet {\n" + "convex FALSE\n" + "solid FALSE\n" + "coord Coordinate {\n" + "point [\n"; + + BOOST_FOREACH(vertex_descriptor v, vertices(g)){ + os << get(vpm,v) << ",\n"; + reindex[v]=n++; + } + os << "] #point\n" + "} #coord Coordinate\n" + "coordIndex [\n"; + BOOST_FOREACH(face_descriptor f, faces(g)){ + BOOST_FOREACH(vertex_descriptor v, vertices_around_face(halfedge(f,g),g)){ + os << reindex[v] << ","; + } + os << "-1,\n"; + } + + os << "] #coordIndex\n" + "} #geometry\n" + "} #Shape\n" + "] #children\n" + "} #group\n" + "]\n" + "}\n"; + + return os.good(); +} + +template +bool write_wrl(std::ostream& os, + const FaceGraph& g) +{ + return write_wrl(os, g, + parameters::all_default()); +} + /*! \ingroup PkgBGLIOFct writes the graph `g` in the OFF format. diff --git a/BGL/test/BGL/CMakeLists.txt b/BGL/test/BGL/CMakeLists.txt index 8b6ef06e78d..0949c353647 100644 --- a/BGL/test/BGL/CMakeLists.txt +++ b/BGL/test/BGL/CMakeLists.txt @@ -97,6 +97,8 @@ create_single_source_cgal_program( "test_graph_traits.cpp" ) create_single_source_cgal_program( "test_Properties.cpp" ) +create_single_source_cgal_program( "test_wrl.cpp" ) + if(OpenMesh_FOUND) target_link_libraries( test_clear PRIVATE ${OPENMESH_LIBRARIES}) target_link_libraries( test_Euler_operations PRIVATE ${OPENMESH_LIBRARIES}) diff --git a/BGL/test/BGL/test_wrl.cpp b/BGL/test/BGL/test_wrl.cpp new file mode 100644 index 00000000000..f8a29ee8533 --- /dev/null +++ b/BGL/test/BGL/test_wrl.cpp @@ -0,0 +1,18 @@ +#include +#include +#include +#include +#include + +typedef CGAL::Simple_cartesian Kernel; +typedef Kernel::Point_3 Point; +typedef CGAL::Surface_mesh Mesh; + +int main() +{ + Mesh sm; + + CGAL::make_tetrahedron(Point(0,0,0), Point(1,0,0), Point(1,1,0), Point(0,0,1), sm); + CGAL::write_wrl(std::cout, sm); + return 0; +} From a5e1edd698eea0e22158b7800f89aa4834e43a23 Mon Sep 17 00:00:00 2001 From: Guillaume Damiand Date: Tue, 27 Nov 2018 11:59:29 +0100 Subject: [PATCH 084/193] Continue to update the lcc demo and the basic viewer. --- .../include/CGAL/Qt/Basic_viewer_qt.h | 5 +- .../Linear_cell_complex_3_demo.cpp | 2 +- .../demo/Linear_cell_complex/Viewer.cpp | 213 ++---------------- .../demo/Linear_cell_complex/Viewer.h | 157 ++++++------- .../include/CGAL/draw_linear_cell_complex.h | 207 +++++++++++++---- 5 files changed, 269 insertions(+), 315 deletions(-) diff --git a/GraphicsView/include/CGAL/Qt/Basic_viewer_qt.h b/GraphicsView/include/CGAL/Qt/Basic_viewer_qt.h index f3079abcda5..1b8fb91323e 100644 --- a/GraphicsView/include/CGAL/Qt/Basic_viewer_qt.h +++ b/GraphicsView/include/CGAL/Qt/Basic_viewer_qt.h @@ -935,8 +935,11 @@ protected: } virtual QString helpString() const + { return helpString("CGAL Basic Viewer"); } + + virtual QString helpString(const char* title) const { - QString text("

C G A L B a s i c V i e w e r

"); + QString text(QString("

")+QString(title)+QString("

")); text += "Use the mouse to move the camera around the object. "; text += "You can respectively revolve around, zoom and translate with " "the three mouse buttons. "; diff --git a/Linear_cell_complex/demo/Linear_cell_complex/Linear_cell_complex_3_demo.cpp b/Linear_cell_complex/demo/Linear_cell_complex/Linear_cell_complex_3_demo.cpp index 7069e069760..4b39885f450 100644 --- a/Linear_cell_complex/demo/Linear_cell_complex/Linear_cell_complex_3_demo.cpp +++ b/Linear_cell_complex/demo/Linear_cell_complex/Linear_cell_complex_3_demo.cpp @@ -39,7 +39,7 @@ int main(int argc, char** argv) application.setApplicationName("3D Linear Cell Complex"); //for windows #if (QT_VERSION >= QT_VERSION_CHECK(5, 3, 0)) - // application.setAttribute(Qt::AA_UseDesktopOpenGL); + application.setAttribute(Qt::AA_UseDesktopOpenGL); #endif // Import resources from libCGALQt5 diff --git a/Linear_cell_complex/demo/Linear_cell_complex/Viewer.cpp b/Linear_cell_complex/demo/Linear_cell_complex/Viewer.cpp index 2bb7c75c737..018d0bdad69 100644 --- a/Linear_cell_complex/demo/Linear_cell_complex/Viewer.cpp +++ b/Linear_cell_complex/demo/Linear_cell_complex/Viewer.cpp @@ -19,223 +19,44 @@ // Author(s) : Guillaume Damiand // Contributor(s): Kumar Snehasish // -#include "Viewer.h" -#include -#include -#include -#include +#include "Viewer.h" #include -#include Viewer::Viewer(QWidget* parent) : Base(parent, NULL, ""), - wireframe(false), - flatShading(true), - edges(true), - vertices(true), - inverse_normal(false), - size_points(7.), - size_edges(3.1), m_previous_scene_empty(true) -// ambient(0.6f, 0.5f, 0.5f, 0.5f), {} -Viewer::~Viewer() -{} +void Viewer::setScene(Scene* scene_, bool doredraw) +{ + scene = scene_; + set_lcc(scene->lcc, doredraw); +} void Viewer::sceneChanged() { Base::compute_elements(); - this->camera()->setSceneBoundingBox(CGAL::qglviewer::Vec(m_bounding_box.xmin(), - m_bounding_box.ymin(), - m_bounding_box.zmin()), - CGAL::qglviewer::Vec(m_bounding_box.xmax(), - m_bounding_box.ymax(), - m_bounding_box.zmax())); + this->camera()-> + setSceneBoundingBox(CGAL::qglviewer::Vec(m_bounding_box.xmin(), + m_bounding_box.ymin(), + m_bounding_box.zmin()), + CGAL::qglviewer::Vec(m_bounding_box.xmax(), + m_bounding_box.ymax(), + m_bounding_box.zmax())); Base::redraw(); if (m_previous_scene_empty) - this->showEntireScene(); + { this->showEntireScene(); } m_previous_scene_empty = scene->lcc->is_empty(); // for the next call to sceneChanged } void Viewer::keyPressEvent(QKeyEvent *e) { - const Qt::KeyboardModifiers modifiers = e->modifiers(); - - if ((e->key()==Qt::Key_W) && (modifiers==Qt::NoButton)) - { - wireframe = !wireframe; - if (wireframe) - { - displayMessage("Wireframe."); - } - else - { - displayMessage("Filled faces."); - } - update(); - } - else if ((e->key()==Qt::Key_F) && (modifiers==Qt::NoButton)) - { - flatShading = !flatShading; - if (flatShading) - displayMessage("Flat shading."); - else - displayMessage("Gouraud shading."); - - update(); - - } - else if ((e->key()==Qt::Key_E) && (modifiers==Qt::NoButton)) - { - edges = !edges; - displayMessage(QString("Draw edges=%1.").arg(edges?"true":"false")); - - update(); - } - else if ((e->key()==Qt::Key_V) && (modifiers==Qt::NoButton)) - { - vertices = !vertices; - displayMessage(QString("Draw vertices=%1.").arg(vertices?"true":"false")); - update(); - } - else if ((e->key()==Qt::Key_N) && (modifiers==Qt::NoButton)) - { - inverse_normal = !inverse_normal; - displayMessage(QString("Inverse normal=%1.").arg(inverse_normal?"true":"false")); - sceneChanged(); - } - else if ((e->key()==Qt::Key_Plus) && (modifiers==Qt::KeypadModifier)) - { - size_edges+=.5; - displayMessage(QString("Size of edges=%1.").arg(size_edges)); - update(); - } - else if ((e->key()==Qt::Key_Minus) && (modifiers==Qt::KeypadModifier)) - { - if (size_edges>.5) size_edges-=.5; - displayMessage(QString("Size of edges=%1.").arg(size_edges)); - update(); - } - else if ((e->key()==Qt::Key_Plus) && (modifiers==(Qt::ShiftModifier|Qt::KeypadModifier))) - { - size_points+=.5; - displayMessage(QString("Size of points=%1.").arg(size_points)); - update(); - } - else if ((e->key()==Qt::Key_Minus) && (modifiers==(Qt::ShiftModifier|Qt::KeypadModifier))) - { - if (size_points>.5) size_points-=.5; - displayMessage(QString("Size of points=%1.").arg(size_points)); - update(); - } -/* else if ((e->key()==Qt::Key_PageUp) && (modifiers==Qt::NoButton)) - { - ambient.setX(ambient.x()+.1); - if (ambient.x()>1.) ambient.setX(1.); - ambient.setY(ambient.x()+.1); - if (ambient.y()>1.) ambient.setY(1.); - ambient.setZ(ambient.x()+.1); - if (ambient.z()>1.) ambient.setZ(1.); - displayMessage(QString("Light color=(%1 %2 %3)."). - arg(ambient.x()).arg(ambient.y()).arg(ambient.z())); - update(); - } - else if ((e->key()==Qt::Key_PageDown) && (modifiers==Qt::NoButton)) - { - ambient.setX(ambient.x()-.1); - if (ambient.x()<0.) ambient.setX(0.); - ambient.setY(ambient.y()-.1); - if (ambient.y()<0.) ambient.setY(0.); - ambient.setZ(ambient.z()-.1); - if (ambient.z()<0.) ambient.setZ(0.); - displayMessage(QString("Light color=(%1 %2 %3)."). - arg(ambient.x()).arg(ambient.y()).arg(ambient.z())); - update(); - } - else if ((e->key()==Qt::Key_PageUp) && (modifiers==Qt::ShiftModifier)) - { - ambient.setX(ambient.x()+.1); - if (ambient.x()>1.) ambient.setX(1.); - displayMessage(QString("Light color=(%1 %2 %3)."). - arg(ambient.x()).arg(ambient.y()).arg(ambient.z())); - update(); - } - else if ((e->key()==Qt::Key_PageUp) && (modifiers==Qt::AltModifier)) - { - ambient.setY(ambient.y()+.1); - if (ambient.y()>1.) ambient.setY(1.); - displayMessage(QString("Light color=(%1 %2 %3)."). - arg(ambient.x()).arg(ambient.y()).arg(ambient.z())); - update(); - } - else if ((e->key()==Qt::Key_PageUp) && (modifiers==Qt::ControlModifier)) - { - ambient.setZ(ambient.z()+.1); - if (ambient.z()>1.) ambient.setZ(1.); - displayMessage(QString("Light color=(%1 %2 %3)."). - arg(ambient.x()).arg(ambient.y()).arg(ambient.z())); - update(); - } - else if ((e->key()==Qt::Key_PageDown) && (modifiers==Qt::ShiftModifier)) - { - ambient.setX(ambient.x()-.1); - if (ambient.x()<0.) ambient.setX(0.); - displayMessage(QString("Light color=(%1 %2 %3)."). - arg(ambient.x()).arg(ambient.y()).arg(ambient.z())); - update(); - } - else if ((e->key()==Qt::Key_PageDown) && (modifiers==Qt::AltModifier)) - { - ambient.setY(ambient.y()-.1); - if (ambient.y()<0.) ambient.setY(0.); - displayMessage(QString("Light color=(%1 %2 %3)."). - arg(ambient.x()).arg(ambient.y()).arg(ambient.z())); - update(); - } - else if ((e->key()==Qt::Key_PageDown) && (modifiers==Qt::ControlModifier)) - { - ambient.setZ(ambient.z()-.1); - if (ambient.z()<0.) ambient.setZ(0.); - displayMessage(QString("Light color=(%1 %2 %3)."). - arg(ambient.x()).arg(ambient.y()).arg(ambient.z())); - update(); - }*/ - else - Base::keyPressEvent(e); + // const Qt::KeyboardModifiers modifiers = e->modifiers(); + Base::keyPressEvent(e); } QString Viewer::helpString() const -{ - QString text("

L C C V i e w e r

"); - text += "Use the mouse to move the camera around the object. "; - text += "You can respectively revolve around, zoom and translate with " - "the three mouse buttons. "; - text += "Left and middle buttons pressed together rotate around the " - "camera view direction axis

"; - text += "Pressing Alt and one of the function keys " - "(F1..F12) defines a camera keyFrame. "; - text += "Simply press the function key again to restore it. Several " - "keyFrames define a "; - text += "camera path. Paths are saved when you quit the application and " - "restored at next start.

"; - text += "Press F to display the frame rate, A for the " - "world axis, "; - text += "Alt+Return for full screen mode and Control+S to " - "save a snapshot. "; - text += "See the Keyboard tab in this window for a complete " - "shortcut list.

"; - text += "Double clicks automates single click actions: A left button " - "double click aligns the closer axis with the camera (if close enough). "; - text += "A middle button double click fits the zoom of the camera and " - "the right button re-centers the scene.

"; - text += "A left button double click while holding right button pressed " - "defines the camera Revolve Around Point. "; - text += "See the Mouse tab and the documentation web pages for " - "details.

"; - text += "Press Escape to exit the viewer."; - return text; -} +{ return Base::helpString("LCC Demo"); } diff --git a/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h b/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h index b189c78d6e9..a7a96997b33 100644 --- a/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h +++ b/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h @@ -23,102 +23,103 @@ #define VIEWER_H #include "typedefs.h" - #include -#include -#include + +// Functor used by SimpleLCCViewerQt to colorize of not elements. +struct MyDrawingFunctorLCC +{ + /// @return true iff the volume containing dh is drawn. + template + bool draw_volume(const LCC& alcc, + typename LCC::Dart_const_handle dh) const + { return alcc.template info<3>(dh).is_visible(); } + /// @return true iff the face containing dh is drawn. + template + bool draw_face(const LCC& alcc, + typename LCC::Dart_const_handle dh) const + { return true; } + /// @return true iff the edge containing dh is drawn. + template + bool draw_edge(const LCC& alcc, + typename LCC::Dart_const_handle dh) const + { return true; } + /// @return true iff the vertex containing dh is drawn. + template + bool draw_vertex(const LCC& alcc, + typename LCC::Dart_const_handle dh) const + { return true; } + + /// @return true iff the volume containing dh is colored. + template + bool colored_volume(const LCC& alcc, + typename LCC::Dart_const_handle dh) const + { return true; } + /// @return true iff the face containing dh is colored. + /// if we have also colored_volume(alcc, dh), the volume color is + /// ignored and only the face color is considered. + template + bool colored_face(const LCC& alcc, + typename LCC::Dart_const_handle dh) const + { return false; } + /// @return true iff the edge containing dh is colored. + template + bool colored_edge(const LCC& alcc, + typename LCC::Dart_const_handle dh) const + { return false; } + /// @return true iff the vertex containing dh is colored. + template + bool colored_vertex(const LCC& alcc, + typename LCC::Dart_const_handle dh) const + { return false; } + + /// @return the color of the volume containing dh + /// used only if colored_volume(alcc, dh) and !colored_face(alcc, dh) + template + CGAL::Color volume_color(const LCC& alcc, + typename LCC::Dart_const_handle dh) const + { return alcc.template info<3>(dh).color(); } + /// @return the color of the face containing dh + /// used only if colored_face(alcc, dh) + template + CGAL::Color face_color(const LCC& alcc, + typename LCC::Dart_const_handle dh) const + { + CGAL::Random random((unsigned int)(alcc.darts().index(dh))); + return get_random_color(random); + } + /// @return the color of the edge containing dh + /// used only if colored_edge(alcc, dh) + template + CGAL::Color edge_color(const LCC& alcc, + typename LCC::Dart_const_handle dh) const + { return CGAL::Color(0, 0, 0); } + /// @return the color of the vertex containing dh + /// used only if colored_vertex(alcc, dh) + template + CGAL::Color vertex_color(const LCC& alcc, + typename LCC::Dart_const_handle dh) const + { return CGAL::Color(0, 0, 0); } +}; -// #include -// #include -// #include -// #include -// #include -// #include - -// #define NB_VBO_BUFFERS 8 -// #define NB_VAO_BUFFERS 4 - -class Viewer : public CGAL::SimpleLCCViewerQt // CGAL::QGLViewer +class Viewer : public CGAL::SimpleLCCViewerQt { Q_OBJECT - typedef CGAL::SimpleLCCViewerQt Base; - typedef LCC::Dart_handle Dart_handle; - typedef LCC::Dart_const_handle Dart_const_handle; + typedef CGAL::SimpleLCCViewerQt Base; public: Viewer(QWidget* parent); - ~Viewer(); - - void setScene(Scene* scene_, bool doredraw=true) - { - scene = scene_; - set_lcc(scene->lcc, doredraw); - } - -public: - // void draw(); - - // virtual void init(); - + void setScene(Scene* scene_, bool doredraw=true); void keyPressEvent(QKeyEvent *e); - virtual QString helpString() const; public Q_SLOTS: - void sceneChanged(); -private: - // void initialize_buffers(); - // void attrib_buffers(CGAL::QGLViewer*); - // void compile_shaders(); - - /* void compute_elements(); - void compute_face(Dart_handle dh, LCC::size_type markface); - void compute_edge(Dart_handle dh, LCC::size_type markedge); - void compute_vertex(Dart_handle dh, LCC::size_type markvertex, bool& empty); */ - private: Scene* scene; - - bool wireframe; - bool flatShading; - bool edges; - bool vertices; - bool inverse_normal; - - double size_points; - double size_edges; - - // QVector4D ambient; - bool m_previous_scene_empty; - // bool are_buffers_initialized; - - //Shaders elements - // int vertexLocation[3]; - // int normalsLocation; - // int mvpLocation[2]; - // int mvLocation; - // int colorLocation; - // int colorsLocation; - // int lightLocation[5]; - - // std::vector pos_points; - // std::vector pos_lines; - // std::vector pos_facets; - // std::vector smooth_normals; - // std::vector flat_normals; - // std::vector colors; - - // QGLBuffer buffers[NB_VBO_BUFFERS]; - // QOpenGLVertexArrayObject vao[NB_VAO_BUFFERS]; - // QOpenGLShaderProgram rendering_program; - // QOpenGLShaderProgram rendering_program_p_l; - - // CGAL::Bbox_3 bb; }; #endif diff --git a/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h b/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h index 1bc5cdd5611..c03a7727f82 100644 --- a/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h +++ b/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h @@ -31,15 +31,85 @@ namespace CGAL { // Default color functor; user can change it to have its own face color -struct DefaultColorFunctorLCC +struct DefaultDrawingFunctorLCC { + /// @return true iff the volume containing dh is drawn. template - static CGAL::Color run(const LCC& alcc, - typename LCC::Dart_const_handle dh) - { - if (dh==alcc.null_handle) // use to get the mono color - return CGAL::Color(100, 125, 200); // R G B between 0-255 + bool draw_volume(const LCC& alcc, + typename LCC::Dart_const_handle dh) const + { return true; } + /// @return true iff the face containing dh is drawn. + template + bool draw_face(const LCC& alcc, + typename LCC::Dart_const_handle dh) const + { return true; } + /// @return true iff the edge containing dh is drawn. + template + bool draw_edge(const LCC& alcc, + typename LCC::Dart_const_handle dh) const + { return true; } + /// @return true iff the vertex containing dh is drawn. + template + bool draw_vertex(const LCC& alcc, + typename LCC::Dart_const_handle dh) const + { return true; } + /// @return true iff the volume containing dh is colored. + template + bool colored_volume(const LCC& alcc, + typename LCC::Dart_const_handle dh) const + { return true; } + /// @return true iff the face containing dh is colored. + /// if we have also colored_volume(alcc, dh), the volume color is + /// ignored and only the face color is considered. + template + bool colored_face(const LCC& alcc, + typename LCC::Dart_const_handle dh) const + { return false; } + /// @return true iff the edge containing dh is colored. + template + bool colored_edge(const LCC& alcc, + typename LCC::Dart_const_handle dh) const + { return false; } + /// @return true iff the vertex containing dh is colored. + template + bool colored_vertex(const LCC& alcc, + typename LCC::Dart_const_handle dh) const + { return false; } + + /// @return the color of the volume containing dh + /// used only if colored_volume(alcc, dh) and !colored_face(alcc, dh) + template + CGAL::Color volume_color(const LCC& alcc, + typename LCC::Dart_const_handle dh) const + { + CGAL::Random random((unsigned int)(alcc.darts().index(dh))); + return get_random_color(random); + } + /// @return the color of the face containing dh + /// used only if colored_face(alcc, dh) + template + CGAL::Color face_color(const LCC& alcc, + typename LCC::Dart_const_handle dh) const + { + CGAL::Random random((unsigned int)(alcc.darts().index(dh))); + return get_random_color(random); + } + /// @return the color of the edge containing dh + /// used only if colored_edge(alcc, dh) + template + CGAL::Color edge_color(const LCC& alcc, + typename LCC::Dart_const_handle dh) const + { + CGAL::Random random((unsigned int)(alcc.darts().index(dh))); + return get_random_color(random); + } + /// @return the color of the vertex containing dh + /// used only if colored_vertex(alcc, dh) + template + CGAL::Color vertex_color(const LCC& alcc, + typename LCC::Dart_const_handle dh) const + { CGAL::Random random((unsigned int)(alcc.darts().index(dh))); return get_random_color(random); } @@ -73,7 +143,7 @@ struct LCC_geom_utils }; // Viewer class for LCC -template +template class SimpleLCCViewerQt : public Basic_viewer_qt { typedef Basic_viewer_qt Base; @@ -92,12 +162,12 @@ public: const LCC* alcc=NULL, const char* title="Basic LCC Viewer", bool anofaces=false, - const ColorFunctor& fcolor=ColorFunctor()) : + const DrawingFunctorLCC& drawing_functor=DrawingFunctorLCC()) : // First draw: vertices; edges, faces; multi-color; inverse normal Base(parent, title, true, true, true, false, true), lcc(alcc), m_nofaces(anofaces), - m_fcolor(fcolor) + m_drawing_functor(drawing_functor) { compute_elements(); } @@ -110,8 +180,10 @@ protected: if (doredraw) { redraw(); } } - void compute_face(Dart_const_handle dh) + void compute_face(Dart_const_handle dh, Dart_const_handle voldh) { + if (m_nofaces || !m_drawing_functor.draw_face(*lcc, dh)) return; + // We fill only closed faces. Dart_const_handle cur=dh; Dart_const_handle min=dh; @@ -123,8 +195,18 @@ protected: } while(cur!=dh); - CGAL::Color c=m_fcolor.run(*lcc, dh); - face_begin(c); + if (m_drawing_functor.colored_face(*lcc, dh)) + { + CGAL::Color c=m_drawing_functor.face_color(*lcc, dh); + face_begin(c); + } + else if (m_drawing_functor.colored_volume(*lcc, voldh)) + { + CGAL::Color c=m_drawing_functor.volume_color(*lcc, voldh); + face_begin(c); + } + else + { face_begin(); } cur=dh; do @@ -140,20 +222,35 @@ protected: void compute_edge(Dart_const_handle dh) { + if (!m_drawing_functor.draw_edge(*lcc, dh)) return; + Point p1 = lcc->point(dh); Dart_const_handle d2 = lcc->other_extremity(dh); if (d2!=NULL) - { add_segment(p1, lcc->point(d2)); } + { + if (m_drawing_functor.colored_edge(*lcc, dh)) + { add_segment(p1, lcc->point(d2), m_drawing_functor.edge_color(*lcc, dh)); } + else + { add_segment(p1, lcc->point(d2)); } + } } void compute_vertex(Dart_const_handle dh) - { add_point(lcc->point(dh)); } + { + if (!m_drawing_functor.draw_vertex(*lcc, dh)) return; + + if (m_drawing_functor.colored_vertex(*lcc, dh)) + { add_point(lcc->point(dh), m_drawing_functor.vertex_color(*lcc, dh)); } + else + { add_point(lcc->point(dh)); } + } void compute_elements() { clear(); if (lcc==NULL) return; + typename LCC::size_type markvolumes = lcc->get_new_mark(); typename LCC::size_type markfaces = lcc->get_new_mark(); typename LCC::size_type markedges = lcc->get_new_mark(); typename LCC::size_type markvertices = lcc->get_new_mark(); @@ -161,25 +258,57 @@ protected: for (typename LCC::Dart_range::const_iterator it=lcc->darts().begin(), itend=lcc->darts().end(); it!=itend; ++it ) { - if ( !m_nofaces && !lcc->is_marked(it, markfaces) ) + if (!lcc->is_marked(it, markvolumes) && + m_drawing_functor.draw_volume(*lcc, it)) { - compute_face(it); - CGAL::mark_cell(*lcc, it, markfaces); - } - - if ( !lcc->is_marked(it, markedges) ) - { - compute_edge(it); - CGAL::mark_cell(*lcc, it, markedges); - } - - if ( !lcc->is_marked(it, markvertices) ) - { - compute_vertex(it); - CGAL::mark_cell(*lcc, it, markvertices); + for (typename LCC::template Dart_of_cell_basic_range<3>:: + const_iterator itv=lcc->template darts_of_cell_basic<3>(it, markvolumes).begin(), + itvend=lcc->template darts_of_cell_basic<3>(it, markvolumes).end(); + itv!=itvend; ++itv) + { + if (!lcc->is_marked(itv, markfaces) && + m_drawing_functor.draw_face(*lcc, itv)) + { + compute_face(itv, it); + for (typename LCC::template Dart_of_cell_basic_range<2>:: + const_iterator itf=lcc->template darts_of_cell_basic<2>(itv, markfaces).begin(), + itfend=lcc->template darts_of_cell_basic<2>(itv, markfaces).end(); + itf!=itfend; ++itf) + { + if ( !lcc->is_marked(itf, markedges) && + m_drawing_functor.draw_edge(*lcc, itf)) + { + compute_edge(itf); + for (typename LCC::template Dart_of_cell_basic_range<1>:: + const_iterator ite=lcc->template darts_of_cell_basic<1>(itf, markfaces).begin(), + iteend=lcc->template darts_of_cell_basic<1>(itf, markfaces).end(); + ite!=iteend; ++ite) + { + if ( !lcc->is_marked(ite, markvertices) && + m_drawing_functor.draw_vertex(*lcc, ite)) + { + compute_vertex(ite); + CGAL::mark_cell(*lcc, ite, markvertices); + } + } + } + } + } + } } } + for (typename LCC::Dart_range::const_iterator it=lcc->darts().begin(), + itend=lcc->darts().end(); it!=itend; ++it ) + { + lcc->unmark(it, markvertices); + lcc->unmark(it, markedges); + lcc->unmark(it, markfaces); + lcc->unmark(it, markvolumes); + + } + + lcc->free_mark(markvolumes); lcc->free_mark(markfaces); lcc->free_mark(markedges); lcc->free_mark(markvertices); @@ -204,14 +333,14 @@ protected: protected: const LCC* lcc; bool m_nofaces; - const ColorFunctor& m_fcolor; + const DrawingFunctorLCC& m_drawing_functor; }; -template +template void draw(const LCC& alcc, const char* title, bool nofill, - const ColorFunctor& fcolor) + const DrawingFunctorLCC& drawing_functor) { #if defined(CGAL_TEST_SUITE) bool cgal_test_suite=true; @@ -224,11 +353,11 @@ void draw(const LCC& alcc, int argc=1; const char* argv[2]={"lccviewer","\0"}; QApplication app(argc,const_cast(argv)); - SimpleLCCViewerQt mainwindow(app.activeWindow(), - &alcc, - title, - nofill, - fcolor); + SimpleLCCViewerQt mainwindow(app.activeWindow(), + &alcc, + title, + nofill, + drawing_functor); mainwindow.show(); app.exec(); } @@ -237,8 +366,8 @@ void draw(const LCC& alcc, template void draw(const LCC& alcc, const char* title, bool nofill) { - DefaultColorFunctorLCC c; - draw(alcc, title, nofill, c); + DefaultDrawingFunctorLCC f; + draw(alcc, title, nofill, f); } template From 162a4b5593887c9ce45dec3fd6a7c3b5bf3427b4 Mon Sep 17 00:00:00 2001 From: Guillaume Damiand Date: Tue, 27 Nov 2018 15:45:05 +0100 Subject: [PATCH 085/193] Continue to update the lcc demo and the basic viewer. --- .../demo/Linear_cell_complex/Viewer.h | 11 ++++++++++ .../include/CGAL/draw_linear_cell_complex.h | 22 ++++++++++++++++--- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h b/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h index a7a96997b33..514b3db1599 100644 --- a/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h +++ b/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h @@ -49,6 +49,17 @@ struct MyDrawingFunctorLCC typename LCC::Dart_const_handle dh) const { return true; } + /// @return true iff the volume containing dh is drawn in wireframe. + template + bool volume_wireframe(const LCC& alcc, + typename LCC::Dart_const_handle dh) const + { return false; } + /// @return true iff the face containing dh is drawn in wireframe. + template + bool face_wireframe(const LCC& alcc, + typename LCC::Dart_const_handle dh) const + { return false; } + /// @return true iff the volume containing dh is colored. template bool colored_volume(const LCC& alcc, diff --git a/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h b/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h index c03a7727f82..1bb832fde74 100644 --- a/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h +++ b/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h @@ -54,6 +54,17 @@ struct DefaultDrawingFunctorLCC typename LCC::Dart_const_handle dh) const { return true; } + /// @return true iff the volume containing dh is drawn in wireframe. + template + bool volume_wireframe(const LCC& alcc, + typename LCC::Dart_const_handle dh) const + { return false; } + /// @return true iff the face containing dh is drawn in wireframe. + template + bool face_wireframe(const LCC& alcc, + typename LCC::Dart_const_handle dh) const + { return false; } + /// @return true iff the volume containing dh is colored. template bool colored_volume(const LCC& alcc, @@ -266,24 +277,29 @@ protected: itvend=lcc->template darts_of_cell_basic<3>(it, markvolumes).end(); itv!=itvend; ++itv) { + lcc->mark(itv, markvolumes); // To be sure that all darts of the basic iterator will be marked if (!lcc->is_marked(itv, markfaces) && m_drawing_functor.draw_face(*lcc, itv)) { - compute_face(itv, it); + if (!m_drawing_functor.volume_wireframe(*lcc, itv) && + !m_drawing_functor.face_wireframe(*lcc, itv)) + { compute_face(itv, it); } for (typename LCC::template Dart_of_cell_basic_range<2>:: const_iterator itf=lcc->template darts_of_cell_basic<2>(itv, markfaces).begin(), itfend=lcc->template darts_of_cell_basic<2>(itv, markfaces).end(); itf!=itfend; ++itf) { + lcc->mark(itf, markfaces); // To be sure that all darts of the basic iterator will be marked if ( !lcc->is_marked(itf, markedges) && m_drawing_functor.draw_edge(*lcc, itf)) { compute_edge(itf); for (typename LCC::template Dart_of_cell_basic_range<1>:: - const_iterator ite=lcc->template darts_of_cell_basic<1>(itf, markfaces).begin(), - iteend=lcc->template darts_of_cell_basic<1>(itf, markfaces).end(); + const_iterator ite=lcc->template darts_of_cell_basic<1>(itf, markedges).begin(), + iteend=lcc->template darts_of_cell_basic<1>(itf, markedges).end(); ite!=iteend; ++ite) { + lcc->mark(ite, markedges); // To be sure that all darts of the basic iterator will be marked if ( !lcc->is_marked(ite, markvertices) && m_drawing_functor.draw_vertex(*lcc, ite)) { From db9204acedc8e666c9f558fd7e98e7773072242f Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 27 Nov 2018 15:51:19 +0100 Subject: [PATCH 086/193] Update kernel_ftC2.h Simplify expression as we know that `b == 0` --- Cartesian_kernel/include/CGAL/constructions/kernel_ftC2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cartesian_kernel/include/CGAL/constructions/kernel_ftC2.h b/Cartesian_kernel/include/CGAL/constructions/kernel_ftC2.h index 48dba7821ae..144ec2695d2 100644 --- a/Cartesian_kernel/include/CGAL/constructions/kernel_ftC2.h +++ b/Cartesian_kernel/include/CGAL/constructions/kernel_ftC2.h @@ -284,7 +284,7 @@ line_get_pointC2(const FT &a, const FT &b, const FT &c, int i, { if (CGAL_NTS is_zero(b)) { - x = (-b-c)/a + i * b; + x = -c/a; y = 1 - i * a; } else From 111eb4ee21291b8b28f20abfd642e41707948b08 Mon Sep 17 00:00:00 2001 From: Guillaume Damiand Date: Tue, 27 Nov 2018 16:07:52 +0100 Subject: [PATCH 087/193] Demo of LCC is now ok --- Linear_cell_complex/demo/Linear_cell_complex/Viewer.h | 2 +- Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h b/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h index 514b3db1599..f5c5eec9a80 100644 --- a/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h +++ b/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h @@ -53,7 +53,7 @@ struct MyDrawingFunctorLCC template bool volume_wireframe(const LCC& alcc, typename LCC::Dart_const_handle dh) const - { return false; } + { return !(alcc.template info<3>(dh).is_filled()); } /// @return true iff the face containing dh is drawn in wireframe. template bool face_wireframe(const LCC& alcc, diff --git a/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h b/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h index 1bb832fde74..29ed3ad3289 100644 --- a/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h +++ b/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h @@ -289,7 +289,9 @@ protected: itfend=lcc->template darts_of_cell_basic<2>(itv, markfaces).end(); itf!=itfend; ++itf) { - lcc->mark(itf, markfaces); // To be sure that all darts of the basic iterator will be marked + if (!m_drawing_functor.volume_wireframe(*lcc, itv) && + !m_drawing_functor.face_wireframe(*lcc, itv)) + { lcc->mark(itf, markfaces); } // To be sure that all darts of the basic iterator will be marked if ( !lcc->is_marked(itf, markedges) && m_drawing_functor.draw_edge(*lcc, itf)) { From edfdc8d34653d9ab6a9d072132edddf0044b2d2e Mon Sep 17 00:00:00 2001 From: Guillaume Damiand Date: Tue, 27 Nov 2018 17:02:38 +0100 Subject: [PATCH 088/193] Readd the random face color option for lcc viewer. --- .../include/CGAL/Qt/Basic_viewer_qt.h | 2 +- .../include/CGAL/draw_linear_cell_complex.h | 36 ++++++++++++++----- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/GraphicsView/include/CGAL/Qt/Basic_viewer_qt.h b/GraphicsView/include/CGAL/Qt/Basic_viewer_qt.h index 1b8fb91323e..18213239d26 100644 --- a/GraphicsView/include/CGAL/Qt/Basic_viewer_qt.h +++ b/GraphicsView/include/CGAL/Qt/Basic_viewer_qt.h @@ -740,7 +740,7 @@ protected: setKeyDescription(::Qt::Key_E, "Toggles edges display"); setKeyDescription(::Qt::Key_F, "Toggles faces display"); setKeyDescription(::Qt::Key_G, "Switch between flat/Gouraud shading display"); - setKeyDescription(::Qt::Key_M, "Toggles mono color for all faces"); + setKeyDescription(::Qt::Key_M, "Toggles mono color"); setKeyDescription(::Qt::Key_N, "Inverse direction of normals"); setKeyDescription(::Qt::Key_V, "Toggles vertices display"); setKeyDescription(::Qt::Key_Plus, "Increase size of edges"); diff --git a/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h b/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h index 29ed3ad3289..c1fb9eedbb5 100644 --- a/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h +++ b/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h @@ -178,6 +178,7 @@ public: Base(parent, title, true, true, true, false, true), lcc(alcc), m_nofaces(anofaces), + m_random_face_color(false), m_drawing_functor(drawing_functor) { compute_elements(); @@ -205,8 +206,14 @@ protected: cur=lcc->next(cur); } while(cur!=dh); - - if (m_drawing_functor.colored_face(*lcc, dh)) + + if (m_random_face_color) + { + CGAL::Random random((unsigned int)(lcc->darts().index(dh))); + CGAL::Color c=get_random_color(random); + face_begin(c); + } + else if (m_drawing_functor.colored_face(*lcc, dh)) { CGAL::Color c=m_drawing_functor.face_color(*lcc, dh); face_begin(c); @@ -331,26 +338,37 @@ protected: lcc->free_mark(markedges); lcc->free_mark(markvertices); } - + + virtual void init() + { + Base::init(); + setKeyDescription(::Qt::Key_C, "Toggles random face colors"); + } + virtual void keyPressEvent(QKeyEvent *e) { - // Test key pressed: - // const ::Qt::KeyboardModifiers modifiers = e->modifiers(); - // if ((e->key()==Qt::Key_PageUp) && (modifiers==Qt::NoButton)) { ... } + const ::Qt::KeyboardModifiers modifiers = e->modifiers(); + if ((e->key()==::Qt::Key_C) && (modifiers==::Qt::NoButton)) + { + m_random_face_color=!m_random_face_color; + displayMessage(QString("Random face color=%1.").arg(m_random_face_color?"true":"false")); + compute_elements(); + redraw(); + } + else + { Base::keyPressEvent(e); } // Call the base method to process others/classicals key // Call: * compute_elements() if the model changed, followed by // * redraw() if some viewing parameters changed that implies some // modifications of the buffers // (eg. type of normal, color/mono) // * update() just to update the drawing - - // Call the base method to process others/classicals key - Base::keyPressEvent(e); } protected: const LCC* lcc; bool m_nofaces; + bool m_random_face_color; const DrawingFunctorLCC& m_drawing_functor; }; From 4b8bd40d8c0c1b70203eb95bb4c83fc50e1aa87a Mon Sep 17 00:00:00 2001 From: Guillaume Damiand Date: Tue, 27 Nov 2018 18:21:57 +0100 Subject: [PATCH 089/193] Bugfix in Buffer_for_vao.h, in the method is_facet_convex. --- GraphicsView/include/CGAL/Buffer_for_vao.h | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/GraphicsView/include/CGAL/Buffer_for_vao.h b/GraphicsView/include/CGAL/Buffer_for_vao.h index b7658d45021..a0148cd4c0b 100644 --- a/GraphicsView/include/CGAL/Buffer_for_vao.h +++ b/GraphicsView/include/CGAL/Buffer_for_vao.h @@ -426,25 +426,7 @@ public: const Local_point& S=facet[id]; const Local_point& T=facet[(id+1==facet.size())?0:id+1]; Local_vector V1=Local_vector((T-S).x(), (T-S).y(), (T-S).z()); - if(std::isnan(S.x()) || - std::isnan(S.y()) || - std::isnan(S.z())) - { - return false; - } - if(std::isnan(T.x()) || - std::isnan(T.y()) || - std::isnan(T.z())) - { - return false; - } - const Local_point& U=facet[(id+2==facet.size())?0:id+2]; - if(std::isnan(U.x()) || - std::isnan(U.y()) || - std::isnan(U.z())) - { - return false; - } + const Local_point& U=facet[(id+2>=facet.size())?id+2-facet.size():id+2]; Local_vector V2=Local_vector((U-T).x(), (U-T).y(), (U-T).z()); orientation = Local_kernel::Orientation_3()(V1, V2, normal); @@ -465,7 +447,7 @@ public: const Local_point& T=facet[(id+1==facet.size())?0:id+1]; Local_vector V1=Local_vector((T-S).x(), (T-S).y(), (T-S).z()); - const Local_point& U=facet[(id+2==facet.size())?0:id+2]; + const Local_point& U=facet[(id+2>=facet.size())?id+2-facet.size():id+2]; Local_vector V2=Local_vector((U-T).x(), (U-T).y(), (U-T).z()); local_orientation=Local_kernel::Orientation_3()(V1, V2, normal) ; From 5f007da4615d34e7f177210477b7c6a644d6c908 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 28 Nov 2018 07:56:14 +0100 Subject: [PATCH 090/193] Remove unused variables --- BGL/include/CGAL/boost/graph/io.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/io.h b/BGL/include/CGAL/boost/graph/io.h index f5775e63662..71bb55def86 100644 --- a/BGL/include/CGAL/boost/graph/io.h +++ b/BGL/include/CGAL/boost/graph/io.h @@ -61,9 +61,6 @@ bool write_wrl(std::ostream& os, vpm = choose_param(get_param(np, internal_np::vertex_point), get_const_property_map(CGAL::vertex_point, g)); - vertices_size_type nv = static_cast(std::distance(vertices(g).first, vertices(g).second)); - faces_size_type nf = static_cast(std::distance(faces(g).first, faces(g).second)); - boost::container::flat_map reindex; int n = 0; From 6cc109f7c42b5ade5f53fbeeca2d5d46c7f361f1 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 28 Nov 2018 09:07:36 +0100 Subject: [PATCH 091/193] AABB Tree testsuite --- .../CGAL/internal/AABB_tree/AABB_ray_intersection.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/AABB_tree/include/CGAL/internal/AABB_tree/AABB_ray_intersection.h b/AABB_tree/include/CGAL/internal/AABB_tree/AABB_ray_intersection.h index c5c388d4304..ccebce05bb8 100644 --- a/AABB_tree/include/CGAL/internal/AABB_tree/AABB_ray_intersection.h +++ b/AABB_tree/include/CGAL/internal/AABB_tree/AABB_ray_intersection.h @@ -31,10 +31,18 @@ #include #include #if BOOST_VERSION >= 105000 -#include +# if defined(BOOST_MSVC) +# pragma warning(push) +# pragma warning(disable: 4996) +# endif +# include +# if defined(BOOST_MSVC) +# pragma warning(pop) +# endif #else -#include +# include #endif + #include namespace CGAL { From 04bbc7c6ef39d3ae8ed9ee6d2e355c9499764f54 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 28 Nov 2018 09:17:35 +0100 Subject: [PATCH 092/193] Suppress boost::bimap warning --- Mesher_level/include/CGAL/Double_map.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Mesher_level/include/CGAL/Double_map.h b/Mesher_level/include/CGAL/Double_map.h index 517cb223b13..3fd229693c7 100644 --- a/Mesher_level/include/CGAL/Double_map.h +++ b/Mesher_level/include/CGAL/Double_map.h @@ -40,8 +40,14 @@ #endif #ifdef CGAL_USE_BOOST_BIMAP +# if defined(BOOST_MSVC) +# pragma warning(push) +# pragma warning(disable: 4996) +# endif #include #include +# if defined(BOOST_MSVC) +# pragma warning(pop) #endif namespace CGAL { From 81cf49efb1bbd7b7d9391e50eebac9082c6fd837 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Wed, 28 Nov 2018 09:46:53 +0100 Subject: [PATCH 093/193] Fix the construction of CGAL_ROOT in header-only In header-only, `CGALConfig.cmake` constructs the path to the root of the CGAL installation. It used to use `../` a lot, to go back in parent directories, but: - that was... ugly, - and Ninja saw a problem with that (a warning about the path to `print_GMP_version.cpp`). `CGALConfig.cmake` Now uses the CMake command `get_filename_component`. --- Installation/lib/cmake/CGAL/CGALConfig.cmake | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Installation/lib/cmake/CGAL/CGALConfig.cmake b/Installation/lib/cmake/CGAL/CGALConfig.cmake index 486f1ff6746..ad0de1806ca 100644 --- a/Installation/lib/cmake/CGAL/CGALConfig.cmake +++ b/Installation/lib/cmake/CGAL/CGALConfig.cmake @@ -26,7 +26,11 @@ endfunction() cgal_detect_branch_build(BRANCH_BUILD) if(BRANCH_BUILD) - set(CGAL_ROOT ${CGAL_CONFIG_DIR}/../../../..) + set(CGAL_ROOT ${CGAL_CONFIG_DIR}) + get_filename_component(CGAL_ROOT "${CGAL_ROOT}" DIRECTORY) + get_filename_component(CGAL_ROOT "${CGAL_ROOT}" DIRECTORY) + get_filename_component(CGAL_ROOT "${CGAL_ROOT}" DIRECTORY) + get_filename_component(CGAL_ROOT "${CGAL_ROOT}" DIRECTORY) set(CGAL_INSTALLATION_PACKAGE_DIR ${CGAL_ROOT}/Installation) set(CGAL_GRAPHICSVIEW_PACKAGE_DIR ${CGAL_ROOT}/GraphicsView) set(CGAL_MODULES_DIR ${CGAL_ROOT}/Installation/cmake/modules) @@ -43,7 +47,10 @@ if(BRANCH_BUILD) endif() endforeach() else() - set(CGAL_ROOT ${CGAL_CONFIG_DIR}/../../..) + set(CGAL_ROOT ${CGAL_CONFIG_DIR}) + get_filename_component(CGAL_ROOT "${CGAL_ROOT}" DIRECTORY) + get_filename_component(CGAL_ROOT "${CGAL_ROOT}" DIRECTORY) + get_filename_component(CGAL_ROOT "${CGAL_ROOT}" DIRECTORY) # not BRANCH_BUILD: it can be an installed CGAL, or the tarball layout if(EXISTS ${CGAL_CONFIG_DIR}/CGAL_add_test.cmake) From a6b6fd6a7fddd4583aa923f7d59caf8827da1c0b Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 28 Nov 2018 10:23:28 +0100 Subject: [PATCH 094/193] Fix error --- Mesher_level/include/CGAL/Double_map.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Mesher_level/include/CGAL/Double_map.h b/Mesher_level/include/CGAL/Double_map.h index 3fd229693c7..7de1f9d66e6 100644 --- a/Mesher_level/include/CGAL/Double_map.h +++ b/Mesher_level/include/CGAL/Double_map.h @@ -48,6 +48,7 @@ #include # if defined(BOOST_MSVC) # pragma warning(pop) +# endif #endif namespace CGAL { From d2c5e1c210c737fd6299665e236e1e0d63bba325 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 28 Nov 2018 13:29:19 +0100 Subject: [PATCH 095/193] Suppress warning concerning td::fpos::seekpos() --- .../include/CGAL/Classification/ETHZ_random_forest_classifier.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Classification/include/CGAL/Classification/ETHZ_random_forest_classifier.h b/Classification/include/CGAL/Classification/ETHZ_random_forest_classifier.h index cf3ae810df9..1587baf4b9b 100644 --- a/Classification/include/CGAL/Classification/ETHZ_random_forest_classifier.h +++ b/Classification/include/CGAL/Classification/ETHZ_random_forest_classifier.h @@ -38,6 +38,7 @@ # pragma warning(disable:4267) # pragma warning(disable:4275) # pragma warning(disable:4251) +# pragma warning(disable:4996) #endif #include From 5a8987a9bbf6f444bade41f4fd1789dc639374ea Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Wed, 28 Nov 2018 14:40:51 +0100 Subject: [PATCH 096/193] Generalise the creation of surface-only c3t3 items --- Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp | 2 ++ .../Polyhedron/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.cpp | 6 ++++-- .../Polyhedron/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.h | 2 ++ 3 files changed, 8 insertions(+), 2 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 f249bb1455b..27a20f77cec 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp @@ -502,6 +502,7 @@ void Mesh_3_plugin::mesh_3(const bool surface_only, const bool use_defaults) edge_size, radius_edge, manifold, + surface_only, scene); } #endif @@ -527,6 +528,7 @@ void Mesh_3_plugin::mesh_3(const bool surface_only, const bool use_defaults) radius_edge, protect_features, manifold, + surface_only, scene, detect_connected_components, image_item->isGray(), 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 4d6cbfc8f52..211c98f1bd4 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 @@ -181,6 +181,7 @@ Meshing_thread* cgal_code_mesh_3(const Implicit_function_interface* pfunction, const double edge_size, const double tet_shape, const int manifold, + const bool surface_only, CGAL::Three::Scene_interface* scene) { if (pfunction == NULL) { return NULL; } @@ -198,7 +199,7 @@ Meshing_thread* cgal_code_mesh_3(const Implicit_function_interface* pfunction, [](int i, int j) { return (i * 1000 + j); } ); - Scene_c3t3_item* p_new_item = new Scene_c3t3_item; + Scene_c3t3_item* p_new_item = new Scene_c3t3_item(surface_only); p_new_item->setScene(scene); Mesh_parameters param; @@ -236,6 +237,7 @@ Meshing_thread* cgal_code_mesh_3(const Image* pImage, const double tet_shape, bool protect_features, const int manifold, + const bool surface_only, CGAL::Three::Scene_interface* scene, bool detect_connected_components, bool is_gray, @@ -259,7 +261,7 @@ Meshing_thread* cgal_code_mesh_3(const Image* pImage, param.tet_shape = tet_shape; param.manifold = manifold; param.image_3_ptr = pImage; - Scene_c3t3_item* p_new_item = new Scene_c3t3_item; + Scene_c3t3_item* p_new_item = new Scene_c3t3_item(surface_only); p_new_item->setScene(scene); if(!is_gray) { 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 ca90415d036..20b01d11e6d 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 @@ -44,6 +44,7 @@ Meshing_thread* cgal_code_mesh_3(const Implicit_function_interface* pfunction, const double edge_size, const double tet_shape, const int manifold, + const bool surface_only, CGAL::Three::Scene_interface* scene); #endif @@ -58,6 +59,7 @@ Meshing_thread* cgal_code_mesh_3(const CGAL::Image_3* pImage, const double tet_shape, bool protect_features, const int manifold, + const bool surface_only, CGAL::Three::Scene_interface* scene, bool detect_connected_components, bool is_gray = false, From 2c093b9cc8cf0ba5c11b1f4e52d6879074455640 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 28 Nov 2018 16:25:51 +0100 Subject: [PATCH 097/193] Add missing addItem() --- .../Plugins/Point_set/Surface_reconstruction_plugin.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_plugin.cpp index 8836464f409..f5dcb92714a 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_plugin.cpp @@ -1160,6 +1160,7 @@ void Polyhedron_demo_surface_reconstruction_plugin::advancing_front_reconstructi reco_item->setColor(Qt::lightGray); reco_item->setRenderingMode(FlatPlusEdges); reco_item->invalidateOpenGLBuffers(); + scene->addItem(reco_item); QApplication::restoreOverrideCursor(); } } From c570e86661610857447f8a2e6c37bbfafa95f85b Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 29 Nov 2018 08:12:26 +0100 Subject: [PATCH 098/193] Removed unused typedef; Added to CHANGES.md --- BGL/include/CGAL/boost/graph/io.h | 2 -- Installation/CHANGES.md | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/io.h b/BGL/include/CGAL/boost/graph/io.h index 71bb55def86..60dcfca72ad 100644 --- a/BGL/include/CGAL/boost/graph/io.h +++ b/BGL/include/CGAL/boost/graph/io.h @@ -54,8 +54,6 @@ bool write_wrl(std::ostream& os, typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; typedef typename boost::graph_traits::face_descriptor face_descriptor; typedef typename boost::graph_traits::vertices_size_type vertices_size_type; - typedef typename boost::graph_traits::faces_size_type faces_size_type; - typename Polygon_mesh_processing::GetVertexPointMap::const_type vpm = choose_param(get_param(np, internal_np::vertex_point), diff --git a/Installation/CHANGES.md b/Installation/CHANGES.md index 672d71541a4..86dd48044b6 100644 --- a/Installation/CHANGES.md +++ b/Installation/CHANGES.md @@ -54,6 +54,10 @@ Release date: March 2019 `Arr_polyline_traits_2`, `Arr_polycurve_traits_2`, and `Arr_polycurve_basic_traits_2`. +### CGAL and the Boost Graph Library (BGL) + +- Add function `write_wrl()` for writing into VRML 2.0 format. + Release 4.13 ------------ From b14b457b152d8dd7910e141a92cd9a59d4f63374 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Thu, 29 Nov 2018 10:08:04 +0100 Subject: [PATCH 099/193] Add missing argument in cgal_test --- Snap_rounding_2/test/Snap_rounding_2/cgal_test_base | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Snap_rounding_2/test/Snap_rounding_2/cgal_test_base b/Snap_rounding_2/test/Snap_rounding_2/cgal_test_base index 42fd5193cd0..eb20f1c06cf 100755 --- a/Snap_rounding_2/test/Snap_rounding_2/cgal_test_base +++ b/Snap_rounding_2/test/Snap_rounding_2/cgal_test_base @@ -25,7 +25,7 @@ configure() { echo "Configuring... " - if eval 'cmake --no-warn-unused-cli "$CMAKE_GENERATOR" -DRUNNING_CGAL_AUTO_TEST=TRUE \ + if eval 'cmake --no-warn-unused-cli ${INIT_FILE:+"-C${INIT_FILE}"} "$CMAKE_GENERATOR" -DRUNNING_CGAL_AUTO_TEST=TRUE \ -DCGAL_DIR="$CGAL_DIR" \ .' ; then From e294889e804a781baf03ccf5436f2771629bcb2a Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 29 Nov 2018 10:46:48 +0100 Subject: [PATCH 100/193] More casts to avoid warning --- Number_types/test/Number_types/Interval_nt.cpp | 2 +- STL_Extension/test/STL_Extension/test_dispatch_output.cpp | 6 +++--- .../test/Segment_Delaunay_graph_2/include/test_types.h | 2 +- .../test/Segment_Delaunay_graph_Linf_2/include/test_types.h | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Number_types/test/Number_types/Interval_nt.cpp b/Number_types/test/Number_types/Interval_nt.cpp index f2ca4dcf5ab..9d6ff105124 100644 --- a/Number_types/test/Number_types/Interval_nt.cpp +++ b/Number_types/test/Number_types/Interval_nt.cpp @@ -211,7 +211,7 @@ bool multiplication_test() g = d * e; h = d * f; i = a * e; - j = j; + j = (IA_nt&)j; // When CGAL_IA_DEBUG is defined, it'll test the current rounding mode for // these operations. diff --git a/STL_Extension/test/STL_Extension/test_dispatch_output.cpp b/STL_Extension/test/STL_Extension/test_dispatch_output.cpp index 8036587fc81..b8df6175cdc 100644 --- a/STL_Extension/test/STL_Extension/test_dispatch_output.cpp +++ b/STL_Extension/test/STL_Extension/test_dispatch_output.cpp @@ -23,7 +23,7 @@ void check_types(output out){ CGAL_USE_TYPE(typename output::pointer); CGAL_USE_TYPE(typename output::reference); T1 tmp=out.get_iterator_tuple(); - tmp=tmp; + tmp=(T1&)tmp; } template @@ -69,8 +69,8 @@ void complete_test(std::vector data1,std::list data2){ check_types(disp); check_types(drop); - disp = disp; - drop = drop; + disp = (Dispatcher&)disp; + drop = (Dropper&)drop; std::back_insert_iterator > bck_ins(cont_2); diff --git a/Segment_Delaunay_graph_2/test/Segment_Delaunay_graph_2/include/test_types.h b/Segment_Delaunay_graph_2/test/Segment_Delaunay_graph_2/include/test_types.h index 630d7411361..612bcffa80b 100644 --- a/Segment_Delaunay_graph_2/test/Segment_Delaunay_graph_2/include/test_types.h +++ b/Segment_Delaunay_graph_2/test/Segment_Delaunay_graph_2/include/test_types.h @@ -167,7 +167,7 @@ bool test_sdg(InputStream&, const SDG&, const char* ifname, const char* ofname, start_testing("assignment operator"); sdg.insert(site_list.begin(), site_list.end()); - sdg = sdg; + sdg = (Segment_Delaunay_graph_2&)sdg; sdg2 = sdg; assert( sdg.is_valid() ); diff --git a/Segment_Delaunay_graph_Linf_2/test/Segment_Delaunay_graph_Linf_2/include/test_types.h b/Segment_Delaunay_graph_Linf_2/test/Segment_Delaunay_graph_Linf_2/include/test_types.h index b28f452f0a3..a2e414a691c 100644 --- a/Segment_Delaunay_graph_Linf_2/test/Segment_Delaunay_graph_Linf_2/include/test_types.h +++ b/Segment_Delaunay_graph_Linf_2/test/Segment_Delaunay_graph_Linf_2/include/test_types.h @@ -167,7 +167,7 @@ bool test_sdg(InputStream&, const SDG&, const char* ifname, const char* ofname, start_testing("assignment operator"); sdg.insert(site_list.begin(), site_list.end()); - sdg = sdg; + sdg = (Segment_Delaunay_graph_2&)sdg; sdg2 = sdg; assert( sdg.is_valid() ); From b8458399f952a764698d37ad9e5e9a6b811da624 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Thu, 29 Nov 2018 11:29:05 +0100 Subject: [PATCH 101/193] Add misisng include --- Polyhedron/demo/Polyhedron/MainWindow.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Polyhedron/demo/Polyhedron/MainWindow.cpp b/Polyhedron/demo/Polyhedron/MainWindow.cpp index 5f88ea9b487..456be43e226 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.cpp +++ b/Polyhedron/demo/Polyhedron/MainWindow.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #ifdef QT_SCRIPT_LIB # include # ifdef QT_SCRIPTTOOLS_LIB From cb4c3b47cf6ad31be165f4972e5df2fdb808538f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 29 Nov 2018 14:53:21 +0100 Subject: [PATCH 102/193] fix back-ticking --- BGL/include/CGAL/boost/graph/helpers.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BGL/include/CGAL/boost/graph/helpers.h b/BGL/include/CGAL/boost/graph/helpers.h index c62b5c9ebba..7ed5fbf1447 100644 --- a/BGL/include/CGAL/boost/graph/helpers.h +++ b/BGL/include/CGAL/boost/graph/helpers.h @@ -1081,7 +1081,7 @@ make_regular_prism( * \ingroup PkgBGLHelperFct * \brief Creates a pyramid, outward oriented, having `nb_vertices` vertices in its base and adds it to the graph `g`. * - * If `center` is (0, 0, 0), then the first point of the base is (`radius`, 0`, 0) + * If `center` is `(0, 0, 0)`, then the first point of the base is `(radius, 0, 0)` * \param nb_vertices the number of vertices in the base. It must be greater than or equal to 3. * \param g the graph in which the pyramid will be created * \param base_center the center of the circle in which the base is inscribed. From c2665415cd37264c37202682d435b449dea3c720 Mon Sep 17 00:00:00 2001 From: Guillaume Damiand Date: Fri, 30 Nov 2018 08:03:31 +0100 Subject: [PATCH 103/193] Remove warning in lcc viewers. --- .../demo/Linear_cell_complex/Viewer.h | 36 +++++++++---------- .../include/CGAL/draw_linear_cell_complex.h | 28 +++++++-------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h b/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h index f5c5eec9a80..611272d0e9d 100644 --- a/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h +++ b/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h @@ -35,18 +35,18 @@ struct MyDrawingFunctorLCC { return alcc.template info<3>(dh).is_visible(); } /// @return true iff the face containing dh is drawn. template - bool draw_face(const LCC& alcc, - typename LCC::Dart_const_handle dh) const + bool draw_face(const LCC&, + typename LCC::Dart_const_handle) const { return true; } /// @return true iff the edge containing dh is drawn. template - bool draw_edge(const LCC& alcc, - typename LCC::Dart_const_handle dh) const + bool draw_edge(const LCC&, + typename LCC::Dart_const_handle) const { return true; } /// @return true iff the vertex containing dh is drawn. template - bool draw_vertex(const LCC& alcc, - typename LCC::Dart_const_handle dh) const + bool draw_vertex(const LCC&, + typename LCC::Dart_const_handle) const { return true; } /// @return true iff the volume containing dh is drawn in wireframe. @@ -56,31 +56,31 @@ struct MyDrawingFunctorLCC { return !(alcc.template info<3>(dh).is_filled()); } /// @return true iff the face containing dh is drawn in wireframe. template - bool face_wireframe(const LCC& alcc, - typename LCC::Dart_const_handle dh) const + bool face_wireframe(const LCC&, + typename LCC::Dart_const_handle) const { return false; } /// @return true iff the volume containing dh is colored. template - bool colored_volume(const LCC& alcc, - typename LCC::Dart_const_handle dh) const + bool colored_volume(const LCC&, + typename LCC::Dart_const_handle) const { return true; } /// @return true iff the face containing dh is colored. /// if we have also colored_volume(alcc, dh), the volume color is /// ignored and only the face color is considered. template - bool colored_face(const LCC& alcc, - typename LCC::Dart_const_handle dh) const + bool colored_face(const LCC&, + typename LCC::Dart_const_handle) const { return false; } /// @return true iff the edge containing dh is colored. template - bool colored_edge(const LCC& alcc, - typename LCC::Dart_const_handle dh) const + bool colored_edge(const LCC&, + typename LCC::Dart_const_handle) const { return false; } /// @return true iff the vertex containing dh is colored. template - bool colored_vertex(const LCC& alcc, - typename LCC::Dart_const_handle dh) const + bool colored_vertex(const LCC&, + typename LCC::Dart_const_handle) const { return false; } /// @return the color of the volume containing dh @@ -107,8 +107,8 @@ struct MyDrawingFunctorLCC /// @return the color of the vertex containing dh /// used only if colored_vertex(alcc, dh) template - CGAL::Color vertex_color(const LCC& alcc, - typename LCC::Dart_const_handle dh) const + CGAL::Color vertex_color(const LCC&, + typename LCC::Dart_const_handle) const { return CGAL::Color(0, 0, 0); } }; diff --git a/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h b/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h index c1fb9eedbb5..37974bc33ab 100644 --- a/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h +++ b/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h @@ -35,39 +35,39 @@ struct DefaultDrawingFunctorLCC { /// @return true iff the volume containing dh is drawn. template - bool draw_volume(const LCC& alcc, - typename LCC::Dart_const_handle dh) const + bool draw_volume(const LCC&, + typename LCC::Dart_const_handle) const { return true; } /// @return true iff the face containing dh is drawn. template - bool draw_face(const LCC& alcc, - typename LCC::Dart_const_handle dh) const + bool draw_face(const LCC&, + typename LCC::Dart_const_handle) const { return true; } /// @return true iff the edge containing dh is drawn. template - bool draw_edge(const LCC& alcc, - typename LCC::Dart_const_handle dh) const + bool draw_edge(const LCC&, + typename LCC::Dart_const_handle) const { return true; } /// @return true iff the vertex containing dh is drawn. template - bool draw_vertex(const LCC& alcc, - typename LCC::Dart_const_handle dh) const + bool draw_vertex(const LCC&, + typename LCC::Dart_const_handle) const { return true; } /// @return true iff the volume containing dh is drawn in wireframe. template - bool volume_wireframe(const LCC& alcc, - typename LCC::Dart_const_handle dh) const + bool volume_wireframe(const LCC&, + typename LCC::Dart_const_handle) const { return false; } /// @return true iff the face containing dh is drawn in wireframe. template - bool face_wireframe(const LCC& alcc, - typename LCC::Dart_const_handle dh) const + bool face_wireframe(const LCC&, + typename LCC::Dart_const_handle) const { return false; } /// @return true iff the volume containing dh is colored. template - bool colored_volume(const LCC& alcc, + bool colored_volume(const LCC&, typename LCC::Dart_const_handle dh) const { return true; } /// @return true iff the face containing dh is colored. @@ -85,7 +85,7 @@ struct DefaultDrawingFunctorLCC /// @return true iff the vertex containing dh is colored. template bool colored_vertex(const LCC& alcc, - typename LCC::Dart_const_handle dh) const + typename LCC::Dart_const_handle) const { return false; } /// @return the color of the volume containing dh From 44addb1f83bf5757b4efe6fe74cd867afd689975 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 30 Nov 2018 09:56:33 +0100 Subject: [PATCH 104/193] two halfedges with the same target and source points are non-manifold --- .../Polygon_mesh_processing/stitch_borders.h | 6 ++++-- .../Polygon_mesh_processing/test_stitching.cpp | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h index 89a6af30e02..fc256aae135 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h @@ -110,13 +110,15 @@ collect_duplicated_stitchable_boundary_edges ++set_it->second.first; // increase the multiplicity if(set_it->second.first == 2) { + set_it->second.second = halfedge_pairs.size(); // set the id of the pair in the vector + halfedge_pairs.push_back( std::make_pair(set_it->first, he) ); if ( get(vpmap, source(he,pmesh))==get(vpmap, target(set_it->first,pmesh)) && get(vpmap, target(he,pmesh))==get(vpmap, source(set_it->first,pmesh)) ) { - set_it->second.second = halfedge_pairs.size(); // set the id of the pair in the vector - halfedge_pairs.push_back( std::make_pair(set_it->first, he) ); manifold_halfedge_pairs.push_back(true); } + else + manifold_halfedge_pairs.push_back(false); } else if ( set_it->second.first > 2 ) diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_stitching.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_stitching.cpp index 14fc54b703e..2d34bf8b60f 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_stitching.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_stitching.cpp @@ -59,6 +59,20 @@ void test_surface_mesh(const char* fname) std::cout << "OK\n"; } +void bug_test() +{ + typedef Epic K; + typedef K::Point_3 Point_3; + CGAL::Surface_mesh tm; + + CGAL::make_triangle(Point_3(0,0,0), Point_3(1,0,0), Point_3(0,1,0), tm); + CGAL::make_triangle(Point_3(0,0,0), Point_3(1,0,0), Point_3(0,1,0), tm); + CGAL::make_triangle(Point_3(0,0,0), Point_3(1,0,0), Point_3(0,1,0), tm); + CGAL::make_triangle(Point_3(0,0,0), Point_3(1,0,0), Point_3(0,1,0), tm); + + CGAL::Polygon_mesh_processing::stitch_borders(tm); +} + int main() { test_polyhedron("data_stitching/full_border.off"); @@ -88,6 +102,8 @@ int main() test_surface_mesh("data_stitching/non_manifold.off"); test_surface_mesh("data_stitching/non_manifold2.off"); + bug_test(); + return 0; } From 3069612c37f55b7d9e39173cc8f198161065d18b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 30 Nov 2018 10:01:01 +0100 Subject: [PATCH 105/193] two halfedges with the same target and source points are non-manifold similar as 44addb1 from 4.12-branch --- .../include/CGAL/Polygon_mesh_processing/stitch_borders.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h index 830cca479a0..17ee46b260b 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h @@ -109,13 +109,15 @@ void fill_pairs(const Halfedge& he, ++set_it->second.first; // increase the multiplicity if(set_it->second.first == 2) { + set_it->second.second = halfedge_pairs.size(); // set the id of the pair in the vector + halfedge_pairs.push_back( std::make_pair(set_it->first, he) ); if ( get(vpmap, source(he,pmesh))==get(vpmap, target(set_it->first,pmesh)) && get(vpmap, target(he,pmesh))==get(vpmap, source(set_it->first,pmesh)) ) { - set_it->second.second = halfedge_pairs.size(); // set the id of the pair in the vector - halfedge_pairs.push_back( std::make_pair(set_it->first, he) ); manifold_halfedge_pairs.push_back(true); } + else + manifold_halfedge_pairs.push_back(false); } else if ( set_it->second.first > 2 ) From 6d6c2f371736e5ee8f0732d65e16068f9cf253b3 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Fri, 30 Nov 2018 10:09:31 +0100 Subject: [PATCH 106/193] Fixed initializer with workaround for the absense of c++11 auto feature--added facets properly. --- .../Arr_polyhedral_sgm.h | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm.h b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm.h index b2be5687c10..603837c1ebf 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm.h @@ -242,6 +242,14 @@ private: /*! Set the marked-face index */ void set_marked_facet_index(size_type id) {m_marked_facet_index = id;} + /*! Add all facets. */ + template + void add_facets(Iterator begin, Iterator end, Builder& B) + { + for (Iterator it = begin; it != end; ++it) B.add_vertex_to_facet(*it); + B.end_facet(); + } + /*! builds the polyhedron */ void operator()(HDS& hds) { @@ -262,12 +270,11 @@ private: for (CoordIndexIter it = m_indices_begin; it != m_indices_end; ++it) { Polyhedron_facet_handle fh = B.begin_facet(); if (counter == m_marked_facet_index) fh->set_marked(true); - //! \todo EF: when upgrading to C++11 change the type of the following - // iterator to auto. Better yet, use for (auto blah : foo). - for (std::vector::const_iterator iit = it->begin(); - iit != it->end(); ++iit) - B.add_vertex_to_facet(*iit); - B.end_facet(); + //! \todo EF: when upgrading to C++11 enable the following code and + // remove add_facets(). + // for (const auto& facet : *it) B.add_vertex_to_facet(facet); + // B.end_facet(); + add_facets(it->begin(), it->end(), B); ++counter; } B.end_surface(); From 879c7c3605886df3fd549f8c5f72cd19b02013cf Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Fri, 30 Nov 2018 12:42:58 +0100 Subject: [PATCH 107/193] Suppress warning concerning boost in demo plugin --- Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp index 1e363259796..8d6d8648199 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp @@ -1,5 +1,8 @@ #ifdef _MSC_VER # pragma warning(disable:4244) // conversion with loss of data +# pragma warning(disable:4996) // boost_1_65_1\boost/iostreams/positioning.hpp(96): + // warning C4996: 'std::fpos<_Mbstatet>::seekpos': warning STL4019: + // The member std::fpos::seekpos() is non-Standard #endif #include "Volume_plane.h" From b6a777c918a08dec37a4ec55bd0c251f1196798d Mon Sep 17 00:00:00 2001 From: nivoliev <16121552+nivoliev@users.noreply.github.com> Date: Fri, 30 Nov 2018 16:41:30 +0100 Subject: [PATCH 108/193] generate a truly Delaunay triangulation --- Triangulation/examples/Triangulation/delaunay_triangulation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Triangulation/examples/Triangulation/delaunay_triangulation.cpp b/Triangulation/examples/Triangulation/delaunay_triangulation.cpp index 73fafb3d1c7..526b2d8fc7e 100644 --- a/Triangulation/examples/Triangulation/delaunay_triangulation.cpp +++ b/Triangulation/examples/Triangulation/delaunay_triangulation.cpp @@ -24,7 +24,7 @@ int main() { 100, 100, 100, 100, 100, 100, 100 } }; - typedef CGAL::Triangulation > > T; + typedef CGAL::Dalunay_triangulation > > T; T dt(7); std::vector points; From c801bb27d1538dab75ab2ff3a48b7a839e914587 Mon Sep 17 00:00:00 2001 From: nivoliev <16121552+nivoliev@users.noreply.github.com> Date: Fri, 30 Nov 2018 16:54:50 +0100 Subject: [PATCH 109/193] typo in Delaunay_triangulation class name --- Triangulation/examples/Triangulation/delaunay_triangulation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Triangulation/examples/Triangulation/delaunay_triangulation.cpp b/Triangulation/examples/Triangulation/delaunay_triangulation.cpp index 526b2d8fc7e..036c0de6d50 100644 --- a/Triangulation/examples/Triangulation/delaunay_triangulation.cpp +++ b/Triangulation/examples/Triangulation/delaunay_triangulation.cpp @@ -24,7 +24,7 @@ int main() { 100, 100, 100, 100, 100, 100, 100 } }; - typedef CGAL::Dalunay_triangulation > > T; + typedef CGAL::Delaunay_triangulation > > T; T dt(7); std::vector points; From b29dcaaf63ed2099b9e18856b9a33767e3dcea72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 3 Dec 2018 09:47:38 +0100 Subject: [PATCH 110/193] add missing documented function --- Nef_S2/include/CGAL/Nef_polyhedron_S2.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Nef_S2/include/CGAL/Nef_polyhedron_S2.h b/Nef_S2/include/CGAL/Nef_polyhedron_S2.h index 7a5dc5ffc9d..29e4ae47c89 100644 --- a/Nef_S2/include/CGAL/Nef_polyhedron_S2.h +++ b/Nef_S2/include/CGAL/Nef_polyhedron_S2.h @@ -350,6 +350,11 @@ public: f->mark() == true); } + bool is_sphere() const + { + return is_plane(); + } + void extract_complement() { CGAL_NEF_TRACEN("extract complement"); if ( this->is_shared() ) clone_rep(); From 881fdab58d7d5e678acb0417fa540e009517658d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 3 Dec 2018 09:57:43 +0100 Subject: [PATCH 111/193] fix setting of mark --- Nef_S2/include/CGAL/Nef_polyhedron_S2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Nef_S2/include/CGAL/Nef_polyhedron_S2.h b/Nef_S2/include/CGAL/Nef_polyhedron_S2.h index 29e4ae47c89..71eb311e6a1 100644 --- a/Nef_S2/include/CGAL/Nef_polyhedron_S2.h +++ b/Nef_S2/include/CGAL/Nef_polyhedron_S2.h @@ -395,7 +395,7 @@ public: CGAL_forall_svertices(v,D) v->mark() = true; CGAL_forall_sedges(e,D) e->mark() = true; CGAL_forall_sfaces(f,D) f->mark() = false; - if ( D.has_sloop() ) D.shalfloop()->mark() = D.shalfoop()->twin() = true; + if ( D.has_sloop() ) D.shalfloop()->mark() = D.shalfoop()->twin()->mark() = true; D.simplify(); } From 7c6450192e8f9fdb4837bc3105ead9a5d56eae9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 3 Dec 2018 10:16:58 +0100 Subject: [PATCH 112/193] add a function that convert to double and do the normalization --- .../include/CGAL/Nef_S2/Sphere_geometry_OGL.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Nef_S2/include/CGAL/Nef_S2/Sphere_geometry_OGL.h b/Nef_S2/include/CGAL/Nef_S2/Sphere_geometry_OGL.h index e7904529787..fa177c9c0bc 100644 --- a/Nef_S2/include/CGAL/Nef_S2/Sphere_geometry_OGL.h +++ b/Nef_S2/include/CGAL/Nef_S2/Sphere_geometry_OGL.h @@ -71,6 +71,23 @@ VVector convert(const CGAL::Vector_3& v) CGAL::to_double(v.y()), CGAL::to_double(v.z())); } +template +VVector normalize_and_convert(const CGAL::Vector_3& v) +{ + typename R::FT xa = CGAL::abs(v.x()); + typename R::FT ya = CGAL::abs(v.y()); + typename R::FT za = CGAL::abs(v.z()); + typename R::FT m = (std::max)((std::max)(xa,ya),za); + if (m==0) { + return VVector(0,0,0); + } else { + double xd = CGAL::to_double(v.x()/m); + double yd = CGAL::to_double(v.y()/m); + double zd = CGAL::to_double(v.z()/m); + VVector u(xd,yd,zd); + return u / CGAL_NTS sqrt(u*u) ; // normalize + } +} const double refinement_angle = 0.1; const double shrink_fac = 0.995; From 4d3b5ce0c739dc9ccf76019a47031550bc045a7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 3 Dec 2018 10:32:59 +0100 Subject: [PATCH 113/193] use convert_and_normalize() --- Nef_S2/include/CGAL/Nef_S2/Sphere_geometry_OGL.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Nef_S2/include/CGAL/Nef_S2/Sphere_geometry_OGL.h b/Nef_S2/include/CGAL/Nef_S2/Sphere_geometry_OGL.h index fa177c9c0bc..f0527bb932b 100644 --- a/Nef_S2/include/CGAL/Nef_S2/Sphere_geometry_OGL.h +++ b/Nef_S2/include/CGAL/Nef_S2/Sphere_geometry_OGL.h @@ -97,8 +97,7 @@ class Approximator { public: static VPoint approximate(const CGAL::Sphere_point& p) { - VVector v = convert(p-CGAL::ORIGIN); - v = v / CGAL_NTS sqrt(v*v) ; // normalize + VVector v = normalize_and_convert(p-CGAL::ORIGIN); return CGAL::ORIGIN+v; } From 12ae925f317cf92a471ad5d9b37ebc31addff5c7 Mon Sep 17 00:00:00 2001 From: Guillaume Damiand Date: Mon, 3 Dec 2018 20:11:19 +0100 Subject: [PATCH 114/193] Some more unused variables. --- .../demo/Linear_cell_complex/Viewer.h | 4 ++-- .../include/CGAL/draw_linear_cell_complex.h | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h b/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h index 611272d0e9d..d42dbbe6713 100644 --- a/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h +++ b/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h @@ -101,8 +101,8 @@ struct MyDrawingFunctorLCC /// @return the color of the edge containing dh /// used only if colored_edge(alcc, dh) template - CGAL::Color edge_color(const LCC& alcc, - typename LCC::Dart_const_handle dh) const + CGAL::Color edge_color(const LCC&, + typename LCC::Dart_const_handle) const { return CGAL::Color(0, 0, 0); } /// @return the color of the vertex containing dh /// used only if colored_vertex(alcc, dh) diff --git a/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h b/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h index 37974bc33ab..1cdc247d855 100644 --- a/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h +++ b/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h @@ -68,23 +68,23 @@ struct DefaultDrawingFunctorLCC /// @return true iff the volume containing dh is colored. template bool colored_volume(const LCC&, - typename LCC::Dart_const_handle dh) const + typename LCC::Dart_const_handle) const { return true; } /// @return true iff the face containing dh is colored. /// if we have also colored_volume(alcc, dh), the volume color is /// ignored and only the face color is considered. template - bool colored_face(const LCC& alcc, - typename LCC::Dart_const_handle dh) const + bool colored_face(const LCC&, + typename LCC::Dart_const_handle) const { return false; } /// @return true iff the edge containing dh is colored. template - bool colored_edge(const LCC& alcc, - typename LCC::Dart_const_handle dh) const + bool colored_edge(const LCC&, + typename LCC::Dart_const_handle) const { return false; } /// @return true iff the vertex containing dh is colored. template - bool colored_vertex(const LCC& alcc, + bool colored_vertex(const LCC&, typename LCC::Dart_const_handle) const { return false; } From d949683ff8d00979d38754d3a15bb61ea2960003 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Tue, 4 Dec 2018 09:42:18 +0100 Subject: [PATCH 115/193] Move the include of QJsonArray hoping it won't get suppressed fron integration this time --- Polyhedron/demo/Polyhedron/MainWindow.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Polyhedron/demo/Polyhedron/MainWindow.cpp b/Polyhedron/demo/Polyhedron/MainWindow.cpp index 456be43e226..e4664935777 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.cpp +++ b/Polyhedron/demo/Polyhedron/MainWindow.cpp @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -39,7 +40,7 @@ #include #include #include -#include + #ifdef QT_SCRIPT_LIB # include # ifdef QT_SCRIPTTOOLS_LIB From 25471b02b35f9f4427613d1d7d5f3f306cc3843d Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 4 Dec 2018 10:38:16 +0100 Subject: [PATCH 116/193] Try to avoid warning in Residue.cpp (although it is not a self-assignment but a -= --- Modular_arithmetic/test/Modular_arithmetic/Residue.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modular_arithmetic/test/Modular_arithmetic/Residue.cpp b/Modular_arithmetic/test/Modular_arithmetic/Residue.cpp index 2329d54e81e..1fdadfd0888 100644 --- a/Modular_arithmetic/test/Modular_arithmetic/Residue.cpp +++ b/Modular_arithmetic/test/Modular_arithmetic/Residue.cpp @@ -102,7 +102,7 @@ int main() assert(mod_x == CGAL::modular_image(int_x)); int_x -= int_x; int_x = CGAL::mod(int_x, prime); - mod_x -= mod_x; + mod_x -= (CGAL::Residue&)mod_x; } { CGAL::Residue::set_current_prime(67111043); From 20899df7a7066485f258397a7eed80ea7ceb119c Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Tue, 4 Dec 2018 11:26:32 +0100 Subject: [PATCH 117/193] Make the hexahedron creation clearer and fix examples and tests --- BGL/examples/BGL_surface_mesh/gwdwg.cpp | 4 ++-- BGL/include/CGAL/boost/graph/helpers.h | 10 +++++----- BGL/test/BGL/test_helpers.cpp | 2 +- Generator/test/Generator/generic_random_test.cpp | 6 ++++-- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/BGL/examples/BGL_surface_mesh/gwdwg.cpp b/BGL/examples/BGL_surface_mesh/gwdwg.cpp index b857d5a774d..07ed87cc639 100644 --- a/BGL/examples/BGL_surface_mesh/gwdwg.cpp +++ b/BGL/examples/BGL_surface_mesh/gwdwg.cpp @@ -25,10 +25,10 @@ int main() Point_3(1,-1,-1), Point_3(1,1,-1), Point_3(-1,1,-1), + Point_3(-1,1,1), Point_3(-1,-1,1), Point_3(1,-1,1), Point_3(1,1,1), - Point_3(-1,1,1), sm ); @@ -45,10 +45,10 @@ int main() Point_3(0.5,-0.5,-0.5), Point_3(0.5,0.5,-0.5), Point_3(-0.5,0.5,-0.5), + Point_3(-0.5,0.5,0.5), Point_3(-0.5,-0.5,0.5), Point_3(0.5,-0.5,0.5), Point_3(0.5,0.5,0.5), - Point_3(-0.5,0.5,0.5), poly ); pvertex_descriptor pvd = * vertices(pmesh).first; diff --git a/BGL/include/CGAL/boost/graph/helpers.h b/BGL/include/CGAL/boost/graph/helpers.h index 7ed5fbf1447..7f2b5d3d0eb 100644 --- a/BGL/include/CGAL/boost/graph/helpers.h +++ b/BGL/include/CGAL/boost/graph/helpers.h @@ -868,16 +868,16 @@ make_hexahedron(const P& p0, const P& p1, const P& p2, const P& p3, ppmap[v6] = p6; ppmap[v7] = p7; - halfedge_descriptor ht = internal::make_quad(v7, v4, v5, v6, g); - halfedge_descriptor hb = prev(internal::make_quad(v1, v0, v3, v2, g),g); + halfedge_descriptor ht = internal::make_quad(v4, v5, v6, v7, g); + halfedge_descriptor hb = prev(internal::make_quad(v0, v3, v2, v1, g),g); for(int i=0; i <4; i++){ halfedge_descriptor h = halfedge(add_edge(g),g); set_target(h,target(hb,g),g); set_next(h,opposite(hb,g),g); - set_next(opposite(next(ht,g),g),h,g); + set_next(opposite(prev(ht,g),g),h,g); h = opposite(h,g); - set_target(h,target(ht,g),g); - set_next(h,opposite(ht,g),g); + set_target(h,source(prev(ht,g),g),g); + set_next(h,opposite(next(next(ht,g),g),g),g); set_next(opposite(next(hb,g),g),h,g); hb = next(hb,g); ht = prev(ht,g); diff --git a/BGL/test/BGL/test_helpers.cpp b/BGL/test/BGL/test_helpers.cpp index e4d0e145829..3ba16eb4d6e 100644 --- a/BGL/test/BGL/test_helpers.cpp +++ b/BGL/test/BGL/test_helpers.cpp @@ -132,7 +132,7 @@ int main() assert(CGAL::is_triangle_mesh(m)); assert(CGAL::is_valid_polygon_mesh(m)); m.clear(); - hd = CGAL::make_hexahedron(a,b,c,d,aa,bb,cc,dd,m); + hd = CGAL::make_hexahedron(a,b,c,d,dd,aa,bb,cc,m); assert(CGAL::is_hexahedron(hd,m)); assert(CGAL::is_quad_mesh(m)); assert(CGAL::is_valid_polygon_mesh(m)); diff --git a/Generator/test/Generator/generic_random_test.cpp b/Generator/test/Generator/generic_random_test.cpp index 7ea066f4233..3090ddbfc80 100644 --- a/Generator/test/Generator/generic_random_test.cpp +++ b/Generator/test/Generator/generic_random_test.cpp @@ -288,8 +288,10 @@ int main() Polyhedron polyhedron; // A cube - make_hexahedron(Point_3(-0.5,-0.5,-0.5), Point_3(0.5,-0.5,-0.5), Point_3(0.5,0.5,-0.5), Point_3(-0.5,0.5,-0.5), - Point_3(-0.5,0.5,0.5), Point_3(-0.5,-0.5,0.5), Point_3(0.5,-0.5,0.5), Point_3(0.5,0.5,0.5), + make_hexahedron( + Point_3(-0.5,-0.5,-0.5), Point_3(0.5,-0.5,-0.5), Point_3(0.5,0.5,-0.5), + Point_3(-0.5,0.5,-0.5), Point_3(-0.5,0.5,0.5), Point_3(-0.5,-0.5,0.5), + Point_3(0.5,-0.5,0.5), Point_3(0.5,0.5,0.5), polyhedron); boost::graph_traits::halfedge_descriptor facets[6]; From b04523f8c3c9d9726a14de6de623d96d12e58cda Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Tue, 4 Dec 2018 12:59:43 +0100 Subject: [PATCH 118/193] add images to doc --- BGL/doc/BGL/fig/hexahedron.png | Bin 0 -> 7755 bytes BGL/doc/BGL/fig/tetrahedron.png | Bin 0 -> 5828 bytes BGL/include/CGAL/boost/graph/helpers.h | 6 +++++- 3 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 BGL/doc/BGL/fig/hexahedron.png create mode 100644 BGL/doc/BGL/fig/tetrahedron.png diff --git a/BGL/doc/BGL/fig/hexahedron.png b/BGL/doc/BGL/fig/hexahedron.png new file mode 100644 index 0000000000000000000000000000000000000000..34a4fb17085ec3010f696ba04701b0eb755ba519 GIT binary patch literal 7755 zcmb_>byQSQ+wZ^-(x@OUD2);dL#K3uAl)fFbeBPQmvl*r)X+$yl%&!*NO#w_x$nEy zUF%!-&pUNy_Uzf`nZ2L={NjYFC`sdClVd|55Ik8KiMQa`cmI5V0ba|sDl)+V!$e+M z0&;hM&u%G-2Q64|8Et0>1n2Sn69tl%K?)i%U1Sv{F_+K@usN74ULgHI6Pb&omW#N9 zot?S83q;(>+}Oq3jKN$qLKAFeEuhxv~# zLb9pJWjfZ1^D*8$h>nGvh@sc&JU|RlAMJkQ99Vr#W+XMa=ZXBAdb4{oG^FF*GIdfx zLL{mB|9bF6i%Tx1j*h;?!pASn$qB47?JX(04k;;N;d9+2f(UsX{~>++*ttn=?YWwo z8tvb|e@AO=G*Q^jaY;Eu4-XIXo0|pY3tTsFj&gIK%gV_)l~Ra~j*jLd5L)W$t&A+s zp5^?0@YH+z)!zo^B1!?bZF!pIf4}p-+s$yNiukumNK50;I3ouhmIt!qp`)Xt%4lh& z2%ax~{O-6Sb+H<+j22Q{Qj&J{1CzRMOj(4rzrP<+8DgZpHF%bNT#9|3G|fTknc~xvtpu92B@Z-QC`x_60&Q)v4yIP{rhms@NW7` z_PpCeql}B&s$XY30eAMdQFWFaj>{6M+;(X!Kjgs#u(D$aD3fVNyD=l=^eb?nt>~>7 z{0OAopnK}ANhwytXaan>3+wWDV})(QVv*|`IVtw6*^u%NK79X?1cQ30t0)xSktvoX z?CY`Da`vamy)uK(S!&^&`>;slCiM2^>gZxUt7#M6sEAJob}gJdQ;$j&_(Lihv5Bz= z@-cowRELI__s_{Vjcz{|);Y;O1DphoQCyp-QyMtmu07V}HU5*1i7AA=_56eD)}-U^ zET8YnOdl8+3%k+C%sv124}6*@h$rXR9$jvV+#Eez_4qY!*TagG7W1NoH+3TKMoHU0 z+E)~bFkJ||8b-H9$PpGy9T<4td-T*iP+uu zN~|0UV`&Y8n*~g zWMpI-M{+_Hx+X`+!6d^d!P7sc!m1t0{+DW@5fSR>HPDq_hO=4cXfq3opCdWqzPaf< z3qER)SK$>z%Hxxhay~xIUA?_Ha94Z#3Wy2XKiID%RyBv;ZYrv(&kha_;?mMK`9HFO z9cGuTP+D3_&&#VN6+xQQXchIh+Oo+vbkKynvIU;}Qu}#8%4f|mlAwpw)a=B>#3Z~? zX_D`q&gR^`>1PfPov?6l;=zuXh-56Q9SDEIddNigOJ=wEXh?(Ii{IxQzH(^^i>f1t zTU}k1adD{;=!DzQ`CgqSQVF=#XbeRKQ~PN_HYQ4wH+!g(ypIx?)pY1-Y+Q59nJU|E zFVTMqZf$LeoF8S~*$(E&*xHtXzgB`e9q?OP*V+~{pti^7e1GY?^#qH%6T#ef^YB^s z1>Z;HYbctx!2@zN;p$iVXmfDZk`!^y8qd-@{CIP<@KQ_+_ZG;VlBLI01Vl-daI zZ(UvJ7Aww^mny@bky2v0d3p4VjMB7Jm)Z;LjEw7XT+VEt1NDg9&%S?u{kO*Iag*E5 z@@juPq^r9-HYP??N($p62Hs&~K07=6@Xz64!>rg?F-ON&p`oEsng*V0xmf=|?j%cw zKS6gHG~39_&COM%hGO9EhYFW%V26l&&=-$daA|qo4 zc;R%lQ!fuH8ZIU8w<=m<5|Z`7*^ix@+xl`@X<{ES`U%9S^&4GcW#bw82U0oBLFsyJ zHJaap66$wz=_x=$ln64)iftwLF^6K=T$8&zK%Y;aKle9#9<74>%zVmkHrME?F^>Hr zN!?7|7qe8+hN7{_jDCFa$4BUpsN3GWT|;Xh=$%IOyR^JK(ent2MMEncWt%Ac^VhFx z1Al-~`)Wp=ZI~j@%#l%m@&Zd#?_2c8*smCzUV?_(uf0tPY z>wL&$u+b?^D~k`upSx@lzMd3~i;L@$C~+pXP5IReo0MZ3I_aKd97uYC9->{8Qxmwl zYUYj;ksEN6ai(@j+UL^1KuQ|T*<1p7ciQz#Jm|c3EK7u^YIdi`g$j;q*<8FAs0?h_+IduM3*Rkivmtgtg zB*rYC(Y-g-=iXgz^3;imi4_=!0*jRJ@N&pwqw=r)3q54(TN=uq>4KH-p;kv2^bXAj z7$7;}Q}$Fg*3rEIjPRgs7f9y-te*69IjY8TM8jo?P&|b_0tH@yaYRB7a_Pc#qRMKF z0TP5ym$nI<O`_kDi}D z?IR{ZBY7XG+GlEvMrhk>>}ec5^O9>0BRmdbt?g-KWRzRahs@XJVTQPs7?_yO`-@@~ zZMR+z4~E^%CQ9CY`t%8Yy8V~a9(VOc#*eAD5vo4uf&>Fqjbz9aqswRFdf!D%H}vrG z6Eg(dqx^5S3@eIg11KCZ_NTFrIeeq)15wAwX2Uq`t+9tv>V5gBX~?r*EwtV2ILyL3 z@%)zdCjkh2Eh#zFU2kH{^my}xP4E52VcENL=$8S@SiUpiq4pU(hMP~!eYpYa5h!?E zH;D{;y@`~Th(X1&gao3~y@frmX>3J9^N4Ih1XPBnV8p#g1)0jd$34anRcrZHU*8T^ zd%gDA#piOP$Zsb#EhYxio+BRITK(m=if@Rc*1gyY)!*2f1|JkxyIV6 z)HU`z@!N`akdn4&Ow7zxJe7X77&5oNxV(p_?X5WSH0R*E`L*NYF9iaIw>^^+5=IK- zNfNjpJ$z`qAlq-8rd$NyEBiB(Pu1H{)Jam9btvzCarw7(5=GTXN>cLg*@<(?(3$4o z>>=&q-CyfiRy_ngm1$4J!Ip2&joZ`w>}*j$e@r#|SU8>5qS)Hm1Bl!2U|)`wD%ckr zUANE(A4^X-eCrN9(JiZ8;KuCKQj@Rmaz$*%nHx9Uou><hsZ?7m7a@j?cPX=^)v6btLi}BGOf22_M7wYVWBg`OtUIp7mhDtpxFC!f9GE3 z`uUAlOhyJJ!0LpR-e~WenEU0v;pg(DDaWkJm8fI1PhLAGeV~hu))m&Vy={9BqdPP8 z^%r90lB&0qt(+qoL^@I?9S(I^FU%~nKdIrRz&12S>dMMq^1&BH=>1GOE!FxMmk`pa&M}J4viAkjJyRt}1O5zVG>s^@7WJ2bqD(dPqoSdAB zi;LTr;4yJ=Z{*~#U%h$-8K0O?)zSHRwbw>K$aINl7ybVIyNr?&esSnP@$9S~8O&Ne zKIN-^lUrg<4cFCms1w#nY)Z->32H!i<1#a!j$EFLNoWiV4!XK_#eqyuM`RUYgp#V`qRm}d$r&u5+ZO_nYnA(MOkv>npidZi zAN|UVL)*J&;6tXzPVLmL3iJJMW#r_hv)`&ffhNSu-x)~fQD(%R5G7K!okghr?*Tdo z{UX44CI_c84yAsY+N+KV#JdW zMp!`R@>Bv(LX`+cxc9#sBvnBmuo!t+3yVT*F+7Qbu08)d?=P75&5|Jh?txMr8%#%J zV`C!^x5NBPW#Nnb2x<{OU%&#@)z$xf%Ar<$_l{mV`f0)U?{W9NP*16~zZnH4Bqm;5 z{aS-CF)_vT^~s>nadD}GI?IwL9i0R!g&Z9I4HB1CKOG;t{QUV7@?4UR2vO47 zn%U9urlN6^<@M{=4+sd70n@+?vcGP@01W1#s6x!kR#v;I>eMS}p&S7bbmMnkutElJmHu#p%@o^RrR?=@ zQH2FDjS9Vu_;sBIrvjJF@vp3kT(FoY*prO^_pLsH}oQ0#KTl$EnN9 z%lA{1i!o}S>vQuanu15^`Sa)FqSLtnwKh|r!(@g2i>0L{YnmN107Fi{SnEB!S~-%H zzsY-jV`UxZZ*W);M)46wyZ*=(1Gb%wQfKW733kTnHR4j%sDag&blRf<-b@T#ZYX#bVh7oa66P`x_e@cDHSn2+x@Md9QHQ zJSmh6S6Olg>*V^t-aws2<3(oO4I<3zr+*;%sHJviS&B+Z7Gs5qO!N221<}^lerO-p z3)K%)Y|m?#Zoh-v&gDmA>|z>V-V$)2GJUfj>gzKCx&|zOsH7x1V0kXdF5!G^C{Li1 zlFZ0+l#$0Nm|EUN?m+!It;(>lupBF%#R2zV1h^If4zqL%)-cq7f_Ahc-vmB;^h?z0 z0Cc1t<`y!6sEB-KGwG2NJxd4EkHqvr$0ELYJD9QElmdDX#64|~paFSxxm8&WUwXsm zzB_xt{qX_NMK+X6UH}=_s)vP-W_t*i>SpXs0aL;c02zC+LVYI#Zq;WsNS;jJQ|*${ z(tAfnuWVue^v+|qVLc==vRgb;14YBm`qGN+615mJH?S@BNe8FKo4xrK6kf06e`X*7 zc%6|EO=GlyobCTt01q14`d6Zs=pD5n(`*o16-{Z^L7r7Zy32z+M*whPS0*Q*;2m7G z2SNq*{#31)si>&Pvpa;hscLJ7TJ`AF+{eJ{xQqr2k)wn;!bPrqwh<@-|D3R|`s7(~ zI?};%QEZX5&7bV1JpL&a6{}jIf}?MyYN6>F^EWCcRKE?U$WFIwWoKWJD|GPP!xd!q z7Z>(Epkiz)TPEkKBRLP}O7P9l6L@R@>PFweN-s)>(6I=TbWRYrth&IG!gmMe z8}F4JF7y%TCdfVAy64~d1qF`R=Z^SK1(^Wb(kG~=>g3zj#rMH7gLGTu;{*UA_tP@V zS4v7MsCB~tFy>{*pKr#UQ})(`Q@251))jNsAoFOzZ27~^#Ky+J$EPh_rDL)?+khXC z_(F49+0cBtv}kU2^!I}%B3?{es8fLKX*k%gvTc4hq+IV~DvTX4$BLBKQ!O(ch4k^t zxD=T*{m^XDZgJJ8h4*wxwrA>ZT%g%L6s;8^a%F!H2<9|dAff16V?^AwkvGX z^}yBLAqp6Z0B93ZTBT?$a^mS28G-1hsBW2_1(f_yRus{Al^&R4kfWiD0 zx*C44xQU60%MW$VPrbdp^48WR9@qgsghi#OupYy|0HH!o#LXDAcmbeO7QFnIhk7rSb&qCL3kjY9M=>ro_Sp-K zGQb%g-Gc@=XjhqhHZwEhk{SV%s3b}jL`@n39jaWlEij;jJZ4ZJ6!kjWWtC5QSv6nu zK&{%PxUw=C)cjOIPp3S;fxT>uWt6er_hUGE|FKygQBlp&Wkj5i@xrrLkw`fj%=jif zjJM#g1iaM#-c|a+9AM0A-^*i$%LiCkvDw+#4C@NgBAdCc2JAtBX6ELx85urR{#z{V zMY^L&Nl5_dIPmcBBJte=m9(`}ZU1}=ERat&h`TGw&3ywv2eFoPV#dx{V9$nTxs7ckhn<&_mEKa08OaK5Ix z`n?s>41}W3?ZtYO==S4lh$Dzr0_5}LaLTKXZFe_&QC(dU!GM=o{QYhYX7OI>+e}r| z5@px+nRhAt^mUm1O9kv3JP*yn@LK|xe0vij9G$v~lc9x34hKUvY!s%W#Wd};>S|OPu!1@eUs6)i z&>KY+54N=Dawub&m47O~Yl(m*SG}E%%{C=9{=&`36$(VEXSB*xy5VR@z`Q$*_`BbY z*I$HVp5WDXHCQQ^jmdJ|ys8>{(t1an14C*?{|>J}MXT|&Y0$ z%oB1iMXCX;_7y6o>x}mgeG#CrxlUsEGk}%_Tga}FaC573*_obrF?G;(y~aL>;a>qf z@|j8cI8FW}|5P5;r-nWU-AGhnX|3I7)8lsZe0+RPbFNde-uzdhO)ld=kC zfKkx?g`#m(j$Gc?a6dllS^_YtlCb@_PoL0!*)1>v`>&G);!5(p?yZUn4Y1}kG$Z zo699!KN?=~>f;(ldc&fuo_8CTwqd_0S|9{X7P0z>SgPKz#w&1Afv zIOpwX0c6J)7c)&r>vB{n&LtkpBD*V53_8iQ-#}iNz#Wcmbd6druCh*Xfg&wd3O0Zb z!lwF03*@^M%Q?FHE?kYC?PtD9SV*&xT8@xl;-zim!eTTD3Zc)g*KQrxT3NJ@L#7?M zPhT;&KRi0KenpfPZ;{xJwXWS}+?GwpqvLrjy z+f@6nomkjw0*S9>Wn~rbQOa%4**i7p_>Ipm)Hy52zTIB4d%8{Q!teOEv^8CMSKPZ~ zHht{baT-&_XX@dc#YgOpJ*SuLdPiker@K95$%p~^=rQ0q+D6EE(2pX!_d#vS%ylkG zvu-2|sZZ1qLHD!0tvhx4_dW_w(JMY@NZ7=}f&rk72CWr(YHBJ3Tutzgm4C}SL|S{- z)vzwBY)ZGch}(ey$NqCK2Zt8esCfCcTwGl6)xL*QV;Xh`Ew2(B0^3mU z2GtKZ6))3~e>y2~c2c!2D)gI@^7H9jS*_65*4E+@5+wBX=QM$;a!ZZm?!9Rj%V;uf z33rB)3+M-kan0ct$AaDddt@a0gFUN-Yl=;;U62*q-1<`81l!A$ z;RWAQIivOfl*18mf>8N8(-%WGiu^EV8^lK6T_;y~`hEuv`}@E(JV3KwTMUpkEedz@ zVUAKZDWsoq^5oGk;?7Q5M;omPdU|?R%uoshi2S+q$wZKAp{+K_E6B+mZfsu@cc#H? zd|G9Y;35?fO}6-^UXP#56JfWTi~UXlbizEFg7U7O9=U~9U*G3~oa$ESrfSVbLm7M; ztdBOsuQ3RoZdXG_HR&u)Qi%sEge3HQPbQM&KSt?!M$^82{kA8HYGyb2vh`~BakkwP`v-&AIp{3{@4L^Sl7rE0dS2MA}gsRQSrv;!~XzbOBgx; literal 0 HcmV?d00001 diff --git a/BGL/doc/BGL/fig/tetrahedron.png b/BGL/doc/BGL/fig/tetrahedron.png new file mode 100644 index 0000000000000000000000000000000000000000..b0cb6a42259b4ebe4a5a13fbe6b155ec010ec6ca GIT binary patch literal 5828 zcmV;#7CY&QP)e zSad^gZEa<4bO1wgWnpw>WFU8GbZ8()Nlj2!fese{02VAsL_t(|+U=crm=xuiz<+aa zGu+5EFkAwHG8}^lULb;sqM`}Wh#Jkt>?X$DT7l#2=>F<^>;2yI%OM;z2D$*( z0)v4bAfR_+E)vJn{8N)DDX>Qy3gkcqUB57Y-5=yRUOXY+xE z`pETo|Hr@!HpE7lxfA%g$LoItR;kgx7MKbQbiIE)FdK3G?gjpYxBGepiFv~eBTzgC z^zeASOdn1F(D}EcN%rd!YASF@-@DJ_JWl{6Hq1sMympB`&jC8<_uZ_o zU9HbI0G*Kd$G_-n9X!teJ`zYYj8L*tZ45V$sz&&h>$M~L+PN{u761qJy>mRyKOC51 z!)%0+_J}(+R-^6J3I8PUxJx+Rk2!7#l6vwLaBH0ZV<51|hS~@t?K}jet;^nU9-jdZ z0!>}V-3Of3<=OdF{2v2>g*MbiSXo8Iw2U3L%Qo5Xas1i91FAjNB02drL zq~Pi^yX;07DMW&S>EPSI%QnPD*hxovdNb81y=-`mD6kl~%E$A)O7ewQh7mZ5fE`Hc zNvb@Ai;&5pqKEJ)0rfxc>

rxGQrO`LSikK+E5x%F@9-wKSi;Wffc9i7N|J_`tH(`?6Fz=j85Nx^7?)Qg->li@!MiM(HF zQ^E+VfP9q3^KV58s-6Ny+O#mjCLo*BZ1|0!+aIevUQf4xfMgBt zRs-I!B~~CA1$77)j9--=}cXAMEm<~@gCb!6WJoCmB!QeT$Z6fz^dHt7w#6R_{} zIa2=nEO5C^A)~g)K{oL09iSzao7SpDF0)Hz8l<+qTMN?HuQydnkp|k20E28QnSj*B zcdLhNs}@xDA(8g!ly53(n30|l8t5|XRKUk@i#iil0lW0sFb$G+h9kL9r$aD~$B=U1 zsaVmK2}p(*MP^dm{o-R}6Va!zdJ-c8e1gOr;!)dPtax-nsvn2iB{b4SePlZ|LMR}P zkn91juuEyAgJD!3r4F)yfHc+K2=ukfX*P)8TnM}o^07UH>~Asy%K|oh=G7V)xcMSBo%rB8zMU1pCbLXUd1BrCLl>NMAz$4Wh2lBn27ATXqbQ`LQ{>X<{#yQ)V;gSeMln}}b7Zx|e)e4FQN6A%#Z)>fnz#xN>SL}HudL{UIM zIymmavVhG7@i11c5u3DH9Ra+Eb(J>(anS`>VwVJv^4$?gjk^hn2?!uPrWV^J`767T z9j>0B>e6E)O9Z678tFzkdw{XPo7nEVS0UHP;w9(UG|5g4(i+G^c62f- za|r3+I1?+n%1Qwl4XmX4PA1vRTBKJ0c_g9J$RYu`3iDvqgwGJK)?{p_tE^i>bWQLx z*<^#na<&@q!)@wBpVlPTpgNlc#2L5ENCl=5;U(5U;9a{E2~!H(0L;QR@rks63;<@^ zrAUg^YOqhn%6B6xAjL=^%t(#{ND%QQtTHij)K~3M$83<4DMI#4w65|I(jfJKFMu<4 zDN<%TvRC5MSj0Ut0@Ba~#8-9!Hv(^AF5pNA$RH%O+al=xu@=dUeg^1a!x3%)8BVmD z#MP$Zel74iR!S0@4H7Ny?~wRw9x1=P(y=VEBl{n#6fwUMznZ zfb36lfel6NayF8Kg$YRDC`2Oe#WobRx5OF^EV7{wB)gE{?G$XMt6Jkt;A^Hq0?oNd zF!4egip+ByXk`Ktc-kSZ;LbJ_nWISWOqhU#f)XSp$TUfYxDxnZ6Od5RR&Q!q*}*Z> zMtW~#9}puve2O#|pNV<5(n=2S6#fOHOoL>W9*7HgkZF+g{a?+nZPvodMx-g-^GGh8 z2}l|=NIjD4y``Kc+XHr0#A^oquw0Rb4mLcA)7svt^a3%%hawG@qw9T>5 zvk%#NVGa@B4la`das~e6U>U(+DbiJbCbo~eFYLl!U%Gj*f8DpO_9CxjO<|rFcyiE3@`yP0Wm7G4%xhCN|+7z zObAFH9V{dJ*aD0P77|hya3%y~2$BhEWG8=C;dn8Onj{kfG6=~6HL{mIz}Jxuj{R&n zDpCqGO2c{0ixob)AueERDWsfFYTK-tfJBczhzq!@EwLnncaF^o!^KCyH<5_@pllzE z_kdBRK@1N%A}xj5XX^muA@%3^CLl%}E>a;W$;Kbw6)Dfe1jML<&T6;^(k4l#4bp}5 zLz;NK@AQ|rI6p*&S zF}vLRyYEuVErrr0AfrjI zi`R%g3xI2ZSx9T4ND0U_*gk|t>a5qB?Mz*EMTXBauzoZfBzqWwG#(rfg&$L>0)h#M z;Uis;w3IesUt$da-nQ#$_{>(|4kWhLFYE#`D+AyC4DglBo2=qpBs=^yGPL!A-|Ec0L9)PU7>URE6GR zb13o**QL_`0h9D5oy?8>G2qEGt*rjaO?uZ)g#si%bZ3g^sf#oRxWVR7H8F@Ch2H%D6;$lc+SW3y$Jj)U0-%RspZYwjTF!Lsp2jN zKCyWeNs3f^)ba70Il8>}efx%d^%Nu|c4tLCPg z8#8Z5k_J!cNKz}Yy+w_zsw6wd^<#3XI4<`6W=MTX1DjKk(jKM6_n1yaT)gY_c_MJG z$8qNY(~$5$U6=j3B}s!nF279Cc6c$)4{&%CNr7IiKln-Dl9*%0t03%C)jQDj-gB7i zH%dGV{70Pk3Xzyc8F1M3_g2c=;5G&xr#wFLc+5HeOO1BlSU_r>@|FUv;=EVa^&^kD z{yvJ-zUKh{2%H8^s4Y|myx}^>kC4ES5e+t1VJG}Rum1%7cOGy`Upq&Iq!dY2I;yY# zP0TrpflYpW*@mi;lBGa3L;X1K->5(0)tCV)1MX45`U(juI&qUS;JEAfYgEe_;im;s zk{gfr_4!~uD=iJ9jC}_k!bT3k`+(T`RcXa*u1>&A_1`u6pIee*V^8wP= z4%NsEO?1`bMX?G=F6BY%BS?JhXE8U;Le)mE#5q^4UlXM}scmzxQ-5$im6IHMxbFD( zxwOYTBuI2v1#GEH139X7d(1L!4)A@OU!kXiY6CC&B5{#L!0l>l99NBUCg#{{^*LVj zJl`(?DIv8G{dQ!t&juc_M57WX2&c8ciP+v6^-=< z>3%fV>s*9n?z*#Zb5w)mBHqmEmiT9s+W{{_qt@ zL$O$#$pLrInTyOiAKO+;6i;2*7>kT4e7;5z;~pmLgWLmikhHMHXKIu%{O>s)q-!(1|4 z&umnnK$qedAqk}aj0A?K>2hcpQY!JFPR`CXxchJLFwk!X?jpWN)NMEaEpSi8i{XUhWt0Ps2a%`Svg!;gxNNnn5z3cBm+^g+N+wzZ~Efx)k=zckyK+pSOn=O(vJm%6{z z=b*dBx9N&wiZ1(}N@4yzfOybK{rYlaQusn{CaD3}D#lB342fwZx;~zZ__nh-rKFJ> z!uKPMEcUByut>GRcafBgwmPvI;!m@U+M>G(%e#nsIFTjfTy-QA`TeEtRkfQeP1PWp z7U%t9#Fe*LwMh|`Qw;KufKgv0{duo05u#235>f60T#UFZf3G(N=g$AO8qYV7J!Qv} z)GnF`T%eAG0wnHHSN|^5_x^wc8XvA|{h7+z^%=cGZBNqPcmt{Pc({t=@^k`>Lp)Ih zssfLyk=7Dv5wuA?8nY3XV$_yK#d^mdpoVgNHHvrX?_I0Q-BNw*Cwu9P#5cz24a6NI zYobf;^|~y3r>gmzih$%HRa}^(B$ZRIh@GFNrdKV;g=z<(}_uV5B^>aqFbn#ZJSLO ztD73g-SzM0lox@WL~@8WtAk<_nRA;ONpLQbDtwgkl=LzrVeAxA%Gy7H_2DeC$L-n_ zaW(%!RrztmExrT^qTQx~(nyy~bugE7;M9A(*RN1xx1CPvnMlImr@DqaOAX^Oh->zs z9zTonVkU=Hz#sLPZ%52FXsu(>hVs;j_Bw8LRTC^nwmDuALHj5x1>|)kwfK8_x2rDB z(NML>1QmjjF$U9I#N+i+$d^VXNOtjHwS)3?3A9n4R{@`?wmm|5pv{N~tr36lYb5Uz ze@wjsEfKF%DYAuD&~FqC)D~!`nqWMVV>XBK8k9xAL+V^;YttqBG{{P%{P4jP&wDr0 zGG(zE<(mTbyIZLS=&d$ZH^f!^xjqgd^&~rxc*0KA3`Q0U$W%4DZ}+evlHq<`rj4)V z-*}d4vLQ$sL5Ui|%T*&R*5}-Un;?FPCWz=vzb~*5G z`s}bm?V6$b+3IM5q>>b2@V#?D$_98I=H&-KW(fd7YgMLVkQGXSJGrIiQr#8WQJ?B0ZgoAd; zj7&3)iY*!)oc^Yc;Iwruqnv^gCq2CZ5&-iu?mO!;Yn*DI1(ZjW7b0%c>r`M2BXCQs zE=WdbEKZKq^ZM*g@N)hxKr(GdA@PHW9_Klx%ecO3C%lZfeM@cljWDpsV_D=jy1#?u z5`Cfne!+Fjv##TQ6X*N|x(qXnP_l!{QQ`isiSIo2A+;Os2>V#1v~`Of(>0EOEU;lV z!pbr#@3Zhzo$ybo5#1i~FvZI>y<3m}JCFBT0B_nb8)3CUHmm*M?qhnXKEHu?Q))-U z>_-BEcj@b1nxZik`==U4s03u58qo7y6S^1WTUL272TAoVRSi)W$-P?RacpO#M%pk! zNjEB{f;2)pUVM+L_h9%R#6|ol754&+Wui+X8Aj-+hxFF%m4GlYQk+uD$Bz*%tllU_E|cyQ{^h8!(AgARwGIjAmy?@ zO7inLNGtpuRKJ0VVFaGoz~3<>H>(%$BGR6*rksm(E*XKic2C;y8c`(&iH*FE)OU=j z;@IIxEM>la#&&TsA|(jbQG#r1HWX=Qa1yE8sE?$dtU#IoTSB4{IsO7fD}`RFa{cW9 O0000 @@ -892,6 +894,8 @@ make_hexahedron(const P& p0, const P& p1, const P& p2, const P& p3, * \ingroup PkgBGLHelperFct * \brief Creates an isolated tetrahedron * with its vertices initialized to `p0`, `p1`, `p2`, and `p3`, and adds it to the graph `g`. + * \image html tetrahedron.png + * \image latex tetrahedron.png * \returns the halfedge that has the target vertex associated with `p0`, in the face with the vertices with the points `p0`, `p1`, and `p2`. **/ template @@ -989,7 +993,7 @@ make_tetrahedron(const P& p0, const P& p1, const P& p2, const P& p3, Graph& g) * having `nb_vertices` vertices in each of its bases and adds it to the graph `g`. * If `center` is (0, 0, 0), then the first point of the prism is (`radius`, `height`, 0) * \param nb_vertices the number of vertices per base. It must be greater than or equal to 3. - * \param g the graph in which the regular prism will be created. + * \param g the graph in which the regular prism will be created.https://cgal.geometryfactory.com/~mgimeno/BGL_helpers/BGL/group__PkgBGLRef.html * \param base_center the center of the circle in which the lower base is inscribed. * \param height the distance between the two bases. * \param radius the radius of the circles in which the bases are inscribed. From 3dcd3359db83b0472eeca02eaa422046846d28ab Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Tue, 4 Dec 2018 16:24:30 +0100 Subject: [PATCH 119/193] Fix behavior with offset --- Polyhedron/demo/Polyhedron/MainWindow.cpp | 13 +++++++++---- Polyhedron/demo/Polyhedron/MainWindow.h | 2 +- Polyhedron/demo/Polyhedron/Scene.cpp | 6 ++++-- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/MainWindow.cpp b/Polyhedron/demo/Polyhedron/MainWindow.cpp index ca9ac17873c..dc0023cf6ad 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.cpp +++ b/Polyhedron/demo/Polyhedron/MainWindow.cpp @@ -208,7 +208,7 @@ MainWindow::MainWindow(bool verbose, QWidget* parent) this, SLOT(removeManipulatedFrame(CGAL::Three::Scene_item*))); connect(scene, SIGNAL(updated_bbox(bool)), - this, SLOT(invalidate_bbox())); + this, SLOT(invalidate_bbox(bool))); connect(scene, SIGNAL(selectionChanged(int)), this, SLOT(selectSceneItem(int))); @@ -1105,6 +1105,7 @@ void MainWindow::open(QString filename) qobject_cast(scene_item); if(group) scene->redraw_model(); + updateViewerBBox(true); } bool MainWindow::open(QString filename, QString loader_name) { @@ -1776,7 +1777,6 @@ void MainWindow::on_actionLoad_triggered() scene->item(scene->numberOfEntries()-1)->setColor(colors_[++nb_item]); } } - updateViewerBBox(true); } void MainWindow::on_actionSaveAs_triggered() @@ -2228,7 +2228,9 @@ void MainWindow::setAddKeyFrameKeyboardModifiers(::Qt::KeyboardModifiers m) void MainWindow::on_actionRecenterScene_triggered() { - updateViewerBBox(); + //force the recomputaion of the bbox + bbox_need_update = true; + updateViewerBBox(true); viewer->camera()->showEntireScene(); } @@ -2582,7 +2584,10 @@ void MainWindow::setDefaultSaveDir() settings.setValue("default_saveas_dir", def_save_dir); } -void MainWindow::invalidate_bbox() +void MainWindow::invalidate_bbox(bool do_recenter) { bbox_need_update = true; + if(do_recenter) + updateViewerBBox(true); + } diff --git a/Polyhedron/demo/Polyhedron/MainWindow.h b/Polyhedron/demo/Polyhedron/MainWindow.h index 4c38c289b97..d0d1aad10ec 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.h +++ b/Polyhedron/demo/Polyhedron/MainWindow.h @@ -441,7 +441,7 @@ public: public Q_SLOTS: void toggleFullScreen(); void setDefaultSaveDir(); - void invalidate_bbox(); + void invalidate_bbox(bool do_recenter); private: QList visibleDockWidgets; QLineEdit operationSearchBar; diff --git a/Polyhedron/demo/Polyhedron/Scene.cpp b/Polyhedron/demo/Polyhedron/Scene.cpp index 13826d45f6d..890940606fe 100644 --- a/Polyhedron/demo/Polyhedron/Scene.cpp +++ b/Polyhedron/demo/Polyhedron/Scene.cpp @@ -1330,8 +1330,10 @@ void Scene::itemVisibilityChanged(CGAL::Three::Scene_item* item) && !item->isEmpty()) { //does not recenter - if(visibility_recentering_enabled) - Q_EMIT updated_bbox(false); + if(visibility_recentering_enabled){ + Q_EMIT updated_bbox(true); + + } } } From 665c66e5579536ee979ea5eeb99b4e478ec67fce Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 5 Dec 2018 10:15:49 +0100 Subject: [PATCH 120/193] Fix warning in PLY_reader --- Point_set_3/include/CGAL/Point_set_3/IO.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Point_set_3/include/CGAL/Point_set_3/IO.h b/Point_set_3/include/CGAL/Point_set_3/IO.h index 93117799195..f2d14227ec9 100644 --- a/Point_set_3/include/CGAL/Point_set_3/IO.h +++ b/Point_set_3/include/CGAL/Point_set_3/IO.h @@ -156,7 +156,7 @@ private: virtual void assign (PLY_reader& reader, typename Point_set::Index index) { - Type t; + Type t{}; reader.assign (t, m_name.c_str()); put(m_pmap, index, t); } From 629b41e69de32721cca2ef48751a056f14101b17 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 5 Dec 2018 16:33:44 +0100 Subject: [PATCH 121/193] Remove garbage --- BGL/include/CGAL/boost/graph/helpers.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BGL/include/CGAL/boost/graph/helpers.h b/BGL/include/CGAL/boost/graph/helpers.h index 73f2687d9bb..d574d7cc9ca 100644 --- a/BGL/include/CGAL/boost/graph/helpers.h +++ b/BGL/include/CGAL/boost/graph/helpers.h @@ -993,7 +993,7 @@ make_tetrahedron(const P& p0, const P& p1, const P& p2, const P& p3, Graph& g) * having `nb_vertices` vertices in each of its bases and adds it to the graph `g`. * If `center` is (0, 0, 0), then the first point of the prism is (`radius`, `height`, 0) * \param nb_vertices the number of vertices per base. It must be greater than or equal to 3. - * \param g the graph in which the regular prism will be created.https://cgal.geometryfactory.com/~mgimeno/BGL_helpers/BGL/group__PkgBGLRef.html + * \param g the graph in which the regular prism will be created. * \param base_center the center of the circle in which the lower base is inscribed. * \param height the distance between the two bases. * \param radius the radius of the circles in which the bases are inscribed. From 722f8e18d0d98325095e4d43edce3d7e6b2fc9d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 5 Dec 2018 17:53:09 +0100 Subject: [PATCH 122/193] init variables to avoid warnings --- .../examples/Segment_Delaunay_graph_2/sdg-filtered-traits.cpp | 3 ++- .../Segment_Delaunay_graph_Linf_2/sdg-filtered-traits-linf.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Segment_Delaunay_graph_2/examples/Segment_Delaunay_graph_2/sdg-filtered-traits.cpp b/Segment_Delaunay_graph_2/examples/Segment_Delaunay_graph_2/sdg-filtered-traits.cpp index 6945fb1c3a5..13e05eb5087 100644 --- a/Segment_Delaunay_graph_2/examples/Segment_Delaunay_graph_2/sdg-filtered-traits.cpp +++ b/Segment_Delaunay_graph_2/examples/Segment_Delaunay_graph_2/sdg-filtered-traits.cpp @@ -26,7 +26,8 @@ int main() assert( ifs ); SDG2 sdg; - SDG2::Site_2 site; + SDG2::Site_2 site = + SDG2::Site_2::construct_site_2(K::Point_2(CGAL::ORIGIN)); // read the sites and insert them in the segment Delaunay graph while ( ifs >> site ) { diff --git a/Segment_Delaunay_graph_Linf_2/examples/Segment_Delaunay_graph_Linf_2/sdg-filtered-traits-linf.cpp b/Segment_Delaunay_graph_Linf_2/examples/Segment_Delaunay_graph_Linf_2/sdg-filtered-traits-linf.cpp index 1b1777855a0..c3ad58dd8ee 100644 --- a/Segment_Delaunay_graph_Linf_2/examples/Segment_Delaunay_graph_Linf_2/sdg-filtered-traits-linf.cpp +++ b/Segment_Delaunay_graph_Linf_2/examples/Segment_Delaunay_graph_Linf_2/sdg-filtered-traits-linf.cpp @@ -30,7 +30,8 @@ int main( int argc, char *argv[] ) assert( ifs ); SDG2 sdg; - SDG2::Site_2 site; + SDG2::Site_2 site = + SDG2::Site_2::construct_site_2(Rep::Point_2(CGAL::ORIGIN));; // read the sites and insert them in the segment Delaunay graph while ( ifs >> site ) { From aecbd80d203074d2a059d4cba7773392526e6665 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 5 Dec 2018 17:56:30 +0100 Subject: [PATCH 123/193] avoid Wmaybe-uninitialized Triggered when compiling the target Simple_cartesian @lrineau do you think it is an acceptable fix (I tend not to like it). --- Kernel_23/test/Kernel_23/include/CGAL/_test_io.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kernel_23/test/Kernel_23/include/CGAL/_test_io.h b/Kernel_23/test/Kernel_23/include/CGAL/_test_io.h index bf7dacd2f97..765527e0a58 100644 --- a/Kernel_23/test/Kernel_23/include/CGAL/_test_io.h +++ b/Kernel_23/test/Kernel_23/include/CGAL/_test_io.h @@ -40,7 +40,7 @@ _test_io_for(const T& t) } std::ifstream iFile(TEST_FILENAME, std::ios::in); - T u; + T u = t; iFile >> u; assert(!iFile.fail()); assert(u == t); From 846f19f401f5dfbd09081745585a1fa57d4a598f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 5 Dec 2018 18:20:06 +0100 Subject: [PATCH 124/193] init variables --- Kernel_23/test/Kernel_23/issue_129.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kernel_23/test/Kernel_23/issue_129.cpp b/Kernel_23/test/Kernel_23/issue_129.cpp index cb9ae603e25..06b6c674782 100644 --- a/Kernel_23/test/Kernel_23/issue_129.cpp +++ b/Kernel_23/test/Kernel_23/issue_129.cpp @@ -28,7 +28,7 @@ int main() { try { - CGAL::Point_3 a, b, c, d; + CGAL::Point_3 a(CGAL::ORIGIN), b(a), c(a), d(a); CGAL::squared_radius(a, b, c, d); } catch(...) {} return EXIT_SUCCESS; From db4be1db6a5179c71947be3f85d5bf5a4dfa4387 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 5 Dec 2018 18:20:24 +0100 Subject: [PATCH 125/193] fix Wmaybe-uninitialiazed warnings --- .../test/Segment_Delaunay_graph_2/include/test_info.h | 3 ++- .../Segment_Delaunay_graph_Linf_2/sdg-filtered-traits-linf.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Segment_Delaunay_graph_2/test/Segment_Delaunay_graph_2/include/test_info.h b/Segment_Delaunay_graph_2/test/Segment_Delaunay_graph_2/include/test_info.h index 3db6956d14b..9ba280559d7 100644 --- a/Segment_Delaunay_graph_2/test/Segment_Delaunay_graph_2/include/test_info.h +++ b/Segment_Delaunay_graph_2/test/Segment_Delaunay_graph_2/include/test_info.h @@ -17,7 +17,8 @@ bool test_info(SDG& sdg, const char* fname) assert( ifs ); sdg.clear(); - typename SDG::Site_2 site; + typename SDG::Site_2 site = + SDG::Site_2::construct_site_2(typename SDG::Point_2(CGAL::ORIGIN)); // read the sites and insert them in the segment Delaunay graph int info_id = 1; diff --git a/Segment_Delaunay_graph_Linf_2/examples/Segment_Delaunay_graph_Linf_2/sdg-filtered-traits-linf.cpp b/Segment_Delaunay_graph_Linf_2/examples/Segment_Delaunay_graph_Linf_2/sdg-filtered-traits-linf.cpp index c3ad58dd8ee..b7f9642ab6b 100644 --- a/Segment_Delaunay_graph_Linf_2/examples/Segment_Delaunay_graph_Linf_2/sdg-filtered-traits-linf.cpp +++ b/Segment_Delaunay_graph_Linf_2/examples/Segment_Delaunay_graph_Linf_2/sdg-filtered-traits-linf.cpp @@ -31,7 +31,7 @@ int main( int argc, char *argv[] ) SDG2 sdg; SDG2::Site_2 site = - SDG2::Site_2::construct_site_2(Rep::Point_2(CGAL::ORIGIN));; + SDG2::Site_2::construct_site_2(Rep::Point_2(CGAL::ORIGIN)); // read the sites and insert them in the segment Delaunay graph while ( ifs >> site ) { From 474ec90f4a84222e66eda0b2191d03b4dec8da81 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 5 Dec 2018 19:08:17 +0100 Subject: [PATCH 126/193] Do not include --- .../AABB_custom_indexed_triangle_set_array_example.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AABB_tree/examples/AABB_tree/AABB_custom_indexed_triangle_set_array_example.cpp b/AABB_tree/examples/AABB_tree/AABB_custom_indexed_triangle_set_array_example.cpp index 8505b99ed49..87dfc24553f 100644 --- a/AABB_tree/examples/AABB_tree/AABB_custom_indexed_triangle_set_array_example.cpp +++ b/AABB_tree/examples/AABB_tree/AABB_custom_indexed_triangle_set_array_example.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include From cf0909ef51477d8388d1e7070716eff3e65791be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 6 Dec 2018 08:43:32 +0100 Subject: [PATCH 127/193] fix maybe-uninitialized warning thanks @mglisse --- Generator/include/CGAL/point_generators_d.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Generator/include/CGAL/point_generators_d.h b/Generator/include/CGAL/point_generators_d.h index e082cf42cce..c7f40cbf5a7 100644 --- a/Generator/include/CGAL/point_generators_d.h +++ b/Generator/include/CGAL/point_generators_d.h @@ -151,14 +151,12 @@ void Random_points_in_cube_d

:: generate_point() { typedef typename Kernel_traits

::Kernel::RT RT; + CGAL_assume(dimension>0); std::vector coord(dimension); for(int i=0; id_range * ( 2 * this->_rnd.get_double() - 1.0)); P p(dimension, coord.begin(), coord.end() ); - #ifdef BOOST_GCC - #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" - #endif this->d_item = p; } From 5a2857d4510f381b2eec76209c28d2b97fac70de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 6 Dec 2018 09:23:06 +0100 Subject: [PATCH 128/193] fix maybe uninitialized warning triggered by target Orthogonal_incremental_neighbor_search --- Spatial_searching/include/CGAL/Kd_tree_rectangle.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Spatial_searching/include/CGAL/Kd_tree_rectangle.h b/Spatial_searching/include/CGAL/Kd_tree_rectangle.h index 1eb6efad609..042dbb088f0 100644 --- a/Spatial_searching/include/CGAL/Kd_tree_rectangle.h +++ b/Spatial_searching/include/CGAL/Kd_tree_rectangle.h @@ -166,6 +166,7 @@ namespace CGAL { inline FT min_coord(int i) const { + CGAL_assume(i Date: Thu, 6 Dec 2018 12:39:04 +0100 Subject: [PATCH 129/193] Suppress boost PP related warnings --- .../include/CGAL/optimize_periodic_3_mesh_3.h | 9 +++++++++ .../include/CGAL/refine_periodic_3_mesh_3.h | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/Periodic_3_mesh_3/include/CGAL/optimize_periodic_3_mesh_3.h b/Periodic_3_mesh_3/include/CGAL/optimize_periodic_3_mesh_3.h index 31f5fb4b8cc..8aeb4874ea2 100644 --- a/Periodic_3_mesh_3/include/CGAL/optimize_periodic_3_mesh_3.h +++ b/Periodic_3_mesh_3/include/CGAL/optimize_periodic_3_mesh_3.h @@ -33,6 +33,11 @@ namespace CGAL { +#if defined(BOOST_MSVC) +# pragma warning(push) +# pragma warning(disable:4003) // not enough actual parameters for macro +#endif + // see CGAL_PRAGMA_DIAG_PUSH // see @@ -120,6 +125,10 @@ BOOST_PARAMETER_FUNCTION( CGAL_PRAGMA_DIAG_POP +#if defined(BOOST_MSVC) +# pragma warning(pop) +#endif + } // namespace CGAL #endif // CGAL_OPTIMIZE_PERIODIC_3_MESH_3_H diff --git a/Periodic_3_mesh_3/include/CGAL/refine_periodic_3_mesh_3.h b/Periodic_3_mesh_3/include/CGAL/refine_periodic_3_mesh_3.h index c39ed5d3d6b..8447b3d47cf 100644 --- a/Periodic_3_mesh_3/include/CGAL/refine_periodic_3_mesh_3.h +++ b/Periodic_3_mesh_3/include/CGAL/refine_periodic_3_mesh_3.h @@ -144,6 +144,11 @@ void project_points(C3T3& c3t3, } // namespace internal +#if defined(BOOST_MSVC) +# pragma warning(push) +# pragma warning(disable:4003) // not enough actual parameters for macro +#endif + // see CGAL_PRAGMA_DIAG_PUSH // see @@ -181,6 +186,10 @@ BOOST_PARAMETER_FUNCTION( CGAL_PRAGMA_DIAG_POP +#if defined(BOOST_MSVC) +# pragma warning(pop) +#endif + /** * @brief This function refines the mesh c3t3 wrt domain & criteria * From 864d4cd0c163cb1f8bc4981e2738467db71842ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 6 Dec 2018 14:17:19 +0100 Subject: [PATCH 130/193] fix maybe-uninitialized warning --- NewKernel_d/include/CGAL/NewKernel_d/Vector/array.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Vector/array.h b/NewKernel_d/include/CGAL/NewKernel_d/Vector/array.h index 2a80ddf7e41..4f99858df63 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Vector/array.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Vector/array.h @@ -70,7 +70,8 @@ template struct Array_vector { CGAL_assertion(d<=d_); //TODO: optimize for forward iterators Vector a; - std::copy(f,e,a.begin()); + CGAL_assume(f!=e); + std::copy(f,e,a.begin()); return a; } }; From 055072829278e6efeb705184a854ae21c5667e3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 6 Dec 2018 14:19:33 +0100 Subject: [PATCH 131/193] fix indentation --- NewKernel_d/include/CGAL/NewKernel_d/Vector/array.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Vector/array.h b/NewKernel_d/include/CGAL/NewKernel_d/Vector/array.h index 4f99858df63..6f9aa5bb3f2 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Vector/array.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Vector/array.h @@ -70,8 +70,8 @@ template struct Array_vector { CGAL_assertion(d<=d_); //TODO: optimize for forward iterators Vector a; - CGAL_assume(f!=e); - std::copy(f,e,a.begin()); + CGAL_assume(f!=e); + std::copy(f,e,a.begin()); return a; } }; From 1f51c8ab10583fe50188e05c7bd60b7d5c1c9bb2 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Mon, 26 Nov 2018 15:44:17 +0100 Subject: [PATCH 132/193] has_sloop() -> has_shalfloop() --- Nef_S2/include/CGAL/Nef_polyhedron_S2.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Nef_S2/include/CGAL/Nef_polyhedron_S2.h b/Nef_S2/include/CGAL/Nef_polyhedron_S2.h index 71eb311e6a1..c980fabd6f3 100644 --- a/Nef_S2/include/CGAL/Nef_polyhedron_S2.h +++ b/Nef_S2/include/CGAL/Nef_polyhedron_S2.h @@ -380,7 +380,7 @@ public: SHalfedge_iterator e; CGAL_forall_svertices(v,D) v->mark() = false; CGAL_forall_sedges(e,D) e->mark() = false; - if ( D.has_sloop() ) D.shalfloop()->mark() = false; + if ( D.has_shalfloop() ) D.shalfloop()->mark() = false; D.simplify(); } @@ -395,7 +395,7 @@ public: CGAL_forall_svertices(v,D) v->mark() = true; CGAL_forall_sedges(e,D) e->mark() = true; CGAL_forall_sfaces(f,D) f->mark() = false; - if ( D.has_sloop() ) D.shalfloop()->mark() = D.shalfoop()->twin()->mark() = true; + if ( D.has_shalfloop() ) D.shalfloop()->mark() = D.shalfoop()->twin()->mark() = true; D.simplify(); } From 91107dce9bd4b179fd3bc391a84e6af9cef8ac3a Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Fri, 7 Dec 2018 11:38:14 +0100 Subject: [PATCH 133/193] Improve the script git-show-content It might need `--no-pager`, to avoid iterating on the pager screens. --- Scripts/developer_scripts/git-show-content | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Scripts/developer_scripts/git-show-content b/Scripts/developer_scripts/git-show-content index 5ccd986a7ac..b72e089e828 100755 --- a/Scripts/developer_scripts/git-show-content +++ b/Scripts/developer_scripts/git-show-content @@ -14,17 +14,17 @@ function reset() { trap reset ERR EXIT KILL TERM INT -for c in $(git log --pretty='%h' --first-parent cgal/master..$base); do +for c in $(git --no-pager log --pretty='%h' --first-parent cgal/master..$base); do git update-ref refs/cgal/git-show-content $c git bundle create bundle ${c}^..refs/cgal/git-show-content > /dev/null 2>&1 gzip -f bundle size=${(l:4:)$(( $(zstat +size bundle.gz) / 1024 ))} - git show --no-patch --pretty='%C(auto)%h (SIZE: %C(auto)'"${size}kB)"' %s <%an> %cD' $c + git --no-pager show --no-patch --pretty='%C(auto)%h (SIZE: %C(auto)'"${size}kB)"' %s <%an> %cD' $c parents=(${(@)$(git rev-parse $c^@)}) if ! [ ${#${parents:1}[@]} -eq 0 ]; then - git show --no-patch --pretty=' merge: %h%C(auto)% d' ${parents:1} + git --no-pager show --no-patch --pretty=' merge: %h%C(auto)% d' ${parents:1} fi done last=$c -[ -n "$last" ] && git log -1 --pretty='Base commit: %C(auto)%h %d' ${last}'~' +[ -n "$last" ] && git --no-pager log -1 --pretty='Base commit: %C(auto)%h %d' ${last}'~' From 8634fc94e964f7af7af94aeeba7483048e037db1 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Fri, 7 Dec 2018 12:01:39 +0100 Subject: [PATCH 134/193] Fix a warning when `FT` is `int` https://cgal.geometryfactory.com/CGAL/testsuite/CGAL-4.14-Ic-63/Arrangement_on_surface_2_Examples/TestReport_Blake_Windows_MSVCPreview-Release-64bits.gz --- .../include/CGAL/constructions/kernel_ftC2.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Cartesian_kernel/include/CGAL/constructions/kernel_ftC2.h b/Cartesian_kernel/include/CGAL/constructions/kernel_ftC2.h index 144ec2695d2..f9bd5290086 100644 --- a/Cartesian_kernel/include/CGAL/constructions/kernel_ftC2.h +++ b/Cartesian_kernel/include/CGAL/constructions/kernel_ftC2.h @@ -28,6 +28,7 @@ #include #include +#include namespace CGAL { @@ -284,6 +285,15 @@ line_get_pointC2(const FT &a, const FT &b, const FT &c, int i, { if (CGAL_NTS is_zero(b)) { + // Laurent Rineau, 2018/12/07: I had this CGAL_assume to calm + // down a warning from MSVC 2017: + // > include\cgal\constructions\kernel_ftc2.h(287) : + // > warning C4723: potential divide by 0 + // The test `!boost::is_integral::value` is there to avoid + // that `a != 0` is tested on anything but integral types, for + // performance reasons. + CGAL_assume(!boost::is_integral::value || a != FT(0)); + x = -c/a; y = 1 - i * a; } From 212944baf6a7c3fda575f41b010013291ec9a2ba Mon Sep 17 00:00:00 2001 From: Mael Date: Fri, 7 Dec 2018 12:13:55 +0100 Subject: [PATCH 135/193] Update Cartesian_kernel/include/CGAL/constructions/kernel_ftC2.h Co-Authored-By: lrineau --- Cartesian_kernel/include/CGAL/constructions/kernel_ftC2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cartesian_kernel/include/CGAL/constructions/kernel_ftC2.h b/Cartesian_kernel/include/CGAL/constructions/kernel_ftC2.h index f9bd5290086..9373f9feeda 100644 --- a/Cartesian_kernel/include/CGAL/constructions/kernel_ftC2.h +++ b/Cartesian_kernel/include/CGAL/constructions/kernel_ftC2.h @@ -285,7 +285,7 @@ line_get_pointC2(const FT &a, const FT &b, const FT &c, int i, { if (CGAL_NTS is_zero(b)) { - // Laurent Rineau, 2018/12/07: I had this CGAL_assume to calm + // Laurent Rineau, 2018/12/07: I add this CGAL_assume to calm // down a warning from MSVC 2017: // > include\cgal\constructions\kernel_ftc2.h(287) : // > warning C4723: potential divide by 0 From 66359c5d1303e1ee84170c73ede427c7dc6c9d71 Mon Sep 17 00:00:00 2001 From: albert-github Date: Sat, 8 Dec 2018 13:28:28 +0100 Subject: [PATCH 136/193] XHTML address of dtd The address of the dtd for checking has changed from http -> https --- Documentation/doc/resources/1.8.13/deprecated.html | 2 +- Documentation/doc/resources/1.8.13/header.html | 2 +- Documentation/doc/resources/1.8.13/header_package.html | 2 +- Documentation/doc/resources/1.8.14/deprecated.html | 2 +- Documentation/doc/resources/1.8.14/header.html | 2 +- Documentation/doc/resources/1.8.14/header_package.html | 2 +- Documentation/doc/resources/1.8.4/deprecated.html | 2 +- Documentation/doc/resources/1.8.4/header.html | 2 +- Documentation/doc/resources/1.8.4/header_package.html | 2 +- Documentation/doc/scripts/html_output_post_processing.py | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Documentation/doc/resources/1.8.13/deprecated.html b/Documentation/doc/resources/1.8.13/deprecated.html index 4d8329a9fb2..823d7ea093c 100644 --- a/Documentation/doc/resources/1.8.13/deprecated.html +++ b/Documentation/doc/resources/1.8.13/deprecated.html @@ -1,4 +1,4 @@ - + diff --git a/Documentation/doc/resources/1.8.13/header.html b/Documentation/doc/resources/1.8.13/header.html index ea550ad48c8..f5ed0edf20d 100644 --- a/Documentation/doc/resources/1.8.13/header.html +++ b/Documentation/doc/resources/1.8.13/header.html @@ -1,5 +1,5 @@ - + diff --git a/Documentation/doc/resources/1.8.13/header_package.html b/Documentation/doc/resources/1.8.13/header_package.html index c8e2578351f..46521a96a54 100644 --- a/Documentation/doc/resources/1.8.13/header_package.html +++ b/Documentation/doc/resources/1.8.13/header_package.html @@ -1,5 +1,5 @@ - + diff --git a/Documentation/doc/resources/1.8.14/deprecated.html b/Documentation/doc/resources/1.8.14/deprecated.html index 60d1c4e90bc..a8baa72c005 100644 --- a/Documentation/doc/resources/1.8.14/deprecated.html +++ b/Documentation/doc/resources/1.8.14/deprecated.html @@ -1,4 +1,4 @@ - + diff --git a/Documentation/doc/resources/1.8.14/header.html b/Documentation/doc/resources/1.8.14/header.html index ea550ad48c8..f5ed0edf20d 100644 --- a/Documentation/doc/resources/1.8.14/header.html +++ b/Documentation/doc/resources/1.8.14/header.html @@ -1,5 +1,5 @@ - + diff --git a/Documentation/doc/resources/1.8.14/header_package.html b/Documentation/doc/resources/1.8.14/header_package.html index 7adad539ace..df3a1bcba36 100644 --- a/Documentation/doc/resources/1.8.14/header_package.html +++ b/Documentation/doc/resources/1.8.14/header_package.html @@ -1,5 +1,5 @@ - + diff --git a/Documentation/doc/resources/1.8.4/deprecated.html b/Documentation/doc/resources/1.8.4/deprecated.html index 4d8329a9fb2..823d7ea093c 100644 --- a/Documentation/doc/resources/1.8.4/deprecated.html +++ b/Documentation/doc/resources/1.8.4/deprecated.html @@ -1,4 +1,4 @@ - + diff --git a/Documentation/doc/resources/1.8.4/header.html b/Documentation/doc/resources/1.8.4/header.html index 890229ec02c..4b0aae2bff8 100644 --- a/Documentation/doc/resources/1.8.4/header.html +++ b/Documentation/doc/resources/1.8.4/header.html @@ -1,4 +1,4 @@ - + diff --git a/Documentation/doc/resources/1.8.4/header_package.html b/Documentation/doc/resources/1.8.4/header_package.html index 051c01002f6..37a9f67fdca 100644 --- a/Documentation/doc/resources/1.8.4/header_package.html +++ b/Documentation/doc/resources/1.8.4/header_package.html @@ -1,4 +1,4 @@ - + diff --git a/Documentation/doc/scripts/html_output_post_processing.py b/Documentation/doc/scripts/html_output_post_processing.py index c2a0b34941f..e89c7e7b61a 100755 --- a/Documentation/doc/scripts/html_output_post_processing.py +++ b/Documentation/doc/scripts/html_output_post_processing.py @@ -62,7 +62,7 @@ def conceptify_ns(d): def write_out_html(d, fn): f = codecs.open(fn, 'w', encoding='utf-8') # this is the normal doxygen doctype, which is thrown away by pyquery - f.write('\n') + f.write('\n') f.write('') f.write(d.html()) f.write('\n') From 14560b8e3c2920c90d89613aa5044bbf51d9e5ed Mon Sep 17 00:00:00 2001 From: albert-github Date: Sat, 8 Dec 2018 15:15:27 +0100 Subject: [PATCH 137/193] XHTML problem regarding TOC definition Form the doxygen documentation: Normally the contents between \htmlonly and \endhtmlonly is inserted as-is. When you want to insert a HTML fragment that has block scope like a table or list which should appear outside

..

, this can lead to invalid HTML. You can use \htmlonly[block] to make doxygen end the current paragraph and restart it after \endhtmlonly. --- Documentation/doc/resources/1.8.14/BaseDoxyfile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/doc/resources/1.8.14/BaseDoxyfile.in b/Documentation/doc/resources/1.8.14/BaseDoxyfile.in index 9bc583f5cd8..265cbe2ea4d 100644 --- a/Documentation/doc/resources/1.8.14/BaseDoxyfile.in +++ b/Documentation/doc/resources/1.8.14/BaseDoxyfile.in @@ -287,7 +287,7 @@ ALIASES = "sc{1}=\1 \endhtmlonly \latexonly END MODIFICATIONS \endlatexonly" \ "cgalPkgBib{1}=BibTeX: \1-${CGAL_RELEASE_YEAR_ID}
" \ "cgalFootnote{1}=\1" \ - "cgalAutoToc=\htmlonly
\endhtmlonly" \ + "cgalAutoToc=\htmlonly[block]
\endhtmlonly" \ "cgalTagTrue=\link CGAL::Tag_true `CGAL::Tag_true`\endlink" \ "cgalTagFalse=\link CGAL::Tag_false `CGAL::Tag_false`\endlink" \ "cgalHeading{1}= \1
" \ From dd0acafcf28c78df87a25281d146ab408ae9852b Mon Sep 17 00:00:00 2001 From: albert-github Date: Sat, 8 Dec 2018 15:22:44 +0100 Subject: [PATCH 138/193] XHTML incorrect tag sequence with figure Due to the extra empty line an wrong sequence of tags appeared in the HTML output. --- Visibility_2/doc/Visibility_2/visibility_2.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/Visibility_2/doc/Visibility_2/visibility_2.txt b/Visibility_2/doc/Visibility_2/visibility_2.txt index 34fa2d8674e..c72f5d03f29 100644 --- a/Visibility_2/doc/Visibility_2/visibility_2.txt +++ b/Visibility_2/doc/Visibility_2/visibility_2.txt @@ -129,7 +129,6 @@ does not require preprocessing is advantageous. The following example shows how to obtain the regularized and non-regularized visibility regions. \cgalFigureBegin{simple_example, simple_example.png} - The visibility region of \f$ q \f$ in a simple polygon: (1) non-regularized visibility; and (2) regularized visibility. \cgalFigureEnd \cgalExample{Visibility_2/simple_polygon_visibility_2.cpp} From d6641b569f33ee9c99e7c6073feb9de727b041f7 Mon Sep 17 00:00:00 2001 From: albert-github Date: Sun, 9 Dec 2018 18:31:13 +0100 Subject: [PATCH 139/193] Problems with formulas in documentation There were some problems with formulas in the documentation most of them resulting in 'Undefined control sequence ' (MathJax output) Note problem with the Bounding Volumes has not been resolved, separate issue created #3522 --- .../Boolean_set_operations_2.txt | 2 +- Generator/doc/Generator/Generator.txt | 2 +- .../CGAL/Monge_via_jet_fitting.h | 2 +- .../doc/Jet_fitting_3/Jet_fitting_3.txt | 34 ++++------ .../doc/Kernel_d/CGAL/Kernel_d/Vector_d.h | 4 +- QP_solver/doc/QP_solver/CGAL/QP_solution.h | 12 ++-- QP_solver/doc/QP_solver/QP_solver.txt | 4 +- Ridges_3/doc/Ridges_3/Ridges_3.txt | 12 ++-- .../doc/Spatial_searching/CGAL/Splitters.h | 2 +- .../Surface_mesh_deformation.txt | 66 +++++++------------ 10 files changed, 52 insertions(+), 88 deletions(-) diff --git a/Boolean_set_operations_2/doc/Boolean_set_operations_2/Boolean_set_operations_2.txt b/Boolean_set_operations_2/doc/Boolean_set_operations_2/Boolean_set_operations_2.txt index f62ef5d35b8..ff6ffd789b8 100644 --- a/Boolean_set_operations_2/doc/Boolean_set_operations_2/Boolean_set_operations_2.txt +++ b/Boolean_set_operations_2/doc/Boolean_set_operations_2/Boolean_set_operations_2.txt @@ -74,7 +74,7 @@ polygon vertices is referred to as the polygon (outer) boundary.
  • A polygon whose curves are pairwise disjoint in their interior, and whose vertices' degree equals two is defined as a Simple polygon. Such a polygon has a well-defined interior and exterior and is topologically equivalent to a disk. Note that while traversing the edges of the relatively simple polygon illustrated above (B), no curve is crossed over. -
  • A Relatively simple polygon allows vertices with a degree\f$\gt 2\f$, but all of its edges are disjoint in their interior. Furthermore, it must be an orientable polygon. Namely when it is inserted into an arrangement and its outer boundary is traversed, the same face is adjacent to all of the halfedges (no crossing over any curve during the traversal). +
  • A Relatively simple polygon allows vertices with a degree\f$> 2\f$, but all of its edges are disjoint in their interior. Furthermore, it must be an orientable polygon. Namely when it is inserted into an arrangement and its outer boundary is traversed, the same face is adjacent to all of the halfedges (no crossing over any curve during the traversal). Note that while polygon C has the same curves as polygon B, traversal of the curves leads to crossing over a previously traversed curve, and is therefore neither simple nor relatively simple.
  • A polygon in our context must be relatively simple and its outer boundary vertices must be ordered in a counterclockwise direction around the interior of the polygon. diff --git a/Generator/doc/Generator/Generator.txt b/Generator/doc/Generator/Generator.txt index 138c4a7a7a5..cadcc924ab8 100644 --- a/Generator/doc/Generator/Generator.txt +++ b/Generator/doc/Generator/Generator.txt @@ -277,7 +277,7 @@ triangle (2D and 3D) and in tetrahedra (3D). Basically, in order to generate a random point in a \f$N\f$-simplex (a triangle for \f$N = 2\f$, and tetrahedron for \f$N = 3\f$), we generate numbers \f$a_1,a_2,\ldots,a_N\f$ identically and independently uniformly distributed in \f$(0,1)\f$, we sort them, we let \f$a_0 = 0\f$ and \f$a_{N+1} = 1\f$, -and then \f$a_{i+1}−a_i\f$, for \f$i = 1,\ldots,N\f$ becomes its +and then \f$a_{i+1}-a_i\f$, for \f$i = 1,\ldots,N\f$ becomes its barycentric coordinates with respect to the simplex. Maxime Gimemo introduced the random generators on 2D and 3D triangle meshes. diff --git a/Jet_fitting_3/doc/Jet_fitting_3/CGAL/Monge_via_jet_fitting.h b/Jet_fitting_3/doc/Jet_fitting_3/CGAL/Monge_via_jet_fitting.h index 2bfe86e437a..a0778b4c18e 100644 --- a/Jet_fitting_3/doc/Jet_fitting_3/CGAL/Monge_via_jet_fitting.h +++ b/Jet_fitting_3/doc/Jet_fitting_3/CGAL/Monge_via_jet_fitting.h @@ -199,7 +199,7 @@ Monge_via_jet_fitting(); This operator performs all the computations. The \f$ N\f$ input points are given by the `InputIterator` parameters which value-type are `Data_kernel::Point_3`, `d` is the degree of the fitted -polynomial, `d'` is the degree of the expected Monge +polynomial, \c d' is the degree of the expected Monge coefficients. \pre \f$ N \geq N_{d}:=(d+1)(d+2)/2\f$, \f$ 1 \leq d' \leq\min(d,4) \f$. */ template Monge_form diff --git a/Jet_fitting_3/doc/Jet_fitting_3/Jet_fitting_3.txt b/Jet_fitting_3/doc/Jet_fitting_3/Jet_fitting_3.txt index 36d39ebf838..d89781711dc 100644 --- a/Jet_fitting_3/doc/Jet_fitting_3/Jet_fitting_3.txt +++ b/Jet_fitting_3/doc/Jet_fitting_3/Jet_fitting_3.txt @@ -77,13 +77,11 @@ the surface can locally be written as the graph of a bivariate function. Letting \f$ h.o.t.\f$ stand for higher order terms, one has : -\f[ -\begin{equation} +\f{equation}{ z(x,y)=J_{B,d}(x,y) + h.o.t. \ ; \quad J_{B,d}(x,y)=\ccSum{k=0}{d}{(\ccSum{i=0}{i}{ \frac{B_{k-i,i}x^{k-i}y^{i}}{i!(k-i)!}})}. -\end{equation} -\f] +\f} The degree \f$ d\f$ polynomial \f$ J_{B,d}\f$ is the Taylor expansion of the function \f$ z\f$, and is called its \f$ d\f$-jet. Notice that a \f$ d\f$-jet contains @@ -343,12 +341,10 @@ The fitting process consists of finding the coefficients \f$ A_{i,j}\f$ of the degree \f$ d\f$ polynomial \anchor eqanswer -\f[ -\begin{equation} +\f{equation}{ J_{A,d}= \ccSum{k=0}{d}{(\ccSum{i=0}{k}{ \frac{A_{k-i,i}x^{k-i}y^{i}}{i!(k-i)!}})}. -\end{equation} -\f] +\f} Denote \f$ p_i=(x_i,y_i,z_i), \ i=1,\ldots , N\f$ the coordinates of the sample points of \f$ P^+\f$. @@ -362,7 +358,7 @@ given by A = & (A_{0,0}, A_{1,0},A_{0,1}, \ldots , A_{0,d})^T \\ Z= &(z_1, z_2,\ldots , z_N)^T \\ M= &(1,x_i,\ y_i,\ \frac{x_i^2}{2},\ldots , -\ \frac{x_iy_i^{d-1}}{(d-1)!},\ \frac{y_i^d}{d!})_{i=1,...,N}\\ +\ \frac{x_iy_i^{d-1}}{(d-1)!},\ \frac{y_i^d}{d!})_{i=1,...,N} \f} The equations for interpolation become \f$ MA=Z\f$. For approximation, the @@ -395,8 +391,7 @@ The number \f$ r\f$, which is the number of non zero singular values, is strictly lower than \f$ N_d\f$ if the system is under constrained. In any case, the unique solution which minimize \f$ ||A||_2\f$ is given by: -\f[ -\begin{equation} +\f{equation}{ A= V \left( \begin{array}{cc} D_r^{-1} & 0_{N_d-r,\ r}\\ @@ -404,8 +399,7 @@ D_r^{-1} & 0_{N_d-r,\ r}\\ \end{array} \right) U^TZ. -\end{equation} -\f] +\f} One can provide the condition number of the matrix \f$ M\f$ (after preconditioning) which is the ratio of the maximal and the minimal @@ -491,22 +485,18 @@ We use explicit formula. The implicit equation of the fitted polynomial surface in the fitting-basis with origin the point \f$ (0,0,A_{0,0})\f$ is \f$ Q=0\f$ with -\f[ -\begin{equation} +\f{equation}{ Q=-w-A_{0,0} +\ccSum{i,j}{}{\frac{A_{i,j}u^iv^j}{i!j!}}. -\end{equation} -\f] +\f} The equation in the Monge basis is obtained by substituting \f$ (u,v,w)\f$ by \f$ P^T_{F\rightarrow M}(x,y,z)\f$. Denote \f$ f(x,y,z)=0\f$ this implicit equation. By definition of the Monge basis, we have locally (at \f$ (0,0,0)\f$) -\f[ -\begin{equation} +\f{equation}{ f(x,y,z)=0 \Leftrightarrow z=g(x,y) -\end{equation} -\f] +\f} and the Taylor expansion of \f$ g\f$ at \f$ (0,0)\f$ are the Monge coefficients sought. @@ -526,7 +516,7 @@ f_{0,0,1} ^{2}}} \\ &b_1=g_{2,1}=-{\frac {- f_{0,1,1} f_{2,0,0} + f_{2,1,0} f_{0,0,1} }{ f_{0,0,1} ^{2}}} \\ -& .... \\ +& .... \f} diff --git a/Kernel_d/doc/Kernel_d/CGAL/Kernel_d/Vector_d.h b/Kernel_d/doc/Kernel_d/CGAL/Kernel_d/Vector_d.h index d09974defaa..541a6f73f8a 100644 --- a/Kernel_d/doc/Kernel_d/CGAL/Kernel_d/Vector_d.h +++ b/Kernel_d/doc/Kernel_d/CGAL/Kernel_d/Vector_d.h @@ -96,8 +96,8 @@ InputIterator first, InputIterator last); introduces a variable `v` of type `Vector_d` in dimension `d` initialized to the vector with homogeneous coordinates as defined by -`H = set [first,last)` and `D`: \f$ (\pmH[0], -\pmH[1], \ldots, \pmH[d-1], \pmD)\f$. The sign +`H = set [first,last)` and `D`: \f$ (\pm H_0, +\pm H_1, \ldots, \pm H_{D-1}, \pm H_D)\f$. The sign chosen is the sign of \f$ D\f$. \pre `D` is non-zero, the iterator range defines a \f$ d\f$-tuple of `RT`. diff --git a/QP_solver/doc/QP_solver/CGAL/QP_solution.h b/QP_solver/doc/QP_solver/CGAL/QP_solution.h index b3b9776dbfe..c323a4fd101 100644 --- a/QP_solver/doc/QP_solver/CGAL/QP_solution.h +++ b/QP_solver/doc/QP_solver/CGAL/QP_solution.h @@ -495,9 +495,9 @@ then \f$\lambda_i\geq 0\f$ (\f$\lambda_i\leq 0\f$, respectively).
  • \f[ \begin{array}{llll} -&&\geq 0 & \mbox{if \f$u_j=\infty\f$} \\ +&&\geq 0 & \mbox{if $u_j=\infty$} \\ \qplambda^T A_j &\quad \\ -&&\leq 0 & \mbox{if \f$l_j=-\infty\f$.} +&&\leq 0 & \mbox{if $l_j=-\infty$}. \end{array} \f]
  • \f[\qplambda^T\qpb \quad<\quad \ccSum{j: \qplambda^TA_j <0}{}{ \qplambda^TA_j u_j } @@ -508,12 +508,12 @@ then \f$\lambda_i\geq 0\f$ (\f$\lambda_i\leq 0\f$, respectively). that there is a feasible solution \f$\qpx\f$. Then we get \f[ \begin{array}{lcll} -0 &\geq& \qplambda^T(A\qpx -\qpb) & \mbox{(by \f$A\qpx\qprel \qpb\f$ and 1.)} \\ +0 &\geq& \qplambda^T(A\qpx -\qpb) & \mbox{(by $A\qpx\qprel \qpb$ and 1.)} \\ &=& \ccSum{j: \qplambda^TA_j <0}{}{ \qplambda^TA_j x_j } \quad+\quad \ccSum{j: \qplambda^TA_j >0}{}{ \qplambda^TA_j x_j} - \qplambda^T \qpb \\ &\geq& \ccSum{j: \qplambda^TA_j <0}{}{ \qplambda^TA_j u_j } \quad+\quad \ccSum{j: \qplambda^TA_j >0}{}{ \qplambda^TA_j l_j} - \qplambda^T \qpb & -\mbox{(by \f$\qpl\leq \qpx \leq \qpu\f$ and 2.)} \\ +\mbox{(by $\qpl\leq \qpx \leq \qpu$ and 2.)} \\ &>& 0 & \mbox{(by 3.)}, \end{array} \f] @@ -547,9 +547,9 @@ solution of (QP). The program (QP) is unbounded if an \f$n\f$-vector then \f$(A\qpw)_i\leq 0\f$ (\f$(A\qpw)_i\geq 0, (A\qpw)_i=0\f$, respectively).
  • \f[ \begin{array}{llll} -&&\geq 0 & \mbox{if \f$l_j\f$ is finite} \\ +&&\geq 0 & \mbox{if $l_j$ is finite} \\ w_j &\quad \\ -&&\leq 0 & \mbox{if \f$u_j\f$ is finite.} +&&\leq 0 & \mbox{if $u_j$ is finite.} \end{array} \f]
  • \f$\qpw^TD\qpw=0\f$ and \f$(\qpc^T+2{\qpx^*}^TD)\qpw<0\f$. diff --git a/QP_solver/doc/QP_solver/QP_solver.txt b/QP_solver/doc/QP_solver/QP_solver.txt index c7850995e6d..70410f95591 100644 --- a/QP_solver/doc/QP_solver/QP_solver.txt +++ b/QP_solver/doc/QP_solver/QP_solver.txt @@ -528,12 +528,12 @@ when we use the homogeneous representations of the points: if \f$ q_1,\ldots,q_n,q\in\mathbb{R}^{d+1}\f$ are homogeneous coordinates for \f$ p_1,\ldots,p_n,p\f$ with positive homogenizing coordinates \f$ h_1,\ldots,h_n,h\f$, we have -\f[$q_j = h_j \cdot (p_j \mid 1) \mbox{~for all $j$, and~} q = h \cdot +\f[q_j = h_j \cdot (p_j \mid 1) \mbox{~for all $j$, and~} q = h \cdot (p\mid 1).\f] Now, nonnegative \f$\lambda_1,\ldots,\lambda_n\f$ are suitable coefficients for a convex combination if and only if \f[\ccSum{j=1}{n}{~ \lambda_j(p_j \mid 1)} = (p\mid 1), \f] equivalently, if there are \f$\mu_1,\ldots,\mu_n\f$ -(with \f$\mu_j = \lambda_j \cdot h/{h_j}\f$ for all \f$j\f$) such that +(with \f$\mu_j = \lambda_j \cdot h/{h_j}\f$ for all $j$) such that \f[\ccSum{j=1}{n}{~\mu_j~q_j} = q, \quad \mu_j \geq 0\mbox{~for all $j$}.\f] The linear program now tests for the existence of nonnegative \f$ \mu_j\f$ diff --git a/Ridges_3/doc/Ridges_3/Ridges_3.txt b/Ridges_3/doc/Ridges_3/Ridges_3.txt index ab9993f0822..8bbb53826c8 100644 --- a/Ridges_3/doc/Ridges_3/Ridges_3.txt +++ b/Ridges_3/doc/Ridges_3/Ridges_3.txt @@ -113,20 +113,16 @@ The Taylor expansion of \f$ k_1\f$ (resp. \f$ k_2\f$) along the max by \f$ x\f$ (resp. \f$ y\f$) are: \anchor eqtaylor_along_line -\f[ -\begin{equation} +\f{equation}{ k_1(x) = k_1 + b_0x + \frac{P_1}{2(k_1-k_2)}x^2 + ... , \quad \quad \quad P_1= 3b_1^2+(k_1-k_2)(c_0-3k_1^3). -\end{equation} -\f] +\f} \anchor eqtaylor_along_red_line -\f[ -\begin{equation} +\f{equation}{ k_2(y) = k_2 + b_3y + \frac{P_2}{2(k_2-k_1)}y^2 + ... , \quad \quad \quad P_2= 3b_2^2+(k_2-k_1)(c_4-3k_2^3). -\end{equation} -\f] +\f} Notice also that switching from one to the other of the two afore-mentioned coordinate systems reverts the sign of all the odd diff --git a/Spatial_searching/doc/Spatial_searching/CGAL/Splitters.h b/Spatial_searching/doc/Spatial_searching/CGAL/Splitters.h index 5f6fe92cb62..19a379dfad3 100644 --- a/Spatial_searching/doc/Spatial_searching/CGAL/Splitters.h +++ b/Spatial_searching/doc/Spatial_searching/CGAL/Splitters.h @@ -160,7 +160,7 @@ namespace CGAL { Implements the midpoint of max spread splitting rule. A rectangle is cut through \f$ (\mathrm{Mind}+\mathrm{Maxd})/2\f$ orthogonal -to the dimension with the maximum point spread \f$ [\mathrm{Mind},\matrm{Maxd}]\f$. +to the dimension with the maximum point spread \f$ [\mathrm{Mind},\mathrm{Maxd}]\f$. \cgalHeading{Parameters} diff --git a/Surface_mesh_deformation/doc/Surface_mesh_deformation/Surface_mesh_deformation.txt b/Surface_mesh_deformation/doc/Surface_mesh_deformation/Surface_mesh_deformation.txt index b5df4208507..9368c7905a8 100644 --- a/Surface_mesh_deformation/doc/Surface_mesh_deformation/Surface_mesh_deformation.txt +++ b/Surface_mesh_deformation/doc/Surface_mesh_deformation/Surface_mesh_deformation.txt @@ -255,12 +255,10 @@ The Laplacian representation (referred to as Laplace coordinatesencode the local neighborhood of a vertex in the surface mesh. In this representation, a vertex \f$ \mathbf{v}_i \f$ is associated a 3D vector defined as: -\f[ -\begin{equation} +\f{equation}{ L(\mathbf{v}_i) = \sum_{\mathbf{v}_j \in N(\mathbf{v}_i)} w_{ij}(\mathbf{v}_i - \mathbf{v}_j), \label{eq:lap_open} -\end{equation} -\f] +\f} where: - \f$N(\mathbf{v}_i)\f$ denotes the set of vertices adjacent to \f$\mathbf{v}_i\f$; @@ -282,12 +280,10 @@ Laplacian representation of \f$ v_i \f$ with uniform weights: the red square ver Considering a surface mesh with \f$n\f$ vertices, it is possible to define its Laplacian representation \f$\Delta\f$ as a \f$n \times 3\f$ matrix: -\f[ -\begin{equation} +\f{equation}{ \mathbf{L}\mathbf{V} = \Delta, \label{eq:lap_system} -\end{equation} -\f] +\f} where: - \f$\mathbf{L}\f$ is a \f$n \times n\f$ sparse matrix, referred to as the Laplacian matrix. Its elements \f$ m_{ij} \f$, \f$i,j \in \{1 \dots n\} \f$ are defined as follows: @@ -313,8 +309,7 @@ This package supports hard constraints, that is, target positions of control ver Given a surface mesh deformation system with a ROI made of \f$ n \f$ vertices and \f$ k \f$ control vertices, we consider the following linear system: -\f[ -\begin{equation} +\f{equation}{ \left[ \begin{array}{ccc} \mathbf{L}_f\\ @@ -329,8 +324,7 @@ Given a surface mesh deformation system with a ROI made of \f$ n \f$ vertices an \end{array} \right], \label{eq:lap_energy_system} -\end{equation} -\f] +\f} where: - \f$\mathbf{V}\f$ is a \f$n \times 3\f$ matrix denoting the unknowns of the system that represent the vertex coordinates after deformation. The system is built so that the \f$ k \f$ last rows correspond to the control vertices. @@ -348,14 +342,12 @@ preserves the Laplacian representation of the surface mesh restricted to the unc Given a surface mesh \f$M\f$ with \f$ n \f$ vertices \f$ \{\mathbf{v}_i\} i \in \{1 \dots n \} \f$ and some deformation constraints, we consider the following energy function: -\f[ -\begin{equation} +\f{equation}{ \sum_{\mathbf{v}_i \in M} \sum_{\mathbf{v}_j \in N(\mathbf{v}_i)} w_{ij} \left\| (\mathbf{v}'_i - \mathbf{v}'_j) - \mathbf{R}_i(\mathbf{v}_i - \mathbf{v}_j) \right\|^2, \label{eq:arap_energy} -\end{equation} -\f] +\f} where: - \f$\mathbf{R}_i\f$ is a \f$ 3 \times 3 \f$ rotation matrix @@ -387,12 +379,10 @@ Each such term of the energy is minimized by using a two-step optimization appro In the first step, the positions of the vertices are considered as fixed so that the rotation matrices are the only unknowns. For the vertex \f$\mathbf{v}_i\f$, we consider the covariance matrix \f$\mathbf{S}_i\f$: -\f[ -\begin{equation} +\f{equation}{ \mathbf{S}_i = \sum_{\mathbf{v}_j \in N(\mathbf{v}_i)} w_{ij} (\mathbf{v}_i - \mathbf{v}_j)(\mathbf{v}'_i - \mathbf{v}'_j)^T, \label{eq:cov_matrix} -\end{equation} -\f] +\f} It was shown \cgalCite{Sorkine2009LeastSquaresRigid} that minimizing the energy contribution of \f$\mathbf{v}_i\f$ in Eq. \f$\eqref{eq:arap_energy}\f$ is equivalent to maximizing the trace of the matrix @@ -404,13 +394,11 @@ In the second step, the rotation matrices are substituted into the partial deriv with respect to \f$\mathbf{v}'_i\f$. Assuming the weights are symmetric, setting the derivative to zero results in the following equation: -\f[ -\begin{equation} +\f{equation}{ \sum_{\mathbf{v}_j \in N(\mathbf{v}_i)} w_{ij}(\mathbf{v}'_i - \mathbf{v}'_j) = \sum_{\mathbf{v}_j \in N(\mathbf{v}_i)} w_{ij} \frac{(\mathbf{R}_i + \mathbf{R}_j)}{2} (\mathbf{v}_i - \mathbf{v}_j). \label{eq:lap_ber} -\end{equation} -\f] +\f} The left-hand side of this equation corresponds to the one of Eq.\f$\eqref{eq:lap_open}\f$, and we can set \f$\Delta\f$ to be the right-hand side. @@ -428,13 +416,11 @@ The original algorithm \cgalCite{Sorkine2007AsRigidAs} we described assumes that - the weight between two vertices is symmetric. In order to support asymmetric weights in our implementation, we slightly change Eq. \f$\eqref{eq:lap_ber}\f$ to: -\f[ -\begin{equation} +\f{equation}{ \sum_{\mathbf{v}_j \in N(\mathbf{v}_i)} (w_{ij} + w_{ji})(\mathbf{v}'_i - \mathbf{v}'_j) = \sum_{\mathbf{v}_j \in N(\mathbf{v}_i)} (w_{ij}\mathbf{R}_i + w_{ji}\mathbf{R}_j)(\mathbf{v}_i - \mathbf{v}_j). \label{eq:lap_ber_asym} -\end{equation} -\f] +\f} - The energy contribution of each vertex is positive. If the weight between two vertices is always positive, this is always the case. However, when using the cotangent weighting scheme (the default in our implementation), if the sum of the angles opposite to an edge is greater than \f$ \pi \f$, @@ -448,14 +434,12 @@ A method minimizing another energy function is described next to avoid the latte The elastic energy function proposed by \cgalCite{Chao2010SimpleGeomModel} additionally takes into account all the opposite edges in the facets incident to a vertex. The energy function to minimize becomes: -\f[ -\begin{equation} +\f{equation}{ \sum_{\mathbf{v}_i \in M} \sum_{(\mathbf{v}_j, \mathbf{v}_k) \in E(\mathbf{v}_i)} w_{jk} \left\| (\mathbf{v}'_j - \mathbf{v}'_k) - \mathbf{R}_i(\mathbf{v}_j - \mathbf{v}_k) \right\|^2, \label{eq:arap_energy_rims} -\end{equation} -\f] +\f} where \f$E(\mathbf{v}_i)\f$ consists of the set of edges incident to \f$\mathbf{v}_i\f$ (the spokes) and the set of edges in the link (the rims) of \f$\mathbf{v}_i\f$ in the surface mesh \f$M\f$ @@ -470,23 +454,19 @@ The method to get the new positions of the unconstrained vertices is similar to method explained in \ref SMD_Overview_ARAP. For the first step, the Eq. \f$\eqref{eq:cov_matrix}\f$ is modified to take into account the edges in \f$E(\mathbf{v}_i)\f$: -\f[ -\begin{equation} +\f{equation}{ \mathbf{S}_i = \sum_{(\mathbf{v}_j, \mathbf{v}_k) \in E(\mathbf{v}_i)} w_{jk} (\mathbf{v}_j - \mathbf{v}_k)(\mathbf{v}'_j - \mathbf{v}'_k)^T, \label{eq:cov_matrix_sr} -\end{equation} -\f] +\f} For the second step, setting partial derivative of Eq. \f$\eqref{eq:arap_energy_rims}\f$ to zero with respect to \f$\mathbf{v}_i\f$ gives the following equation: -\f[ -\begin{equation} +\f{equation}{ \sum_{\mathbf{v}_j \in N(\mathbf{v}_i)} (w_{ij} + w_{ji})(\mathbf{v}'_i - \mathbf{v}'_j) = \sum_{\mathbf{v}_j \in N(\mathbf{v}_i)} \frac{w_{ij}(\mathbf{R}_i + \mathbf{R}_j + \mathbf{R}_m) + w_{ji}(\mathbf{R}_i + \mathbf{R}_j + \mathbf{R}_n)}{3} (\mathbf{v}_i - \mathbf{v}_j). \label{eq:lap_ber_rims} -\end{equation} -\f] +\f} where \f$\mathbf{R}_m\f$ and \f$\mathbf{R}_n\f$ are the rotation matrices of the vertices \f$\mathbf{v}_m\f$, \f$\mathbf{v}_n\f$ which are the opposite vertices of the edge \f$\mathbf{v}_i \mathbf{v}_j\f$ @@ -504,14 +484,12 @@ The implementation in this package uses the cotangent weights by default (negati \subsection SMD_Overview_SRE_ARAP Smoothed Rotation Enhanced As-Rigid-As Possible (SR_ARAP) Deformation Using 1-ring elements, SR-ARAP adds a bending element to Eq. \f$\eqref{eq:arap_energy}\f$: -\f[ -\begin{equation} +\f{equation}{ \sum_{\mathbf{v}_i \in M} \sum_{\mathbf{v}_j \in N(\mathbf{v}_i)} w_{ij} \left\| (\mathbf{v}'_i - \mathbf{v}'_j) - \mathbf{R}_i(\mathbf{v}_i - \mathbf{v}_j) \right\|^2 + \alpha A \left\| \mathbf{R}_i - \mathbf{R}_j \right\|^2_F \label{eq:sre_arap_energy} -\end{equation} -\f] +\f} where - \f$\alpha=0.02\f$ is a weighting coefficient. From d6f878f3616fd05a6d48801efb239a24a3ea408f Mon Sep 17 00:00:00 2001 From: albert-github Date: Sun, 9 Dec 2018 19:08:51 +0100 Subject: [PATCH 140/193] Problems with formulas in documentation Small regression (substitution should not have taken place). --- QP_solver/doc/QP_solver/QP_solver.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/QP_solver/doc/QP_solver/QP_solver.txt b/QP_solver/doc/QP_solver/QP_solver.txt index 70410f95591..b61aa94727e 100644 --- a/QP_solver/doc/QP_solver/QP_solver.txt +++ b/QP_solver/doc/QP_solver/QP_solver.txt @@ -533,7 +533,7 @@ when we use the homogeneous representations of the points: if suitable coefficients for a convex combination if and only if \f[\ccSum{j=1}{n}{~ \lambda_j(p_j \mid 1)} = (p\mid 1), \f] equivalently, if there are \f$\mu_1,\ldots,\mu_n\f$ -(with \f$\mu_j = \lambda_j \cdot h/{h_j}\f$ for all $j$) such that +(with \f$\mu_j = \lambda_j \cdot h/{h_j}\f$ for all \f$j\f$) such that \f[\ccSum{j=1}{n}{~\mu_j~q_j} = q, \quad \mu_j \geq 0\mbox{~for all $j$}.\f] The linear program now tests for the existence of nonnegative \f$ \mu_j\f$ From 6a5857cf6781641d05cb2cef175b39a430018c1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 10 Dec 2018 07:22:17 +0100 Subject: [PATCH 141/193] add missing : --- .../Straight_skeleton_2/CGAL/Straight_skeleton_converter_2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/Straight_skeleton_converter_2.h b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/Straight_skeleton_converter_2.h index 0497ab07c75..0c26fe5caac 100644 --- a/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/Straight_skeleton_converter_2.h +++ b/Straight_skeleton_2/doc/Straight_skeleton_2/CGAL/Straight_skeleton_converter_2.h @@ -100,7 +100,7 @@ boost::shared_ptr operator()( Source_skeleton const& s) const; \tparam SrcSs type of the source straight skeleton \tparam TgtSs type of the target straight skeleton \tparam NTConverter a function object that must -provide `TgtSs:Traits::FT operator()(SrcSs::Traits::FT n)` that converts `n` to an +provide `TgtSs::Traits::FT operator()(SrcSs::Traits::FT n)` that converts `n` to an `TgtSs::Traits::FT` which has the same value. The default value of this parameter is `NT_converter`. \cgalModels `StraightSkeletonItemsConverter_2` From 37d05cd835e35d4c92392eaae60281e08b4552de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 10 Dec 2018 07:40:21 +0100 Subject: [PATCH 142/193] fix undefined control sequence in html --- .../CGAL/Approximate_min_ellipsoid_d.h | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/Bounding_volumes/doc/Bounding_volumes/CGAL/Approximate_min_ellipsoid_d.h b/Bounding_volumes/doc/Bounding_volumes/CGAL/Approximate_min_ellipsoid_d.h index c162a00c5aa..650ea1a75c5 100644 --- a/Bounding_volumes/doc/Bounding_volumes/CGAL/Approximate_min_ellipsoid_d.h +++ b/Bounding_volumes/doc/Bounding_volumes/CGAL/Approximate_min_ellipsoid_d.h @@ -13,28 +13,28 @@ x\in\E^d \mid x^T E x + x^T e + \eta\leq 0 \}\f$, where \f$ E\f$ is some positive definite matrix from the set \f$ \mathbb{R}^{d\times d}\f$, \f$ e\f$ is some real \f$ d\f$-vector, and \f$ \eta\in\mathbb{R}\f$. A pointset \f$ P\subseteq \E^d\f$ is called full-dimensional if its affine hull has dimension \f$ d\f$. -For a finite, full-dimensional pointset \f$ P\f$ we denote by \f$ \mel(P)\f$ the +For a finite, full-dimensional pointset \f$ P\f$ we denote by \f$ (P)\f$ the smallest ellipsoid that contains all points of \f$ P\f$; this ellipsoid exists and is unique. For a given finite and full-dimensional pointset \f$ P\subset \E^d\f$ and a real number \f$ \epsilon\ge 0\f$, we say that an ellipsoid \f$ {\cal -E}\subset\E^d\f$ is an \f$ (1+\epsilon)\f$-appoximation to \f$ \mel(P)\f$ if -\f$ P\subset {\cal E}\f$ and \f$ \vol({\cal E}) \leq (1+\epsilon) -\vol(\mel(P))\f$. In other words, an \f$ (1+\epsilon)\f$-approximation to -\f$ \mel(P)\f$ is an enclosing ellipsoid whose volume is by at most a +E}\subset\E^d\f$ is an \f$ (1+\epsilon)\f$-appoximation to \f$ (P)\f$ if +\f$ P\subset {\cal E}\f$ and \f$ ({\cal E}) \leq (1+\epsilon) +((P))\f$. In other words, an \f$ (1+\epsilon)\f$-approximation to +\f$ (P)\f$ is an enclosing ellipsoid whose volume is by at most a factor of \f$ 1+\epsilon\f$ larger than the volume of the smallest enclosing ellipsoid of \f$ P\f$. Given this notation, an object of class `Approximate_min_ellipsoid_d` represents an -\f$ (1+\epsilon)\f$-approximation to \f$ \mel(P)\f$ for a given finite and +\f$ (1+\epsilon)\f$-approximation to \f$ (P)\f$ for a given finite and full-dimensional multiset of points \f$ P\subset\E^d\f$ and a real constant \f$ \epsilon>0\f$.\cgalFootnote{A multiset is a set where elements may have multiplicity greater than \f$ 1\f$.} When an `Approximate_min_ellipsoid_d` object is constructed, an iterator over the points \f$ P\f$ and the number \f$ \epsilon\f$ have to be specified; the number \f$ \epsilon\f$ defines the desired approximation ratio \f$ 1+\epsilon\f$. The underlying algorithm will then -try to compute an \f$ (1+\epsilon)\f$-approximation to \f$ \mel(P)\f$, and one of +try to compute an \f$ (1+\epsilon)\f$-approximation to \f$ (P)\f$, and one of the following two cases takes place.
    • The algorithm determines that \f$ P\f$ is not full-dimensional (see @@ -44,7 +44,7 @@ the following two cases takes place. in all cases decide correctly whether \f$ P\f$ is full-dimensional or not. If `is_full_dimensional()` returns `false`, the points lie in such a "thin" subspace of \f$ \E^d\f$ that the algorithm is -incapable of computing an approximation to \f$ \mel(P)\f$. More +incapable of computing an approximation to \f$ (P)\f$. More precisely, if `is_full_dimensional()` returns `false`, there exist two parallel hyperplanes in \f$ \E^d\f$ with the points \f$ P\f$ in between so that the distance \f$ \delta\f$ between the hyperplanes is @@ -55,7 +55,7 @@ If \f$ P\f$ is not full-dimensional, linear algebra techniques should be used to determine an affine subspace \f$ S\f$ of \f$ \E^d\f$ that contains the points \f$ P\f$ as a (w.r.t.\ \f$ S\f$) full-dimensional pointset; once \f$ S\f$ is determined, the algorithm can be invoked again to compute an -approximation to (the lower-dimensional) \f$ \mel(P)\f$ in \f$ S\f$. Since +approximation to (the lower-dimensional) \f$ (P)\f$ in \f$ S\f$. Since `is_full_dimensional()` might (due to rounding errors, see above) return `false` even though \f$ P\f$ is full-dimensional, the lower-dimensional subspace \f$ S\f$ containing \f$ P\f$ need not exist. @@ -66,7 +66,7 @@ ellipsoid of the projected points within \f$ H\f$; the fitting can be done for instance using the `linear_least_squares_fitting()` function from the \cgal package `Principal_component_analysis`.
    • The algorithm determines that \f$ P\f$ is full-dimensional. In this -case, it provides an approximation \f$ {\cal E}\f$ to \f$ \mel(P)\f$, but +case, it provides an approximation \f$ {\cal E}\f$ to \f$ (P)\f$, but depending on the input problem (i.e., on the pair \f$ (P,\epsilon)\f$), it may not have achieved the desired approximation ratio but merely some worse approximation ratio \f$ 1+\epsilon'>1+\epsilon\f$. The @@ -126,7 +126,7 @@ Cholesky-decomposition. The algorithm's running time is To illustrate the usage of `Approximate_min_ellipsoid_d` we give two examples in 2D. The first program generates a random set \f$ P\subset\E^2\f$ and outputs the -points and a \f$ 1.01\f$-approximation of \f$ \mel(P)\f$ as an EPS-file, which +points and a \f$ 1.01\f$-approximation of \f$ (P)\f$ as an EPS-file, which you can view using gv, for instance. (In both examples you can change the variables `n` and `d` to experiment with the code.) @@ -202,7 +202,7 @@ typedef unspecified_type Axis_direction_iterator; /*! initializes `ame` to an \f$ (1+\epsilon)\f$-approximation of -\f$ \mel(P)\f$ with \f$ P\f$ being the set of points in the range +\f$ (P)\f$ with \f$ P\f$ being the set of points in the range [`first`,`last`). The number \f$ \epsilon\f$ in this will be at most `eps`, if possible. However, due to the limited precision in the algorithm's underlying arithmetic, it @@ -258,7 +258,7 @@ unsigned int number_of_points( ) const; returns a number \f$ \epsilon'\f$ such that the computed approximation is (under exact arithmetic) guaranteed to be an \f$ (1+\epsilon')\f$-approximation to -\f$ \mel(P)\f$. +\f$ (P)\f$. \pre `ame.is_full_dimensional() == true`. \post \f$ \epsilon'>0\f$. */ @@ -402,7 +402,7 @@ bool is_full_dimensional( ) const; /// An object `ame` is valid iff
      • `ame` contains all points of /// its defining set \f$ P\f$,
      • `ame` is an \f$ /// (1+\epsilon')\f$-approximation to the smallest ellipsoid \f$ -/// \mel(P)\f$ of \f$ P\f$,
      • The ellipsoid represented by `ame` +/// (P)\f$ of \f$ P\f$,
      • The ellipsoid represented by `ame` /// fulfills the inclusion ( \ref eqapproximate_min_ellipsoid_incl /// ).
      /// @{ @@ -424,7 +424,7 @@ bool is_valid( bool verbose = false) const; /*! Writes the points \f$ P\f$ and the computed approximation to -\f$ \mel(P)\f$ as an EPS-file under pathname `name`. \pre The dimension of points \f$ P\f$ must be \f$ 2\f$. +\f$ (P)\f$ as an EPS-file under pathname `name`. \pre The dimension of points \f$ P\f$ must be \f$ 2\f$. Note: this routine is provided as a debugging routine; future version of \cgal might not provide it anymore. From 8e75d21c384f2af08a135c0502fb154cf316b353 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 10 Dec 2018 08:00:57 +0100 Subject: [PATCH 143/193] fix maybe-uninitialized warning --- .../include/CGAL/Periodic_3_mesh_3/Protect_edges_sizing_field.h | 1 - Periodic_3_mesh_3/include/CGAL/refine_periodic_3_mesh_3.h | 1 - 2 files changed, 2 deletions(-) diff --git a/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_3/Protect_edges_sizing_field.h b/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_3/Protect_edges_sizing_field.h index 05b76b7b2ec..ef21d9dc89b 100644 --- a/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_3/Protect_edges_sizing_field.h +++ b/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_3/Protect_edges_sizing_field.h @@ -772,7 +772,6 @@ get_positions_with_vertex_at_extremity(const Bare_point& known_point, << " inverted order ? " << std::boolalpha << inverted_return_order << std::endl; #endif - CGAL_precondition(known_point != Bare_point()); CGAL_precondition(!domain_.is_loop(curve_index)); CGAL_precondition(extremity_points.size() == 2); diff --git a/Periodic_3_mesh_3/include/CGAL/refine_periodic_3_mesh_3.h b/Periodic_3_mesh_3/include/CGAL/refine_periodic_3_mesh_3.h index c39ed5d3d6b..53b57cb51b0 100644 --- a/Periodic_3_mesh_3/include/CGAL/refine_periodic_3_mesh_3.h +++ b/Periodic_3_mesh_3/include/CGAL/refine_periodic_3_mesh_3.h @@ -116,7 +116,6 @@ void project_points(C3T3& c3t3, const Weighted_point& vh_wp = c3t3.triangulation().point(vh); const Bare_point& vh_p = cp(vh_wp); const Bare_point new_point = helper.project_on_surface(vh, vh_p); - CGAL_assertion(new_point != Bare_point()); const FT sq_d = CGAL::squared_distance(new_point, vh_p); From 284e374df6e331b50d65559640d00b844cb5642c Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Mon, 10 Dec 2018 08:49:17 +0100 Subject: [PATCH 144/193] Subdivision:methods_3: Use deprecation warning --- .../Subdivision_methods_plugin.cpp | 11 +++++++---- .../Subdivision_method_3/subdivision_methods_3.h | 12 ++++++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Subdivision_methods/Subdivision_methods_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Subdivision_methods/Subdivision_methods_plugin.cpp index c5c3067099e..2b54e27cf3e 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Subdivision_methods/Subdivision_methods_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Subdivision_methods/Subdivision_methods_plugin.cpp @@ -11,7 +11,10 @@ #include "Scene_surface_mesh_item.h" #include "SMesh_type.h" #include + using namespace CGAL::Three; +namespace params = CGAL::parameters; + class Polyhedron_demo_subdivision_methods_plugin : public QObject, public Polyhedron_demo_plugin_helper @@ -81,7 +84,7 @@ void Polyhedron_demo_subdivision_methods_plugin::apply_loop(FaceGraphItem* item, time.start(); messages->information("Loop subdivision..."); QApplication::setOverrideCursor(Qt::WaitCursor); - CGAL::Subdivision_method_3::Loop_subdivision(*graph, nb_steps); + CGAL::Subdivision_method_3::Loop_subdivision(*graph, params::number_of_iterations(nb_steps)); messages->information(QString("ok (%1 ms)").arg(time.elapsed())); QApplication::restoreOverrideCursor(); item->invalidateOpenGLBuffers(); @@ -113,7 +116,7 @@ void Polyhedron_demo_subdivision_methods_plugin::apply_catmullclark(FaceGraphIte time.start(); messages->information("Catmull-Clark subdivision..."); QApplication::setOverrideCursor(Qt::WaitCursor); - CGAL::Subdivision_method_3::CatmullClark_subdivision(*graph, nb_steps); + CGAL::Subdivision_method_3::CatmullClark_subdivision(*graph, params::number_of_iterations(nb_steps)); messages->information(QString("ok (%1 ms)").arg(time.elapsed())); QApplication::restoreOverrideCursor(); item->invalidateOpenGLBuffers(); @@ -143,7 +146,7 @@ void Polyhedron_demo_subdivision_methods_plugin::apply_sqrt3(FaceGraphItem* item time.start(); messages->information("Sqrt-3 subdivision..."); QApplication::setOverrideCursor(Qt::WaitCursor); - CGAL::Subdivision_method_3::Sqrt3_subdivision(*graph, nb_steps); + CGAL::Subdivision_method_3::Sqrt3_subdivision(*graph, params::number_of_iterations(nb_steps)); messages->information(QString("ok (%1 ms)").arg(time.elapsed())); QApplication::restoreOverrideCursor(); item->invalidateOpenGLBuffers(); @@ -175,7 +178,7 @@ void Polyhedron_demo_subdivision_methods_plugin::apply_doosabin(FaceGraphItem* i time.start(); messages->information("Doo-Sabin subdivision..."); QApplication::setOverrideCursor(Qt::WaitCursor); - CGAL::Subdivision_method_3::DooSabin_subdivision(*graph, nb_steps); + CGAL::Subdivision_method_3::DooSabin_subdivision(*graph, params::number_of_iterations(nb_steps)); messages->information(QString("ok (%1 ms)").arg(time.elapsed())); QApplication::restoreOverrideCursor(); item->invalidateOpenGLBuffers(); diff --git a/Subdivision_method_3/include/CGAL/Subdivision_method_3/subdivision_methods_3.h b/Subdivision_method_3/include/CGAL/Subdivision_method_3/subdivision_methods_3.h index a00393d6ed3..41355110f38 100644 --- a/Subdivision_method_3/include/CGAL/Subdivision_method_3/subdivision_methods_3.h +++ b/Subdivision_method_3/include/CGAL/Subdivision_method_3/subdivision_methods_3.h @@ -95,10 +95,13 @@ namespace parameters = CGAL::parameters; #ifndef DOXYGEN_RUNNING // Backward compatibility +#ifndef CGAL_NO_DEPRECATED_CODE template +CGAL_DEPRECATED_MSG("you are using the deprecated API of CatmullClark_subdivision(), please update your code") void CatmullClark_subdivision(PolygonMesh& pmesh, int step = 1) { PQQ(pmesh, CatmullClark_mask_3(&pmesh, get(vertex_point,pmesh)), step); } +#endif #endif /*! @@ -142,10 +145,13 @@ void CatmullClark_subdivision(PolygonMesh& pmesh, const NamedParameters& np) { #ifndef DOXYGEN_RUNNING // backward compatibility +#ifndef CGAL_NO_DEPRECATED_CODE template +CGAL_DEPRECATED_MSG("you are using the deprecated API of Loop_subdivision(), please update your code") void Loop_subdivision(PolygonMesh& pmesh, int step = 1) { PTQ(pmesh, Loop_mask_3(&pmesh, get(vertex_point,pmesh)) , step); } +#endif #endif /*! @@ -187,11 +193,14 @@ void Loop_subdivision(PolygonMesh& pmesh, const NamedParameters& np) { #ifndef DOXYGEN_RUNNING // backward compatibility +#ifndef CGAL_NO_DEPRECATED_CODE template +CGAL_DEPRECATED_MSG("you are using the deprecated API of DooSabin_subdivision(), please update your code") void DooSabin_subdivision(PolygonMesh& pmesh, int step = 1) { DQQ(pmesh, DooSabin_mask_3(&pmesh, get(vertex_point, pmesh)), step); } #endif +#endif /*! * @@ -232,11 +241,14 @@ void DooSabin_subdivision(PolygonMesh& pmesh, const NamedParameters& np) { #ifndef DOXYGEN_RUNNING // backward compatibility +#ifndef CGAL_NO_DEPRECATED_CODE template +CGAL_DEPRECATED_MSG("you are using the deprecated API of Sqrt3_subdivision(), please update your code") void Sqrt3_subdivision(PolygonMesh& pmesh, int step = 1) { Sqrt3(pmesh, Sqrt3_mask_3(&pmesh, get(vertex_point,pmesh)), step); } #endif +#endif /*! * From 7dbe4b729e8e268667939e89100d91cf1f0da774 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 10 Dec 2018 17:45:41 +0100 Subject: [PATCH 145/193] fix memory leak --- .../Plugins/PMP/Mean_curvature_flow_skeleton_plugin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Mean_curvature_flow_skeleton_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Mean_curvature_flow_skeleton_plugin.cpp index cd7f6c5fbab..940fe1144d9 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Mean_curvature_flow_skeleton_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Mean_curvature_flow_skeleton_plugin.cpp @@ -872,7 +872,7 @@ Polyhedron_demo_mean_curvature_flow_skeleton_plugin::createContractedItem(Scene_ { if(!item) return; - if(item->mcs == NULL) + if(item->mcs != NULL) delete item->mcs; double omega_H = ui->omega_H->value(); double omega_P = ui->omega_P->value(); From e9065aeaba53c537c1e315395e928179aebf8ec8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 10 Dec 2018 17:55:39 +0100 Subject: [PATCH 146/193] init pole to avoid warnings --- .../include/CGAL/Mean_curvature_flow_skeletonization.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Surface_mesh_skeletonization/include/CGAL/Mean_curvature_flow_skeletonization.h b/Surface_mesh_skeletonization/include/CGAL/Mean_curvature_flow_skeletonization.h index cc403bb788a..ba18f094c0b 100644 --- a/Surface_mesh_skeletonization/include/CGAL/Mean_curvature_flow_skeletonization.h +++ b/Surface_mesh_skeletonization/include/CGAL/Mean_curvature_flow_skeletonization.h @@ -93,8 +93,8 @@ template < class Refs, class Point, class ID, class vertex_descriptor> struct Skel_HDS_vertex_type : public HalfedgeDS_vertex_max_base_with_id { typedef HalfedgeDS_vertex_max_base_with_id Base; - Skel_HDS_vertex_type() : Base (), is_fixed(false) {} - Skel_HDS_vertex_type( Point const& p) : Base(p), is_fixed(false) {} + Skel_HDS_vertex_type() : Base (), pole(ORIGIN), is_fixed(false) {} + Skel_HDS_vertex_type( Point const& p) : Base(p), pole(ORIGIN), is_fixed(false) {} std::vector vertices; Point pole; bool is_fixed; From 8da9e7ceec89191a218958bba9c09c0cca8ca856 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 7 Dec 2018 15:42:41 +0100 Subject: [PATCH 147/193] handle case of empty meshes --- .../Polygon_mesh_processing/corefinement.h | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/corefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/corefinement.h index 1f7383346ed..20127c0e8fb 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/corefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/corefinement.h @@ -441,6 +441,58 @@ corefine_and_compute_boolean_operations( return CGAL::make_array(true, true, true, true); } + // handle case of empty meshes (isolated vertices are ignored) + if (faces(tm1).empty()) + { + if(faces(tm2).empty()) + { + for (int i=0; i<4; ++i) + if (output[i] != boost::none) + clear(*(*output[i])); + return CGAL::make_array(true, true, true, true); + } + // tm2 is not empty + if (output[Corefinement::UNION] != boost::none) + if (&tm2 != *output[Corefinement::UNION]) + copy_face_graph(tm2, + *(*output[Corefinement::UNION]), + parameters::vertex_point_map(vpm2), + parameters::vertex_point_map(*cpp11::get(vpm_out_tuple))); + if (output[Corefinement::INTERSECTION] != boost::none) + clear(*(*output[Corefinement::INTERSECTION])); + if (output[Corefinement::TM1_MINUS_TM2] != boost::none) + clear(*(*output[Corefinement::TM1_MINUS_TM2])); + if (output[Corefinement::TM2_MINUS_TM1] != boost::none) + if (&tm2 != *output[Corefinement::TM2_MINUS_TM1]) + copy_face_graph(tm2, + *(*output[Corefinement::TM2_MINUS_TM1]), + parameters::vertex_point_map(vpm2), + parameters::vertex_point_map(*cpp11::get(vpm_out_tuple))); + return CGAL::make_array(true, true, true, true); + } + else + if (faces(tm2).empty()) + { + // tm1 is not empty + if (output[Corefinement::UNION] != boost::none) + if (&tm1 != *output[Corefinement::UNION]) + copy_face_graph(tm1, + *(*output[Corefinement::UNION]), + parameters::vertex_point_map(vpm1), + parameters::vertex_point_map(*cpp11::get(vpm_out_tuple))); + if (output[Corefinement::INTERSECTION] != boost::none) + clear(*(*output[Corefinement::INTERSECTION])); + if (output[Corefinement::TM2_MINUS_TM1] != boost::none) + clear(*(*output[Corefinement::TM2_MINUS_TM1])); + if (output[Corefinement::TM1_MINUS_TM2] != boost::none) + if (&tm1 != *output[Corefinement::TM1_MINUS_TM2]) + copy_face_graph(tm1, + *(*output[Corefinement::TM1_MINUS_TM2]), + parameters::vertex_point_map(vpm1), + parameters::vertex_point_map(*cpp11::get(vpm_out_tuple))); + return CGAL::make_array(true, true, true, true); + } + // Edge is-constrained maps //for input meshes typedef typename boost::lookup_named_param_def < From fa52560c62149f15fbad480bbc20538923150afb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 7 Dec 2018 15:42:41 +0100 Subject: [PATCH 148/193] handle case of empty meshes --- .../Polygon_mesh_processing/corefinement.h | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/corefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/corefinement.h index c6f4c83e0fd..dec93d03966 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/corefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/corefinement.h @@ -329,6 +329,62 @@ boolean_operation( TriangleMesh& tm1, return CGAL::make_array(true, true, true, true); } + // handle case of empty meshes (isolated vertices are ignored) + if (faces(tm1).empty()) + { + if(faces(tm2).empty()) + { + for (int i=0; i<4; ++i) + if (desired_output[i] != boost::none) + clear(*(*desired_output[i])); + return CGAL::make_array(true, true, true, true); + } + // tm2 is not empty + if (desired_output[Corefinement::UNION] != boost::none) + if (&tm2 != *desired_output[Corefinement::UNION]) + copy_face_graph(tm2, + *(*desired_output[Corefinement::UNION]), + Emptyset_iterator(), Emptyset_iterator(), Emptyset_iterator(), + vpm2, + vpm_out[Corefinement::UNION]); + if (desired_output[Corefinement::INTER] != boost::none) + clear(*(*desired_output[Corefinement::INTER])); + if (desired_output[Corefinement::TM1_MINUS_TM2] != boost::none) + clear(*(*desired_output[Corefinement::TM1_MINUS_TM2])); + if (desired_output[Corefinement::TM2_MINUS_TM1] != boost::none) + if (&tm2 != *desired_output[Corefinement::TM2_MINUS_TM1]) + copy_face_graph(tm2, + *(*desired_output[Corefinement::TM2_MINUS_TM1]), + Emptyset_iterator(), Emptyset_iterator(), Emptyset_iterator(), + vpm2, + vpm_out[Corefinement::TM2_MINUS_TM1]); + return CGAL::make_array(true, true, true, true); + } + else + if (faces(tm2).empty()) + { + // tm1 is not empty + if (desired_output[Corefinement::UNION] != boost::none) + if (&tm1 != *desired_output[Corefinement::UNION]) + copy_face_graph(tm1, + *(*desired_output[Corefinement::UNION]), + Emptyset_iterator(), Emptyset_iterator(), Emptyset_iterator(), + vpm1, + vpm_out[Corefinement::UNION]); + if (desired_output[Corefinement::INTER] != boost::none) + clear(*(*desired_output[Corefinement::INTER])); + if (desired_output[Corefinement::TM2_MINUS_TM1] != boost::none) + clear(*(*desired_output[Corefinement::TM2_MINUS_TM1])); + if (desired_output[Corefinement::TM1_MINUS_TM2] != boost::none) + if (&tm1 != *desired_output[Corefinement::TM1_MINUS_TM2]) + copy_face_graph(tm1, + *(*desired_output[Corefinement::TM1_MINUS_TM2]), + Emptyset_iterator(), Emptyset_iterator(), Emptyset_iterator(), + vpm1, + vpm_out[Corefinement::TM1_MINUS_TM2]); + return CGAL::make_array(true, true, true, true); + } + // Edge is-constrained maps //for input meshes typedef typename boost::lookup_named_param_def < From 9c3008ebd0221ada34bba81d9aa4c8aef9968293 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Mon, 10 Dec 2018 09:36:44 +0100 Subject: [PATCH 149/193] Fix warnings in doc --- .../include/CGAL/Optimal_transportation_reconstruction_2.h | 2 +- Three/include/CGAL/Three/Triangle_container.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Optimal_transportation_reconstruction_2/include/CGAL/Optimal_transportation_reconstruction_2.h b/Optimal_transportation_reconstruction_2/include/CGAL/Optimal_transportation_reconstruction_2.h index 091f7e95460..b7567d84d86 100644 --- a/Optimal_transportation_reconstruction_2/include/CGAL/Optimal_transportation_reconstruction_2.h +++ b/Optimal_transportation_reconstruction_2/include/CGAL/Optimal_transportation_reconstruction_2.h @@ -1534,7 +1534,7 @@ public: `false` if the algorithm was prematurely ended because no more edge collapse was possible. */ - bool run(const unsigned steps) { + bool run(const unsigned int steps) { m_tolerance = (FT)(-1.); CGAL::Real_timer timer; if (m_verbose > 0) diff --git a/Three/include/CGAL/Three/Triangle_container.h b/Three/include/CGAL/Three/Triangle_container.h index ecea0b1ed69..b85092be9b5 100644 --- a/Three/include/CGAL/Three/Triangle_container.h +++ b/Three/include/CGAL/Three/Triangle_container.h @@ -89,6 +89,7 @@ struct DEMO_FRAMEWORK_EXPORT Triangle_container :public Primitive_container /// If the shaders of this program doesn't need one, you can ignore it. /// The others should be filled at each `draw()` from the item. ///@{ + //! getter for the "shrink_factor" parameter float getShrinkFactor(); //! getter for the "plane" parameter From cbd4d97998bd1c2bd4606048b181c4f7e7e62771 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Tue, 11 Dec 2018 10:30:58 +0100 Subject: [PATCH 150/193] Fix a [-Wconversion] warning --- CGAL_ImageIO/include/CGAL/ImageIO_impl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CGAL_ImageIO/include/CGAL/ImageIO_impl.h b/CGAL_ImageIO/include/CGAL/ImageIO_impl.h index da049f853db..6e8ec0ffb05 100644 --- a/CGAL_ImageIO/include/CGAL/ImageIO_impl.h +++ b/CGAL_ImageIO/include/CGAL/ImageIO_impl.h @@ -168,7 +168,7 @@ unsigned int ImageIO_limit_len(size_t to_be_read) CGAL_INLINE_FUNCTION size_t ImageIO_write(const _image *im, const void *buf, size_t len) { size_t to_be_written = len; - int l = -1; + std::ptrdiff_t l = -1; char *b = (char*)buf; switch(im->openMode) { From 71563a3338618b1fc4ebc6efc3e3013e432e628e Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Tue, 11 Dec 2018 10:31:12 +0100 Subject: [PATCH 151/193] Fix a [-Wmaybe-uninitialized] warning --- Mesh_3/test/Mesh_3/test_c3t3_with_features.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Mesh_3/test/Mesh_3/test_c3t3_with_features.cpp b/Mesh_3/test/Mesh_3/test_c3t3_with_features.cpp index abb6cdf0909..9255e725f81 100644 --- a/Mesh_3/test/Mesh_3/test_c3t3_with_features.cpp +++ b/Mesh_3/test/Mesh_3/test_c3t3_with_features.cpp @@ -314,7 +314,9 @@ struct Tester // Test edge iterators //------------------------------------------------------- std::cout << "Test edge iterators\n"; - const Edge& edge_to_modify = *(c3t3.edges_in_complex_begin()); + typename C3t3::Edges_in_complex_iterator eit = c3t3.edges_in_complex_begin(); + assert(eit != c3t3.edges_in_complex_end()); + const Edge& edge_to_modify = *eit; c3t3.remove_from_complex(edge_to_modify); c3t3.add_to_complex(edge_to_modify,curve_index_bis); From 548f86b98bba4cd53c8607f55fad6dc3cf6f955f Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Tue, 11 Dec 2018 14:35:25 +0100 Subject: [PATCH 152/193] Check stream state before allocating memory. --- Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h index ce5490de872..b5099136f3e 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h @@ -2098,7 +2098,9 @@ private: //------------------------------------------------------- private data CGAL_assertion( (off == "OFF") || (off == "COFF") || (off == "NOFF") || (off == "CNOFF")); is >> n >> f >> e; - + if(!is){ + return false; + } sm.reserve(sm.num_vertices()+n, sm.num_faces()+2*f, sm.num_edges()+e); std::vector vertexmap(n); P p; @@ -2151,6 +2153,10 @@ private: //------------------------------------------------------- private data for(int i=0; i < f; i++){ is >> sm_skip_comments; is >> d; + if(!is){ + sm.clear(); + return false; + } vr.resize(d); for(std::size_t j=0; j> vi; From b04369cc6b78c5f1ccf42b9e36a57f0065931b35 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Tue, 11 Dec 2018 14:55:00 +0100 Subject: [PATCH 153/193] Don't assert OFF type --- Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h index b5099136f3e..947c0c8aeae 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h @@ -2095,8 +2095,14 @@ private: //------------------------------------------------------- private data std::string off; is >> sm_skip_comments; is >> off; - CGAL_assertion( (off == "OFF") || (off == "COFF") || (off == "NOFF") || (off == "CNOFF")); - + if(! ( + (off == "OFF") || (off == "COFF") || (off == "NOFF") || (off == "CNOFF") + ) + ) + { + is.setstate(std::ios::failbit); + return false; + } is >> n >> f >> e; if(!is){ return false; From 8f9510c3a469bd2148a3c5f2c55a0badb30a8609 Mon Sep 17 00:00:00 2001 From: albert-github Date: Tue, 11 Dec 2018 19:31:25 +0100 Subject: [PATCH 154/193] XHTML Problems regarding tag sequences XHTML is strict regarding tag sequences (contrary to HTML) in out case most of the times missing or superfluous p tags. --- .../Algebraic_kernel_d/Algebraic_kernel_d.txt | 10 +++--- .../Arrangement_on_surface_2.txt | 4 +-- Documentation/doc/CMakeLists.txt | 2 +- .../doc/resources/1.8.14/BaseDoxyfile.in | 34 +++++++++---------- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Algebraic_kernel_d/doc/Algebraic_kernel_d/Algebraic_kernel_d.txt b/Algebraic_kernel_d/doc/Algebraic_kernel_d/Algebraic_kernel_d.txt index 52cdc3b4292..d6082d26967 100644 --- a/Algebraic_kernel_d/doc/Algebraic_kernel_d/Algebraic_kernel_d.txt +++ b/Algebraic_kernel_d/doc/Algebraic_kernel_d/Algebraic_kernel_d.txt @@ -325,27 +325,27 @@ efficiency. The following example illustrates the construction of `AlgebraicKernel_d_1::Algebraic_real_1` using `AlgebraicKernel_d_1::Construct_algebraic_real_1`: -\cgalExample{Algebraic_kernel_d/Construct_algebraic_real_1.cpp} +\cgalExample{Algebraic_kernel_d/Construct_algebraic_real_1.cpp} \subsection CGALAK1Solving Solving Univariate Polynomials The following example illustrates the construction of `AlgebraicKernel_d_1::Algebraic_real_1` -using `AlgebraicKernel_d_1::Solve_1`: \cgalExample{Algebraic_kernel_d/Solve_1.cpp} +using `AlgebraicKernel_d_1::Solve_1`: \cgalExample{Algebraic_kernel_d/Solve_1.cpp} \subsection CGALAK1EGCompare_1 Comparison and Approximation of Algebraic Real Numbers The following example illustrates the comparison of `AlgebraicKernel_d_1::Algebraic_real_1` numbers: -\cgalExample{Algebraic_kernel_d/Compare_1.cpp} +\cgalExample{Algebraic_kernel_d/Compare_1.cpp} \subsection CGALAK1EGIsolate_1 Isolation of Algebraic Real Numbers with respect to roots of other polynomials The following example illustrates the isolation of `AlgebraicKernel_d_1::Algebraic_real_1` numbers: -\cgalExample{Algebraic_kernel_d/Isolate_1.cpp} +\cgalExample{Algebraic_kernel_d/Isolate_1.cpp} \subsection CGALAK1EGSign_at_1 Interplay with Polynomials The following example illustrates the sign evaluation of `AlgebraicKernel_d_1::Algebraic_real_1` numbers in polynomials: -\cgalExample{Algebraic_kernel_d/Sign_at_1.cpp} +\cgalExample{Algebraic_kernel_d/Sign_at_1.cpp} \section Algebraic_kernel_dDesign Design and Implementation History diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Arrangement_on_surface_2.txt b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Arrangement_on_surface_2.txt index 719b0deceed..ad8d8120b55 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Arrangement_on_surface_2.txt +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Arrangement_on_surface_2.txt @@ -2209,10 +2209,10 @@ representing line segments. A polyline can be constructed given one of the following inputs: -- A range of \a points, where two succeeding points in the +- A range of points, where two succeeding points in the range represent the endpoints of a segment of the polyline. -- A range of \a segments. Note that , if the types +- A range of segments. Note that , if the types `SubcurveTraits_2::Curve_2` and `SubcurveTraits_2::X_monotone_curve_2` are not the same, then when `Make_x_monotone_2` is invoked the segments that compose the polyline will be broken into \f$x\f$-monotone diff --git a/Documentation/doc/CMakeLists.txt b/Documentation/doc/CMakeLists.txt index 3e630a9ae3e..c45057f806d 100644 --- a/Documentation/doc/CMakeLists.txt +++ b/Documentation/doc/CMakeLists.txt @@ -93,7 +93,7 @@ function(configure_doxygen_package CGAL_PACKAGE_NAME) file(APPEND ${CGAL_DOC_PACKAGE_DEFAULTS} "STRIP_FROM_INC_PATH = ${CGAL_PACKAGE_DOC_DIR}/\n") file(APPEND ${CGAL_DOC_PACKAGE_DEFAULTS} "STRIP_FROM_INC_PATH += ${CGAL_PACKAGE_DIR}/include/\n") file(APPEND ${CGAL_DOC_PACKAGE_DEFAULTS} "ALIASES += \"cgalPkgDescriptionBegin{2}=\\details \"\n") - file(APPEND ${CGAL_DOC_PACKAGE_DEFAULTS} "ALIASES += \"cgalPkgManuals{2}=
      \"\n") + file(APPEND ${CGAL_DOC_PACKAGE_DEFAULTS} "ALIASES += \"cgalPkgManuals{2}=
      \"\n") file(APPEND ${CGAL_DOC_PACKAGE_DEFAULTS} "INPUT = ${CGAL_PACKAGE_DOC_DIR}\n") if(NOT EXISTS "${CGAL_PACKAGE_DOC_DIR}/CGAL") # This package has in-source documentation. diff --git a/Documentation/doc/resources/1.8.14/BaseDoxyfile.in b/Documentation/doc/resources/1.8.14/BaseDoxyfile.in index 9bc583f5cd8..77233259e85 100644 --- a/Documentation/doc/resources/1.8.14/BaseDoxyfile.in +++ b/Documentation/doc/resources/1.8.14/BaseDoxyfile.in @@ -242,29 +242,29 @@ ALIASES = "sc{1}=\1File \ref \1 \include \1" \ "cgalFigureAnchor{1}=\anchor fig__\1" \ "cgalFigureRef{1}=\ref fig__\1" \ - "cgalFigureBegin{2}=\anchor fig__\1 ^^ \image html \2 ^^ \image latex \2 \"\" width=15cm ^^ \htmlonly
      \endhtmlonly \latexonly ^^ \endlatexonly ^^ \ref fig__\1" \ - "cgalFigureBegin{3}=\anchor fig__\1 ^^
      \image html \2 ^^ \image latex \2 \"\" width=7.5cm ^^ \image html \3 ^^ \image latex \3 \"\" width=7.5cm ^^
      \htmlonly
      \endhtmlonly ^^ \latexonly ^^ \endlatexonly \ref fig__\1" \ - "cgalFigureBegin{4}=\anchor fig__\1 ^^
      \image html \2 ^^ \image latex \2 \"\" width=5cm ^^ \image html \3 ^^ \image latex \3 \"\" width=5cm ^^ \image html \4 ^^ \image latex \4 \"\" width=5cm ^^
      \htmlonly
      \endhtmlonly ^^ \latexonly ^^ \endlatexonly \ref fig__\1" \ - "cgalFigureBegin{5}=\anchor fig__\1 ^^
      \image html \2 ^^ \image latex \2 \"\" width=3.75cm ^^ \image html \3 ^^ \image latex \3 \"\" width=3.75cm ^^ \image html \4 ^^ \image latex \4 \"\" width=3.75cm ^^ \image html \5 ^^ \image latex \5 \"\" width=3.75cm ^^
      \htmlonly
      \endhtmlonly ^^ \latexonly ^^ \endlatexonly \ref fig__\1" \ - "cgalFigureBegin{6}=\anchor fig__\1 ^^
      \image html \2 ^^ \image latex \2 \"\" width=3cm ^^ \image html \3 ^^ \image latex \3 \"\" width=3cm ^^ \image html \4 ^^ \image latex \4 \"\" width=3cm ^^ \image html \5 ^^ \image latex \5 \"\" width=3cm ^^ \image html \6 ^^ \image latex \6 \"\" width=3cm ^^
      \htmlonly
      \endhtmlonly ^^ \latexonly ^^ \endlatexonly \ref fig__\1" \ - "cgalFigureBegin{7}=\anchor fig__\1 ^^
      \image html \2 ^^ \image latex \2 \"\" width=2.5cm ^^ \image html \3 ^^ \image latex \3 \"\" width=2.5cm ^^ \image html \4 ^^ \image latex \4 \"\" width=2.5cm ^^ \image html \5 ^^ \image latex \5 \"\" width=2.5cm ^^ \image html \6 ^^ \image latex \6 \"\" width=2.5cm ^^ \image html \7 ^^ \image latex \7 \"\" width=2.5cm ^^
      \htmlonly
      \endhtmlonly ^^ \latexonly ^^ \endlatexonly \ref fig__\1" \ - "cgalFigureBegin{8}=\anchor fig__\1 ^^
      \image html \2 ^^ \image latex \2 \"\" width=2.1cm ^^ \image html \3 ^^ \image latex \3 \"\" width=2.1cm ^^ \image html \4 ^^ \image latex \4 \"\" width=2.1cm ^^ \image html \5 ^^ \image latex \5 \"\" width=2.1cm ^^ \image html \6 ^^ \image latex \6 \"\" width=2.1cm ^^ \image html \7 ^^ \image latex \7 \"\" width=2.1cm ^^ \image html \8 ^^ \image latex \8 \"\" width=2.1cm ^^
      \htmlonly
      \endhtmlonly ^^ \latexonly ^^ \endlatexonly \ref fig__\1" \ - "cgalFigureBegin{9}=\anchor fig__\1 ^^
      \image html \2 ^^ \image latex \2 \"\" width=1.9cm ^^ \image html \3 ^^ \image latex \3 \"\" width=1.9cm ^^ \image html \4 ^^ \image latex \4 \"\" width=1.9cm ^^ \image html \5 ^^ \image latex \5 \"\" width=1.9cm ^^ \image html \6 ^^ \image latex \6 \"\" width=1.9cm ^^ \image html \7 ^^ \image latex \7 \"\" width=1.9cm ^^ \image html \8 ^^ \image latex \8 \"\" width=1.9cm ^^ \image html \9 ^^ \image latex \9 \"\" width=1.9cm ^^
      \htmlonly
      \endhtmlonly ^^ \latexonly ^^ \endlatexonly \ref fig__\1" \ - "cgalFigureBegin{10}=\anchor fig__\1 ^^
      \image html \2 ^^ \image latex \2 \"\" width=1.6cm ^^ \image html \3 ^^ \image latex \3 \"\" width=1.6cm ^^ \image html \4 ^^ \image latex \4 \"\" width=1.6cm ^^ \image html \5 ^^ \image latex \5 \"\" width=1.6cm ^^ \image html \6 ^^ \image latex \6 \"\" width=1.6cm ^^ \image html \7 ^^ \image latex \7 \"\" width=1.6cm ^^ \image html \8 ^^ \image latex \8 \"\" width=1.6cm ^^ \image html \9 ^^ \image latex \9 \"\" width=1.6cm ^^ \image html \10 ^^ \image latex \10 \"\" width=1.6cm ^^
      \htmlonly
      \endhtmlonly ^^ \latexonly ^^ \endlatexonly \ref fig__\1" \ - "cgalFigureEnd=\htmlonly
      \endhtmlonly
      " \ - "cgalFigureCaptionBegin{1}=\htmlonly
      \endhtmlonly \ref fig__\1" \ - "cgalFigureCaptionEnd=\htmlonly
      \endhtmlonly
      " \ + "cgalFigureBegin{2}=\anchor fig__\1 ^^ \image html \2 ^^ \image latex \2 \"\" width=15cm ^^ \htmlonly[block]
      \endhtmlonly \latexonly ^^ \endlatexonly ^^ \ref fig__\1" \ + "cgalFigureBegin{3}=\anchor fig__\1 ^^
      \image html \2 ^^ \image latex \2 \"\" width=7.5cm ^^ \image html \3 ^^ \image latex \3 \"\" width=7.5cm ^^
      \htmlonly[block]
      \endhtmlonly ^^ \latexonly ^^ \endlatexonly \ref fig__\1" \ + "cgalFigureBegin{4}=\anchor fig__\1 ^^
      \image html \2 ^^ \image latex \2 \"\" width=5cm ^^ \image html \3 ^^ \image latex \3 \"\" width=5cm ^^ \image html \4 ^^ \image latex \4 \"\" width=5cm ^^
      \htmlonly[block]
      \endhtmlonly ^^ \latexonly ^^ \endlatexonly \ref fig__\1" \ + "cgalFigureBegin{5}=\anchor fig__\1 ^^
      \image html \2 ^^ \image latex \2 \"\" width=3.75cm ^^ \image html \3 ^^ \image latex \3 \"\" width=3.75cm ^^ \image html \4 ^^ \image latex \4 \"\" width=3.75cm ^^ \image html \5 ^^ \image latex \5 \"\" width=3.75cm ^^
      \htmlonly[block]
      \endhtmlonly ^^ \latexonly ^^ \endlatexonly \ref fig__\1" \ + "cgalFigureBegin{6}=\anchor fig__\1 ^^
      \image html \2 ^^ \image latex \2 \"\" width=3cm ^^ \image html \3 ^^ \image latex \3 \"\" width=3cm ^^ \image html \4 ^^ \image latex \4 \"\" width=3cm ^^ \image html \5 ^^ \image latex \5 \"\" width=3cm ^^ \image html \6 ^^ \image latex \6 \"\" width=3cm ^^
      \htmlonly[block]
      \endhtmlonly ^^ \latexonly ^^ \endlatexonly \ref fig__\1" \ + "cgalFigureBegin{7}=\anchor fig__\1 ^^
      \image html \2 ^^ \image latex \2 \"\" width=2.5cm ^^ \image html \3 ^^ \image latex \3 \"\" width=2.5cm ^^ \image html \4 ^^ \image latex \4 \"\" width=2.5cm ^^ \image html \5 ^^ \image latex \5 \"\" width=2.5cm ^^ \image html \6 ^^ \image latex \6 \"\" width=2.5cm ^^ \image html \7 ^^ \image latex \7 \"\" width=2.5cm ^^
      \htmlonly[block]
      \endhtmlonly ^^ \latexonly ^^ \endlatexonly \ref fig__\1" \ + "cgalFigureBegin{8}=\anchor fig__\1 ^^
      \image html \2 ^^ \image latex \2 \"\" width=2.1cm ^^ \image html \3 ^^ \image latex \3 \"\" width=2.1cm ^^ \image html \4 ^^ \image latex \4 \"\" width=2.1cm ^^ \image html \5 ^^ \image latex \5 \"\" width=2.1cm ^^ \image html \6 ^^ \image latex \6 \"\" width=2.1cm ^^ \image html \7 ^^ \image latex \7 \"\" width=2.1cm ^^ \image html \8 ^^ \image latex \8 \"\" width=2.1cm ^^
      \htmlonly[block]
      \endhtmlonly ^^ \latexonly ^^ \endlatexonly \ref fig__\1" \ + "cgalFigureBegin{9}=\anchor fig__\1 ^^
      \image html \2 ^^ \image latex \2 \"\" width=1.9cm ^^ \image html \3 ^^ \image latex \3 \"\" width=1.9cm ^^ \image html \4 ^^ \image latex \4 \"\" width=1.9cm ^^ \image html \5 ^^ \image latex \5 \"\" width=1.9cm ^^ \image html \6 ^^ \image latex \6 \"\" width=1.9cm ^^ \image html \7 ^^ \image latex \7 \"\" width=1.9cm ^^ \image html \8 ^^ \image latex \8 \"\" width=1.9cm ^^ \image html \9 ^^ \image latex \9 \"\" width=1.9cm ^^
      \htmlonly[block]
      \endhtmlonly ^^ \latexonly ^^ \endlatexonly \ref fig__\1" \ + "cgalFigureBegin{10}=\anchor fig__\1 ^^
      \image html \2 ^^ \image latex \2 \"\" width=1.6cm ^^ \image html \3 ^^ \image latex \3 \"\" width=1.6cm ^^ \image html \4 ^^ \image latex \4 \"\" width=1.6cm ^^ \image html \5 ^^ \image latex \5 \"\" width=1.6cm ^^ \image html \6 ^^ \image latex \6 \"\" width=1.6cm ^^ \image html \7 ^^ \image latex \7 \"\" width=1.6cm ^^ \image html \8 ^^ \image latex \8 \"\" width=1.6cm ^^ \image html \9 ^^ \image latex \9 \"\" width=1.6cm ^^ \image html \10 ^^ \image latex \10 \"\" width=1.6cm ^^
      \htmlonly[block]
      \endhtmlonly ^^ \latexonly ^^ \endlatexonly \ref fig__\1" \ + "cgalFigureEnd=\htmlonly[block]
      \endhtmlonly
      " \ + "cgalFigureCaptionBegin{1}=\htmlonly[block]
      \endhtmlonly \ref fig__\1" \ + "cgalFigureCaptionEnd=\htmlonly[block]
      \endhtmlonly
      " \ "cgalConcept=\details
      ^^ \brief" \ "cgalConceptNamespace=\details
      ^^ \brief" \ "cgalRefines=\xrefitem refines \"Refines\" \"Refinement Relationships\"" \ "cgalModels=\xrefitem models \"Is Model Of\" \"Is Model Relationships\"" \ "cgalGeneralizes=\xrefitem generalizes \"Generalizes\" \"Generalization Relationships\"" \ "cgalHasModel=\xrefitem hasModels \"Has Models\" \"Has Model Relationships\"" \ - "cgalDebugBegin=\htmlonly
      Debugging Support
      \endhtmlonly ^^" \ - "cgalDebugEnd=\htmlonly
      \endhtmlonly" \ + "cgalDebugBegin=\htmlonly[block]
      Debugging Support
      \endhtmlonly ^^" \ + "cgalDebugEnd=\htmlonly[block]
      \endhtmlonly" \ "cgalDebugFunction=This is a function for debugging purpose." \ - "cgalAdvancedBegin=\htmlonly
      Advanced
      \endhtmlonly ^^" \ - "cgalAdvancedEnd=\htmlonly
      \endhtmlonly" \ + "cgalAdvancedBegin=\htmlonly[block]
      Advanced
      \endhtmlonly ^^" \ + "cgalAdvancedEnd=\htmlonly[block]
      \endhtmlonly" \ "cgalAdvancedFunction=This is an advanced function." \ "cgalAdvancedClass=This is an advanced class." \ "cgalRequiresCPP11=\warning This function requires a C++11 compiler." \ @@ -291,7 +291,7 @@ ALIASES = "sc{1}=\1\1
      " \ - "cgalClassifedRefPages=\htmlonly

      Classified Reference Pages

      \endhtmlonly" \ + "cgalClassifedRefPages=\htmlonly[block]

      Classified Reference Pages

      \endhtmlonly" \ "cgalCite{1}=\cite \1" # This tag can be used to specify a number of word-keyword mappings (TCL only). From 7e42c3064785ad5c62df2df3087de0ba82e441ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 12 Dec 2018 08:24:32 +0100 Subject: [PATCH 155/193] avoid extra `

      ` after figures --- Documentation/doc/resources/1.8.13/BaseDoxyfile.in | 4 ++-- Documentation/doc/resources/1.8.14/BaseDoxyfile.in | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Documentation/doc/resources/1.8.13/BaseDoxyfile.in b/Documentation/doc/resources/1.8.13/BaseDoxyfile.in index 49b2e2c11b3..e3f372bcf3d 100644 --- a/Documentation/doc/resources/1.8.13/BaseDoxyfile.in +++ b/Documentation/doc/resources/1.8.13/BaseDoxyfile.in @@ -250,9 +250,9 @@ ALIASES = "sc{1}=\1
      \image html \2 \n \image latex \2 \"\" width=2.1cm \n \image html \3 \n \image latex \3 \"\" width=2.1cm \n \image html \4 \n \image latex \4 \"\" width=2.1cm \n \image html \5 \n \image latex \5 \"\" width=2.1cm \n \image html \6 \n \image latex \6 \"\" width=2.1cm \n \image html \7 \n \image latex \7 \"\" width=2.1cm \n \image html \8 \n \image latex \8 \"\" width=2.1cm \n
      \htmlonly
      \endhtmlonly \n \latexonly \n \endlatexonly \ref fig__\1" \ "cgalFigureBegin{9}=\anchor fig__\1 \n
      \image html \2 \n \image latex \2 \"\" width=1.9cm \n \image html \3 \n \image latex \3 \"\" width=1.9cm \n \image html \4 \n \image latex \4 \"\" width=1.9cm \n \image html \5 \n \image latex \5 \"\" width=1.9cm \n \image html \6 \n \image latex \6 \"\" width=1.9cm \n \image html \7 \n \image latex \7 \"\" width=1.9cm \n \image html \8 \n \image latex \8 \"\" width=1.9cm \n \image html \9 \n \image latex \9 \"\" width=1.9cm \n
      \htmlonly
      \endhtmlonly \n \latexonly \n \endlatexonly \ref fig__\1" \ "cgalFigureBegin{10}=\anchor fig__\1 \n
      \image html \2 \n \image latex \2 \"\" width=1.6cm \n \image html \3 \n \image latex \3 \"\" width=1.6cm \n \image html \4 \n \image latex \4 \"\" width=1.6cm \n \image html \5 \n \image latex \5 \"\" width=1.6cm \n \image html \6 \n \image latex \6 \"\" width=1.6cm \n \image html \7 \n \image latex \7 \"\" width=1.6cm \n \image html \8 \n \image latex \8 \"\" width=1.6cm \n \image html \9 \n \image latex \9 \"\" width=1.6cm \n \image html \10 \n \image latex \10 \"\" width=1.6cm \n
      \htmlonly
      \endhtmlonly \n \latexonly \n \endlatexonly \ref fig__\1" \ - "cgalFigureEnd=\htmlonly
      \endhtmlonly
      " \ + "cgalFigureEnd=\htmlonly

      \endhtmlonly" \ "cgalFigureCaptionBegin{1}=\htmlonly
      \endhtmlonly \ref fig__\1" \ - "cgalFigureCaptionEnd=\htmlonly
      \endhtmlonly
      " \ + "cgalFigureCaptionEnd=\htmlonly

      \endhtmlonly" \ "cgalConcept=\details
      \n \brief" \ "cgalConceptNamespace=\details
      \n \brief" \ "cgalRefines=\xrefitem refines \"Refines\" \"Refinement Relationships\"" \ diff --git a/Documentation/doc/resources/1.8.14/BaseDoxyfile.in b/Documentation/doc/resources/1.8.14/BaseDoxyfile.in index 9bc583f5cd8..a9141040bc6 100644 --- a/Documentation/doc/resources/1.8.14/BaseDoxyfile.in +++ b/Documentation/doc/resources/1.8.14/BaseDoxyfile.in @@ -251,9 +251,9 @@ ALIASES = "sc{1}=\1
      \image html \2 ^^ \image latex \2 \"\" width=2.1cm ^^ \image html \3 ^^ \image latex \3 \"\" width=2.1cm ^^ \image html \4 ^^ \image latex \4 \"\" width=2.1cm ^^ \image html \5 ^^ \image latex \5 \"\" width=2.1cm ^^ \image html \6 ^^ \image latex \6 \"\" width=2.1cm ^^ \image html \7 ^^ \image latex \7 \"\" width=2.1cm ^^ \image html \8 ^^ \image latex \8 \"\" width=2.1cm ^^
      \htmlonly
      \endhtmlonly ^^ \latexonly ^^ \endlatexonly \ref fig__\1" \ "cgalFigureBegin{9}=\anchor fig__\1 ^^
      \image html \2 ^^ \image latex \2 \"\" width=1.9cm ^^ \image html \3 ^^ \image latex \3 \"\" width=1.9cm ^^ \image html \4 ^^ \image latex \4 \"\" width=1.9cm ^^ \image html \5 ^^ \image latex \5 \"\" width=1.9cm ^^ \image html \6 ^^ \image latex \6 \"\" width=1.9cm ^^ \image html \7 ^^ \image latex \7 \"\" width=1.9cm ^^ \image html \8 ^^ \image latex \8 \"\" width=1.9cm ^^ \image html \9 ^^ \image latex \9 \"\" width=1.9cm ^^
      \htmlonly
      \endhtmlonly ^^ \latexonly ^^ \endlatexonly \ref fig__\1" \ "cgalFigureBegin{10}=\anchor fig__\1 ^^
      \image html \2 ^^ \image latex \2 \"\" width=1.6cm ^^ \image html \3 ^^ \image latex \3 \"\" width=1.6cm ^^ \image html \4 ^^ \image latex \4 \"\" width=1.6cm ^^ \image html \5 ^^ \image latex \5 \"\" width=1.6cm ^^ \image html \6 ^^ \image latex \6 \"\" width=1.6cm ^^ \image html \7 ^^ \image latex \7 \"\" width=1.6cm ^^ \image html \8 ^^ \image latex \8 \"\" width=1.6cm ^^ \image html \9 ^^ \image latex \9 \"\" width=1.6cm ^^ \image html \10 ^^ \image latex \10 \"\" width=1.6cm ^^
      \htmlonly
      \endhtmlonly ^^ \latexonly ^^ \endlatexonly \ref fig__\1" \ - "cgalFigureEnd=\htmlonly
      \endhtmlonly
      " \ + "cgalFigureEnd=\htmlonly

      \endhtmlonly" \ "cgalFigureCaptionBegin{1}=\htmlonly
      \endhtmlonly \ref fig__\1" \ - "cgalFigureCaptionEnd=\htmlonly
      \endhtmlonly
      " \ + "cgalFigureCaptionEnd=\htmlonly

      \endhtmlonly" \ "cgalConcept=\details
      ^^ \brief" \ "cgalConceptNamespace=\details
      ^^ \brief" \ "cgalRefines=\xrefitem refines \"Refines\" \"Refinement Relationships\"" \ From b56aaa769c0c7e199481010a784c4fe472b81fc0 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 12 Dec 2018 11:50:19 +0100 Subject: [PATCH 156/193] Fix Issue #3536 --- Geomview/doc/Geomview/CGAL/IO/Geomview_stream.h | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/Geomview/doc/Geomview/CGAL/IO/Geomview_stream.h b/Geomview/doc/Geomview/CGAL/IO/Geomview_stream.h index d189bb8367f..a93f3b86950 100644 --- a/Geomview/doc/Geomview/CGAL/IO/Geomview_stream.h +++ b/Geomview/doc/Geomview/CGAL/IO/Geomview_stream.h @@ -363,19 +363,6 @@ operator<<(Geomview_stream& gs, const Bbox_2& b); Geomview_stream& operator<<(Geomview_stream& gs, const Bbox_3& b); -/*! - Inserts the bounding box `b` into the stream `gs`. - \relates Geomview_stream -*/ -Geomview_stream& -operator<<(Geomview_stream& gs, const Bbox_3& b); - -/*! - Inserts the bounding box `b` into the stream `gs`. - \relates Geomview_stream -*/ -Geomview_stream& -operator<<(Geomview_stream& gs, const Bbox_3& b); /// @} From 7a04091d4a0f53e9b551aa5f4738c6bf77000002 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 12 Dec 2018 14:31:50 +0100 Subject: [PATCH 157/193] Add offset from vtk --- CGAL_ImageIO/include/CGAL/read_vtk_image_data.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CGAL_ImageIO/include/CGAL/read_vtk_image_data.h b/CGAL_ImageIO/include/CGAL/read_vtk_image_data.h index 2c28a44c25a..c592d3a0be2 100644 --- a/CGAL_ImageIO/include/CGAL/read_vtk_image_data.h +++ b/CGAL_ImageIO/include/CGAL/read_vtk_image_data.h @@ -63,6 +63,7 @@ read_vtk_image_data(vtkImageData* vtk_image) _image* image = ::_initImage(); const int* dims = vtk_image->GetDimensions(); const double* spacing = vtk_image->GetSpacing(); + const double* offset = vtk_image->GetOrigin(); image->vectMode = VM_SCALAR; image->xdim = dims[0]; image->ydim = dims[1]; @@ -71,6 +72,9 @@ read_vtk_image_data(vtkImageData* vtk_image) image->vx = spacing[0]; image->vy = spacing[1]; image->vz = spacing[2]; + image->tx = offset[0]; + image->ty = offset[1]; + image->tz = offset[2]; image->endianness = ::_getEndianness(); int vtk_type = vtk_image->GetScalarType(); if(vtk_type == VTK_SIGNED_CHAR) vtk_type = VTK_CHAR; From c8dcfbf64dcd0291cb40b006f22a48a07dcaa9db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 13 Dec 2018 08:51:06 +0100 Subject: [PATCH 158/193] remove duplicate definition --- .../Concepts/OptimalTransportationReconstructionTraits_2.h | 1 - 1 file changed, 1 deletion(-) diff --git a/Optimal_transportation_reconstruction_2/doc/Optimal_transportation_reconstruction_2/Concepts/OptimalTransportationReconstructionTraits_2.h b/Optimal_transportation_reconstruction_2/doc/Optimal_transportation_reconstruction_2/Concepts/OptimalTransportationReconstructionTraits_2.h index 04c9035a830..54551b8a64d 100644 --- a/Optimal_transportation_reconstruction_2/doc/Optimal_transportation_reconstruction_2/Concepts/OptimalTransportationReconstructionTraits_2.h +++ b/Optimal_transportation_reconstruction_2/doc/Optimal_transportation_reconstruction_2/Concepts/OptimalTransportationReconstructionTraits_2.h @@ -149,7 +149,6 @@ public: /// @{ Construct_point_2 construct_point_2_object(); Construct_vector_2 construct_vector_2_object(); - Construct_vector_2 construct_vector_2_object(); Construct_line_2 construct_line_2_object(); Construct_translated_point_2 construct_translated_point_2_object(); Construct_scaled_vector_2 construct_scaled_vector_2_object(); From ea7c64b8b2040ea7d6222d67daf14dc66c9bec17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 13 Dec 2018 08:53:54 +0100 Subject: [PATCH 159/193] 3 -> 2 --- .../Point_set_shape_detection_3/Concepts/ShapeDetectionTraits.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Point_set_shape_detection_3/doc/Point_set_shape_detection_3/Concepts/ShapeDetectionTraits.h b/Point_set_shape_detection_3/doc/Point_set_shape_detection_3/Concepts/ShapeDetectionTraits.h index 44db0198c28..acbb8d24111 100644 --- a/Point_set_shape_detection_3/doc/Point_set_shape_detection_3/Concepts/ShapeDetectionTraits.h +++ b/Point_set_shape_detection_3/doc/Point_set_shape_detection_3/Concepts/ShapeDetectionTraits.h @@ -35,7 +35,7 @@ public: /// The circle type, only required if you want to detect tori typedef unspecified_type Circle_2; /// The 2D vector type, only required if you want to detect tori - typedef unspecified_type Vector_3; + typedef unspecified_type Vector_2; /// The number type of the Cartesian coordinates of types Point_3 typedef unspecified_type FT; From dfdfc8633783f982449dbeb38e748948e5cc7d98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 13 Dec 2018 08:56:25 +0100 Subject: [PATCH 160/193] fix duplicate --- .../doc/Arrangement_on_surface_2/CGAL/Arr_observer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_observer.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_observer.h index 20c9cfbecb7..a80e03569ff 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_observer.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_observer.h @@ -167,7 +167,7 @@ virtual void before_detach (); issued immediately after the observer has been detached from its arrangement instance. */ -virtual void after_attach (); +virtual void after_detach (); /// @} From 266fee1c4c4292638ac49c2600477b2fdf90cac4 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 12 Dec 2018 11:54:18 +0100 Subject: [PATCH 161/193] Check for uniqueness of the vertices in add_face --- BGL/include/CGAL/boost/graph/Euler_operations.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/BGL/include/CGAL/boost/graph/Euler_operations.h b/BGL/include/CGAL/boost/graph/Euler_operations.h index 56d92e979ee..f7d8e2f9dcb 100644 --- a/BGL/include/CGAL/boost/graph/Euler_operations.h +++ b/BGL/include/CGAL/boost/graph/Euler_operations.h @@ -585,6 +585,12 @@ add_face(const VertexRange& vr, Graph& g) std::vector vertices(vr.begin(), vr.end()); // quick and dirty copy unsigned int n = (unsigned int)vertices.size(); + //check that every vertex is unique + std::sort(vertices.begin(), vertices.end()); + if(std::unique(vertices.begin(), vertices.end()) != vertices.end()) + return boost::graph_traits::null_face(); + vertices.clear(); + vertices=std::vector(vr.begin(), vr.end()); // don't allow degenerated faces CGAL_assertion(n > 2); From 31b68de8b2290d19facec25fb84a4ad7b8506638 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 12 Dec 2018 14:53:01 +0100 Subject: [PATCH 162/193] use std::copy and adjacent_find --- BGL/include/CGAL/boost/graph/Euler_operations.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/Euler_operations.h b/BGL/include/CGAL/boost/graph/Euler_operations.h index f7d8e2f9dcb..1375e41c68a 100644 --- a/BGL/include/CGAL/boost/graph/Euler_operations.h +++ b/BGL/include/CGAL/boost/graph/Euler_operations.h @@ -587,10 +587,9 @@ add_face(const VertexRange& vr, Graph& g) unsigned int n = (unsigned int)vertices.size(); //check that every vertex is unique std::sort(vertices.begin(), vertices.end()); - if(std::unique(vertices.begin(), vertices.end()) != vertices.end()) + if(std::adjacent_find(vertices.begin(), vertices.end()) != vertices.end()) return boost::graph_traits::null_face(); - vertices.clear(); - vertices=std::vector(vr.begin(), vr.end()); + std::copy(vr.begin(), vr.end(), vertices.begin()); // don't allow degenerated faces CGAL_assertion(n > 2); From 51f8877e60f5f37bd1c70bd4ce6b851f8ecf1c1a Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Thu, 13 Dec 2018 09:17:46 +0100 Subject: [PATCH 163/193] Replace the assertion about n>2 by a if --- BGL/include/CGAL/boost/graph/Euler_operations.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/Euler_operations.h b/BGL/include/CGAL/boost/graph/Euler_operations.h index 1375e41c68a..04b415b207c 100644 --- a/BGL/include/CGAL/boost/graph/Euler_operations.h +++ b/BGL/include/CGAL/boost/graph/Euler_operations.h @@ -587,11 +587,14 @@ add_face(const VertexRange& vr, Graph& g) unsigned int n = (unsigned int)vertices.size(); //check that every vertex is unique std::sort(vertices.begin(), vertices.end()); - if(std::adjacent_find(vertices.begin(), vertices.end()) != vertices.end()) + if(std::adjacent_find(vertices.begin(), vertices.end()) != vertices.end()){ return boost::graph_traits::null_face(); + } std::copy(vr.begin(), vr.end(), vertices.begin()); // don't allow degenerated faces - CGAL_assertion(n > 2); + if(n <= 2){ + return boost::graph_traits::null_face(); + } std::vector halfedges(n); std::vector is_new(n); From c51852f8a1dfcba2a9ef06f7f54bd4bac88cb69f Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Thu, 13 Dec 2018 09:34:05 +0100 Subject: [PATCH 164/193] Add check in collect_garbage() --- Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h index ce5490de872..004831a2ac0 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h @@ -2482,6 +2482,11 @@ void Surface_mesh

      :: collect_garbage() { + if (!has_garbage()) + { + return; + } + int i, i0, i1, nV(num_vertices()), nE(num_edges()), From e1d5552de7635416af53acbb54402bc2701e5da0 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 13 Dec 2018 09:39:48 +0100 Subject: [PATCH 165/193] Do not call deprecated code. Add a test file for the deprecated code --- .../Plugins/PCA/Basic_generator_plugin.cpp | 4 +- .../Principal_component_analysis/Scene.cpp | 2 +- .../subdivision_methods_3.h | 32 +- .../test_Subdivision_method_3.cpp | 28 +- .../test_deprecated_Subdivision_method_3.cpp | 362 ++++++++++++++++++ 5 files changed, 406 insertions(+), 22 deletions(-) create mode 100644 Subdivision_method_3/test/Subdivision_method_3/test_deprecated_Subdivision_method_3.cpp diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Basic_generator_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PCA/Basic_generator_plugin.cpp index e5242bd41bf..d1754a52afd 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/Basic_generator_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/Basic_generator_plugin.cpp @@ -34,6 +34,8 @@ typedef Kernel::Point_3 Point; namespace euler = CGAL::Euler; using namespace CGAL::Three; +namespace params = CGAL::parameters; + class Q_DECL_EXPORT Basic_generator_plugin : public QObject, public Polyhedron_demo_plugin_helper @@ -548,7 +550,7 @@ void Basic_generator_plugin::generateSphere() typedef typename boost::property_map::type VPMap; if(precision !=0) CGAL::Subdivision_method_3::Sqrt3_subdivision(sphere, - precision); + params::number_of_iterations(precision)); VPMap vpmap = get(CGAL::vertex_point, sphere); //emplace the points back on the sphere BOOST_FOREACH(typename boost::graph_traits::vertex_descriptor vd, vertices(sphere)) diff --git a/Principal_component_analysis/demo/Principal_component_analysis/Scene.cpp b/Principal_component_analysis/demo/Principal_component_analysis/Scene.cpp index 38a89df8036..129799a7aa3 100644 --- a/Principal_component_analysis/demo/Principal_component_analysis/Scene.cpp +++ b/Principal_component_analysis/demo/Principal_component_analysis/Scene.cpp @@ -225,7 +225,7 @@ void Scene::refine_loop() return; } std::cout << "Loop subdivision..."; - CGAL::Subdivision_method_3::Loop_subdivision(*m_pPolyhedron, 1); + CGAL::Subdivision_method_3::Loop_subdivision(*m_pPolyhedron); std::cout << "done (" << m_pPolyhedron->size_of_facets() << " facets)" << std::endl; } diff --git a/Subdivision_method_3/include/CGAL/Subdivision_method_3/subdivision_methods_3.h b/Subdivision_method_3/include/CGAL/Subdivision_method_3/subdivision_methods_3.h index 41355110f38..f8bb8d8a064 100644 --- a/Subdivision_method_3/include/CGAL/Subdivision_method_3/subdivision_methods_3.h +++ b/Subdivision_method_3/include/CGAL/Subdivision_method_3/subdivision_methods_3.h @@ -98,7 +98,7 @@ namespace parameters = CGAL::parameters; #ifndef CGAL_NO_DEPRECATED_CODE template CGAL_DEPRECATED_MSG("you are using the deprecated API of CatmullClark_subdivision(), please update your code") -void CatmullClark_subdivision(PolygonMesh& pmesh, int step = 1) { +void CatmullClark_subdivision(PolygonMesh& pmesh, int step) { PQQ(pmesh, CatmullClark_mask_3(&pmesh, get(vertex_point,pmesh)), step); } #endif @@ -141,6 +141,11 @@ void CatmullClark_subdivision(PolygonMesh& pmesh, const NamedParameters& np) { internal::PQQ_1step(pmesh, vpm, mask); } +template +void CatmullClark_subdivision(PolygonMesh& pmesh) +{ + CatmullClark_subdivision(pmesh, CGAL::parameters::all_default()); +} // ----------------------------------------------------------------------------- #ifndef DOXYGEN_RUNNING @@ -148,7 +153,7 @@ void CatmullClark_subdivision(PolygonMesh& pmesh, const NamedParameters& np) { #ifndef CGAL_NO_DEPRECATED_CODE template CGAL_DEPRECATED_MSG("you are using the deprecated API of Loop_subdivision(), please update your code") -void Loop_subdivision(PolygonMesh& pmesh, int step = 1) { +void Loop_subdivision(PolygonMesh& pmesh, int step) { PTQ(pmesh, Loop_mask_3(&pmesh, get(vertex_point,pmesh)) , step); } #endif @@ -189,6 +194,11 @@ void Loop_subdivision(PolygonMesh& pmesh, const NamedParameters& np) { internal::PTQ_1step(pmesh, vpm, mask); } +template +void Loop_subdivision(PolygonMesh& pmesh) +{ + Loop_subdivision(pmesh, CGAL::parameters::all_default()); +} // ----------------------------------------------------------------------------- #ifndef DOXYGEN_RUNNING @@ -196,7 +206,7 @@ void Loop_subdivision(PolygonMesh& pmesh, const NamedParameters& np) { #ifndef CGAL_NO_DEPRECATED_CODE template CGAL_DEPRECATED_MSG("you are using the deprecated API of DooSabin_subdivision(), please update your code") -void DooSabin_subdivision(PolygonMesh& pmesh, int step = 1) { +void DooSabin_subdivision(PolygonMesh& pmesh, int step) { DQQ(pmesh, DooSabin_mask_3(&pmesh, get(vertex_point, pmesh)), step); } #endif @@ -236,7 +246,12 @@ void DooSabin_subdivision(PolygonMesh& pmesh, const NamedParameters& np) { for(unsigned int i = 0; i < step; i++) internal::DQQ_1step(pmesh, vpm, mask); } - + +template +void DooSabin_subdivision(PolygonMesh& pmesh) +{ + DooSabin_subdivision(pmesh, CGAL::parameters::all_default()); +} // ----------------------------------------------------------------------------- #ifndef DOXYGEN_RUNNING @@ -244,7 +259,7 @@ void DooSabin_subdivision(PolygonMesh& pmesh, const NamedParameters& np) { #ifndef CGAL_NO_DEPRECATED_CODE template CGAL_DEPRECATED_MSG("you are using the deprecated API of Sqrt3_subdivision(), please update your code") -void Sqrt3_subdivision(PolygonMesh& pmesh, int step = 1) { +void Sqrt3_subdivision(PolygonMesh& pmesh, int step) { Sqrt3(pmesh, Sqrt3_mask_3(&pmesh, get(vertex_point,pmesh)), step); } #endif @@ -289,7 +304,12 @@ void Sqrt3_subdivision(PolygonMesh& pmesh, const NamedParameters& np) { for(unsigned int i = 0; i < step; i++) internal::Sqrt3_1step(pmesh, vpm, mask, (i%2==1)); } - + +template +void Sqrt3_subdivision(PolygonMesh& pmesh) +{ + Sqrt3_subdivision(pmesh, CGAL::parameters::all_default()); +} /// @} } // namespace Subdivision_method_3 diff --git a/Subdivision_method_3/test/Subdivision_method_3/test_Subdivision_method_3.cpp b/Subdivision_method_3/test/Subdivision_method_3/test_Subdivision_method_3.cpp index 7b0e8f399e5..f809086515e 100644 --- a/Subdivision_method_3/test/Subdivision_method_3/test_Subdivision_method_3.cpp +++ b/Subdivision_method_3/test/Subdivision_method_3/test_Subdivision_method_3.cpp @@ -57,7 +57,7 @@ void test_Subdivision_surface_3() { Polyhedron P; mesh >> P; - Subdivision_method_3::CatmullClark_subdivision(P,TEST_DEPTH); + Subdivision_method_3::CatmullClark_subdivision(P); assert(CGAL::is_valid_polygon_mesh(P)); } @@ -68,7 +68,7 @@ void test_Subdivision_surface_3() { Polyhedron P; mesh >> P; - Subdivision_method_3::CatmullClark_subdivision(P,TEST_DEPTH); + Subdivision_method_3::CatmullClark_subdivision(P); assert(CGAL::is_valid_polygon_mesh(P)); } @@ -80,7 +80,7 @@ void test_Subdivision_surface_3() { Polyhedron P; mesh >> P; - Subdivision_method_3::Loop_subdivision(P,TEST_DEPTH); + Subdivision_method_3::Loop_subdivision(P); assert(CGAL::is_valid_polygon_mesh(P)); } @@ -91,7 +91,7 @@ void test_Subdivision_surface_3() { Polyhedron P; mesh >> P; - Subdivision_method_3::Loop_subdivision(P,TEST_DEPTH); + Subdivision_method_3::Loop_subdivision(P); assert(CGAL::is_valid_polygon_mesh(P)); } @@ -102,7 +102,7 @@ void test_Subdivision_surface_3() { Polyhedron P; mesh >> P; - Subdivision_method_3::DooSabin_subdivision(P,TEST_DEPTH); + Subdivision_method_3::DooSabin_subdivision(P); assert(CGAL::is_valid_polygon_mesh(P)); } @@ -113,7 +113,7 @@ void test_Subdivision_surface_3() { Polyhedron P; mesh >> P; - Subdivision_method_3::Sqrt3_subdivision(P,TEST_DEPTH); + Subdivision_method_3::Sqrt3_subdivision(P); assert(CGAL::is_valid_polygon_mesh(P)); } } @@ -129,7 +129,7 @@ void test_Subdivision_surface_3_SM() { Polyhedron P; mesh >> P; - Subdivision_method_3::CatmullClark_subdivision(P,TEST_DEPTH); + Subdivision_method_3::CatmullClark_subdivision(P); assert(CGAL::is_valid_polygon_mesh(P)); } @@ -140,7 +140,7 @@ void test_Subdivision_surface_3_SM() { Polyhedron P; mesh >> P; - Subdivision_method_3::CatmullClark_subdivision(P,TEST_DEPTH); + Subdivision_method_3::CatmullClark_subdivision(P); assert(CGAL::is_valid_polygon_mesh(P)); } @@ -152,7 +152,7 @@ void test_Subdivision_surface_3_SM() { Polyhedron P; mesh >> P; - Subdivision_method_3::Loop_subdivision(P,TEST_DEPTH); + Subdivision_method_3::Loop_subdivision(P); assert(CGAL::is_valid_polygon_mesh(P)); } @@ -163,7 +163,7 @@ void test_Subdivision_surface_3_SM() { Polyhedron P; mesh >> P; - Subdivision_method_3::Loop_subdivision(P,TEST_DEPTH); + Subdivision_method_3::Loop_subdivision(P); assert(CGAL::is_valid_polygon_mesh(P)); } @@ -174,7 +174,7 @@ void test_Subdivision_surface_3_SM() { Polyhedron P; mesh >> P; - Subdivision_method_3::DooSabin_subdivision(P,TEST_DEPTH); + Subdivision_method_3::DooSabin_subdivision(P); assert(CGAL::is_valid_polygon_mesh(P, true)); } @@ -185,7 +185,7 @@ void test_Subdivision_surface_3_SM() { Polyhedron P; mesh >> P; - Subdivision_method_3::DooSabin_subdivision(P,TEST_DEPTH); + Subdivision_method_3::DooSabin_subdivision(P); assert(CGAL::is_valid_polygon_mesh(P)); } @@ -196,7 +196,7 @@ void test_Subdivision_surface_3_SM() { Polyhedron P; mesh >> P; - Subdivision_method_3::Sqrt3_subdivision(P,TEST_DEPTH); + Subdivision_method_3::Sqrt3_subdivision(P); assert(CGAL::is_valid_polygon_mesh(P)); } @@ -207,7 +207,7 @@ void test_Subdivision_surface_3_SM() { Polyhedron P; mesh >> P; - Subdivision_method_3::Sqrt3_subdivision(P,TEST_DEPTH); + Subdivision_method_3::Sqrt3_subdivision(P); assert(CGAL::is_valid_polygon_mesh(P)); } } diff --git a/Subdivision_method_3/test/Subdivision_method_3/test_deprecated_Subdivision_method_3.cpp b/Subdivision_method_3/test/Subdivision_method_3/test_deprecated_Subdivision_method_3.cpp new file mode 100644 index 00000000000..c8a6c85c632 --- /dev/null +++ b/Subdivision_method_3/test/Subdivision_method_3/test_deprecated_Subdivision_method_3.cpp @@ -0,0 +1,362 @@ +#include +// ============================================================================ +// +// Copyright (c) 2005-2006, 2017 Le-Jeng Shiue +// +// This software and related documentation is part of an INTERNAL release +// of the Computational Geometry Algorithms Library (CGAL). It is not +// intended for general use. +// +// ---------------------------------------------------------------------------- +// +// release : $CGAL_Revision: $ +// release_date : $CGAL_Date: $ +// +// file : test/Subdivision_method_3/test_Subdivision_method_3.C +// package : Subdivision_method_3 +// chapter : Subdivision Method +// +// revision : $Id$ +// revision_date : $Date$ +// +// author(s) : Le-Jeng Shiue +// +// Test subdivision methods +// ============================================================================ + +#include +#include +#include + +#include + +#include +#include +#include + +using namespace std; +using namespace CGAL; + +#define TEST_DEPTH (3) + +//#define TESTMESH_GENERAL "data/??.off" + +#define TESTMESH_QUAD "data/corner.off" +#define TESTMESH_QUAD_OPEN "data/corner_with_hole.off" + +#define TESTMESH_TRI "data/quint_tris.off" +#define TESTMESH_TRI_OPEN "data/nefertiti.off" + +void test_Subdivision_surface_3() { + typedef CGAL::Simple_cartesian Kernel; + typedef CGAL::Polyhedron_3 Polyhedron; + + // test Catmull-Clark subdivision on quad mesh + { + ifstream mesh(TESTMESH_QUAD); + + Polyhedron P; + mesh >> P; + + Subdivision_method_3::CatmullClark_subdivision(P,TEST_DEPTH); + assert(CGAL::is_valid_polygon_mesh(P)); + } + + // test Catmull-Clark subdivision on 'opened' quad mesh + { + ifstream mesh(TESTMESH_QUAD_OPEN); + + Polyhedron P; + mesh >> P; + + Subdivision_method_3::CatmullClark_subdivision(P,TEST_DEPTH); + assert(CGAL::is_valid_polygon_mesh(P)); + } + + + // test Loop subdivision on tri mesh + { + ifstream mesh(TESTMESH_TRI); + + Polyhedron P; + mesh >> P; + + Subdivision_method_3::Loop_subdivision(P,TEST_DEPTH); + assert(CGAL::is_valid_polygon_mesh(P)); + } + + // test Loop subdivision on 'opened' tri mesh + { + ifstream mesh(TESTMESH_TRI_OPEN); + + Polyhedron P; + mesh >> P; + + Subdivision_method_3::Loop_subdivision(P,TEST_DEPTH); + assert(CGAL::is_valid_polygon_mesh(P)); + } + + // test Doo-Sabin subdivision on general mesh + { + ifstream mesh(TESTMESH_TRI_OPEN); + + Polyhedron P; + mesh >> P; + + Subdivision_method_3::DooSabin_subdivision(P,TEST_DEPTH); + assert(CGAL::is_valid_polygon_mesh(P)); + } + + // test Sqrt-3 subdivision on tri mesh + { + ifstream mesh(TESTMESH_TRI); + + Polyhedron P; + mesh >> P; + + Subdivision_method_3::Sqrt3_subdivision(P,TEST_DEPTH); + assert(CGAL::is_valid_polygon_mesh(P)); + } +} + +void test_Subdivision_surface_3_SM() { + typedef CGAL::Simple_cartesian Kernel; + typedef CGAL::Surface_mesh Polyhedron; + + // test Catmull-Clark subdivision on quad mesh + { + ifstream mesh(TESTMESH_QUAD); + + Polyhedron P; + mesh >> P; + + Subdivision_method_3::CatmullClark_subdivision(P,TEST_DEPTH); + assert(CGAL::is_valid_polygon_mesh(P)); + } + + // test Catmull-Clark subdivision on 'opened' quad mesh + { + ifstream mesh(TESTMESH_QUAD_OPEN); + + Polyhedron P; + mesh >> P; + + Subdivision_method_3::CatmullClark_subdivision(P,TEST_DEPTH); + assert(CGAL::is_valid_polygon_mesh(P)); + } + + + // test Loop subdivision on tri mesh + { + ifstream mesh(TESTMESH_TRI); + + Polyhedron P; + mesh >> P; + + Subdivision_method_3::Loop_subdivision(P,TEST_DEPTH); + assert(CGAL::is_valid_polygon_mesh(P)); + } + + // test Loop subdivision on 'opened' tri mesh + { + ifstream mesh(TESTMESH_TRI_OPEN); + + Polyhedron P; + mesh >> P; + + Subdivision_method_3::Loop_subdivision(P,TEST_DEPTH); + assert(CGAL::is_valid_polygon_mesh(P)); + } + + // test Doo-Sabin subdivision on general mesh + { + ifstream mesh(TESTMESH_TRI_OPEN); + + Polyhedron P; + mesh >> P; + + Subdivision_method_3::DooSabin_subdivision(P,TEST_DEPTH); + assert(CGAL::is_valid_polygon_mesh(P, true)); + } + + // test Doo-Sabin subdivision on 'opened' quad mesh + { + ifstream mesh(TESTMESH_QUAD_OPEN); + + Polyhedron P; + mesh >> P; + + Subdivision_method_3::DooSabin_subdivision(P,TEST_DEPTH); + assert(CGAL::is_valid_polygon_mesh(P)); + } + + // test Sqrt-3 subdivision on tri mesh + { + ifstream mesh(TESTMESH_TRI); + + Polyhedron P; + mesh >> P; + + Subdivision_method_3::Sqrt3_subdivision(P,TEST_DEPTH); + assert(CGAL::is_valid_polygon_mesh(P)); + } + + // test Sqrt-3 subdivision on 'opened' tri mesh + { + ifstream mesh(TESTMESH_TRI_OPEN); + + Polyhedron P; + mesh >> P; + + Subdivision_method_3::Sqrt3_subdivision(P,TEST_DEPTH); + assert(CGAL::is_valid_polygon_mesh(P)); + } +} + +void test_Subdivision_surface_3_SM_NP() { + typedef CGAL::Simple_cartesian Kernel; + typedef CGAL::Surface_mesh Polyhedron; + + // test Catmull-Clark subdivision on quad mesh + { + ifstream mesh(TESTMESH_QUAD); + + Polyhedron P; + mesh >> P; + + Subdivision_method_3::CatmullClark_subdivision(P,Subdivision_method_3::parameters::vertex_point_map(get(vertex_point, P)) + .number_of_iterations(TEST_DEPTH)); + assert(CGAL::is_valid_polygon_mesh(P)); + } + + // test Catmull-Clark subdivision on 'opened' quad mesh + { + ifstream mesh(TESTMESH_QUAD_OPEN); + + Polyhedron P; + mesh >> P; + + Subdivision_method_3::CatmullClark_subdivision(P,Subdivision_method_3::parameters::vertex_point_map(get(vertex_point, P)) + .number_of_iterations(TEST_DEPTH)); + assert(CGAL::is_valid_polygon_mesh(P)); + } + + + // test Loop subdivision on tri mesh + { + ifstream mesh(TESTMESH_TRI); + + Polyhedron P; + mesh >> P; + + Subdivision_method_3::Loop_subdivision(P,Subdivision_method_3::parameters::vertex_point_map(get(vertex_point, P)) + .number_of_iterations(TEST_DEPTH)); + assert(CGAL::is_valid_polygon_mesh(P)); + } + + // test Loop subdivision on 'opened' tri mesh + { + ifstream mesh(TESTMESH_TRI_OPEN); + + Polyhedron P; + mesh >> P; + + Subdivision_method_3::Loop_subdivision(P,Subdivision_method_3::parameters::vertex_point_map(get(vertex_point, P)) + .number_of_iterations(TEST_DEPTH)); + assert(CGAL::is_valid_polygon_mesh(P)); + } + + // test Doo-Sabin subdivision on 'opened' tri mesh + { + ifstream mesh(TESTMESH_TRI_OPEN); + + Polyhedron P; + mesh >> P; + + Subdivision_method_3::DooSabin_subdivision(P,Subdivision_method_3::parameters::vertex_point_map(get(vertex_point, P)) + .number_of_iterations(TEST_DEPTH)); + assert(CGAL::is_valid_polygon_mesh(P)); + } + + // test Doo-Sabin subdivision on 'opened' quad mesh + { + ifstream mesh(TESTMESH_QUAD_OPEN); + + Polyhedron P; + mesh >> P; + + Subdivision_method_3::DooSabin_subdivision(P,TEST_DEPTH); + assert(CGAL::is_valid_polygon_mesh(P)); + } + + // test Sqrt-3 subdivision on tri mesh + { + ifstream mesh(TESTMESH_TRI); + + Polyhedron P; + mesh >> P; + + Subdivision_method_3::Sqrt3_subdivision(P,Subdivision_method_3::parameters::vertex_point_map(get(vertex_point, P)) + .number_of_iterations(TEST_DEPTH)); + + assert(CGAL::is_valid_polygon_mesh(P)); + } + + // test Sqrt-3 subdivision on 'opened' tri mesh + { + ifstream mesh(TESTMESH_TRI_OPEN); + + Polyhedron P; + mesh >> P; + + Subdivision_method_3::Sqrt3_subdivision(P,Subdivision_method_3::parameters::vertex_point_map(get(vertex_point, P)) + .number_of_iterations(TEST_DEPTH)); + + std::ofstream out("out_0.off"); + out << P; + + assert(CGAL::is_valid_polygon_mesh(P)); + } + + // test Sqrt-3 subdivision on 'opened' tri mesh & with external property map + { + ifstream mesh(TESTMESH_TRI_OPEN); + + Polyhedron P; + mesh >> P; + + typedef Kernel::Point_3 Point; + typedef Kernel::Vector_3 Vector; + + typedef boost::graph_traits::vertex_descriptor vertex_descriptor; + typedef boost::unordered_map Point_pmap; + typedef boost::associative_property_map APM; + typedef boost::property_map::type VPM; + + Point_pmap um; + APM apm(um); + VPM vpm = get(vertex_point, P); + + // some arbitrary new coordinates (different from the internal vpm) + BOOST_FOREACH(vertex_descriptor vd, vertices(P)) { + boost::property_traits::reference pt = get(vpm, vd); + Vector v = pt - Point(0., 0., -3.); + put(apm, vd, pt + 0.5*v); + } + + Subdivision_method_3::Sqrt3_subdivision(P, + Subdivision_method_3::parameters::vertex_point_map(apm) + .number_of_iterations(TEST_DEPTH)); + + assert(CGAL::is_valid_polygon_mesh(P)); + } +} + +int main() { + test_Subdivision_surface_3(); + test_Subdivision_surface_3_SM(); + test_Subdivision_surface_3_SM_NP(); + std::cerr << "Done" << std::endl; + return 0; +} +// EOF // From 10e11e6eb2cc2b26ab49c5da829b2ea6deb96d67 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 13 Dec 2018 09:43:14 +0100 Subject: [PATCH 166/193] Do not call deprecated code. Add a test file for the deprecated code --- AABB_tree/demo/AABB_tree/Scene.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AABB_tree/demo/AABB_tree/Scene.cpp b/AABB_tree/demo/AABB_tree/Scene.cpp index 7a416bbde35..6303fb2140b 100644 --- a/AABB_tree/demo/AABB_tree/Scene.cpp +++ b/AABB_tree/demo/AABB_tree/Scene.cpp @@ -1297,7 +1297,7 @@ void Scene::refine_loop() return; } std::cout << "Loop subdivision..."; - CGAL::Subdivision_method_3::Loop_subdivision(*m_pPolyhedron, 1); + CGAL::Subdivision_method_3::Loop_subdivision(*m_pPolyhedron); std::cout << "done (" << m_pPolyhedron->size_of_facets() << " facets)" << std::endl; clear_internal_data(); From a6c1632f82e40db6626aa95da59e6d59a42e8375 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 13 Dec 2018 09:51:47 +0100 Subject: [PATCH 167/193] No need to disable warnings --- .../CMakeLists.txt | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/Surface_mesh_parameterization/test/Surface_mesh_parameterization/CMakeLists.txt b/Surface_mesh_parameterization/test/Surface_mesh_parameterization/CMakeLists.txt index 9455b197844..e325bf4aafa 100644 --- a/Surface_mesh_parameterization/test/Surface_mesh_parameterization/CMakeLists.txt +++ b/Surface_mesh_parameterization/test/Surface_mesh_parameterization/CMakeLists.txt @@ -14,24 +14,7 @@ find_package(CGAL QUIET) if ( CGAL_FOUND ) - # VisualC++ optimization for applications dealing with large data - if (MSVC) - # Allow Windows applications to use up to 3GB of RAM - SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE") - - # Turn off stupid VC++ warnings - SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267 /wd4311 /wd4800 /wd4503 /wd4244 /wd4345 /wd4996 /wd4396 /wd4018") - - # Print new compilation options - message( STATUS "USING DEBUG CXXFLAGS = '${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}'" ) - message( STATUS "USING DEBUG EXEFLAGS = '${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_DEBUG}'" ) - message( STATUS "USING RELEASE CXXFLAGS = '${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}'" ) - message( STATUS "USING RELEASE EXEFLAGS = '${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_RELEASE}'" ) - endif(MSVC) - - - #find Eigen find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater) if(EIGEN3_FOUND) include( ${EIGEN3_USE_FILE} ) From f6e83cd23e976bdd620083fd2da2adbbc8d2be54 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Thu, 13 Dec 2018 10:59:00 +0100 Subject: [PATCH 168/193] Move the definition of CGAL_USE_FILE in case of early return() --- Installation/lib/cmake/CGAL/CGALConfig.cmake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Installation/lib/cmake/CGAL/CGALConfig.cmake b/Installation/lib/cmake/CGAL/CGALConfig.cmake index ad0de1806ca..0fa343ba78c 100644 --- a/Installation/lib/cmake/CGAL/CGALConfig.cmake +++ b/Installation/lib/cmake/CGAL/CGALConfig.cmake @@ -73,6 +73,9 @@ include(${CGAL_MODULES_DIR}/CGAL_CreateSingleSourceCGALProgram.cmake) include(${CGAL_MODULES_DIR}/CGAL_Macros.cmake) include(${CGAL_MODULES_DIR}/CGAL_Common.cmake) +set(CGAL_USE_FILE ${CGAL_MODULES_DIR}/UseCGAL.cmake) + + if(CGAL_BUILDING_LIBS) foreach(comp ${CGAL_FIND_COMPONENTS}) if(CGAL_${comp}_FOUND) @@ -146,8 +149,6 @@ endforeach() # Temporary? Change the CMAKE module path cgal_setup_module_path() -set(CGAL_USE_FILE ${CGAL_MODULES_DIR}/UseCGAL.cmake) - include("${CGAL_MODULES_DIR}/CGAL_parse_version_h.cmake") cgal_parse_version_h( "${CGAL_INSTALLATION_PACKAGE_DIR}/include/CGAL/version.h" "CGAL_VERSION_NAME" From 57fd9818c7205e265c1c277ec07daa6acf49dad5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 14 Dec 2018 07:51:04 +0100 Subject: [PATCH 169/193] exclude fig_src from being parsed --- QP_solver/doc/QP_solver/Doxyfile.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/QP_solver/doc/QP_solver/Doxyfile.in b/QP_solver/doc/QP_solver/Doxyfile.in index b3330c4cb4e..5d8e054a416 100644 --- a/QP_solver/doc/QP_solver/Doxyfile.in +++ b/QP_solver/doc/QP_solver/Doxyfile.in @@ -1,3 +1,5 @@ @INCLUDE = ${CGAL_DOC_PACKAGE_DEFAULTS} PROJECT_NAME = "CGAL ${CGAL_DOC_VERSION} - Linear and Quadratic Programming Solver" + +EXCLUDE = ${CGAL_PACKAGE_DOC_DIR}/fig_src From 73e3457f3f07416e9fb894a3a9e92ce1b9da340e Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Fri, 14 Dec 2018 08:20:37 +0100 Subject: [PATCH 170/193] One warning was left --- .../test/Subdivision_method_3/test_Subdivision_method_3.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Subdivision_method_3/test/Subdivision_method_3/test_Subdivision_method_3.cpp b/Subdivision_method_3/test/Subdivision_method_3/test_Subdivision_method_3.cpp index f809086515e..b467aea5e90 100644 --- a/Subdivision_method_3/test/Subdivision_method_3/test_Subdivision_method_3.cpp +++ b/Subdivision_method_3/test/Subdivision_method_3/test_Subdivision_method_3.cpp @@ -284,7 +284,7 @@ void test_Subdivision_surface_3_SM_NP() { Polyhedron P; mesh >> P; - Subdivision_method_3::DooSabin_subdivision(P,TEST_DEPTH); + Subdivision_method_3::DooSabin_subdivision(P,Subdivision_method_3::parameters::number_of_iterations(TEST_DEPTH)); assert(CGAL::is_valid_polygon_mesh(P)); } From 1efb1d51624d5a761c229dbf2c28ad8e2fa238f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 14 Dec 2018 08:27:19 +0100 Subject: [PATCH 171/193] change kernel to avoid conflict with master --- .../test/Polygon_mesh_processing/test_stitching.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_stitching.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_stitching.cpp index 30c3f317026..4fba64559f6 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_stitching.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_stitching.cpp @@ -105,7 +105,7 @@ void test_surface_mesh_cc(const char* fname) void bug_test() { - typedef Epic K; + typedef CGAL::Simple_cartesian K; typedef K::Point_3 Point_3; CGAL::Surface_mesh tm; From 858d10070b079fa9c6818b0b6bd57d12c6995939 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Mon, 17 Dec 2018 13:07:18 +0100 Subject: [PATCH 172/193] Improve PLY element handling and thus fix bug when reading unknown element --- Point_set_3/include/CGAL/Point_set_3/IO.h | 219 ++++++------ .../include/CGAL/IO/read_ply_points.h | 317 +++++++++--------- Polyhedron_IO/include/CGAL/IO/PLY_reader.h | 254 ++++++++------ 3 files changed, 429 insertions(+), 361 deletions(-) diff --git a/Point_set_3/include/CGAL/Point_set_3/IO.h b/Point_set_3/include/CGAL/Point_set_3/IO.h index 93117799195..287cf45e728 100644 --- a/Point_set_3/include/CGAL/Point_set_3/IO.h +++ b/Point_set_3/include/CGAL/Point_set_3/IO.h @@ -135,7 +135,7 @@ private: struct Abstract_ply_property_to_point_set_property { virtual ~Abstract_ply_property_to_point_set_property() { } - virtual void assign (PLY_reader& reader, typename Point_set::Index index) = 0; + virtual void assign (PLY_element& element, typename Point_set::Index index) = 0; }; template @@ -154,10 +154,10 @@ private: m_pmap = ps.push_property_map (m_map); } - virtual void assign (PLY_reader& reader, typename Point_set::Index index) + virtual void assign (PLY_element& element, typename Point_set::Index index) { Type t; - reader.assign (t, m_name.c_str()); + element.assign (t, m_name.c_str()); put(m_pmap, index, t); } }; @@ -178,123 +178,121 @@ public: delete m_properties[i]; } - void instantiate_properties (PLY_reader& reader) + void instantiate_properties (PLY_element& element) { - const std::vector& readers - = reader.readers(); - bool has_normal[3] = { false, false, false }; - for (std::size_t i = 0; i < readers.size(); ++ i) + for (std::size_t j = 0; j < element.number_of_properties(); ++ j) + { + internal::PLY::PLY_read_number* property = element.property(j); + + const std::string& name = property->name(); + if (name == "x" || + name == "y" || + name == "z") { - const std::string& name = readers[i]->name(); - if (name == "x" || - name == "y" || - name == "z") - { - if (dynamic_cast*>(readers[i])) - m_use_floats = true; - continue; - } - if (name == "nx") - { - has_normal[0] = true; - continue; - } - if (name == "ny") - { - has_normal[1] = true; - continue; - } - if (name == "nz") - { - has_normal[2] = true; - continue; - } - - if (dynamic_cast*>(readers[i])) - { - m_properties.push_back - (new PLY_property_to_point_set_property(m_point_set, - name)); - } - else if (dynamic_cast*>(readers[i])) - { - m_properties.push_back - (new PLY_property_to_point_set_property(m_point_set, - name)); - } - else if (dynamic_cast*>(readers[i])) - { - m_properties.push_back - (new PLY_property_to_point_set_property(m_point_set, - name)); - } - else if (dynamic_cast*>(readers[i])) - { - m_properties.push_back - (new PLY_property_to_point_set_property(m_point_set, - name)); - } - else if (dynamic_cast*>(readers[i])) - { - m_properties.push_back - (new PLY_property_to_point_set_property(m_point_set, - name)); - } - else if (dynamic_cast*>(readers[i])) - { - m_properties.push_back - (new PLY_property_to_point_set_property(m_point_set, - name)); - } - else if (dynamic_cast*>(readers[i])) - { - m_properties.push_back - (new PLY_property_to_point_set_property(m_point_set, - name)); - } - else if (dynamic_cast*>(readers[i])) - { - m_properties.push_back - (new PLY_property_to_point_set_property(m_point_set, - name)); - } + if (dynamic_cast*>(property)) + m_use_floats = true; + continue; + } + if (name == "nx") + { + has_normal[0] = true; + continue; + } + if (name == "ny") + { + has_normal[1] = true; + continue; + } + if (name == "nz") + { + has_normal[2] = true; + continue; } + if (dynamic_cast*>(property)) + { + m_properties.push_back + (new PLY_property_to_point_set_property(m_point_set, + name)); + } + else if (dynamic_cast*>(property)) + { + m_properties.push_back + (new PLY_property_to_point_set_property(m_point_set, + name)); + } + else if (dynamic_cast*>(property)) + { + m_properties.push_back + (new PLY_property_to_point_set_property(m_point_set, + name)); + } + else if (dynamic_cast*>(property)) + { + m_properties.push_back + (new PLY_property_to_point_set_property(m_point_set, + name)); + } + else if (dynamic_cast*>(property)) + { + m_properties.push_back + (new PLY_property_to_point_set_property(m_point_set, + name)); + } + else if (dynamic_cast*>(property)) + { + m_properties.push_back + (new PLY_property_to_point_set_property(m_point_set, + name)); + } + else if (dynamic_cast*>(property)) + { + m_properties.push_back + (new PLY_property_to_point_set_property(m_point_set, + name)); + } + else if (dynamic_cast*>(property)) + { + m_properties.push_back + (new PLY_property_to_point_set_property(m_point_set, + name)); + } + } if (has_normal[0] && has_normal[1] && has_normal[2]) m_point_set.add_normal_map(); } - void process_line (PLY_reader& reader) + void process_line (PLY_element& element) { m_point_set.insert(); if (m_use_floats) - process_line(reader); + process_line(element); else - process_line(reader); + process_line(element); for (std::size_t i = 0; i < m_properties.size(); ++ i) - m_properties[i]->assign (reader, *(m_point_set.end() - 1)); + m_properties[i]->assign (element, *(m_point_set.end() - 1)); } template - void process_line (PLY_reader& reader) + void process_line (PLY_element& element) { FT x = (FT)0.,y = (FT)0., z = (FT)0., nx = (FT)0., ny = (FT)0., nz = (FT)0.; - reader.assign (x, "x"); - reader.assign (y, "y"); - reader.assign (z, "z"); + element.assign (x, "x"); + element.assign (y, "y"); + element.assign (z, "z"); Point point (x, y, z); m_point_set.point(*(m_point_set.end() - 1)) = point; if (m_point_set.has_normal_map()) { - reader.assign (nx, "nx"); - reader.assign (ny, "ny"); - reader.assign (nz, "nz"); + element.assign (nx, "nx"); + element.assign (ny, "ny"); + element.assign (nz, "nz"); Vector normal (nx, ny, nz); m_point_set.normal(*(m_point_set.end() - 1)) = normal; } @@ -401,24 +399,33 @@ read_ply_point_set( if (comments != NULL) *comments = reader.comments(); - filler.instantiate_properties (reader); + for (std::size_t i = 0; i < reader.number_of_elements(); ++ i) + { + internal::PLY::PLY_element& element = reader.element(i); - point_set.reserve (reader.m_nb_points); - - std::size_t points_read = 0; - - while (!(stream.eof()) && points_read < reader.m_nb_points) + if (element.name() == "vertex" || element.name() == "vertices") { - for (std::size_t i = 0; i < reader.readers().size (); ++ i) - reader.readers()[i]->get (stream); - - filler.process_line (reader); - - ++ points_read; + point_set.reserve (element.number_of_items()); + filler.instantiate_properties (element); } - // Skip remaining lines + + for (std::size_t j = 0; j < element.number_of_items(); ++ j) + { + for (std::size_t k = 0; k < element.number_of_properties(); ++ k) + { + internal::PLY::PLY_read_number* property = element.property(k); + property->get (stream); - return (points_read == reader.m_nb_points); + if (stream.eof()) + return false; + } + + if (element.name() == "vertex" || element.name() == "vertices") + filler.process_line (element); + } + } + + return !stream.bad(); } /*! diff --git a/Point_set_processing_3/include/CGAL/IO/read_ply_points.h b/Point_set_processing_3/include/CGAL/IO/read_ply_points.h index d96d61c76b1..11409af4abb 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_ply_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_ply_points.h @@ -48,12 +48,12 @@ #define TRY_TO_GENERATE_PROPERTY(STD_TYPE, T_TYPE, TYPE) \ if (type == STD_TYPE || type == T_TYPE) \ - m_properties->push_back (new PLY_read_typed_number< TYPE > (name, format)) + m_elements.back().add_property (new PLY_read_typed_number< TYPE > (name, format)) #define TRY_TO_GENERATE_SIZED_LIST_PROPERTY(STD_SIZE_TYPE, T_SIZE_TYPE, SIZE_TYPE, STD_INDEX_TYPE, T_INDEX_TYPE, INDEX_TYPE) \ if ((size_type == STD_SIZE_TYPE || size_type == T_SIZE_TYPE) && \ (index_type == STD_INDEX_TYPE || index_type == T_INDEX_TYPE)) \ - m_properties->push_back (new PLY_read_typed_list_with_typed_size< SIZE_TYPE , INDEX_TYPE > (name, format)) + m_elements.back().add_property (new PLY_read_typed_list_with_typed_size< SIZE_TYPE , INDEX_TYPE > (name, format)) #define TRY_TO_GENERATE_LIST_PROPERTY(STD_INDEX_TYPE, T_INDEX_TYPE, INDEX_TYPE) \ TRY_TO_GENERATE_SIZED_LIST_PROPERTY("uchar", "uint8", boost::uint8_t, STD_INDEX_TYPE, T_INDEX_TYPE, INDEX_TYPE); \ @@ -317,24 +317,145 @@ namespace internal { } }; + class PLY_element + { + std::string m_name; + std::size_t m_number; + + std::vector m_properties; + public: + + PLY_element (const std::string& name, std::size_t number) + : m_name (name), m_number (number) + { } + + PLY_element (const PLY_element& other) + : m_name (other.m_name), m_number (other.m_number), m_properties (other.m_properties) + { + const_cast(other).m_properties.clear(); + } + + PLY_element& operator= (const PLY_element& other) + { + m_name = other.m_name; + m_number = other.m_number; + m_properties = other.m_properties; + const_cast(other).m_properties.clear(); + return *this; + } + + ~PLY_element() + { + for (std::size_t i = 0; i < m_properties.size(); ++ i) + delete m_properties[i]; + } + + const std::string& name() const { return m_name; } + std::size_t number_of_items() const { return m_number; } + std::size_t number_of_properties() const { return m_properties.size(); } + + PLY_read_number* property (std::size_t idx) { return m_properties[idx]; } + + void add_property (PLY_read_number* read_number) + { + m_properties.push_back (read_number); + } + + template + bool has_property (const char* tag) + { + return has_property (tag, Type()); + } + template + bool has_property (const char* tag, const std::vector&) + { + for (std::size_t i = 0; i < number_of_properties(); ++ i) + if (m_properties[i]->name () == tag) + return (dynamic_cast*>(m_properties[i]) != NULL); + return false; + } + + template + bool has_property (const char* tag, Type) + { + for (std::size_t i = 0; i < number_of_properties(); ++ i) + if (m_properties[i]->name () == tag) + return (dynamic_cast*>(m_properties[i]) != NULL); + return false; + } + bool has_property (const char* tag, double) + { + for (std::size_t i = 0; i < number_of_properties(); ++ i) + if (m_properties[i]->name () == tag) + return (dynamic_cast*>(m_properties[i]) != NULL + || dynamic_cast*>(m_properties[i]) != NULL); + + return false; + } + + template + void assign (Type& t, const char* tag) + { + for (std::size_t i = 0; i < number_of_properties (); ++ i) + if (m_properties[i]->name () == tag) + { + PLY_read_typed_number* + property = dynamic_cast*>(m_properties[i]); + CGAL_assertion (property != NULL); + t = property->buffer(); + return; + } + } + + template + void assign (std::vector& t, const char* tag) + { + for (std::size_t i = 0; i < number_of_properties (); ++ i) + if (m_properties[i]->name () == tag) + { + PLY_read_typed_list* + property = dynamic_cast*>(m_properties[i]); + CGAL_assertion (property != NULL); + t = property->buffer(); + return; + } + } + + void assign (double& t, const char* tag) + { + for (std::size_t i = 0; i < number_of_properties (); ++ i) + if (m_properties[i]->name () == tag) + { + PLY_read_typed_number* + property_double = dynamic_cast*>(m_properties[i]); + if (property_double == NULL) + { + PLY_read_typed_number* + property_float = dynamic_cast*>(m_properties[i]); + CGAL_assertion (property_float != NULL); + t = property_float->buffer(); + } + else + t = property_double->buffer(); + + return; + } + } + + }; class PLY_reader { - std::vector m_point_properties; - std::vector m_face_properties; - std::vector* m_properties; + std::vector m_elements; std::string m_comments; public: - std::size_t m_nb_points; - std::size_t m_nb_faces; + PLY_reader () { } - PLY_reader () : m_properties (&m_point_properties), m_nb_points (0), m_nb_faces(0) { } - - const std::vector& readers() const { return *m_properties; } - void read_faces() + std::size_t number_of_elements() const { return m_elements.size(); } + PLY_element& element (std::size_t idx) { - m_properties = &m_face_properties; + return m_elements[idx]; } const std::string& comments() const { return m_comments; } @@ -349,9 +470,6 @@ namespace internal { std::string line; std::istringstream iss; - // Check the order of the properties of the point set - bool reading_vertices = false, reading_faces = false; - while (getline (stream,line)) { iss.clear(); @@ -401,9 +519,6 @@ namespace internal { if (keyword == "property") { - if (!reading_vertices && !reading_faces) - continue; - std::string type, name; if (!(iss >> type >> name)) { @@ -455,9 +570,6 @@ namespace internal { m_comments += "\n"; } } - // When end_header is reached, stop loop and begin reading points - else if (keyword == "end_header") - break; else if (keyword == "element") { std::string type; @@ -468,120 +580,18 @@ namespace internal { return false; } - if (type == "vertex") - { - m_nb_points = number; - reading_vertices = true; - reading_faces = false; - } - - else if (type == "face") - { - m_nb_faces = number; - reading_faces = true; - reading_vertices = false; - m_properties = &m_face_properties; - } - else - { - reading_faces = false; - reading_vertices = false; - continue; - } + m_elements.push_back (PLY_element(type, number)); } - + // When end_header is reached, stop loop and begin reading points + else if (keyword == "end_header") + break; } } - m_properties = &m_point_properties; return true; } ~PLY_reader () { - for (std::size_t i = 0; i < m_point_properties.size (); ++ i) - delete m_point_properties[i]; - m_point_properties.clear(); - } - - template - bool does_tag_exist (const char* tag) - { - return does_tag_exist (tag, Type()); - } - - template - void assign (Type& t, const char* tag) - { - for (std::size_t i = 0; i < m_properties->size (); ++ i) - if ((*m_properties)[i]->name () == tag) - { - PLY_read_typed_number* - reader = dynamic_cast*>((*m_properties)[i]); - CGAL_assertion (reader != NULL); - t = reader->buffer(); - return; - } - } - - template - void assign (std::vector& t, const char* tag) - { - for (std::size_t i = 0; i < m_properties->size (); ++ i) - if ((*m_properties)[i]->name () == tag) - { - PLY_read_typed_list* - reader = dynamic_cast*>((*m_properties)[i]); - CGAL_assertion (reader != NULL); - t = reader->buffer(); - return; - } - } - - template - bool does_tag_exist (const char* tag, const std::vector&) - { - for (std::size_t i = 0; i < m_properties->size (); ++ i) - if ((*m_properties)[i]->name () == tag) - return (dynamic_cast*>((*m_properties)[i]) != NULL); - return false; - } - - template - bool does_tag_exist (const char* tag, Type) - { - for (std::size_t i = 0; i < m_properties->size (); ++ i) - if ((*m_properties)[i]->name () == tag) - return (dynamic_cast*>((*m_properties)[i]) != NULL); - return false; - } - bool does_tag_exist (const char* tag, double) - { - for (std::size_t i = 0; i < m_properties->size (); ++ i) - if ((*m_properties)[i]->name () == tag) - return (dynamic_cast*>((*m_properties)[i]) != NULL - || dynamic_cast*>((*m_properties)[i]) != NULL); - - return false; - } - void assign (double& t, const char* tag) - { - for (std::size_t i = 0; i < m_properties->size (); ++ i) - if ((*m_properties)[i]->name () == tag) - { - PLY_read_typed_number* - reader_double = dynamic_cast*>((*m_properties)[i]); - if (reader_double == NULL) - { - PLY_read_typed_number* - reader_float = dynamic_cast*>((*m_properties)[i]); - CGAL_assertion (reader_float != NULL); - t = reader_float->buffer(); - } - else - t = reader_double->buffer(); - - return; - } } }; @@ -640,12 +650,12 @@ namespace internal { typename PropertyMap, typename Constructor, typename ... T> - void process_properties (PLY_reader& reader, OutputValueType& new_element, + void process_properties (PLY_element& element, OutputValueType& new_element, std::tuple...>&& current) { typedef typename PropertyMap::value_type PmapValueType; std::tuple values; - Filler::fill(reader, values, current); + Filler::fill(element, values, current); PmapValueType new_value = call_functor(std::get<1>(current), values); put (std::get<0>(current), new_element, new_value); } @@ -656,42 +666,42 @@ namespace internal { typename ... T, typename NextPropertyBinder, typename ... PropertyMapBinders> - void process_properties (PLY_reader& reader, OutputValueType& new_element, + void process_properties (PLY_element& element, OutputValueType& new_element, std::tuple...>&& current, NextPropertyBinder&& next, PropertyMapBinders&& ... properties) { typedef typename PropertyMap::value_type PmapValueType; std::tuple values; - Filler::fill(reader, values, current); + Filler::fill(element, values, current); PmapValueType new_value = call_functor(std::get<1>(current), values); put (std::get<0>(current), new_element, new_value); - process_properties (reader, new_element, std::forward(next), + process_properties (element, new_element, std::forward(next), std::forward(properties)...); } template - void process_properties (PLY_reader& reader, OutputValueType& new_element, + void process_properties (PLY_element& element, OutputValueType& new_element, std::pair >&& current) { T new_value = T(); - reader.assign (new_value, current.second.name); + element.assign (new_value, current.second.name); put (current.first, new_element, new_value); } template - void process_properties (PLY_reader& reader, OutputValueType& new_element, + void process_properties (PLY_element& element, OutputValueType& new_element, std::pair >&& current, NextPropertyBinder&& next, PropertyMapBinders&& ... properties) { T new_value = T(); - reader.assign (new_value, current.second.name); + element.assign (new_value, current.second.name); put (current.first, new_element, new_value); - process_properties (reader, new_element, std::forward(next), + process_properties (element, new_element, std::forward(next), std::forward(properties)...); } @@ -757,24 +767,31 @@ bool read_ply_points_with_properties (std::istream& stream, if (!(reader.init (stream))) return false; - std::size_t points_read = 0; - - while (!(stream.eof()) && points_read < reader.m_nb_points) + for (std::size_t i = 0; i < reader.number_of_elements(); ++ i) + { + internal::PLY::PLY_element& element = reader.element(i); + + for (std::size_t j = 0; j < element.number_of_items(); ++ j) { - for (std::size_t i = 0; i < reader.readers().size (); ++ i) - reader.readers()[i]->get (stream); + for (std::size_t k = 0; k < element.number_of_properties(); ++ k) + { + internal::PLY::PLY_read_number* property = element.property(k); + property->get (stream); - OutputValueType new_element; + if (stream.eof()) + return false; + } - internal::PLY::process_properties (reader, new_element, std::forward(properties)...); - - *(output ++) = new_element; - - ++ points_read; + if (element.name() == "vertex" || element.name() == "vertices") + { + OutputValueType new_element; + internal::PLY::process_properties (element, new_element, std::forward(properties)...); + *(output ++) = new_element; + } } - // Skip remaining lines + } - return (points_read == reader.m_nb_points); + return true; } /// \cond SKIP_IN_MANUAL diff --git a/Polyhedron_IO/include/CGAL/IO/PLY_reader.h b/Polyhedron_IO/include/CGAL/IO/PLY_reader.h index 371114bd353..36b8a16fef1 100644 --- a/Polyhedron_IO/include/CGAL/IO/PLY_reader.h +++ b/Polyhedron_IO/include/CGAL/IO/PLY_reader.h @@ -29,36 +29,40 @@ namespace CGAL{ template bool read_PLY_faces (std::istream& in, - PLY::PLY_reader& reader, + internal::PLY::PLY_element& element, std::vector< Polygon_3 >& polygons, std::vector< Color_rgb >& fcolors, const char* vertex_indices_tag) { - std::size_t faces_read = 0; - bool has_colors = false; std::string rtag = "r", gtag = "g", btag = "b"; - if ((reader.does_tag_exist("red") || reader.does_tag_exist("r")) && - (reader.does_tag_exist("green") || reader.does_tag_exist("g")) && - (reader.does_tag_exist("blue") || reader.does_tag_exist("b"))) + if ((element.has_property("red") || element.has_property("r")) && + (element.has_property("green") || element.has_property("g")) && + (element.has_property("blue") || element.has_property("b"))) { has_colors = true; - if (reader.does_tag_exist("red")) + if (element.has_property("red")) { rtag = "red"; gtag = "green"; btag = "blue"; } } - while (!(in.eof()) && faces_read < reader.m_nb_faces) + for (std::size_t j = 0; j < element.number_of_items(); ++ j) { - for (std::size_t i = 0; i < reader.readers().size (); ++ i) - reader.readers()[i]->get (in); + for (std::size_t k = 0; k < element.number_of_properties(); ++ k) + { + internal::PLY::PLY_read_number* property = element.property(k); + property->get (in); + + if (in.eof()) + return false; + } cpp11::tuple, boost::uint8_t, boost::uint8_t, boost::uint8_t> new_face; if (has_colors) { - PLY::process_properties (reader, new_face, + PLY::process_properties (element, new_face, std::make_pair (CGAL::make_nth_of_tuple_property_map<0>(new_face), PLY_property >(vertex_indices_tag)), std::make_pair (CGAL::make_nth_of_tuple_property_map<1>(new_face), @@ -71,15 +75,13 @@ namespace CGAL{ fcolors.push_back (Color_rgb (get<1>(new_face), get<2>(new_face), get<3>(new_face))); } else - PLY::process_properties (reader, new_face, + PLY::process_properties (element, new_face, std::make_pair (CGAL::make_nth_of_tuple_property_map<0>(new_face), PLY_property >(vertex_indices_tag))); polygons.push_back (Polygon_3(get<0>(new_face).size())); for (std::size_t i = 0; i < get<0>(new_face).size(); ++ i) polygons.back()[i] = std::size_t(get<0>(new_face)[i]); - - ++ faces_read; } return !in.bad(); @@ -106,45 +108,66 @@ namespace CGAL{ if (!(reader.init (in))) return false; - std::size_t points_read = 0; - - while (!(in.eof()) && points_read < reader.m_nb_points) + for (std::size_t i = 0; i < reader.number_of_elements(); ++ i) { - for (std::size_t i = 0; i < reader.readers().size (); ++ i) - reader.readers()[i]->get (in); + internal::PLY::PLY_element& element = reader.element(i); - Point_3 new_vertex; + if (element.name() == "vertex" || element.name() == "vertices") + { + for (std::size_t j = 0; j < element.number_of_items(); ++ j) + { + for (std::size_t k = 0; k < element.number_of_properties(); ++ k) + { + internal::PLY::PLY_read_number* property = element.property(k); + property->get (in); - internal::PLY::process_properties (reader, new_vertex, - make_ply_point_reader (CGAL::Identity_property_map())); - + if (in.eof()) + return false; + } - points.push_back (new_vertex); + Point_3 new_vertex; + + internal::PLY::process_properties (element, new_vertex, + make_ply_point_reader (CGAL::Identity_property_map())); - ++ points_read; + points.push_back (get<0>(new_vertex)); + } + } + else if (element.name() == "face" || element.name() == "faces") + { + std::vector dummy; + + if (element.has_property > ("vertex_indices")) + internal::read_PLY_faces (in, element, polygons, dummy, "vertex_indices"); + else if (element.has_property > ("vertex_indices")) + internal::read_PLY_faces (in, element, polygons, dummy, "vertex_indices"); + else if (element.has_property > ("vertex_index")) + internal::read_PLY_faces (in, element, polygons, dummy, "vertex_index"); + else if (element.has_property > ("vertex_index")) + internal::read_PLY_faces (in, element, polygons, dummy, "vertex_index"); + else + { + std::cerr << "Error: can't find vertex indices in PLY input" << std::endl; + return false; + } + } + else // Read other elements and ignore + { + for (std::size_t j = 0; j < element.number_of_items(); ++ j) + { + for (std::size_t k = 0; k < element.number_of_properties(); ++ k) + { + internal::PLY::PLY_read_number* property = element.property(k); + property->get (in); + + if (in.eof()) + return false; + } + } + } } - if (points_read != reader.m_nb_points) - return false; - - std::vector dummy; - - reader.read_faces(); - - if (reader.does_tag_exist > ("vertex_indices")) - return internal::read_PLY_faces (in, reader, polygons, dummy, "vertex_indices"); - - if (reader.does_tag_exist > ("vertex_indices")) - return internal::read_PLY_faces (in, reader, polygons, dummy, "vertex_indices"); - - if (reader.does_tag_exist > ("vertex_index")) - return internal::read_PLY_faces (in, reader, polygons, dummy, "vertex_index"); - - if (reader.does_tag_exist > ("vertex_index")) - return internal::read_PLY_faces (in, reader, polygons, dummy, "vertex_index"); - - std::cerr << "Error: can't find vertex indices in PLY input" << std::endl; - return false; + return !in.bad(); } template @@ -161,75 +184,96 @@ namespace CGAL{ std::cerr << "Error: cannot open file" << std::endl; return false; } - internal::PLY::PLY_reader reader; if (!(reader.init (in))) return false; - - std::size_t points_read = 0; - bool has_colors = false; - std::string rtag = "r", gtag = "g", btag = "b"; - if ((reader.does_tag_exist("red") || reader.does_tag_exist("r")) && - (reader.does_tag_exist("green") || reader.does_tag_exist("g")) && - (reader.does_tag_exist("blue") || reader.does_tag_exist("b"))) + for (std::size_t i = 0; i < reader.number_of_elements(); ++ i) { - has_colors = true; - if (reader.does_tag_exist("red")) + internal::PLY::PLY_element& element = reader.element(i); + + if (element.name() == "vertex" || element.name() == "vertices") { - rtag = "red"; gtag = "green"; btag = "blue"; + bool has_colors = false; + std::string rtag = "r", gtag = "g", btag = "b"; + if ((element.has_property("red") || element.has_property("r")) && + (element.has_property("green") || element.has_property("g")) && + (element.has_property("blue") || element.has_property("b"))) + { + has_colors = true; + if (element.has_property("red")) + { + rtag = "red"; gtag = "green"; btag = "blue"; + } + } + + for (std::size_t j = 0; j < element.number_of_items(); ++ j) + { + for (std::size_t k = 0; k < element.number_of_properties(); ++ k) + { + internal::PLY::PLY_read_number* property = element.property(k); + property->get (in); + + if (in.eof()) + return false; + } + + cpp11::tuple new_vertex; + + if (has_colors) + { + internal::PLY::process_properties (element, new_vertex, + make_ply_point_reader (CGAL::make_nth_of_tuple_property_map<0>(new_vertex)), + std::make_pair (CGAL::make_nth_of_tuple_property_map<1>(new_vertex), + PLY_property(rtag.c_str())), + std::make_pair (CGAL::make_nth_of_tuple_property_map<2>(new_vertex), + PLY_property(gtag.c_str())), + std::make_pair (CGAL::make_nth_of_tuple_property_map<3>(new_vertex), + PLY_property(btag.c_str()))); + + vcolors.push_back (Color_rgb (get<1>(new_vertex), get<2>(new_vertex), get<3>(new_vertex))); + } + else + internal::PLY::process_properties (element, new_vertex, + make_ply_point_reader (CGAL::make_nth_of_tuple_property_map<0>(new_vertex))); + + points.push_back (get<0>(new_vertex)); + } + } + else if (element.name() == "face" || element.name() == "faces") + { + if (element.has_property > ("vertex_indices")) + internal::read_PLY_faces (in, element, polygons, fcolors, "vertex_indices"); + else if (element.has_property > ("vertex_indices")) + internal::read_PLY_faces (in, element, polygons, fcolors, "vertex_indices"); + else if (element.has_property > ("vertex_index")) + internal::read_PLY_faces (in, element, polygons, fcolors, "vertex_index"); + else if (element.has_property > ("vertex_index")) + internal::read_PLY_faces (in, element, polygons, fcolors, "vertex_index"); + else + { + std::cerr << "Error: can't find vertex indices in PLY input" << std::endl; + return false; + } + } + else // Read other elements and ignore + { + for (std::size_t j = 0; j < element.number_of_items(); ++ j) + { + for (std::size_t k = 0; k < element.number_of_properties(); ++ k) + { + internal::PLY::PLY_read_number* property = element.property(k); + property->get (in); + + if (in.eof()) + return false; + } + } } } - while (!(in.eof()) && points_read < reader.m_nb_points) - { - for (std::size_t i = 0; i < reader.readers().size (); ++ i) - reader.readers()[i]->get (in); - - cpp11::tuple new_vertex; - - if (has_colors) - { - internal::PLY::process_properties (reader, new_vertex, - make_ply_point_reader (CGAL::make_nth_of_tuple_property_map<0>(new_vertex)), - std::make_pair (CGAL::make_nth_of_tuple_property_map<1>(new_vertex), - PLY_property(rtag.c_str())), - std::make_pair (CGAL::make_nth_of_tuple_property_map<2>(new_vertex), - PLY_property(gtag.c_str())), - std::make_pair (CGAL::make_nth_of_tuple_property_map<3>(new_vertex), - PLY_property(btag.c_str()))); - - vcolors.push_back (Color_rgb (get<1>(new_vertex), get<2>(new_vertex), get<3>(new_vertex))); - } - else - internal::PLY::process_properties (reader, new_vertex, - make_ply_point_reader (CGAL::make_nth_of_tuple_property_map<0>(new_vertex))); - - points.push_back (get<0>(new_vertex)); - - ++ points_read; - } - - if (points_read != reader.m_nb_points) - return false; - - reader.read_faces(); - - if (reader.does_tag_exist > ("vertex_indices")) - return internal::read_PLY_faces (in, reader, polygons, fcolors, "vertex_indices"); - - if (reader.does_tag_exist > ("vertex_indices")) - return internal::read_PLY_faces (in, reader, polygons, fcolors, "vertex_indices"); - - if (reader.does_tag_exist > ("vertex_index")) - return internal::read_PLY_faces (in, reader, polygons, fcolors, "vertex_index"); - - if (reader.does_tag_exist > ("vertex_index")) - return internal::read_PLY_faces (in, reader, polygons, fcolors, "vertex_index"); - - std::cerr << "Error: can't find vertex indices in PLY input" << std::endl; - return false; + return !in.bad(); } From 1cfcb1ba5b57d4989866d4a6749ec311f05186d2 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Tue, 18 Dec 2018 15:28:02 +0100 Subject: [PATCH 173/193] Fix stream status handling everywhere PLY reader is used --- Point_set_3/include/CGAL/Point_set_3/IO.h | 8 ++++--- .../include/CGAL/IO/read_ply_points.h | 5 ++++- Polyhedron_IO/include/CGAL/IO/PLY_reader.h | 22 ++++++++++++------- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/Point_set_3/include/CGAL/Point_set_3/IO.h b/Point_set_3/include/CGAL/Point_set_3/IO.h index 287cf45e728..6d6e3acb2aa 100644 --- a/Point_set_3/include/CGAL/Point_set_3/IO.h +++ b/Point_set_3/include/CGAL/Point_set_3/IO.h @@ -394,7 +394,10 @@ read_ply_point_set( internal::PLY::Point_set_3_filler filler(point_set); if (!(reader.init (stream))) + { + stream.setstate(std::ios::failbit); return false; + } if (comments != NULL) *comments = reader.comments(); @@ -415,8 +418,7 @@ read_ply_point_set( { internal::PLY::PLY_read_number* property = element.property(k); property->get (stream); - - if (stream.eof()) + if (stream.fail()) return false; } @@ -425,7 +427,7 @@ read_ply_point_set( } } - return !stream.bad(); + return true; } /*! diff --git a/Point_set_processing_3/include/CGAL/IO/read_ply_points.h b/Point_set_processing_3/include/CGAL/IO/read_ply_points.h index 11409af4abb..a7cc94683ca 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_ply_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_ply_points.h @@ -765,7 +765,10 @@ bool read_ply_points_with_properties (std::istream& stream, internal::PLY::PLY_reader reader; if (!(reader.init (stream))) + { + stream.setstate(std::ios::failbit); return false; + } for (std::size_t i = 0; i < reader.number_of_elements(); ++ i) { @@ -778,7 +781,7 @@ bool read_ply_points_with_properties (std::istream& stream, internal::PLY::PLY_read_number* property = element.property(k); property->get (stream); - if (stream.eof()) + if (stream.fail()) return false; } diff --git a/Polyhedron_IO/include/CGAL/IO/PLY_reader.h b/Polyhedron_IO/include/CGAL/IO/PLY_reader.h index 36b8a16fef1..2f7522c36fd 100644 --- a/Polyhedron_IO/include/CGAL/IO/PLY_reader.h +++ b/Polyhedron_IO/include/CGAL/IO/PLY_reader.h @@ -54,7 +54,7 @@ namespace CGAL{ internal::PLY::PLY_read_number* property = element.property(k); property->get (in); - if (in.eof()) + if (in.fail()) return false; } @@ -84,7 +84,7 @@ namespace CGAL{ polygons.back()[i] = std::size_t(get<0>(new_face)[i]); } - return !in.bad(); + return true; } } @@ -106,7 +106,10 @@ namespace CGAL{ internal::PLY::PLY_reader reader; if (!(reader.init (in))) + { + in.setstate(std::ios::failbit); return false; + } for (std::size_t i = 0; i < reader.number_of_elements(); ++ i) { @@ -121,7 +124,7 @@ namespace CGAL{ internal::PLY::PLY_read_number* property = element.property(k); property->get (in); - if (in.eof()) + if (in.fail()) return false; } @@ -160,14 +163,14 @@ namespace CGAL{ internal::PLY::PLY_read_number* property = element.property(k); property->get (in); - if (in.eof()) + if (in.fail()) return false; } } } } - return !in.bad(); + return true; } template @@ -187,7 +190,10 @@ namespace CGAL{ internal::PLY::PLY_reader reader; if (!(reader.init (in))) + { + in.setstate(std::ios::failbit); return false; + } for (std::size_t i = 0; i < reader.number_of_elements(); ++ i) { @@ -215,7 +221,7 @@ namespace CGAL{ internal::PLY::PLY_read_number* property = element.property(k); property->get (in); - if (in.eof()) + if (in.fail()) return false; } @@ -266,14 +272,14 @@ namespace CGAL{ internal::PLY::PLY_read_number* property = element.property(k); property->get (in); - if (in.eof()) + if (in.fail()) return false; } } } } - return !in.bad(); + return true; } From 0f0f03e08bb048eb47efeee0201d41d5a4648188 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 19 Dec 2018 16:05:08 +0100 Subject: [PATCH 174/193] handle empty meshes --- .../include/CGAL/Polygon_mesh_processing/bbox.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/bbox.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/bbox.h index 033364bac9b..a82985d40a4 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/bbox.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/bbox.h @@ -76,13 +76,12 @@ namespace CGAL { GT gt = choose_param(get_param(np, internal_np::geom_traits), GT()); typename GT::Construct_bbox_3 get_bbox = gt.construct_bbox_3_object(); - typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; + typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; - halfedge_descriptor h0 = *(halfedges(pmesh).first); - CGAL::Bbox_3 bb = get(vpm, target(h0, pmesh)).bbox(); - BOOST_FOREACH(halfedge_descriptor h, halfedges(pmesh)) + CGAL::Bbox_3 bb; + BOOST_FOREACH(vertex_descriptor v, vertices(pmesh)) { - bb += get_bbox( get(vpm, target(h, pmesh)) ); + bb += get_bbox( get(vpm, v) ); } return bb; } From 725e773bdd0e0a43e113f6078db05151844feff7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 20 Dec 2018 09:31:52 +0100 Subject: [PATCH 175/193] add nef to polygon soup --- .../convert_nef_polyhedron_to_polygon_mesh.h | 41 +++++++++++-------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/Nef_3/include/CGAL/boost/graph/convert_nef_polyhedron_to_polygon_mesh.h b/Nef_3/include/CGAL/boost/graph/convert_nef_polyhedron_to_polygon_mesh.h index 369db23902d..7393881de00 100644 --- a/Nef_3/include/CGAL/boost/graph/convert_nef_polyhedron_to_polygon_mesh.h +++ b/Nef_3/include/CGAL/boost/graph/convert_nef_polyhedron_to_polygon_mesh.h @@ -343,36 +343,45 @@ void collect_polygon_mesh_info( } //end of namespace nef_to_pm - -template -void convert_nef_polyhedron_to_polygon_mesh(const Nef_polyhedron& nef, Polygon_mesh& pm, bool triangulate_all_faces = false) +template +void convert_nef_polyhedron_to_polygon_soup(const Nef_polyhedron& nef, + std::vector& points, + std::vector< std::vector >& polygons, + bool triangulate_all_faces = false) { typedef typename Nef_polyhedron::Point_3 Point_3; - typedef typename boost::property_traits::type>::value_type PM_Point; - typedef typename Kernel_traits::Kernel PM_Kernel; typedef typename Kernel_traits::Kernel Nef_Kernel; - typedef Cartesian_converter Converter; - + typedef Cartesian_converter Converter; + typedef typename Output_kernel::Point_3 Out_point; typename Nef_polyhedron::Volume_const_iterator vol_it = nef.volumes_begin(), vol_end = nef.volumes_end(); if ( Nef_polyhedron::Infi_box::extended_kernel() ) ++vol_it; // skip Infi_box CGAL_assertion ( vol_it != vol_end ); ++vol_it; // skip unbounded volume + Converter to_output; + for (;vol_it!=vol_end;++vol_it) + nef_to_pm::collect_polygon_mesh_info(points, + polygons, + nef, + vol_it->shells_begin(), + to_output, + triangulate_all_faces); +} + +template +void convert_nef_polyhedron_to_polygon_mesh(const Nef_polyhedron& nef, Polygon_mesh& pm, bool triangulate_all_faces = false) +{ + typedef typename boost::property_traits::type>::value_type PM_Point; + typedef typename Kernel_traits::Kernel PM_Kernel; + std::vector points; std::vector< std::vector > polygons; - Converter to_inexact; - for (;vol_it!=vol_end;++vol_it) - nef_to_pm::collect_polygon_mesh_info(points, - polygons, - nef, - vol_it->shells_begin(), - to_inexact, - triangulate_all_faces); - + convert_nef_polyhedron_to_polygon_soup(nef, points, polygons, triangulate_all_faces); Polygon_mesh_processing::polygon_soup_to_polygon_mesh(points, polygons, pm); } + } //end of namespace CGAL From 2c6e9c2b70b5975827ca1b8cdf6f5a8091aa5992 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 20 Dec 2018 15:57:51 +0100 Subject: [PATCH 176/193] Fixed memory leaks in partition code --- .../CGAL/boost/graph/METIS/partition_dual_graph.h | 15 ++++++++++++--- .../CGAL/boost/graph/METIS/partition_graph.h | 15 ++++++++++++--- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/METIS/partition_dual_graph.h b/BGL/include/CGAL/boost/graph/METIS/partition_dual_graph.h index 8bfeb002ae1..7e2a15870a7 100644 --- a/BGL/include/CGAL/boost/graph/METIS/partition_dual_graph.h +++ b/BGL/include/CGAL/boost/graph/METIS/partition_dual_graph.h @@ -36,12 +36,15 @@ #include #include +#include + namespace CGAL { namespace METIS { template -void partition_dual_graph(const TriangleMesh& tm, int nparts, +void partition_dual_graph(const TriangleMesh& tm, + int nparts, METIS_options options, // options array const NamedParameters& np) { @@ -93,11 +96,11 @@ void partition_dual_graph(const TriangleMesh& tm, int nparts, idx_t objval; // partition info for the nodes - idx_t* npart = (idx_t*) calloc(nn, sizeof(idx_t)); + idx_t* npart = (idx_t*) calloc(num_vertices(tm), sizeof(idx_t)); CGAL_assertion(npart != NULL); // partition info for the elements - idx_t* epart = (idx_t*) calloc(ne, sizeof(idx_t)); + idx_t* epart = (idx_t*) calloc(num_faces(tm), sizeof(idx_t)); CGAL_assertion(epart != NULL); // do not support Fortran-style arrays @@ -118,6 +121,12 @@ void partition_dual_graph(const TriangleMesh& tm, int nparts, Output_face_partition_ids fo; vo(tm, indices, npart, get_param(np, internal_np::vertex_partition_id)); fo(tm, epart, get_param(np, internal_np::face_partition_id)); + + delete[] eptr; + delete[] eind; + + std::free(npart); + std::free(epart); } template diff --git a/BGL/include/CGAL/boost/graph/METIS/partition_graph.h b/BGL/include/CGAL/boost/graph/METIS/partition_graph.h index 65176d37131..d0f3e56b759 100644 --- a/BGL/include/CGAL/boost/graph/METIS/partition_graph.h +++ b/BGL/include/CGAL/boost/graph/METIS/partition_graph.h @@ -34,6 +34,8 @@ #include #include +#include + namespace CGAL { namespace METIS { @@ -76,7 +78,8 @@ struct Output_face_partition_ids }; template -void partition_graph(const TriangleMesh& tm, int nparts, +void partition_graph(const TriangleMesh& tm, + int nparts, METIS_options options, // pointer to the options array const NamedParameters& np) { @@ -125,11 +128,11 @@ void partition_graph(const TriangleMesh& tm, int nparts, idx_t objval; // partition info for the nodes - idx_t* npart = (idx_t*) calloc(nn, sizeof(idx_t)); + idx_t* npart = (idx_t*) calloc(num_vertices(tm), sizeof(idx_t)); CGAL_assertion(npart != NULL); // partition info for the elements - idx_t* epart = (idx_t*) calloc(ne, sizeof(idx_t)); + idx_t* epart = (idx_t*) calloc(num_faces(tm), sizeof(idx_t)); CGAL_assertion(epart != NULL); // do not support Fortran-style arrays @@ -150,6 +153,12 @@ void partition_graph(const TriangleMesh& tm, int nparts, Output_face_partition_ids fo; vo(tm, indices, npart, get_param(np, internal_np::vertex_partition_id)); fo(tm, epart, get_param(np, internal_np::face_partition_id)); + + delete[] eptr; + delete[] eind; + + std::free(npart); + std::free(epart); } template From fe5c3a77f97b8f3ee1a644ebb2aa74ac2d7a26b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 21 Dec 2018 09:51:58 +0100 Subject: [PATCH 177/193] swap the edge too --- .../internal/Isotropic_remeshing/remesh_impl.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h index 08d90b8f234..0e0596fc1fb 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h @@ -686,6 +686,7 @@ namespace internal { if (is_on_border(he) || is_on_mesh(he)) { he = opposite(he, mesh_); //he now is PATCH_BORDER + e = edge(he, mesh_); CGAL_assertion(is_on_patch_border(he)); } }//end if(not on PATCH) From 04b0a2c48a9cf19cb9b7dc6bc0e82443c88468b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 31 Dec 2018 08:15:28 +0100 Subject: [PATCH 178/193] doc clean-up improve doxygen likeliness --- QP_solver/doc/QP_solver/CGAL/QP_functions.h | 115 +++++--------------- QP_solver/doc/QP_solver/CGAL/QP_models.h | 30 ++--- QP_solver/doc/QP_solver/CGAL/QP_options.h | 3 +- QP_solver/doc/QP_solver/CGAL/QP_solution.h | 6 +- 4 files changed, 39 insertions(+), 115 deletions(-) diff --git a/QP_solver/doc/QP_solver/CGAL/QP_functions.h b/QP_solver/doc/QP_solver/CGAL/QP_functions.h index 1c8b614dd2b..f06b7f6f9a4 100644 --- a/QP_solver/doc/QP_solver/CGAL/QP_functions.h +++ b/QP_solver/doc/QP_solver/CGAL/QP_functions.h @@ -4,6 +4,8 @@ namespace CGAL { /// @{ /*! +\tparam LinearProgram a model of `LinearProgram`. + This function writes a linear program to an output stream (in `MPSFormat`). The time complexity is \f$ \Theta (mn)\f$, even if the program is very sparse. @@ -12,18 +14,9 @@ It writes the linear program `lp` to `out` in `MPSFormat`. The name of the program will be the one provided by `problem_name`. -Requirements --------------- - +\cgalHeading{Requirements} Output operators are defined for all entry types of `lp`. -Example --------------- - -\ref QP_solver/print_first_lp.cpp - -\sa The concept `LinearProgram` - */ template void print_linear_program @@ -32,6 +25,8 @@ const std::string& problem_name = std::string("MY_MPS")); /*! +\tparam NonnegativeLinearProgram a model of `NonnegativeLinearProgram` + This function writes a nonnegative linear program to an output stream (in `MPSFormat`). The time complexity is \f$ \Theta (mn)\f$, even if the program is very sparse. @@ -40,18 +35,9 @@ Writes the nonnegative linear program `lp` to `out` in `MPSFormat`. The name of the program will be the one provided by `problem_name`. -Requirements --------------- - +\cgalHeading{Requirements} Output operators are defined for all entry types of `lp`. -Example --------------- - -\ref QP_solver/print_first_nonnegative_lp.cpp - -\sa The concept `NonnegativeLinearProgram` - */ template void print_nonnegative_linear_program @@ -60,6 +46,8 @@ const std::string& problem_name = std::string("MY_MPS")); /*! +\tparam NonnegativeQuadraticProgram a model of `NonnegativeQuadraticProgram` + This function writes a nonnegative quadratic program to an output stream (in `MPSFormat`). The time complexity is \f$ \Theta (n^2 + mn)\f$, even if the program is very sparse. @@ -68,18 +56,9 @@ Writes the nonnegative quadratic program `qp` to `out` in `MPSFormat`. The name of the program will be the one provided by `problem_name`. -Requirements --------------- - +\cgalHeading{Requirements} Output operators are defined for all entry types of `qp`. -Example --------------- - -\ref QP_solver/print_first_nonnegative_qp.cpp - -\sa The concept `NonnegativeQuadraticProgram` - */ template void print_nonnegative_quadratic_program @@ -88,6 +67,9 @@ const std::string& problem_name = std::string("MY_MPS")); /*! +\tparam QuadraticProgram a model of `QuadraticProgram` + + This function writes a quadratic program to an output stream (in `MPSFormat`). The time complexity is \f$ \Theta (n^2 + mn)\f$, even if the program is very sparse. @@ -95,17 +77,9 @@ if the program is very sparse. Writes the quadratic program `qp` to `out` in `MPSFormat`. The name of the program will be the one provided by `problem_name`. -Requirements --------------- - +\cgalHeading{Requirements} Output operators are defined for all entry types of `qp`. -Example --------------- - -\ref QP_solver/print_first_qp.cpp - -\sa The concept `QuadraticProgram` */ template void print_quadratic_program @@ -118,10 +92,10 @@ This function solves a linear program, using some exact Integral Domain `ET` for its computations. Various options may be provided, see `Quadratic_program_options`. -Requirements --------------- +\tparam LinearProgram a model of `LinearProgram` such as `Quadratic_program`, +`Quadratic_program_from_mps`, or `Linear_program_from_iterators` -`ET` is a model of the concepts `IntegralDomain` and +\tparam ET a model of the concepts `IntegralDomain` and `RealEmbeddable`; it must be an exact type, and all entries of `qp` are convertible to `ET`. @@ -144,15 +118,6 @@ factor. For maximum efficiency, it is advisable to define the macros \returns the solution of the linear program `lp`, solved with exact number type `ET`. -Example --------------- - -\ref QP_solver/first_lp.cpp - -\sa `Quadratic_program` -\sa `Quadratic_program_from_mps` -\sa `Linear_program_from_iterators` - */ template Quadratic_program_solution solve_linear_program @@ -165,10 +130,10 @@ This function solves a nonnegative linear program, using some exact Integral Domain `ET` for its computations. Various options may be provided, see `Quadratic_program_options`. -Requirements --------------- +\tparam NonnegativeQuadraticProgram a model of `NonnegativeQuadraticProgram` such as +`Quadratic_program`, `Quadratic_program_from_mps`, or `Nonnegative_quadratic_program_from_iterators`. -`ET` is a model of the concepts `IntegralDomain` and +\tparam ET is a model of the concepts `IntegralDomain` and `RealEmbeddable`; it must be an exact type, and all entries of `qp` are convertible to `ET`. @@ -191,16 +156,6 @@ factor. For maximum efficiency, it is advisable to define the macros \returns the solution of the nonnegative linear program `lp`, solved with exact number type `ET`. -Example --------------- - -\ref QP_solver/first_nonnegative_lp.cpp - -The models of \ref NonnegativeLinearProgram\: -\sa `Quadratic_program` -\sa `Quadratic_program_from_mps` -\sa `Nonnegative_linear_program_from_iterators` - */ template Quadratic_program_solution solve_nonnegative_linear_program @@ -213,10 +168,10 @@ This function solves a nonnegative quadratic program, using some exact Integral Domain `ET` for its computations. Various options may be provided, see `Quadratic_program_options`. -Requirements --------------- +\tparam NonnegativeQuadraticProgram a model of `NonnegativeQuadraticProgram` such as +`Quadratic_program`, `Quadratic_program_from_mps`, or `Nonnegative_quadratic_program_from_iterators`. -`ET` is a model of the concepts `IntegralDomain` and +\tparam ET a model of the concepts `IntegralDomain` and `RealEmbeddable`; it must be an exact type, and all entries of `qp` are convertible to `ET`. @@ -239,15 +194,6 @@ factor. For maximum efficiency, it is advisable to define the macros \returns the solution of the nonnegative quadratic program `qp`, solved with exact number type `ET`. -Example --------------- - -\ref QP_solver/first_nonnegative_qp.cpp - -The models of \ref ::NonnegativeQuadraticProgram\: -\sa `Quadratic_program` -\sa `Quadratic_program_from_mps` -\sa `Nonnegative_quadratic_program_from_iterators` */ template Quadratic_program_solution solve_nonnegative_quadratic_program @@ -260,10 +206,11 @@ This function solves a quadratic program, using some exact Integral Domain `ET` for its computations. Various options may be provided, see `Quadratic_program_options`. -Requirements --------------- -`ET` is a model of the concepts `IntegralDomain` and +\tparam NonnegativeQuadraticProgram a model of `NonnegativeQuadraticProgram` such as +`Quadratic_program`, `Quadratic_program_from_mps`, or `Nonnegative_quadratic_program_from_iterators`. + +\tparam ET is a model of the concepts `IntegralDomain` and `RealEmbeddable`; it must be an exact type, and all entries of `qp` are convertible to `ET`. @@ -286,16 +233,6 @@ factor. For maximum efficiency, it is advisable to define the macros \returns the solution of the quadratic program `qp`, solved with exact number type `ET`. -Example --------------- - -\ref QP_solver/first_qp.cpp - -The models of \ref QuadraticProgram\: -\sa `Quadratic_program` -\sa `Quadratic_program_from_mps` -\sa `Quadratic_program_from_iterators` - */ template Quadratic_program_solution solve_quadratic_program diff --git a/QP_solver/doc/QP_solver/CGAL/QP_models.h b/QP_solver/doc/QP_solver/CGAL/QP_models.h index 1ede1029905..28748e7f103 100644 --- a/QP_solver/doc/QP_solver/CGAL/QP_models.h +++ b/QP_solver/doc/QP_solver/CGAL/QP_models.h @@ -57,8 +57,7 @@ namespace CGAL { \cgalModels `QuadraticProgram` \cgalModels `LinearProgram` - Example - -------------- + \cgalHeading{Example} \ref QP_solver/first_lp_from_iterators.cpp @@ -113,8 +112,7 @@ public: \returns an instance of `Linear_program_from_iterators`, constructed from the given iterators. - Example - -------------- + \cgalHeading{Example} The following example demonstrates the typical usage of makers with the simpler function `make_nonnegative_linear_program_from_iterators()`. @@ -160,8 +158,7 @@ make_linear_program_from_iterators ( \returns an instance of `Nonnegative_linear_program_from_iterators`, constructed from the given iterators. - Example - -------------- + \cgalHeading{Example} `QP_solver/solve_convex_hull_containment_lp2.h` @@ -198,8 +195,7 @@ make_nonnegative_linear_program_from_iterators ( `Nonnegative_quadratic_program_from_iterators`, constructed from the given iterators. - Example - -------------- + \cgalHeading{Example} The following example demonstrates the typical usage of makers with the simpler function `make_nonnegative_linear_program_from_iterators()`. @@ -240,8 +236,7 @@ make_nonnegative_quadratic_program_from_iterators ( \returns an instance of `Quadratic_program_from_iterators`, constructed from the given iterators. - Example - -------------- + \cgalHeading{Example} The following example demonstrates the typical usage of makers with the simpler function `make_nonnegative_linear_program_from_iterators()`. @@ -330,8 +325,7 @@ make_quadratic_program_from_iterators ( \cgalModels `NonnegativeQuadraticProgram` \cgalModels `NonnegativeLinearProgram` - Example - -------------- + \cgalHeading{Example} \ref QP_solver/first_nonnegative_lp_from_iterators.cpp @@ -422,8 +416,7 @@ public: \cgalModels `QuadraticProgram` \cgalModels `NonnegativeQuadraticProgram` - Example - -------------- + \cgalHeading{Example} \ref QP_solver/first_nonnegative_qp_from_iterators.cpp @@ -522,8 +515,7 @@ public: \cgalModels `QuadraticProgram` - Example - -------------- + \cgalHeading{Example} \ref QP_solver/first_qp_from_iterators.cpp @@ -630,8 +622,7 @@ public: \cgalModels `NonnegativeQuadraticProgram` \cgalModels `NonnegativeLinearProgram` - Example - -------------- + \cgalHeading{Example} \ref QP_solver/first_qp_from_mps.cpp @@ -854,8 +845,7 @@ namespace CGAL { \cgalModels `NonnegativeQuadraticProgram` \cgalModels `NonnegativeLinearProgram` - Example - -------------- + \cgalHeading{Example} \ref QP_solver/first_qp.cpp diff --git a/QP_solver/doc/QP_solver/CGAL/QP_options.h b/QP_solver/doc/QP_solver/CGAL/QP_options.h index 658363321e9..389f4dc81c2 100644 --- a/QP_solver/doc/QP_solver/CGAL/QP_options.h +++ b/QP_solver/doc/QP_solver/CGAL/QP_options.h @@ -15,8 +15,7 @@ options referring to The idea is that this list grows in the future. -Operations --------------- +\cgalHeading{Operations} Here we just have set/get pairs for any option type. diff --git a/QP_solver/doc/QP_solver/CGAL/QP_solution.h b/QP_solver/doc/QP_solver/CGAL/QP_solution.h index b3b9776dbfe..7130cadaf62 100644 --- a/QP_solver/doc/QP_solver/CGAL/QP_solution.h +++ b/QP_solver/doc/QP_solver/CGAL/QP_solution.h @@ -36,13 +36,11 @@ the four functions `solve_nonnegative_quadratic_program`, and `solve_nonnegative_linear_program`. -Example --------------- +\cgalHeading{Example} \ref QP_solver/first_qp.cpp -Terminology --------------- +\cgalHeading{Terminology} If there is no \f$ \qpx\f$ that satisfies all the (in)equalities, the program is called infeasible, otherwise, it is feasible, From ecc89af2b2eaeb6d3f275b6f20d7a0e2cede9dec Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Sun, 30 Dec 2018 14:57:54 +0100 Subject: [PATCH 179/193] Fix Surface_mesh::join() --- .../include/CGAL/Surface_mesh/Surface_mesh.h | 79 +++++++++++++------ 1 file changed, 54 insertions(+), 25 deletions(-) diff --git a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h index 45a7b529eec..8e9392bec14 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h @@ -1106,42 +1106,40 @@ public: } size_type inf_value = (std::numeric_limits::max)(); if(other.vertices_freelist_ != inf_value){ - if(vertices_freelist_ != inf_value){ - Vertex_index vi(nv+other.vertices_freelist_); - Halfedge_index inf((std::numeric_limits::max)()); - while(vconn_[vi].halfedge_ != inf){ - Vertex_index corrected_vi = Vertex_index(size_type(vconn_[vi].halfedge_)+nv-nh); - vconn_[vi].halfedge_ = Halfedge_index(corrected_vi); - vi = corrected_vi; - } - vconn_[vi].halfedge_ = Halfedge_index(vertices_freelist_); + Vertex_index vi(nv+other.vertices_freelist_); + Halfedge_index inf((std::numeric_limits::max)()); + while(vconn_[vi].halfedge_ != inf){ + Vertex_index corrected_vi = Vertex_index(size_type(vconn_[vi].halfedge_)+nv-nh); + vconn_[vi].halfedge_ = Halfedge_index(corrected_vi); + vi = corrected_vi; } + vconn_[vi].halfedge_ = Halfedge_index(vertices_freelist_); + vertices_freelist_ = nv + other.vertices_freelist_; } if(other.faces_freelist_ != inf_value){ - if(faces_freelist_ != inf_value){ - Face_index fi(nf+other.faces_freelist_); - Halfedge_index inf((std::numeric_limits::max)()); - while(fconn_[fi].halfedge_ != inf){ - Face_index corrected_fi = Face_index(size_type(fconn_[fi].halfedge_)+nf-nh); - fconn_[fi].halfedge_ = Halfedge_index(corrected_fi); - fi = corrected_fi; - } - fconn_[fi].halfedge_ = Halfedge_index(faces_freelist_); + Face_index fi(nf+other.faces_freelist_); + Halfedge_index inf((std::numeric_limits::max)()); + while(fconn_[fi].halfedge_ != inf){ + Face_index corrected_fi = Face_index(size_type(fconn_[fi].halfedge_)+nf-nh); + fconn_[fi].halfedge_ = Halfedge_index(corrected_fi); + fi = corrected_fi; } + fconn_[fi].halfedge_ = Halfedge_index(faces_freelist_); + faces_freelist_ = nf + other.faces_freelist_; } + if(other.edges_freelist_ != inf_value){ - if(edges_freelist_ != inf_value){ - Halfedge_index hi(nh+other.edges_freelist_); - Halfedge_index inf((std::numeric_limits::max)()); - while(hconn_[hi].next_halfedge_ != inf){ - hi = hconn_[hi].next_halfedge_; - } - hconn_[hi].next_halfedge_ = Halfedge_index(edges_freelist_); + Halfedge_index hi(nh+other.edges_freelist_); + Halfedge_index inf((std::numeric_limits::max)()); + while(hconn_[hi].next_halfedge_ != inf){ + hi = hconn_[hi].next_halfedge_; } + hconn_[hi].next_halfedge_ = Halfedge_index(edges_freelist_); edges_freelist_ = nh + other.edges_freelist_; } + garbage_ = garbage_ || other.garbage_; removed_vertices_ += other.removed_vertices_; removed_edges_ += other.removed_edges_; @@ -1378,6 +1376,37 @@ public: if(!valid && verbose){ std::cerr << "#faces: iterated: " << fcount << " vs number_of_faces(): " << number_of_faces()<< std::endl; } + + size_type inf = (std::numeric_limits::max)(); + size_type vfl = vertices_freelist_; + int rv = 0; + while(vfl != inf){ + vfl = (size_type)vconn_[Vertex_index(vfl)].halfedge_; + rv++; + } + assert( rv == removed_vertices_ ); + valid = valid && ( rv == removed_vertices_ ); + + + size_type efl = edges_freelist_; + int re = 0; + while(efl != inf){ + efl = (size_type)hconn_[Halfedge_index(efl)].next_halfedge_; + re++; + } + assert( re == removed_edges_ ); + valid = valid && ( re == removed_edges_ ); + + size_type ffl = faces_freelist_; + int rf = 0; + while(ffl != inf){ + ffl = (size_type)fconn_[Face_index(ffl)].halfedge_; + rf++; + } + assert( rf == removed_faces_ ); + valid = valid && ( rf == removed_faces_ ); + + return valid; } From 3bfc09de3fdb5a91d9ff1383ca0dc14b9f64b822 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 31 Dec 2018 09:34:17 +0100 Subject: [PATCH 180/193] add comments --- .../include/CGAL/Surface_mesh/Surface_mesh.h | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h index 8e9392bec14..573d7d9af91 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h @@ -1067,28 +1067,33 @@ public: bool join(const Surface_mesh& other) { + // increase capacity const size_type nv = num_vertices(), nh = num_halfedges(), nf = num_faces(); resize(num_vertices()+ other.num_vertices(), num_edges()+ other.num_edges(), num_faces()+ other.num_faces()); + // append properties in the free space created by resize vprops_.transfer(other.vprops_); hprops_.transfer(other.hprops_); fprops_.transfer(other.fprops_); eprops_.transfer(other.eprops_); + // translate halfedge index in vertex -> halfedge for(size_type i = nv; i < nv+other.num_vertices(); i++){ Vertex_index vi(i); if(vconn_[vi].halfedge_ != null_halfedge()){ vconn_[vi].halfedge_ = Halfedge_index(size_type(vconn_[vi].halfedge_)+nh); } } + // translate halfedge index in face -> halfedge for(size_type i = nf; i < nf+other.num_faces(); i++){ Face_index fi(i); if(fconn_[fi].halfedge_ != null_halfedge()){ fconn_[fi].halfedge_ = Halfedge_index(size_type(fconn_[fi].halfedge_)+nh); } } + // translate indices in halfedge -> face, halfedge -> target, halfedge -> prev, and halfedge -> next for(size_type i = nh; i < nh+other.num_halfedges(); i++){ Halfedge_index hi(i); if(hconn_[hi].face_ != null_face()){ @@ -1105,41 +1110,50 @@ public: } } size_type inf_value = (std::numeric_limits::max)(); + + // merge vertex free list if(other.vertices_freelist_ != inf_value){ Vertex_index vi(nv+other.vertices_freelist_); Halfedge_index inf((std::numeric_limits::max)()); + // correct the indices in the linked list of free vertices copied (due to vconn_ translation) while(vconn_[vi].halfedge_ != inf){ Vertex_index corrected_vi = Vertex_index(size_type(vconn_[vi].halfedge_)+nv-nh); vconn_[vi].halfedge_ = Halfedge_index(corrected_vi); vi = corrected_vi; } + // append the vertex free linked list of `this` to the copy of `other` vconn_[vi].halfedge_ = Halfedge_index(vertices_freelist_); - + // update the begin of the vertex free linked list vertices_freelist_ = nv + other.vertices_freelist_; } + // merge face free list if(other.faces_freelist_ != inf_value){ Face_index fi(nf+other.faces_freelist_); Halfedge_index inf((std::numeric_limits::max)()); + // correct the indices in the linked list of free faces copied (due to fconn_ translation) while(fconn_[fi].halfedge_ != inf){ Face_index corrected_fi = Face_index(size_type(fconn_[fi].halfedge_)+nf-nh); fconn_[fi].halfedge_ = Halfedge_index(corrected_fi); fi = corrected_fi; } + // append the face free linked list of `this` to the copy of `other` fconn_[fi].halfedge_ = Halfedge_index(faces_freelist_); - + // update the begin of the face free linked list faces_freelist_ = nf + other.faces_freelist_; } - + // merge edge free list if(other.edges_freelist_ != inf_value){ Halfedge_index hi(nh+other.edges_freelist_); Halfedge_index inf((std::numeric_limits::max)()); while(hconn_[hi].next_halfedge_ != inf){ hi = hconn_[hi].next_halfedge_; } + // append the halfedge free linked list of `this` to the copy of `other` hconn_[hi].next_halfedge_ = Halfedge_index(edges_freelist_); + // update the begin of the halfedge free linked list edges_freelist_ = nh + other.edges_freelist_; } - + // update garbage infos garbage_ = garbage_ || other.garbage_; removed_vertices_ += other.removed_vertices_; removed_edges_ += other.removed_edges_; @@ -1406,7 +1420,6 @@ public: assert( rf == removed_faces_ ); valid = valid && ( rf == removed_faces_ ); - return valid; } From dc56732a6f6b38ab775d9ae3e69911962ce05f89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 2 Jan 2019 08:46:40 +0100 Subject: [PATCH 181/193] fix typo --- .../doc/Arrangement_on_surface_2/Arrangement_on_surface_2.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Arrangement_on_surface_2.txt b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Arrangement_on_surface_2.txt index ad8d8120b55..dc4d957e931 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Arrangement_on_surface_2.txt +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Arrangement_on_surface_2.txt @@ -2681,7 +2681,7 @@ manner whenever possible. Thus, it resorts to exact computations only when the approximate computation fails to produce an unambiguous result. Note that most arrangement vertices are therefore associated with approximated points. You cannot access the coordinates of such points and obtain them as -algebraic numbers, and only access to the approximate coordinates in possible. +algebraic numbers, and only access to the approximate coordinates is possible. See the Reference Manual for the exact interface of the `Point_2`, `Curve_2` and `X_monotone_curve_2` defined by the traits class. From 5a1b51bdd05898a1e1718b7f70747055cbb6a79b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 2 Jan 2019 10:11:28 +0100 Subject: [PATCH 182/193] fix warning --- Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h index 573d7d9af91..39437aff178 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h @@ -1393,31 +1393,28 @@ public: size_type inf = (std::numeric_limits::max)(); size_type vfl = vertices_freelist_; - int rv = 0; + size_type rv = 0; while(vfl != inf){ vfl = (size_type)vconn_[Vertex_index(vfl)].halfedge_; rv++; } - assert( rv == removed_vertices_ ); valid = valid && ( rv == removed_vertices_ ); size_type efl = edges_freelist_; - int re = 0; + size_type re = 0; while(efl != inf){ efl = (size_type)hconn_[Halfedge_index(efl)].next_halfedge_; re++; } - assert( re == removed_edges_ ); valid = valid && ( re == removed_edges_ ); size_type ffl = faces_freelist_; - int rf = 0; + size_type rf = 0; while(ffl != inf){ ffl = (size_type)fconn_[Face_index(ffl)].halfedge_; rf++; } - assert( rf == removed_faces_ ); valid = valid && ( rf == removed_faces_ ); return valid; From ace09977af4da7aab21f10c94a56209607966cab Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Wed, 2 Jan 2019 12:22:58 +0200 Subject: [PATCH 183/193] Cleaned up the code --- .../Arr_polyhedral_sgm.h | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm.h b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm.h index 603837c1ebf..8a57cd28808 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm.h @@ -242,13 +242,10 @@ private: /*! Set the marked-face index */ void set_marked_facet_index(size_type id) {m_marked_facet_index = id;} - /*! Add all facets. */ + /*! Add vertices to the current facet. */ template - void add_facets(Iterator begin, Iterator end, Builder& B) - { - for (Iterator it = begin; it != end; ++it) B.add_vertex_to_facet(*it); - B.end_facet(); - } + void add_vertices_to_facet(Iterator begin, Iterator end, Builder& B) + { for (Iterator it = begin; it != end; ++it) B.add_vertex_to_facet(*it); } /*! builds the polyhedron */ void operator()(HDS& hds) @@ -271,10 +268,11 @@ private: Polyhedron_facet_handle fh = B.begin_facet(); if (counter == m_marked_facet_index) fh->set_marked(true); //! \todo EF: when upgrading to C++11 enable the following code and - // remove add_facets(). + // remove add_vertices_to_facet(). // for (const auto& facet : *it) B.add_vertex_to_facet(facet); // B.end_facet(); - add_facets(it->begin(), it->end(), B); + add_vertices_to_facet(it->begin(), it->end(), B); + B.end_facet(); ++counter; } B.end_surface(); From 0396dd11182d83ab43e0ef27ab70068086388b56 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Wed, 19 Sep 2018 13:49:25 +0200 Subject: [PATCH 184/193] Patch to improve normal orientation using user-defined seed points --- .../CGAL/boost/graph/named_params_helper.h | 23 +++ .../CGAL/boost/graph/parameters_interface.h | 1 + .../include/CGAL/mst_orient_normals.h | 142 ++++++++++++++---- 3 files changed, 138 insertions(+), 28 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/named_params_helper.h b/BGL/include/CGAL/boost/graph/named_params_helper.h index cbf5a2fedce..e585269eba0 100644 --- a/BGL/include/CGAL/boost/graph/named_params_helper.h +++ b/BGL/include/CGAL/boost/graph/named_params_helper.h @@ -405,6 +405,29 @@ namespace CGAL { > ::type type; }; + template + class GetIsConstrainedMap + { + struct DummyConstrainedMap + { + typedef typename std::iterator_traits::value_type key_type; + typedef bool value_type; + typedef value_type reference; + typedef boost::readable_property_map_tag category; + + typedef DummyConstrainedMap Self; + friend reference get(const Self&, const key_type&) { return false; } + }; + + public: + typedef DummyConstrainedMap NoMap; + typedef typename boost::lookup_named_param_def < + internal_np::point_is_constrained_t, + NamedParameters, + DummyConstrainedMap //default + > ::type type; + }; + } // namespace Point_set_processing_3 template diff --git a/BGL/include/CGAL/boost/graph/parameters_interface.h b/BGL/include/CGAL/boost/graph/parameters_interface.h index d2dd2208420..9e38eec688d 100644 --- a/BGL/include/CGAL/boost/graph/parameters_interface.h +++ b/BGL/include/CGAL/boost/graph/parameters_interface.h @@ -117,3 +117,4 @@ CGAL_add_named_parameter(plane_t, plane_map, plane_map) CGAL_add_named_parameter(plane_index_t, plane_index_map, plane_index_map) CGAL_add_named_parameter(select_percentage_t, select_percentage, select_percentage) CGAL_add_named_parameter(require_uniform_sampling_t, require_uniform_sampling, require_uniform_sampling) +CGAL_add_named_parameter(point_is_constrained_t, point_is_constrained, point_is_constrained_map) diff --git a/Point_set_processing_3/include/CGAL/mst_orient_normals.h b/Point_set_processing_3/include/CGAL/mst_orient_normals.h index 4935cd7d208..7f9789d5e2b 100644 --- a/Point_set_processing_3/include/CGAL/mst_orient_normals.h +++ b/Point_set_processing_3/include/CGAL/mst_orient_normals.h @@ -121,6 +121,34 @@ public: const NormalMap m_normal_map; }; +template +class Default_constrained_map +{ +public: + + typedef boost::readable_property_map_tag category; + typedef typename ForwardIterator::value_type key_type; + typedef bool value_type; + typedef value_type reference; + +private: + + ForwardIterator m_source_point; + +public: + + Default_constrained_map () { } + Default_constrained_map (ForwardIterator source_point) + : m_source_point (source_point) { } + + /// Free function to access the map elements. + friend inline + reference get(const Default_constrained_map& map, key_type p) + { + return (p == *map.m_source_point); + } + +}; /// Helper class: Propagate_normal_orientation /// @@ -145,10 +173,12 @@ struct Propagate_normal_orientation : public boost::base_visitor< Propagate_normal_orientation > { typedef internal::MST_graph MST_graph; + typedef typename MST_graph::vertex_descriptor vertex_descriptor; typedef boost::on_examine_edge event_filter; - Propagate_normal_orientation(double angle_max = CGAL_PI/2.) ///< max angle to propagate the normal orientation (radians) - : m_angle_max(angle_max) + Propagate_normal_orientation(vertex_descriptor source, + double angle_max = CGAL_PI/2.) ///< max angle to propagate the normal orientation (radians) + : m_source(source), m_angle_max(angle_max) { // Precondition: 0 < angle_max <= PI/2 CGAL_point_set_processing_precondition(0 < angle_max && angle_max <= CGAL_PI/2.); @@ -158,16 +188,28 @@ struct Propagate_normal_orientation void operator()(Edge& edge, const MST_graph& mst_graph) { typedef typename boost::property_traits::reference Vector_ref; - typedef typename MST_graph::vertex_descriptor vertex_descriptor; + + // Gets source + vertex_descriptor source_vertex = source(edge, mst_graph); + + // Gets target + vertex_descriptor target_vertex = target(edge, mst_graph); + bool& target_normal_is_oriented = ((MST_graph&)mst_graph)[target_vertex].is_oriented; + + // special case if vertex is source vertex (and thus has no related point/normal) + if (source_vertex == m_source) + { + target_normal_is_oriented = true; + return; + } // Gets source normal - vertex_descriptor source_vertex = source(edge, mst_graph); Vector_ref source_normal = get(mst_graph.m_normal_map, *(mst_graph[source_vertex].input_point) ); const bool source_normal_is_oriented = mst_graph[source_vertex].is_oriented; - // Gets target normal - vertex_descriptor target_vertex = target(edge, mst_graph); + + // Gets target Vector_ref target_normal = get( mst_graph.m_normal_map, *(mst_graph[target_vertex].input_point) ); - bool& target_normal_is_oriented = ((MST_graph&)mst_graph)[target_vertex].is_oriented; + if ( ! target_normal_is_oriented ) { // -> -> @@ -188,6 +230,7 @@ struct Propagate_normal_orientation // Data // Implementation note: boost::breadth_first_search() makes copies of this object => data must be constant or shared. private: + vertex_descriptor m_source; const double m_angle_max; ///< max angle to propagate the normal orientation (radians). }; @@ -264,6 +307,7 @@ template Riemannian_graph @@ -273,6 +317,7 @@ create_riemannian_graph( PointMap point_map, ///< property map: value_type of ForwardIterator -> Point_3 NormalMap normal_map, ///< property map: value_type of ForwardIterator -> Vector_3 IndexMap index_map, ///< property map ForwardIterator -> index + ConstrainedMap constrained_map, ///< property map ForwardIterator -> bool unsigned int k, ///< number of neighbors const Kernel& /*kernel*/) ///< geometric traits. { @@ -337,6 +382,12 @@ create_riemannian_graph( CGAL_point_set_processing_assertion(v == get(index_map,it)); riemannian_graph[v].input_point = it; } + + // add source vertex (virtual, does not correspond to a point) + typename Riemannian_graph::vertex_descriptor v = add_vertex(riemannian_graph); + std::size_t source_point_index = num_input_points; + CGAL_point_set_processing_assertion(v == source_point_index); + // // add edges Riemannian_graph_weight_map riemannian_graph_weight_map = get(boost::edge_weight, riemannian_graph); @@ -384,6 +435,20 @@ create_riemannian_graph( search_iterator++; } + + // Check if point is source + if (get(constrained_map, *it)) + { + typename boost::graph_traits::edge_descriptor e; + bool inserted; + boost::tie(e, inserted) = add_edge(vertex(it_index, riemannian_graph), + vertex(source_point_index, riemannian_graph), + riemannian_graph); + CGAL_point_set_processing_assertion(inserted); + + riemannian_graph_weight_map[e] = 0.; + } + } return riemannian_graph; @@ -418,8 +483,7 @@ create_mst_graph( IndexMap index_map, ///< property map ForwardIterator -> index unsigned int k, ///< number of neighbors const Kernel& kernel, ///< geometric traits. - const Riemannian_graph& riemannian_graph, ///< graph connecting each vertex to its knn - ForwardIterator source_point) ///< source point (with an oriented normal) + const Riemannian_graph& riemannian_graph) ///< graph connecting each vertex to its knn { // prevents warnings CGAL_USE(point_map); @@ -440,16 +504,17 @@ create_mst_graph( CGAL_point_set_processing_precondition(first != beyond); // Number of input points - const std::size_t num_input_points = num_vertices(riemannian_graph); + const std::size_t num_input_points = num_vertices(riemannian_graph) - 1; std::size_t memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE(" %ld Mb allocated\n", memory>>20); CGAL_TRACE(" Calls boost::prim_minimum_spanning_tree()\n"); // Computes Minimum Spanning Tree. - std::size_t source_point_index = get(index_map, source_point); + std::size_t source_point_index = num_input_points; + Riemannian_graph_weight_map riemannian_graph_weight_map = get(boost::edge_weight, riemannian_graph); typedef std::vector PredecessorMap; - PredecessorMap predecessor(num_input_points); + PredecessorMap predecessor(num_input_points + 1); boost::prim_minimum_spanning_tree(riemannian_graph, &predecessor[0], weight_map( riemannian_graph_weight_map ) .root_vertex( vertex(source_point_index, riemannian_graph) )); @@ -472,8 +537,13 @@ create_mst_graph( typename MST_graph::vertex_descriptor v = add_vertex(mst_graph); CGAL_point_set_processing_assertion(v == get(index_map,it)); mst_graph[v].input_point = it; - mst_graph[v].is_oriented = (it == source_point); + mst_graph[v].is_oriented = false; } + + typename MST_graph::vertex_descriptor v = add_vertex(mst_graph); + CGAL_point_set_processing_assertion(v == source_point_index); + mst_graph[v].is_oriented = true; + // add edges for (std::size_t i=0; i < predecessor.size(); i++) // add edges { @@ -525,6 +595,11 @@ create_mst_graph( If this parameter is omitted, `CGAL::Identity_property_map` is used.\cgalParamEnd \cgalParamBegin{normal_map} a model of `ReadWritePropertyMap` with value type `geom_traits::Vector_3`.\cgalParamEnd + \cgalParamBegin{point_is_constrained_map} a model of `ReadablePropertyMap` with value type + `bool`. Points with a `true` value will be used as seed points: their normal will be considered as already + oriented, it won't be altered and it will be propagated to its neighbors. If this parameter is omitted, + the heighest point (heightest Z coordinate) will be used as the unique seed with an upward oriented + normal\cgalParamEnd \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `Kernel`\cgalParamEnd \cgalNamedParamsEnd @@ -545,6 +620,7 @@ mst_orient_normals( typedef typename Point_set_processing_3::GetPointMap::type PointMap; typedef typename Point_set_processing_3::GetNormalMap::type NormalMap; typedef typename Point_set_processing_3::GetK::Kernel Kernel; + typedef typename Point_set_processing_3::GetIsConstrainedMap::type ConstrainedMap; CGAL_static_assertion_msg(!(boost::is_same::NoMap>::value), @@ -552,6 +628,7 @@ mst_orient_normals( PointMap point_map = choose_param(get_param(np, internal_np::point_map), PointMap()); NormalMap normal_map = choose_param(get_param(np, internal_np::normal_map), NormalMap()); + ConstrainedMap constrained_map = choose_param(get_param(np, internal_np::point_is_constrained), ConstrainedMap()); Kernel kernel; // Bring private stuff to scope @@ -584,37 +661,46 @@ mst_orient_normals( // and get() requires a lookup in the map. IndexMap index_map(points.begin(), points.end()); - // Orients the normal of the point with maximum Z towards +Z axis. - typename PointRange::iterator source_point - = mst_find_source(points.begin(), points.end(), - point_map, normal_map, - kernel); - // Iterates over input points and creates Riemannian Graph: // - vertices are numbered like the input points index. // - vertices are empty. // - we add the edge (i, j) if either vertex i is in the k-neighborhood of vertex j, // or vertex j is in the k-neighborhood of vertex i. - Riemannian_graph riemannian_graph - = create_riemannian_graph(points.begin(), points.end(), - point_map, normal_map, index_map, - k, - kernel); + Riemannian_graph riemannian_graph; + + if (boost::is_same::NoMap>::value) + riemannian_graph = create_riemannian_graph(points.begin(), points.end(), + point_map, normal_map, index_map, + Default_constrained_map + (mst_find_source(points.begin(), points.end(), + point_map, normal_map, + kernel)), + k, + kernel); + else + riemannian_graph = create_riemannian_graph(points.begin(), points.end(), + point_map, normal_map, index_map, + constrained_map, + k, + kernel); // Creates a Minimum Spanning Tree starting at source_point MST_graph mst_graph = create_mst_graph(points.begin(), points.end(), point_map, normal_map, index_map, k, kernel, - riemannian_graph, - source_point); + riemannian_graph); memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE(" %ld Mb allocated\n", memory>>20); CGAL_TRACE(" Calls boost::breadth_first_search()\n"); + const std::size_t num_input_points = distance(points.begin(), points.end()); + std::size_t source_point_index = num_input_points; + // Traverse the point set along the MST to propagate source_point's orientation - Propagate_normal_orientation orienter; - std::size_t source_point_index = get(index_map, source_point); + Propagate_normal_orientation orienter(source_point_index); + boost::breadth_first_search(mst_graph, vertex(source_point_index, mst_graph), // source visitor(boost::make_bfs_visitor(orienter))); From 8d1a0eea9ac3d73f9eb9586ee128b6a59399b5a7 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Wed, 19 Sep 2018 12:36:02 +0200 Subject: [PATCH 185/193] Specialize QMultiInputDialog to handle correctly radio buttons --- .../Polyhedron/include/QMultipleInputDialog.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/include/QMultipleInputDialog.h b/Polyhedron/demo/Polyhedron/include/QMultipleInputDialog.h index 17147651f29..4825f59a6c0 100644 --- a/Polyhedron/demo/Polyhedron/include/QMultipleInputDialog.h +++ b/Polyhedron/demo/Polyhedron/include/QMultipleInputDialog.h @@ -9,6 +9,7 @@ #include #include #include +#include class QMultipleInputDialog { @@ -29,8 +30,19 @@ public: template QObjectType* add (const char* name) { - QObjectType* out = new QObjectType (dialog); - form->addRow (QString(name), out); + QObjectType* out = NULL; + + if (boost::is_same::value) + { + out = dynamic_cast(new QRadioButton (QString(name), dialog)); + form->addRow (out); + } + else + { + out = new QObjectType (dialog); + form->addRow (QString(name), out); + } + return out; } From c67bc374adfb9ea250296ecfb8251363ab251253 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Wed, 19 Sep 2018 12:36:36 +0200 Subject: [PATCH 186/193] Orient normal plugin with selected seed + separation from estimation --- .../Point_set_normal_estimation_plugin.cpp | 169 +++++++++++++----- .../Point_set_normal_estimation_plugin.ui | 101 +---------- 2 files changed, 124 insertions(+), 146 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_normal_estimation_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_normal_estimation_plugin.cpp index ab53c6c887b..f0cd446b369 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_normal_estimation_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_normal_estimation_plugin.cpp @@ -18,6 +18,8 @@ #include #include +#include + #include "run_with_qprogressdialog.h" #include "ui_Point_set_normal_estimation_plugin.h" @@ -77,6 +79,25 @@ struct Jet_estimate_normals_functor } }; +struct Vector_to_pmap +{ + typedef boost::readable_property_map_tag category; + typedef typename Point_set::Index key_type; + typedef bool value_type; + typedef value_type reference; + + std::vector* vec; + + Vector_to_pmap (std::vector* vec = NULL) : vec (vec) { } + + friend inline + reference get(const Vector_to_pmap& map, key_type p) + { + return (*map.vec)[p]; + } + +}; + using namespace CGAL::Three; class Polyhedron_demo_point_set_normal_estimation_plugin : @@ -88,6 +109,7 @@ class Polyhedron_demo_point_set_normal_estimation_plugin : Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") QAction* actionNormalEstimation; + QAction* actionNormalOrientation; QAction* actionNormalInversion; public: @@ -99,6 +121,10 @@ public: actionNormalEstimation->setObjectName("actionNormalEstimation"); actionNormalEstimation->setProperty("subMenuName","Point Set Processing"); + actionNormalOrientation = new QAction(tr("Normal Orientation"), mainWindow); + actionNormalOrientation->setObjectName("actionNormalOrientation"); + actionNormalOrientation->setProperty("subMenuName","Point Set Processing"); + actionNormalInversion = new QAction(tr("Inverse Normal Orientations"), mainWindow); actionNormalInversion->setObjectName("actionNormalInversion"); actionNormalInversion->setProperty("subMenuName","Point Set Processing"); @@ -106,7 +132,7 @@ public: } QList actions() const { - return QList() << actionNormalEstimation << actionNormalInversion; + return QList() << actionNormalEstimation << actionNormalOrientation << actionNormalInversion; } bool applicable(QAction* action) const { @@ -124,6 +150,7 @@ public: public Q_SLOTS: void on_actionNormalEstimation_triggered(); + void on_actionNormalOrientation_triggered(); void on_actionNormalInversion_triggered(); }; // end PS_demo_smoothing_plugin @@ -142,7 +169,6 @@ class Point_set_demo_normal_estimation_dialog : public QDialog, private Ui::Norm unsigned int convolution_neighbors() const { return m_convolution_neighbors->value(); } double convolution_radius() const { return m_convolution_radius->value(); } double offset_radius() const { return m_offset_radius->value(); } - int orient_neighbors() const { return m_orient_neighbors->value(); } unsigned int method () const { @@ -151,10 +177,6 @@ class Point_set_demo_normal_estimation_dialog : public QDialog, private Ui::Norm if (buttonVCM->isChecked ()) return 2; return -1; } - bool orient () const - { - return buttonOrient->isChecked(); - } bool use_convolution_radius () const { return buttonRadius->isChecked(); @@ -275,59 +297,112 @@ void Polyhedron_demo_point_set_normal_estimation_plugin::on_actionNormalEstimati << (memory>>20) << " Mb allocated" << std::endl; } + item->resetMenu(); item->setRenderingMode(ShadedPoints); + // Updates scene + item->invalidateOpenGLBuffers(); + scene->itemChanged(index); + + QApplication::restoreOverrideCursor(); + } +#endif // !CGAL_DISABLE_NORMAL_ESTIMATION_PLUGIN +} + +void Polyhedron_demo_point_set_normal_estimation_plugin::on_actionNormalOrientation_triggered() +{ + const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); + + Scene_points_with_normal_item* item = + qobject_cast(scene->item(index)); + + if(item) + { + // Gets point set + Point_set* points = item->point_set(); + if(points == NULL) + return; + + // Gets options + QMultipleInputDialog dialog ("Normal Orientation", mw); + QSpinBox* neighborhood = dialog.add ("Neighborhood Size: "); + neighborhood->setRange (1, 10000000); + neighborhood->setValue (18); + + QRadioButton* use_seed_points = NULL; + QRadioButton* orient_selection = NULL; + + if (points->nb_selected_points() != 0) + { + use_seed_points = dialog.add ("Use selection as seed points and orient the unselected points"); + use_seed_points->setChecked(true); + orient_selection = dialog.add ("Orient selection"); + orient_selection->setChecked(false); + } + + if(!dialog.exec()) + return; + + QApplication::setOverrideCursor(Qt::BusyCursor); + QApplication::processEvents(); + + // First point to delete + Point_set::iterator first_unoriented_point = points->end(); + //*************************************** // normal orientation //*************************************** - if (dialog.orient ()) - { - CGAL::Timer task_timer; task_timer.start(); - std::cerr << "Orient normals with a Minimum Spanning Tree (k=" << dialog.orient_neighbors() << ")...\n"; + CGAL::Timer task_timer; task_timer.start(); + std::cerr << "Orient normals with a Minimum Spanning Tree (k=" << neighborhood->value() << ")...\n"; - // Tries to orient normals - first_unoriented_point = - CGAL::mst_orient_normals(points->all_or_selection_if_not_empty(), - dialog.orient_neighbors(), - points->parameters()); + // Tries to orient normals + if (points->nb_selected_points() != 0 && use_seed_points->isChecked()) + { + std::vector constrained_map (points->size(), false); - std::size_t nb_unoriented_normals = std::distance(first_unoriented_point, points->end()); - std::size_t memory = CGAL::Memory_sizer().virtual_size(); - std::cerr << "Orient normals: " << nb_unoriented_normals << " point(s) with an unoriented normal are selected (" - << task_timer.time() << " seconds, " - << (memory>>20) << " Mb allocated)" - << std::endl; - - // Selects points with an unoriented normal - points->set_first_selected (first_unoriented_point); - - // Updates scene - item->invalidateOpenGLBuffers(); - scene->itemChanged(index); - - QApplication::restoreOverrideCursor(); - - // Warns user - if (nb_unoriented_normals > 0) - { - QMessageBox::information(NULL, - tr("Points with an unoriented normal"), - tr("%1 point(s) with an unoriented normal are selected.\nPlease orient them or remove them before running Poisson reconstruction.") - .arg(nb_unoriented_normals)); - } - } + for (typename Point_set::iterator it = points->first_selected(); it != points->end(); ++ it) + constrained_map[*it] = true; + + first_unoriented_point = + CGAL::mst_orient_normals(*points, + std::size_t(neighborhood->value()), + points->parameters(). + point_is_constrained_map(Vector_to_pmap(&constrained_map))); + } else - { - // Updates scene - item->invalidateOpenGLBuffers(); - scene->itemChanged(index); + first_unoriented_point = + CGAL::mst_orient_normals(points->all_or_selection_if_not_empty(), + std::size_t(neighborhood->value()), + points->parameters()); - QApplication::restoreOverrideCursor(); - } + std::size_t nb_unoriented_normals = std::distance(first_unoriented_point, points->end()); + std::size_t memory = CGAL::Memory_sizer().virtual_size(); + std::cerr << "Orient normals: " << nb_unoriented_normals << " point(s) with an unoriented normal are selected (" + << task_timer.time() << " seconds, " + << (memory>>20) << " Mb allocated)" + << std::endl; + + // Selects points with an unoriented normal + points->set_first_selected (first_unoriented_point); + + // Updates scene + item->invalidateOpenGLBuffers(); + scene->itemChanged(index); + + QApplication::restoreOverrideCursor(); + + // Warns user + if (nb_unoriented_normals > 0) + { + QMessageBox::information(NULL, + tr("Points with an unoriented normal"), + tr("%1 point(s) with an unoriented normal are selected.\nPlease orient them or remove them before running Poisson reconstruction.") + .arg(nb_unoriented_normals)); + } } -#endif // !CGAL_DISABLE_NORMAL_ESTIMATION_PLUGIN } + #include "Point_set_normal_estimation_plugin.moc" diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_normal_estimation_plugin.ui b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_normal_estimation_plugin.ui index 905ba695a9d..8ceaeaea887 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_normal_estimation_plugin.ui +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_normal_estimation_plugin.ui @@ -6,8 +6,8 @@ 0 0 - 400 - 473 + 301 + 372 @@ -201,74 +201,6 @@ - - - - Qt::Horizontal - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Orient Estimated Normals - - - true - - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - QFormLayout::AllNonFixedFieldsGrow - - - - - Neighborhood Size - - - - - - - Nearest Neighbors - - - 6 - - - 100000000 - - - 18 - - - - - - @@ -279,19 +211,6 @@ - - - - Qt::Vertical - - - - 20 - 40 - - - - @@ -344,22 +263,6 @@ - - buttonOrient - toggled(bool) - frame_4 - setEnabled(bool) - - - 199 - 316 - - - 199 - 355 - - - buttonRadius toggled(bool) From f406473fd3c47c5e613d1391f8eebaaa1ae78c45 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Wed, 19 Sep 2018 14:11:25 +0200 Subject: [PATCH 187/193] Document new named parameter --- .../doc/Point_set_processing_3/NamedParameters.txt | 9 +++++++++ Point_set_processing_3/include/CGAL/mst_orient_normals.h | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Point_set_processing_3/doc/Point_set_processing_3/NamedParameters.txt b/Point_set_processing_3/doc/Point_set_processing_3/NamedParameters.txt index dcb0f56f626..9d6702cdd6a 100644 --- a/Point_set_processing_3/doc/Point_set_processing_3/NamedParameters.txt +++ b/Point_set_processing_3/doc/Point_set_processing_3/NamedParameters.txt @@ -182,6 +182,15 @@ give better result if the distribution of the input points is highly non-uniform Default value: `false` \cgalNPEnd +\cgalNPBegin{point_is_constrained_map} \anchor PSP_point_is_constrained_map +is the property map containing information about points being constrained or not. +Constrained points are left unaltered and are used as seeds in `mst_orient_normals()`.\n +\b Type: a class model of `ReadablePropertyMap` with +`PointRange::iterator::value_type` as key type and +`bool` as value type. \n +Default value: a property map with only the highest point constrained. +\cgalNPEnd + \cgalNPTableEnd */ diff --git a/Point_set_processing_3/include/CGAL/mst_orient_normals.h b/Point_set_processing_3/include/CGAL/mst_orient_normals.h index 7f9789d5e2b..d0f981d7824 100644 --- a/Point_set_processing_3/include/CGAL/mst_orient_normals.h +++ b/Point_set_processing_3/include/CGAL/mst_orient_normals.h @@ -598,7 +598,7 @@ create_mst_graph( \cgalParamBegin{point_is_constrained_map} a model of `ReadablePropertyMap` with value type `bool`. Points with a `true` value will be used as seed points: their normal will be considered as already oriented, it won't be altered and it will be propagated to its neighbors. If this parameter is omitted, - the heighest point (heightest Z coordinate) will be used as the unique seed with an upward oriented + the highest point (hightest Z coordinate) will be used as the unique seed with an upward oriented normal\cgalParamEnd \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `Kernel`\cgalParamEnd \cgalNamedParamsEnd From ad8ebeaa015ab05fb79af3cf03a1b8b8703e28bb Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Wed, 19 Sep 2018 14:12:40 +0200 Subject: [PATCH 188/193] Fix documentation of named parameters, replacing iterators by value_type --- .../Point_set_processing_3/NamedParameters.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Point_set_processing_3/doc/Point_set_processing_3/NamedParameters.txt b/Point_set_processing_3/doc/Point_set_processing_3/NamedParameters.txt index 9d6702cdd6a..ee321dfd95e 100644 --- a/Point_set_processing_3/doc/Point_set_processing_3/NamedParameters.txt +++ b/Point_set_processing_3/doc/Point_set_processing_3/NamedParameters.txt @@ -31,17 +31,17 @@ typename CGAL::Kernel_traits::Kernel \cgalNPEnd \cgalNPBegin{point_map} \anchor PSP_point_map - is the property map containing the points associated to the iterators of the point range `points`.\n + is the property map containing the points associated to the elements of the point range `points`.\n \b Type: a class model of `ReadablePropertyMap` with -`PointRange::iterator` as key type and +`PointRange::iterator::value_type` as key type and `geom_traits::Point_3` as value type. \n Default value: \code CGAL::Identity_property_map\endcode \cgalNPEnd \cgalNPBegin{normal_map} \anchor PSP_normal_map - is the property map containing the normal vectors associated to the iterators of the point range `points`.\n + is the property map containing the normal vectors associated to the elements of the point range `points`.\n \b Type: a class model of `ReadablePropertyMap` with -`PointRange::iterator` as key type and +`PointRange::iterator::value_type` as key type and `geom_traits::Vector_3` as value type. \n No default value. \cgalNPEnd @@ -67,9 +67,9 @@ Note that when a callback is run on a parallelized algorithm with `CGAL::Paralle \cgalNPEnd \cgalNPBegin{query_point_map} \anchor PSP_query_point_map - is the property map containing the points associated to the iterators of the point range `queries`.\n + is the property map containing the points associated to the elements of the point range `queries`.\n \b Type: a class model of `ReadablePropertyMap` with -`PointRange::iterator` as key type and +`PointRange::iterator::value_type` as key type and `geom_traits::Point_3` as value type. \n Default value: \code CGAL::Identity_property_map\endcode \cgalNPEnd @@ -146,9 +146,9 @@ multiple of a tolerance `epsilon` used to connect simplices. \cgalNPEnd \cgalNPBegin{plane_map} \anchor PSP_plane_map - is the property map containing the planes associated to the iterators of the plane range `planes`.\n + is the property map containing the planes associated to the elements of the plane range `planes`.\n \b Type: a class model of `ReadablePropertyMap` with -`PlaneRange::iterator` as key type and +`PlaneRange::iterator::value_type` as key type and `geom_traits::Plane_3` as value type. \n Default value: \code CGAL::Identity_property_map\endcode \cgalNPEnd From 7656b167027a7520f455139fee4f7289b545f8e9 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Thu, 4 Oct 2018 11:52:12 +0200 Subject: [PATCH 189/193] Fix typo hightest->highest --- Point_set_processing_3/include/CGAL/mst_orient_normals.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Point_set_processing_3/include/CGAL/mst_orient_normals.h b/Point_set_processing_3/include/CGAL/mst_orient_normals.h index d0f981d7824..b5da8304180 100644 --- a/Point_set_processing_3/include/CGAL/mst_orient_normals.h +++ b/Point_set_processing_3/include/CGAL/mst_orient_normals.h @@ -598,7 +598,7 @@ create_mst_graph( \cgalParamBegin{point_is_constrained_map} a model of `ReadablePropertyMap` with value type `bool`. Points with a `true` value will be used as seed points: their normal will be considered as already oriented, it won't be altered and it will be propagated to its neighbors. If this parameter is omitted, - the highest point (hightest Z coordinate) will be used as the unique seed with an upward oriented + the highest point (highest Z coordinate) will be used as the unique seed with an upward oriented normal\cgalParamEnd \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `Kernel`\cgalParamEnd \cgalNamedParamsEnd From 52ba7cac4661d8de1f7bec6e2ac907c035665a45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 2 Jan 2019 10:15:53 +0100 Subject: [PATCH 190/193] remove extra typename --- .../Plugins/Point_set/Point_set_normal_estimation_plugin.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_normal_estimation_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_normal_estimation_plugin.cpp index f0cd446b369..6ae9d2ba4c7 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_normal_estimation_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_normal_estimation_plugin.cpp @@ -82,7 +82,7 @@ struct Jet_estimate_normals_functor struct Vector_to_pmap { typedef boost::readable_property_map_tag category; - typedef typename Point_set::Index key_type; + typedef Point_set::Index key_type; typedef bool value_type; typedef value_type reference; @@ -362,7 +362,7 @@ void Polyhedron_demo_point_set_normal_estimation_plugin::on_actionNormalOrientat { std::vector constrained_map (points->size(), false); - for (typename Point_set::iterator it = points->first_selected(); it != points->end(); ++ it) + for (Point_set::iterator it = points->first_selected(); it != points->end(); ++ it) constrained_map[*it] = true; first_unoriented_point = From 0bdce6935d34d30714837371b62fd2fb3f098bfe Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Wed, 2 Jan 2019 11:35:33 +0100 Subject: [PATCH 191/193] Remove useless variable --- .../Plugins/Point_set/Point_set_normal_estimation_plugin.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_normal_estimation_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_normal_estimation_plugin.cpp index 6ae9d2ba4c7..5193fec725f 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_normal_estimation_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_normal_estimation_plugin.cpp @@ -231,9 +231,6 @@ void Polyhedron_demo_point_set_normal_estimation_plugin::on_actionNormalEstimati QApplication::setOverrideCursor(Qt::BusyCursor); QApplication::processEvents(); - // First point to delete - Point_set::iterator first_unoriented_point = points->end(); - //*************************************** // normal estimation //*************************************** From 294ebaf8f5155d9fdd79b0cacf5f5340bf5d87c4 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Thu, 3 Jan 2019 14:02:33 +0100 Subject: [PATCH 192/193] Remove unused variable and useless assertion --- Point_set_processing_3/include/CGAL/mst_orient_normals.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Point_set_processing_3/include/CGAL/mst_orient_normals.h b/Point_set_processing_3/include/CGAL/mst_orient_normals.h index b5da8304180..72cd4e3b48f 100644 --- a/Point_set_processing_3/include/CGAL/mst_orient_normals.h +++ b/Point_set_processing_3/include/CGAL/mst_orient_normals.h @@ -384,9 +384,8 @@ create_riemannian_graph( } // add source vertex (virtual, does not correspond to a point) - typename Riemannian_graph::vertex_descriptor v = add_vertex(riemannian_graph); + add_vertex(riemannian_graph); std::size_t source_point_index = num_input_points; - CGAL_point_set_processing_assertion(v == source_point_index); // // add edges From 3b246294bfe908efdbac57f2feb3760dfb844b70 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Fri, 4 Jan 2019 14:39:29 +0100 Subject: [PATCH 193/193] Update CHANGES.md --- Installation/CHANGES.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Installation/CHANGES.md b/Installation/CHANGES.md index 86dd48044b6..9f2c4f38d50 100644 --- a/Installation/CHANGES.md +++ b/Installation/CHANGES.md @@ -32,6 +32,14 @@ Release date: March 2019 - Added the class `CGAL::Rigid_triangle_mesh_collision_detection` to detect intersections between meshes and volumes undergoing affine transformations. +### Point Set Processing + +- `CGAL::mst_orient_normals()` can now be called with a set of user-selected + seed points that are known to be already oriented. A new optional named + parameter `point_is_constrained_map` is added for this purpose. The + original behavior (using one unique and automatically selected seed) is + kept if this parameter is not used. + ### 3D Fast Intersection and Distance Computation - The primitives `AABB_face_graph_triangle_primitive` and