diff --git a/Polyhedron/demo/Polyhedron/MainWindow_simplify.cpp b/Polyhedron/demo/Polyhedron/MainWindow_simplify.cpp index cccb524c507..5e6e219f35e 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow_simplify.cpp +++ b/Polyhedron/demo/Polyhedron/MainWindow_simplify.cpp @@ -15,34 +15,35 @@ void MainWindow::on_actionSimplify_triggered() int index = getSelectedPolygonIndex(); Polyhedron* pMesh = scene->polyhedron(index); - // simplify + // get option (#edges) bool ok; const unsigned int nb_edges = QInputDialog::getInteger(this, tr("Stop condition"), tr("Number of edges:"), pMesh->size_of_halfedges () / 4, // current value: nb of edges /2 - 10, // min + 3, // min pMesh->size_of_halfedges(), // max 1, // step for the spinbox &ok); if(!ok) return; -1000; // TODO: should be an option - namespace SMS = CGAL::Surface_mesh_simplification; - - // wait cursor + // simplify + QTime time; + time.start(); + std::cout << "Simplify..."; QApplication::setOverrideCursor(Qt::WaitCursor); - + namespace SMS = CGAL::Surface_mesh_simplification; SMS::Count_stop_predicate< Polyhedron > stop(nb_edges); // target # edges SMS::edge_collapse( *pMesh, stop, CGAL::vertex_index_map(boost::get(CGAL::vertex_external_index,*pMesh)) .edge_index_map(boost::get(CGAL::edge_external_index,*pMesh))); + std::cout << "ok (" << time.elapsed() << " ms, " + << pMesh->size_of_halfedges() / 2 << " edges)" << std::endl; + // update scene scene->polyhedronChanged(index); - - // default cursor QApplication::restoreOverrideCursor(); } } diff --git a/Polyhedron/demo/Polyhedron/MainWindow_subdivision_methods.cpp b/Polyhedron/demo/Polyhedron/MainWindow_subdivision_methods.cpp index 6dded9de9c9..aedad8b982e 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow_subdivision_methods.cpp +++ b/Polyhedron/demo/Polyhedron/MainWindow_subdivision_methods.cpp @@ -8,7 +8,7 @@ void MainWindow::on_actionLoop_triggered() { Polyhedron* poly = getSelectedPolygon(); if(!poly) return; - CGAL::Subdivision_method_3::Loop_subdivision(*poly, 1); + //CGAL::Subdivision_method_3::Loop_subdivision(*poly, 1); scene->polyhedronChanged(poly); } @@ -16,7 +16,7 @@ void MainWindow::on_actionCatmullClark_triggered() { Polyhedron* poly = getSelectedPolygon(); if(!poly) return; - CGAL::Subdivision_method_3::CatmullClark_subdivision(*poly, 1); + //CGAL::Subdivision_method_3::CatmullClark_subdivision(*poly, 1); scene->polyhedronChanged(poly); } @@ -24,7 +24,7 @@ void MainWindow::on_actionSqrt3_triggered() { Polyhedron* poly = getSelectedPolygon(); if(!poly) return; - CGAL::Subdivision_method_3::Sqrt3_subdivision(*poly, 1); + //CGAL::Subdivision_method_3::Sqrt3_subdivision(*poly, 1); scene->polyhedronChanged(poly); } diff --git a/Polyhedron/demo/Polyhedron/Scene.cpp b/Polyhedron/demo/Polyhedron/Scene.cpp index 5dff1975f76..0ca59292e15 100644 --- a/Polyhedron/demo/Polyhedron/Scene.cpp +++ b/Polyhedron/demo/Polyhedron/Scene.cpp @@ -75,9 +75,12 @@ Scene::open(QString filename) QApplication::restoreOverrideCursor(); cerr << QString("\n"); destroy(poly); + + delete poly; return -1; } + cerr << QString("ok\n"); addPolyhedron(poly, fileinfo.baseName()); QApplication::restoreOverrideCursor();