diff --git a/.gitattributes b/.gitattributes index 1f1e7e1fe1f..b0fc43975df 100644 --- a/.gitattributes +++ b/.gitattributes @@ -541,13 +541,13 @@ Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/algebraic/points -te Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/algebraic/split -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/algebraic/vertex -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/algebraic/xcurves -text +Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/assertions -text +Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/assertions.pt -text +Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/assertions.xcv -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/compare -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/compare_y_at_x -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/compare_y_at_x.pt -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/compare_y_at_x.xcv -text -Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/errors -text -Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/errors.pt -text -Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/errors.xcv -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/intersect -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/intersect.pt -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/intersect.xcv -text @@ -564,14 +564,14 @@ Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/split.xcv -te Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/vertex -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/vertex.pt -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/vertex.xcv -text +Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circle_segments/assertions -text +Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circle_segments/assertions.pt -text +Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circle_segments/assertions.xcv -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circle_segments/compare_y_at_x -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circle_segments/compare_y_at_x_left -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circle_segments/compare_y_at_x_right -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circle_segments/constructor -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circle_segments/constructor.xcv -text -Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circle_segments/errors -text -Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circle_segments/errors.pt -text -Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circle_segments/errors.xcv -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circle_segments/intersect -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circle_segments/intersect.pt -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circle_segments/intersect.xcv -text @@ -624,6 +624,7 @@ Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_line_arcs/s Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_line_arcs/vertex -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_line_arcs/vertex.pt -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_line_arcs/xcurves -text +Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_lines/assertions -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_lines/compare -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_lines/compare.pt -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_lines/compare_y_at_x -text @@ -631,7 +632,6 @@ Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_lines/const Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_lines/constructor.cv -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_lines/constructor.xcv -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_lines/curves -text -Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_lines/errors -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_lines/intersect -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_lines/intersect.pt -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_lines/intersect.xcv -text @@ -650,6 +650,9 @@ Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_lines/verte Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_lines/xcurves -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/compare -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/compare.pt -text +Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/assertions -text +Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/assertions.pt -text +Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/assertions.xcv -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/compare -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/compare.pt -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/compare_y_at_x -text @@ -659,9 +662,6 @@ Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/constructor - Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/constructor.cv -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/constructor.xcv -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/curves -text -Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/errors -text -Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/errors.pt -text -Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/errors.xcv -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/intersect -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/is_vertical -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/is_vertical.xcv -text @@ -690,12 +690,12 @@ Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/paramet Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/points -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/split -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/xcurves -text +Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/assertions -text +Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/assertions.pt -text +Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/assertions.xcv -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/compare_y_at_x -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/compare_y_at_x_left -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/curves -text -Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/errors -text -Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/errors.pt -text -Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/errors.xcv -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/intersect -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/intersect.pt -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/intersect.xcv -text @@ -712,12 +712,12 @@ Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/split.xc Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/vertex -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/vertex.pt -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/xcurves -text +Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/segments/assertions -text +Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/segments/assertions.pt -text +Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/segments/assertions.xcv -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/segments/compare_y_at_x -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/segments/compare_y_at_x_left -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/segments/curves -text -Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/segments/errors -text -Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/segments/errors.pt -text -Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/segments/errors.xcv -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/segments/intersect -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/segments/intersect.pt -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/segments/intersect.xcv -text @@ -753,12 +753,12 @@ Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segme Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/queries/test02.txt -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/queries/test10.txt -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/xcurves/test10.txt -text +Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/assertions -text +Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/assertions.pt -text +Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/assertions.xcv -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/compare_y_at_x -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/compare_y_at_x.pt -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/compare_y_at_x.xcv -text -Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/errors -text -Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/errors.pt -text -Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/errors.xcv -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/intersect -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/intersect.pt -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/intersect.xcv -text @@ -789,12 +789,12 @@ Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/split Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/vertex -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/xcurves -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/segments/are_mergeable -text +Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/segments/assertions -text +Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/segments/assertions.pt -text +Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/segments/assertions.xcv -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/segments/compare_y_at_x -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/segments/compare_y_at_x_left -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/segments/curves -text -Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/segments/errors -text -Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/segments/errors.pt -text -Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/segments/errors.xcv -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/segments/intersect -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/segments/intersect.pt -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/segments/intersect.xcv -text @@ -2974,11 +2974,13 @@ Nef_3/test/Nef_3/data/cube+vee.off -text svneol=unset#application/octet-stream Nef_3/test/Nef_3/data/cube+veeee.off -text svneol=unset#application/octet-stream Nef_3/test/Nef_3/data/cube+vertex.off -text svneol=unset#application/octet-stream Nef_3/test/Nef_3/data/cube.off -text svneol=unset#application/octet-stream +Nef_3/test/Nef_3/data/icosahedron.off -text Nef_3/test/Nef_3/data/nine_planes.off -text svneol=unset#application/octet-stream Nef_3/test/Nef_3/data/octa.off -text svneol=unset#application/octet-stream Nef_3/test/Nef_3/data/star.off -text svneol=unset#application/octet-stream Nef_3/test/Nef_3/data/wrongly_oriented_cube.off -text Nef_3/test/Nef_3/nary.cpp -text +Nef_3/test/Nef_3/nef_union_error_llvm.cpp -text Nef_S2/doc_tex/Nef_S2/fig/complex.gif -text svneol=unset#image/gif Nef_S2/doc_tex/Nef_S2/fig/complex.pdf -text svneol=unset#application/pdf Nef_S2/doc_tex/Nef_S2/fig/halfspace.gif -text svneol=unset#image/gif @@ -3195,6 +3197,14 @@ Polyhedron/demo/Polyhedron/Deform_mesh.ui -text Polyhedron/demo/Polyhedron/MainWindow.ui -text Polyhedron/demo/Polyhedron/Polyhedron_3.qrc -text Polyhedron/demo/Polyhedron/Polyhedron_demo_corefinement_plugin.cpp -text +Polyhedron/demo/Polyhedron/Polyhedron_demo_normal_estimation_plugin.cpp -text +Polyhedron/demo/Polyhedron/Polyhedron_demo_normal_estimation_plugin.ui -text +Polyhedron/demo/Polyhedron/Polyhedron_demo_off_to_xyz_plugin.cpp -text +Polyhedron/demo/Polyhedron/Polyhedron_demo_point_set_outliers_removal_plugin.cpp -text +Polyhedron/demo/Polyhedron/Polyhedron_demo_point_set_outliers_removal_plugin.ui -text +Polyhedron/demo/Polyhedron/Polyhedron_demo_point_set_simplification_plugin.ui -text +Polyhedron/demo/Polyhedron/Polyhedron_demo_point_set_smoothing_plugin.cpp -text +Polyhedron/demo/Polyhedron/Polyhedron_demo_poisson_plugin.ui -text Polyhedron/demo/Polyhedron/Remeshing_dialog.ui -text Polyhedron/demo/Polyhedron/Scene_combinatorial_map_item.cpp -text Polyhedron/demo/Polyhedron/Scene_combinatorial_map_item.h -text diff --git a/.gitignore b/.gitignore index 34ebe46c01c..5614d5cc13d 100644 --- a/.gitignore +++ b/.gitignore @@ -535,6 +535,7 @@ Mesh_2/test/Mesh_2/CMakeLists.txt Mesh_2/test/Mesh_2/Makefile Mesh_2/test/Mesh_2/bench_double_map Mesh_2/test/Mesh_2/cgal_test_with_cmake +Mesh_2/test/Mesh_2/conform_plus Mesh_2/test/Mesh_2/depends Mesh_2/test/Mesh_2/my_makefile Mesh_2/test/Mesh_2/semantic.cache @@ -542,6 +543,7 @@ Mesh_2/test/Mesh_2/test_conforming Mesh_2/test/Mesh_2/test_double_map Mesh_2/test/Mesh_2/test_filtred_container Mesh_2/test/Mesh_2/test_meshing +Mesh_2/test/Mesh_2/test_meshing_user_bug_test_case Mesh_2/test/Mesh_2/test_vertex_and_face_bases Mesh_3/*.tags.xml Mesh_3/.*.deps diff --git a/AABB_tree/examples/AABB_tree/AABB_polyhedron_facet_distance_example.cpp b/AABB_tree/examples/AABB_tree/AABB_polyhedron_facet_distance_example.cpp index 8e558b29952..b962b6bc613 100644 --- a/AABB_tree/examples/AABB_tree/AABB_polyhedron_facet_distance_example.cpp +++ b/AABB_tree/examples/AABB_tree/AABB_polyhedron_facet_distance_example.cpp @@ -47,7 +47,13 @@ int main() // computes closest point and primitive id Point_and_primitive_id pp = tree.closest_point_and_primitive(query); - std::cout << "closest point: " << pp.first << std::endl; + Point closest_point = pp.first; Polyhedron::Face_handle f = pp.second; // closest primitive id + std::cout << "closest point: " << closest_point << std::endl; + std::cout << "closest triangle: ( " + << f->halfedge()->vertex()->point() << " , " + << f->halfedge()->next()->vertex()->point() << " , " + << f->halfedge()->next()->next()->vertex()->point() + << " )" << std::endl; return EXIT_SUCCESS; } diff --git a/AABB_tree/include/CGAL/internal/AABB_tree/AABB_search_tree.h b/AABB_tree/include/CGAL/internal/AABB_tree/AABB_search_tree.h index 944fb5a82b9..9815caefb45 100644 --- a/AABB_tree/include/CGAL/internal/AABB_tree/AABB_search_tree.h +++ b/AABB_tree/include/CGAL/internal/AABB_tree/AABB_search_tree.h @@ -125,7 +125,6 @@ namespace CGAL Point_and_primitive_id closest_point(const Point& query) const { - typedef typename Add_decorated_point::Point_3 Decorated_point; Neighbor_search search(*m_p_tree, query, 1); return Point_and_primitive_id(static_cast(search.begin()->first), search.begin()->first.id()); } diff --git a/AABB_tree/include/CGAL/internal/AABB_tree/nearest_point_segment_3.h b/AABB_tree/include/CGAL/internal/AABB_tree/nearest_point_segment_3.h index 08372a62fbd..8d1ff55626b 100644 --- a/AABB_tree/include/CGAL/internal/AABB_tree/nearest_point_segment_3.h +++ b/AABB_tree/include/CGAL/internal/AABB_tree/nearest_point_segment_3.h @@ -90,7 +90,6 @@ namespace CGAL { const K& k) { typedef typename K::Point_3 Point_3; - typedef typename K::Vector_3 Vector_3; typedef typename K::FT FT; typename K::Compute_squared_distance_3 sq_distance = diff --git a/AABB_tree/include/CGAL/internal/AABB_tree/nearest_point_triangle_3.h b/AABB_tree/include/CGAL/internal/AABB_tree/nearest_point_triangle_3.h index 4a84784e704..d0b2baf28e5 100644 --- a/AABB_tree/include/CGAL/internal/AABB_tree/nearest_point_triangle_3.h +++ b/AABB_tree/include/CGAL/internal/AABB_tree/nearest_point_triangle_3.h @@ -187,7 +187,6 @@ nearest_point_3(const typename K::Point_3& origin, const K& k) { typedef typename K::Point_3 Point_3; - typedef typename K::Vector_3 Vector_3; typedef typename K::FT FT; typename K::Compute_squared_distance_3 sq_distance = diff --git a/Algebraic_kernel_for_spheres/include/CGAL/Algebraic_kernel_for_spheres/internal_functions_on_roots_and_polynomial_1_3_and_2_3.h b/Algebraic_kernel_for_spheres/include/CGAL/Algebraic_kernel_for_spheres/internal_functions_on_roots_and_polynomial_1_3_and_2_3.h index afae9fe9b55..9c8a30aaa4a 100644 --- a/Algebraic_kernel_for_spheres/include/CGAL/Algebraic_kernel_for_spheres/internal_functions_on_roots_and_polynomial_1_3_and_2_3.h +++ b/Algebraic_kernel_for_spheres/include/CGAL/Algebraic_kernel_for_spheres/internal_functions_on_roots_and_polynomial_1_3_and_2_3.h @@ -57,7 +57,6 @@ namespace CGAL { template bool intersect(const typename AK::Polynomial_1_3 & p1, const typename AK::Polynomial_1_3 & p2) { - typedef typename AK::Polynomial_1_3 Polynomial_1_3; typedef typename AK::RT RT; CGAL_kernel_precondition(!(same_solutions(p1,p2))); @@ -76,7 +75,6 @@ namespace CGAL { line_from_2_planes(const typename AK::Polynomial_1_3 & p1, const typename AK::Polynomial_1_3 & p2) { - typedef typename AK::Polynomial_1_3 Polynomial_1_3; typedef typename AK::Polynomials_for_line_3 Polynomials_for_line_3; typedef typename AK::FT FT; CGAL_kernel_precondition(intersect(p1,p2)); @@ -112,7 +110,6 @@ namespace CGAL { inline bool intersect(const typename AK::Polynomial_for_spheres_2_3 & s1, const typename AK::Polynomial_for_spheres_2_3 & s2) { - typedef typename AK::Polynomial_1_3 Polynomial_1_3; typedef typename AK::FT FT; typedef typename AK::Root_of_2 Root_of_2; @@ -145,7 +142,6 @@ namespace CGAL { inline bool tangent(const typename AK::Polynomial_for_spheres_2_3 & s1, const typename AK::Polynomial_for_spheres_2_3 & s2) { - typedef typename AK::Polynomial_1_3 Polynomial_1_3; typedef typename AK::RT RT; typedef typename AK::Root_of_2 Root_of_2; @@ -335,7 +331,6 @@ namespace CGAL { OutputIterator res ) { typedef typename AK::RT RT; - typedef typename AK::Root_for_spheres_2_3 Root_for_spheres_2_3; typedef typename AK::Polynomials_for_line_3 Polynomials_for_line_3; // we put as a precondition that the polynomial for spheres represents // a sphere and not an isolated point or an empty_space @@ -519,11 +514,9 @@ template < class AK, class OutputIterator > const typename AK::Polynomials_for_line_3 & l, OutputIterator res ) { - typedef typename AK::RT RT; typedef typename AK::Root_for_spheres_2_3 Root_for_spheres_2_3; typedef typename AK::Polynomial_for_spheres_2_3 Polynomial_for_spheres_2_3; typedef typename AK::Polynomial_1_3 Polynomial_1_3; - typedef typename AK::Polynomials_for_line_3 Polynomials_for_line_3; const Polynomial_for_spheres_2_3 &s1 = e1.first; const Polynomial_1_3 &p1 = e1.second; diff --git a/Algebraic_kernel_for_spheres/include/CGAL/Algebraic_kernel_for_spheres/internal_functions_on_roots_and_polynomials_1_3.h b/Algebraic_kernel_for_spheres/include/CGAL/Algebraic_kernel_for_spheres/internal_functions_on_roots_and_polynomials_1_3.h index 24bde57e79b..40eee8b4042 100644 --- a/Algebraic_kernel_for_spheres/include/CGAL/Algebraic_kernel_for_spheres/internal_functions_on_roots_and_polynomials_1_3.h +++ b/Algebraic_kernel_for_spheres/include/CGAL/Algebraic_kernel_for_spheres/internal_functions_on_roots_and_polynomials_1_3.h @@ -39,7 +39,6 @@ namespace CGAL { const typename AK::Polynomial_1_3 & e3, OutputIterator res ) { - typedef typename AK::RT RT; typedef typename AK::FT FT; typedef typename AK::Root_for_spheres_2_3 Root_for_spheres_2_3; CGAL_kernel_precondition(!(same_solutions(e1,e2) || same_solutions(e1,e3) || diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base index a95145e32e5..7104348c1f8 100755 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base @@ -77,7 +77,7 @@ INTERSECT=8 SPLIT=9 ARE_MERGEABLE=10 MERGE=11 -ERRORS=12 +ASSERTIONS=12 CONSTRUCTOR=13 COMPARE_X_AT_LIMIT=14 COMPARE_X_NEAR_LIMIT=15 @@ -334,7 +334,7 @@ execute_commands_old_structure() commands_indicator[SPLIT]=1 commands_indicator[ARE_MERGEABLE]=1 commands_indicator[MERGE]=1 - commands_indicator[ERRORS]=1 + commands_indicator[ASSERTIONS]=1 commands_indicator[CONSTRUCTOR]=1 i=1 if [ $# -gt 2 ] ; then @@ -400,10 +400,10 @@ execute_commands_old_structure() data/empty.zero data/$1/merge.xcv \ data/empty.zero data/$1/merge $2 fi - if [ ${commands_indicator[$ERRORS]} -ne 0 ] ; then + if [ ${commands_indicator[$ASSERTIONS]} -ne 0 ] ; then run_trapped_test test_traits \ - data/$1/errors.pt data/$1/errors.xcv \ - data/empty.zero data/$1/errors $2 + data/$1/assertions.pt data/$1/assertions.xcv \ + data/empty.zero data/$1/assertions $2 fi if [ ${commands_indicator[$CONSTRUCTOR]} -ne 0 ] ; then run_trapped_test test_traits \ @@ -440,7 +440,7 @@ execute_commands_new_structure() commands_indicator[SPLIT]=0 commands_indicator[ARE_MERGEABLE]=0 commands_indicator[MERGE]=0 - commands_indicator[ERRORS]=0 + commands_indicator[ASSERTIONS]=0 commands_indicator[CONSTRUCTOR]=0 i=1 if [ $# -gt 2 ] ; then @@ -523,9 +523,9 @@ execute_commands_new_structure() run_trapped_test test_traits data/$1/points \ data/$1/xcurves data/$1/curves data/$1/merge $2 fi - if [ ${commands_indicator[$ERRORS]} -ne 0 ] ; then + if [ ${commands_indicator[$ASSERTIONS]} -ne 0 ] ; then run_trapped_test test_traits data/$1/points \ - data/$1/xcurves data/$1/curves data/$1/errors $2 + data/$1/xcurves data/$1/curves data/$1/assertions $2 fi if [ ${commands_indicator[$CONSTRUCTOR]} -ne 0 ] ; then run_trapped_test test_traits data/$1/points \ @@ -863,7 +863,7 @@ test_non_caching_segment_traits() else execute_commands_old_structure segments non_caching_segment_traits \ VERTEX IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT CONSTRUCTOR \ - COMPARE_Y_AT_X_RIGHT ARE_MERGEABLE ERRORS + COMPARE_Y_AT_X_RIGHT ARE_MERGEABLE ASSERTIONS execute_commands_new_structure segments segment_traits \ IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT @@ -987,7 +987,7 @@ test_line_arc_traits() else execute_commands_old_structure circular_lines line_arc_traits \ VERTEX IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT \ - ERRORS COMPARE_Y_AT_X_RIGHT MERGE ARE_MERGEABLE + ASSERTIONS COMPARE_Y_AT_X_RIGHT MERGE ARE_MERGEABLE execute_commands_new_structure circular_lines line_arc_traits \ IS_VERTICAL COMPARE_Y_AT_X @@ -1015,7 +1015,7 @@ test_circular_arc_traits() else execute_commands_old_structure circular_arcs circular_arc_traits \ VERTEX IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT \ - ERRORS COMPARE_Y_AT_X_RIGHT MERGE ARE_MERGEABLE + ASSERTIONS COMPARE_Y_AT_X_RIGHT MERGE ARE_MERGEABLE execute_commands_new_structure circular_arcs circular_arc_traits \ VERTEX IS_VERTICAL COMPARE_Y_AT_X @@ -1035,7 +1035,7 @@ test_circular_line_arc_traits() else execute_commands_old_structure circular_line_arcs circular_line_arc_traits \ VERTEX IS_VERTICAL CONSTRUCTOR COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT \ - ERRORS COMPARE_Y_AT_X_RIGHT MERGE ARE_MERGEABLE + ASSERTIONS COMPARE_Y_AT_X_RIGHT MERGE ARE_MERGEABLE execute_commands_new_structure circular_line_arcs circular_line_arc_traits \ IS_VERTICAL COMPARE_Y_AT_X @@ -1095,7 +1095,7 @@ test_bezier_traits() else execute_commands_old_structure bezier bezier_traits \ COMPARE_Y_AT_X_LEFT COMPARE_Y_AT_X_RIGHT SPLIT \ - CONSTRUCTOR ERRORS ARE_MERGEABLE + CONSTRUCTOR ASSERTIONS ARE_MERGEABLE fi clean_tests } @@ -1113,7 +1113,7 @@ test_spherical_arc_traits() execute_commands_old_structure spherical_arcs spherical_arc_traits \ COMPARE_Y_AT_X_LEFT COMPARE_Y_AT_X_RIGHT INTERSECT \ CONSTRUCTOR \ - COMPARE MAKE_X_MONOTONE SPLIT MERGE ERRORS ARE_MERGEABLE + COMPARE MAKE_X_MONOTONE SPLIT MERGE ASSERTIONS ARE_MERGEABLE execute_commands_new_structure spherical_arcs spherical_arc_traits \ INTERSECT \ diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/errors b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/assertions similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/errors rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/assertions diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/errors.pt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/assertions.pt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/errors.pt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/assertions.pt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/errors.xcv b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/assertions.xcv similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/errors.xcv rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/bezier/assertions.xcv diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circle_segments/errors b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circle_segments/assertions similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circle_segments/errors rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circle_segments/assertions diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circle_segments/errors.pt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circle_segments/assertions.pt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circle_segments/errors.pt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circle_segments/assertions.pt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circle_segments/errors.xcv b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circle_segments/assertions.xcv similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circle_segments/errors.xcv rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circle_segments/assertions.xcv diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_lines/errors b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_lines/assertions similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_lines/errors rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_lines/assertions diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/errors b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/assertions similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/errors rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/assertions diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/errors.pt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/assertions.pt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/errors.pt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/assertions.pt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/errors.xcv b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/assertions.xcv similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/errors.xcv rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/assertions.xcv diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/errors b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/assertions similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/errors rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/assertions diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/errors.pt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/assertions.pt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/errors.pt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/assertions.pt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/errors.xcv b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/assertions.xcv similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/errors.xcv rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/rays/assertions.xcv diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/segments/errors b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/segments/assertions similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/segments/errors rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/segments/assertions diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/segments/errors.pt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/segments/assertions.pt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/segments/errors.pt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/segments/assertions.pt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/segments/errors.xcv b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/segments/assertions.xcv similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/segments/errors.xcv rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/segments/assertions.xcv diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/errors b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/assertions similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/errors rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/assertions diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/errors.pt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/assertions.pt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/errors.pt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/assertions.pt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/errors.xcv b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/assertions.xcv similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/errors.xcv rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/assertions.xcv diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/segments/errors b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/segments/assertions similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/segments/errors rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/segments/assertions diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/segments/errors.pt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/segments/assertions.pt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/segments/errors.pt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/segments/assertions.pt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/segments/errors.xcv b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/segments/assertions.xcv similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/segments/errors.xcv rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/segments/assertions.xcv diff --git a/CGAL_ipelets/demo/CGAL_ipelets/alpha_shapes.cpp b/CGAL_ipelets/demo/CGAL_ipelets/alpha_shapes.cpp index 102ba1ded0d..62a35e224da 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/alpha_shapes.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/alpha_shapes.cpp @@ -74,7 +74,7 @@ void ASphapeIpelet::protected_run(int fn) - Iso_rectangle_2 bbox=read_active_objects( + read_active_objects( CGAL::dispatch_or_drop_output(std::back_inserter(pt_list), std::back_inserter(cir_list)) ); diff --git a/CGAL_ipelets/demo/CGAL_ipelets/multi_delaunay.cpp b/CGAL_ipelets/demo/CGAL_ipelets/multi_delaunay.cpp index 1d5d717a42f..9822447f593 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/multi_delaunay.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/multi_delaunay.cpp @@ -119,7 +119,6 @@ void MdelaunayIpelet::protected_run(int fn) //WE MAY COUNT SEVERAL TIME SAME TRIANGLE WITH THE FOLLOWING METHOD //iterate over adjacent point in the regular triangulation and compute a new wpoint for those having one commun parent from delaunay for (RegularI::Finite_edges_iterator it=rti.finite_edges_begin();it!=rti.finite_edges_end();++it){ - VertexI ff=it->first->vertex(Delaunay::cw(it->second)); Point_2 pt0_ori0=it->first->vertex(Delaunay::cw(it->second))->info().front(); Point_2 pt0_ori1=it->first->vertex(Delaunay::cw(it->second))->info().back(); Point_2 pt1_ori0=it->first->vertex(Delaunay::ccw(it->second))->info().front(); diff --git a/CGAL_ipelets/demo/CGAL_ipelets/partition.cpp b/CGAL_ipelets/demo/CGAL_ipelets/partition.cpp index 91dfe327d8b..35cf5e7218a 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/partition.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/partition.cpp @@ -56,8 +56,7 @@ void ConvexpartitionIpelet::protected_run(int fn) } std::list pol_list; - Iso_rectangle_2 bbox= - read_active_objects( CGAL::dispatch_or_drop_output( std::back_inserter(pol_list) ) ); + read_active_objects( CGAL::dispatch_or_drop_output( std::back_inserter(pol_list) ) ); diff --git a/CGAL_ipelets/include/CGAL/CGAL_Ipelet_base_v6.h b/CGAL_ipelets/include/CGAL/CGAL_Ipelet_base_v6.h index a6768ade4f2..005fc250fb3 100644 --- a/CGAL_ipelets/include/CGAL/CGAL_Ipelet_base_v6.h +++ b/CGAL_ipelets/include/CGAL/CGAL_Ipelet_base_v6.h @@ -496,7 +496,7 @@ public: typedef typename std::multimap >::iterator Map_theta_iterator; Map_theta_iterator s_it=map_theta.insert( std::make_pair(get_theta(*source,circle),std::make_pair(OSRC,source))); - Map_theta_iterator t_it=map_theta.insert( + /*Map_theta_iterator t_it=*/map_theta.insert( std::make_pair(get_theta(*target,circle),std::make_pair(OTRG,target))); for (typename std::vector::iterator it_arc=arc_list.begin();it_arc!=arc_list.end();++it_arc){ diff --git a/CGAL_ipelets/include/CGAL/CGAL_Ipelet_base_v7.h b/CGAL_ipelets/include/CGAL/CGAL_Ipelet_base_v7.h index ead80f0f5d8..deaf48795ae 100644 --- a/CGAL_ipelets/include/CGAL/CGAL_Ipelet_base_v7.h +++ b/CGAL_ipelets/include/CGAL/CGAL_Ipelet_base_v7.h @@ -502,7 +502,8 @@ public: typedef typename std::multimap >::iterator Map_theta_iterator; Map_theta_iterator s_it=map_theta.insert( std::make_pair(get_theta(*source,circle),std::make_pair(OSRC,source))); - Map_theta_iterator t_it=map_theta.insert( + /* Map_theta_iterator t_it=*/ + map_theta.insert( std::make_pair(get_theta(*target,circle),std::make_pair(OTRG,target))); for (typename std::vector::iterator it_arc=arc_list.begin();it_arc!=arc_list.end();++it_arc){ diff --git a/Circular_kernel_3/include/CGAL/Circular_arc_point_3.h b/Circular_kernel_3/include/CGAL/Circular_arc_point_3.h index 2fb83aea446..9fb9bd6dd37 100644 --- a/Circular_kernel_3/include/CGAL/Circular_arc_point_3.h +++ b/Circular_kernel_3/include/CGAL/Circular_arc_point_3.h @@ -225,7 +225,6 @@ public: std::istream & operator>>(std::istream & is, Circular_arc_point_3 &p) { - typedef typename SK::Root_of_2 Root_of_2; typedef typename SK::Root_for_spheres_2_3 Root_for_spheres_2_3; Root_for_spheres_2_3 r; diff --git a/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_function_has_on_spherical_kernel.h b/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_function_has_on_spherical_kernel.h index 8e412a6ab5e..002f00687be 100644 --- a/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_function_has_on_spherical_kernel.h +++ b/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_function_has_on_spherical_kernel.h @@ -58,7 +58,6 @@ namespace CGAL { has_on(const typename SK::Line_3 &a, const typename SK::Circular_arc_point_3 &p) { - typedef typename SK::Algebraic_kernel Algebraic_kernel; typedef typename SK::Polynomials_for_line_3 Equation; Equation equation = get_equation(a); return p.rep().coordinates().is_on_line(equation); diff --git a/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_circular_arc_3.h b/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_circular_arc_3.h index e62036e479b..03688fc38e7 100644 --- a/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_circular_arc_3.h +++ b/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_circular_arc_3.h @@ -185,7 +185,6 @@ namespace CGAL { const typename SK::Circular_arc_3 & ca, OutputIterator res) { - typedef typename SK::Point_3 Point_3; typedef typename SK::Circular_arc_point_3 Circular_arc_point_3; typedef std::vector solutions_container; typedef std::pair Solution; diff --git a/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_line_arc_3.h b/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_line_arc_3.h index 41548bb92de..c42bcbc4fe1 100644 --- a/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_line_arc_3.h +++ b/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_line_arc_3.h @@ -151,7 +151,6 @@ namespace CGAL { typedef typename SK::Point_3 Point_3; typedef typename SK::Circular_arc_point_3 Circular_arc_point_3; typedef typename SK::Line_3 Line_3; - typedef typename SK::Line_arc_3 Line_arc_3; Point_3 inters_p; Line_3 inters_l; diff --git a/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_sphere_3.h b/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_sphere_3.h index 16e9c77ce1d..de8e2908955 100644 --- a/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_sphere_3.h +++ b/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_sphere_3.h @@ -51,7 +51,6 @@ namespace CGAL { typename SK::Polynomial_for_spheres_2_3 get_equation( const typename SK::Sphere_3 & s ) { - typedef typename SK::RT RT; typedef typename SK::Point_3 Point_3; typedef typename SK::Algebraic_kernel Algebraic_kernel; Point_3 center = s.center(); @@ -297,7 +296,6 @@ namespace CGAL { typedef typename SK::Circle_3 Circle_3; typedef typename SK::Point_3 Point_3; typedef typename SK::Algebraic_kernel Algebraic_kernel; - typedef std::vector< Object > solutions_container; CGAL_kernel_precondition(!s1.is_degenerate()); CGAL_kernel_precondition(!s2.is_degenerate()); CGAL_kernel_precondition(!s3.is_degenerate()); @@ -445,7 +443,6 @@ namespace CGAL { typedef typename SK::Root_for_spheres_2_3 Root_for_spheres_2_3; typedef typename SK::Circular_arc_point_3 Circular_arc_point_3; typedef typename SK::Polynomials_for_circle_3 Equation_circle; - typedef typename SK::Circle_3 Circle_3; typedef typename SK::Algebraic_kernel Algebraic_kernel; if(non_oriented_equal(c1,c2)) { *res++ = make_object(c1); @@ -475,7 +472,6 @@ namespace CGAL { typedef typename SK::Circular_arc_point_3 Circular_arc_point_3; typedef typename SK::Polynomials_for_circle_3 Equation_circle; typedef typename SK::Polynomials_for_line_3 Equation_line; - typedef typename SK::Circle_3 Circle_3; typedef typename SK::Algebraic_kernel Algebraic_kernel; CGAL_kernel_precondition(!l.is_degenerate()); Equation_circle e1 = get_equation(c); diff --git a/Conic_2/include/CGAL/ConicCPA2.h b/Conic_2/include/CGAL/ConicCPA2.h index d31f38b309d..fca7633ce9c 100644 --- a/Conic_2/include/CGAL/ConicCPA2.h +++ b/Conic_2/include/CGAL/ConicCPA2.h @@ -615,7 +615,6 @@ std::ostream& operator << ( std::ostream& os, const ConicCPA2<_PT,_DA>& c) template< class _PT, class _DA> std::istream& operator >> ( std::istream& is, ConicCPA2<_PT,_DA>& c) { - typedef ConicCPA2<_PT,_DA> Conic; typedef typename _DA::FT FT; FT r, s, t, u, v, w; diff --git a/Filtered_kernel/include/CGAL/Lazy.h b/Filtered_kernel/include/CGAL/Lazy.h index c41589af468..02a83353fdc 100644 --- a/Filtered_kernel/include/CGAL/Lazy.h +++ b/Filtered_kernel/include/CGAL/Lazy.h @@ -1365,8 +1365,6 @@ struct Lazy_construction { template \ result_type \ operator()( BOOST_PP_ENUM(n, CGAL_LARGS, _) ) const { \ - BOOST_PP_REPEAT(n, CGAL_TYPEMAP_EC, L) \ - BOOST_PP_REPEAT(n, CGAL_TYPEMAP_AC, L) \ typedef Lazy< AT, ET, EFT, E2A> Handle; \ CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); \ Protect_FPU_rounding P; \ diff --git a/HalfedgeDS/include/CGAL/HalfedgeDS_items_decorator.h b/HalfedgeDS/include/CGAL/HalfedgeDS_items_decorator.h index 3875fc361fc..eb882c31893 100644 --- a/HalfedgeDS/include/CGAL/HalfedgeDS_items_decorator.h +++ b/HalfedgeDS/include/CGAL/HalfedgeDS_items_decorator.h @@ -261,7 +261,7 @@ public: set_prev( h->next(), h); } - void set_vertex_in_vertex_loop( Halfedge_handle h, Vertex_handle v, + void set_vertex_in_vertex_loop( Halfedge_handle , Vertex_handle , Tag_false) const {} void set_vertex_in_vertex_loop( Halfedge_handle h, Vertex_handle v, Tag_true) const { @@ -282,7 +282,7 @@ public: set_vertex_in_vertex_loop( h, v, Supports_halfedge_vertex()); } - void set_face_in_face_loop( Halfedge_handle h, Face_handle f, + void set_face_in_face_loop( Halfedge_handle , Face_handle , Tag_false) const {} void set_face_in_face_loop( Halfedge_handle h, Face_handle f, Tag_true) const { diff --git a/Installation/CMakeLists.txt b/Installation/CMakeLists.txt index bcaf389805d..8e7647e029d 100644 --- a/Installation/CMakeLists.txt +++ b/Installation/CMakeLists.txt @@ -489,10 +489,14 @@ message( "== Generate version files (DONE) ==\n") # #-------------------------------------------------------------------------------------------------- -message("== Detect external libraries ==") +message("== Set up flags ==") include(CGAL_SetupFlags) +message("== Set up flags (DONE) ==\n") + +message("== Detect external libraries ==") + macro( add_config_flag flag ) if ( ${flag} ) @@ -767,10 +771,10 @@ endif() # Set CGAL_LIBRARY_NAME, CGAL_Qt3_LIBRARY_NAME and so on. Those variables # are the name of CGAL libraries, without the path. Used in the generation # of the installed CGALConfig.cmake -get_filename_component(CGAL_LIBRARY_NAME "${CGAL_LIBRARY}" NAME CACHE) +get_filename_component(CGAL_LIBRARY_NAME "${CGAL_LIBRARY}" NAME) hide_variable(CGAL_LIBRARY_NAME) foreach(lib ${CGAL_CONFIGURED_LIBRARIES}) - get_filename_component(CGAL_${lib}_LIBRARY_NAME "${CGAL_${lib}_LIBRARY}" NAME CACHE) + get_filename_component(CGAL_${lib}_LIBRARY_NAME "${CGAL_${lib}_LIBRARY}" NAME) hide_variable(CGAL_${lib}_LIBRARY_NAME) endforeach() diff --git a/Installation/cmake/modules/FindQt3-patched.cmake b/Installation/cmake/modules/FindQt3-patched.cmake index a72ba4788d8..add0a5d9855 100644 --- a/Installation/cmake/modules/FindQt3-patched.cmake +++ b/Installation/cmake/modules/FindQt3-patched.cmake @@ -5,6 +5,7 @@ # QT3_DEFINITIONS - definitions to use when # compiling code that uses Qt. # QT3_FOUND - If false, don't try to use Qt. +# QT3_VERSION_STRING - the version of Qt found # # If you need the multithreaded version of Qt, set QT3_MT_REQUIRED to TRUE # @@ -17,7 +18,7 @@ # These are around for backwards compatibility # they will be set -# QT3_WRAP_CPP, set true if3 QT_MOC_EXECUTABLE is found +# QT3_WRAP_CPP, set true if QT3_MOC_EXECUTABLE is found # QT3_WRAP_UI set true if QT3_UIC_EXECUTABLE is found FILE(GLOB GLOB_PATHS_BIN /usr/lib/qt-3*/bin /sw/lib/qt3*/bin) @@ -40,8 +41,8 @@ FIND_PATH(QT3_INCLUDE_DIR qt.h # if qglobal.h is not in the qt_include_dir then set # QT3_INCLUDE_DIR to NOTFOUND IF(NOT EXISTS ${QT3_INCLUDE_DIR}/qglobal.h) - SET(QT3_INCLUDE_DIR QT3_INCLUDE_DIR-NOTFOUND CACHE PATH "path to qt3 include directory" FORCE) - SET(QT3_INCLUDE_DIR QT3_INCLUDE_DIR-NOTFOUND CACHE PATH "path to qt3 include directory" FORCE) # double-set to work-around cmake 2.6 bug + SET(QT3_INCLUDE_DIR QT3_INCLUDE_DIR-NOTFOUND CACHE PATH "path to Qt3 include directory" FORCE) + SET(QT3_INCLUDE_DIR QT3_INCLUDE_DIR-NOTFOUND CACHE PATH "path to Qt3 include directory" FORCE) # double-set to work-around cmake 2.6 bug ENDIF(NOT EXISTS ${QT3_INCLUDE_DIR}/qglobal.h) IF(QT3_INCLUDE_DIR) @@ -53,7 +54,6 @@ IF(QT3_INCLUDE_DIR) # Under windows the qt library (MSVC) has the format qt-mtXYZ where XYZ is the # version X.Y.Z, so we need to remove the dots from version STRING(REGEX REPLACE "\\." "" qt_version_str_lib "${qt_version_str}") -ELSE(QT3_INCLUDE_DIR) ENDIF(QT3_INCLUDE_DIR) FILE(GLOB GLOB_PATHS_LIB /usr/lib/qt-3*/lib/) @@ -99,9 +99,6 @@ ELSE (QT3_MT_REQUIRED) ) ENDIF (QT3_MT_REQUIRED) -IF(QT3_QT_LIBRARY) -ELSE(QT3_QT_LIBRARY) -ENDIF(QT3_QT_LIBRARY) FIND_LIBRARY(QT3_QASSISTANTCLIENT_LIBRARY @@ -122,58 +119,59 @@ FIND_LIBRARY(QT3_QASSISTANTCLIENT_LIBRARY # qt 3 should prefer QTDIR over the PATH FIND_PROGRAM(QT3_MOC_EXECUTABLE - NAMES moc moc-qt3 + NAMES moc-qt3 moc + HINTS + $ENV{QTDIR}/bin PATHS "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/include/Qt" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/include/Qt" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/include/Qt" $ENV{QTDIR}/bin ${GLOB_PATHS_BIN} - $ENV{PATH} /usr/local/qt/bin /usr/lib/qt/bin /usr/lib/qt3/bin /usr/share/qt3/bin C:/Progra~1/qt/bin /usr/X11R6/bin - NO_DEFAULT_PATH ) IF(QT3_MOC_EXECUTABLE) SET ( QT3_WRAP_CPP "YES") -ELSE(QT3_MOC_EXECUTABLE) ENDIF(QT3_MOC_EXECUTABLE) # qt 3 should prefer QTDIR over the PATH -FIND_PROGRAM(QT3_UIC_EXECUTABLE uic +FIND_PROGRAM(QT3_UIC_EXECUTABLE + NAMES uic-qt3 uic + HINTS + $ENV{QTDIR}/bin PATHS "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/include/Qt" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/include/Qt" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/include/Qt" - $ENV{QTDIR}/bin ${GLOB_PATHS_BIN} - $ENV{PATH} /usr/local/qt/bin /usr/lib/qt/bin /usr/lib/qt3/bin /usr/share/qt3/bin C:/Progra~1/qt/bin /usr/X11R6/bin - NO_DEFAULT_PATH ) IF(QT3_UIC_EXECUTABLE) SET ( QT3_WRAP_UI "YES") -ELSE(QT3_UIC_EXECUTABLE) ENDIF(QT3_UIC_EXECUTABLE) IF (WIN32) FIND_LIBRARY(QT3_QTMAIN_LIBRARY qtmain + HINTS + $ENV{QTDIR}/lib "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/lib" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/lib" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/lib" + PATHS "$ENV{ProgramFiles}/qt/lib" - $ENV{QTDIR}/lib "C:/Program Files/qt/lib" + "C:/Program Files/qt/lib" DOC "This Library is only needed by and included with Qt3 on MSWindows. It should be NOTFOUND, undefined or IGNORE otherwise." ) ENDIF (WIN32) diff --git a/Intersections_2/include/CGAL/Line_2_Iso_rectangle_2_intersection.h b/Intersections_2/include/CGAL/Line_2_Iso_rectangle_2_intersection.h index dd1a40dfae5..57155fffc0b 100644 --- a/Intersections_2/include/CGAL/Line_2_Iso_rectangle_2_intersection.h +++ b/Intersections_2/include/CGAL/Line_2_Iso_rectangle_2_intersection.h @@ -87,7 +87,7 @@ template typename Line_2_Iso_rectangle_2_pair::Intersection_results Line_2_Iso_rectangle_2_pair::intersection_type() const { - typedef typename K::Line_2 line_t; + //typedef typename K::Line_2 line_t; if (_known) return _result; // The non const this pointer is used to cast away const. diff --git a/Intersections_2/include/CGAL/Point_2_Triangle_2_intersection.h b/Intersections_2/include/CGAL/Point_2_Triangle_2_intersection.h index 4ae6e78d511..d9c87f07702 100644 --- a/Intersections_2/include/CGAL/Point_2_Triangle_2_intersection.h +++ b/Intersections_2/include/CGAL/Point_2_Triangle_2_intersection.h @@ -81,7 +81,6 @@ template typename Point_2_Triangle_2_pair::Intersection_results Point_2_Triangle_2_pair::intersection_type() const { - typedef typename K::Line_2 line_t; if (_known) return _result; // The non const this pointer is used to cast away const. @@ -93,6 +92,7 @@ Point_2_Triangle_2_pair::intersection_type() const } return _result; /* + typedef typename K::Line_2 line_t; line_t l(_trian->vertex(0), _trian->vertex(1)); if (l.has_on_positive_side(_trian->vertex(2))) { for (int i=0; i<3; i++) { diff --git a/Intersections_2/include/CGAL/Ray_2_Ray_2_intersection.h b/Intersections_2/include/CGAL/Ray_2_Ray_2_intersection.h index 506b4eed36c..82ff7f6888e 100644 --- a/Intersections_2/include/CGAL/Ray_2_Ray_2_intersection.h +++ b/Intersections_2/include/CGAL/Ray_2_Ray_2_intersection.h @@ -99,7 +99,7 @@ Ray_2_Ray_2_pair::intersection_type() const return _result; case Line_2_Line_2_pair::LINE: { - typedef typename K::RT RT; + //typedef typename K::RT RT; const typename K::Vector_2 &dir1 = _ray1->direction().to_vector(); const typename K::Vector_2 &dir2 = _ray2->direction().to_vector(); if (CGAL_NTS abs(dir1.x()) > CGAL_NTS abs(dir1.y())) { diff --git a/Intersections_2/include/CGAL/Ray_2_Segment_2_intersection.h b/Intersections_2/include/CGAL/Ray_2_Segment_2_intersection.h index 373284bba32..eb80caa3490 100644 --- a/Intersections_2/include/CGAL/Ray_2_Segment_2_intersection.h +++ b/Intersections_2/include/CGAL/Ray_2_Segment_2_intersection.h @@ -101,7 +101,7 @@ Ray_2_Segment_2_pair::intersection_type() const ? POINT : NO_INTERSECTION; return _result; case Line_2_Line_2_pair::LINE: { - typedef typename K::RT RT; + //typedef typename K::RT RT; const typename K::Point_2 &start1 = _seg->source(); const typename K::Point_2 &end1 = _seg->target(); const typename K::Point_2 &start2 = _ray->source(); diff --git a/Intersections_2/include/CGAL/Segment_2_Segment_2_intersection.h b/Intersections_2/include/CGAL/Segment_2_Segment_2_intersection.h index 7acebb5a6b0..215ad965a1e 100644 --- a/Intersections_2/include/CGAL/Segment_2_Segment_2_intersection.h +++ b/Intersections_2/include/CGAL/Segment_2_Segment_2_intersection.h @@ -322,7 +322,7 @@ Segment_2_Segment_2_pair::intersection_type() const break; case Line_2_Line_2_pair::LINE: { - typedef typename K::RT RT; + //typedef typename K::RT RT; typename K::Point_2 const &start1 = _seg1->source(); typename K::Point_2 const &end1 = _seg1->target(); typename K::Point_2 const &start2 = _seg2->source(); diff --git a/Intersections_3/include/CGAL/Intersections_3/intersection_3_1_impl.h b/Intersections_3/include/CGAL/Intersections_3/intersection_3_1_impl.h index 33231b775fa..b8a0dfc8afa 100644 --- a/Intersections_3/include/CGAL/Intersections_3/intersection_3_1_impl.h +++ b/Intersections_3/include/CGAL/Intersections_3/intersection_3_1_impl.h @@ -202,7 +202,6 @@ intersection(const typename K::Line_3 &l1, const K&) { typedef typename K::FT FT; - typedef typename K::Line_3 Line_3; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; @@ -237,8 +236,6 @@ do_intersect(const typename K::Line_3 &l1, const typename K::Line_3 &l2, const K&) { - typedef typename K::FT FT; - typedef typename K::Line_3 Line_3; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; @@ -630,9 +627,7 @@ intersection(const typename K::Plane_3 &p, const typename K::Sphere_3 &s, const K&) { - typedef typename K::Sphere_3 Sphere_3; typedef typename K::Circle_3 Circle_3; - typedef typename K::Plane_3 Plane_3; typedef typename K::Point_3 Point_3; typedef typename K::FT FT; const FT d2 = CGAL::square(p.a()*s.center().x() + @@ -656,10 +651,6 @@ do_intersect(const typename K::Plane_3 &p, const typename K::Sphere_3 &s, const K&) { - typedef typename K::Sphere_3 Sphere_3; - typedef typename K::Circle_3 Circle_3; - typedef typename K::Plane_3 Plane_3; - typedef typename K::Point_3 Point_3; typedef typename K::FT FT; const FT d2 = CGAL::square(p.a()*s.center().x() + p.b()*s.center().y() + @@ -697,7 +688,6 @@ intersection(const typename K::Sphere_3 &s1, const K& k) { typedef typename K::Plane_3 Plane_3; - typedef typename K::Sphere_3 Sphere_3; if(s1.center() == s2.center()) { if(s1.squared_radius() == s2.squared_radius()) { if(is_zero(s1.squared_radius())) return make_object(s1.center()); @@ -716,7 +706,6 @@ do_intersect(const typename K::Sphere_3 &s1, const K& k) { typedef typename K::Plane_3 Plane_3; - typedef typename K::Sphere_3 Sphere_3; if(s1.center() == s2.center()) { return s1.squared_radius() == s2.squared_radius(); } @@ -1095,7 +1084,6 @@ intersection(const typename K::Line_3 &line, typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; typedef typename K::Segment_3 Segment_3; - typedef typename K::RT RT; typedef typename K::FT FT; bool all_values = true; FT _min = 0, _max = 0; // initialization to stop compiler warning @@ -1169,7 +1157,6 @@ intersection(const typename K::Ray_3 &ray, typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; typedef typename K::Segment_3 Segment_3; - typedef typename K::RT RT; typedef typename K::FT FT; bool all_values = true; FT _min = 0, _max = 0; // initialization to prevent compiler warning @@ -1241,7 +1228,6 @@ intersection(const typename K::Segment_3 &seg, typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; typedef typename K::Segment_3 Segment_3; - typedef typename K::RT RT; typedef typename K::FT FT; FT _min = 0, _max; @@ -1320,7 +1306,6 @@ intersection( min_points[1] = (icub2.min)(); max_points[0] = (icub1.max)(); max_points[1] = (icub2.max)(); - typedef typename K::FT FT; const int DIM = 3; int min_idx[DIM]; int max_idx[DIM]; diff --git a/Intersections_3/include/CGAL/Triangle_3_Tetrahedron_3_do_intersect.h b/Intersections_3/include/CGAL/Triangle_3_Tetrahedron_3_do_intersect.h index bbec80b86e5..727870eba8e 100644 --- a/Intersections_3/include/CGAL/Triangle_3_Tetrahedron_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Triangle_3_Tetrahedron_3_do_intersect.h @@ -39,7 +39,6 @@ do_intersect(const typename K::Triangle_3 &tr, const K & k) { typedef typename K::Triangle_3 Triangle; - typedef typename K::Point_3 Point; CGAL_kernel_precondition( ! k.is_degenerate_3_object() (tr) ); CGAL_kernel_precondition( ! k.is_degenerate_3_object() (tet) ); diff --git a/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Ray_3_intersection.h b/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Ray_3_intersection.h index 72b42435a52..ce43b8aa0a0 100644 --- a/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Ray_3_intersection.h +++ b/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Ray_3_intersection.h @@ -43,7 +43,6 @@ t3r3_intersection_coplanar_aux(const typename K::Point_3& p, // preconditions: // + p,v,a,b are coplanar - typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; typedef typename K::FT FT; diff --git a/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Segment_3_intersection.h b/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Segment_3_intersection.h index 841499dd6c1..3ea7d4d4232 100644 --- a/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Segment_3_intersection.h +++ b/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Segment_3_intersection.h @@ -42,7 +42,6 @@ t3s3_intersection_coplanar_aux(const typename K::Point_3& p, // preconditions: // + p,q,a,b are coplanar - typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; typedef typename K::FT FT; diff --git a/Kinetic_data_structures/src/CGAL/JAMA_numeric_solver.cpp b/Kinetic_data_structures/src/CGAL/JAMA_numeric_solver.cpp index b48ca2710c9..f602104eb31 100644 --- a/Kinetic_data_structures/src/CGAL/JAMA_numeric_solver.cpp +++ b/Kinetic_data_structures/src/CGAL/JAMA_numeric_solver.cpp @@ -78,7 +78,7 @@ void jama_polynomial_compute_roots(const double *begin, const double *end, double lb, double ub, std::vector &roots) { - std::size_t degree= end-begin-1; + std::ptrdiff_t degree= end-begin-1; switch( degree) { case -1: case 0: @@ -104,7 +104,7 @@ void jama_polynomial_compute_cleaned_roots(const double *begin, const double *en double lb, double ub, std::vector &roots) { - std::size_t degree= end-begin-1; + std::ptrdiff_t degree= end-begin-1; switch( degree) { case -1: case 0: diff --git a/Kinetic_data_structures/src/CGAL/Turkowski_numeric_solver.cpp b/Kinetic_data_structures/src/CGAL/Turkowski_numeric_solver.cpp index 14cca5981d7..419aa40bb5e 100644 --- a/Kinetic_data_structures/src/CGAL/Turkowski_numeric_solver.cpp +++ b/Kinetic_data_structures/src/CGAL/Turkowski_numeric_solver.cpp @@ -393,7 +393,7 @@ void Turkowski_polynomial_compute_roots(const double *begin, const double *end, std::vector &roots) { - std::size_t degree= end-begin-1; + std::ptrdiff_t degree= end-begin-1; switch( degree) { case -1: case 0: @@ -426,7 +426,7 @@ void Turkowski_polynomial_compute_cleaned_roots(const double *begin, const doubl double lb, double ub, std::vector &roots) { - std::size_t degree= end-begin-1; + std::ptrdiff_t degree= end-begin-1; switch( degree) { case -1: case 0: diff --git a/Maintenance/infrastructure/cgal.geometryfactory.com/bin/dump_crontab b/Maintenance/infrastructure/cgal.geometryfactory.com/bin/dump_crontab index 9e3aafefbaf..06504b6f5cb 100755 --- a/Maintenance/infrastructure/cgal.geometryfactory.com/bin/dump_crontab +++ b/Maintenance/infrastructure/cgal.geometryfactory.com/bin/dump_crontab @@ -1,6 +1,6 @@ #!/bin/zsh -cd $HOME/CGAL/trunk/Maintenance/infrastructure/cgal.geometryfactory.com/ +cd $HOME/CGAL/next/Maintenance/infrastructure/cgal.geometryfactory.com/ crontab -l >| crontab svn add -q crontab [ -n "`svn st crontab`" ] && svn ci -m 'updated crontab (automated commit)' crontab diff --git a/Maintenance/infrastructure/cgal.geometryfactory.com/reference-platforms/common-setup b/Maintenance/infrastructure/cgal.geometryfactory.com/reference-platforms/common-setup index 00269c3bdcf..72b75447950 100644 --- a/Maintenance/infrastructure/cgal.geometryfactory.com/reference-platforms/common-setup +++ b/Maintenance/infrastructure/cgal.geometryfactory.com/reference-platforms/common-setup @@ -1,6 +1,6 @@ export QTDIR=/usr/lib/qt-3.3 -source /home/lrineau/CGAL/MPFI-RS/setup-rs +source /home/lrineau/CGAL/RS-3.1/setup-rs PATH=/usr/local/packages/qt4.7/bin:$PATH PATH=$HOME/CGAL/path-cmake-2.6:$PATH diff --git a/Maintenance/infrastructure/delaunay.geometryfactory.com/reference-platforms/i686_Cygwin-Vista_MSVS2008-Release-32bits/setup b/Maintenance/infrastructure/delaunay.geometryfactory.com/reference-platforms/i686_Cygwin-Vista_MSVS2008-Release-32bits/setup index 7e5c9997047..1ae0afc5788 100644 --- a/Maintenance/infrastructure/delaunay.geometryfactory.com/reference-platforms/i686_Cygwin-Vista_MSVS2008-Release-32bits/setup +++ b/Maintenance/infrastructure/delaunay.geometryfactory.com/reference-platforms/i686_Cygwin-Vista_MSVS2008-Release-32bits/setup @@ -87,7 +87,7 @@ export QGLVIEWERROOT COLLECT_DEMOS_BINARIES=y export COLLECT_DEMOS_BINARIES -source /cygdrive/c/cgal/RSCube/setup-rs-32 +source /cygdrive/c/cgal/RS-3.1/setup-rs-32 BOOST_LIBRARYDIR='C:/cgal/boost-release-branch/stage/lib' BOOST_INCLUDEDIR='C:/cgal/boost-release-branch' diff --git a/Maintenance/infrastructure/delaunay.geometryfactory.com/reference-platforms/x64_Cygwin-Vista_MSVS2010-64bits/setup b/Maintenance/infrastructure/delaunay.geometryfactory.com/reference-platforms/x64_Cygwin-Vista_MSVS2010-64bits/setup index dc560f754e0..edb4aa049b3 100644 --- a/Maintenance/infrastructure/delaunay.geometryfactory.com/reference-platforms/x64_Cygwin-Vista_MSVS2010-64bits/setup +++ b/Maintenance/infrastructure/delaunay.geometryfactory.com/reference-platforms/x64_Cygwin-Vista_MSVS2010-64bits/setup @@ -99,5 +99,5 @@ export GMP_LIB_DIR MPFR_LIB_DIR export CGAL_TAUCS_DIR export QGLVIEWERROOT -source /cygdrive/c/cgal/RSCube/setup-rs-64 +source /cygdrive/c/cgal/RS-3.1/setup-rs-64 diff --git a/Mesh_2/include/CGAL/Mesh_2/Refine_edges.h b/Mesh_2/include/CGAL/Mesh_2/Refine_edges.h index 33ebb303b7a..0ceb0ad7793 100644 --- a/Mesh_2/include/CGAL/Mesh_2/Refine_edges.h +++ b/Mesh_2/include/CGAL/Mesh_2/Refine_edges.h @@ -422,12 +422,6 @@ public: zone.fh = triangulation_ref_impl().locate(p, zone.locate_type, zone.i, edge.first); const Face_handle n = f->neighbor(i); - CGAL_assertion_msg(zone.locate_type != Tr::FACE || - zone.fh == f || zone.fh == n, - "Your data set contains at least a vertex that is " - "very close to \n" - " a constrained edge! " - "Mesh_2 cannot mesh that sort of data set."); const bool f_does_conflict = (zone.locate_type == Tr::EDGE) || triangulation_ref_impl().test_conflict(p, f); diff --git a/Mesh_2/test/Mesh_2/test_meshing_user_bug_test_case.cpp b/Mesh_2/test/Mesh_2/test_meshing_user_bug_test_case.cpp new file mode 100644 index 00000000000..9750d188a6f --- /dev/null +++ b/Mesh_2/test/Mesh_2/test_meshing_user_bug_test_case.cpp @@ -0,0 +1,63 @@ +// Bug reported by a user against CGAL-4.0.2 +// A single triangle cannot be meshed! +// +// The bug report is in the message: +// Date: Wed, 25 Jul 2012 02:20:13 -0700 (PDT) +// From: gerth +// To: cgal-discuss@inria.fr +// Subject: [cgal-discuss] Delauny_Mesher gives a CGAL::Assertion_exception +// +// The fault was a buggy assertion added in the following revision: +// ----------------------------------------------------------------------- +// r66359 | lrineau | 2011-11-16 18:58:22 +0100 (Wed, 16 Nov 2011) | 3 lines +// +// Add an assertion that checks that a point constructed as the midpoint of an +// edge is located either on the edge or inside one of the two incident faces. +// +// ----------------------------------------------------------------------- +// And the assertion message was: +// terminate called after throwing an instance of 'CGAL::Assertion_exception' +// what(): CGAL ERROR: assertion violation! +// Expr: zone.locate_type != Tr::FACE || zone.fh == f || zone.fh == n +// File: /home/lrineau/wc/Mesh_2/test/Mesh_2/../../include/CGAL/Mesh_2/Refine_edges.h +// Line: 430 +// Explanation: Your data set contains at least a vertex that is very close to +// a constrained edge! Mesh_2 cannot mesh that sort of data set. + +#include +#include +#include +#include +#include + +#include + +typedef CGAL::Exact_predicates_inexact_constructions_kernel K; +typedef CGAL::Triangulation_vertex_base_2 Vb; +typedef CGAL::Delaunay_mesh_face_base_2 Fb; +typedef CGAL::Triangulation_data_structure_2 Tds; +typedef CGAL::Constrained_Delaunay_triangulation_2 CDT; +typedef CGAL::Delaunay_mesh_size_criteria_2 Criteria; + +typedef CDT::Vertex_handle Vertex_handle; +typedef CDT::Point Point; + +int main() +{ + CDT cdt; + + Vertex_handle va = cdt.insert(Point(0,0)); + Vertex_handle vb = cdt.insert(Point(-3.5240345245692879,-12.4)); + Vertex_handle vc = cdt.insert(Point(-9.3417057867627591,2.6237986627966166)); + + cdt.insert_constraint(va, vb); + cdt.insert_constraint(vb, vc); + cdt.insert_constraint(vc, va); + + std::cout << "Number of vertices: " << cdt.number_of_vertices() << std::endl; + + std::cout << "Meshing the triangulation..." << std::endl; + CGAL::refine_Delaunay_mesh_2(cdt, Criteria(0.125, 1.0)); + + std::cout << "Number of vertices: " << cdt.number_of_vertices() << std::endl; +} diff --git a/Nef_3/test/Nef_3/data/icosahedron.off b/Nef_3/test/Nef_3/data/icosahedron.off new file mode 100644 index 00000000000..fd6137d9052 --- /dev/null +++ b/Nef_3/test/Nef_3/data/icosahedron.off @@ -0,0 +1,34 @@ +OFF +12 20 0 +-0.5257310271 0.0000000000 -0.8506510258 +0.5257310271 0.0000000000 -0.8506510258 +0.5257310271 0.0000000000 0.8506510258 +-0.5257310271 0.0000000000 0.8506510258 +-0.8506510258 -0.5257310271 0.0000000000 +-0.8506510258 0.5257310271 0.0000000000 +0.8506510258 0.5257310271 0.0000000000 +0.8506510258 -0.5257310271 0.0000000000 +0.0000000000 -0.8506510258 0.5257310271 +0.0000000000 -0.8506510258 -0.5257310271 +0.0000000000 0.8506510258 -0.5257310271 +0.0000000000 0.8506510258 0.5257310271 +3 1 9 0 +3 10 1 0 +3 5 10 0 +3 4 5 0 +3 9 4 0 +3 8 2 3 +3 4 8 3 +3 5 4 3 +3 11 5 3 +3 2 11 3 +3 11 2 6 +3 10 11 6 +3 1 10 6 +3 7 1 6 +3 2 7 6 +3 11 10 5 +3 9 8 4 +3 7 2 8 +3 9 7 8 +3 1 7 9 diff --git a/Nef_3/test/Nef_3/nef_union_error_llvm.cpp b/Nef_3/test/Nef_3/nef_union_error_llvm.cpp new file mode 100644 index 00000000000..5d828e3e4a1 --- /dev/null +++ b/Nef_3/test/Nef_3/nef_union_error_llvm.cpp @@ -0,0 +1,40 @@ +#include +#include +#include +#include +#include +#include +#include + +typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; +typedef CGAL::Polyhedron_3 Polyhedron; +typedef CGAL::Polyhedron_3 > Polyhedron_d; +typedef CGAL::Nef_polyhedron_3 Nef_polyhedron; +typedef Kernel::Vector_3 Vector_3; +typedef Kernel::Aff_transformation_3 Aff_transformation_3; + +int main(int argc, char** argv) { + Polyhedron P1; + Polyhedron P2; + Polyhedron P3; + + std::ifstream f1("data/icosahedron.off"); + f1 >> P1; + std::ifstream f2("data/icosahedron.off"); + f2 >> P2; + Nef_polyhedron N1(P1); + Nef_polyhedron N2(P2); + + Aff_transformation_3 aff(CGAL::TRANSLATION, Vector_3(1,1,0,1)); + N2.transform(aff); + + std::cout << N1.number_of_volumes() << std::endl; + std::cout << N2.number_of_volumes() << std::endl; + + N1+=N2; // model-dependent crash here + + std::cout << N1.number_of_volumes() << std::endl; + N1.closure().convert_to_polyhedron(P3); + + return 0; +} \ No newline at end of file diff --git a/Number_types/test/Number_types/rounding_modes.cpp b/Number_types/test/Number_types/rounding_modes.cpp index 747dd5a4c2c..a401dfeb005 100644 --- a/Number_types/test/Number_types/rounding_modes.cpp +++ b/Number_types/test/Number_types/rounding_modes.cpp @@ -3,6 +3,7 @@ #include #include #include +#include typedef CGAL::Interval_nt_advanced NT_adv; typedef CGAL::Interval_nt<> NT; diff --git a/Polyhedron/demo/Polyhedron/CMakeLists.txt b/Polyhedron/demo/Polyhedron/CMakeLists.txt index 51de4c29aea..f9267d45797 100644 --- a/Polyhedron/demo/Polyhedron/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/CMakeLists.txt @@ -135,6 +135,7 @@ if(CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) Scene_c2t3_item.cpp Scene_nef_polyhedron_item.cpp Show_point_dialog.cpp + Scene_points_with_normal_item.cpp ) # AUXILIARY LIBRARIES @@ -202,6 +203,10 @@ if(CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) Scene_nef_rendering.cpp) target_link_libraries(scene_nef_polyhedron_item demo_framework scene_polyhedron_item) + add_library(scene_points_with_normal_item SHARED + Scene_points_with_normal_item.cpp Scene_points_with_normal_item.moc) + target_link_libraries(scene_points_with_normal_item demo_framework) + foreach( lib demo_framework scene_basic_objects @@ -308,6 +313,9 @@ if(CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) polyhedron_demo_plugin(off_plugin Polyhedron_demo_off_plugin) target_link_libraries(off_plugin scene_polyhedron_item scene_polygon_soup_item) + polyhedron_demo_plugin(xyz_plugin Polyhedron_demo_xyz_plugin) + target_link_libraries(xyz_plugin scene_points_with_normal_item) + polyhedron_demo_plugin(polylines_io_plugin Polyhedron_demo_polylines_io_plugin) target_link_libraries(polylines_io_plugin scene_polylines_item) @@ -317,11 +325,14 @@ if(CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) polyhedron_demo_plugin(triangulate_facets_plugin Polyhedron_demo_triangulate_facets_plugin) target_link_libraries(triangulate_facets_plugin scene_polyhedron_item) - polyhedron_demo_plugin(off_to_nef_plugin Polyhedron_demo_off_to_nef_plugin EXCLUDE_FROM_ALL) + polyhedron_demo_plugin(off_to_nef_plugin Polyhedron_demo_off_to_nef_plugin) target_link_libraries(off_to_nef_plugin scene_nef_polyhedron_item) + polyhedron_demo_plugin(off_to_xyz_plugin Polyhedron_demo_off_to_xyz_plugin) + target_link_libraries(off_to_xyz_plugin scene_points_with_normal_item) + polyhedron_demo_plugin(convex_hull_plugin Polyhedron_demo_convex_hull_plugin) - target_link_libraries(convex_hull_plugin scene_polyhedron_item) + target_link_libraries(convex_hull_plugin scene_polyhedron_item scene_points_with_normal_item) polyhedron_demo_plugin(kernel_plugin Polyhedron_demo_kernel_plugin) target_link_libraries(kernel_plugin scene_polyhedron_item) @@ -332,7 +343,38 @@ if(CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) if(EIGEN3_FOUND OR TAUCS_FOUND) polyhedron_demo_plugin(parameterization_plugin Polyhedron_demo_parameterization_plugin) target_link_libraries(parameterization_plugin scene_polyhedron_item scene_textured_polyhedron_item ) + else(EIGEN3_FOUND OR TAUCS_FOUND) + message(STATUS "NOTICE: Neither TAUCS nor Eigen 3.1 (or greater) libraries have been found. Parameterization will not be available.") endif(EIGEN3_FOUND OR TAUCS_FOUND) + + if(TAUCS_FOUND OR EIGEN3_FOUND) + qt4_wrap_ui( poissonUI_FILES Polyhedron_demo_poisson_plugin.ui) + polyhedron_demo_plugin(poisson_plugin Polyhedron_demo_poisson_plugin Polyhedron_demo_poisson_plugin_impl.cpp ${poissonUI_FILES}) + target_link_libraries(poisson_plugin scene_polyhedron_item scene_points_with_normal_item) + else(TAUCS_FOUND OR EIGEN3_FOUND) + message(STATUS "NOTICE: Neither TAUCS nor Eigen 3.1 (or greater) libraries have been found. Poisson reconstruction will not be available.") + endif(TAUCS_FOUND OR EIGEN3_FOUND) + + + # Link with BLAS and LAPACK only (optional), for Jet Fitting + if (NOT EIGEN3_FOUND AND LAPACK_FOUND) + include( ${LAPACK_USE_FILE} ) + endif() + + if(EIGEN3_FOUND OR LAPACK_FOUND) + qt4_wrap_ui( normal_estimationUI_FILES Polyhedron_demo_normal_estimation_plugin.ui) + polyhedron_demo_plugin(normal_estimation_plugin Polyhedron_demo_normal_estimation_plugin ${normal_estimationUI_FILES}) + target_link_libraries(normal_estimation_plugin scene_points_with_normal_item) + + polyhedron_demo_plugin(point_set_smoothing_plugin Polyhedron_demo_point_set_smoothing_plugin) + target_link_libraries(point_set_smoothing_plugin scene_points_with_normal_item) + + polyhedron_demo_plugin(point_set_average_spacing_plugin Polyhedron_demo_point_set_average_spacing_plugin) + target_link_libraries(point_set_average_spacing_plugin scene_points_with_normal_item) + + else(EIGEN3_FOUND OR LAPACK_FOUND) + message(STATUS "NOTICE: Nor Eigen 3.1 (or greater) nor LAPACK library were found. Normal estimation and smoothing will not be available.") + endif(EIGEN3_FOUND OR LAPACK_FOUND) polyhedron_demo_plugin(self_intersection_plugin Polyhedron_demo_self_intersection_plugin) target_link_libraries(self_intersection_plugin scene_polyhedron_item) @@ -361,6 +403,14 @@ if(CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) polyhedron_demo_plugin(cut_plugin Polyhedron_demo_cut_plugin) target_link_libraries(cut_plugin scene_polyhedron_item scene_basic_objects) + + qt4_wrap_ui(point_set_simplificationUI_FILES Polyhedron_demo_point_set_simplification_plugin.ui) + polyhedron_demo_plugin(point_set_simplification_plugin Polyhedron_demo_point_set_simplification_plugin ${point_set_simplificationUI_FILES}) + target_link_libraries(point_set_simplification_plugin scene_points_with_normal_item) + + qt4_wrap_ui( ps_outliers_removal_UI_FILES Polyhedron_demo_point_set_outliers_removal_plugin.ui) + polyhedron_demo_plugin(point_set_outliers_removal_plugin Polyhedron_demo_point_set_outliers_removal_plugin ${ps_outliers_removal_UI_FILES}) + target_link_libraries(point_set_outliers_removal_plugin scene_points_with_normal_item) else (CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) diff --git a/Polyhedron/demo/Polyhedron/MainWindow.cpp b/Polyhedron/demo/Polyhedron/MainWindow.cpp index 29708f5b097..fa242320424 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.cpp +++ b/Polyhedron/demo/Polyhedron/MainWindow.cpp @@ -21,6 +21,11 @@ #include #include #include +#include +#include +#include + +#include #ifdef QT_SCRIPT_LIB # include @@ -109,8 +114,13 @@ MainWindow::MainWindow(QWidget* parent) ui = new Ui::MainWindow; ui->setupUi(this); + // remove the Load Script menu entry, when the demo has not been compiled with QT_SCRIPT_LIB +#if !defined(QT_SCRIPT_LIB) + ui->menuBar->removeAction(ui->actionLoad_Script); +#endif + // Save some pointers from ui, for latter use. - treeView = ui->treeView; + sceneView = ui->sceneView; viewer = ui->viewer; // do not save the state of the viewer (anoying) @@ -119,23 +129,23 @@ MainWindow::MainWindow(QWidget* parent) // setup scene scene = new Scene(this); viewer->setScene(scene); - treeView->setModel(scene); + sceneView->setModel(scene); // setup the treeview: delegation and columns sizing... - treeView->setItemDelegate(new SceneDelegate(this)); + sceneView->setItemDelegate(new SceneDelegate(this)); - treeView->header()->setStretchLastSection(false); - treeView->header()->setResizeMode(Scene::NameColumn, QHeaderView::Stretch); - treeView->header()->setResizeMode(Scene::NameColumn, QHeaderView::Stretch); - treeView->header()->setResizeMode(Scene::ColorColumn, QHeaderView::ResizeToContents); - treeView->header()->setResizeMode(Scene::RenderingModeColumn, QHeaderView::Fixed); - treeView->header()->setResizeMode(Scene::ABColumn, QHeaderView::Fixed); - treeView->header()->setResizeMode(Scene::VisibleColumn, QHeaderView::Fixed); + sceneView->header()->setStretchLastSection(false); + sceneView->header()->setResizeMode(Scene::NameColumn, QHeaderView::Stretch); + sceneView->header()->setResizeMode(Scene::NameColumn, QHeaderView::Stretch); + sceneView->header()->setResizeMode(Scene::ColorColumn, QHeaderView::ResizeToContents); + sceneView->header()->setResizeMode(Scene::RenderingModeColumn, QHeaderView::Fixed); + sceneView->header()->setResizeMode(Scene::ABColumn, QHeaderView::Fixed); + sceneView->header()->setResizeMode(Scene::VisibleColumn, QHeaderView::Fixed); - treeView->resizeColumnToContents(Scene::ColorColumn); - treeView->resizeColumnToContents(Scene::RenderingModeColumn); - treeView->resizeColumnToContents(Scene::ABColumn); - treeView->resizeColumnToContents(Scene::VisibleColumn); + sceneView->resizeColumnToContents(Scene::ColorColumn); + sceneView->resizeColumnToContents(Scene::RenderingModeColumn); + sceneView->resizeColumnToContents(Scene::ABColumn); + sceneView->resizeColumnToContents(Scene::VisibleColumn); // setup connections connect(scene, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex & )), @@ -160,20 +170,20 @@ MainWindow::MainWindow(QWidget* parent) connect(scene, SIGNAL(updated_bbox()), this, SLOT(updateViewerBBox())); - connect(treeView->selectionModel(), + connect(sceneView->selectionModel(), SIGNAL(selectionChanged ( const QItemSelection & , const QItemSelection & ) ), this, SLOT(updateInfo())); - connect(treeView->selectionModel(), + connect(sceneView->selectionModel(), SIGNAL(selectionChanged ( const QItemSelection & , const QItemSelection & ) ), this, SLOT(updateDisplayInfo())); - connect(treeView->selectionModel(), + connect(sceneView->selectionModel(), SIGNAL(selectionChanged ( const QItemSelection & , const QItemSelection & ) ), this, SLOT(selectionChanged())); - treeView->setContextMenuPolicy(Qt::CustomContextMenu); - connect(treeView, SIGNAL(customContextMenuRequested(const QPoint & )), + sceneView->setContextMenuPolicy(Qt::CustomContextMenu); + connect(sceneView, SIGNAL(customContextMenuRequested(const QPoint & )), this, SLOT(showSceneContextMenu(const QPoint &))); connect(viewer, SIGNAL(selected(int)), @@ -302,8 +312,34 @@ MainWindow::MainWindow(QWidget* parent) } // debugger->action(QScriptEngineDebugger::InterruptAction)->trigger(); #endif + + // setup menu filtering + connect(ui->menuOperations, SIGNAL(aboutToShow()), this, SLOT(filterOperations())); } +void MainWindow::filterOperations() +{ + Q_FOREACH(const PluginNamePair& p, plugins) { + if(p.first->applicable()) { + Q_FOREACH(QAction* action, p.first->actions()) { + action->setVisible(true); + } + } else { + Q_FOREACH(QAction* action, p.first->actions()) { + action->setVisible(false); + } + } + } + + // do a pass over all menus in Operations and hide them when they are empty + Q_FOREACH(QAction* action, ui->menuOperations->actions()) { + if(QMenu* menu = action->menu()) { + action->setVisible(!(menu->isEmpty())); + } + } +} + + #ifdef QT_SCRIPT_LIB void MainWindow::evaluate_script(QString script, const QString& /*filename*/, @@ -351,6 +387,12 @@ void MainWindow::enableScriptDebugger(bool b /* = true */) "the Qt Script Debugger is not available.")); } +namespace { +bool actionsByName(QAction* x, QAction* y) { + return x->text() < y->text(); +} +} + void MainWindow::loadPlugins() { Q_FOREACH(QObject *obj, QPluginLoader::staticInstances()) @@ -395,11 +437,21 @@ void MainWindow::loadPlugins() } } } + + // sort the operations menu by name + QList actions = ui->menuOperations->actions(); + qSort(actions.begin(), actions.end(), actionsByName); + ui->menuOperations->clear(); + ui->menuOperations->addActions(actions); } -bool MainWindow::hasPlugin(QString pluginName) + +bool MainWindow::hasPlugin(const QString& pluginName) const { - return plugins.contains(pluginName); + Q_FOREACH(const PluginNamePair& p, plugins) { + if(p.second == pluginName) return true; + } + return false; } bool MainWindow::initPlugin(QObject* obj) @@ -410,7 +462,7 @@ bool MainWindow::initPlugin(QObject* obj) if(plugin) { // Call plugin's init() method plugin->init(this, this->scene, this); - plugins << obj->objectName(); + plugins << qMakePair(plugin, obj->objectName()); #ifdef QT_SCRIPT_LIB QScriptValue objectValue = script_engine->newQObject(obj); @@ -437,8 +489,6 @@ bool MainWindow::initIOPlugin(QObject* obj) Polyhedron_demo_io_plugin_interface* plugin = qobject_cast(obj); if(plugin) { -// std::cerr << "I/O plugin\n"; - plugins << obj->objectName(); io_plugins << plugin; return true; } @@ -562,7 +612,7 @@ void MainWindow::updateViewerBBox() void MainWindow::reload_item() { QAction* sender_action = qobject_cast(sender()); if(!sender_action) return; - + bool ok; int item_index = sender_action->data().toInt(&ok); QObject* item_object = scene->item(item_index); @@ -578,103 +628,100 @@ void MainWindow::reload_item() { << "that is not a Scene_item*\n"; return; } + QString filename = item->property("source filename").toString(); - if(filename.isEmpty()) { + QString loader_name = item->property("loader_name").toString(); + if(filename.isEmpty() || loader_name.isEmpty()) { std::cerr << "Cannot reload item: " - << "the item has not filename attached\n"; + << "the item has no \"source filename\" or no \"loader_name\" attached attached\n"; return; } + + Polyhedron_demo_io_plugin_interface* fileloader = find_loader(loader_name); QFileInfo fileinfo(filename); - if(! (fileinfo.isFile() && fileinfo.isReadable()) ) { - std::cerr << "Cannot reload item: " - << "cannot read file " << qPrintable(filename) << " \n"; - return; - } - Scene_item* new_item = load_item(fileinfo); - if(!new_item) { - std::cerr << "Cannot reload item: " - << "file " << qPrintable(filename) << " is not an item\n"; - return; - } + + Scene_item* new_item = load_item(fileinfo, fileloader); + new_item->setName(item->name()); new_item->setColor(item->color()); new_item->setRenderingMode(item->renderingMode()); new_item->setVisible(item->visible()); - new_item->setProperty("source filename", item->property("source filename")); new_item->changed(); scene->replaceItem(item_index, new_item); delete item; } -Scene_item* MainWindow::load_item(QFileInfo fileinfo) const { - Scene_item* item = 0; - Q_FOREACH(Polyhedron_demo_io_plugin_interface* plugin, - io_plugins) - { - if(plugin->canLoad()) { - item = plugin->load(fileinfo); - if(item) break; // go out of the loop +Polyhedron_demo_io_plugin_interface* MainWindow::find_loader(const QString& loader_name) const { + Q_FOREACH(Polyhedron_demo_io_plugin_interface* io_plugin, + io_plugins) { + if(io_plugin->name() == loader_name) { + return io_plugin; } } - return item; + throw std::invalid_argument(QString("No loader found with the name %1 available") + .arg(loader_name).toStdString()) ; } -void MainWindow::open(QString filename, bool no_popup) +void MainWindow::open(QString filename) { -#ifdef QT_SCRIPT_LIB - QString program; - if(filename.startsWith("javascript:")) { - program=filename.right(filename.size() - 11); - } - if(filename.startsWith("qtscript:")) { - program=filename.right(filename.size() - 9); - } - if(filename.endsWith(".js")) { - QFile script_file(filename); - script_file.open(QIODevice::ReadOnly); - program = script_file.readAll(); - } - if(!program.isEmpty()) - { - { - QTextStream(stderr) << "Execution of script \"" - << filename << "\"\n"; - // << filename << "\", with following content:\n" - // << program; - } - evaluate_script(program, filename); - return; - } -#endif - QFileInfo fileinfo(filename); - Scene_item* item = 0; - if(fileinfo.isFile() && fileinfo.isReadable()) { - item = load_item(fileinfo); - if(item) { - Scene::Item_id index = scene->addItem(item); - item->setProperty("source filename", fileinfo.absoluteFilePath()); - QSettings settings; - settings.setValue("OFF open directory", - fileinfo.absoluteDir().absolutePath()); - this->addToRecentFiles(filename); - selectSceneItem(index); - } - else { - if(no_popup) return; - QMessageBox::critical(this, - tr("Cannot open file"), - tr("File %1 has not a known file format.") - .arg(filename)); + QString suffix=fileinfo.suffix(); + QRegExp extension_rx(tr("\\(\\*.(%1)\\)").arg(suffix));//match (*.XXX) where XXX is the extension of the input file + QRegExp allfiles_rx("\\(\\*?\\.?(\\*)\\)"); //match (*) and (*.*) + + // collect all io_plugins and offer them to load if the file extension match one name filter + // also collect all available plugin in case of a no extension match + QStringList selected_items; + QStringList all_items; + Q_FOREACH(Polyhedron_demo_io_plugin_interface* io_plugin, io_plugins) { + all_items << io_plugin->name(); + QStringList split_filters = io_plugin->nameFilters().split(";;"); + Q_FOREACH(const QString& filter, split_filters) { + if ( extension_rx.indexIn(filter) !=-1 || allfiles_rx.indexIn(filter) !=-1 ){ + selected_items << io_plugin->name(); + break; + } } } - else { - if(no_popup) return; - QMessageBox::critical(this, - tr("Cannot open file"), - tr("File %1 is not a readable file.") - .arg(filename)); + + bool ok; + QString loader_name; + + switch( selected_items.size() ) + { + case 1: + loader_name=selected_items.first(); + ok=true; + break; + case 0: + loader_name=QInputDialog::getItem(this, tr("Select a loader"), tr("Available loaders for %1 :").arg(fileinfo.fileName()), all_items, 0, false, &ok); + break; + default: + loader_name=QInputDialog::getItem(this, tr("Select a loader"), tr("Available loaders for %1 :").arg(fileinfo.fileName()), selected_items, 0, false, &ok); } + + if(!ok || loader_name.isEmpty()) { return; } + + Scene_item* scene_item = load_item(filename, find_loader(loader_name)); + selectSceneItem(scene->addItem(scene_item)); +} + +Scene_item* MainWindow::load_item(QFileInfo fileinfo, Polyhedron_demo_io_plugin_interface* loader) { + Scene_item* item = NULL; + if(!fileinfo.isFile() || !fileinfo.isReadable()) { + throw std::invalid_argument(QString("File %1 is not a readable file.") + .arg(fileinfo.absoluteFilePath()).toStdString()); + } + + item = loader->load(fileinfo); + if(!item) { + throw std::logic_error(QString("Could not load item from file %1 using plugin %2") + .arg(fileinfo.absoluteFilePath()).arg(loader->name()).toStdString()); + } + + item->setProperty("source filename", fileinfo.absoluteFilePath()); + item->setProperty("loader_name", loader->name()); + return item; } void MainWindow::selectSceneItem(int i) @@ -682,7 +729,7 @@ void MainWindow::selectSceneItem(int i) if(i < 0) return; if(i >= scene->numberOfEntries()) return; - treeView->selectionModel()->select(scene->createSelection(i), + sceneView->selectionModel()->select(scene->createSelection(i), QItemSelectionModel::ClearAndSelect); } @@ -701,27 +748,27 @@ void MainWindow::unSelectSceneItem(int i) void MainWindow::addSceneItemInSelection(int i) { - treeView->selectionModel()->select(scene->createSelection(i), + sceneView->selectionModel()->select(scene->createSelection(i), QItemSelectionModel::Select); scene->itemChanged(i); } void MainWindow::removeSceneItemFromSelection(int i) { - treeView->selectionModel()->select(scene->createSelection(i), + sceneView->selectionModel()->select(scene->createSelection(i), QItemSelectionModel::Deselect); scene->itemChanged(i); } void MainWindow::selectAll() { - treeView->selectionModel()->select(scene->createSelectionAll(), + sceneView->selectionModel()->select(scene->createSelectionAll(), QItemSelectionModel::ClearAndSelect); } int MainWindow::getSelectedSceneItemIndex() const { - QModelIndexList selectedRows = treeView->selectionModel()->selectedRows(); + QModelIndexList selectedRows = sceneView->selectionModel()->selectedRows(); if(selectedRows.size() != 1) return -1; else @@ -730,7 +777,7 @@ int MainWindow::getSelectedSceneItemIndex() const QList MainWindow::getSelectedSceneItemIndices() const { - QModelIndexList selectedRows = treeView->selectionModel()->selectedRows(); + QModelIndexList selectedRows = sceneView->selectionModel()->selectedRows(); QList result; Q_FOREACH(QModelIndex index, selectedRows) { result << index.row(); @@ -802,8 +849,8 @@ void MainWindow::showSceneContextMenu(const QPoint& p) { if(!sender) return; int index = -1; - if(sender == treeView) { - QModelIndex modelIndex = treeView->indexAt(p); + if(sender == sceneView) { + QModelIndex modelIndex = sceneView->indexAt(p); if(!modelIndex.isValid()) return; index = modelIndex.row(); @@ -867,39 +914,85 @@ void MainWindow::closeEvent(QCloseEvent *event) event->accept(); } +void MainWindow::load_script(QFileInfo info) +{ +#if defined(QT_SCRIPT_LIB) + QString program; + QString filename = info.absoluteFilePath(); + QFile script_file(filename); + script_file.open(QIODevice::ReadOnly); + program = script_file.readAll(); + if(!program.isEmpty()) + { + QTextStream(stderr) + << "Execution of script \"" + << filename << "\"\n"; + evaluate_script(program, filename); + } +#endif +} + +void MainWindow::on_actionLoad_Script_triggered() +{ +#if defined(QT_SCRIPT_LIB) + QString filename = QFileDialog::getSaveFileName( + this, + tr("Select a script to run..."), + ".", + "QTScripts (*.js);;All Files (*)"); + + load_script(QFileInfo(filename)); +#endif +} + void MainWindow::on_actionLoad_triggered() { QStringList filters; + // we need to special case our way out of this + filters << "All Files (*)"; + QStringList extensions; + + typedef QMap FilterPluginMap; + FilterPluginMap filterPluginMap; + Q_FOREACH(Polyhedron_demo_io_plugin_interface* plugin, io_plugins) { - if(plugin->canLoad()) { - Q_FOREACH(QString filter, plugin->nameFilters()) { - if(!filter.isEmpty()) { - QRegExp re1("\\((.+)\\)"); - if(re1.indexIn(filter) != -1) { - QString filter_extensions = re1.cap(1); - extensions += filter_extensions.simplified().split(" "); - } - filters << filter; - } + QStringList split_filters = plugin->nameFilters().split(";;"); + Q_FOREACH(const QString& filter, split_filters) { + FilterPluginMap::iterator it = filterPluginMap.find(filter); + if(it != filterPluginMap.end()) { + qDebug() << "Duplicate Filter: " << it.value(); + qDebug() << "This filter will not be available."; + } else { + filterPluginMap[filter] = plugin; } + filters << filter; } } - QStringList sorted_extensions = extensions.toSet().toList(); - filters << tr("All files (*)"); - filters.push_front(QString("All know files (%1)") - .arg(sorted_extensions.join(" "))); - QSettings settings; - QString directory = settings.value("OFF open directory", - QDir::current().dirName()).toString(); - QStringList filenames = - QFileDialog::getOpenFileNames(this, - tr("Open File..."), - directory, - filters.join(";;")); - if(!filenames.isEmpty()) { - Q_FOREACH(QString filename, filenames) { + + QFileDialog dialog(this); + dialog.setNameFilters(filters); + if(dialog.exec() != QDialog::Accepted) { return; } + + FilterPluginMap::iterator it = + filterPluginMap.find(dialog.selectedNameFilter()); + + Polyhedron_demo_io_plugin_interface* selectedPlugin = NULL; + + if(it != filterPluginMap.end()) { + selectedPlugin = it.value(); + } + + Q_FOREACH(const QString& filename, dialog.selectedFiles()) { + Scene_item* item = NULL; + if(selectedPlugin) { + QFileInfo info(filename); + item = load_item(info, selectedPlugin); + Scene::Item_id index = scene->addItem(item); + selectSceneItem(index); + this->addToRecentFiles(filename); + } else { open(filename); } } @@ -907,7 +1000,7 @@ void MainWindow::on_actionLoad_triggered() void MainWindow::on_actionSaveAs_triggered() { - QModelIndexList selectedRows = treeView->selectionModel()->selectedRows(); + QModelIndexList selectedRows = sceneView->selectionModel()->selectedRows(); if(selectedRows.size() != 1) return; Scene_item* item = scene->item(getSelectedSceneItemIndex()); @@ -973,7 +1066,7 @@ void MainWindow::on_actionDuplicate_triggered() void MainWindow::on_actionShowHide_triggered() { - Q_FOREACH(QModelIndex index, treeView->selectionModel()->selectedRows()) + Q_FOREACH(QModelIndex index, sceneView->selectionModel()->selectedRows()) { int i = index.row(); Scene_item* item = scene->item(i); diff --git a/Polyhedron/demo/Polyhedron/MainWindow.h b/Polyhedron/demo/Polyhedron/MainWindow.h index e030162fa8f..bb3ab2f66db 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.h +++ b/Polyhedron/demo/Polyhedron/MainWindow.h @@ -18,6 +18,7 @@ class Viewer; class QTreeView; class QMenu; class Polyhedron_demo_io_plugin_interface; +class Polyhedron_demo_plugin_interface; class Scene_item; @@ -41,9 +42,26 @@ public: public slots: void updateViewerBBox(); - void open(QString filename, bool no_popup = false); - Scene_item* load_item(QFileInfo) const; + + void open(QString); + + /// Find an IO plugin. + /// @throws `std::invalid_argument` if no loader with that argument can be found + /// @returns the IO plugin associated with `loader_name` + Polyhedron_demo_io_plugin_interface* find_loader(const QString& loader_name) const; + + /// Load an item with a given loader. + /// + /// @throws `std::logic_error` if loading does not succeed or + /// `std::invalid_argument` if `fileinfo` specifies an invalid file + Scene_item* load_item(QFileInfo fileinfo, Polyhedron_demo_io_plugin_interface*); + + /// Reloads an item. Expects to be called by a QAction with the + /// index of the item to be reloaded as data attached to the action. + /// The index must identify a valid `Scene_item`. void reload_item(); + + void load_script(QFileInfo); void selectSceneItem(int i); void showSelectedPoint(double, double, double); @@ -66,7 +84,7 @@ public slots: void error(QString); void message(QString, QString, QString = QString("normal")); - bool hasPlugin(QString); + bool hasPlugin(const QString&) const; void enableScriptDebugger(bool = true); protected slots: @@ -91,6 +109,7 @@ protected slots: void on_actionLoad_triggered(); bool on_actionErase_triggered(); void on_actionDuplicate_triggered(); + void on_actionLoad_Script_triggered(); // Show/Hide void on_actionShowHide_triggered(); @@ -112,6 +131,8 @@ protected slots: void on_action_Copy_camera_triggered(); void on_action_Paste_camera_triggered(); + void filterOperations(); + protected: void loadPlugins(); bool initPlugin(QObject*); @@ -128,10 +149,13 @@ private: Scene* scene; Viewer* viewer; - QTreeView* treeView; + QTreeView* sceneView; Ui::MainWindow* ui; QVector io_plugins; - QStringList plugins; + + // typedef to make Q_FOREACH work + typedef QPair PluginNamePair; + QVector plugins; #ifdef QT_SCRIPT_LIB QScriptEngine* script_engine; public: diff --git a/Polyhedron/demo/Polyhedron/MainWindow.ui b/Polyhedron/demo/Polyhedron/MainWindow.ui index d64f459a718..820be781c58 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.ui +++ b/Polyhedron/demo/Polyhedron/MainWindow.ui @@ -50,6 +50,8 @@ + + @@ -209,7 +211,7 @@ - + QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked @@ -623,6 +625,11 @@ Ctrl+A + + + Load Script + + diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_3.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_3.cpp index 623db9777dd..6686efdc8c8 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_3.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_3.cpp @@ -1,10 +1,39 @@ #include "MainWindow.h" #include +#include #include +#include + +class Polyhedron_demo : public QApplication +{ +public: + Polyhedron_demo(int& argc, char **argv) : QApplication(argc, argv) {} + + bool notify(QObject* receiver, QEvent* event) + { + try { + return QApplication::notify(receiver, event); + } catch (std::exception &e) { + // find the mainwindow to spawn an error message + Q_FOREACH (QWidget *widget, QApplication::topLevelWidgets()) { + if(MainWindow* mw = qobject_cast(widget)) { + QMessageBox::critical( + mw, + tr("Unhandled exception"), + e.what()); + break; + } + } + } catch (...) { + qFatal("Unknown exception encountered. Aborting."); + } + return false; + } +}; int main(int argc, char **argv) { - QApplication app(argc, argv); + Polyhedron_demo app(argc, argv); app.setOrganizationDomain("geometryfactory.com"); app.setOrganizationName("GeometryFactory"); app.setApplicationName("Polyhedron_3 demo"); @@ -29,7 +58,7 @@ int main(int argc, char **argv) mainWindow.enableScriptDebugger(); args.removeAt(0); } - mainWindow.open("autostart.js", true); + mainWindow.load_script(QFileInfo("autostart.js")); #endif Q_FOREACH(QString filename, args) { mainWindow.open(filename); diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_convex_hull_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_convex_hull_plugin.cpp index c2bd9f730ae..733223f3ea6 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_convex_hull_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_convex_hull_plugin.cpp @@ -4,6 +4,7 @@ #include #include "Scene_polyhedron_item.h" +#include "Scene_points_with_normal_item.h" #include "Polyhedron_type.h" #include "Polyhedron_demo_plugin_helper.h" @@ -24,6 +25,12 @@ public: return QStringList() << "actionConvexHull"; } + bool applicable() const { + return + qobject_cast(scene->item(scene->mainSelectionIndex())) || + qobject_cast(scene->item(scene->mainSelectionIndex())); + } + public slots: void on_actionConvexHull_triggered(); @@ -34,29 +41,36 @@ void Polyhedron_demo_convex_hull_plugin::on_actionConvexHull_triggered() { const Scene_interface::Item_id index = scene->mainSelectionIndex(); - Scene_polyhedron_item* item = + Scene_polyhedron_item* poly_item = qobject_cast(scene->item(index)); - if(item) + Scene_points_with_normal_item* pts_item = + qobject_cast(scene->item(index)); + + if(poly_item || pts_item) { - Polyhedron* pMesh = item->polyhedron(); - // wait cursor QApplication::setOverrideCursor(Qt::WaitCursor); - + QTime time; time.start(); std::cout << "Convex hull..."; // add convex hull as new polyhedron Polyhedron *pConvex_hull = new Polyhedron; - CGAL::convex_hull_3(pMesh->points_begin(),pMesh->points_end(),*pConvex_hull); + if ( poly_item ){ + Polyhedron* pMesh = poly_item->polyhedron(); + CGAL::convex_hull_3(pMesh->points_begin(),pMesh->points_end(),*pConvex_hull); + } + else{ + CGAL::convex_hull_3(pts_item->point_set()->begin(),pts_item->point_set()->end(),*pConvex_hull); + } std::cout << "ok (" << time.elapsed() << " ms)" << std::endl; Scene_polyhedron_item* new_item = new Scene_polyhedron_item(pConvex_hull); - new_item->setName(tr("%1 (convex hull)").arg(item->name())); + new_item->setName(tr("%1 (convex hull)").arg(scene->item(index)->name())); new_item->setColor(Qt::magenta); - new_item->setRenderingMode(item->renderingMode()); + new_item->setRenderingMode(FlatPlusEdges); scene->addItem(new_item); // default cursor diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_corefinement_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_corefinement_plugin.cpp index 6ac59533b33..7c73d4ec92d 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_corefinement_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_corefinement_plugin.cpp @@ -28,7 +28,9 @@ class Polyhedron_demo_corefinement_plugin : public: - + bool applicable() const { + return qobject_cast(scene->item(scene->mainSelectionIndex())); + } QList actions() const { return QList() << actionPolyhedronCorefinement_3; diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_cut_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_cut_plugin.cpp index ca15a7fb968..a343556bde7 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_cut_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_cut_plugin.cpp @@ -160,6 +160,10 @@ public: virtual ~Polyhedron_demo_cut_plugin(); + bool applicable() const { + return true; + } + void init(QMainWindow* mainWindow, Scene_interface* scene_interface, Messages_interface* m); QList actions() const; diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_edit_polyhedron_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_edit_polyhedron_plugin.cpp index ca6bb55a845..b11478c40d1 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_edit_polyhedron_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_edit_polyhedron_plugin.cpp @@ -73,6 +73,16 @@ public: return QList() << actionToggleEdit; } + //! Applicable if any of the currently selected items is either a Polyhedron or an Edit polyhedron + bool applicable() const { + Q_FOREACH(Scene_interface::Item_id i, scene->selectionIndices()) + { + if(qobject_cast(scene->item(i)) + || qobject_cast(scene->item(i))) + return true; + } + return false; + } public slots: void on_actionToggleEdit_triggered(bool); void start_deform(); diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_inside_out_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_inside_out_plugin.cpp index 4ceac2b1e79..25469ebef8a 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_inside_out_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_inside_out_plugin.cpp @@ -21,6 +21,13 @@ public: QStringList actionsNames() const { return QStringList() << "actionInsideOut"; } + + bool applicable() const { + const Scene_interface::Item_id index = scene->mainSelectionIndex(); + return qobject_cast(scene->item(index)) + || qobject_cast(scene->item(index)); + } + public slots: void on_actionInsideOut_triggered(); diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_intersection_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_intersection_plugin.cpp index ccc95d6d4cf..5a1dbc791bb 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_intersection_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_intersection_plugin.cpp @@ -33,7 +33,9 @@ class Polyhedron_demo_intersection_plugin : public: - + bool applicable() const { + return qobject_cast(scene->item(scene->mainSelectionIndex())); + } QList actions() const { return QList() << actionPolyhedronIntersection_3; diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_io_plugin_interface.h b/Polyhedron/demo/Polyhedron/Polyhedron_demo_io_plugin_interface.h index 4f9a6e38583..9fe656e4a42 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_io_plugin_interface.h +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_io_plugin_interface.h @@ -9,9 +9,10 @@ class Scene_item; class Polyhedron_demo_io_plugin_interface { public: + virtual QString name() const = 0; virtual ~Polyhedron_demo_io_plugin_interface() {} - - virtual QStringList nameFilters() const = 0; + + virtual QString nameFilters() const = 0; virtual bool canLoad() const = 0; virtual Scene_item* load(QFileInfo fileinfo) = 0; diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_kernel_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_kernel_plugin.cpp index d4403303f8b..ce37d19b68d 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_kernel_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_kernel_plugin.cpp @@ -36,6 +36,11 @@ public: QStringList actionsNames() const { return QStringList() << "actionKernel"; } + + bool applicable() const { + return qobject_cast(scene->item(scene->mainSelectionIndex())); + } + public slots: void on_actionKernel_triggered(); diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_mesh_3_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_mesh_3_plugin.cpp index 48cf75b54da..d9e920e7147 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_mesh_3_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_mesh_3_plugin.cpp @@ -42,6 +42,10 @@ public: QList actions() const { return QList() << actionMesh_3; } + + bool applicable() const { + return qobject_cast(scene->item(scene->mainSelectionIndex())); + } public slots: void mesh_3(); diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_mesh_3_plugin_cgal_code.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_mesh_3_plugin_cgal_code.cpp index a095320f812..cf0ad1d1a93 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_mesh_3_plugin_cgal_code.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_mesh_3_plugin_cgal_code.cpp @@ -133,7 +133,7 @@ public: // Indicate if rendering mode is supported bool supportsRenderingMode(RenderingMode m) const { - return (m != Gouraud); // CHECK THIS! + return (m != Gouraud && m!=PointsPlusNormals); // CHECK THIS! } void draw() const { diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_mesh_simplification_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_mesh_simplification_plugin.cpp index 09a8b9adaef..5dce477e069 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_mesh_simplification_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_mesh_simplification_plugin.cpp @@ -26,6 +26,9 @@ public: return QStringList() << "actionSimplify"; } + bool applicable() const { + return qobject_cast(scene->item(scene->mainSelectionIndex())); + } public slots: void on_actionSimplify_triggered(); diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_nef_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_nef_plugin.cpp index ff393b7663c..629cb24755b 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_nef_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_nef_plugin.cpp @@ -30,6 +30,11 @@ public: << "actionMinkowskiSum"; } + bool applicable() const { + return qobject_cast(scene->item(scene->mainSelectionIndex())) + || qobject_cast(scene->item(scene->mainSelectionIndex())); + } + // QList actions() const { // QMenu* menu = new QMenu(tr("Boolean operations"), mw); // QAction* action_to_nef = new QAction(tr("Convert to nef polyhedron"), mw); diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_normal_estimation_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_normal_estimation_plugin.cpp new file mode 100644 index 00000000000..27c8743c507 --- /dev/null +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_normal_estimation_plugin.cpp @@ -0,0 +1,201 @@ +#include "config.h" +#include "Scene_points_with_normal_item.h" +#include "Polyhedron_demo_plugin_helper.h" +#include "Polyhedron_demo_plugin_interface.h" + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "ui_Polyhedron_demo_normal_estimation_plugin.h" + +class Polyhedron_demo_normal_estimation_plugin : + public QObject, + public Polyhedron_demo_plugin_helper +{ + Q_OBJECT + Q_INTERFACES(Polyhedron_demo_plugin_interface) + QAction* actionNormalEstimation; + QAction* actionNormalInversion; + +public: + void init(QMainWindow* mainWindow, Scene_interface* scene_interface) { + + actionNormalEstimation = new QAction(tr("Normal estimation of point set"), mainWindow); + actionNormalEstimation->setObjectName("actionNormalEstimation"); + + actionNormalInversion = new QAction(tr("Inverse normal orientation"), mainWindow); + actionNormalInversion->setObjectName("actionNormalInversion"); + + Polyhedron_demo_plugin_helper::init(mainWindow, scene_interface); + } + + QList actions() const { + return QList() << actionNormalEstimation << actionNormalInversion; + } + + bool applicable() const { + return qobject_cast(scene->item(scene->mainSelectionIndex())); + } + +public slots: + void on_actionNormalEstimation_triggered(); + void on_actionNormalInversion_triggered(); + +}; // end PS_demo_smoothing_plugin + +class Point_set_demo_normal_estimation_dialog : public QDialog, private Ui::NormalEstimationDialog +{ + Q_OBJECT + public: + Point_set_demo_normal_estimation_dialog(QWidget* /*parent*/ = 0) + { + setupUi(this); + } + + QString directionMethod() const { return m_inputDirection->currentText(); } + int directionNbNeighbors() const { return m_inputNbNeighborsDirection->value(); } + + QString orientationMethod() const { return m_inputOrientation->currentText(); } + int orientationNbNeighbors() const { return m_inputNbNeighborsOrientation->value(); } +}; + + +void Polyhedron_demo_normal_estimation_plugin::on_actionNormalInversion_triggered() +{ + const 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; + + for(Point_set::iterator it = points->begin(); it != points->end(); ++it){ + it->normal() = -1 * it->normal(); + } + } +} + +void Polyhedron_demo_normal_estimation_plugin::on_actionNormalEstimation_triggered() +{ + const 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 + Point_set_demo_normal_estimation_dialog dialog; + if(!dialog.exec()) + return; + + QApplication::setOverrideCursor(Qt::WaitCursor); + + // First point to delete + Point_set::iterator first_unoriented_point = points->end(); + + //*************************************** + // normal estimation + //*************************************** + + if (dialog.directionMethod() == "plane") + { + CGAL::Timer task_timer; task_timer.start(); + std::cerr << "Estimates normal direction by PCA (k=" << dialog.directionNbNeighbors() <<")...\n"; + + // Estimates normals direction. + CGAL::pca_estimate_normals(points->begin(), points->end(), + CGAL::make_normal_of_point_with_normal_pmap(points->begin()), + dialog.directionNbNeighbors()); + + // Mark all normals as unoriented + first_unoriented_point = points->begin(); + + long memory = CGAL::Memory_sizer().virtual_size(); + std::cerr << "Estimates normal direction: " << task_timer.time() << " seconds, " + << (memory>>20) << " Mb allocated" + << std::endl; + } + else if (dialog.directionMethod() == "quadric") + { + CGAL::Timer task_timer; task_timer.start(); + std::cerr << "Estimates normal direction by Jet Fitting (k=" << dialog.directionNbNeighbors() <<")...\n"; + + // Estimates normals direction. + CGAL::jet_estimate_normals(points->begin(), points->end(), + CGAL::make_normal_of_point_with_normal_pmap(points->begin()), + dialog.directionNbNeighbors()); + + // Mark all normals as unoriented + first_unoriented_point = points->begin(); + + long memory = CGAL::Memory_sizer().virtual_size(); + std::cerr << "Estimates normal direction: " << task_timer.time() << " seconds, " + << (memory>>20) << " Mb allocated" + << std::endl; + } + + //*************************************** + // normal orientation + //*************************************** + + CGAL::Timer task_timer; task_timer.start(); + std::cerr << "Orient normals with a Minimum Spanning Tree (k=" << dialog.orientationNbNeighbors() << ")...\n"; + + // Tries to orient normals + first_unoriented_point = + CGAL::mst_orient_normals(points->begin(), points->end(), + CGAL::make_normal_of_point_with_normal_pmap(points->begin()), + dialog.orientationNbNeighbors()); + + int nb_unoriented_normals = std::distance(first_unoriented_point, points->end()); + long 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->select(points->begin(), points->end(), false); + points->select(first_unoriented_point, points->end(), true); + + // Updates scene + 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)); + } + } +} + +Q_EXPORT_PLUGIN2(Polyhedron_demo_normal_estimation_plugin, Polyhedron_demo_normal_estimation_plugin) + +#include "Polyhedron_demo_normal_estimation_plugin.moc" diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_normal_estimation_plugin.ui b/Polyhedron/demo/Polyhedron/Polyhedron_demo_normal_estimation_plugin.ui new file mode 100644 index 00000000000..109d4e7e3cf --- /dev/null +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_normal_estimation_plugin.ui @@ -0,0 +1,132 @@ + + NormalEstimationDialog + + + + 0 + 0 + 311 + 120 + + + + Normal estimation + + + + + + Direction: + + + + + + + + quadric + + + + + plane + + + + + + + + neighbors + + + 6 + + + 9999 + + + 18 + + + + + + + Orientation: + + + + + + + + MST + + + + + + + + neighbors + + + 6 + + + 9999 + + + 18 + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + NormalEstimationDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + NormalEstimationDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_off_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_off_plugin.cpp index 6f6d926bd46..b312fd627bb 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_off_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_off_plugin.cpp @@ -13,18 +13,15 @@ class Polyhedron_demo_off_plugin : Q_INTERFACES(Polyhedron_demo_io_plugin_interface) public: - QStringList nameFilters() const; + QString name() const { return "Polyhedron_demo_off_plugin"; } + QString nameFilters() const { return "OFF files (*.off)"; } bool canLoad() const; Scene_item* load(QFileInfo fileinfo); - + bool canSave(const Scene_item*); bool save(const Scene_item*, QFileInfo fileinfo); }; -QStringList Polyhedron_demo_off_plugin::nameFilters() const { - return QStringList() << "OFF files (*.off)"; -} - bool Polyhedron_demo_off_plugin::canLoad() const { return true; } diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_off_to_nef_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_off_to_nef_plugin.cpp index 4016bfffddd..263855ff58f 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_off_to_nef_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_off_to_nef_plugin.cpp @@ -12,7 +12,8 @@ class Polyhedron_demo_off_to_nef_plugin : Q_INTERFACES(Polyhedron_demo_io_plugin_interface) public: - QStringList nameFilters() const; + QString name() const { return "Polyhedron_demo_off_to_nef_plugin"; } + QString nameFilters() const { return "OFF files, into nef (*.off)"; } bool canLoad() const; Scene_item* load(QFileInfo fileinfo); @@ -20,10 +21,6 @@ public: bool save(const Scene_item*, QFileInfo fileinfo); }; -QStringList Polyhedron_demo_off_to_nef_plugin::nameFilters() const { - return QStringList() << "OFF files, into nef (*.off)"; -} - bool Polyhedron_demo_off_to_nef_plugin::canLoad() const { return true; } @@ -46,12 +43,12 @@ Polyhedron_demo_off_to_nef_plugin::load(QFileInfo fileinfo) { return item; } -bool Polyhedron_demo_off_to_nef_plugin::canSave(const Scene_item* item) +bool Polyhedron_demo_off_to_nef_plugin::canSave(const Scene_item*) { return false; } -bool Polyhedron_demo_off_to_nef_plugin::save(const Scene_item* item, QFileInfo fileinfo) +bool Polyhedron_demo_off_to_nef_plugin::save(const Scene_item*, QFileInfo) { return false; } diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_off_to_xyz_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_off_to_xyz_plugin.cpp new file mode 100644 index 00000000000..00e054eb0c1 --- /dev/null +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_off_to_xyz_plugin.cpp @@ -0,0 +1,57 @@ +#include "Scene_points_with_normal_item.h" + +#include "Polyhedron_demo_io_plugin_interface.h" +#include + +class Polyhedron_demo_off_to_xyz_plugin : + public QObject, + public Polyhedron_demo_io_plugin_interface +{ + Q_OBJECT + Q_INTERFACES(Polyhedron_demo_io_plugin_interface) + +public: + QString name() const { return "Polyhedron_demo_off_to_xyz_plugin"; } + QString nameFilters() const { return "OFF files as Point set (*.off)"; } + bool canLoad() const; + Scene_item* load(QFileInfo fileinfo); + + bool canSave(const Scene_item*); + bool save(const Scene_item*, QFileInfo fileinfo); +}; + +bool Polyhedron_demo_off_to_xyz_plugin::canLoad() const { + return true; +} + +Scene_item* +Polyhedron_demo_off_to_xyz_plugin::load(QFileInfo fileinfo) { + std::ifstream in(fileinfo.filePath().toUtf8()); + + if(!in) + std::cerr << "Error!\n"; + Scene_points_with_normal_item* item = new Scene_points_with_normal_item(); + + if(!item->read_off_point_set(in)) + { + delete item; + return 0; + } + + item->setName(fileinfo.baseName()); + return item; +} + +bool Polyhedron_demo_off_to_xyz_plugin::canSave(const Scene_item*) +{ + return false; +} + +bool Polyhedron_demo_off_to_xyz_plugin::save(const Scene_item*, QFileInfo) +{ + return false; +} + +#include +Q_EXPORT_PLUGIN2(Polyhedron_demo_off_to_xyz_plugin, Polyhedron_demo_off_to_xyz_plugin) +#include "Polyhedron_demo_off_to_xyz_plugin.moc" diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_orient_soup_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_orient_soup_plugin.cpp index 04cdc88ee8d..25a086d383f 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_orient_soup_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_orient_soup_plugin.cpp @@ -22,6 +22,15 @@ public: void init(QMainWindow* mainWindow, Scene_interface* scene_interface, Messages_interface* m); + + bool applicable() const { + Q_FOREACH(Scene_interface::Item_id index, scene->selectionIndices()) { + if(qobject_cast(scene->item(index))) + return true; + } + return false; + } + QList actions() const; public slots: diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_parameterization_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_parameterization_plugin.cpp index 3291389b87f..7c89b65ac83 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_parameterization_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_parameterization_plugin.cpp @@ -37,6 +37,10 @@ public: << "actionDCP"; } + bool applicable() const { + return qobject_cast(scene->item(scene->mainSelectionIndex())); + } + public slots: void on_actionMVC_triggered(); void on_actionDCP_triggered(); diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_pca_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_pca_plugin.cpp index 3560a5ea981..b7af60450a6 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_pca_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_pca_plugin.cpp @@ -38,6 +38,11 @@ public: << "actionFitLine"; } + bool applicable() const { + return qobject_cast(scene->item(scene->mainSelectionIndex())); + } + + public slots: void on_actionFitPlane_triggered(); void on_actionFitLine_triggered(); diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_plugin_interface.h b/Polyhedron/demo/Polyhedron/Polyhedron_demo_plugin_interface.h index 6c23fb815ca..238bb803a13 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_plugin_interface.h +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_plugin_interface.h @@ -18,6 +18,15 @@ public: virtual void init(QMainWindow* mw, Scene_interface* sc, Messages_interface*) { init(mw, sc); }; + + //! Checks the current state of the `Scene` or `MainWindow` and decides + //! if the plugin can function, given that state. It's actions are + //! visible in contextmenus, if this returns true, not visible + //! otherwise. + //! + //! @returns \c true, if the plugin is applicable, \c false + //! otherwise + virtual bool applicable() const = 0; virtual QList actions() const = 0; }; diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_point_set_average_spacing_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_point_set_average_spacing_plugin.cpp new file mode 100644 index 00000000000..f6b6969289e --- /dev/null +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_point_set_average_spacing_plugin.cpp @@ -0,0 +1,109 @@ +#include "config.h" +#include "Scene_points_with_normal_item.h" +#include "Polyhedron_demo_plugin_helper.h" +#include "Polyhedron_demo_plugin_interface.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +class Polyhedron_demo_point_set_average_spacing_plugin : + public QObject, + public Polyhedron_demo_plugin_helper +{ + Q_OBJECT + Q_INTERFACES(Polyhedron_demo_plugin_interface) + +private: + QAction* actionAverageSpacing; + +public: + void init(QMainWindow* mainWindow, Scene_interface* scene_interface) { + actionAverageSpacing = new QAction(tr("Point set average spacing"), mainWindow); + actionAverageSpacing->setObjectName("actionAverageSpacing"); + + Polyhedron_demo_plugin_helper::init(mainWindow, scene_interface); + } + + QList actions() const { + return QList() << actionAverageSpacing; + } + + //! Applicable if the currently selected item is a + //! points_with_normal_item. + bool applicable() const { + return qobject_cast(scene->item(scene->mainSelectionIndex())); + } + +public slots: + void on_actionAverageSpacing_triggered(); +}; // end Polyhedron_demo_point_set_average_spacing_plugin + +void Polyhedron_demo_point_set_average_spacing_plugin::on_actionAverageSpacing_triggered() +{ + const 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 + bool ok; + const int nb_neighbors = + QInputDialog::getInteger((QWidget*)mw, + tr("Average Spacing"), // dialog title + tr("Number of neighbors:"), // field label + 6, // default value = 1 ring + 6, // min + 1000, // max + 1, // step + &ok); + if(!ok) + return; + + QApplication::setOverrideCursor(Qt::WaitCursor); + + CGAL::Timer task_timer; task_timer.start(); + std::cerr << "Average spacing (k=" << nb_neighbors <<")...\n"; + + // Computes average spacing + double average_spacing = CGAL::compute_average_spacing( + points->begin(), points->end(), + nb_neighbors); + + // Print result + Kernel::Sphere_3 bsphere = points->bounding_sphere(); + double radius = std::sqrt(bsphere.squared_radius()); + long memory = CGAL::Memory_sizer().virtual_size(); + std::cerr << "Average spacing = " << average_spacing + << " = " << average_spacing/radius << " * point set radius (" + << task_timer.time() << " seconds, " + << (memory>>20) << " Mb allocated)" + << std::endl; + QApplication::restoreOverrideCursor(); + + QMessageBox::information(NULL, + tr("Average Spacing"), + tr("Average Spacing = %1 = %2 * point set radius") + .arg(average_spacing) + .arg(average_spacing/radius)); + } +} + +Q_EXPORT_PLUGIN2(Polyhedron_demo_point_set_average_spacing_plugin, Polyhedron_demo_point_set_average_spacing_plugin) + +#include "Polyhedron_demo_point_set_average_spacing_plugin.moc" diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_point_set_outliers_removal_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_point_set_outliers_removal_plugin.cpp new file mode 100644 index 00000000000..f7141971045 --- /dev/null +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_point_set_outliers_removal_plugin.cpp @@ -0,0 +1,117 @@ +#include "config.h" +#include "Scene_points_with_normal_item.h" +#include "Polyhedron_demo_plugin_helper.h" +#include "Polyhedron_demo_plugin_interface.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "ui_Polyhedron_demo_point_set_outliers_removal_plugin.h" + +class Polyhedron_demo_point_set_outliers_removal_plugin : + public QObject, + public Polyhedron_demo_plugin_helper +{ + Q_OBJECT + Q_INTERFACES(Polyhedron_demo_plugin_interface) + +private: + QAction* actionOutlierRemoval; + +public: + void init(QMainWindow* mainWindow, Scene_interface* scene_interface) { + actionOutlierRemoval = new QAction(tr("Point set outliers selection"), mainWindow); + actionOutlierRemoval->setObjectName("actionOutlierRemoval"); + + Polyhedron_demo_plugin_helper::init(mainWindow, scene_interface); + } + + //! Applicate for Point_sets with normals. + bool applicable() const { + return qobject_cast(scene->item(scene->mainSelectionIndex())); + } + + QList actions() const { + return QList() << actionOutlierRemoval; + } + +public slots: + void on_actionOutlierRemoval_triggered(); + +}; // end Polyhedron_demo_point_set_outliers_removal_plugin + +class Point_set_demo_outlier_removal_dialog : public QDialog, private Ui::OutlierRemovalDialog +{ + Q_OBJECT + public: + Point_set_demo_outlier_removal_dialog(QWidget * /*parent*/ = 0) + { + setupUi(this); + } + + double percentage() const { return m_inputPercentage->value(); } + int nbNeighbors() const { return m_inputNbNeighbors->value(); } +}; + +void Polyhedron_demo_point_set_outliers_removal_plugin::on_actionOutlierRemoval_triggered() +{ + const 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 + Point_set_demo_outlier_removal_dialog dialog; + if(!dialog.exec()) + return; + const double removed_percentage = dialog.percentage(); // percentage of points to remove + const int nb_neighbors = dialog.nbNeighbors(); + + QApplication::setOverrideCursor(Qt::WaitCursor); + + CGAL::Timer task_timer; task_timer.start(); + std::cerr << "Select outliers (" << removed_percentage <<"%)...\n"; + + // Computes outliers + Point_set::iterator first_point_to_remove = + CGAL::remove_outliers(points->begin(), points->end(), + nb_neighbors, + removed_percentage); + + int nb_points_to_remove = std::distance(first_point_to_remove, points->end()); + long memory = CGAL::Memory_sizer().virtual_size(); + std::cerr << "Simplification: " << nb_points_to_remove << " point(s) are selected (" + << task_timer.time() << " seconds, " + << (memory>>20) << " Mb allocated)" + << std::endl; + + // Selects points to delete + points->select(points->begin(), points->end(), false); + points->select(first_point_to_remove, points->end(), true); + + // Updates scene + scene->itemChanged(index); + + QApplication::restoreOverrideCursor(); + } +} + +Q_EXPORT_PLUGIN2(Polyhedron_demo_point_set_outliers_removal_plugin, Polyhedron_demo_point_set_outliers_removal_plugin) + +#include "Polyhedron_demo_point_set_outliers_removal_plugin.moc" diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_point_set_outliers_removal_plugin.ui b/Polyhedron/demo/Polyhedron/Polyhedron_demo_point_set_outliers_removal_plugin.ui new file mode 100644 index 00000000000..20721560a27 --- /dev/null +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_point_set_outliers_removal_plugin.ui @@ -0,0 +1,109 @@ + + OutlierRemovalDialog + + + + 0 + 0 + 331 + 120 + + + + Outlier Removal + + + + + + Removed percentage: + + + + + + + % + + + 0.010000000000000 + + + 100.000000000000000 + + + 0.100000000000000 + + + 5.000000000000000 + + + + + + + Neighbors + + + + + + + 6 + + + 9999 + + + 24 + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + OutlierRemovalDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + OutlierRemovalDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_point_set_simplification_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_point_set_simplification_plugin.cpp new file mode 100644 index 00000000000..d8a07c7bada --- /dev/null +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_point_set_simplification_plugin.cpp @@ -0,0 +1,143 @@ +#include "config.h" +#include "Scene_points_with_normal_item.h" +#include "Polyhedron_demo_plugin_helper.h" +#include "Polyhedron_demo_plugin_interface.h" + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "ui_Polyhedron_demo_point_set_simplification_plugin.h" + +class Polyhedron_demo_point_set_simplification_plugin : + public QObject, + public Polyhedron_demo_plugin_helper +{ + Q_OBJECT + Q_INTERFACES(Polyhedron_demo_plugin_interface) + QAction* actionSimplify; + +public: + void init(QMainWindow* mainWindow, Scene_interface* scene_interface) { + actionSimplify = new QAction(tr("Point set simplification selection"), mainWindow); + actionSimplify->setObjectName("actionSimplify"); + + Polyhedron_demo_plugin_helper::init(mainWindow, scene_interface); + } + + bool applicable() const { + return qobject_cast(scene->item(scene->mainSelectionIndex())); + } + + QList actions() const { + return QList() << actionSimplify; + } + +public slots: + void on_actionSimplify_triggered(); + +}; // end Polyhedron_demo_point_set_simplification_plugin + +class Point_set_demo_point_set_simplification_dialog : public QDialog, private Ui::PointSetSimplificationDialog +{ + Q_OBJECT + public: + Point_set_demo_point_set_simplification_dialog(QWidget * /*parent*/ = 0) + { + setupUi(this); + } + + QString simplificationMethod() const { return m_simplificationMethod->currentText(); } + float randomSimplificationPercentage() const { return m_randomSimplificationPercentage->value(); } + float gridCellSize() const { return m_gridCellSize->value(); } +}; + +void Polyhedron_demo_point_set_simplification_plugin::on_actionSimplify_triggered() +{ + const 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 + Point_set_demo_point_set_simplification_dialog dialog; + if(!dialog.exec()) + return; + + QApplication::setOverrideCursor(Qt::WaitCursor); + + CGAL::Timer task_timer; task_timer.start(); + + // First point to delete + Point_set::iterator first_point_to_remove = points->end(); + + if (dialog.simplificationMethod() == "Random") + { + std::cerr << "Random point cloud simplification (" << dialog.randomSimplificationPercentage() <<"%)...\n"; + + // Computes points to remove by random simplification + first_point_to_remove = + CGAL::random_simplify_point_set(points->begin(), points->end(), + dialog.randomSimplificationPercentage()); + } + else if (dialog.simplificationMethod() == "Grid Clustering") + { + std::cerr << "Point cloud simplification by clustering (cell size = " << dialog.gridCellSize() <<" * average spacing)...\n"; + + // Computes average spacing + double average_spacing = CGAL::compute_average_spacing( + points->begin(), points->end(), + 6 /* knn = 1 ring */); + + // Computes points to remove by Grid Clustering + first_point_to_remove = + CGAL::grid_simplify_point_set(points->begin(), points->end(), + dialog.gridCellSize()*average_spacing); + } + + int nb_points_to_remove = std::distance(first_point_to_remove, points->end()); + long memory = CGAL::Memory_sizer().virtual_size(); + std::cerr << "Simplification: " << nb_points_to_remove << " point(s) are selected for removal (" + << task_timer.time() << " seconds, " + << (memory>>20) << " Mb allocated)" + << std::endl; + + // Selects points to delete + points->select(points->begin(), points->end(), false); + points->select(first_point_to_remove, points->end(), true); + + // Updates scene + scene->itemChanged(index); + + QApplication::restoreOverrideCursor(); + + // Warns user + if (nb_points_to_remove > 0) + { + QMessageBox::information(NULL, + tr("Points selected from removal"), + tr("%1 point(s) are selected for removal.\nYou may remove them with the \"Delete selection\" menu item.") + .arg(nb_points_to_remove)); + } + } +} + +Q_EXPORT_PLUGIN2(Polyhedron_demo_point_set_simplification_plugin, Polyhedron_demo_point_set_simplification_plugin) + +#include "Polyhedron_demo_point_set_simplification_plugin.moc" diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_point_set_simplification_plugin.ui b/Polyhedron/demo/Polyhedron/Polyhedron_demo_point_set_simplification_plugin.ui new file mode 100644 index 00000000000..7c45142f0eb --- /dev/null +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_point_set_simplification_plugin.ui @@ -0,0 +1,142 @@ + + PointSetSimplificationDialog + + + + 0 + 0 + 403 + 153 + + + + Simplification + + + + + + Method: + + + + + + + + Random + + + + + Grid Clustering + + + + + + + + Points to Remove Randomly + + + + + + + % + + + 2 + + + 0.100000000000000 + + + 100.000000000000000 + + + 0.100000000000000 + + + 50.000000000000000 + + + + + + + Grid Cell Size + + + + + + + * average spacing + + + 2 + + + 0.100000000000000 + + + 10.000000000000000 + + + 0.100000000000000 + + + 1.000000000000000 + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + PointSetSimplificationDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + PointSetSimplificationDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_point_set_smoothing_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_point_set_smoothing_plugin.cpp new file mode 100644 index 00000000000..ace89f18bd8 --- /dev/null +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_point_set_smoothing_plugin.cpp @@ -0,0 +1,84 @@ +#include "config.h" +#include "Scene_points_with_normal_item.h" +#include "Polyhedron_demo_plugin_helper.h" +#include "Polyhedron_demo_plugin_interface.h" + +#include +#include +#include +#include +#include +#include + +#include + +class Polyhedron_demo_point_set_smoothing_plugin : + public QObject, + public Polyhedron_demo_plugin_helper +{ + Q_OBJECT + Q_INTERFACES(Polyhedron_demo_plugin_interface) + QAction* actionJetSmoothing; + +public: + void init(QMainWindow* mainWindow, Scene_interface* scene_interface) { + actionJetSmoothing = new QAction(tr("Point set jet smoothing"), mainWindow); + actionJetSmoothing->setObjectName("actionJetSmoothing"); + + Polyhedron_demo_plugin_helper::init(mainWindow, scene_interface); + } + + QList actions() const { + return QList() << actionJetSmoothing; + } + + bool applicable() const { + return qobject_cast(scene->item(scene->mainSelectionIndex())); + } + +public slots: + void on_actionJetSmoothing_triggered(); + +}; // end Polyhedron_demo_point_set_smoothing_plugin + +void Polyhedron_demo_point_set_smoothing_plugin::on_actionJetSmoothing_triggered() +{ + const Scene_interface::Item_id index = scene->mainSelectionIndex(); + + Scene_points_with_normal_item* item = + qobject_cast(scene->item(index)); + + if(item) + { + Point_set* points = item->point_set(); + if(!points) return; + + // Gets options + bool ok; + const unsigned int nb_neighbors = + QInputDialog::getInteger((QWidget*)mw, + tr("Jet Smoothing"), // dialog title + tr("Number of neighbors:"), // field label + 24, // default value = fast + 6, // min + 1000, // max + 1, // step + &ok); + if(!ok) return; + + QApplication::setOverrideCursor(Qt::WaitCursor); + + CGAL::jet_smooth_point_set(points->begin(), points->end(), nb_neighbors); + + points->invalidate_bounds(); + + // update scene + scene->itemChanged(index); + + QApplication::restoreOverrideCursor(); + } +} + +Q_EXPORT_PLUGIN2(Polyhedron_demo_point_set_smoothing_plugin, Polyhedron_demo_point_set_smoothing_plugin) + +#include "Polyhedron_demo_point_set_smoothing_plugin.moc" diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_poisson_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_poisson_plugin.cpp new file mode 100644 index 00000000000..66466a59d88 --- /dev/null +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_poisson_plugin.cpp @@ -0,0 +1,128 @@ +#include "config.h" +#include "Scene_points_with_normal_item.h" +#include "Polyhedron_demo_plugin_helper.h" +#include "Polyhedron_demo_plugin_interface.h" +#include "Scene_polyhedron_item.h" + +#include +#include +#include +#include +#include +#include + +#include "ui_Polyhedron_demo_poisson_plugin.h" + +// Poisson reconstruction method: +// Reconstructs a surface mesh from a point set and returns it as a polyhedron. +Polyhedron* poisson_reconstruct(const Point_set& points, + Kernel::FT sm_angle, // Min triangle angle (degrees). + Kernel::FT sm_radius, // Max triangle size w.r.t. point set average spacing. + Kernel::FT sm_distance, // Approximation error w.r.t. point set average spacing. + const QString& solver); // solver name + +class Polyhedron_demo_poisson_plugin : + public QObject, + public Polyhedron_demo_plugin_helper +{ + Q_OBJECT + Q_INTERFACES(Polyhedron_demo_plugin_interface) + QAction* actionPoissonReconstruction; + +public: + void init(QMainWindow* mainWindow, Scene_interface* scene_interface) { + + actionPoissonReconstruction = new QAction(tr("Poisson reconstruction"), mainWindow); + actionPoissonReconstruction->setObjectName("actionPoissonReconstruction"); + + Polyhedron_demo_plugin_helper::init(mainWindow, scene_interface); + } + + //! Applicate for Point_sets with normals. + bool applicable() const { + return qobject_cast(scene->item(scene->mainSelectionIndex())); + } + + QList actions() const { + return QList() << actionPoissonReconstruction; + } + +public slots: + void on_actionPoissonReconstruction_triggered(); +}; // end class Polyhedron_demo_poisson_plugin + + +class Polyhedron_demo_poisson_plugin_dialog : public QDialog, private Ui::PoissonDialog +{ + Q_OBJECT + public: + Polyhedron_demo_poisson_plugin_dialog(QWidget* /*parent*/ = 0) + { + setupUi(this); + + #ifdef CGAL_TAUCS_ENABLED + m_inputSolver->addItem("Taucs"); + #endif + + #ifdef CGAL_EIGEN3_ENABLED + m_inputSolver->addItem("Eigen - built-in simplicial LDLt"); + m_inputSolver->addItem("Eigen - built-in CG"); + #endif + } + + double triangleAngle() const { return m_inputAngle->value(); } + double triangleRadius() const { return m_inputRadius->value(); } + double triangleError() const { return m_inputDistance->value(); } + QString solver() const { return m_inputSolver->currentText(); } +}; + +void Polyhedron_demo_poisson_plugin::on_actionPoissonReconstruction_triggered() +{ + const Scene_interface::Item_id index = scene->mainSelectionIndex(); + + Scene_points_with_normal_item* point_set_item = + qobject_cast(scene->item(index)); + + if(point_set_item) + { + // Gets point set + Point_set* points = point_set_item->point_set(); + if(!points) return; + + // Gets options + Polyhedron_demo_poisson_plugin_dialog dialog; + if(!dialog.exec()) + return; + const double sm_angle = dialog.triangleAngle(); + const double sm_radius = dialog.triangleRadius(); + const double sm_distance = dialog.triangleError(); + const QString sm_solver = dialog.solver(); + + QApplication::setOverrideCursor(Qt::WaitCursor); + + // Reconstruct point set as a polyhedron + Polyhedron* pRemesh = poisson_reconstruct(*points, sm_angle, sm_radius, sm_distance, sm_solver); + if(pRemesh) + { + // Add polyhedron to scene + Scene_polyhedron_item* new_item = new Scene_polyhedron_item(pRemesh); + new_item->setName(tr("%1 Poisson (%2 %3 %4)") + .arg(point_set_item->name()) + .arg(sm_angle) + .arg(sm_radius) + .arg(sm_distance)); + new_item->setColor(Qt::lightGray); + scene->addItem(new_item); + + // Hide point set + point_set_item->setVisible(false); + scene->itemChanged(index); + } + + QApplication::restoreOverrideCursor(); + } +} + +Q_EXPORT_PLUGIN2(Polyhedron_demo_poisson_plugin, Polyhedron_demo_poisson_plugin) + +#include "Polyhedron_demo_poisson_plugin.moc" diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_poisson_plugin.ui b/Polyhedron/demo/Polyhedron/Polyhedron_demo_poisson_plugin.ui new file mode 100644 index 00000000000..3682ceb5131 --- /dev/null +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_poisson_plugin.ui @@ -0,0 +1,156 @@ + + + PoissonDialog + + + + 0 + 0 + 376 + 170 + + + + Poisson reconstruction + + + + + + Min triangle angle: + + + + + + + ° + + + 1.000000000000000 + + + 30.000000000000000 + + + 20.000000000000000 + + + + + + + Max triangle size: + + + + + + + * average spacing + + + 0 + + + 1.000000000000000 + + + 1000.000000000000000 + + + 1.000000000000000 + + + 100.000000000000000 + + + + + + + Approximation error: + + + + + + + * average spacing + + + 6 + + + 0.010000000000000 + + + 100.000000000000000 + + + 0.010000000000000 + + + 0.250000000000000 + + + + + + + Solver: + + + + + + + + + + + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + PoissonDialog + accept() + + + 177 + 123 + + + 53 + 125 + + + + + buttonBox + rejected() + PoissonDialog + reject() + + + 257 + 119 + + + 257 + 143 + + + + + diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_poisson_plugin_impl.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_poisson_plugin_impl.cpp new file mode 100644 index 00000000000..2fc4397c520 --- /dev/null +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_poisson_plugin_impl.cpp @@ -0,0 +1,236 @@ +//---------------------------------------------------------- +// Poisson reconstruction method: +// Reconstructs a surface mesh from a point set and returns it as a polyhedron. +//---------------------------------------------------------- + +#ifdef CGAL_EIGEN3_ENABLED +#include +#endif + +// CGAL +#include // must be included before kernel +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef CGAL_TAUCS_ENABLED +#include +#endif + +#include + +#include "Kernel_type.h" +#include "Polyhedron_type.h" +#include "Scene_points_with_normal_item.h" + + +// Poisson implicit function +typedef CGAL::Poisson_reconstruction_function Poisson_reconstruction_function; + +// Surface mesher +typedef CGAL::Surface_mesh_default_triangulation_3 STr; +typedef CGAL::Surface_mesh_complex_2_in_triangulation_3 C2t3; +typedef CGAL::Implicit_surface_3 Surface_3; + +// AABB tree +typedef CGAL::AABB_polyhedron_triangle_primitive Primitive; +typedef CGAL::AABB_traits AABB_traits; +typedef CGAL::AABB_tree AABB_tree; + + +// Poisson reconstruction method: +// Reconstructs a surface mesh from a point set and returns it as a polyhedron. +Polyhedron* poisson_reconstruct(const Point_set& points, + Kernel::FT sm_angle, // Min triangle angle (degrees). + Kernel::FT sm_radius, // Max triangle size w.r.t. point set average spacing. + Kernel::FT sm_distance, // Approximation error w.r.t. point set average spacing. + const QString& solver_name) // solver name +{ + CGAL::Timer task_timer; task_timer.start(); + + //*************************************** + // Checks requirements + //*************************************** + + int nb_points = points.size(); + if (nb_points == 0) + { + std::cerr << "Error: empty point set" << std::endl; + return NULL; + } + + bool points_have_normals = (points.begin()->normal() != CGAL::NULL_VECTOR); + if ( ! points_have_normals ) + { + std::cerr << "Input point set not supported: this reconstruction method requires oriented normals" << std::endl; + return NULL; + } + + CGAL::Timer reconstruction_timer; reconstruction_timer.start(); + + //*************************************** + // Computes implicit function + //*************************************** + + std::cerr << "Computes Poisson implicit function " + << "using " << solver_name.toAscii().data() << " solver...\n"; + + + // Creates implicit function from the point set. + // Note: this method requires an iterator over points + // + property maps to access each point's position and normal. + // The position property map can be omitted here as we use iterators over Point_3 elements. + Poisson_reconstruction_function function( + points.begin(), points.end(), + CGAL::make_normal_of_point_with_normal_pmap(points.begin())); + + bool ok = false; + #ifdef CGAL_TAUCS_ENABLED + if(solver_name=="Taucs") + { + // Creates sparse linear solver: + // TAUCS out-of-core Multifrontal Supernodal Cholesky Factorization + const char* OOC_SUPERNODAL_CHOLESKY_FACTORIZATION[] = + { + "taucs.factor.LLT=true", + "taucs.factor.mf=true", + "taucs.factor.ordering=metis", + "taucs.ooc=true", "taucs.ooc.basename=taucs-ooc", + NULL + }; + unlink("taucs-ooc.0"); // make sure TAUCS ooc file does not exist + CGAL::Taucs_symmetric_solver_traits solver(OOC_SUPERNODAL_CHOLESKY_FACTORIZATION); + + ok = function.compute_implicit_function(solver); + } + #endif + + #ifdef CGAL_EIGEN3_ENABLED + if(solver_name=="Eigen - built-in simplicial LDLt") + { + CGAL::Eigen_solver_traits::EigenType> > solver; + ok = function.compute_implicit_function(solver); + } + if(solver_name=="Eigen - built-in CG") + { + CGAL::Eigen_solver_traits::EigenType> > solver; + solver.solver().setTolerance(1e-6); + solver.solver().setMaxIterations(1000); + ok = function.compute_implicit_function(solver); + } + #endif + + // Computes the Poisson indicator function f() + // at each vertex of the triangulation. + if ( ! ok ) + { + std::cerr << "Error: cannot compute implicit function" << std::endl; + return NULL; + } + + // Prints status + std::cerr << "Total implicit function (triangulation+refinement+solver): " << task_timer.time() << " seconds\n"; + task_timer.reset(); + + //*************************************** + // Surface mesh generation + //*************************************** + + std::cerr << "Surface meshing...\n"; + + // Computes average spacing + Kernel::FT average_spacing = CGAL::compute_average_spacing(points.begin(), points.end(), + 6 /* knn = 1 ring */); + + // Gets one point inside the implicit surface + Kernel::Point_3 inner_point = function.get_inner_point(); + Kernel::FT inner_point_value = function(inner_point); + if(inner_point_value >= 0.0) + { + std::cerr << "Error: unable to seed (" << inner_point_value << " at inner_point)" << std::endl; + return NULL; + } + + // Gets implicit function's radius + Kernel::Sphere_3 bsphere = function.bounding_sphere(); + Kernel::FT radius = std::sqrt(bsphere.squared_radius()); + + // Defines the implicit surface: requires defining a + // conservative bounding sphere centered at inner point. + Kernel::FT sm_sphere_radius = 5.0 * radius; + Kernel::FT sm_dichotomy_error = sm_distance*average_spacing/1000.0; // Dichotomy error must be << sm_distance + Surface_3 surface(function, + Kernel::Sphere_3(inner_point,sm_sphere_radius*sm_sphere_radius), + sm_dichotomy_error/sm_sphere_radius); + + // Defines surface mesh generation criteria + CGAL::Surface_mesh_default_criteria_3 criteria(sm_angle, // Min triangle angle (degrees) + sm_radius*average_spacing, // Max triangle size + sm_distance*average_spacing); // Approximation error + + CGAL_TRACE_STREAM << " make_surface_mesh(sphere center=("<facets_begin(), output_mesh->facets_end()); + tree.accelerate_distance_queries(); + + // Computes distance from each input point to reconstructed mesh + double max_distance = DBL_MIN; + double avg_distance = 0; + for (Point_set::const_iterator p=points.begin(); p!=points.end(); p++) + { + double distance = std::sqrt(tree.squared_distance(*p)); + + max_distance = (std::max)(max_distance, distance); + avg_distance += distance; + } + avg_distance /= double(points.size()); + + std::cerr << "Reconstruction error:\n" + << " max = " << max_distance << " = " << max_distance/average_spacing << " * average spacing\n" + << " avg = " << avg_distance << " = " << avg_distance/average_spacing << " * average spacing\n"; + + return output_mesh; +} + diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_polylines_io_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_polylines_io_plugin.cpp index 4670a105972..7cbcfd479e4 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_polylines_io_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_polylines_io_plugin.cpp @@ -13,7 +13,8 @@ class Polyhedron_demo_polylines_io_plugin : Q_INTERFACES(Polyhedron_demo_io_plugin_interface) public: - QStringList nameFilters() const; + QString name() const { return "Polyhedron_demo_polylines_io_plugin"; } + QString nameFilters() const { return "Polylines files (*.cgal)"; } bool canLoad() const; Scene_item* load(QFileInfo fileinfo); @@ -21,10 +22,6 @@ public: bool save(const Scene_item*, QFileInfo fileinfo); }; -QStringList Polyhedron_demo_polylines_io_plugin::nameFilters() const { - return QStringList() << "Polylines files (*.polylines.txt *.cgal)"; -} - bool Polyhedron_demo_polylines_io_plugin::canLoad() const { return true; } diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_remeshing_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_remeshing_plugin.cpp index fe2a7cf40a8..88b1172f1bb 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_remeshing_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_remeshing_plugin.cpp @@ -39,6 +39,10 @@ public: } } + bool applicable() const { + return qobject_cast(scene->item(scene->mainSelectionIndex())); + } + QList actions() const { return QList() << actionRemeshing; } diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_self_intersection_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_self_intersection_plugin.cpp index 5df1f10acd2..35f38e089e5 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_self_intersection_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_self_intersection_plugin.cpp @@ -30,6 +30,10 @@ public: return QStringList() << "actionSelfIntersection"; } + bool applicable() const { + return qobject_cast(scene->item(scene->mainSelectionIndex())); + } + public slots: void on_actionSelfIntersection_triggered(); diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_subdivision_methods_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_subdivision_methods_plugin.cpp index 358bfd3c722..b5a3b4eac6c 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_subdivision_methods_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_subdivision_methods_plugin.cpp @@ -23,6 +23,9 @@ public: << "actionSqrt3"; } + bool applicable() const { + return qobject_cast(scene->item(scene->mainSelectionIndex())); + } public slots: void on_actionLoop_triggered(); void on_actionCatmullClark_triggered(); diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_triangulate_facets_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_triangulate_facets_plugin.cpp index ddf73011158..377d14113ca 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_triangulate_facets_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_triangulate_facets_plugin.cpp @@ -41,6 +41,11 @@ public: << actionUnTriangulateFacets; } + bool applicable() const { + return qobject_cast(scene->item(scene->mainSelectionIndex())); + } + + public slots: void untriangulate() { const Scene_interface::Item_id index = scene->mainSelectionIndex(); diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_trivial_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_trivial_plugin.cpp index c81ca089e55..03b4c6de85d 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_trivial_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_trivial_plugin.cpp @@ -99,8 +99,13 @@ class Polyhedron_demo_trivial_plugin : public: void init(QMainWindow* mainWindow, Scene_interface* scene_interface); - QList actions() const; + QList actions() const { + return QList() << actionBbox; + } + bool applicable() const { + return true; + } public slots: void bbox(); void enableAction(); @@ -119,10 +124,6 @@ void Polyhedron_demo_trivial_plugin::init(QMainWindow* mainWindow, Scene_interfa this, SLOT(bbox())); } -QList Polyhedron_demo_trivial_plugin::actions() const { - return QList() << actionBbox; -} - void Polyhedron_demo_trivial_plugin::bbox() { for(int i = 0, end = scene->numberOfEntries(); diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_xyz_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_xyz_plugin.cpp new file mode 100644 index 00000000000..447ef910190 --- /dev/null +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_xyz_plugin.cpp @@ -0,0 +1,80 @@ +#include "Scene_points_with_normal_item.h" +#include "Scene_polyhedron_item.h" +#include "Scene_polygon_soup_item.h" +#include "Polyhedron_type.h" +#include "Kernel_type.h" + +#include "Polyhedron_demo_io_plugin_interface.h" +#include + +class Polyhedron_demo_xyz_plugin : + public QObject, + public Polyhedron_demo_io_plugin_interface +{ + Q_OBJECT + Q_INTERFACES(Polyhedron_demo_io_plugin_interface) + +public: + QString name() const { return "Polyhedron_demo_xyz_plugin"; } + + QString nameFilters() const { return "XYZ as Point Set (*.xyz);;Point Set with Normal (*.pwn)"; } + bool canLoad() const; + Scene_item* load(QFileInfo fileinfo); + + bool canSave(const Scene_item*); + bool save(const Scene_item*, QFileInfo fileinfo); +}; + +bool Polyhedron_demo_xyz_plugin::canLoad() const { + return true; +} + + +Scene_item* +Polyhedron_demo_xyz_plugin::load(QFileInfo fileinfo) +{ + // Open file + std::ifstream in(fileinfo.filePath().toUtf8().data()); + if(!in) { + std::cerr << "Error! Cannot open file " << fileinfo.filePath().toStdString() << std::endl; + return NULL; + } + + // Read .xyz in a point set + Scene_points_with_normal_item* point_set_item = new Scene_points_with_normal_item; + point_set_item->setName(fileinfo.completeBaseName()); + if(!point_set_item->read_xyz_point_set(in)) { + delete point_set_item; + return NULL; + } + return point_set_item; +} + +bool Polyhedron_demo_xyz_plugin::canSave(const Scene_item* item) +{ + // This plugin supports point sets + return qobject_cast(item); +} + +bool Polyhedron_demo_xyz_plugin::save(const Scene_item* item, QFileInfo fileinfo) +{ + // Check extension (quietly) + std::string extension = fileinfo.suffix().toUtf8().data(); + if (extension != "xyz" && extension != "XYZ" && + extension != "pwn" && extension != "PWN") + return false; + + // This plugin supports point sets + const Scene_points_with_normal_item* point_set_item = + qobject_cast(item); + if(!point_set_item) + return false; + + // Save point set as .xyz + std::ofstream out(fileinfo.filePath().toUtf8().data()); + return point_set_item->write_xyz_point_set(out); +} + +#include +Q_EXPORT_PLUGIN2(Polyhedron_demo_xyz_plugin, Polyhedron_demo_xyz_plugin) +#include "Polyhedron_demo_xyz_plugin.moc" diff --git a/Polyhedron/demo/Polyhedron/Scene.cpp b/Polyhedron/demo/Polyhedron/Scene.cpp index 04d2d53b34a..7601bdc13f0 100644 --- a/Polyhedron/demo/Polyhedron/Scene.cpp +++ b/Polyhedron/demo/Polyhedron/Scene.cpp @@ -62,7 +62,7 @@ Scene::replaceItem(Scene::Item_id index, Scene_item* item) emit updated(); itemChanged(index); QAbstractListModel::reset(); - return item; + return item; } int @@ -250,6 +250,18 @@ Scene::draw_aux(bool with_names) item.draw_edges(); } + else{ + if( item.renderingMode() == PointsPlusNormals ){ + ::glDisable(GL_LIGHTING); + ::glPolygonMode(GL_FRONT_AND_BACK,GL_LINE); + ::glPointSize(2.f); + ::glLineWidth(1.0f); + if(index == selected_item) + CGALglcolor(item.color().lighter(120)); + else + CGALglcolor(item.color()); + } + } if(with_names) { ::glPopName(); } @@ -265,7 +277,7 @@ Scene::draw_aux(bool with_names) Scene_item& item = *m_entries[index]; if(item.visible()) { - if(item.renderingMode() == Points) + if(item.renderingMode() == Points || item.renderingMode() == PointsPlusNormals) { ::glDisable(GL_LIGHTING); ::glPolygonMode(GL_FRONT_AND_BACK,GL_POINT); diff --git a/Polyhedron/demo/Polyhedron/Scene.h b/Polyhedron/demo/Polyhedron/Scene.h index bde9b3233fa..a020143068f 100644 --- a/Polyhedron/demo/Polyhedron/Scene.h +++ b/Polyhedron/demo/Polyhedron/Scene.h @@ -58,6 +58,16 @@ public: int numberOfEntries() const; const QList& entries() const { return m_entries; } Q_INVOKABLE Scene_item* item(int) const ; + + //! \todo Replace Index based selection functionality with those + //! functions. + ///@{ + Scene_item* selectedItem() const; + QList selectedItems() const; + QList selectionA() const; + QList selectionB() const; + ///@} + int mainSelectionIndex() const; QList selectionIndices() const; int selectionAindex() const; diff --git a/Polyhedron/demo/Polyhedron/Scene_c2t3_item.h b/Polyhedron/demo/Polyhedron/Scene_c2t3_item.h index 44f98d18de9..a90910de482 100644 --- a/Polyhedron/demo/Polyhedron/Scene_c2t3_item.h +++ b/Polyhedron/demo/Polyhedron/Scene_c2t3_item.h @@ -74,7 +74,7 @@ public: // Indicate if rendering mode is supported bool supportsRenderingMode(RenderingMode m) const { - return (m != Gouraud); // CHECK THIS! + return (m != Gouraud && m!=PointsPlusNormals); // CHECK THIS! } void draw() const { diff --git a/Polyhedron/demo/Polyhedron/Scene_combinatorial_map_item.h b/Polyhedron/demo/Polyhedron/Scene_combinatorial_map_item.h index 144b8adec3b..0df85992499 100644 --- a/Polyhedron/demo/Polyhedron/Scene_combinatorial_map_item.h +++ b/Polyhedron/demo/Polyhedron/Scene_combinatorial_map_item.h @@ -38,7 +38,7 @@ public: QString toolTip() const; // Indicate if rendering mode is supported - virtual bool supportsRenderingMode(RenderingMode m) const { return m != Gouraud; } // CHECK THIS! + virtual bool supportsRenderingMode(RenderingMode m) const { return (m != Gouraud && m!=PointsPlusNormals); } // CHECK THIS! //Event handling virtual bool keyPressEvent(QKeyEvent*); // OpenGL drawing in a display list diff --git a/Polyhedron/demo/Polyhedron/Scene_edit_polyhedron_item.h b/Polyhedron/demo/Polyhedron/Scene_edit_polyhedron_item.h index 7fd0c489b4d..c8cb676e0fd 100644 --- a/Polyhedron/demo/Polyhedron/Scene_edit_polyhedron_item.h +++ b/Polyhedron/demo/Polyhedron/Scene_edit_polyhedron_item.h @@ -50,7 +50,7 @@ public: // QMenu* contextMenu(); // Indicate if rendering mode is supported - bool supportsRenderingMode(RenderingMode) const { return true; } + bool supportsRenderingMode(RenderingMode m) const { return (m!=PointsPlusNormals); } // Points/Wireframe/Flat/Gouraud OpenGL drawing in a display list void draw() const; diff --git a/Polyhedron/demo/Polyhedron/Scene_interface.h b/Polyhedron/demo/Polyhedron/Scene_interface.h index 52e8be1bb50..5ff5755d174 100644 --- a/Polyhedron/demo/Polyhedron/Scene_interface.h +++ b/Polyhedron/demo/Polyhedron/Scene_interface.h @@ -9,7 +9,8 @@ class Scene_item; // OpenGL rendering mode -enum RenderingMode { Points = 0, +enum RenderingMode { Points = 0, + PointsPlusNormals, Wireframe, Flat, FlatPlusEdges, diff --git a/Polyhedron/demo/Polyhedron/Scene_item.cpp b/Polyhedron/demo/Polyhedron/Scene_item.cpp index 7a4aedde781..d051c821a52 100644 --- a/Polyhedron/demo/Polyhedron/Scene_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_item.cpp @@ -27,6 +27,8 @@ QString modeName(RenderingMode mode) { return QObject::tr("flat+edges"); case Gouraud: return QObject::tr("Gouraud"); + case PointsPlusNormals: + return QObject::tr("pts+normals"); default: Q_ASSERT(false); return QObject::tr("unknown"); @@ -46,6 +48,8 @@ const char* slotName(RenderingMode mode) { return SLOT(setFlatPlusEdgesMode()); case Gouraud: return SLOT(setGouraudMode()); + case PointsPlusNormals: + return SLOT(setPointsPlusNormalsMode()); default: Q_ASSERT(false); return ""; diff --git a/Polyhedron/demo/Polyhedron/Scene_item.h b/Polyhedron/demo/Polyhedron/Scene_item.h index e675e91e394..fb83232a42f 100644 --- a/Polyhedron/demo/Polyhedron/Scene_item.h +++ b/Polyhedron/demo/Polyhedron/Scene_item.h @@ -114,6 +114,10 @@ public slots: setRenderingMode(Gouraud); } + void setPointsPlusNormalsMode(){ + setRenderingMode(PointsPlusNormals); + } + virtual void itemAboutToBeDestroyed(Scene_item*); virtual void select(double orig_x, diff --git a/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.cpp b/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.cpp new file mode 100644 index 00000000000..f2f791c022a --- /dev/null +++ b/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.cpp @@ -0,0 +1,254 @@ +#include "Scene_points_with_normal_item.h" +#include "Polyhedron_type.h" +#include "CGAL/compute_normal.h" + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include +#include +#include + + +Scene_points_with_normal_item::Scene_points_with_normal_item() + : Scene_item_with_display_list(), + m_points(new Point_set) +{ + setRenderingMode(PointsPlusNormals); +} + +// Copy constructor +Scene_points_with_normal_item::Scene_points_with_normal_item(const Scene_points_with_normal_item& toCopy) + : Scene_item_with_display_list(), // do not call superclass' copy constructor + m_points(new Point_set(*toCopy.m_points)) +{ + setRenderingMode(PointsPlusNormals); +} + +// Converts polyhedron to point set +Scene_points_with_normal_item::Scene_points_with_normal_item(const Polyhedron& input_mesh) + : Scene_item_with_display_list(), + m_points(new Point_set) +{ + // Converts Polyhedron vertices to point set. + // Computes vertices normal from connectivity. + Polyhedron::Vertex_const_iterator v; + for (v = input_mesh.vertices_begin(); v != input_mesh.vertices_end(); v++) + { + const Kernel::Point_3& p = v->point(); + Kernel::Vector_3 n = compute_vertex_normal(*v); + m_points->push_back(UI_point(p,n)); + } + + setRenderingMode(PointsPlusNormals); +} + +Scene_points_with_normal_item::~Scene_points_with_normal_item() +{ + Q_ASSERT(m_points != NULL); + delete m_points; m_points = NULL; +} + +// Duplicates scene item +Scene_points_with_normal_item* +Scene_points_with_normal_item::clone() const +{ + return new Scene_points_with_normal_item(*this); +} + +// Is selection empty? +bool Scene_points_with_normal_item::isSelectionEmpty() const +{ + return (m_points->nb_selected_points() == 0); +} + +// Delete selection +void Scene_points_with_normal_item::deleteSelection() +{ + CGAL::Timer task_timer; task_timer.start(); + std::cerr << "Delete " << m_points->nb_selected_points() << " points..."; + + // Delete selected points + m_points->delete_selection(); + + long memory = CGAL::Memory_sizer().virtual_size(); + std::cerr << "done: " << task_timer.time() << " seconds, " + << (memory>>20) << " Mb allocated" + << std::endl; +} + +// Reset selection mark +void Scene_points_with_normal_item::resetSelection() +{ + // Un-select all points + m_points->select(m_points->begin(), m_points->end(), false); +} + +// Loads point set from .OFF file +bool Scene_points_with_normal_item::read_off_point_set(std::istream& stream) +{ + Q_ASSERT(m_points != NULL); + + m_points->clear(); + bool ok = stream && + CGAL::read_off_points_and_normals(stream, + std::back_inserter(*m_points), + CGAL::make_normal_of_point_with_normal_pmap(std::back_inserter(*m_points))) && + !isEmpty(); + + return ok; +} + +// Write point set to .OFF file +bool Scene_points_with_normal_item::write_off_point_set(std::ostream& stream) const +{ + Q_ASSERT(m_points != NULL); + + return stream && + CGAL::write_off_points_and_normals(stream, + m_points->begin(), m_points->end(), + CGAL::make_normal_of_point_with_normal_pmap(m_points->begin())); +} + +// Loads point set from .XYZ file +bool Scene_points_with_normal_item::read_xyz_point_set(std::istream& stream) +{ + Q_ASSERT(m_points != NULL); + + m_points->clear(); + bool ok = stream && + CGAL::read_xyz_points_and_normals(stream, + std::back_inserter(*m_points), + CGAL::make_normal_of_point_with_normal_pmap(std::back_inserter(*m_points))) && + !isEmpty(); + + return ok; +} + +// Write point set to .XYZ file +bool Scene_points_with_normal_item::write_xyz_point_set(std::ostream& stream) const +{ + Q_ASSERT(m_points != NULL); + + return stream && + CGAL::write_xyz_points_and_normals(stream, + m_points->begin(), m_points->end(), + CGAL::make_normal_of_point_with_normal_pmap(m_points->begin())); +} + +QString +Scene_points_with_normal_item::toolTip() const +{ + Q_ASSERT(m_points != NULL); + + return QObject::tr("

%1 (color: %4)
" + "Point set

" + "

Number of points: %2

") + .arg(name()) + .arg(m_points->size()) + .arg(color().name()); +} + +bool Scene_points_with_normal_item::supportsRenderingMode(RenderingMode m) const +{ + return m==Points || m==PointsPlusNormals; +} + +// Points OpenGL drawing in a display list +void Scene_points_with_normal_item::direct_draw() const +{ + Q_ASSERT(m_points != NULL); + + // Draw points + m_points->gl_draw_vertices(); +} + +// Normals OpenGL drawing +void Scene_points_with_normal_item::draw_normals() const +{ + Q_ASSERT(m_points != NULL); + + // Draw normals + bool points_have_normals = (m_points->begin() != m_points->end() && + m_points->begin()->normal() != CGAL::NULL_VECTOR); + if(points_have_normals) + { + Kernel::Sphere_3 region_of_interest = m_points->region_of_interest(); + float normal_length = (float)std::sqrt(region_of_interest.squared_radius() / 1000.); + + m_points->gl_draw_normals(normal_length); + } +} + +// Gets wrapped point set +Point_set* Scene_points_with_normal_item::point_set() +{ + Q_ASSERT(m_points != NULL); + return m_points; +} +const Point_set* Scene_points_with_normal_item::point_set() const +{ + Q_ASSERT(m_points != NULL); + return m_points; +} + +bool +Scene_points_with_normal_item::isEmpty() const +{ + Q_ASSERT(m_points != NULL); + return m_points->empty(); +} + +Scene_points_with_normal_item::Bbox +Scene_points_with_normal_item::bbox() const +{ + Q_ASSERT(m_points != NULL); + + Kernel::Iso_cuboid_3 bbox = m_points->bounding_box(); + return Bbox(bbox.xmin(),bbox.ymin(),bbox.zmin(), + bbox.xmax(),bbox.ymax(),bbox.zmax()); +} + +void Scene_points_with_normal_item::computes_local_spacing(int k) +{ + typedef Kernel Geom_traits; + typedef Geom_traits::FT FT; + typedef CGAL::Search_traits_3 TreeTraits; + typedef CGAL::Orthogonal_k_neighbor_search Neighbor_search; + typedef Neighbor_search::Tree Tree; + + Point_set::iterator end(m_points->end()); + + // build kdtree + Tree tree(m_points->begin(), end); + + // Compute the radius of each point = (distance max to k nearest neighbors)/2. + { + int i=0; + for (Point_set::iterator it=m_points->begin(); it!=end; ++it, ++i) + { + Neighbor_search search(tree, *it, k+1); + double maxdist2 = (--search.end())->second; // squared distance to furthest neighbor + it->radius() = sqrt(maxdist2)/2.; + } + } + + m_points->set_radii_uptodate(true); +} + +void Scene_points_with_normal_item::setRenderingMode(RenderingMode m) +{ + Scene_item_with_display_list::setRenderingMode(m); +} + +#include "Scene_points_with_normal_item.moc" diff --git a/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.h b/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.h new file mode 100644 index 00000000000..1e6239aca88 --- /dev/null +++ b/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.h @@ -0,0 +1,76 @@ +#ifndef POINT_SET_ITEM_H +#define POINT_SET_ITEM_H + +#include "Scene_points_with_normal_item_config.h" +#include "Polyhedron_type_fwd.h" +#include "Kernel_type.h" +#include "Point_set_3.h" +#include "Scene_item_with_display_list.h" + +#include + + +// point set +typedef Point_set_3 Point_set; +typedef Point_set::UI_point UI_point; // type of points in Point_set_3 + + +// This class represents a point set in the OpenGL scene +class SCENE_POINTS_WITH_NORMAL_ITEM_EXPORT Scene_points_with_normal_item + : public Scene_item_with_display_list +{ + Q_OBJECT + +public: + Scene_points_with_normal_item(); + Scene_points_with_normal_item(const Scene_points_with_normal_item& toCopy); + Scene_points_with_normal_item(const Polyhedron& p); + ~Scene_points_with_normal_item(); + Scene_points_with_normal_item* clone() const; + + // Is selection empty? + virtual bool isSelectionEmpty() const; + // Delete selection + virtual void deleteSelection(); + // Reset selection mark + void resetSelection(); + + // IO + bool read_off_point_set(std::istream& in); + bool write_off_point_set(std::ostream& out) const; + bool read_xyz_point_set(std::istream& in); + bool write_xyz_point_set(std::ostream& out) const; + + // Function for displaying meta-data of the item + virtual QString toolTip() const; + + // Indicate if rendering mode is supported + virtual bool supportsRenderingMode(RenderingMode m) const; + // Points OpenGL drawing in a display list + virtual void direct_draw() const; + // Normals OpenGL drawing + void draw_normals() const; + virtual void draw_edges() const { draw_normals(); }//to tweak scene + + // Gets wrapped point set + Point_set* point_set(); + const Point_set* point_set() const; + + // Gets dimensions + virtual bool isFinite() const { return true; } + virtual bool isEmpty() const; + virtual Bbox bbox() const; + + virtual void setRenderingMode(RenderingMode m); + + // computes the local point spacing (aka radius) of each point + void computes_local_spacing(int k); + +// Data +private: + Point_set* m_points; + +}; // end class Scene_points_with_normal_item + + +#endif // POINT_SET_ITEM_H diff --git a/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item_config.h b/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item_config.h new file mode 100644 index 00000000000..139569dea86 --- /dev/null +++ b/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item_config.h @@ -0,0 +1,10 @@ +#ifndef SCENE_POINTS_WITH_NORMAL_ITEM_CONFIG_H +#define SCENE_POINTS_WITH_NORMAL_ITEM_CONFIG_H + +#ifdef scene_points_with_normal_item_EXPORTS +# define SCENE_POINTS_WITH_NORMAL_ITEM_EXPORT Q_DECL_EXPORT +#else +# define SCENE_POINTS_WITH_NORMAL_ITEM_EXPORT Q_DECL_IMPORT +#endif + +#endif // SCENE_POINTS_WITH_NORMAL_ITEM_CONFIG_H diff --git a/Polyhedron/demo/Polyhedron/Scene_polygon_soup_item.h b/Polyhedron/demo/Polyhedron/Scene_polygon_soup_item.h index 6f2d9290f6f..920fba0ce37 100644 --- a/Polyhedron/demo/Polyhedron/Scene_polygon_soup_item.h +++ b/Polyhedron/demo/Polyhedron/Scene_polygon_soup_item.h @@ -26,7 +26,7 @@ public: QString toolTip() const; // Indicate if rendering mode is supported - virtual bool supportsRenderingMode(RenderingMode m) const { return m != Gouraud; } // CHECK THIS! + virtual bool supportsRenderingMode(RenderingMode m) const { return (m!=Gouraud && m!=PointsPlusNormals); } // CHECK THIS! // OpenGL drawing in a display list void direct_draw() const; void draw_points() const; diff --git a/Polyhedron/demo/Polyhedron/Scene_polyhedron_item.h b/Polyhedron/demo/Polyhedron/Scene_polyhedron_item.h index 722c38b3ca1..6cd614519ab 100644 --- a/Polyhedron/demo/Polyhedron/Scene_polyhedron_item.h +++ b/Polyhedron/demo/Polyhedron/Scene_polyhedron_item.h @@ -37,7 +37,7 @@ public: QMenu* contextMenu(); // Indicate if rendering mode is supported - virtual bool supportsRenderingMode(RenderingMode) const { return true; } + virtual bool supportsRenderingMode(RenderingMode m) const { return (m!=PointsPlusNormals); } // Points/Wireframe/Flat/Gouraud OpenGL drawing in a display list virtual void direct_draw() const; virtual void direct_draw_edges() const; diff --git a/Polyhedron/demo/Polyhedron/TODO b/Polyhedron/demo/Polyhedron/TODO deleted file mode 100644 index 2d7798c396f..00000000000 --- a/Polyhedron/demo/Polyhedron/TODO +++ /dev/null @@ -1,4 +0,0 @@ -- The following file has not yet been ported to the plugin stuff: - MainWindow_curvature_estimation.cpp -- The cut plugin has memory leaks. And the AABB tree item should be updated - when the corresponding items are changed(). diff --git a/Polyhedron/demo/Polyhedron/TODO.txt b/Polyhedron/demo/Polyhedron/TODO.txt index d6c6ca14682..b136b31a00a 100644 --- a/Polyhedron/demo/Polyhedron/TODO.txt +++ b/Polyhedron/demo/Polyhedron/TODO.txt @@ -1,3 +1,48 @@ - merge all -> merge all polyhedra into one (with several connected components) - use the signal QMenu::aboutToShow() to enable/disable some menu entries. - check that display list is deleted when destroys one entry +- The following file has not yet been ported to the plugin stuff: + MainWindow_curvature_estimation.cpp +- The cut plugin has memory leaks. And the AABB tree item should be updated + when the corresponding items are changed(). + +Clean up loading: +- DONE plugin aware +- DONE recently used history + +Error handling: +- DONE currently error handling is strewn all about, + using exceptions to report error would make that a little less complicated + +Naming: +- naming of most classes is awkward and painfully verbose, especially + prefixes suffixes + +Rendering: +- rendering modes are somewhat backwards +- move rendering modes and rendering into the items + +MainWindow: +- "selected" etc. needs some clean-up + +Color bug: +- multiple items mess up coloring + +Usability: +- DONE build context menus interactively +- make selection mechanisms more interactive + +Plugin registration: +- remove from MainWindow.ui the registration of optional plugin, i.e. addaction (otherwise it's not an optional plugin) +- each plugin should store a pointer per action +- remove the action map from plugin helper +- change bool applicable() to void applicable(QList& visible,QList& invisible) to enable action of plugin one by one (only for nef for now) +- clean up + +Check what can be pulled in from experimental Mesh_3-protecting branch + +related to the MERGE with Point_set_demo: + - clean up Point_set_3.h and UI_point_3.h + - we should probably have a points_item + - Points and normal should be seperated items (pb with select and remove) + \ No newline at end of file diff --git a/Polyhedron/demo/Polyhedron/cgal_test_with_cmake b/Polyhedron/demo/Polyhedron/cgal_test_with_cmake index 54e8bf35e90..66038a63f0f 100755 --- a/Polyhedron/demo/Polyhedron/cgal_test_with_cmake +++ b/Polyhedron/demo/Polyhedron/cgal_test_with_cmake @@ -106,10 +106,12 @@ else scene_edit_polyhedron_item \ scene_nef_polyhedron_item \ scene_combinatorial_map_item \ + scene_plane_item \ scene_polyline_item \ scene_polygon_soup_item \ scene_polyhedron_item \ scene_textured_polyhedron_item \ + scene_points_with_normal_item\ convex_hull_plugin \ corefinement_plugin \ cut_plugin \ @@ -121,8 +123,10 @@ else mesh_simplification_plugin \ nef_plugin \ off_plugin \ + xyz_plugin \ polylines_io_plugin \ off_to_nef_plugin \ + off_to_xyz_plugin \ orient_soup_plugin \ parameterization_plugin \ pca_plugin \ @@ -130,6 +134,11 @@ else self_intersection_plugin \ subdivision_methods_plugin \ triangulate_facets_plugin \ + point_set_average_spacing_plugin \ + point_set_outliers_removal_plugin \ + point_set_simplification_plugin \ + point_set_smoothing_plugin \ + poisson_plugin \ trivial_plugin do if ${MAKE_CMD} -f Makefile help | grep "$target" > /dev/null; then diff --git a/Polyhedron/demo/Polyhedron/include/Point_set_3.h b/Polyhedron/demo/Polyhedron/include/Point_set_3.h new file mode 100644 index 00000000000..69f369cb58f --- /dev/null +++ b/Polyhedron/demo/Polyhedron/include/Point_set_3.h @@ -0,0 +1,358 @@ +// Author: Laurent Saboret, Nader Salman, Gael Guennebaud + +#ifndef POINT_SET_3_H +#define POINT_SET_3_H + +#include +#include +#include + +#include + +#include +#include + +#ifdef CGAL_GLEW_ENABLED +# include +#else +# include +#endif + + +/// The Point_set_3 class is array of points + normals of type +/// Point_with_normal_3 (in fact +/// UI_point_3 to support a selection flag and an optional radius). +/// It provides: +/// - accessors: points and normals iterators, property maps +/// - OpenGL rendering +/// - bounding box +/// +/// CAUTION: +/// - User is responsible to call invalidate_bounds() after adding, moving or removing points. +/// +/// @heading Parameters: +/// @param Gt Geometric traits class. + +template +class Point_set_3 : public std::deque > +{ +// Private types +private: + + // Base class + typedef std::deque > Base; + +// Public types +public: + + // Repeat base class' types + /// @cond SKIP_IN_MANUAL + typedef typename Base::iterator iterator; + typedef typename Base::const_iterator const_iterator; + + using Base::erase; + + /// @endcond + + // Classic CGAL geometric types + typedef Gt Geom_traits; ///< Geometric traits class. + typedef typename Geom_traits::FT FT; + typedef typename Geom_traits::Point_3 Point; ///< typedef to Geom_traits::Point_3 + typedef typename Geom_traits::Vector_3 Vector; ///< typedef to Geom_traits::Vector_3 + typedef typename Geom_traits::Iso_cuboid_3 Iso_cuboid; + typedef typename Geom_traits::Sphere_3 Sphere; + + /// Type of points in Point_set_3 + typedef UI_point_3 UI_point; ///< Position + normal + selection flag + // Its superclass: + typedef typename UI_point::Point_with_normal Point_with_normal; ///< Position + normal + + // Iterator over Point_3 points + typedef typename std::deque::iterator Point_iterator; + typedef typename std::deque::const_iterator Point_const_iterator; + +// Data members +private: + + // Indicate if m_barycenter, m_bounding_box, m_bounding_sphere and + // m_diameter_standard_deviation below are valid. + mutable bool m_bounding_box_is_valid; + + mutable Iso_cuboid m_bounding_box; // point set's bounding box + mutable Sphere m_bounding_sphere; // point set's bounding sphere + mutable Point m_barycenter; // point set's barycenter + mutable FT m_diameter_standard_deviation; // point set's standard deviation + + unsigned int m_nb_selected_points; // number of selected points + + bool m_radii_are_uptodate; + +// Public methods +public: + + /// Default constructor. + Point_set_3() + { + m_nb_selected_points = 0; + m_bounding_box_is_valid = false; + m_radii_are_uptodate = false; + } + + // Default copy constructor and operator =() are fine. + + // Repeat base class' public methods used below + /// @cond SKIP_IN_MANUAL + using Base::begin; + using Base::end; + using Base::size; + /// @endcond + + /// Gets the number of selected points. + unsigned int nb_selected_points() const { return m_nb_selected_points; } + + /// Mark a point as selected/not selected. + void select(UI_point* point, bool is_selected = true) + { + if (point->is_selected() != is_selected) + { + point->select(is_selected); + m_nb_selected_points += (is_selected ? 1 : -1); + } + } + + /// Mark a range of points as selected/not selected. + /// + /// @param first Iterator over first point to select/unselect. + /// @param beyond Past-the-end iterator. + void select(iterator first, iterator beyond, + bool is_selected = true) + { + for (iterator it = first; it != beyond; it++) + it->select(is_selected); + + m_nb_selected_points = std::count_if(begin(), end(), + std::mem_fun_ref(&UI_point::is_selected)); + } + + /// Deletes selected points. + void delete_selection() + { + // Deletes selected points using erase-remove idiom + erase(std::remove_if(begin(), end(), std::mem_fun_ref(&UI_point::is_selected)), + end()); + + // after erase(), use Scott Meyer's "swap trick" to trim excess capacity + Point_set_3(*this).swap(*this); + + m_nb_selected_points = 0; + invalidate_bounds(); + } + + /// Gets the bounding box. + Iso_cuboid bounding_box() const + { + if (!m_bounding_box_is_valid) + update_bounds(); + + return m_bounding_box; + } + + /// Gets bounding sphere. + Sphere bounding_sphere() const + { + if (!m_bounding_box_is_valid) + update_bounds(); + + return m_bounding_sphere; + } + + /// Gets points barycenter. + Point barycenter() const + { + if (!m_bounding_box_is_valid) + update_bounds(); + + return m_barycenter; + } + + /// Gets the standard deviation of the distance to barycenter. + FT diameter_standard_deviation() const + { + if (!m_bounding_box_is_valid) + update_bounds(); + + return m_diameter_standard_deviation; + } + + // Gets the region of interest, ignoring the outliers. + // This method is used to define the OpenGL arcball sphere. + Sphere region_of_interest() const + { + if (!m_bounding_box_is_valid) + update_bounds(); + + // A good candidate is a sphere containing the dense region of the point cloud: + // - center point is barycenter + // - Radius is 2 * standard deviation + float radius = 2.f * (float)m_diameter_standard_deviation; + return Sphere(m_barycenter, radius*radius); + } + + /// Update barycenter, bounding box, bounding sphere and standard deviation. + /// User is responsible to call invalidate_bounds() after adding, moving or removing points. + void invalidate_bounds() + { + m_bounding_box_is_valid = false; + } + + // Draw points using OpenGL calls. + // Preconditions: OpenGL point size and color must be set. + void gl_draw_vertices() const + { + // Draw *non-selected* points + if (m_nb_selected_points < size()) + { + ::glBegin(GL_POINTS); + for (const_iterator it = begin(); it != end(); it++) + { + const UI_point& p = *it; + if ( ! p.is_selected() ) + ::glVertex3dv(&p.x()); + } + ::glEnd(); + } + + // Draw *selected* points + if (m_nb_selected_points > 0) + { + ::glPointSize(4.f); // selected => bigger + ::glColor3ub(255,0,0); // selected => red + ::glBegin(GL_POINTS); + for (const_iterator it = begin(); it != end(); it++) + { + const UI_point& p = *it; + if (p.is_selected()) + ::glVertex3dv(&p.x()); + } + ::glEnd(); + } + } + + // Draw normals using OpenGL calls. + // Preconditions: OpenGL line width and color must be set. + void gl_draw_normals(float scale = 1.0) const // scale applied to normal length + { + // Draw normals of *non-selected* points + if (m_nb_selected_points < size()) + { + // Draw normals + ::glBegin(GL_LINES); + for (const_iterator it = begin(); it != end(); it++) + { + const UI_point& p = *it; + const Vector& n = p.normal(); + if (!p.is_selected()) + { + Point q = p + scale * n; + ::glVertex3d(p.x(),p.y(),p.z()); + ::glVertex3d(q.x(),q.y(),q.z()); + } + } + ::glEnd(); + } + + // Draw normals of *selected* points + if (m_nb_selected_points > 0) + { + ::glColor3ub(255,0,0); // selected => red + ::glBegin(GL_LINES); + for (const_iterator it = begin(); it != end(); it++) + { + const UI_point& p = *it; + const Vector& n = p.normal(); + if (p.is_selected()) + { + Point q = p + scale * n; + ::glVertex3d(p.x(),p.y(),p.z()); + ::glVertex3d(q.x(),q.y(),q.z()); + } + } + ::glEnd(); + } + } + + bool are_radii_uptodate() const { return m_radii_are_uptodate; } + void set_radii_uptodate(bool /*on*/) { m_radii_are_uptodate = false; } + +// Private methods: +private: + + /// Recompute barycenter, bounding box, bounding sphere and standard deviation. + void update_bounds() const + { + if (begin() == end()) + return; + + // Update bounding box and barycenter. + // TODO: we should use the functions in PCA component instead. + FT xmin,xmax,ymin,ymax,zmin,zmax; + xmin = ymin = zmin = 1e38; + xmax = ymax = zmax = -1e38; + Vector v = CGAL::NULL_VECTOR; + FT norm = 0; + for (Point_const_iterator it = begin(); it != end(); it++) + { + const Point& p = *it; + + // update bbox + xmin = (std::min)(p.x(),xmin); + ymin = (std::min)(p.y(),ymin); + zmin = (std::min)(p.z(),zmin); + xmax = (std::max)(p.x(),xmax); + ymax = (std::max)(p.y(),ymax); + zmax = (std::max)(p.z(),zmax); + + // update barycenter + v = v + (p - CGAL::ORIGIN); + norm += 1; + } + // + Point p(xmin,ymin,zmin); + Point q(xmax,ymax,zmax); + m_bounding_box = Iso_cuboid(p,q); + // + m_barycenter = CGAL::ORIGIN + v / norm; + + // Computes bounding sphere + typedef CGAL::Min_sphere_of_spheres_d_traits_3 Traits; + typedef CGAL::Min_sphere_of_spheres_d Min_sphere; + typedef typename Traits::Sphere Traits_sphere; + // + // Represents points by a set of spheres with 0 radius + std::vector spheres; + for (Point_const_iterator it = begin(); it != end(); it++) + spheres.push_back(Traits_sphere(*it,0)); + // + // Computes min sphere + Min_sphere ms(spheres.begin(),spheres.end()); + typename Min_sphere::Cartesian_const_iterator coord = ms.center_cartesian_begin(); + FT cx = *coord++; + FT cy = *coord++; + FT cz = *coord++; + m_bounding_sphere = Sphere(Point(cx,cy,cz), ms.radius()*ms.radius()); + + // Computes standard deviation of the distance to barycenter + typename Geom_traits::Compute_squared_distance_3 sqd; + FT sq_radius = 0; + for (Point_const_iterator it = begin(); it != end(); it++) + sq_radius += sqd(*it, m_barycenter); + sq_radius /= size(); + m_diameter_standard_deviation = CGAL::sqrt(sq_radius); + + m_bounding_box_is_valid = true; + } + +}; // end of class Point_set_3 + + +#endif // POINT_SET_3_H diff --git a/Polyhedron/demo/Polyhedron/include/UI_point_3.h b/Polyhedron/demo/Polyhedron/include/UI_point_3.h new file mode 100644 index 00000000000..2c2407e6b23 --- /dev/null +++ b/Polyhedron/demo/Polyhedron/include/UI_point_3.h @@ -0,0 +1,132 @@ +// Author: Laurent Saboret + +#ifndef UI_POINT_3_H +#define UI_POINT_3_H + +#include +#include + +#include +#include + + +/// The UI_point_3 class represents a 3D point in Surface_reconstruction_points_3 demo. +/// It contains: +/// - a position, +/// - a normal, +/// - a radius, +/// - a selection flag. +/// +/// @heading Parameters: +/// @param Gt Geometric traits class. + +template +class UI_point_3 + : public CGAL::Point_with_normal_3 +{ +// Private types +private: + + // Base class + typedef CGAL::Point_with_normal_3 Base; + +// Public types +public: + + /// Base class + typedef Base Point_with_normal; + + // Repeat base class public types + typedef Gt Geom_traits; ///< Geometric traits class. + typedef typename Geom_traits::FT FT; + typedef typename Geom_traits::RT RT; + typedef typename Geom_traits::Point_2 Point_2; ///< typedef to Geom_traits::Point_2 + typedef typename Geom_traits::Point_3 Point_3; ///< typedef to Geom_traits::Point_3 + typedef typename Geom_traits::Vector_3 Vector_3; ///< typedef to Geom_traits::Vector_3 + +// Public methods +public: + + /// Point is (0,0,0) by default. + /// Normal is (0,0,0) by default. + UI_point_3(const CGAL::Origin& o = CGAL::ORIGIN) + : Base(o) + { + m_is_selected = false; + m_radius = FT(0); + } + UI_point_3(FT x, FT y, FT z, + const Vector_3& normal = CGAL::NULL_VECTOR) + : Base(x,y,z,normal) + { + m_is_selected = false; + m_radius = FT(0); + } + UI_point_3(RT hx, RT hy, RT hz, RT hw, + const Vector_3& normal = CGAL::NULL_VECTOR) + : Base(hx,hy,hz,hw,normal) + { + m_is_selected = false; + m_radius = FT(0); + } + UI_point_3(const Point_3& point, + const Vector_3& normal = CGAL::NULL_VECTOR) + : Base(point, normal) + { + m_is_selected = false; + m_radius = FT(0); + } + template + UI_point_3(const CGAL::Point_with_normal_3& pwn) + : Base(pwn) + { + m_is_selected = false; + m_radius = FT(0); + } + + /// Copy constructor + UI_point_3(const UI_point_3& upt) + : Base(upt) + { + m_is_selected = upt.m_is_selected; + m_radius = upt.m_radius; + } + template + UI_point_3(const UI_point_3& upt) + : Base(upt) + { + m_is_selected = upt.is_selected(); + m_radius = upt.radius(); + } + /// Operator =() + UI_point_3& operator=(const UI_point_3& upt) + { + Base::operator=(upt); + m_is_selected = upt.m_is_selected; + m_radius = upt.m_radius; + return *this; + } + + // Inherited operators ==() and !=() are fine. + + /// Selection flag. + bool is_selected() const { return m_is_selected; } + void select(bool is_selected=true) { m_is_selected = is_selected; } + + /// Gets/sets radius. + FT radius() const { return m_radius; } + FT& radius() { return m_radius; } + +// Data +private: + + // Selection flag. + bool m_is_selected; + + /// radius. + FT m_radius; +}; + + +#endif //UI_POINT_3_H + diff --git a/Polyhedron_IO/include/CGAL/IO/generic_print_polyhedron.h b/Polyhedron_IO/include/CGAL/IO/generic_print_polyhedron.h index a36bb754ff2..215bf50fdd7 100644 --- a/Polyhedron_IO/include/CGAL/IO/generic_print_polyhedron.h +++ b/Polyhedron_IO/include/CGAL/IO/generic_print_polyhedron.h @@ -33,7 +33,6 @@ generic_print_polyhedron( std::ostream& out, const Polyhedron& P, Writer& writer) { // writes P to `out' in the format provided by `writer'. - typedef typename Polyhedron::Vertex Vertex; typedef typename Polyhedron::Vertex_const_iterator VCI; typedef typename Polyhedron::Facet_const_iterator FCI; typedef typename Polyhedron::Halfedge_around_facet_const_circulator HFCC; diff --git a/Polynomial/include/CGAL/Polynomial/Polynomial_type.h b/Polynomial/include/CGAL/Polynomial/Polynomial_type.h index 68ae9f8528c..fcbebf14700 100644 --- a/Polynomial/include/CGAL/Polynomial/Polynomial_type.h +++ b/Polynomial/include/CGAL/Polynomial/Polynomial_type.h @@ -41,6 +41,7 @@ typename CGAL::internal::Innermost_coefficient_type::Type , 2>::Type #include +#include #include #include @@ -1330,7 +1331,7 @@ void Polynomial::output_maple(std::ostream& os) const { static const char *varnames[] = { "x", "y", "z" }; varname = varnames[Polynomial_traits_d::d]; } else { - sprintf(vnbuf, "w%d", Polynomial_traits_d::d - 2); + std::sprintf(vnbuf, "w%d", Polynomial_traits_d::d - 2); varname = vnbuf; } diff --git a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Segment_Delaunay_graph_2_impl.h b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Segment_Delaunay_graph_2_impl.h index d2b7c6c41f8..9893a04d81c 100644 --- a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Segment_Delaunay_graph_2_impl.h +++ b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Segment_Delaunay_graph_2_impl.h @@ -763,7 +763,8 @@ insert_segment_interior(const Site_2& t, const Storage_site_2& ss, Storage_site_2 ssvp = vp->storage_site(); Storage_site_2 sss = split_storage_site(ss, ssvp, true); - Storage_site_2 sss1 = split_storage_site(ss, ssvp, false); + /*Storage_site_2 sss1 =*/ + split_storage_site(ss, ssvp, false); // merge the info of the second (common) subsegment // merge_info(vv, sss); // merge the info of the (common) splitting endpoint diff --git a/Surface_mesh_parameterization/include/CGAL/Parameterization_mesh_patch_3.h b/Surface_mesh_parameterization/include/CGAL/Parameterization_mesh_patch_3.h index 69bbdb16e0c..bad3d1a86ce 100644 --- a/Surface_mesh_parameterization/include/CGAL/Parameterization_mesh_patch_3.h +++ b/Surface_mesh_parameterization/include/CGAL/Parameterization_mesh_patch_3.h @@ -22,6 +22,7 @@ #ifndef CGAL_PARAMETERIZATION_MESH_PATCH_3_H #define CGAL_PARAMETERIZATION_MESH_PATCH_3_H +#include #include #include #include diff --git a/Surface_mesh_parameterization/include/CGAL/Taucs_fix.h b/Surface_mesh_parameterization/include/CGAL/Taucs_fix.h index 2e5ca56010c..23298be050b 100644 --- a/Surface_mesh_parameterization/include/CGAL/Taucs_fix.h +++ b/Surface_mesh_parameterization/include/CGAL/Taucs_fix.h @@ -32,6 +32,7 @@ #if defined(__GNUC__) #undef __DEPRECATED #include + #undef complex #endif // taucs.h will define min/max macros if it's not already done (e.g. by Windows.h). diff --git a/Surface_mesh_parameterization/include/CGAL/Taucs_matrix.h b/Surface_mesh_parameterization/include/CGAL/Taucs_matrix.h index 90c3c93327b..f8cabd3da5c 100644 --- a/Surface_mesh_parameterization/include/CGAL/Taucs_matrix.h +++ b/Surface_mesh_parameterization/include/CGAL/Taucs_matrix.h @@ -27,6 +27,7 @@ #include #include +#include #include namespace CGAL { @@ -322,9 +323,9 @@ public: int nb_elements = m_columns[col].size(); // Number of non null elements of the column // Fast copy of column indices and values - memcpy(&m_matrix->rowind[first_index], &m_columns[col].m_indices[0], nb_elements*sizeof(int)); + std::memcpy(&m_matrix->rowind[first_index], &m_columns[col].m_indices[0], nb_elements*sizeof(int)); T* taucs_values = (T*) m_matrix->values.v; - memcpy(&taucs_values[first_index], &m_columns[col].m_values[0], nb_elements*sizeof(T)); + std::memcpy(&taucs_values[first_index], &m_columns[col].m_values[0], nb_elements*sizeof(T)); // Start of next column will be: m_matrix->colptr[col+1] = first_index + nb_elements; diff --git a/Surface_mesh_parameterization/include/CGAL/Taucs_solver_traits.h b/Surface_mesh_parameterization/include/CGAL/Taucs_solver_traits.h index 686fc58743b..4e3799425e8 100644 --- a/Surface_mesh_parameterization/include/CGAL/Taucs_solver_traits.h +++ b/Surface_mesh_parameterization/include/CGAL/Taucs_solver_traits.h @@ -38,6 +38,7 @@ #include +#include // For tempnam #include #include #include diff --git a/Triangulation_2/include/CGAL/Delaunay_triangulation_2.h b/Triangulation_2/include/CGAL/Delaunay_triangulation_2.h index 0eb89bc8df3..d6eb5a23aab 100644 --- a/Triangulation_2/include/CGAL/Delaunay_triangulation_2.h +++ b/Triangulation_2/include/CGAL/Delaunay_triangulation_2.h @@ -2249,7 +2249,6 @@ move_if_no_collision_and_give_new_faces(Vertex_handle v, CGAL_triangulation_precondition(!this->is_infinite(v)); if(v->point() == p) return v; - typedef std::list Faces_list; const int dim = this->dimension(); if(dim == 2) { diff --git a/Triangulation_2/include/CGAL/Regular_triangulation_euclidean_traits_2.h b/Triangulation_2/include/CGAL/Regular_triangulation_euclidean_traits_2.h index be6a3d07a31..500fbf362ba 100644 --- a/Triangulation_2/include/CGAL/Regular_triangulation_euclidean_traits_2.h +++ b/Triangulation_2/include/CGAL/Regular_triangulation_euclidean_traits_2.h @@ -180,8 +180,8 @@ compare_power_distance(const Weighted_point& p, const Bare_point& r, Homogeneous_tag) { typedef typename Kernel_traits::Kernel::RT RT; - return compare_power_distanceH2(p.hx(), p.hy(), p.hw(), FT(p.weight()), - q.hx(), q.hy(), q.hw(), FT(q.weight()), + return compare_power_distanceH2(p.hx(), p.hy(), p.hw(), RT(p.weight()), + q.hx(), q.hy(), q.hw(), RT(q.weight()), r.hx(), r.hy(), r.hw()); } @@ -306,7 +306,6 @@ typename Kernel_traits::Kernel::Oriented_side power_test_2(const Weighted_point &p, const Weighted_point &t) { - typedef typename Kernel_traits::Kernel::RT RT; Comparison_result r = compare(p.weight(), t.weight()); if(r == LARGER) return ON_NEGATIVE_SIDE; else if (r == SMALLER) return ON_POSITIVE_SIDE; diff --git a/Triangulation_2/include/CGAL/Triangulation_2.h b/Triangulation_2/include/CGAL/Triangulation_2.h index 4dcc820ec16..8bcebd366d4 100644 --- a/Triangulation_2/include/CGAL/Triangulation_2.h +++ b/Triangulation_2/include/CGAL/Triangulation_2.h @@ -594,7 +594,6 @@ std::ptrdiff_t insert(InputIterator first, InputIterator last) bool well_oriented(Vertex_handle v) const { - typedef typename Geom_traits::Orientation_2 Orientation_2; Face_circulator fc = incident_faces(v), done(fc); do { if(!is_infinite(fc)) { @@ -634,8 +633,6 @@ public: EdgeIt edge_end, FaceIt face_begin, FaceIt face_end) { - typedef typename Triangulation_data_structure::Edge Tds_Edge; - typedef typename Triangulation_data_structure::Face Tds_Face; Vertex_handle v = _tds.star_hole( edge_begin, edge_end, face_begin, face_end); v->set_point(p); @@ -2149,7 +2146,6 @@ move_if_no_collision_and_give_new_faces(Vertex_handle v, { CGAL_triangulation_precondition(!is_infinite(v)); if(v->point() == p) return v; - typedef std::list Faces_list; const int dim = this->dimension(); Locate_type lt; diff --git a/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_delaunay_3.h b/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_delaunay_3.h index 918d44283da..aee119e3398 100644 --- a/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_delaunay_3.h +++ b/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_delaunay_3.h @@ -33,6 +33,7 @@ #include "_test_remove_cluster.h" #include +#include // Accessory set of functions to differentiate between // Delaunay::nearest_vertex[_in_cell] and @@ -1074,6 +1075,7 @@ _test_cls_delaunay_3(const Triangulation &) assert(TM_0.dimension() == 1); Vertex_handle tmv5 = TM_0.insert(Point(0,2,0)); + CGAL_USE(tmv5); Vertex_handle tmv6 = TM_0.insert(Point(1,0,0)); assert(TM_0.dimension() == 3); diff --git a/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_triangulation_3.h b/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_triangulation_3.h index cc6d7c8d1e1..515964a4e9c 100644 --- a/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_triangulation_3.h +++ b/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_triangulation_3.h @@ -28,6 +28,7 @@ #include "_test_cls_circulator.h" #include +#include template bool check_all_are_finite(Triangulation* tr, const Container& cont) @@ -639,6 +640,7 @@ _test_cls_triangulation_3(const Triangulation &) TAI1.insert_and_give_new_cells( Point(x, x, x), std::back_inserter(lis_tai1)); + CGAL_USE(taiv); assert(TAI1.is_valid()); assert(TAI1.dimension() == 1); assert(lis_tai1.size() == 2); @@ -668,6 +670,7 @@ _test_cls_triangulation_3(const Triangulation &) TAI1.insert_and_give_new_cells( Point(x, y, 0), std::back_inserter(lis_tai1)); + CGAL_USE(taiv); assert(TAI1.is_valid()); assert(TAI1.dimension() == 2); while(!lis_tai1.empty()) @@ -697,6 +700,7 @@ _test_cls_triangulation_3(const Triangulation &) TAI1.insert_and_give_new_cells( Point(x, y, z), std::back_inserter(lis_tai1)); + CGAL_USE(taiv); assert(TAI1.is_valid()); assert(TAI1.dimension() == 3); while(!lis_tai1.empty()) diff --git a/Voronoi_diagram_2/test/Voronoi_diagram_2/include/vda_test_vda.h b/Voronoi_diagram_2/test/Voronoi_diagram_2/include/vda_test_vda.h index 90c268a7fcc..8ac77b36b5f 100644 --- a/Voronoi_diagram_2/test/Voronoi_diagram_2/include/vda_test_vda.h +++ b/Voronoi_diagram_2/test/Voronoi_diagram_2/include/vda_test_vda.h @@ -25,6 +25,7 @@ #include #include #include "helper_functions.h" +#include //========================================================================== //========================================================================== @@ -607,11 +608,13 @@ void test_vda(const VDA& vda) Site_iterator sit; for (sit = vda.sites_begin(); sit != vda.sites_end(); ++sit) { typename AT::Site_2 s = *sit; + CGAL_USE(s); } if ( vda.sites_begin() != vda.sites_end() ) { for (sit = --vda.sites_end(); sit != vda.sites_begin(); --sit) { typename AT::Site_2 s = *sit; + CGAL_USE(s); } } }