From 8bb22d5b2c1d7ca9220207fc4f97c8cc0ae0584b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 26 Mar 2020 14:23:37 +0100 Subject: [PATCH] extra run of the script to remove tabs and trailing whitespaces right after the merge of the 5.0 release branch + manual fix of the files (indentation was changed in the meantime): * Spatial_sorting/include/CGAL/Multiscale_sort.h * Spatial_sorting/test/Spatial_sorting/test_multiscale.cpp --- .travis/packages.txt | 276 +-- AABB_tree/demo/AABB_tree/Scene.cpp | 2 +- AABB_tree/demo/AABB_tree/benchmarks.cpp | 6 +- AABB_tree/doc/AABB_tree/Concepts/AABBTraits.h | 134 +- .../AABB_halfedge_graph_edge_example.cpp | 8 +- .../AABB_polyhedron_edge_example.cpp | 2 +- ...AABB_polyhedron_facet_distance_example.cpp | 4 +- .../AABB_tree/AABB_segment_3_example.cpp | 4 +- .../CGAL/AABB_face_graph_triangle_primitive.h | 4 +- .../AABB_halfedge_graph_segment_primitive.h | 2 +- AABB_tree/include/CGAL/AABB_tree.h | 902 +++++----- .../test/AABB_tree/aabb_test_empty_tree.cpp | 2 +- .../AABB_tree/aabb_test_singleton_tree.cpp | 6 +- .../CGAL/HalfedgeDS_face_max_base_with_id.h | 48 +- .../HalfedgeDS_halfedge_max_base_with_id.h | 46 +- .../CGAL/HalfedgeDS_vertex_max_base_with_id.h | 44 +- BGL/doc/BGL/CGAL/Polyhedron_items_with_id_3.h | 34 +- .../CGAL/Triangulation_face_base_with_id_2.h | 12 +- .../Triangulation_vertex_base_with_id_2.h | 22 +- BGL/doc/BGL/CGAL/boost/graph/properties.h | 4 +- BGL/doc/BGL/NamedParameters.txt | 12 +- BGL/doc/BGL/PackageDescription.txt | 14 +- BGL/examples/BGL_LCC/copy_lcc.cpp | 2 +- .../BGL_polyhedron_3/copy_polyhedron.cpp | 4 +- BGL/examples/BGL_surface_mesh/write_inp.cpp | 2 +- BGL/include/CGAL/boost/graph/Seam_mesh.h | 2 +- .../CGAL/boost/graph/copy_face_graph.h | 30 +- .../internal/initialized_index_maps_helpers.h | 2 +- BGL/include/CGAL/boost/graph/io.h | 48 +- .../CGAL/boost/graph/named_params_helper.h | 2 +- BGL/include/CGAL/boost/graph/properties.h | 4 +- BGL/test/BGL/test_Prefix.h | 18 +- BGL/test/BGL/test_Properties.cpp | 2 +- BGL/test/BGL/test_cgal_bgl_named_params.cpp | 6 +- .../DH_speed_test_100_vertices.cpp | 2 +- .../MV_speed_test_100_vertices.cpp | 2 +- .../WP_speed_test_100_vertices.cpp | 2 +- .../CMakeLists.txt | 6 +- .../test/Bounding_volumes/CMakeLists.txt | 6 +- .../CGAL/box_intersection_d.h | 546 +++--- .../CGAL/Box_intersection_d/Box_with_info_d.h | 2 +- .../CGAL/Box_intersection_d/segment_tree.h | 10 +- .../test/Box_intersection_d/test_box_grid.cpp | 2 +- CGAL_ipelets/demo/CGAL_ipelets/CMakeLists.txt | 14 +- .../include/CGAL/Cartesian/Point_2.h | 18 +- .../include/CGAL/Cartesian/Point_3.h | 12 +- .../include/CGAL/Cartesian/Vector_2.h | 12 +- .../include/CGAL/Cartesian/Vector_3.h | 10 +- .../examples/Classification/CMakeLists.txt | 6 +- .../Classification/example_classification.cpp | 24 +- .../example_cluster_classification.cpp | 52 +- .../ETHZ/Random_forest_classifier.h | 36 +- .../Classification/Local_eigen_analysis.h | 94 +- .../Classification/Mesh_feature_generator.h | 48 +- .../Point_set_feature_generator.h | 42 +- .../Classification/Point_set_neighborhood.h | 16 +- .../include/CGAL/Classification/classify.h | 64 +- .../test/Classification/CMakeLists.txt | 4 +- .../include/CGAL/Combinatorial_map.h | 28 +- .../CGAL/Combinatorial_map_basic_operations.h | 64 +- .../include/CGAL/Combinatorial_map_storages.h | 4 +- .../include/CGAL/Face_graph_wrapper.h | 128 +- .../CGAL/Functors_for_face_graph_wrapper.h | 12 +- .../CGAL/Iterators_for_face_graph_wrapper.h | 62 +- .../test/Combinatorial_map/CMakeLists.txt | 4 +- .../Combinatorial_map_copy_test.cpp | 14 +- .../Combinatorial_map_test.cpp | 6 +- .../doc/Convex_hull_2/CGAL/ch_jarvis.h | 100 +- .../doc/Convex_hull_3/CGAL/convex_hull_3.h | 4 +- .../examples/Convex_hull_3/CMakeLists.txt | 4 +- .../examples/Convex_hull_3/graph_hull_3.cpp | 4 +- Convex_hull_3/include/CGAL/convex_hull_3.h | 18 +- .../Convex_hull_3/test_ch_3_ambiguity.cpp | 4 +- .../doc/Documentation/Third_party.txt | 4 +- .../include/CGAL/Kernel_profiler.h | 6 +- Filtered_kernel/include/CGAL/Lazy.h | 122 +- .../CGAL/internal/Static_filters/Coplanar_3.h | 2 +- .../internal/Static_filters/Static_filters.h | 8 +- .../include/CGAL/Generalized_map.h | 10 +- .../include/CGAL/Generalized_map_storages.h | 4 +- .../doc/Generator/CGAL/point_generators_2.h | 2 +- .../doc/Generator/CGAL/point_generators_3.h | 10 +- Generator/examples/Generator/CMakeLists.txt | 6 +- Generator/include/CGAL/point_generators_d.h | 32 +- Generator/test/Generator/CMakeLists.txt | 4 +- GraphicsView/demo/Polygon/CMakeLists.txt | 2 +- GraphicsView/include/CGAL/Buffer_for_vao.h | 90 +- .../include/CGAL/Qt/Basic_viewer_qt.h | 64 +- .../test/Heat_method_3/CMakeLists.txt | 4 +- Installation/CMakeLists.txt | 108 +- .../CGAL/Surface_mesh/Surface_mesh_fwd.h | 2 +- .../test/Intersections_3/call_test.cpp | 10 +- .../examples/Jet_fitting_3/CMakeLists.txt | 2 +- .../doc/Kernel_23/CGAL/Filtered_predicate.h | 72 +- .../include/CGAL/Kernel/interface_macros.h | 464 ++--- Kernel_23/include/CGAL/Kernel_checker.h | 6 +- Kernel_23/include/CGAL/Vector_2.h | 4 +- Kernel_23/include/CGAL/Vector_3.h | 12 +- .../Kernel_23/include/CGAL/_test_cls_ray_3.h | 8 +- .../include/CGAL/_test_cls_segment_3.h | 8 +- .../include/CGAL/Kernel_d/function_objects.h | 26 +- .../Linear_cell_complex/CMakeLists.txt | 2 +- .../Linear_cell_complex/basic_viewer.h | 106 +- .../CGAL/CMap_linear_cell_complex_storages.h | 4 +- .../CGAL/GMap_linear_cell_complex_storages.h | 2 +- .../include/CGAL/Linear_cell_complex_base.h | 4 +- ...inear_cell_complex_for_combinatorial_map.h | 4 +- .../include/CGAL/draw_linear_cell_complex.h | 22 +- .../CGAL/Delaunay_mesh_size_criteria_2.h | 116 +- Mesh_2/include/CGAL/Mesh_2/Clusters.h | 28 +- Mesh_2/include/CGAL/Mesh_2/Refine_edges.h | 94 +- Mesh_3/examples/Mesh_3/CMakeLists.txt | 54 +- .../IO/Complex_3_in_triangulation_3_to_vtk.h | 16 +- Mesh_3/include/CGAL/IO/File_maya.h | 48 +- .../Mesh_complex_3_in_triangulation_3_base.h | 86 +- .../CGAL/Mesh_3/Refine_facets_manifold_base.h | 8 +- .../Lipschitz_sizing_experimental.h | 2 +- .../include/CGAL/Polyhedral_mesh_domain_3.h | 8 +- Mesh_3/test/Mesh_3/CMakeLists.txt | 8 +- Mesh_3/test/Mesh_3/test_mesh_3_issue_1554.cpp | 6 +- .../test_mesh_capsule_var_distance_bound.cpp | 6 +- ...hedral_domain_with_features_deprecated.cpp | 6 +- Nef_3/doc/Nef_3/CGAL/draw_nef_3.h | 4 +- Nef_3/doc/Nef_3/Nef_3.txt | 82 +- Nef_3/examples/Nef_3/CMakeLists.txt | 8 +- Nef_3/include/CGAL/Nef_3/K3_tree.h | 410 ++--- Nef_3/include/CGAL/Nef_3/SNC_point_locator.h | 560 +++--- .../CGAL/NewKernel_d/Kernel_d_interface.h | 476 ++--- .../CGAL/NewKernel_d/Types/Weighted_point.h | 76 +- .../CGAL/NewKernel_d/Wrapper/Point_d.h | 42 +- .../NewKernel_d/function_objects_cartesian.h | 1582 ++++++++--------- .../include/CGAL/NewKernel_d/functor_tags.h | 454 ++--- NewKernel_d/test/NewKernel_d/CMakeLists.txt | 4 +- NewKernel_d/test/NewKernel_d/Epick_d.cpp | 4 +- Number_types/include/CGAL/GMP/Gmpq_type.h | 4 +- Number_types/include/CGAL/Lazy_exact_nt.h | 24 +- .../CGAL/Sqrt_extension/Eigen_NumTraits.h | 2 +- Number_types/test/Number_types/CMakeLists.txt | 4 +- .../scene.h | 10 +- .../CGAL/draw_periodic_2_triangulation_2.h | 4 +- .../PackageDescription.txt | 10 +- .../Periodic_2_triangulation_2.txt | 30 +- .../Periodic_2_triangulation_2/CMakeLists.txt | 4 +- .../draw_periodic_2_triangulation_2.cpp | 6 +- .../examples/Periodic_3_mesh_3/CMakeLists.txt | 2 +- .../test/Periodic_3_mesh_3/CMakeLists.txt | 2 +- .../CGAL/_test_cls_periodic_3_tds_cell.h | 2 +- .../examples/Point_set_3/CMakeLists.txt | 6 +- .../NamedParameters.txt | 2 +- .../PackageDescription.txt | 2 +- .../Point_set_processing_3.txt | 80 +- .../doc/Point_set_processing_3/examples.txt | 2 +- .../Point_set_processing_3/CMakeLists.txt | 20 +- .../average_spacing_example.cpp | 2 +- .../bilateral_smooth_point_set_example.cpp | 4 +- .../callback_example.cpp | 6 +- .../edge_aware_upsample_point_set_example.cpp | 6 +- .../normals_example.cpp | 2 +- .../registration_with_OpenGR.cpp | 2 +- ...tion_with_opengr_pointmatcher_pipeline.cpp | 4 +- .../registration_with_pointmatcher.cpp | 12 +- .../scale_estimation_example.cpp | 12 +- ...plify_and_regularize_point_set_example.cpp | 2 +- .../include/CGAL/IO/read_las_points.h | 30 +- .../include/CGAL/IO/read_off_points.h | 20 +- .../include/CGAL/IO/read_ply_points.h | 22 +- .../include/CGAL/IO/read_xyz_points.h | 30 +- .../include/CGAL/IO/write_las_points.h | 22 +- .../include/CGAL/IO/write_off_points.h | 6 +- .../include/CGAL/IO/write_ply_points.h | 16 +- .../include/CGAL/IO/write_xyz_points.h | 12 +- .../compute_registration_transformation.h | 2 +- .../include/CGAL/OpenGR/register_point_sets.h | 2 +- .../internal/Search_traits_vertex_handle_3.h | 6 +- .../include/CGAL/bilateral_smooth_point_set.h | 120 +- .../include/CGAL/compute_average_spacing.h | 18 +- .../CGAL/edge_aware_upsample_point_set.h | 76 +- .../include/CGAL/estimate_scale.h | 52 +- .../include/CGAL/grid_simplify_point_set.h | 10 +- .../CGAL/hierarchy_simplify_point_set.h | 312 ++-- .../include/CGAL/jet_estimate_normals.h | 34 +- .../include/CGAL/jet_smooth_point_set.h | 40 +- .../include/CGAL/mst_orient_normals.h | 30 +- .../include/CGAL/pca_estimate_normals.h | 34 +- .../compute_registration_transformation.h | 112 +- .../CGAL/pointmatcher/register_point_sets.h | 60 +- .../include/CGAL/remove_outliers.h | 8 +- .../include/CGAL/structure_point_set.h | 146 +- .../include/CGAL/vcm_estimate_normals.h | 10 +- .../wlop_simplify_and_regularize_point_set.h | 124 +- .../Point_set_processing_3/CMakeLists.txt | 8 +- .../edge_aware_upsample_test.cpp | 8 +- .../normal_estimation_test.cpp | 16 +- .../CMakeLists.txt | 2 +- .../poisson_reconstruction.cpp | 14 +- .../Polygon_mesh_processing/CMakeLists.txt | 4 +- .../NamedParameters.txt | 2 +- .../PackageDescription.txt | 12 +- .../Polygon_mesh_processing/CMakeLists.txt | 4 +- .../corefinement_LCC.cpp | 2 +- .../isotropic_remeshing_of_patch_example.cpp | 2 +- .../connected_components.h | 2 +- .../CGAL/Polygon_mesh_processing/distance.h | 2 +- .../CGAL/Polygon_mesh_processing/fair.h | 4 +- .../Corefinement/intersection_callbacks.h | 2 +- .../Hole_filling/Triangulate_hole_polyline.h | 214 +-- .../Isotropic_remeshing/remesh_impl.h | 4 +- .../Polygon_mesh_processing/intersection.h | 8 +- .../random_perturbation.h | 2 +- .../CGAL/Polygon_mesh_processing/remesh.h | 2 +- .../repair_polygon_soup.h | 2 +- .../Polygon_mesh_processing/stitch_borders.h | 32 +- .../triangulate_hole.h | 8 +- .../include/CGAL/Side_of_triangle_mesh.h | 6 +- .../include/CGAL/polygon_mesh_processing.h | 2 +- .../Polygon_mesh_processing/CMakeLists.txt | 4 +- .../connected_component_polyhedron.cpp | 2 +- .../remeshing_test_P_SM_OM.cpp | 4 +- .../test_orient_cc.cpp | 2 +- .../Polygon_mesh_processing/test_pmp_clip.cpp | 8 +- .../test_stitching.cpp | 2 +- .../CMakeLists.txt | 4 +- ...olyfit_example_model_complexty_control.cpp | 168 +- .../polyfit_example_user_provided_planes.cpp | 106 +- .../polyfit_example_with_region_growing.cpp | 16 +- .../polyfit_example_without_input_planes.cpp | 170 +- .../CGAL/internal/compute_confidences.h | 340 ++-- .../CMakeLists.txt | 4 +- Polyhedron/demo/Polyhedron/CMakeLists.txt | 24 +- Polyhedron/demo/Polyhedron/MainWindow.cpp | 8 +- Polyhedron/demo/Polyhedron/MainWindow.h | 20 +- .../Plugins/AABB_tree/Cut_plugin.cpp | 8 +- .../Plugins/Classification/CMakeLists.txt | 8 +- .../Classification/Classification_plugin.cpp | 230 +-- .../Classification/Cluster_classification.cpp | 106 +- .../Classification/Cluster_classification.h | 44 +- .../Point_set_item_classification.cpp | 68 +- .../Point_set_item_classification.h | 50 +- .../Surface_mesh_item_classification.cpp | 40 +- .../Surface_mesh_item_classification.h | 30 +- .../Convex_hull/Convex_hull_plugin.cpp | 20 +- .../Display/Display_property_plugin.cpp | 58 +- .../demo/Polyhedron/Plugins/IO/CMakeLists.txt | 4 +- .../Polyhedron/Plugins/IO/Nef_io_plugin.cpp | 6 +- .../Polyhedron/Plugins/IO/PLY_io_plugin.cpp | 16 +- .../Plugins/IO/Polylines_io_plugin.cpp | 4 +- .../Polyhedron/Plugins/IO/VTK_io_plugin.cpp | 32 +- .../Polyhedron/Plugins/IO/lcc_io_plugin.cpp | 26 +- .../Plugins/Mesh_2/Mesh_2_plugin.cpp | 2 +- .../Plugins/Mesh_3/C3t3_io_plugin.cpp | 14 +- .../Mesh_3/C3t3_rib_exporter_plugin.cpp | 340 ++-- .../Polyhedron/Plugins/Mesh_3/CMakeLists.txt | 2 +- .../Plugins/Mesh_3/Io_image_plugin.cpp | 4 +- .../Plugins/Mesh_3/Optimization_plugin.cpp | 140 +- .../Polyhedron/Plugins/PMP/CMakeLists.txt | 4 +- .../Plugins/PMP/Distance_plugin.cpp | 18 +- .../Plugins/PMP/Engrave_text_plugin.cpp | 148 +- .../Polyhedron/Plugins/PMP/Fairing_plugin.cpp | 8 +- .../Plugins/PMP/Hole_filling_plugin.cpp | 8 +- .../PMP/Isotropic_remeshing_plugin.cpp | 22 +- .../Mean_curvature_flow_skeleton_plugin.cpp | 24 +- .../Plugins/PMP/Repair_polyhedron_plugin.cpp | 2 +- .../Plugins/PMP/Selection_plugin.cpp | 64 +- .../Point_set_average_spacing_plugin.cpp | 14 +- .../Point_set_bilateral_smoothing_plugin.cpp | 14 +- .../Point_set_normal_estimation_plugin.cpp | 12 +- .../Point_set_outliers_removal_plugin.cpp | 4 +- .../Point_set/Point_set_selection_plugin.cpp | 184 +- .../Point_set_shape_detection_plugin.cpp | 180 +- .../Point_set_simplification_plugin.cpp | 12 +- .../Point_set/Point_set_smoothing_plugin.cpp | 2 +- .../Point_set/Point_set_upsampling_plugin.cpp | 40 +- .../Point_set/Point_set_wlop_plugin.cpp | 16 +- .../Point_set/Register_point_sets_plugin.cpp | 20 +- .../Surface_reconstruction_poisson_impl.cpp | 44 +- ...urface_reconstruction_scale_space_impl.cpp | 18 +- .../Plugins/Surface_mesh/CMakeLists.txt | 4 +- .../Mesh_plane_detection_plugin.cpp | 44 +- .../Surface_mesh/Mesh_segmentation_plugin.cpp | 10 +- .../Mesh_simplification_plugin.cpp | 20 +- .../Surface_mesh/Offset_meshing_plugin.cpp | 14 +- .../Plugins/Surface_mesh/VSA_wrapper.h | 2 +- .../Edit_polyhedron_plugin.cpp | 46 +- .../Scene_edit_polyhedron_item.cpp | 56 +- .../demo/Polyhedron/Scene_c3t3_item.cpp | 88 +- .../Scene_item_rendering_helper.cpp | 6 +- .../Polyhedron/Scene_polygon_soup_item.cpp | 94 +- .../Scene_polyhedron_selection_item.cpp | 134 +- .../demo/Polyhedron/Scene_polylines_item.cpp | 42 +- .../demo/Polyhedron/Scene_spheres_item.cpp | 30 +- .../Polyhedron/Scene_surface_mesh_item.cpp | 110 +- Polyhedron/demo/Polyhedron/Use_ssh.cpp | 6 +- Polyhedron/demo/Polyhedron/Viewer.cpp | 166 +- Polyhedron/demo/Polyhedron/Viewer.h | 4 +- .../include/CGAL/IO/read_surf_trianglemesh.h | 2 +- .../include/run_with_qprogressdialog.h | 20 +- Polyhedron_IO/include/CGAL/IO/OFF_reader.h | 2 +- .../include/CGAL/IO/Polyhedron_iostream.h | 8 +- Polyhedron_IO/include/CGAL/IO/STL_reader.h | 2 +- .../CMakeLists.txt | 2 +- .../CMakeLists.txt | 4 +- .../CMakeLists.txt | 4 +- .../include/CGAL/Dynamic_property_map.h | 12 +- Ridges_3/examples/Ridges_3/CMakeLists.txt | 8 +- Ridges_3/include/CGAL/Umbilics.h | 80 +- Ridges_3/test/Ridges_3/CMakeLists.txt | 6 +- STL_Extension/doc/STL_Extension/CGAL/tags.h | 48 +- STL_Extension/include/CGAL/Container_helper.h | 2 +- STL_Extension/include/CGAL/Handle.h | 18 +- STL_Extension/include/CGAL/Handle_for.h | 20 +- STL_Extension/include/CGAL/exceptions.h | 16 +- STL_Extension/include/CGAL/tags.h | 12 +- .../CMakeLists.txt | 6 +- .../Jet_smoother.h | 6 +- .../Weighted_PCA_smoother.h | 34 +- .../benchmark/Shape_detection/CMakeLists.txt | 2 +- .../examples/Shape_detection/CMakeLists.txt | 6 +- .../K_neighbor_query.h | 74 +- .../Sphere_neighbor_query.h | 72 +- .../test/Shape_detection/CMakeLists.txt | 4 +- .../examples/Solver_interface/CMakeLists.txt | 6 +- .../Spatial_searching/CMakeLists.txt | 4 +- .../CGAL/Euclidean_distance.h | 114 +- .../Spatial_searching/CGAL/Fuzzy_iso_box.h | 2 +- .../CGAL/Incremental_neighbor_search.h | 110 +- .../CGAL/K_neighbor_search.h | 106 +- .../doc/Spatial_searching/CGAL/Kd_tree.h | 6 +- .../Orthogonal_incremental_neighbor_search.h | 112 +- .../CGAL/Orthogonal_k_neighbor_search.h | 112 +- .../Concepts/FuzzyQueryItem.h | 44 +- .../Concepts/GeneralDistance.h | 70 +- .../examples/Spatial_searching/CMakeLists.txt | 4 +- .../examples/Spatial_searching/Distance.h | 12 +- .../include/CGAL/Euclidean_distance.h | 16 +- .../include/CGAL/Fuzzy_iso_box.h | 24 +- .../CGAL/Incremental_neighbor_search.h | 530 +++--- .../include/CGAL/K_neighbor_search.h | 68 +- Spatial_searching/include/CGAL/Kd_tree.h | 30 +- Spatial_searching/include/CGAL/Kd_tree_node.h | 344 ++-- .../Orthogonal_incremental_neighbor_search.h | 424 ++--- .../CGAL/Orthogonal_k_neighbor_search.h | 28 +- .../include/CGAL/Search_traits_adapter.h | 66 +- .../include/CGAL/internal/Search_helpers.h | 2 +- .../test/Spatial_searching/Distance.h | 24 +- .../CGAL/Hilbert_policy_tags.h | 16 +- .../doc/Spatial_sorting/CGAL/Hilbert_sort_2.h | 22 +- .../doc/Spatial_sorting/CGAL/Hilbert_sort_3.h | 22 +- .../doc/Spatial_sorting/CGAL/Hilbert_sort_d.h | 24 +- .../CGAL/Hilbert_sort_on_sphere_3.h | 24 +- .../Spatial_sorting/CGAL/Multiscale_sort.h | 26 +- .../CGAL/Spatial_sort_traits_adapter_3.h | 34 +- .../CGAL/Spatial_sort_traits_adapter_d.h | 36 +- .../doc/Spatial_sorting/CGAL/hilbert_sort.h | 24 +- .../CGAL/hilbert_sort_on_sphere.h | 8 +- .../doc/Spatial_sorting/CGAL/spatial_sort.h | 42 +- .../CGAL/spatial_sort_on_sphere.h | 34 +- .../doc/Spatial_sorting/Spatial_sorting.txt | 40 +- .../examples/Spatial_sorting/CMakeLists.txt | 6 +- Spatial_sorting/include/CGAL/Hilbert_sort_d.h | 2 +- .../include/CGAL/Multiscale_sort.h | 36 +- Spatial_sorting/include/CGAL/hilbert_sort.h | 2 +- .../test/Spatial_sorting/CMakeLists.txt | 4 +- .../test/Spatial_sorting/test_multiscale.cpp | 188 +- .../Straight_skeleton_builder_2_impl.h | 590 +++--- .../Straight_skeleton_builder_traits_2_aux.h | 162 +- .../CGAL/Unfiltered_predicate_adaptor.h | 4 +- Stream_support/include/CGAL/IO/read_3mf.h | 2 +- .../test/Stream_support/test_3mf_to_sm.cpp | 2 +- .../subdivision_methods_3.h | 8 +- .../examples/Surface_mesh/sm_join.cpp | 10 +- .../include/CGAL/Surface_mesh/Properties.h | 30 +- .../include/CGAL/Surface_mesh/Surface_mesh.h | 218 +-- .../Surface_mesh_deformation/CMakeLists.txt | 4 +- .../Surface_mesh_deformation/CMakeLists.txt | 6 +- .../Surface_mesh_deformation/CMakeLists.txt | 4 +- .../CMakeLists.txt | 2 +- .../SDF_calculation.h | 6 +- .../Surface_mesh_shortest_path.txt | 6 +- .../Surface_mesh_shortest_path/CMakeLists.txt | 6 +- .../edge_collapse.h | 8 +- .../test/Surface_mesh_simplification/basics.h | 4 +- .../edge_collapse_topology.cpp | 12 +- .../CMakeLists.txt | 4 +- .../path_homotopy_with_schema.cpp | 12 +- ...quadrangulation_computation_benchmarks.cpp | 2 +- .../CGAL/Curves_on_surface_topology.h | 6 +- .../CGAL/Path_on_surface.h | 14 +- .../CGAL/draw_face_graph_with_paths.h | 2 +- .../Concepts/PolygonalSchema.h | 18 +- .../Surface_mesh_topology.txt | 30 +- .../basic_example_surface_mesh_topology.cpp | 6 +- .../basic_example_torus.cpp | 8 +- .../open_path_homotopy.cpp | 2 +- .../Surface_mesh_topology/path_homotopy.cpp | 12 +- .../path_homotopy_with_symbols.cpp | 2 +- .../path_homotopy_with_symbols_2.cpp | 6 +- ...e_mesh_topology_with_sm_and_polyhedron.cpp | 4 +- .../include/CGAL/Curves_on_surface_topology.h | 2 +- .../include/CGAL/Path_on_surface.h | 48 +- .../include/CGAL/Polygonal_schema.h | 54 +- .../include/CGAL/Polygonal_schema_min_items.h | 2 +- .../internal/Minimal_quadrangulation.h | 6 +- .../internal/Path_generators.h | 22 +- .../internal/Path_on_surface_with_rle.h | 24 +- .../include/CGAL/draw_face_graph_with_paths.h | 10 +- .../Creation_of_test_cases_for_paths.h | 4 +- .../homotopy_big_cylinder.cpp | 6 +- .../homotopy_double_torus_with_holes.cpp | 2 +- .../homotopy_rond_point_saucisse.cpp | 8 +- .../homotopy_small_cylinder.cpp | 2 +- .../path_with_rle_deformation_tests.cpp | 8 +- .../test_homotopy_with_polygonal_schema.cpp | 4 +- .../tests_path_on_surface.cpp | 4 +- .../CGAL/No_intersection_surface_sweep_2.h | 2 +- .../CGAL/Triangulation_data_structure_2.h | 168 +- .../TDS_2/CGAL/Triangulation_ds_face_base_2.h | 10 +- .../CGAL/Triangulation_ds_vertex_base_2.h | 24 +- .../Concepts/TriangulationDSFaceBase_2.h | 188 +- .../Concepts/TriangulationDSVertexBase_2.h | 128 +- .../Concepts/TriangulationDataStructure_2.h | 1078 +++++------ .../CGAL/Triangulation_data_structure_3.h | 64 +- .../TDS_3/CGAL/Triangulation_ds_cell_base_3.h | 8 +- .../CGAL/Triangulation_ds_vertex_base_3.h | 26 +- .../Concepts/TriangulationDSCellBase_3.h | 112 +- .../Concepts/TriangulationDSVertexBase_3.h | 96 +- .../Concepts/TriangulationDataStructure_3.h | 1310 +++++++------- TDS_3/doc/TDS_3/PackageDescription.txt | 6 +- TDS_3/doc/TDS_3/TriangulationDS_3.txt | 32 +- .../TDS_3/include/CGAL/_test_cls_tds_cell.h | 2 +- Three/include/CGAL/Three/Viewer_interface.h | 8 +- .../applications/Triangulation/CMakeLists.txt | 6 +- .../benchmark/Triangulation/CMakeLists.txt | 4 +- .../examples/Triangulation/CMakeLists.txt | 10 +- .../test/Triangulation/CMakeLists.txt | 6 +- .../Constrained_Delaunay_triangulation_2.h | 330 ++-- .../CGAL/Constrained_triangulation_2.h | 294 +-- .../doc/Triangulation_2/Triangulation_2.txt | 376 ++-- .../CGAL/Constrained_triangulation_2.h | 634 +++---- .../CGAL/Constrained_triangulation_plus_2.h | 300 ++-- .../Polyline_constraint_hierarchy_2.h | 204 +-- .../CGAL/Triangulation_face_base_with_id_2.h | 2 +- .../_test_cls_constrained_triangulation_2.h | 42 +- .../test_const_del_triangulation_2.cpp | 4 +- .../test_constrained_triangulation_2.cpp | 8 +- .../include/CGAL/Delaunay_triangulation_3.h | 4 +- .../include/CGAL/Triangulation_3_to_lcc.h | 4 +- .../CGAL/Triangular_expansion_visibility_2.h | 200 +-- .../CGAL/draw_voronoi_diagram_2.h | 6 +- .../Voronoi_diagram_2/PackageDescription.txt | 4 +- .../Voronoi_diagram_2/Voronoi_diagram_2.txt | 34 +- .../examples/Voronoi_diagram_2/CMakeLists.txt | 4 +- 451 files changed, 12474 insertions(+), 12474 deletions(-) diff --git a/.travis/packages.txt b/.travis/packages.txt index 731c19e675c..b6c8ea4b1f6 100644 --- a/.travis/packages.txt +++ b/.travis/packages.txt @@ -1,138 +1,138 @@ -AABB_tree -Advancing_front_surface_reconstruction -Algebraic_foundations -Algebraic_kernel_d -Algebraic_kernel_for_circles -Algebraic_kernel_for_spheres -Alpha_shapes_2 -Alpha_shapes_3 -Apollonius_graph_2 -Arithmetic_kernel -Arrangement_on_surface_2 -BGL -Barycentric_coordinates_2 -Boolean_set_operations_2 -Bounding_volumes -Box_intersection_d -CGAL_Core -CGAL_ImageIO -CGAL_ipelets -Cartesian_kernel -Circular_kernel_2 -Circular_kernel_3 -Circulator -Classification -Combinatorial_map -Cone_spanners_2 -Convex_decomposition_3 -Convex_hull_2 -Convex_hull_3 -Convex_hull_d -Distance_2 -Distance_3 -Envelope_2 -Envelope_3 -Filtered_kernel -Generalized_map -Generator -Geomview -GraphicsView -HalfedgeDS -Hash_map -Heat_method_3 -Homogeneous_kernel -Hyperbolic_triangulation_2 -Inscribed_areas -Installation -Interpolation -Intersections_2 -Intersections_3 -Interval_skip_list -Interval_support -Inventor -Jet_fitting_3 -Kernel_23 -Kernel_d -LEDA -Linear_cell_complex -MacOSX -Maintenance -Matrix_search -Mesh_2 -Mesh_3 -Mesher_level -Minkowski_sum_2 -Minkowski_sum_3 -Modifier -Modular_arithmetic -Nef_2 -Nef_3 -Nef_S2 -NewKernel_d -Number_types -OpenNL -Optimal_transportation_reconstruction_2 -Optimisation_basic -Partition_2 -Periodic_2_triangulation_2 -Periodic_3_mesh_3 -Periodic_3_triangulation_3 -Periodic_4_hyperbolic_triangulation_2 -Point_set_2 -Point_set_3 -Point_set_processing_3 -Poisson_surface_reconstruction_3 -Polygon -Polygon_mesh_processing -Polygonal_surface_reconstruction -Polyhedron -Polyhedron_IO -Polyline_simplification_2 -Polynomial -Polytope_distance_d -Principal_component_analysis -Principal_component_analysis_LGPL -Profiling_tools -Property_map -QP_solver -Random_numbers -Ridges_3 -STL_Extension -Scale_space_reconstruction_3 -Scripts -SearchStructures -Segment_Delaunay_graph_2 -Segment_Delaunay_graph_Linf_2 -Set_movable_separability_2 -Shape_detection -Skin_surface_3 -Snap_rounding_2 -Solver_interface -Spatial_searching -Spatial_sorting -Straight_skeleton_2 -Stream_lines_2 -Stream_support -Subdivision_method_3 -Surface_mesh -Surface_mesh_approximation -Surface_mesh_deformation -Surface_mesh_parameterization -Surface_mesh_segmentation -Surface_mesh_shortest_path -Surface_mesh_simplification -Surface_mesh_skeletonization -Surface_mesh_topology -Surface_mesher -Surface_sweep_2 -TDS_2 -TDS_3 -Testsuite -Three -Triangulation -Triangulation_2 -Triangulation_3 -Union_find -Visibility_2 -Voronoi_diagram_2 -wininst +AABB_tree +Advancing_front_surface_reconstruction +Algebraic_foundations +Algebraic_kernel_d +Algebraic_kernel_for_circles +Algebraic_kernel_for_spheres +Alpha_shapes_2 +Alpha_shapes_3 +Apollonius_graph_2 +Arithmetic_kernel +Arrangement_on_surface_2 +BGL +Barycentric_coordinates_2 +Boolean_set_operations_2 +Bounding_volumes +Box_intersection_d +CGAL_Core +CGAL_ImageIO +CGAL_ipelets +Cartesian_kernel +Circular_kernel_2 +Circular_kernel_3 +Circulator +Classification +Combinatorial_map +Cone_spanners_2 +Convex_decomposition_3 +Convex_hull_2 +Convex_hull_3 +Convex_hull_d +Distance_2 +Distance_3 +Envelope_2 +Envelope_3 +Filtered_kernel +Generalized_map +Generator +Geomview +GraphicsView +HalfedgeDS +Hash_map +Heat_method_3 +Homogeneous_kernel +Hyperbolic_triangulation_2 +Inscribed_areas +Installation +Interpolation +Intersections_2 +Intersections_3 +Interval_skip_list +Interval_support +Inventor +Jet_fitting_3 +Kernel_23 +Kernel_d +LEDA +Linear_cell_complex +MacOSX +Maintenance +Matrix_search +Mesh_2 +Mesh_3 +Mesher_level +Minkowski_sum_2 +Minkowski_sum_3 +Modifier +Modular_arithmetic +Nef_2 +Nef_3 +Nef_S2 +NewKernel_d +Number_types +OpenNL +Optimal_transportation_reconstruction_2 +Optimisation_basic +Partition_2 +Periodic_2_triangulation_2 +Periodic_3_mesh_3 +Periodic_3_triangulation_3 +Periodic_4_hyperbolic_triangulation_2 +Point_set_2 +Point_set_3 +Point_set_processing_3 +Poisson_surface_reconstruction_3 +Polygon +Polygon_mesh_processing +Polygonal_surface_reconstruction +Polyhedron +Polyhedron_IO +Polyline_simplification_2 +Polynomial +Polytope_distance_d +Principal_component_analysis +Principal_component_analysis_LGPL +Profiling_tools +Property_map +QP_solver +Random_numbers +Ridges_3 +STL_Extension +Scale_space_reconstruction_3 +Scripts +SearchStructures +Segment_Delaunay_graph_2 +Segment_Delaunay_graph_Linf_2 +Set_movable_separability_2 +Shape_detection +Skin_surface_3 +Snap_rounding_2 +Solver_interface +Spatial_searching +Spatial_sorting +Straight_skeleton_2 +Stream_lines_2 +Stream_support +Subdivision_method_3 +Surface_mesh +Surface_mesh_approximation +Surface_mesh_deformation +Surface_mesh_parameterization +Surface_mesh_segmentation +Surface_mesh_shortest_path +Surface_mesh_simplification +Surface_mesh_skeletonization +Surface_mesh_topology +Surface_mesher +Surface_sweep_2 +TDS_2 +TDS_3 +Testsuite +Three +Triangulation +Triangulation_2 +Triangulation_3 +Union_find +Visibility_2 +Voronoi_diagram_2 +wininst diff --git a/AABB_tree/demo/AABB_tree/Scene.cpp b/AABB_tree/demo/AABB_tree/Scene.cpp index a0bc61b75d0..f96ac203526 100644 --- a/AABB_tree/demo/AABB_tree/Scene.cpp +++ b/AABB_tree/demo/AABB_tree/Scene.cpp @@ -590,7 +590,7 @@ void Scene::update_bbox() } void Scene::draw(CGAL::QGLViewer* viewer) -{ +{ if(!gl_init) initGL(); if(!are_buffers_initialized) diff --git a/AABB_tree/demo/AABB_tree/benchmarks.cpp b/AABB_tree/demo/AABB_tree/benchmarks.cpp index 364d19bc04e..742b07c9a8c 100644 --- a/AABB_tree/demo/AABB_tree/benchmarks.cpp +++ b/AABB_tree/demo/AABB_tree/benchmarks.cpp @@ -97,7 +97,7 @@ std::size_t Scene::nb_digits(std::size_t value) } // bench memory against number of facets in the tree -// the tree is reconstructed each timer in the mesh +// the tree is reconstructed each timer in the mesh // refinement loop void Scene::bench_memory() { @@ -166,8 +166,8 @@ void Scene::bench_construction() Facet_tree tree2(faces(*m_pPolyhedron).first, faces(*m_pPolyhedron).second,*m_pPolyhedron); double duration_construction_and_kdtree = time2.time(); - std::cout << m_pPolyhedron->size_of_facets() << "\t" - << duration_construction_alone << "\t" + std::cout << m_pPolyhedron->size_of_facets() << "\t" + << duration_construction_alone << "\t" << duration_construction_and_kdtree << std::endl; } } diff --git a/AABB_tree/doc/AABB_tree/Concepts/AABBTraits.h b/AABB_tree/doc/AABB_tree/Concepts/AABBTraits.h index a6348816d31..aacdc45fd36 100644 --- a/AABB_tree/doc/AABB_tree/Concepts/AABBTraits.h +++ b/AABB_tree/doc/AABB_tree/Concepts/AABBTraits.h @@ -17,34 +17,34 @@ The concept `AABBTraits` provides the geometric primitive types and methods for class AABBTraits { public: -/// \name Types +/// \name Types /// @{ /*! -Value type of the `Squared_distance` functor. -*/ -typedef unspecified_type FT; +Value type of the `Squared_distance` functor. +*/ +typedef unspecified_type FT; /*! -Type of a 3D point. -*/ -typedef unspecified_type Point_3; +Type of a 3D point. +*/ +typedef unspecified_type Point_3; /*! -Type of primitive. +Type of primitive. Must be a model of the concepts `AABBPrimitive` or `AABBPrimitiveWithSharedData`. -*/ -typedef unspecified_type Primitive; +*/ +typedef unspecified_type Primitive; /*! -Bounding box type. -*/ -typedef unspecified_type Bounding_box; +Bounding box type. +*/ +typedef unspecified_type Bounding_box; /*! enum required for axis selection - */ - enum Axis { + */ + enum Axis { CGAL_X_AXIS, CGAL_Y_AXIS, CGAL_Z_AXIS @@ -52,13 +52,13 @@ typedef unspecified_type Bounding_box; /*! 3D Point and Primitive Id type -*/ -typedef std::pair Point_and_primitive_id; +*/ +typedef std::pair Point_and_primitive_id; /*! -\deprecated +\deprecated This requirement is deprecated and is no longer needed. -*/ +*/ typedef std::pair Object_and_primitive_id; @@ -84,22 +84,22 @@ A functor object to split a range of primitives into two sub-ranges along the lo and have `Primitive` as value type. The operator is used for determining the primitives assigned to the two children nodes of a given node, assuming that the goal is to split the chosen axis dimension of the bounding box of the node. The primitives assigned to this node are passed as argument to the operator. It should modify the iterator range in such a way that its first half and its second half correspond to the two children nodes. -*/ -typedef unspecified_type Split_primitives; +*/ +typedef unspecified_type Split_primitives; /*! -A functor object to compute the bounding box of a set of primitives. Provides the operator: -`Bounding_box operator()(Input_iterator begin, Input_iterator beyond);` %Iterator type `InputIterator` must have `Primitive` as value type. -*/ -typedef unspecified_type Compute_bbox; +A functor object to compute the bounding box of a set of primitives. Provides the operator: +`Bounding_box operator()(Input_iterator begin, Input_iterator beyond);` %Iterator type `InputIterator` must have `Primitive` as value type. +*/ +typedef unspecified_type Compute_bbox; // remove as not used any where in the code: -// A functor object to specify the direction along which the bounding box should be split: +// A functor object to specify the direction along which the bounding box should be split: // `Axis operator()(const Bounding_box& bbox);` which returns the // direction used for splitting `bbox`. It is usually the axis aligned // with the longest edge of `bbox`. -// typedef unspecified_type Splitting_direction; +// typedef unspecified_type Splitting_direction; /// @} @@ -111,20 +111,20 @@ typedef unspecified_type Compute_bbox; /// @{ /*! -A functor object to compute intersection predicates between the query and the nodes of the tree. Provides the operators: +A functor object to compute intersection predicates between the query and the nodes of the tree. Provides the operators: - `bool operator()(const Query & q, const Bounding_box & box);` which returns `true` iff the query intersects the bounding box - `bool operator()(const Query & q, const Primitive & primitive);` which returns `true` iff the query intersects the primitive -*/ -typedef unspecified_type Do_intersect; +*/ +typedef unspecified_type Do_intersect; /*! -A functor object to compute the intersection of a query and a primitive. Provides the operator: -`boost::optional::%Type > operator()(const Query & q, const Primitive& primitive);` which returns the intersection as a pair composed of an object and a primitive id, iff the query intersects the primitive. +A functor object to compute the intersection of a query and a primitive. Provides the operator: +`boost::optional::%Type > operator()(const Query & q, const Primitive& primitive);` which returns the intersection as a pair composed of an object and a primitive id, iff the query intersects the primitive. \cgalHeading{Note on Backward Compatibility} Before the release 4.3 of \cgal, the return type of this function used to be `boost::optional`. -*/ -typedef unspecified_type Intersection; +*/ +typedef unspecified_type Intersection; /// @} @@ -135,68 +135,68 @@ typedef unspecified_type Intersection; /// @{ /*! -A functor object to compute distance comparisons between the query and the nodes of the tree. Provides the operators: +A functor object to compute distance comparisons between the query and the nodes of the tree. Provides the operators: - `bool operator()(const Query & query, const Bounding_box& box, const Point & closest);` which returns `true` iff the bounding box is closer to `query` than `closest` is - `bool operator()(const Query & query, const Primitive & primitive, const Point & closest);` which returns `true` iff `primitive` is closer to the `query` than `closest` is -*/ -typedef unspecified_type Compare_distance; +*/ +typedef unspecified_type Compare_distance; /*! -A functor object to compute closest point from the query on a primitive. Provides the operator: -`Point_3 operator()(const Query& query, const Primitive& primitive, const Point_3 & closest);` which returns the closest point to `query`, among `closest` and all points of the primitive. -*/ -typedef unspecified_type Closest_point; +A functor object to compute closest point from the query on a primitive. Provides the operator: +`Point_3 operator()(const Query& query, const Primitive& primitive, const Point_3 & closest);` which returns the closest point to `query`, among `closest` and all points of the primitive. +*/ +typedef unspecified_type Closest_point; /*! -A functor object to compute the squared distance between two points. Provides the operator: -`FT operator()(const Point& query, const Point_3 & p);` which returns the squared distance between `p` and `q`. -*/ -typedef unspecified_type Squared_distance; +A functor object to compute the squared distance between two points. Provides the operator: +`FT operator()(const Point& query, const Point_3 & p);` which returns the squared distance between `p` and `q`. +*/ +typedef unspecified_type Squared_distance; /*! A functor object to compare two points. Provides the operator: `bool operator()(const Point_3& p, const Point_3& q);}` which returns `true` if `p` is equal to `q`. */ typedef unspecified_type Equal_3; -/// @} +/// @} -/// \name Operations +/// \name Operations /// @{ /*! -Returns the primitive splitting functor. -*/ -Split_primitives split_primitives_object(); +Returns the primitive splitting functor. +*/ +Split_primitives split_primitives_object(); /*! -Returns the bounding box constructor. -*/ -Compute_bbox compute_bbox_object(); +Returns the bounding box constructor. +*/ +Compute_bbox compute_bbox_object(); /*! -Returns the intersection detection functor. -*/ -Do_intersect do_intersect_object(); +Returns the intersection detection functor. +*/ +Do_intersect do_intersect_object(); /*! -Returns the intersection constructor. -*/ -Intersection intersection_object(); +Returns the intersection constructor. +*/ +Intersection intersection_object(); /*! -Returns the distance comparison functor. -*/ -Compare_distance compare_distance_object(); +Returns the distance comparison functor. +*/ +Compare_distance compare_distance_object(); /*! -Returns the closest point constructor. -*/ -Closest_point closest_point_object(); +Returns the closest point constructor. +*/ +Closest_point closest_point_object(); /*! Returns the squared distance functor. -*/ -Squared_distance squared_distance_object(); +*/ +Squared_distance squared_distance_object(); /*! Returns the equal functor. diff --git a/AABB_tree/examples/AABB_tree/AABB_halfedge_graph_edge_example.cpp b/AABB_tree/examples/AABB_tree/AABB_halfedge_graph_edge_example.cpp index 7767ba735c0..57eade14b28 100644 --- a/AABB_tree/examples/AABB_tree/AABB_halfedge_graph_edge_example.cpp +++ b/AABB_tree/examples/AABB_tree/AABB_halfedge_graph_edge_example.cpp @@ -23,8 +23,8 @@ void run(const HalfedgeGraph& graph){ typename Kernel::Point_3 q(0.0, 1.0, 0.0); typename Kernel::Point_3 r(0.0, 0.0, 1.0); - // constructs the AABB tree and the internal search tree for - // efficient distance queries. + // constructs the AABB tree and the internal search tree for + // efficient distance queries. Tree tree( CGAL::edges(graph).first, CGAL::edges(graph).second, graph); @@ -39,7 +39,7 @@ void run(const HalfedgeGraph& graph){ typename Kernel::Point_3 point_query(2.0, 2.0, 2.0); typename Kernel::Point_3 closest = tree.closest_point(point_query); - std::cerr << "closest point is: " << closest << std::endl; + std::cerr << "closest point is: " << closest << std::endl; } int main() @@ -50,7 +50,7 @@ int main() Point s(0.0, 0.0, 0.0); Polyhedron polyhedron; polyhedron.make_tetrahedron(p, q, r, s); - + run(polyhedron); return EXIT_SUCCESS; } diff --git a/AABB_tree/examples/AABB_tree/AABB_polyhedron_edge_example.cpp b/AABB_tree/examples/AABB_tree/AABB_polyhedron_edge_example.cpp index cac955a5b8f..8e8c776032c 100644 --- a/AABB_tree/examples/AABB_tree/AABB_polyhedron_edge_example.cpp +++ b/AABB_tree/examples/AABB_tree/AABB_polyhedron_edge_example.cpp @@ -26,7 +26,7 @@ int main() Polyhedron polyhedron; polyhedron.make_tetrahedron(p, q, r, s); - // constructs the AABB tree and the internal search tree for + // constructs the AABB tree and the internal search tree for // efficient distance queries. Tree tree( CGAL::edges(polyhedron).first, CGAL::edges(polyhedron).second, 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 bb9ad89e463..5da2e15bd84 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 @@ -28,7 +28,7 @@ int main() Polyhedron polyhedron; polyhedron.make_tetrahedron(p, q, r, s); - // constructs AABB tree and computes internal KD-tree + // constructs AABB tree and computes internal KD-tree // data structure to accelerate distance queries Tree tree(faces(polyhedron).first, faces(polyhedron).second, polyhedron); @@ -49,7 +49,7 @@ int main() 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()->vertex()->point() << " , " << f->halfedge()->next()->vertex()->point() << " , " << f->halfedge()->next()->next()->vertex()->point() << " )" << std::endl; diff --git a/AABB_tree/examples/AABB_tree/AABB_segment_3_example.cpp b/AABB_tree/examples/AABB_tree/AABB_segment_3_example.cpp index 95e8c1c7664..73b4d56e2d0 100644 --- a/AABB_tree/examples/AABB_tree/AABB_segment_3_example.cpp +++ b/AABB_tree/examples/AABB_tree/AABB_segment_3_example.cpp @@ -33,7 +33,7 @@ int main() segments.push_back(Segment(a,c)); segments.push_back(Segment(c,d)); - // constructs the AABB tree and the internal search tree for + // constructs the AABB tree and the internal search tree for // efficient distance computations. Tree tree(segments.begin(),segments.end()); @@ -47,7 +47,7 @@ int main() std::cout << tree.number_of_intersected_primitives(triangle_query) << " intersections(s) with triangle" << std::endl; - // computes the closest point from a point query + // computes the closest point from a point query Point point_query(2.0, 2.0, 2.0); Point closest = tree.closest_point(point_query); diff --git a/AABB_tree/include/CGAL/AABB_face_graph_triangle_primitive.h b/AABB_tree/include/CGAL/AABB_face_graph_triangle_primitive.h index a8b1cca343a..619b5a027e2 100644 --- a/AABB_tree/include/CGAL/AABB_face_graph_triangle_primitive.h +++ b/AABB_tree/include/CGAL/AABB_face_graph_triangle_primitive.h @@ -96,7 +96,7 @@ class AABB_face_graph_triangle_primitive { return std::make_pair(fd, &fg); } - + public: #ifdef DOXYGEN_RUNNING /// \name Types @@ -115,7 +115,7 @@ public: - `std::pair::%face_descriptor, FaceGraph>` if `OneFaceGraphPerTree` is `CGAL::Tag_false` */ unspecified_type Id; - + /// @} /*! diff --git a/AABB_tree/include/CGAL/AABB_halfedge_graph_segment_primitive.h b/AABB_tree/include/CGAL/AABB_halfedge_graph_segment_primitive.h index 92596a813f6..1010525d5c3 100644 --- a/AABB_tree/include/CGAL/AABB_halfedge_graph_segment_primitive.h +++ b/AABB_tree/include/CGAL/AABB_halfedge_graph_segment_primitive.h @@ -47,7 +47,7 @@ namespace CGAL { * and `AABBPrimitiveWithSharedData` if `OneHalfedgeGraphPerTree` is `CGAL::Tag_true`. * * \tparam HalfedgeGraph is a model of the halfedge graph concept. - * as key type and a \cgal Kernel `Point_3` as value type. + * as key type and a \cgal Kernel `Point_3` as value type. * \tparam VertexPointPMap is a property map with `boost::graph_traits::%vertex_descriptor`. * The default is `typename boost::property_map< HalfedgeGraph,vertex_point_t>::%const_type`. * \tparam OneHalfedgeGraphPerTree is either `CGAL::Tag_true` or `CGAL::Tag_false`. diff --git a/AABB_tree/include/CGAL/AABB_tree.h b/AABB_tree/include/CGAL/AABB_tree.h index 99dfd89f7f9..0216405563c 100644 --- a/AABB_tree/include/CGAL/AABB_tree.h +++ b/AABB_tree/include/CGAL/AABB_tree.h @@ -38,7 +38,7 @@ namespace CGAL { /// \addtogroup PkgAABBTreeRef /// @{ - /** + /** * Class AABB_tree is a static data structure for efficient * intersection and distance computations in 3D. It builds a * hierarchy of axis-aligned bounding boxes (an AABB tree) from a set @@ -51,41 +51,41 @@ namespace CGAL { * \sa `AABBPrimitive` * */ - template - class AABB_tree - { - private: - // internal KD-tree used to accelerate the distance queries - typedef AABB_search_tree Search_tree; + template + class AABB_tree + { + private: + // internal KD-tree used to accelerate the distance queries + typedef AABB_search_tree Search_tree; - // type of the primitives container - typedef std::vector Primitives; + // type of the primitives container + typedef std::vector Primitives; - public: + public: typedef AABBTraits AABB_traits; - + /// \name Types ///@{ /// Number type returned by the distance queries. - typedef typename AABBTraits::FT FT; + typedef typename AABBTraits::FT FT; /// Type of 3D point. - typedef typename AABBTraits::Point_3 Point; + typedef typename AABBTraits::Point_3 Point; /// Type of input primitive. - typedef typename AABBTraits::Primitive Primitive; - /// Identifier for a primitive in the tree. - typedef typename Primitive::Id Primitive_id; - /// Unsigned integral size type. - typedef typename Primitives::size_type size_type; + typedef typename AABBTraits::Primitive Primitive; + /// Identifier for a primitive in the tree. + typedef typename Primitive::Id Primitive_id; + /// Unsigned integral size type. + typedef typename Primitives::size_type size_type; /// Type of bounding box. - typedef typename AABBTraits::Bounding_box Bounding_box; + typedef typename AABBTraits::Bounding_box Bounding_box; /// 3D Point and Primitive Id type - typedef typename AABBTraits::Point_and_primitive_id Point_and_primitive_id; - /// \deprecated - typedef typename AABBTraits::Object_and_primitive_id Object_and_primitive_id; + typedef typename AABBTraits::Point_and_primitive_id Point_and_primitive_id; + /// \deprecated + typedef typename AABBTraits::Object_and_primitive_id Object_and_primitive_id; /*! An alias to `AABBTraits::Intersection_and_primitive_id` @@ -100,10 +100,10 @@ namespace CGAL { }; #endif - + ///@} - public: + public: /// \name Creation ///@{ @@ -119,8 +119,8 @@ namespace CGAL { * It is equivalent to constructing an empty tree and calling `insert(first,last,t...)`. * The tree stays empty if the memory allocation is not successful. */ - template - AABB_tree(InputIterator first, InputIterator beyond,T&& ...); + template + AABB_tree(InputIterator first, InputIterator beyond,T&& ...); /// After one or more calls to `insert()` the internal data /// structure of the tree must be reconstructed. This procedure @@ -139,12 +139,12 @@ namespace CGAL { #endif ///@} - /// \name Operations - ///@{ + /// \name Operations + ///@{ /// Equivalent to calling `clear()` and then `insert(first,last,t...)`. - template - void rebuild(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond,T&& ...); + template + void rebuild(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond,T&& ...); /// Add a sequence of primitives to the set of primitives of the AABB tree. @@ -153,51 +153,51 @@ namespace CGAL { /// `Primitive(%InputIterator, T...)`. If `Primitive` is a model of the concept /// `AABBPrimitiveWithSharedData`, a call to `AABBTraits::set_shared_data(t...)` /// is made using the internally stored traits. - template - void insert(InputIterator first, InputIterator beyond,T&& ...); + template + void insert(InputIterator first, InputIterator beyond,T&& ...); /// Adds a primitive to the set of primitives of the tree. inline void insert(const Primitive& p); - /// Clears and destroys the tree. - ~AABB_tree() - { - clear(); - } + /// Clears and destroys the tree. + ~AABB_tree() + { + clear(); + } /// Returns a const reference to the internally stored traits class. const AABBTraits& traits() const{ - return m_traits; + return m_traits; } - - /// Clears the tree. - void clear() - { - // clear AABB tree + + /// Clears the tree. + void clear() + { + // clear AABB tree clear_nodes(); - m_primitives.clear(); - clear_search_tree(); - m_default_search_tree_constructed = true; - } + m_primitives.clear(); + clear_search_tree(); + m_default_search_tree_constructed = true; + } + + /// Returns the axis-aligned bounding box of the whole tree. + /// \pre `!empty()` + const Bounding_box bbox() const { + CGAL_precondition(!empty()); + if(size() > 1) + return root_node()->bbox(); + else + return traits().compute_bbox_object()(m_primitives.begin(), + m_primitives.end()); + } - /// Returns the axis-aligned bounding box of the whole tree. - /// \pre `!empty()` - const Bounding_box bbox() const { - CGAL_precondition(!empty()); - if(size() > 1) - return root_node()->bbox(); - else - return traits().compute_bbox_object()(m_primitives.begin(), - m_primitives.end()); - } - /// Returns the number of primitives in the tree. - size_type size() const { return m_primitives.size(); } - - /// Returns \c true, iff the tree contains no primitive. - bool empty() const { return m_primitives.empty(); } - ///@} + size_type size() const { return m_primitives.size(); } - private: + /// Returns \c true, iff the tree contains no primitive. + bool empty() const { return m_primitives.empty(); } + ///@} + + private: template void set_primitive_data_impl(CGAL::Boolean_tag,T ... ){} template @@ -209,27 +209,27 @@ namespace CGAL { set_primitive_data_impl(CGAL::Boolean_tag::value>(),std::forward(t)...); } - bool build_kd_tree() const; - template - bool build_kd_tree(ConstPointIterator first, ConstPointIterator beyond) const; + bool build_kd_tree() const; + template + bool build_kd_tree(ConstPointIterator first, ConstPointIterator beyond) const; public: /// \name Intersection Tests ///@{ - /// Returns `true`, iff the query intersects at least one of - /// the input primitives. \tparam Query must be a type for - /// which `do_intersect` predicates are - /// defined in the traits class `AABBTraits`. - template - bool do_intersect(const Query& query) const; + /// Returns `true`, iff the query intersects at least one of + /// the input primitives. \tparam Query must be a type for + /// which `do_intersect` predicates are + /// defined in the traits class `AABBTraits`. + template + bool do_intersect(const Query& query) const; /// Returns the number of primitives intersected by the /// query. \tparam Query must be a type for which /// `do_intersect` predicates are defined /// in the traits class `AABBTraits`. - template - size_type number_of_intersected_primitives(const Query& query) const; + template + size_type number_of_intersected_primitives(const Query& query) const; /// Outputs to the iterator the list of all intersected primitives /// ids. This function does not compute the intersection points @@ -237,12 +237,12 @@ public: /// function below. \tparam Query must be a type for which /// `do_intersect` predicates are defined /// in the traits class `AABBTraits`. - template - OutputIterator all_intersected_primitives(const Query& query, OutputIterator out) const; + template + OutputIterator all_intersected_primitives(const Query& query, OutputIterator out) const; - /// Returns the intersected primitive id that is encountered first - /// in the tree traversal, iff + /// Returns the intersected primitive id that is encountered first + /// in the tree traversal, iff /// the query intersects at least one of the input primitives. No /// particular order is guaranteed over the tree traversal, such /// that, e.g, the primitive returned is not necessarily the @@ -250,8 +250,8 @@ public: /// must be a type for which /// `do_intersect` predicates are defined /// in the traits class `AABBTraits`. - template - boost::optional any_intersected_primitive(const Query& query) const; + template + boost::optional any_intersected_primitive(const Query& query) const; ///@} /// \name Intersections @@ -263,18 +263,18 @@ public: /// the iterator. `do_intersect()` /// predicates and intersections must be defined for `Query` /// in the `AABBTraits` class. - template - OutputIterator all_intersections(const Query& query, OutputIterator out) const; + template + OutputIterator all_intersections(const Query& query, OutputIterator out) const; - /// Returns the intersection that is encountered first - /// in the tree traversal. No particular + /// Returns the intersection that is encountered first + /// in the tree traversal. No particular /// order is guaranteed over the tree traversal, e.g, the /// primitive returned is not necessarily the closest from the /// source point of a ray query. Type `Query` must be a type /// for which `do_intersect` predicates /// and intersections are defined in the traits class AABBTraits. - template + template boost::optional< typename Intersection_and_primitive_id::Type > any_intersection(const Query& query) const; @@ -345,8 +345,8 @@ public: /// `accelerate_distance_queries()` should be called before the /// first distance query, so that an internal secondary search /// structure is build, for improving performance. - /// \pre `!empty()` - FT squared_distance(const Point& query) const; + /// \pre `!empty()` + FT squared_distance(const Point& query) const; /// Returns the point in the union of all input primitives which /// is closest to the query. In case there are several closest @@ -355,24 +355,24 @@ public: /// called before the first distance query, so that an internal /// secondary search structure is build, for improving /// performance. - /// \pre `!empty()` - Point closest_point(const Point& query) const; + /// \pre `!empty()` + Point closest_point(const Point& query) const; + - /// Returns a `Point_and_primitive_id` which realizes the /// smallest distance between the query point and all input /// primitives. Method `accelerate_distance_queries()` should be /// called before the first distance query, so that an internal /// secondary search structure is build, for improving /// performance. - /// \pre `!empty()` - Point_and_primitive_id closest_point_and_primitive(const Point& query) const; + /// \pre `!empty()` + Point_and_primitive_id closest_point_and_primitive(const Point& query) const; ///@} /// \name Accelerating the Distance Queries - /// + /// /// In the following paragraphs, we discuss details of the /// implementation of the distance queries. We explain the /// internal use of hints, how the user can pass his own hints to @@ -387,7 +387,7 @@ public: /// exact specification of these internal algorithms is that they /// minimize the distance to the object composed of the union of /// the primitives and the hint. - /// It follows that + /// It follows that /// - in order to return the exact distance to the set of /// primitives, the algorithms need the hint to be exactly on the /// primitives; @@ -426,173 +426,173 @@ public: /// relevant in some cases. ///@{ - /// Constructs internal search tree from - /// a point set taken on the internal primitives - /// returns `true` iff successful memory allocation - bool accelerate_distance_queries() const; - ///Turns off the lazy construction of the internal search tree. - void do_not_accelerate_distance_queries() const; + /// Constructs internal search tree from + /// a point set taken on the internal primitives + /// returns `true` iff successful memory allocation + bool accelerate_distance_queries() const; + ///Turns off the lazy construction of the internal search tree. + void do_not_accelerate_distance_queries() const; /// Constructs an internal KD-tree containing the specified point /// set, to be used as the set of potential hints for accelerating /// the distance queries. /// \tparam ConstPointIterator is an iterator with /// value type `Point_and_primitive_id`. - template - bool accelerate_distance_queries(ConstPointIterator first, ConstPointIterator beyond) const - { - #ifdef CGAL_HAS_THREADS - //this ensures that this is done once at a time - CGAL_SCOPED_LOCK(kd_tree_mutex); - #endif - clear_search_tree(); - m_default_search_tree_constructed = false; // not a default kd-tree - return build_kd_tree(first,beyond); - } - + template + bool accelerate_distance_queries(ConstPointIterator first, ConstPointIterator beyond) const + { + #ifdef CGAL_HAS_THREADS + //this ensures that this is done once at a time + CGAL_SCOPED_LOCK(kd_tree_mutex); + #endif + clear_search_tree(); + m_default_search_tree_constructed = false; // not a default kd-tree + return build_kd_tree(first,beyond); + } + /// Returns the minimum squared distance between the query point /// and all input primitives. The internal KD-tree is not used. - /// \pre `!empty()` - FT squared_distance(const Point& query, const Point& hint) const; + /// \pre `!empty()` + FT squared_distance(const Point& query, const Point& hint) const; /// Returns the point in the union of all input primitives which /// is closest to the query. In case there are several closest /// points, one arbitrarily chosen closest point is returned. The /// internal KD-tree is not used. - /// \pre `!empty()` - Point closest_point(const Point& query, const Point& hint) const; - + /// \pre `!empty()` + Point closest_point(const Point& query, const Point& hint) const; + /// Returns a `Point_and_primitive_id` which realizes the /// smallest distance between the query point and all input /// primitives. The internal KD-tree is not used. - /// \pre `!empty()` - Point_and_primitive_id closest_point_and_primitive(const Point& query, const Point_and_primitive_id& hint) const; + /// \pre `!empty()` + Point_and_primitive_id closest_point_and_primitive(const Point& query, const Point_and_primitive_id& hint) const; ///@} - private: + private: template friend class AABB_ray_intersection; // clear nodes void clear_nodes() { - if( size() > 1 ) { - delete [] m_p_root_node; - } - m_p_root_node = nullptr; + if( size() > 1 ) { + delete [] m_p_root_node; + } + m_p_root_node = nullptr; } - // clears internal KD tree - void clear_search_tree() const - { - if ( m_search_tree_constructed ) - { - CGAL_assertion( m_p_search_tree!=nullptr ); - delete m_p_search_tree; - m_p_search_tree = nullptr; - m_search_tree_constructed = false; + // clears internal KD tree + void clear_search_tree() const + { + if ( m_search_tree_constructed ) + { + CGAL_assertion( m_p_search_tree!=nullptr ); + delete m_p_search_tree; + m_p_search_tree = nullptr; + m_search_tree_constructed = false; } - } + } - public: + public: /// \internal - template - void traversal(const Query& query, Traversal_traits& traits) const - { - switch(size()) - { - case 0: - break; - case 1: - traits.intersection(query, singleton_data()); - break; - default: // if(size() >= 2) - root_node()->template traversal(query, traits, m_primitives.size()); - } - } + template + void traversal(const Query& query, Traversal_traits& traits) const + { + switch(size()) + { + case 0: + break; + case 1: + traits.intersection(query, singleton_data()); + break; + default: // if(size() >= 2) + root_node()->template traversal(query, traits, m_primitives.size()); + } + } - private: - typedef AABB_node Node; + private: + typedef AABB_node Node; - public: - // returns a point which must be on one primitive - Point_and_primitive_id any_reference_point_and_id() const - { - CGAL_assertion(!empty()); - return Point_and_primitive_id( + public: + // returns a point which must be on one primitive + Point_and_primitive_id any_reference_point_and_id() const + { + CGAL_assertion(!empty()); + return Point_and_primitive_id( internal::Primitive_helper::get_reference_point(m_primitives[0],m_traits), m_primitives[0].id() ); - } + } - public: - Point_and_primitive_id best_hint(const Point& query) const - { - if(m_search_tree_constructed) + public: + Point_and_primitive_id best_hint(const Point& query) const + { + if(m_search_tree_constructed) { - return m_p_search_tree->closest_point(query); + return m_p_search_tree->closest_point(query); } - else - return this->any_reference_point_and_id(); - } - - //! Returns the datum (geometric object) represented `p`. -#ifndef DOXYGEN_RUNNING - typename internal::Primitive_helper::Datum_type -#else - typename AABBTraits::Primitive::Datum_reference -#endif - datum(Primitive& p)const - { - return internal::Primitive_helper:: - get_datum(p, this->traits()); - } + else + return this->any_reference_point_and_id(); + } - private: + //! Returns the datum (geometric object) represented `p`. +#ifndef DOXYGEN_RUNNING + typename internal::Primitive_helper::Datum_type +#else + typename AABBTraits::Primitive::Datum_reference +#endif + datum(Primitive& p)const + { + return internal::Primitive_helper:: + get_datum(p, this->traits()); + } + + private: //Traits class AABBTraits m_traits; - // set of input primitives - Primitives m_primitives; - // single root node - Node* m_p_root_node; + // set of input primitives + Primitives m_primitives; + // single root node + Node* m_p_root_node; #ifdef CGAL_HAS_THREADS mutable CGAL_MUTEX internal_tree_mutex;//mutex used to protect const calls inducing build() mutable CGAL_MUTEX kd_tree_mutex;//mutex used to protect calls to accelerate_distance_queries #endif - + const Node* root_node() const { - CGAL_assertion(size() > 1); + CGAL_assertion(size() > 1); if(m_need_build){ #ifdef CGAL_HAS_THREADS //this ensures that build() will be called once CGAL_SCOPED_LOCK(internal_tree_mutex); if(m_need_build) #endif - const_cast< AABB_tree* >(this)->build(); + const_cast< AABB_tree* >(this)->build(); } return m_p_root_node; } - const Primitive& singleton_data() const { - CGAL_assertion(size() == 1); - return *m_primitives.begin(); - } + const Primitive& singleton_data() const { + CGAL_assertion(size() == 1); + return *m_primitives.begin(); + } - // search KD-tree - mutable const Search_tree* m_p_search_tree; - mutable bool m_search_tree_constructed; + // search KD-tree + mutable const Search_tree* m_p_search_tree; + mutable bool m_search_tree_constructed; mutable bool m_default_search_tree_constructed; // indicates whether the internal kd-tree should be built bool m_need_build; - private: - // Disabled copy constructor & assignment operator - typedef AABB_tree Self; - AABB_tree(const Self& src); - Self& operator=(const Self& src); + private: + // Disabled copy constructor & assignment operator + typedef AABB_tree Self; + AABB_tree(const Self& src); + Self& operator=(const Self& src); - }; // end class AABB_tree + }; // end class AABB_tree /// @} @@ -607,54 +607,54 @@ public: , m_need_build(false) {} - template - template - AABB_tree::AABB_tree(ConstPrimitiveIterator first, + template + template + AABB_tree::AABB_tree(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond, T&& ... t) - : m_traits() + : m_traits() , m_primitives() - , m_p_root_node(nullptr) - , m_p_search_tree(nullptr) - , m_search_tree_constructed(false) + , m_p_root_node(nullptr) + , m_p_search_tree(nullptr) + , m_search_tree_constructed(false) , m_default_search_tree_constructed(true) , m_need_build(false) - { - // Insert each primitive into tree + { + // Insert each primitive into tree insert(first, beyond,std::forward(t)...); - } - - template - template - void AABB_tree::insert(ConstPrimitiveIterator first, + } + + template + template + void AABB_tree::insert(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond, T&& ... t) - { - set_shared_data(std::forward(t)...); - while(first != beyond) - { - m_primitives.push_back(Primitive(first,std::forward(t)...)); - ++first; - } + { + set_shared_data(std::forward(t)...); + while(first != beyond) + { + m_primitives.push_back(Primitive(first,std::forward(t)...)); + ++first; + } m_need_build = true; } - + // Clears tree and insert a set of primitives - template - template - void AABB_tree::rebuild(ConstPrimitiveIterator first, + template + template + void AABB_tree::rebuild(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond, T&& ... t) - { - // cleanup current tree and internal KD tree - clear(); + { + // cleanup current tree and internal KD tree + clear(); - // inserts primitives + // inserts primitives insert(first, beyond,std::forward(t)...); build(); - } - + } + template template void AABB_tree::build(T&& ... t) @@ -663,141 +663,141 @@ public: build(); } - template - void AABB_tree::insert(const Primitive& p) - { + template + void AABB_tree::insert(const Primitive& p) + { m_primitives.push_back(p); m_need_build = true; } - // Build the data structure, after calls to insert(..) - template - void AABB_tree::build() - { + // Build the data structure, after calls to insert(..) + template + void AABB_tree::build() + { clear_nodes(); if(m_primitives.size() > 1) { - // allocates tree nodes - m_p_root_node = new Node[m_primitives.size()-1](); - if(m_p_root_node == nullptr) - { - std::cerr << "Unable to allocate memory for AABB tree" << std::endl; - CGAL_assertion(m_p_root_node != nullptr); - m_primitives.clear(); - clear(); - } + // allocates tree nodes + m_p_root_node = new Node[m_primitives.size()-1](); + if(m_p_root_node == nullptr) + { + std::cerr << "Unable to allocate memory for AABB tree" << std::endl; + CGAL_assertion(m_p_root_node != nullptr); + m_primitives.clear(); + clear(); + } - // constructs the tree - m_p_root_node->expand(m_primitives.begin(), m_primitives.end(), - m_primitives.size(), m_traits); - } - - - // In case the users has switched on the accelerated distance query - // data structure with the default arguments, then it has to be - // /built/rebuilt. - if(m_default_search_tree_constructed && !empty()){ - build_kd_tree(); - } - m_need_build = false; - } - // constructs the search KD tree from given points - // to accelerate the distance queries - template - bool AABB_tree::build_kd_tree() const - { - // iterate over primitives to get reference points on them - std::vector points; - points.reserve(m_primitives.size()); - typename Primitives::const_iterator it; - for(it = m_primitives.begin(); it != m_primitives.end(); ++it) - points.push_back( Point_and_primitive_id( - internal::Primitive_helper::get_reference_point( - *it,m_traits), it->id() ) ); - - // clears current KD tree - clear_search_tree(); - bool res = build_kd_tree(points.begin(), points.end()); - m_default_search_tree_constructed = true; - return res; - } - - // constructs the search KD tree from given points - // to accelerate the distance queries - template - template - bool AABB_tree::build_kd_tree(ConstPointIterator first, - ConstPointIterator beyond) const - { - m_p_search_tree = new Search_tree(first, beyond); - m_default_search_tree_constructed = true; - if(m_p_search_tree != nullptr) - { - m_search_tree_constructed = true; - return true; - } - else - { - std::cerr << "Unable to allocate memory for accelerating distance queries" << std::endl; - return false; + // constructs the tree + m_p_root_node->expand(m_primitives.begin(), m_primitives.end(), + m_primitives.size(), m_traits); } - } - - template - void AABB_tree::do_not_accelerate_distance_queries()const - { - clear_search_tree(); - m_default_search_tree_constructed = false; - } - // constructs the search KD tree from internal primitives - template - bool AABB_tree::accelerate_distance_queries() const - { - if(m_primitives.empty()) return true; - if (m_default_search_tree_constructed) - { - if (!m_need_build) return m_search_tree_constructed; - return true; // default return type, no tree built - } + // In case the users has switched on the accelerated distance query + // data structure with the default arguments, then it has to be + // /built/rebuilt. + if(m_default_search_tree_constructed && !empty()){ + build_kd_tree(); + } + m_need_build = false; + } + // constructs the search KD tree from given points + // to accelerate the distance queries + template + bool AABB_tree::build_kd_tree() const + { + // iterate over primitives to get reference points on them + std::vector points; + points.reserve(m_primitives.size()); + typename Primitives::const_iterator it; + for(it = m_primitives.begin(); it != m_primitives.end(); ++it) + points.push_back( Point_and_primitive_id( + internal::Primitive_helper::get_reference_point( + *it,m_traits), it->id() ) ); - if(!m_need_build) // the tree was already built, build the kd-tree - { - #ifdef CGAL_HAS_THREADS - //this ensures that this function will be done once - CGAL_SCOPED_LOCK(kd_tree_mutex); - #endif - if (!m_need_build) - { - // clears current KD tree - clear_search_tree(); - bool res = build_kd_tree(); - m_default_search_tree_constructed = true; - return res; - }; - } - m_default_search_tree_constructed = true; - return m_search_tree_constructed; - } + // clears current KD tree + clear_search_tree(); + bool res = build_kd_tree(points.begin(), points.end()); + m_default_search_tree_constructed = true; + return res; + } - template - template - bool - AABB_tree::do_intersect(const Query& query) const - { + // constructs the search KD tree from given points + // to accelerate the distance queries + template + template + bool AABB_tree::build_kd_tree(ConstPointIterator first, + ConstPointIterator beyond) const + { + m_p_search_tree = new Search_tree(first, beyond); + m_default_search_tree_constructed = true; + if(m_p_search_tree != nullptr) + { + m_search_tree_constructed = true; + return true; + } + else + { + std::cerr << "Unable to allocate memory for accelerating distance queries" << std::endl; + return false; + } + } + + template + void AABB_tree::do_not_accelerate_distance_queries()const + { + clear_search_tree(); + m_default_search_tree_constructed = false; + } + + + // constructs the search KD tree from internal primitives + template + bool AABB_tree::accelerate_distance_queries() const + { + if(m_primitives.empty()) return true; + if (m_default_search_tree_constructed) + { + if (!m_need_build) return m_search_tree_constructed; + return true; // default return type, no tree built + } + + if(!m_need_build) // the tree was already built, build the kd-tree + { + #ifdef CGAL_HAS_THREADS + //this ensures that this function will be done once + CGAL_SCOPED_LOCK(kd_tree_mutex); + #endif + if (!m_need_build) + { + // clears current KD tree + clear_search_tree(); + bool res = build_kd_tree(); + m_default_search_tree_constructed = true; + return res; + }; + } + m_default_search_tree_constructed = true; + return m_search_tree_constructed; + } + + template + template + bool + AABB_tree::do_intersect(const Query& query) const + { using namespace CGAL::internal::AABB_tree; typedef typename AABB_tree::AABB_traits AABBTraits; - Do_intersect_traits traversal_traits(m_traits); - this->traversal(query, traversal_traits); - return traversal_traits.is_intersection_found(); - } + Do_intersect_traits traversal_traits(m_traits); + this->traversal(query, traversal_traits); + return traversal_traits.is_intersection_found(); + } #ifndef DOXYGEN_RUNNING //To avoid doxygen to consider definition and declaration as 2 different functions (size_type causes problems) - template - template - typename AABB_tree::size_type - AABB_tree::number_of_intersected_primitives(const Query& query) const - { + template + template + typename AABB_tree::size_type + AABB_tree::number_of_intersected_primitives(const Query& query) const + { using namespace CGAL::internal::AABB_tree; using CGAL::internal::AABB_tree::Counting_output_iterator; typedef typename AABB_tree::AABB_traits AABBTraits; @@ -806,134 +806,134 @@ public: size_type counter = 0; Counting_iterator out(&counter); - Listing_primitive_traits traversal_traits(out,m_traits); - this->traversal(query, traversal_traits); - return counter; - } + this->traversal(query, traversal_traits); + return counter; + } #endif - template - template - OutputIterator - AABB_tree::all_intersected_primitives(const Query& query, - OutputIterator out) const - { + template + template + OutputIterator + AABB_tree::all_intersected_primitives(const Query& query, + OutputIterator out) const + { using namespace CGAL::internal::AABB_tree; typedef typename AABB_tree::AABB_traits AABBTraits; - Listing_primitive_traits traversal_traits(out,m_traits); - this->traversal(query, traversal_traits); - return out; - } + this->traversal(query, traversal_traits); + return out; + } - template - template - OutputIterator - AABB_tree::all_intersections(const Query& query, - OutputIterator out) const - { + template + template + OutputIterator + AABB_tree::all_intersections(const Query& query, + OutputIterator out) const + { using namespace CGAL::internal::AABB_tree; typedef typename AABB_tree::AABB_traits AABBTraits; - Listing_intersection_traits traversal_traits(out,m_traits); - this->traversal(query, traversal_traits); - return out; - } + this->traversal(query, traversal_traits); + return out; + } - template - template + template + template boost::optional< typename AABB_tree::template Intersection_and_primitive_id::Type > - AABB_tree::any_intersection(const Query& query) const - { + AABB_tree::any_intersection(const Query& query) const + { using namespace CGAL::internal::AABB_tree; typedef typename AABB_tree::AABB_traits AABBTraits; - First_intersection_traits traversal_traits(m_traits); - this->traversal(query, traversal_traits); - return traversal_traits.result(); - } + First_intersection_traits traversal_traits(m_traits); + this->traversal(query, traversal_traits); + return traversal_traits.result(); + } - template - template - boost::optional::Primitive_id> - AABB_tree::any_intersected_primitive(const Query& query) const - { + template + template + boost::optional::Primitive_id> + AABB_tree::any_intersected_primitive(const Query& query) const + { using namespace CGAL::internal::AABB_tree; typedef typename AABB_tree::AABB_traits AABBTraits; - First_primitive_traits traversal_traits(m_traits); - this->traversal(query, traversal_traits); - return traversal_traits.result(); - } + First_primitive_traits traversal_traits(m_traits); + this->traversal(query, traversal_traits); + return traversal_traits.result(); + } - // closest point with user-specified hint - template - typename AABB_tree::Point - AABB_tree::closest_point(const Point& query, - const Point& hint) const - { - CGAL_precondition(!empty()); - typename Primitive::Id hint_primitive = m_primitives[0].id(); + // closest point with user-specified hint + template + typename AABB_tree::Point + AABB_tree::closest_point(const Point& query, + const Point& hint) const + { + CGAL_precondition(!empty()); + typename Primitive::Id hint_primitive = m_primitives[0].id(); using namespace CGAL::internal::AABB_tree; typedef typename AABB_tree::AABB_traits AABBTraits; - Projection_traits projection_traits(hint,hint_primitive,m_traits); - this->traversal(query, projection_traits); - return projection_traits.closest_point(); - } + Projection_traits projection_traits(hint,hint_primitive,m_traits); + this->traversal(query, projection_traits); + return projection_traits.closest_point(); + } - // closest point without hint, the search KD-tree is queried for the - // first closest neighbor point to get a hint - template - typename AABB_tree::Point - AABB_tree::closest_point(const Point& query) const - { - CGAL_precondition(!empty()); - const Point_and_primitive_id hint = best_hint(query); - return closest_point(query,hint.first); - } + // closest point without hint, the search KD-tree is queried for the + // first closest neighbor point to get a hint + template + typename AABB_tree::Point + AABB_tree::closest_point(const Point& query) const + { + CGAL_precondition(!empty()); + const Point_and_primitive_id hint = best_hint(query); + return closest_point(query,hint.first); + } - // squared distance with user-specified hint - template - typename AABB_tree::FT - AABB_tree::squared_distance(const Point& query, - const Point& hint) const - { - CGAL_precondition(!empty()); - const Point closest = this->closest_point(query, hint); - return Tr().squared_distance_object()(query, closest); - } + // squared distance with user-specified hint + template + typename AABB_tree::FT + AABB_tree::squared_distance(const Point& query, + const Point& hint) const + { + CGAL_precondition(!empty()); + const Point closest = this->closest_point(query, hint); + return Tr().squared_distance_object()(query, closest); + } - // squared distance without user-specified hint - template - typename AABB_tree::FT - AABB_tree::squared_distance(const Point& query) const - { - CGAL_precondition(!empty()); - const Point closest = this->closest_point(query); - return Tr().squared_distance_object()(query, closest); - } + // squared distance without user-specified hint + template + typename AABB_tree::FT + AABB_tree::squared_distance(const Point& query) const + { + CGAL_precondition(!empty()); + const Point closest = this->closest_point(query); + return Tr().squared_distance_object()(query, closest); + } - // closest point with user-specified hint - template - typename AABB_tree::Point_and_primitive_id - AABB_tree::closest_point_and_primitive(const Point& query) const - { - CGAL_precondition(!empty()); - return closest_point_and_primitive(query,best_hint(query)); - } + // closest point with user-specified hint + template + typename AABB_tree::Point_and_primitive_id + AABB_tree::closest_point_and_primitive(const Point& query) const + { + CGAL_precondition(!empty()); + return closest_point_and_primitive(query,best_hint(query)); + } - // closest point with user-specified hint - template - typename AABB_tree::Point_and_primitive_id - AABB_tree::closest_point_and_primitive(const Point& query, - const Point_and_primitive_id& hint) const - { - CGAL_precondition(!empty()); + // closest point with user-specified hint + template + typename AABB_tree::Point_and_primitive_id + AABB_tree::closest_point_and_primitive(const Point& query, + const Point_and_primitive_id& hint) const + { + CGAL_precondition(!empty()); using namespace CGAL::internal::AABB_tree; typedef typename AABB_tree::AABB_traits AABBTraits; - Projection_traits projection_traits(hint.first,hint.second,m_traits); - this->traversal(query, projection_traits); - return projection_traits.closest_point_and_primitive(); - } + Projection_traits projection_traits(hint.first,hint.second,m_traits); + this->traversal(query, projection_traits); + return projection_traits.closest_point_and_primitive(); + } } // end namespace CGAL diff --git a/AABB_tree/test/AABB_tree/aabb_test_empty_tree.cpp b/AABB_tree/test/AABB_tree/aabb_test_empty_tree.cpp index 3ba40764130..c10ea5f1acf 100644 --- a/AABB_tree/test/AABB_tree/aabb_test_empty_tree.cpp +++ b/AABB_tree/test/AABB_tree/aabb_test_empty_tree.cpp @@ -38,7 +38,7 @@ int main() tree.all_intersected_primitives(triangle_query, devnull); assert(!tree.any_intersected_primitive(triangle_query)); assert(!tree.any_intersection(triangle_query)); - //Cannot call tree.bbox(); + //Cannot call tree.bbox(); tree.build(); tree.clear(); //Cannot call tree.closest_*(...) diff --git a/AABB_tree/test/AABB_tree/aabb_test_singleton_tree.cpp b/AABB_tree/test/AABB_tree/aabb_test_singleton_tree.cpp index aaf49dbf12b..cc26689d64e 100644 --- a/AABB_tree/test/AABB_tree/aabb_test_singleton_tree.cpp +++ b/AABB_tree/test/AABB_tree/aabb_test_singleton_tree.cpp @@ -46,10 +46,10 @@ int main() tree.insert(segments.begin(), segments.end()); tree.build(); assert(tree.closest_point(Point(-0.1, -0.1, -0.1)) == Point(0, 0, 0)); - assert(tree.closest_point(Point(-0.1, -0.1, -0.1), Point(0, 0, 0)) == - Point(0, 0, 0)); + assert(tree.closest_point(Point(-0.1, -0.1, -0.1), Point(0, 0, 0)) == + Point(0, 0, 0)); assert(tree.closest_point_and_primitive(Point(-0.1, -0.1, -0.1)).second == - segments.begin()); + segments.begin()); // Too lazy to call closest_point_and_primitive with a hint. The API is // strange. --Laurent Rineau, 2013/01/16 assert(tree.do_intersect(plane_query) == true); diff --git a/BGL/doc/BGL/CGAL/HalfedgeDS_face_max_base_with_id.h b/BGL/doc/BGL/CGAL/HalfedgeDS_face_max_base_with_id.h index 0006a4332e8..c106f1d9644 100644 --- a/BGL/doc/BGL/CGAL/HalfedgeDS_face_max_base_with_id.h +++ b/BGL/doc/BGL/CGAL/HalfedgeDS_face_max_base_with_id.h @@ -4,26 +4,26 @@ namespace CGAL { /*! \ingroup BGLGraphExternalIndices -The class `HalfedgeDS_face_max_base_with_id` is a model of the `HalfedgeDSFace` -concept. +The class `HalfedgeDS_face_max_base_with_id` is a model of the `HalfedgeDSFace` +concept. -It is equivalent to `HalfedgeDS_face_base< Refs, Tag_true>` -with an added integer field which can be used to index faces -in \sc{Bgl} algorithms. -The class contains support for the incident halfedge pointer -and the required type definitions. -It can be used for deriving own faces. +It is equivalent to `HalfedgeDS_face_base< Refs, Tag_true>` +with an added integer field which can be used to index faces +in \sc{Bgl} algorithms. +The class contains support for the incident halfedge pointer +and the required type definitions. +It can be used for deriving own faces. -Note that the user is in charge to set the index correctly before -running a graph algorithm. +Note that the user is in charge to set the index correctly before +running a graph algorithm. -\tparam Refs must be an instantiation of a `HalfedgeDS`. +\tparam Refs must be an instantiation of a `HalfedgeDS`. \cgalModels `HalfedgeDSFace` -\sa `HalfedgeDS` -\sa `HalfedgeDSItems` -\sa `PolyhedronItems_3` +\sa `HalfedgeDS` +\sa `HalfedgeDSItems` +\sa `PolyhedronItems_3` \sa `CGAL::HalfedgeDS_min_items` \sa `CGAL::HalfedgeDS_vertex_min_base` \sa `CGAL::HalfedgeDS_halfedge_min_base` @@ -37,23 +37,23 @@ template< typename Refs > class HalfedgeDS_face_max_base_with_id { public: -/// \name Creation +/// \name Creation /// @{ /*! -%Default constructor. -*/ -HalfedgeDS_face_max_base_with_id(); +%Default constructor. +*/ +HalfedgeDS_face_max_base_with_id(); /*! -Returns the index. -*/ -int id() const; +Returns the index. +*/ +int id() const; /*! -Returns a reference to the index stored in the face. -*/ -int& id(); +Returns a reference to the index stored in the face. +*/ +int& id(); /// @} diff --git a/BGL/doc/BGL/CGAL/HalfedgeDS_halfedge_max_base_with_id.h b/BGL/doc/BGL/CGAL/HalfedgeDS_halfedge_max_base_with_id.h index b9d7f4142eb..965f513863a 100644 --- a/BGL/doc/BGL/CGAL/HalfedgeDS_halfedge_max_base_with_id.h +++ b/BGL/doc/BGL/CGAL/HalfedgeDS_halfedge_max_base_with_id.h @@ -4,24 +4,24 @@ namespace CGAL { /*! \ingroup BGLGraphExternalIndices -The class `HalfedgeDS_halfedge_max_base_with_id` is a model of the `HalfedgeDSHalfedge` -concept. -It is equivalent to `HalfedgeDS_halfedge_base< Refs, Tag_true, Tag_true, Tag_true>` with an added integer -field which can be used to index halfedges in \sc{Bgl} algorithms. -The class contains support for the previous, next, opposite, vertex and -face pointers and the required type definitions. -It can be used for deriving own halfedges. +The class `HalfedgeDS_halfedge_max_base_with_id` is a model of the `HalfedgeDSHalfedge` +concept. +It is equivalent to `HalfedgeDS_halfedge_base< Refs, Tag_true, Tag_true, Tag_true>` with an added integer +field which can be used to index halfedges in \sc{Bgl} algorithms. +The class contains support for the previous, next, opposite, vertex and +face pointers and the required type definitions. +It can be used for deriving own halfedges. -Note that the user is in charge to set the index correctly before -running a graph algorithm. +Note that the user is in charge to set the index correctly before +running a graph algorithm. -\tparam Refs must be an instantiation of a `HalfedgeDS`. +\tparam Refs must be an instantiation of a `HalfedgeDS`. \cgalModels `HalfedgeDSHalfedge` -\sa `HalfedgeDS` -\sa `HalfedgeDSItems` -\sa `PolyhedronItems_3` +\sa `HalfedgeDS` +\sa `HalfedgeDSItems` +\sa `PolyhedronItems_3` \sa `CGAL::HalfedgeDS_min_items` \sa `CGAL::HalfedgeDS_vertex_min_base` \sa `CGAL::HalfedgeDS_face_min_base` @@ -35,23 +35,23 @@ template< typename Refs > class HalfedgeDS_halfedge_max_base_with_id { public: -/// \name Creation +/// \name Creation /// @{ /*! -%Default constructor. -*/ -HalfedgeDS_halfedge_max_base_with_id(); +%Default constructor. +*/ +HalfedgeDS_halfedge_max_base_with_id(); /*! -Returns the index. -*/ -int id() const; +Returns the index. +*/ +int id() const; /*! -Returns a reference to the index stored in the halfedge. -*/ -int& id(); +Returns a reference to the index stored in the halfedge. +*/ +int& id(); /// @} diff --git a/BGL/doc/BGL/CGAL/HalfedgeDS_vertex_max_base_with_id.h b/BGL/doc/BGL/CGAL/HalfedgeDS_vertex_max_base_with_id.h index 565236d880e..328c65aa8c4 100644 --- a/BGL/doc/BGL/CGAL/HalfedgeDS_vertex_max_base_with_id.h +++ b/BGL/doc/BGL/CGAL/HalfedgeDS_vertex_max_base_with_id.h @@ -4,24 +4,24 @@ namespace CGAL { /*! \ingroup BGLGraphExternalIndices -The class `HalfedgeDS_vertex_max_base_with_id` is a model of the `HalfedgeDSVertex` -concept. It is -equivalent to `HalfedgeDS_vertex_base< Refs, Tag_true>` -with an added integer field which can be used to index vertices -in \sc{Bgl} algorithms.. -The class contains support for the point and the required type definitions. -It can be used for deriving own vertices. +The class `HalfedgeDS_vertex_max_base_with_id` is a model of the `HalfedgeDSVertex` +concept. It is +equivalent to `HalfedgeDS_vertex_base< Refs, Tag_true>` +with an added integer field which can be used to index vertices +in \sc{Bgl} algorithms.. +The class contains support for the point and the required type definitions. +It can be used for deriving own vertices. -Note that the user is in charge to set the index correctly before -running a graph algorithm. +Note that the user is in charge to set the index correctly before +running a graph algorithm. \tparam Refs must be an instantiation of a `HalfedgeDS`. \cgalModels `HalfedgeDSVertex` -\sa `HalfedgeDS` -\sa `HalfedgeDSItems` -\sa `PolyhedronItems_3` +\sa `HalfedgeDS` +\sa `HalfedgeDSItems` +\sa `PolyhedronItems_3` \sa `CGAL::HalfedgeDS_min_items` \sa `CGAL::HalfedgeDS_halfedge_min_base` \sa `CGAL::HalfedgeDS_face_min_base` @@ -35,23 +35,23 @@ template< typename Refs > class HalfedgeDS_vertex_max_base_with_id { public: -/// \name Creation +/// \name Creation /// @{ /*! -%Default constructor. -*/ -HalfedgeDS_vertex_max_base_with_id(); +%Default constructor. +*/ +HalfedgeDS_vertex_max_base_with_id(); /*! -Returns the index. -*/ -int id() const; +Returns the index. +*/ +int id() const; /*! -Returns a reference to the index stored in the vertex. -*/ -int& id(); +Returns a reference to the index stored in the vertex. +*/ +int& id(); /// @} diff --git a/BGL/doc/BGL/CGAL/Polyhedron_items_with_id_3.h b/BGL/doc/BGL/CGAL/Polyhedron_items_with_id_3.h index a64795aaa74..91f9fa32188 100644 --- a/BGL/doc/BGL/CGAL/Polyhedron_items_with_id_3.h +++ b/BGL/doc/BGL/CGAL/Polyhedron_items_with_id_3.h @@ -4,26 +4,26 @@ namespace CGAL { /*! \ingroup BGLGraphExternalIndices -The class `Polyhedron_items_with_id_3` is a model of the `PolyhedronItems_3` -concept. It provides definitions for vertices with points, halfedges, -and faces with plane equations, all of them with an additional integer +The class `Polyhedron_items_with_id_3` is a model of the `PolyhedronItems_3` +concept. It provides definitions for vertices with points, halfedges, +and faces with plane equations, all of them with an additional integer field which can be used to index the items in a \sc{Bgl} algorithm. -The polyhedron traits class must provide the respective types for -the point and the plane equation. -Vertices and facets both contain a halfedge handle to an incident -halfedge. +The polyhedron traits class must provide the respective types for +the point and the plane equation. +Vertices and facets both contain a halfedge handle to an incident +halfedge. -\cgalModels `PolyhedronItems_3` +\cgalModels `PolyhedronItems_3` \cgalHeading{Operations} -Supported as required by the `PolyhedronItems_3` concept. +Supported as required by the `PolyhedronItems_3` concept. \cgalHeading{Additional Methods in All Three Items} \code -int id() const; // Returns the index. -int& id(); // Returns a reference to the index stored in the item. +int id() const; // Returns the index. +int& id(); // Returns a reference to the index stored in the item. \endcode \sa `CGAL::Polyhedron_3` @@ -42,21 +42,21 @@ public: template < class Refs, class Traits> struct Vertex_wrapper { typedef typename Traits::Point_3 Point; - typedef CGAL::Tag_true Supports_vertex_point; + typedef CGAL::Tag_true Supports_vertex_point; }; template < class Refs, class Traits> struct Face_wrapper { typedef typename Traits::Plane_3 Plane; - typedef CGAL::Tag_true Supports_face_plane; + typedef CGAL::Tag_true Supports_face_plane; }; - /// \name Creation + /// \name Creation /// @{ /*! - %Default constructor. - */ - Polyhedron_items_with_id_3(); + %Default constructor. + */ + Polyhedron_items_with_id_3(); /// @} }; /* end Polyhedron_items_with_id_3 */ diff --git a/BGL/doc/BGL/CGAL/Triangulation_face_base_with_id_2.h b/BGL/doc/BGL/CGAL/Triangulation_face_base_with_id_2.h index 15827d6758b..e1b380ac939 100644 --- a/BGL/doc/BGL/CGAL/Triangulation_face_base_with_id_2.h +++ b/BGL/doc/BGL/CGAL/Triangulation_face_base_with_id_2.h @@ -27,18 +27,18 @@ template< typename TriangulationTraits_2, typename TriangulationFaceBase_2 > class Triangulation_face_base_with_id_2 : public TriangulationFaceBase_2 { public: -/// \name Access Functions +/// \name Access Functions /// @{ /*! -Returns the index. -*/ -int id() const; +Returns the index. +*/ +int id() const; /*! Returns a reference to the index stored in the face. -*/ -int& id(); +*/ +int& id(); /// @} diff --git a/BGL/doc/BGL/CGAL/Triangulation_vertex_base_with_id_2.h b/BGL/doc/BGL/CGAL/Triangulation_vertex_base_with_id_2.h index bc156657b30..0c71e6b72af 100644 --- a/BGL/doc/BGL/CGAL/Triangulation_vertex_base_with_id_2.h +++ b/BGL/doc/BGL/CGAL/Triangulation_vertex_base_with_id_2.h @@ -15,30 +15,30 @@ running a graph algorithm, by calling the function \tparam TriangulationTraits_2 is the geometric traits class and must be a model of `TriangulationTraits_2`. -\tparam TriangulationVertexBase_2 must be a vertex base class from which -`Triangulation_vertex_base_with_id_2` derives. It has the default -value `Triangulation_vertex_base_2`. +\tparam TriangulationVertexBase_2 must be a vertex base class from which +`Triangulation_vertex_base_with_id_2` derives. It has the default +value `Triangulation_vertex_base_2`. \cgalModels `TriangulationVertexBase_2` -\sa `CGAL::Triangulation_vertex_base_2` +\sa `CGAL::Triangulation_vertex_base_2` */ template< typename TriangulationTraits_2, typename TriangulationVertexBase_2 > class Triangulation_vertex_base_with_id_2 : public TriangulationVertexBase_2 { public: -/// \name Access Functions +/// \name Access Functions /// @{ /*! -Returns the index. -*/ -int id() const; +Returns the index. +*/ +int id() const; /*! -Returns a reference to the index stored in the vertex. -*/ -int& id(); +Returns a reference to the index stored in the vertex. +*/ +int& id(); /// @} diff --git a/BGL/doc/BGL/CGAL/boost/graph/properties.h b/BGL/doc/BGL/CGAL/boost/graph/properties.h index a7416d53eae..40ca966a8e2 100644 --- a/BGL/doc/BGL/CGAL/boost/graph/properties.h +++ b/BGL/doc/BGL/CGAL/boost/graph/properties.h @@ -69,7 +69,7 @@ struct dynamic_halfedge_property_t { dynamic_halfedge_property_t(); }; - + /// \ingroup PkgBGLPropertiesDynamic /// Dynamic edge property tag /// \tparam T the value type of the edge property @@ -78,7 +78,7 @@ struct dynamic_edge_property_t { dynamic_edge_property_t(); }; - + /// \ingroup PkgBGLPropertiesDynamic /// Dynamic face property tag /// \tparam T the value type of the face property diff --git a/BGL/doc/BGL/NamedParameters.txt b/BGL/doc/BGL/NamedParameters.txt index 47c1d3f866a..1b388ebe66d 100644 --- a/BGL/doc/BGL/NamedParameters.txt +++ b/BGL/doc/BGL/NamedParameters.txt @@ -139,7 +139,7 @@ simply inaccessible. is a model of `OutputIterator` accepting `std::pair` A typical use case is mapping the vertices from a source mesh to its copy's after a `copy_face_graph()` operation.\n -Type:a class model of `OutputIterator` accepting +Type:a class model of `OutputIterator` accepting `std::pair<`boost::graph_traits::%vertex_descriptor, `boost::graph_traits::%vertex_descriptor>`.\n Default: Emptyset_iterator \cgalNPEnd @@ -148,7 +148,7 @@ operation.\n is a model of `OutputIterator` accepting `std::pair` A typical use case is mapping the halfedges from a source mesh to its copy's after a `copy_face_graph()` operation.\n -Type:a class model of `OutputIterator` accepting +Type:a class model of `OutputIterator` accepting `std::pair<`boost::graph_traits::%halfedge_descriptor, `boost::graph_traits::%halfedge_descriptor>`.\n Default: Emptyset_iterator \cgalNPEnd @@ -158,7 +158,7 @@ operation.\n is a model of `OutputIterator` accepting `std::pair` A typical use case is mapping the faces from a source mesh to its copy's after a `copy_face_graph()` operation.\n -Type:a class model of `OutputIterator` accepting +Type:a class model of `OutputIterator` accepting `std::pair<`boost::graph_traits::%face_descriptor, `boost::graph_traits::%face_descriptor>`.\n Default: Emptyset_iterator \cgalNPEnd @@ -168,7 +168,7 @@ is a property map storing for each vertex of a source mesh the corresponding ver A typical use case is mapping the vertices from a source mesh to its copy's after a `copy_face_graph()` operation.\n Type:a class model of `ReadWritePropertyMap` with -`boost::graph_traits::%vertex_descriptor` as key type and +`boost::graph_traits::%vertex_descriptor` as key type and `boost::graph_traits::%vertex_descriptor` as value type.\n Default: None. \cgalNPEnd @@ -178,7 +178,7 @@ is a property map storing for each halfedge of a source mesh the corresponding h A typical use case is mapping the vertices from a source mesh to its copy's after a `copy_face_graph()` operation.\n Type:a class model of `ReadWritePropertyMap` with -`boost::graph_traits::%halfedge_descriptor` as key type and +`boost::graph_traits::%halfedge_descriptor` as key type and `boost::graph_traits::%halfedge_descriptor` as value type.\n Default: None. \cgalNPEnd @@ -188,7 +188,7 @@ is a property map storing for each face of a source mesh the corresponding face A typical use case is mapping the vertices from a source mesh to its copy's after a `copy_face_graph()` operation.\n Type:a class model of `ReadWritePropertyMap` with -`boost::graph_traits::%face_descriptor` as key type and +`boost::graph_traits::%face_descriptor` as key type and `boost::graph_traits::%face_descriptor` as value type.\n Default: None. \cgalNPEnd diff --git a/BGL/doc/BGL/PackageDescription.txt b/BGL/doc/BGL/PackageDescription.txt index 6f85bafbf06..6651c00b6e2 100644 --- a/BGL/doc/BGL/PackageDescription.txt +++ b/BGL/doc/BGL/PackageDescription.txt @@ -22,7 +22,7 @@ digraph example { FaceGraph [ URL="\ref FaceGraph"]; FaceListGraph [ URL="\ref FaceListGraph"]; MutableFaceGraph [ URL="\ref MutableFaceGraph"]; - + MutableHalfedgeGraph -> HalfedgeGraph -> "boost Graph" [ arrowhead="open", label="refines" ]; FaceListGraph -> FaceGraph -> HalfedgeGraph [ arrowhead="open", label="refines" ]; MutableFaceGraph -> MutableHalfedgeGraph [ arrowhead="open", label="refines" ]; @@ -34,12 +34,12 @@ digraph example { \cgalHeading{Notations}
-
`G`
A type that is a model of a graph concept.
-
`g`
An object of type `G`.
-
`u`, `v`
Objects of type `boost::graph_traits::%vertex_descriptor`.
-
`h`
An object of type `boost::graph_traits::%halfedge_descriptor`.
-
`e`
An object of type `boost::graph_traits::%edge_descriptor`.
-
`f`
An object of type `boost::graph_traits::%face_descriptor`.
+
`G`
A type that is a model of a graph concept.
+
`g`
An object of type `G`.
+
`u`, `v`
Objects of type `boost::graph_traits::%vertex_descriptor`.
+
`h`
An object of type `boost::graph_traits::%halfedge_descriptor`.
+
`e`
An object of type `boost::graph_traits::%edge_descriptor`.
+
`f`
An object of type `boost::graph_traits::%face_descriptor`.
\cgalHeading{%VertexListGraph} diff --git a/BGL/examples/BGL_LCC/copy_lcc.cpp b/BGL/examples/BGL_LCC/copy_lcc.cpp index ecc43fefc59..0c84c58a0b6 100644 --- a/BGL/examples/BGL_LCC/copy_lcc.cpp +++ b/BGL/examples/BGL_LCC/copy_lcc.cpp @@ -51,7 +51,7 @@ int main(int argc, char* argv[]) boost::unordered_map v2v; boost::unordered_map h2h; - + CGAL::copy_face_graph(T1, S, CGAL::parameters::vertex_to_vertex_output_iterator(std::inserter(v2v, v2v.end())) .halfedge_to_halfedge_output_iterator(std::inserter(h2h, h2h.end()))); std::ofstream out("reverse.off"); diff --git a/BGL/examples/BGL_polyhedron_3/copy_polyhedron.cpp b/BGL/examples/BGL_polyhedron_3/copy_polyhedron.cpp index 3f9e7b76bef..64c2b8650d9 100644 --- a/BGL/examples/BGL_polyhedron_3/copy_polyhedron.cpp +++ b/BGL/examples/BGL_polyhedron_3/copy_polyhedron.cpp @@ -59,7 +59,7 @@ int main(int argc, char* argv[]) boost::unordered_map v2v; boost::unordered_map h2h; boost::unordered_map f2f; - + CGAL::copy_face_graph(S, T2, CGAL::parameters::vertex_to_vertex_output_iterator(std::inserter(v2v, v2v.end())) .halfedge_to_halfedge_output_iterator(std::inserter(h2h, h2h.end())) .face_to_face_output_iterator(std::inserter(f2f, f2f.end()))); @@ -75,7 +75,7 @@ int main(int argc, char* argv[]) typedef boost::graph_traits::vertex_descriptor tm_vertex_descriptor; typedef boost::graph_traits::halfedge_descriptor tm_halfedge_descriptor; typedef boost::graph_traits::face_descriptor tm_face_descriptor; - + boost::unordered_map v2v; boost::unordered_map h2h; diff --git a/BGL/examples/BGL_surface_mesh/write_inp.cpp b/BGL/examples/BGL_surface_mesh/write_inp.cpp index ba9e3545bb5..d4b09a6e28a 100644 --- a/BGL/examples/BGL_surface_mesh/write_inp.cpp +++ b/BGL/examples/BGL_surface_mesh/write_inp.cpp @@ -13,7 +13,7 @@ typedef CGAL::Surface_mesh Mesh; typedef boost::graph_traits::vertex_descriptor vertex_descriptor; -int main() +int main() { Mesh sm; CGAL::make_quad(Point(0,0,0), Point(1,0,0),Point(1,1,0),Point(0,1,0), sm); diff --git a/BGL/include/CGAL/boost/graph/Seam_mesh.h b/BGL/include/CGAL/boost/graph/Seam_mesh.h index 07ed312307f..5eade0abdee 100644 --- a/BGL/include/CGAL/boost/graph/Seam_mesh.h +++ b/BGL/include/CGAL/boost/graph/Seam_mesh.h @@ -432,7 +432,7 @@ public: friend bool operator==(edge_descriptor e1, edge_descriptor e2) { - return (e1.hd == e2.hd) || (e1.hd == e2.mesh_->opposite(e2.hd)); + return (e1.hd == e2.hd) || (e1.hd == e2.mesh_->opposite(e2.hd)); } friend bool operator!=(edge_descriptor e1, edge_descriptor e2) diff --git a/BGL/include/CGAL/boost/graph/copy_face_graph.h b/BGL/include/CGAL/boost/graph/copy_face_graph.h index 84ec4184dfb..da18703dceb 100644 --- a/BGL/include/CGAL/boost/graph/copy_face_graph.h +++ b/BGL/include/CGAL/boost/graph/copy_face_graph.h @@ -225,9 +225,9 @@ struct Output_iterator_functor { put(map, pair.first, pair.second); } - + }; - + template boost::function_output_iterator > make_functor(PMAP map) { @@ -255,13 +255,13 @@ inline Emptyset_iterator make_functor(const internal_np::Param_not_found&) \tparam TargetMesh a model of `FaceListGraph` \tparam NamedParameters1 a sequence of \ref pmp_namedparameters "Named Parameters" \tparam NamedParameters2 a sequence of \ref pmp_namedparameters "Named Parameters" - + The types `sm_vertex_descriptor` and `sm_face_descriptor` must be models of the concept `Hashable`. \param sm the source mesh \param tm the target mesh \param np1 optional sequence of \ref pmp_namedparameters "Named Parameters" among the ones listed below - + \cgalNamedParamsBegin \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `sm` . @@ -269,30 +269,30 @@ inline Emptyset_iterator make_functor(const internal_np::Param_not_found&) `CGAL::vertex_point_t` should be available in `SourceMesh` \cgalParamEnd \cgalParamBegin{vertex_to_vertex_output_iterator} an `OutputIterator` containing the - pairs source-vertex, target-vertex. If this parameter is given, then + pairs source-vertex, target-vertex. If this parameter is given, then `vertex_to_vertex_map` cannot be used. \cgalParamEnd \cgalParamBegin{halfedge_to_halfedge_output_iterator} an `OutputIterator` containing the - pairs source-halfedge, target-halfedge. If this parameter is given, then + pairs source-halfedge, target-halfedge. If this parameter is given, then `halfedge_to_halfedge_map` cannot be used. \cgalParamEnd \cgalParamBegin{face_to_face_output_iterator} an `OutputIterator` containing the - pairs source-face, target-face. If this parameter is given, then + pairs source-face, target-face. If this parameter is given, then `face_to_face_map` cannot be used. \cgalParamEnd \cgalParamBegin{vertex_to_vertex_map} a `ReadWritePropertyMap` containing the - pairs source-vertex, target-vertex. + pairs source-vertex, target-vertex. \cgalParamEnd \cgalParamBegin{halfedge_to_halfedge_map} a `ReadWritePropertyMap` containing the - pairs source-halfedge, target-halfedge. + pairs source-halfedge, target-halfedge. \cgalParamEnd \cgalParamBegin{face_to_face_map} a `ReadWritePropertyMap` containing the - pairs source-face, target-face. + pairs source-face, target-face. \cgalParamEnd \cgalNamedParamsEnd - + \param np2 optional sequence of \ref pmp_namedparameters "Named Parameters" among the ones listed below - + \cgalNamedParamsBegin \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `tm`. @@ -310,7 +310,7 @@ inline Emptyset_iterator make_functor(const internal_np::Param_not_found&) */ template -void copy_face_graph(const SourceMesh& sm, TargetMesh& tm, +void copy_face_graph(const SourceMesh& sm, TargetMesh& tm, const CGAL::Named_function_parameters& np) { copy_face_graph(sm, tm, np, parameters::all_default()); diff --git a/BGL/include/CGAL/boost/graph/internal/initialized_index_maps_helpers.h b/BGL/include/CGAL/boost/graph/internal/initialized_index_maps_helpers.h index e392ff064a0..928c2c7bc76 100644 --- a/BGL/include/CGAL/boost/graph/internal/initialized_index_maps_helpers.h +++ b/BGL/include/CGAL/boost/graph/internal/initialized_index_maps_helpers.h @@ -5,7 +5,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial -// +// // Author(s) : Mael Rouxel-Labbé // Maxime Gimeno diff --git a/BGL/include/CGAL/boost/graph/io.h b/BGL/include/CGAL/boost/graph/io.h index dd41b28a65f..5d5d519de80 100644 --- a/BGL/include/CGAL/boost/graph/io.h +++ b/BGL/include/CGAL/boost/graph/io.h @@ -30,13 +30,13 @@ namespace CGAL { /*! \ingroup PkgBGLIOFct writes the graph `g` in the wrl format (VRML 2.0). - + \cgalNamedParamsBegin * \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `g`. * If this parameter is omitted, an internal property map for * `CGAL::vertex_point_t` should be available in `FaceGraph`\cgalParamEnd * \cgalNamedParamsEnd - */ + */ template bool write_wrl(std::ostream& os, const FaceGraph& g, @@ -48,14 +48,14 @@ bool write_wrl(std::ostream& os, using parameters::get_parameter; using parameters::choose_parameter; - + typename CGAL::GetVertexPointMap::const_type vpm = choose_parameter(get_parameter(np, internal_np::vertex_point), get_const_property_map(CGAL::vertex_point, g)); boost::container::flat_map reindex; int n = 0; - + os << "#VRML V2.0 utf8\n" "Group {\n" "children [\n" @@ -109,23 +109,23 @@ template bool write_wrl(std::ostream& os, const FaceGraph& g) { - return write_wrl(os, g, + return write_wrl(os, g, parameters::all_default()); } - + /*! \ingroup PkgBGLIOFct writes the graph `g` in the OFF format. - + \cgalNamedParamsBegin * \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `g`. * If this parameter is omitted, an internal property map for * `CGAL::vertex_point_t` should be available in `FaceGraph`\cgalParamEnd * \cgalNamedParamsEnd - + \sa Overloads of this function for specific models of the concept `FaceGraph`. - */ + */ template bool write_off(std::ostream& os, const FaceGraph& g, @@ -138,7 +138,7 @@ bool write_off(std::ostream& os, using parameters::choose_parameter; using parameters::get_parameter; - + typename CGAL::GetVertexPointMap::const_type vpm = choose_parameter(get_parameter(np, internal_np::vertex_point), get_const_property_map(CGAL::vertex_point, g)); @@ -152,7 +152,7 @@ bool write_off(std::ostream& os, os << get(vpm,v) << '\n'; reindex[v]=n++; } - + for(face_descriptor f : faces(g)){ os << degree(f,g); for(vertex_descriptor v : vertices_around_face(halfedge(f,g),g)){ @@ -169,7 +169,7 @@ bool write_off(std::ostream& os, writes the graph `g` in the OFF format into a file named `fname`. \sa Overloads of this function for specific models of the concept `FaceGraph`. - */ + */ template bool write_off(const char* fname, const FaceGraph& g, @@ -193,7 +193,7 @@ template bool write_off(std::ostream& os, const FaceGraph& g) { - return write_off(os, g, + return write_off(os, g, parameters::all_default()); } template @@ -207,11 +207,11 @@ bool write_off(const char* fname, template bool write_off(const std::string& fname, const FaceGraph& g) -{ return write_off(fname, g, +{ return write_off(fname, g, parameters::all_default()); } namespace internal { namespace read_off_tools { - + inline bool is_whitespace(const std::string& s) { for(unsigned int i=0; i < s.size(); i++){ @@ -221,7 +221,7 @@ bool write_off(const std::string& fname, } return true; } - + inline std::string next_non_comment(std::istream& is) { std::string line; @@ -238,7 +238,7 @@ inline std::string next_non_comment(std::istream& is) /*! \ingroup PkgBGLIOFct reads the graph `g` from data in the OFF format. Ignores comment lines which start with a hash, and lines with whitespace. - + \cgalNamedParamsBegin * \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `g`. * If this parameter is omitted, an internal property map for @@ -248,7 +248,7 @@ inline std::string next_non_comment(std::istream& is) \pre The data must represent a 2-manifold \attention The graph `g` is not cleared, and the data from the stream are added. - */ + */ template bool read_off(std::istream& is, FaceGraph& g, @@ -264,13 +264,13 @@ bool read_off(std::istream& is, typedef typename CGAL::GetVertexPointMap::type Vpm; typedef typename boost::property_traits::value_type Point_3; - + Vpm vpm = choose_parameter(get_parameter(np, internal_np::vertex_point), get_property_map(CGAL::vertex_point, g)); vertices_size_type nv, nvf; faces_size_type nf; int ignore; - + std::string line = next_non_comment(is); { std::istringstream iss(line); @@ -283,7 +283,7 @@ bool read_off(std::istream& is, std::istringstream iss(line); iss >> nv >> nf >> ignore; } - + std::vector vertices(nv); Point_3 p; for(vertices_size_type i=0; i < nv; i++){ @@ -323,7 +323,7 @@ bool read_off(std::istream& is, \pre The data must represent a 2-manifold \attention The graph `g` is not cleared, and the data from the stream are added. - */ + */ template bool read_off(const char* fname, FaceGraph& g, @@ -347,12 +347,12 @@ template bool read_off(const std::string& fname, FaceGraph& g, NamedParameters np) -{ return read_off(fname.c_str(), g, np); } +{ return read_off(fname.c_str(), g, np); } template bool read_off(const std::string& fname, FaceGraph& g) -{ return read_off(fname, g, parameters::all_default()); } +{ return read_off(fname, g, parameters::all_default()); } template bool write_inp(std::ostream& os, diff --git a/BGL/include/CGAL/boost/graph/named_params_helper.h b/BGL/include/CGAL/boost/graph/named_params_helper.h index 54c031a7c61..6891abf0e27 100644 --- a/BGL/include/CGAL/boost/graph/named_params_helper.h +++ b/BGL/include/CGAL/boost/graph/named_params_helper.h @@ -351,7 +351,7 @@ CGAL_DEF_GET_INITIALIZED_INDEX_MAP(face, typename boost::graph_traits::fa typedef std::random_access_iterator_tag iterator_category; }; }; - + namespace parameters { template diff --git a/BGL/include/CGAL/boost/graph/properties.h b/BGL/include/CGAL/boost/graph/properties.h index 589662ce0dc..9774e1ac39f 100644 --- a/BGL/include/CGAL/boost/graph/properties.h +++ b/BGL/include/CGAL/boost/graph/properties.h @@ -5,7 +5,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Andreas Fabri, Fernando Cacciola @@ -90,7 +90,7 @@ using boost::face_external_index; namespace CGAL { namespace internal { - + template struct Index_accessor : boost::put_get_helper< std::size_t&, Index_accessor > diff --git a/BGL/test/BGL/test_Prefix.h b/BGL/test/BGL/test_Prefix.h index 4ca383561f1..a08af579147 100644 --- a/BGL/test/BGL/test_Prefix.h +++ b/BGL/test/BGL/test_Prefix.h @@ -171,7 +171,7 @@ bool read_a_mesh(Polyhedron& p, const std::string& str) { } template -std::vector t_data() +std::vector t_data() { std::vector vs; for(unsigned int i = 0; i < sizeof(data) / sizeof(data[0]); ++i) { @@ -254,7 +254,7 @@ struct Surface_fixture_1 { f1 = CGAL::is_border(halfedge(u, m),m) ? face(opposite(halfedge(u, m), m), m) : face(halfedge(u, m), m); assert(f1 != boost::graph_traits::null_face()); CGAL::Halfedge_around_face_iterator hafib, hafie; - for(boost::tie(hafib, hafie) = CGAL::halfedges_around_face(halfedge(f1, m), m); hafib != hafie; ++hafib) + for(boost::tie(hafib, hafie) = CGAL::halfedges_around_face(halfedge(f1, m), m); hafib != hafie; ++hafib) { if(! CGAL::is_border(opposite(*hafib, m), m)) f2 = face(opposite(*hafib, m), m); @@ -401,7 +401,7 @@ struct Surface_fixture_4 { h2 = *hb; ++found; } - } + } } } assert(found == 2); @@ -434,7 +434,7 @@ struct Surface_fixture_5 { } else if(get(pm, target(*hb,m)) == Point_3(2,-1,0)){ h2 = *hb; found++; - } + } } } assert(found == 2); @@ -452,9 +452,9 @@ struct Surface_fixture_6 { assert(CGAL::is_valid_polygon_mesh(m)); typename boost::graph_traits::halfedge_descriptor h; - + h1 = halfedge(*faces(m).first, m); - + h2 = next(next(h1,m),m); } @@ -470,7 +470,7 @@ struct Surface_fixture_7 { assert(read_a_mesh(m, "data/cube.off")); assert(CGAL::is_valid_polygon_mesh(m)); - h = *(halfedges(m).first); + h = *(halfedges(m).first); } Graph m; @@ -501,9 +501,9 @@ struct Surface_fixture_8 { get(pm, target(*hb,m)) == Point_3(0,0,0)){ h3 = *hb; found++; - } + } } - + assert(found == 3); } diff --git a/BGL/test/BGL/test_Properties.cpp b/BGL/test/BGL/test_Properties.cpp index 984891b4ca9..bb541bbc890 100644 --- a/BGL/test/BGL/test_Properties.cpp +++ b/BGL/test/BGL/test_Properties.cpp @@ -67,7 +67,7 @@ void test_uniqueness(const Graph&, std::cout << "Element type: " << typeid(typename boost::range_value::type).name() << std::endl; #endif - typename boost::range_iterator::type + typename boost::range_iterator::type begin = boost::begin(range), begin2 = boost::begin(range), end = boost::end(range); diff --git a/BGL/test/BGL/test_cgal_bgl_named_params.cpp b/BGL/test/BGL/test_cgal_bgl_named_params.cpp index 07dc883392d..5aa0021d0b3 100644 --- a/BGL/test/BGL/test_cgal_bgl_named_params.cpp +++ b/BGL/test/BGL/test_cgal_bgl_named_params.cpp @@ -41,11 +41,11 @@ void test(const NamedParameters& np) assert(get_parameter(np, CGAL::internal_np::METIS_options).v == 800000001); assert(get_parameter(np, CGAL::internal_np::vertex_partition_id).v == 800000002); assert(get_parameter(np, CGAL::internal_np::face_partition_id).v == 800000003); - + assert(get_parameter(np, CGAL::internal_np::vertex_to_vertex_output_iterator).v == 800000004); assert(get_parameter(np, CGAL::internal_np::halfedge_to_halfedge_output_iterator).v == 800000005); assert(get_parameter(np, CGAL::internal_np::face_to_face_output_iterator).v == 800000006); - + assert(get_parameter(np, CGAL::internal_np::vertex_to_vertex_map).v == 800000007); assert(get_parameter(np, CGAL::internal_np::halfedge_to_halfedge_map).v == 800000008); assert(get_parameter(np, CGAL::internal_np::face_to_face_map).v == 800000009); @@ -203,7 +203,7 @@ void test(const NamedParameters& np) check_same_type<42>(get_parameter(np, CGAL::internal_np::projection_functor)); check_same_type<46>(get_parameter(np, CGAL::internal_np::apply_per_connected_component)); check_same_type<47>(get_parameter(np, CGAL::internal_np::output_iterator)); - + // Named parameters used in the package 'Point Set Processing' check_same_type<9000>(get_parameter(np, CGAL::internal_np::point_map)); check_same_type<9001>(get_parameter(np, CGAL::internal_np::query_point_map)); diff --git a/Barycentric_coordinates_2/benchmark/Barycentric_coordinates_2/Discrete_harmonic_coordinates/DH_speed_test_100_vertices.cpp b/Barycentric_coordinates_2/benchmark/Barycentric_coordinates_2/Discrete_harmonic_coordinates/DH_speed_test_100_vertices.cpp index 0b37ce54e32..05a1b96bb6a 100644 --- a/Barycentric_coordinates_2/benchmark/Barycentric_coordinates_2/Discrete_harmonic_coordinates/DH_speed_test_100_vertices.cpp +++ b/Barycentric_coordinates_2/benchmark/Barycentric_coordinates_2/Discrete_harmonic_coordinates/DH_speed_test_100_vertices.cpp @@ -32,7 +32,7 @@ void generate_regular_polygon(const int number_of_vertices, const double polygon vertices.resize(n); - for(int i = 0; i < n; ++i) + for(int i = 0; i < n; ++i) vertices[i] = Point(Scalar(r*sin((CGAL_PI / n) + ((i * 2.0 * CGAL_PI) / n))), Scalar(-r*cos((CGAL_PI / n) + ((i * 2.0 * CGAL_PI) / n)))); } diff --git a/Barycentric_coordinates_2/benchmark/Barycentric_coordinates_2/Mean_value_coordinates/MV_speed_test_100_vertices.cpp b/Barycentric_coordinates_2/benchmark/Barycentric_coordinates_2/Mean_value_coordinates/MV_speed_test_100_vertices.cpp index 1d568bf03db..f654b82bdfe 100644 --- a/Barycentric_coordinates_2/benchmark/Barycentric_coordinates_2/Mean_value_coordinates/MV_speed_test_100_vertices.cpp +++ b/Barycentric_coordinates_2/benchmark/Barycentric_coordinates_2/Mean_value_coordinates/MV_speed_test_100_vertices.cpp @@ -32,7 +32,7 @@ void generate_regular_polygon(const int number_of_vertices, const double polygon vertices.resize(n); - for(int i = 0; i < n; ++i) + for(int i = 0; i < n; ++i) vertices[i] = Point(Scalar(r*sin((CGAL_PI / n) + ((i * 2.0 * CGAL_PI) / n))), Scalar(-r*cos((CGAL_PI / n) + ((i * 2.0 * CGAL_PI) / n)))); } diff --git a/Barycentric_coordinates_2/benchmark/Barycentric_coordinates_2/Wachspress_coordinates/WP_speed_test_100_vertices.cpp b/Barycentric_coordinates_2/benchmark/Barycentric_coordinates_2/Wachspress_coordinates/WP_speed_test_100_vertices.cpp index 0d28ec26fd2..66046a6c081 100644 --- a/Barycentric_coordinates_2/benchmark/Barycentric_coordinates_2/Wachspress_coordinates/WP_speed_test_100_vertices.cpp +++ b/Barycentric_coordinates_2/benchmark/Barycentric_coordinates_2/Wachspress_coordinates/WP_speed_test_100_vertices.cpp @@ -32,7 +32,7 @@ void generate_regular_polygon(const int number_of_vertices, const double polygon vertices.resize(n); - for(int i = 0; i < n; ++i) + for(int i = 0; i < n; ++i) vertices[i] = Point(Scalar(r*sin((CGAL_PI / n) + ((i * 2.0 * CGAL_PI) / n))), Scalar(-r*cos((CGAL_PI / n) + ((i * 2.0 * CGAL_PI) / n)))); } diff --git a/Bounding_volumes/examples/Approximate_min_ellipsoid_d/CMakeLists.txt b/Bounding_volumes/examples/Approximate_min_ellipsoid_d/CMakeLists.txt index 9e5c6bb914e..5ea12f55be3 100644 --- a/Bounding_volumes/examples/Approximate_min_ellipsoid_d/CMakeLists.txt +++ b/Bounding_volumes/examples/Approximate_min_ellipsoid_d/CMakeLists.txt @@ -8,7 +8,7 @@ if ( CGAL_FOUND ) # Use Eigen find_package(Eigen3 3.1.0 QUIET) #(3.1.0 or greater) - + # create a target per cppfile file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) foreach(cppfile ${cppfiles}) @@ -22,8 +22,8 @@ if ( CGAL_FOUND ) endforeach() else() - + message(STATUS "This program requires the CGAL library, and will not be compiled.") - + endif() diff --git a/Bounding_volumes/test/Bounding_volumes/CMakeLists.txt b/Bounding_volumes/test/Bounding_volumes/CMakeLists.txt index dd6813bb97e..804517aea26 100644 --- a/Bounding_volumes/test/Bounding_volumes/CMakeLists.txt +++ b/Bounding_volumes/test/Bounding_volumes/CMakeLists.txt @@ -14,7 +14,7 @@ if ( CGAL_FOUND ) # Use Eigen find_package(Eigen3 3.1.0 QUIET) #(3.1.0 or greater) - + # create a target per cppfile file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) foreach(cppfile ${cppfiles}) @@ -28,8 +28,8 @@ if ( CGAL_FOUND ) endforeach() else() - + message(STATUS "This program requires the CGAL library, and will not be compiled.") - + endif() diff --git a/Box_intersection_d/doc/Box_intersection_d/CGAL/box_intersection_d.h b/Box_intersection_d/doc/Box_intersection_d/CGAL/box_intersection_d.h index b8eb1310a32..77fbe4ae63b 100644 --- a/Box_intersection_d/doc/Box_intersection_d/CGAL/box_intersection_d.h +++ b/Box_intersection_d/doc/Box_intersection_d/CGAL/box_intersection_d.h @@ -3,49 +3,49 @@ namespace CGAL { /*! \addtogroup PkgBoxIntersectionD_box_intersection_all_pairs_d - The function `box_intersection_all_pairs_d()` computes the pairwise intersecting boxes - between two sequences of iso-oriented boxes in arbitrary dimension. - It does so by comparing all possible pairs of boxes and is thus - inferior to the fast `box_intersection_d()` algorithm. + The function `box_intersection_all_pairs_d()` computes the pairwise intersecting boxes + between two sequences of iso-oriented boxes in arbitrary dimension. + It does so by comparing all possible pairs of boxes and is thus + inferior to the fast `box_intersection_d()` algorithm. - The sequences of boxes are given with two forward iterator ranges. The - sequences are not modified. For each intersecting pair of boxes a - `callback` function object is called with the two intersecting - boxes as argument; the first argument is a box from the first - sequence, the second argument a box from the second sequence. + The sequences of boxes are given with two forward iterator ranges. The + sequences are not modified. For each intersecting pair of boxes a + `callback` function object is called with the two intersecting + boxes as argument; the first argument is a box from the first + sequence, the second argument a box from the second sequence. - The algorithm is interface compatible with the - `box_intersection_d()` function. Similarly, we call the - `value_type` of the iterators the box handle, which is - either our box type or a pointer type to our box type. + The algorithm is interface compatible with the + `box_intersection_d()` function. Similarly, we call the + `value_type` of the iterators the box handle, which is + either our box type or a pointer type to our box type. - A \f$ d\f$-dimensional iso-oriented box is defined as the - %Cartesian product of \f$ d\f$ intervals. We call the - box half-open if the \f$ d\f$ intervals \f$ \{ [lo_i,hi_i) \,|\, 0 \leq - i < d\}\f$ are half-open intervals, and we call the box closed if - the \f$ d\f$ intervals \f$ \{ [lo_i,hi_i] \,|\, 0 \leq i < d\}\f$ are closed - intervals. Note that closed boxes support zero-width boxes and they - can intersect at their boundaries, while non-empty half-open boxes - always have a positive volume and they only intersect iff their - interiors overlap. The distinction between closed or half-open boxes - does not require a different representation of boxes, just a different - interpretation when comparing boxes, which is selected with the - `topology` parameter and its two values, - `Box_intersection_d::HALF_OPEN` and - `Box_intersection_d::CLOSED`. + A \f$ d\f$-dimensional iso-oriented box is defined as the + %Cartesian product of \f$ d\f$ intervals. We call the + box half-open if the \f$ d\f$ intervals \f$ \{ [lo_i,hi_i) \,|\, 0 \leq + i < d\}\f$ are half-open intervals, and we call the box closed if + the \f$ d\f$ intervals \f$ \{ [lo_i,hi_i] \,|\, 0 \leq i < d\}\f$ are closed + intervals. Note that closed boxes support zero-width boxes and they + can intersect at their boundaries, while non-empty half-open boxes + always have a positive volume and they only intersect iff their + interiors overlap. The distinction between closed or half-open boxes + does not require a different representation of boxes, just a different + interpretation when comparing boxes, which is selected with the + `topology` parameter and its two values, + `Box_intersection_d::HALF_OPEN` and + `Box_intersection_d::CLOSED`. - In addition, a box has a unique `id`-number. Boxes with equal - `id`-number are not reported since they obviously intersect trivially. + In addition, a box has a unique `id`-number. Boxes with equal + `id`-number are not reported since they obviously intersect trivially. - The algorithm uses a traits class of the `BoxIntersectionTraits_d` - concept to access the boxes. A default traits class is provided that - assumes that the box type is a model of the `BoxIntersectionBox_d` - concept and that the box handle, i.e., the iterators value type, is - identical to the box type or a pointer to the box type. + The algorithm uses a traits class of the `BoxIntersectionTraits_d` + concept to access the boxes. A default traits class is provided that + assumes that the box type is a model of the `BoxIntersectionBox_d` + concept and that the box handle, i.e., the iterators value type, is + identical to the box type or a pointer to the box type. - An important special application of this algorithm is the test for - self-intersections where the second box sequence is an identical copy - of the first sequence including the preserved `id`-number. We + An important special application of this algorithm is the test for + self-intersections where the second box sequence is an identical copy + of the first sequence including the preserved `id`-number. We offer a specialized implementation `box_self_intersection_all_pairs_d()` for this application. @@ -70,15 +70,15 @@ namespace CGAL { \sa \link PkgBoxIntersectionD_box_intersection_d `CGAL::box_intersection_d()` \endlink \sa \link PkgBoxIntersectionD_box_self_intersection_d `CGAL::box_self_intersection_d()` \endlink \sa \link PkgBoxIntersectionD_box_self_intersection_all_pairs_d `CGAL::box_self_intersection_all_pairs_d()` \endlink - \sa `CGAL::Box_intersection_d::Box_traits_d` - \sa `BoxIntersectionBox_d` - \sa `BoxIntersectionTraits_d` + \sa `CGAL::Box_intersection_d::Box_traits_d` + \sa `BoxIntersectionBox_d` + \sa `BoxIntersectionTraits_d` \cgalHeading{Implementation} - The algorithm is trivially testing all pairs and runs therefore in time - \f$ O(nm)\f$ where \f$ n\f$ is the size of the first sequence and \f$ m\f$ is the - size of the second sequence. + The algorithm is trivially testing all pairs and runs therefore in time + \f$ O(nm)\f$ where \f$ n\f$ is the size of the first sequence and \f$ m\f$ is the + size of the second sequence. */ /*! @@ -118,69 +118,69 @@ void box_intersection_all_pairs_d( /*! \addtogroup PkgBoxIntersectionD_box_intersection_d - The function `box_intersection_d()` computes the pairwise intersecting boxes - between two sequences of iso-oriented boxes in arbitrary dimension. - The sequences of boxes are given with two random-access iterator - ranges and will be reordered in the course of the algorithm. For each - intersecting pair of boxes a `callback` function object is called - with the two intersecting boxes as argument; the first argument is a - box from the first sequence, the second argument a box from the second - sequence. The performance of the algorithm can be tuned with a - `cutoff` parameter, see the implementation section below for more - details. + The function `box_intersection_d()` computes the pairwise intersecting boxes + between two sequences of iso-oriented boxes in arbitrary dimension. + The sequences of boxes are given with two random-access iterator + ranges and will be reordered in the course of the algorithm. For each + intersecting pair of boxes a `callback` function object is called + with the two intersecting boxes as argument; the first argument is a + box from the first sequence, the second argument a box from the second + sequence. The performance of the algorithm can be tuned with a + `cutoff` parameter, see the implementation section below for more + details. - The algorithm reorders the boxes in the course of the algorithm. Now, - depending on the size of a box it can be faster to copy the boxes, or - to work with pointers to boxes and copy only pointers. We offer - automatic support for both options. To simplify the description, let - us call the `value_type` of the iterators box handle. The - box handle can either be our box type itself or a pointer (or - const pointer) to the box type. + The algorithm reorders the boxes in the course of the algorithm. Now, + depending on the size of a box it can be faster to copy the boxes, or + to work with pointers to boxes and copy only pointers. We offer + automatic support for both options. To simplify the description, let + us call the `value_type` of the iterators box handle. The + box handle can either be our box type itself or a pointer (or + const pointer) to the box type. - A \f$ d\f$-dimensional iso-oriented box is defined as the - %Cartesian product of \f$ d\f$ intervals. We call the - box half-open if the \f$ d\f$ intervals \f$ \{ [lo_i,hi_i) \,|\, 0 \leq - i < d\}\f$ are half-open intervals, and we call the box closed if - the \f$ d\f$ intervals \f$ \{ [lo_i,hi_i] \,|\, 0 \leq i < d\}\f$ are closed - intervals. Note that closed boxes support zero-width boxes and they - can intersect at their boundaries, while non-empty half-open boxes - always have a positive volume and they only intersect iff their - interiors overlap. The distinction between closed or half-open boxes - does not require a different representation of boxes, just a different - interpretation when comparing boxes, which is selected with the - `topology` parameter and its two values, - `Box_intersection_d::HALF_OPEN` and - `Box_intersection_d::CLOSED`. + A \f$ d\f$-dimensional iso-oriented box is defined as the + %Cartesian product of \f$ d\f$ intervals. We call the + box half-open if the \f$ d\f$ intervals \f$ \{ [lo_i,hi_i) \,|\, 0 \leq + i < d\}\f$ are half-open intervals, and we call the box closed if + the \f$ d\f$ intervals \f$ \{ [lo_i,hi_i] \,|\, 0 \leq i < d\}\f$ are closed + intervals. Note that closed boxes support zero-width boxes and they + can intersect at their boundaries, while non-empty half-open boxes + always have a positive volume and they only intersect iff their + interiors overlap. The distinction between closed or half-open boxes + does not require a different representation of boxes, just a different + interpretation when comparing boxes, which is selected with the + `topology` parameter and its two values, + `Box_intersection_d::HALF_OPEN` and + `Box_intersection_d::CLOSED`. - In addition, a box has a unique `id`-number. It is used to order - boxes consistently in each dimension even if boxes have identical - coordinates. In consequence, the algorithm guarantees that a pair of - intersecting boxes is reported only once. Boxes with equal - `id`-number are not reported since they obviously intersect trivially. + In addition, a box has a unique `id`-number. It is used to order + boxes consistently in each dimension even if boxes have identical + coordinates. In consequence, the algorithm guarantees that a pair of + intersecting boxes is reported only once. Boxes with equal + `id`-number are not reported since they obviously intersect trivially. - The algorithm uses a traits class of the `BoxIntersectionTraits_d` - concept to access the boxes. A default traits class is provided that - assumes that the box type is a model of the `BoxIntersectionBox_d` - concept and that the box handle, i.e., the iterators value type, is - identical to the box type or a pointer to the box type. + The algorithm uses a traits class of the `BoxIntersectionTraits_d` + concept to access the boxes. A default traits class is provided that + assumes that the box type is a model of the `BoxIntersectionBox_d` + concept and that the box handle, i.e., the iterators value type, is + identical to the box type or a pointer to the box type. An important special application of this algorithm is the test for - self-intersections where the second box sequence is an identical copy - of the first sequence including the preserved `id`-number. Note - that this implies that the address of the box is not sufficient for - the `id`-number if boxes are copied by value. To ease the use of - this special case we offer a simplified version of this function with - one iterator range only, which then creates internally the second copy - of the boxes, under the name `box_self_intersection_d()`. + self-intersections where the second box sequence is an identical copy + of the first sequence including the preserved `id`-number. Note + that this implies that the address of the box is not sufficient for + the `id`-number if boxes are copied by value. To ease the use of + this special case we offer a simplified version of this function with + one iterator range only, which then creates internally the second copy + of the boxes, under the name `box_self_intersection_d()`. - In the general case, we distinguish between the bipartite case (the - boxes are from different sequences) and the complete case (the boxes - are from the same sequence, i.e., the self intersection case). The - default is the bipartite case, since the complete case is typically - handled with the simplified function call mentioned above. However, - the general function call offers the `setting` parameter with the - values `Box_intersection_d::COMPLETE` and - `Box_intersection_d::BIPARTITE`. + In the general case, we distinguish between the bipartite case (the + boxes are from different sequences) and the complete case (the boxes + are from the same sequence, i.e., the self intersection case). The + default is the bipartite case, since the complete case is typically + handled with the simplified function call mentioned above. However, + the general function call offers the `setting` parameter with the + values `Box_intersection_d::COMPLETE` and + `Box_intersection_d::BIPARTITE`. \warning The two sequences of boxes passed to `box_intersection_d()` can be ranges created from the same container, but these ranges must not contain @@ -188,59 +188,59 @@ void box_intersection_all_pairs_d( \cgalHeading{Requirements} -
    +
    • `RandomAccessIterator1`, and \f$ \ldots\f$ `2`, must meet the requirements of `RandomAccessIterator` and both value types must be the same. We call this value type `Box_handle` in the following. -
    • `Callback` must be of the `BinaryFunction` concept. - The `Box_handle` must be convertible to both argument types. The - return type is not used and can be `void`. -
    • The `Box_handle` must be a model of the `Assignable` concept. -
    • In addition, if the default box traits is used the `Box_handle` must - be a class type `T` or a pointer to a class type `T`, where - `T` must be a model of the `BoxIntersectionBox_d` concept. - In both cases, the default box traits specializes to a suitable - implementation. -
    • `BoxTraits` must be of the `BoxIntersectionTraits_d` concept. -
    +
  • `Callback` must be of the `BinaryFunction` concept. + The `Box_handle` must be convertible to both argument types. The + return type is not used and can be `void`. +
  • The `Box_handle` must be a model of the `Assignable` concept. +
  • In addition, if the default box traits is used the `Box_handle` must + be a class type `T` or a pointer to a class type `T`, where + `T` must be a model of the `BoxIntersectionBox_d` concept. + In both cases, the default box traits specializes to a suitable + implementation. +
  • `BoxTraits` must be of the `BoxIntersectionTraits_d` concept. +
\sa \link PkgBoxIntersectionD_box_self_intersection_d `CGAL::box_self_intersection_d()` \endlink \sa \link PkgBoxIntersectionD_box_intersection_all_pairs_d `CGAL::box_intersection_all_pairs_d()` \endlink - \sa `CGAL::Box_intersection_d::Box_traits_d` - \sa `BoxIntersectionBox_d` - \sa `BoxIntersectionTraits_d` + \sa `CGAL::Box_intersection_d::Box_traits_d` + \sa `BoxIntersectionBox_d` + \sa `BoxIntersectionTraits_d` \cgalHeading{Implementation} - The implemented algorithm is described in \cgalCite{cgal:ze-fsbi-02} as - version two. Its performance depends on a `cutoff` parameter. - When the size of both iterator ranges drops below the `cutoff` - parameter the function switches from the streamed segment-tree - algorithm to the two-way-scan algorithm, see \cgalCite{cgal:ze-fsbi-02} - for the details. + The implemented algorithm is described in \cgalCite{cgal:ze-fsbi-02} as + version two. Its performance depends on a `cutoff` parameter. + When the size of both iterator ranges drops below the `cutoff` + parameter the function switches from the streamed segment-tree + algorithm to the two-way-scan algorithm, see \cgalCite{cgal:ze-fsbi-02} + for the details. - The streamed segment-tree algorithm needs \f$ O(n \log^d (n) + k)\f$ - worst-case running time and \f$ O(n)\f$ space, where \f$ n\f$ is the number of - boxes in both input sequences, \f$ d\f$ the (constant) dimension of the - boxes, and \f$ k\f$ the output complexity, i.e., the number of pairwise - intersections of the boxes. The two-way-scan algorithm needs \f$ O(n \log - (n) + l)\f$ worst-case running time and \f$ O(n)\f$ space, where \f$ l\f$ is the - number of pairwise overlapping intervals in one dimensions (the - dimension where the algorithm is used instead of the segment tree). - Note that \f$ l\f$ is not necessarily related to \f$ k\f$ and using the - two-way-scan algorithm is a heuristic. + The streamed segment-tree algorithm needs \f$ O(n \log^d (n) + k)\f$ + worst-case running time and \f$ O(n)\f$ space, where \f$ n\f$ is the number of + boxes in both input sequences, \f$ d\f$ the (constant) dimension of the + boxes, and \f$ k\f$ the output complexity, i.e., the number of pairwise + intersections of the boxes. The two-way-scan algorithm needs \f$ O(n \log + (n) + l)\f$ worst-case running time and \f$ O(n)\f$ space, where \f$ l\f$ is the + number of pairwise overlapping intervals in one dimensions (the + dimension where the algorithm is used instead of the segment tree). + Note that \f$ l\f$ is not necessarily related to \f$ k\f$ and using the + two-way-scan algorithm is a heuristic. - Unfortunately, we have no general method to automatically determine an - optimal cutoff parameter, since it depends on the used hardware, the - runtime ratio between callback runtime and segment-tree runtime, and - of course the number of boxes to be checked and their distribution. In - cases where the callback runtime is dominant, it may be best to make - the threshold parameter small. Otherwise a `cutoff`\f$ =\sqrt{n}\f$ can - lead to acceptable results. For well distributed boxes the original - paper \cgalCite{cgal:ze-fsbi-02} gives optimal cutoffs in the thousands. - Anyway, for optimal runtime some experiments to compare different - cutoff parameters are recommended. See also - Section \ref secboxintersperformance . + Unfortunately, we have no general method to automatically determine an + optimal cutoff parameter, since it depends on the used hardware, the + runtime ratio between callback runtime and segment-tree runtime, and + of course the number of boxes to be checked and their distribution. In + cases where the callback runtime is dominant, it may be best to make + the threshold parameter small. Otherwise a `cutoff`\f$ =\sqrt{n}\f$ can + lead to acceptable results. For well distributed boxes the original + paper \cgalCite{cgal:ze-fsbi-02} gives optimal cutoffs in the thousands. + Anyway, for optimal runtime some experiments to compare different + cutoff parameters are recommended. See also + Section \ref secboxintersperformance . \cgalHeading{Concurrency} @@ -267,23 +267,23 @@ void box_intersection_all_pairs_d( \cgalHeading{Example} - The box implementation provided with - `Box_intersection_d::Box_d` has a special - constructor for the \cgal bounding box type `Bbox_2` (and - similar for dimension 3). We use this in the example to create \f$ 3 - \times 3\f$ `boxes` in a grid layout. Additionally we pick the - center box and the box in the upper-right corner as our second box - sequence `query`. + The box implementation provided with + `Box_intersection_d::Box_d` has a special + constructor for the \cgal bounding box type `Bbox_2` (and + similar for dimension 3). We use this in the example to create \f$ 3 + \times 3\f$ `boxes` in a grid layout. Additionally we pick the + center box and the box in the upper-right corner as our second box + sequence `query`. - The default policy of the box type implements the `id`-number with - an explicit counter in the boxes, which is the default choice since it - always works. We use the `id`-number in our callback function to - report the result of the intersection algorithm call. The result will - be that the first `query` box intersects all nine `boxes` and - the second `query` box intersects the four boxes in the - upper-right quadrant. + The default policy of the box type implements the `id`-number with + an explicit counter in the boxes, which is the default choice since it + always works. We use the `id`-number in our callback function to + report the result of the intersection algorithm call. The result will + be that the first `query` box intersects all nine `boxes` and + the second `query` box intersects the four boxes in the + upper-right quadrant. - \cgalExample{Box_intersection_d/minimal.cpp} + \cgalExample{Box_intersection_d/minimal.cpp} */ @@ -299,7 +299,7 @@ void box_intersection_all_pairs_d( */ template< class ConcurrencyTag = CGAL::Sequential_tag, class RandomAccessIterator1, - class RandomAccessIterator2, + class RandomAccessIterator2, class Callback > void box_intersection_d( RandomAccessIterator1 begin1, RandomAccessIterator1 end1, @@ -334,71 +334,71 @@ namespace CGAL { /*! \addtogroup PkgBoxIntersectionD_box_self_intersection_all_pairs_d - The function `box_self_intersection_all_pairs_d()` computes the pairwise intersecting boxes - in a sequence of iso-oriented boxes in arbitrary dimension. - It does so by comparing all possible pairs of boxes and is thus - inferior to the fast `box_self_intersection_d()` algorithm. + The function `box_self_intersection_all_pairs_d()` computes the pairwise intersecting boxes + in a sequence of iso-oriented boxes in arbitrary dimension. + It does so by comparing all possible pairs of boxes and is thus + inferior to the fast `box_self_intersection_d()` algorithm. - The sequence of boxes is given with a forward iterator range. The + The sequence of boxes is given with a forward iterator range. The sequence is not modified. For each intersecting pair of boxes a - `callback` function object is called with the two intersecting - boxes as argument. + `callback` function object is called with the two intersecting + boxes as argument. - The algorithm is interface compatible with the - `box_self_intersection_d()` function. Similarly, we call the - `value_type` of the iterators the box handle, which is - either our box type or a pointer type to our box type. + The algorithm is interface compatible with the + `box_self_intersection_d()` function. Similarly, we call the + `value_type` of the iterators the box handle, which is + either our box type or a pointer type to our box type. - A \f$ d\f$-dimensional iso-oriented box is defined as the - %Cartesian product of \f$ d\f$ intervals. We call the - box half-open if the \f$ d\f$ intervals \f$ \{ [lo_i,hi_i) \,|\, 0 \leq - i < d\}\f$ are half-open intervals, and we call the box closed if - the \f$ d\f$ intervals \f$ \{ [lo_i,hi_i] \,|\, 0 \leq i < d\}\f$ are closed - intervals. Note that closed boxes support zero-width boxes and they - can intersect at their boundaries, while non-empty half-open boxes - always have a positive volume and they only intersect iff their - interiors overlap. The distinction between closed or half-open boxes - does not require a different representation of boxes, just a different - interpretation when comparing boxes, which is selected with the - `topology` parameter and its two values, - `Box_intersection_d::HALF_OPEN` and - `Box_intersection_d::CLOSED`. + A \f$ d\f$-dimensional iso-oriented box is defined as the + %Cartesian product of \f$ d\f$ intervals. We call the + box half-open if the \f$ d\f$ intervals \f$ \{ [lo_i,hi_i) \,|\, 0 \leq + i < d\}\f$ are half-open intervals, and we call the box closed if + the \f$ d\f$ intervals \f$ \{ [lo_i,hi_i] \,|\, 0 \leq i < d\}\f$ are closed + intervals. Note that closed boxes support zero-width boxes and they + can intersect at their boundaries, while non-empty half-open boxes + always have a positive volume and they only intersect iff their + interiors overlap. The distinction between closed or half-open boxes + does not require a different representation of boxes, just a different + interpretation when comparing boxes, which is selected with the + `topology` parameter and its two values, + `Box_intersection_d::HALF_OPEN` and + `Box_intersection_d::CLOSED`. - The algorithm uses a traits class of the `BoxIntersectionTraits_d` - concept to access the boxes. A default traits class is provided that - assumes that the box type is a model of the `BoxIntersectionBox_d` - concept and that the box handle, i.e., the iterators value type, is - identical to the box type or a pointer to the box type. + The algorithm uses a traits class of the `BoxIntersectionTraits_d` + concept to access the boxes. A default traits class is provided that + assumes that the box type is a model of the `BoxIntersectionBox_d` + concept and that the box handle, i.e., the iterators value type, is + identical to the box type or a pointer to the box type. \cgalHeading{Requirements} -
    +
    • `ForwardIter` must meet the requirements of `ForwardIterator`. We call its - value type `Box_handle` in the following. -
    • `Callback` must be of the `BinaryFunction` concept. - The `Box_handle` must be convertible to both argument types. The - return type is not used and can be `void`. -
    • The `Box_handle` must be a model of the `Assignable` concept. -
    • In addition, if the default box traits is used the `Box_handle` must - be a class type `T` or a pointer to a class type `T`, where - `T` must be a model of the `BoxIntersectionBox_d` concept. - In both cases, the default box traits specializes to a suitable - implementation. -
    • `BoxTraits` must be of the `BoxIntersectionTraits_d` concept. -
    + value type `Box_handle` in the following. +
  • `Callback` must be of the `BinaryFunction` concept. + The `Box_handle` must be convertible to both argument types. The + return type is not used and can be `void`. +
  • The `Box_handle` must be a model of the `Assignable` concept. +
  • In addition, if the default box traits is used the `Box_handle` must + be a class type `T` or a pointer to a class type `T`, where + `T` must be a model of the `BoxIntersectionBox_d` concept. + In both cases, the default box traits specializes to a suitable + implementation. +
  • `BoxTraits` must be of the `BoxIntersectionTraits_d` concept. +
\sa \link PkgBoxIntersectionD_box_intersection_d `CGAL::box_intersection_d()` \endlink \sa \link PkgBoxIntersectionD_box_self_intersection_d `CGAL::box_self_intersection_d()` \endlink \sa \link PkgBoxIntersectionD_box_intersection_all_pairs_d `CGAL::box_intersection_all_pairs_d()` \endlink - \sa `CGAL::Box_intersection_d::Box_traits_d` - \sa `BoxIntersectionBox_d` - \sa `BoxIntersectionTraits_d` + \sa `CGAL::Box_intersection_d::Box_traits_d` + \sa `BoxIntersectionBox_d` + \sa `BoxIntersectionTraits_d` \cgalHeading{Implementation} - The algorithm is trivially testing all pairs and runs therefore in time - \f$ O(n^2)\f$ where \f$ n\f$ is the size of the input sequence. This algorithm - does not use the id-number of the boxes. + The algorithm is trivially testing all pairs and runs therefore in time + \f$ O(n^2)\f$ where \f$ n\f$ is the size of the input sequence. This algorithm + does not use the id-number of the boxes. */ @@ -435,41 +435,41 @@ void box_self_intersection_all_pairs_d( namespace CGAL { /*! - \addtogroup PkgBoxIntersectionD_box_self_intersection_d - The function `box_self_intersection_d()` computes the pairwise intersecting boxes - in a sequence of iso-oriented boxes in arbitrary dimension. - The sequence of boxes is given with as a random-access iterator - range and will be reordered in the course of the algorithm. For each - intersecting pair of boxes a `callback` function object is called - with the two intersecting boxes as argument; the first argument is a - box from the sequence, the second argument is a copy of a box from the - sequence. The performance of the algorithm can be tuned with a - `cutoff` parameter, see the implementation section of the - `box_intersection_d()` function. + \addtogroup PkgBoxIntersectionD_box_self_intersection_d + The function `box_self_intersection_d()` computes the pairwise intersecting boxes + in a sequence of iso-oriented boxes in arbitrary dimension. + The sequence of boxes is given with as a random-access iterator + range and will be reordered in the course of the algorithm. For each + intersecting pair of boxes a `callback` function object is called + with the two intersecting boxes as argument; the first argument is a + box from the sequence, the second argument is a copy of a box from the + sequence. The performance of the algorithm can be tuned with a + `cutoff` parameter, see the implementation section of the + `box_intersection_d()` function. - The algorithm creates a second copy of the boxes and reorders the - boxes in the course of the algorithm. Now, depending on the size of a - box it can be faster to copy the boxes, or to work with pointers to - boxes and copy only pointers. We offer automatic support for both - options. To simplify the description, let us call the `value_type` - of the iterators box handle. The box handle can - either be our box type itself or a pointer (or const pointer) to the - box type. + The algorithm creates a second copy of the boxes and reorders the + boxes in the course of the algorithm. Now, depending on the size of a + box it can be faster to copy the boxes, or to work with pointers to + boxes and copy only pointers. We offer automatic support for both + options. To simplify the description, let us call the `value_type` + of the iterators box handle. The box handle can + either be our box type itself or a pointer (or const pointer) to the + box type. - A \f$ d\f$-dimensional iso-oriented box is defined as the - %Cartesian product of \f$ d\f$ intervals. We call the - box half-open if the \f$ d\f$ intervals \f$ \{ [lo_i,hi_i) \,|\, 0 \leq - i < d\}\f$ are half-open intervals, and we call the box closed if - the \f$ d\f$ intervals \f$ \{ [lo_i,hi_i] \,|\, 0 \leq i < d\}\f$ are closed - intervals. Note that closed boxes support zero-width boxes and they - can intersect at their boundaries, while non-empty half-open boxes - always have a positive volume and they only intersect iff their - interiors overlap. The distinction between closed or half-open boxes - does not require a different representation of boxes, just a different - interpretation when comparing boxes, which is selected with the - `topology` parameter and its two values, - `Box_intersection_d::HALF_OPEN` and - `Box_intersection_d::CLOSED`. + A \f$ d\f$-dimensional iso-oriented box is defined as the + %Cartesian product of \f$ d\f$ intervals. We call the + box half-open if the \f$ d\f$ intervals \f$ \{ [lo_i,hi_i) \,|\, 0 \leq + i < d\}\f$ are half-open intervals, and we call the box closed if + the \f$ d\f$ intervals \f$ \{ [lo_i,hi_i] \,|\, 0 \leq i < d\}\f$ are closed + intervals. Note that closed boxes support zero-width boxes and they + can intersect at their boundaries, while non-empty half-open boxes + always have a positive volume and they only intersect iff their + interiors overlap. The distinction between closed or half-open boxes + does not require a different representation of boxes, just a different + interpretation when comparing boxes, which is selected with the + `topology` parameter and its two values, + `Box_intersection_d::HALF_OPEN` and + `Box_intersection_d::CLOSED`. In addition, a box has a unique `id`-number. It is used to order boxes consistently in each dimension even if boxes have identical @@ -483,34 +483,34 @@ namespace CGAL { of the box is not acceptable if boxes are copied by value and one must either pass boxes by pointer or use another type of box `id`-number such as `ID_EXPLICIT`. - The algorithm uses a traits class of the `BoxIntersectionTraits_d` - concept to access the boxes. A default traits class is provided that - assumes that the box type is a model of the `BoxIntersectionBox_d` - concept and that the box handle, i.e., the iterators value type, is - identical to the box type or a pointer to the box type. + The algorithm uses a traits class of the `BoxIntersectionTraits_d` + concept to access the boxes. A default traits class is provided that + assumes that the box type is a model of the `BoxIntersectionBox_d` + concept and that the box handle, i.e., the iterators value type, is + identical to the box type or a pointer to the box type. \cgalHeading{Requirements} -
    -
  • `RandomAccessIterator` must be a mutable random-access - iterator. We call its value type `Box_handle` in the following. -
  • `Callback` must be of the `BinaryFunction` concept. - The `Box_handle` must be convertible to both argument types. The - return type is not used and can be `void`. -
  • The `Box_handle` must be a model of the `Assignable` concept. -
  • In addition, if the default box traits is used the `Box_handle` must - be a class type `T` or a pointer to a class type `T`, where - `T` must be a model of the `BoxIntersectionBox_d` concept. - In both cases, the default box traits specializes to a suitable - implementation. -
  • `BoxTraits` must be of the `BoxIntersectionTraits_d` concept. -
+
    +
  • `RandomAccessIterator` must be a mutable random-access + iterator. We call its value type `Box_handle` in the following. +
  • `Callback` must be of the `BinaryFunction` concept. + The `Box_handle` must be convertible to both argument types. The + return type is not used and can be `void`. +
  • The `Box_handle` must be a model of the `Assignable` concept. +
  • In addition, if the default box traits is used the `Box_handle` must + be a class type `T` or a pointer to a class type `T`, where + `T` must be a model of the `BoxIntersectionBox_d` concept. + In both cases, the default box traits specializes to a suitable + implementation. +
  • `BoxTraits` must be of the `BoxIntersectionTraits_d` concept. +
\sa \link PkgBoxIntersectionD_box_intersection_d `CGAL::box_intersection_d()` \endlink \sa \link PkgBoxIntersectionD_box_self_intersection_all_pairs_d `CGAL::box_self_intersection_all_pairs_d()` \endlink - \sa `CGAL::Box_intersection_d::Box_traits_d` - \sa `BoxIntersectionBox_d` - \sa `BoxIntersectionTraits_d` + \sa `CGAL::Box_intersection_d::Box_traits_d` + \sa `BoxIntersectionBox_d` + \sa `BoxIntersectionTraits_d` \cgalHeading{Implementation} @@ -522,20 +522,20 @@ namespace CGAL { \cgalHeading{Example} - The box implementation provided with - `Box_intersection_d::Box_d` has a special - constructor for the \cgal bounding box type `Bbox_2` (and - similar for dimension 3). We use this in the example to create \f$ 3 - \times 3\f$ `boxes` in a grid layout. + The box implementation provided with + `Box_intersection_d::Box_d` has a special + constructor for the \cgal bounding box type `Bbox_2` (and + similar for dimension 3). We use this in the example to create \f$ 3 + \times 3\f$ `boxes` in a grid layout. - The default policy of the box type implements the `id`-number with - an explicit counter in the boxes, which is the default choice since it - always works. We use the `id`-number in our callback function to - report the result of the intersection algorithm call. The result will - be 20 pairwise intersections, but the order in which they are reported - is non-intuitive. + The default policy of the box type implements the `id`-number with + an explicit counter in the boxes, which is the default choice since it + always works. We use the `id`-number in our callback function to + report the result of the intersection algorithm call. The result will + be 20 pairwise intersections, but the order in which they are reported + is non-intuitive. - \cgalExample{Box_intersection_d/minimal_self.cpp} + \cgalExample{Box_intersection_d/minimal_self.cpp} */ diff --git a/Box_intersection_d/include/CGAL/Box_intersection_d/Box_with_info_d.h b/Box_intersection_d/include/CGAL/Box_intersection_d/Box_with_info_d.h index eeccd7f9819..461d887d2b7 100644 --- a/Box_intersection_d/include/CGAL/Box_intersection_d/Box_with_info_d.h +++ b/Box_intersection_d/include/CGAL/Box_intersection_d/Box_with_info_d.h @@ -6,7 +6,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Lutz Kettner // Andreas Meyer diff --git a/Box_intersection_d/include/CGAL/Box_intersection_d/segment_tree.h b/Box_intersection_d/include/CGAL/Box_intersection_d/segment_tree.h index d9fccef3776..8e18301f9f7 100644 --- a/Box_intersection_d/include/CGAL/Box_intersection_d/segment_tree.h +++ b/Box_intersection_d/include/CGAL/Box_intersection_d/segment_tree.h @@ -6,7 +6,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Lutz Kettner // Andreas Meyer @@ -223,7 +223,7 @@ public: Iterative_radon( RandomAccessIter begin, RandomAccessIter end, Predicate_traits traits, int dim, int /*num_levels*/ ) - : begin(begin), size(end-begin), traits(traits), dim(dim), + : begin(begin), size(end-begin), traits(traits), dim(dim), rng(), dist(0,size-1), generator(rng,dist) {} @@ -335,7 +335,7 @@ void segment_tree( RandomAccessIter1 p_begin, RandomAccessIter1 p_end, #if CGAL_BOX_INTERSECTION_DEBUG CGAL_STATIC_THREAD_LOCAL_VARIABLE(int, level, -1); Counter bla( level ); - CGAL_BOX_INTERSECTION_DUMP("range: [" << lo << "," << hi << ") dim " + CGAL_BOX_INTERSECTION_DUMP("range: [" << lo << "," << hi << ") dim " << dim << std::endl ) CGAL_BOX_INTERSECTION_DUMP("intervals: " ) //dump_box_numbers( i_begin, i_end, traits ); @@ -381,7 +381,7 @@ void segment_tree( RandomAccessIter1 p_begin, RandomAccessIter1 p_end, std::partition( i_begin, i_end, Spanning( lo, hi, dim ) ); if( i_begin != i_span_end ) { - CGAL_BOX_INTERSECTION_DUMP( "checking spanning intervals ... " + CGAL_BOX_INTERSECTION_DUMP( "checking spanning intervals ... " << std::endl ) // make two calls for roots of segment tree at next level. segment_tree( p_begin, p_end, i_begin, i_span_end, inf, sup, @@ -396,7 +396,7 @@ void segment_tree( RandomAccessIter1 p_begin, RandomAccessIter1 p_end, if( p_mid == p_begin || p_mid == p_end ) { CGAL_BOX_INTERSECTION_DUMP( "unable to split points! ") //dump_points( p_begin, p_end, traits, dim ); - CGAL_BOX_INTERSECTION_DUMP( "performing modified two_way_san ... " + CGAL_BOX_INTERSECTION_DUMP( "performing modified two_way_san ... " << std::endl ) modified_two_way_scan( p_begin, p_end, i_span_end, i_end, callback, traits, dim, in_order ); diff --git a/Box_intersection_d/test/Box_intersection_d/test_box_grid.cpp b/Box_intersection_d/test/Box_intersection_d/test_box_grid.cpp index 0b06520214f..40083a18926 100644 --- a/Box_intersection_d/test/Box_intersection_d/test_box_grid.cpp +++ b/Box_intersection_d/test/Box_intersection_d/test_box_grid.cpp @@ -26,7 +26,7 @@ const Box init_boxes[11] = { Box( p, p+ 2), Box( p+ 4, p+ 6), Box( p+ 8, p+ Box( p+24, p+26), Box( p+28, p+30), Box( p+32, p+34), Box( p+16, p+18), Box( p+32, p+34)}; Box boxes[11]; -Box* query = boxes+9; +Box* query = boxes+9; void init() { diff --git a/CGAL_ipelets/demo/CGAL_ipelets/CMakeLists.txt b/CGAL_ipelets/demo/CGAL_ipelets/CMakeLists.txt index a764689a9d9..18e2f342352 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/CMakeLists.txt +++ b/CGAL_ipelets/demo/CGAL_ipelets/CMakeLists.txt @@ -68,9 +68,9 @@ if ( CGAL_FOUND ) if (WITH_IPE_7) add_definitions(-DCGAL_USE_IPE_7) endif() - - message("-- Using IPE version ${IPE_VERSION} compatibility.") - + + message("-- Using IPE version ${IPE_VERSION} compatibility.") + #setting installation directory get_filename_component(IPE_LIBRARY_DIR ${IPE_LIBRARIES} PATH) if (IPE_FOUND AND NOT IPELET_INSTALL_DIR) @@ -78,7 +78,7 @@ if ( CGAL_FOUND ) remove_leading_zero(IPE_MINOR_VERSION_1) remove_leading_zero(IPE_MINOR_VERSION_2) set(INSTALL_PATHS "${IPE_LIBRARY_DIR}/ipe/7.${IPE_MINOR_VERSION_1}.${IPE_MINOR_VERSION_2}/ipelets/") - find_path(IPELET_INSTALL_DIR + find_path(IPELET_INSTALL_DIR NAMES libgoodies.lua goodies.lua PATHS ${INSTALL_PATHS} DOC "The folder where ipelets will be installed" @@ -94,14 +94,14 @@ if ( CGAL_FOUND ) set(INSTALL_PATHS ${INSTALL_PATHS} /usr/lib/ipe/6.0/ipelets) - find_library(IPELET_INSTALL_DIR_FILES + find_library(IPELET_INSTALL_DIR_FILES NAMES align PATHS ${INSTALL_PATHS} ENV IPELETPATH ) if (IPELET_INSTALL_DIR_FILES) get_filename_component(IPELET_INSTALL_DIR ${IPELET_INSTALL_DIR_FILES} PATH) - endif() + endif() endif() endif() @@ -119,7 +119,7 @@ if ( CGAL_FOUND ) set(CGAL_IPELETS ${CGAL_IPELETS} multi_delaunay) set(CGAL_IPELETS ${CGAL_IPELETS} multi_regular) set(CGAL_IPELETS ${CGAL_IPELETS} partition) - set(CGAL_IPELETS ${CGAL_IPELETS} pca) + set(CGAL_IPELETS ${CGAL_IPELETS} pca) set(CGAL_IPELETS ${CGAL_IPELETS} skeleton) set(CGAL_IPELETS ${CGAL_IPELETS} svdlinf) set(CGAL_IPELETS ${CGAL_IPELETS} triangulation) diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Point_2.h b/Cartesian_kernel/include/CGAL/Cartesian/Point_2.h index 028c772c102..25c4a1699c3 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Point_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Point_2.h @@ -1,16 +1,16 @@ -// Copyright (c) 2000 +// Copyright (c) 2000 // Utrecht University (The Netherlands), // ETH Zurich (Switzerland), // INRIA Sophia-Antipolis (France), // Max-Planck-Institute Saarbruecken (Germany), -// and Tel-Aviv University (Israel). All rights reserved. +// and Tel-Aviv University (Israel). All rights reserved. // // This file is part of CGAL (www.cgal.org) // // $URL$ // $Id$ // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Andreas Fabri, Herve Bronnimann @@ -36,7 +36,7 @@ class PointC2 public: typedef typename Vector_2_::Cartesian_const_iterator Cartesian_const_iterator; - + typedef R_ R; PointC2() {} @@ -63,7 +63,7 @@ public: { return base.x(); } - + const FT& y() const { return base.y(); @@ -82,14 +82,14 @@ public: return base.hw(); } - Cartesian_const_iterator cartesian_begin() const + Cartesian_const_iterator cartesian_begin() const { - return base.cartesian_begin(); + return base.cartesian_begin(); } - Cartesian_const_iterator cartesian_end() const + Cartesian_const_iterator cartesian_end() const { - return base.cartesian_end(); + return base.cartesian_end(); } typename R_::Boolean operator==(const PointC2 &p) const diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Point_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Point_3.h index b46ab99284b..9d4dcf2104d 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Point_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Point_3.h @@ -1,16 +1,16 @@ -// Copyright (c) 2000 +// Copyright (c) 2000 // Utrecht University (The Netherlands), // ETH Zurich (Switzerland), // INRIA Sophia-Antipolis (France), // Max-Planck-Institute Saarbruecken (Germany), -// and Tel-Aviv University (Israel). All rights reserved. +// and Tel-Aviv University (Israel). All rights reserved. // // This file is part of CGAL (www.cgal.org) // // $URL$ // $Id$ // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Andreas Fabri and Herve Bronnimann @@ -91,12 +91,12 @@ public: const FT & operator[](int i) const; const FT & homogeneous(int i) const; - Cartesian_const_iterator cartesian_begin() const + Cartesian_const_iterator cartesian_begin() const { - return base.cartesian_begin(); + return base.cartesian_begin(); } - Cartesian_const_iterator cartesian_end() const + Cartesian_const_iterator cartesian_end() const { return base.cartesian_end(); } diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Vector_2.h b/Cartesian_kernel/include/CGAL/Cartesian/Vector_2.h index 01986b321a3..905d766907f 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Vector_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Vector_2.h @@ -1,16 +1,16 @@ -// Copyright (c) 2000 +// Copyright (c) 2000 // Utrecht University (The Netherlands), // ETH Zurich (Switzerland), // INRIA Sophia-Antipolis (France), // Max-Planck-Institute Saarbruecken (Germany), -// and Tel-Aviv University (Israel). All rights reserved. +// and Tel-Aviv University (Israel). All rights reserved. // // This file is part of CGAL (www.cgal.org) // // $URL$ // $Id$ // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Andreas Fabri, Herve Bronnimann @@ -48,7 +48,7 @@ public: typedef R_ R; VectorC2() {} - + VectorC2(const FT &x, const FT &y) : base(CGAL::make_array(x, y)) {} @@ -104,7 +104,7 @@ public: template < class R > CGAL_KERNEL_INLINE -bool +bool operator==(const VectorC2 &v, const VectorC2 &w) { return w.x() == v.x() && w.y() == v.y(); @@ -112,7 +112,7 @@ operator==(const VectorC2 &v, const VectorC2 &w) template < class R > inline -bool +bool operator!=(const VectorC2 &v, const VectorC2 &w) { return !(v == w); diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Vector_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Vector_3.h index 72954931d0b..222d73652e3 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Vector_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Vector_3.h @@ -1,16 +1,16 @@ -// Copyright (c) 2000 +// Copyright (c) 2000 // Utrecht University (The Netherlands), // ETH Zurich (Switzerland), // INRIA Sophia-Antipolis (France), // Max-Planck-Institute Saarbruecken (Germany), -// and Tel-Aviv University (Israel). All rights reserved. +// and Tel-Aviv University (Israel). All rights reserved. // // This file is part of CGAL (www.cgal.org) // // $URL$ // $Id$ // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author : Andreas Fabri @@ -156,7 +156,7 @@ operator!=(const VectorC3 &v, const VectorC3 &w) template < class R > inline bool -operator==(const VectorC3 &v, const Null_vector &) +operator==(const VectorC3 &v, const Null_vector &) { return CGAL_NTS is_zero(v.x()) && CGAL_NTS is_zero(v.y()) && CGAL_NTS is_zero(v.z()); @@ -165,7 +165,7 @@ operator==(const VectorC3 &v, const Null_vector &) template < class R > inline bool -operator==(const Null_vector &n, const VectorC3 &v) +operator==(const Null_vector &n, const VectorC3 &v) { return v == n; } diff --git a/Classification/examples/Classification/CMakeLists.txt b/Classification/examples/Classification/CMakeLists.txt index 4cdfe2e2c08..f2e1cf3ec61 100644 --- a/Classification/examples/Classification/CMakeLists.txt +++ b/Classification/examples/Classification/CMakeLists.txt @@ -10,7 +10,7 @@ find_package( CGAL QUIET COMPONENTS ) if ( NOT CGAL_FOUND ) message(STATUS "This project requires the CGAL library, and will not be compiled.") - return() + return() endif() # Boost and its components @@ -18,7 +18,7 @@ find_package( Boost REQUIRED ) if ( NOT Boost_FOUND ) message(STATUS "This project requires the Boost library, and will not be compiled.") - return() + return() endif() set(Classification_dependencies_met TRUE) @@ -38,7 +38,7 @@ if (NOT OpenCV_FOUND) message(STATUS "NOTICE: OpenCV was not found. OpenCV random forest predicate for classification won't be available.") endif() -find_package(TensorFlow QUIET) +find_package(TensorFlow QUIET) if (NOT TensorFlow_FOUND) message(STATUS "NOTICE: TensorFlow was not found. TensorFlow neural network predicate for classification won't be available.") endif() diff --git a/Classification/examples/Classification/example_classification.cpp b/Classification/examples/Classification/example_classification.cpp index 0475fdfcfb3..9d820d37d92 100644 --- a/Classification/examples/Classification/example_classification.cpp +++ b/Classification/examples/Classification/example_classification.cpp @@ -74,7 +74,7 @@ int main (int argc, char** argv) //! [Analysis] /////////////////////////////////////////////////////////////////// - + /////////////////////////////////////////////////////////////////// //! [Features] @@ -87,7 +87,7 @@ int main (int argc, char** argv) #ifdef CGAL_LINKED_WITH_TBB features.begin_parallel_additions(); #endif - + Feature_handle distance_to_plane = features.add (pts, Pmap(), eigen); Feature_handle dispersion = features.add (pts, Pmap(), grid, radius_neighbors); @@ -97,7 +97,7 @@ int main (int argc, char** argv) #ifdef CGAL_LINKED_WITH_TBB features.end_parallel_additions(); #endif - + //! [Features] /////////////////////////////////////////////////////////////////// @@ -111,7 +111,7 @@ int main (int argc, char** argv) //! [Labels] /////////////////////////////////////////////////////////////////// - + /////////////////////////////////////////////////////////////////// //! [Weights] @@ -120,12 +120,12 @@ int main (int argc, char** argv) classifier.set_weight (distance_to_plane, 6.75e-2f); classifier.set_weight (dispersion, 5.45e-1f); classifier.set_weight (elevation, 1.47e1f); - + std::cerr << "Setting effects" << std::endl; classifier.set_effect (ground, distance_to_plane, Classifier::NEUTRAL); classifier.set_effect (ground, dispersion, Classifier::NEUTRAL); classifier.set_effect (ground, elevation, Classifier::PENALIZING); - + classifier.set_effect (vegetation, distance_to_plane, Classifier::FAVORING); classifier.set_effect (vegetation, dispersion, Classifier::FAVORING); classifier.set_effect (vegetation, elevation, Classifier::NEUTRAL); @@ -143,7 +143,7 @@ int main (int argc, char** argv) /////////////////////////////////////////////////////////////////// //! [Classify] std::vector label_indices (pts.size(), -1); - + CGAL::Real_timer t; t.start(); Classification::classify (pts, labels, classifier, label_indices); @@ -152,7 +152,7 @@ int main (int argc, char** argv) t.reset(); //! [Classify] /////////////////////////////////////////////////////////////////// - + /////////////////////////////////////////////////////////////////// //! [Smoothing] t.start(); @@ -177,7 +177,7 @@ int main (int argc, char** argv) std::cerr << "Classification with graphcut performed in " << t.time() << " second(s)" << std::endl; //! [Graph_cut] /////////////////////////////////////////////////////////////////// - + // Save the output in a colored PLY format std::ofstream f ("classification.ply"); @@ -191,11 +191,11 @@ int main (int argc, char** argv) << "property uchar green" << std::endl << "property uchar blue" << std::endl << "end_header" << std::endl; - + for (std::size_t i = 0; i < pts.size(); ++ i) { f << pts[i] << " "; - + Label_handle label = labels[std::size_t(label_indices[i])]; if (label == ground) f << "245 180 0" << std::endl; @@ -209,7 +209,7 @@ int main (int argc, char** argv) std::cerr << "Error: unknown classification label" << std::endl; } } - + std::cerr << "All done" << std::endl; return EXIT_SUCCESS; } diff --git a/Classification/examples/Classification/example_cluster_classification.cpp b/Classification/examples/Classification/example_cluster_classification.cpp index 78f48b8ddde..3c4b08f60e6 100644 --- a/Classification/examples/Classification/example_cluster_classification.cpp +++ b/Classification/examples/Classification/example_cluster_classification.cpp @@ -51,7 +51,7 @@ int main (int argc, char** argv) { std::string filename = "data/b9.ply"; std::string filename_config = "data/b9_clusters_config.gz"; - + if (argc > 1) filename = argv[1]; if (argc > 2) @@ -73,42 +73,42 @@ int main (int argc, char** argv) t.reset(); Feature_set pointwise_features; - + std::cerr << "Generating pointwise features" << std::endl; t.start(); Feature_generator generator (pts, pts.point_map(), 5); // using 5 scales - + #ifdef CGAL_LINKED_WITH_TBB pointwise_features.begin_parallel_additions(); #endif - + generator.generate_point_based_features (pointwise_features); generator.generate_normal_based_features (pointwise_features, pts.normal_map()); #ifdef CGAL_LINKED_WITH_TBB pointwise_features.end_parallel_additions(); #endif - + t.stop(); std::cerr << "Done in " << t.time() << " second(s)" << std::endl; /////////////////////////////////////////////////////////////////// //! [Cluster] - + std::cerr << "Detecting planes and creating clusters" << std::endl; t.start(); - + const double search_sphere_radius = 1.0; const double max_distance_to_plane = 1.0; const double max_accepted_angle = 25.0; const std::size_t min_region_size = 10; Neighbor_query neighbor_query ( - pts, - search_sphere_radius, + pts, + search_sphere_radius, pts.point_map()); Region_type region_type ( - pts, + pts, max_distance_to_plane, max_accepted_angle, min_region_size, pts.point_map(), pts.normal_map()); Region_growing region_growing ( @@ -118,10 +118,10 @@ int main (int argc, char** argv) region_growing.detect (boost::make_function_output_iterator ([&](const std::vector& region) -> void { - + // Create a new cluster. Classification::Cluster cluster (pts, pts.point_map()); - for (const std::size_t idx : region) + for (const std::size_t idx : region) cluster.insert(idx); clusters.push_back(cluster); })); @@ -133,24 +133,24 @@ int main (int argc, char** argv) //! [Cluster] /////////////////////////////////////////////////////////////////// - + std::cerr << "Computing cluster features" << std::endl; - + /////////////////////////////////////////////////////////////////// //! [Eigen] - + Local_eigen_analysis eigen = Local_eigen_analysis::create_from_point_clusters (clusters); //! [Eigen] /////////////////////////////////////////////////////////////////// t.start(); - + /////////////////////////////////////////////////////////////////// //! [Features] - + Feature_set features; - + #ifdef CGAL_LINKED_WITH_TBB features.begin_parallel_additions(); #endif @@ -172,19 +172,19 @@ int main (int argc, char** argv) features.add (clusters); features.add (clusters); - + for (std::size_t i = 0; i < 3; ++ i) features.add (clusters, eigen, (unsigned int)(i)); - + #ifdef CGAL_LINKED_WITH_TBB features.end_parallel_additions(); #endif - + //! [Features] /////////////////////////////////////////////////////////////////// - + t.stop(); - + // Add types. Label_set labels; Label_handle ground = labels.add ("ground"); @@ -192,10 +192,10 @@ int main (int argc, char** argv) Label_handle roof = labels.add ("roof"); std::vector label_indices(clusters.size(), -1); - + std::cerr << "Using ETHZ Random Forest Classifier" << std::endl; Classification::ETHZ_random_forest_classifier classifier (labels, features); - + std::cerr << "Loading configuration" << std::endl; std::ifstream in_config (filename_config, std::ios_base::in | std::ios_base::binary); classifier.load_configuration (in_config); @@ -205,7 +205,7 @@ int main (int argc, char** argv) t.start(); Classification::classify (clusters, labels, classifier, label_indices); t.stop(); - + std::cerr << "Classification done in " << t.time() << " second(s)" << std::endl; return EXIT_SUCCESS; } diff --git a/Classification/include/CGAL/Classification/ETHZ/Random_forest_classifier.h b/Classification/include/CGAL/Classification/ETHZ/Random_forest_classifier.h index 62b6dc57d26..e3e196cbca2 100644 --- a/Classification/include/CGAL/Classification/ETHZ/Random_forest_classifier.h +++ b/Classification/include/CGAL/Classification/ETHZ/Random_forest_classifier.h @@ -68,16 +68,16 @@ class Random_forest_classifier typedef CGAL::internal::liblearning::RandomForest::RandomForest < CGAL::internal::liblearning::RandomForest::NodeGini < CGAL::internal::liblearning::RandomForest::AxisAlignedSplitter> > Forest; - + const Label_set& m_labels; const Feature_set& m_features; Forest* m_rfc; public: - + /// \name Constructor /// @{ - + /*! \brief Instantiates the classifier using the sets of `labels` and `features`. @@ -86,7 +86,7 @@ public: const Feature_set& features) : m_labels (labels), m_features (features), m_rfc (nullptr) { } - + /*! \brief Copies the `other` classifier's configuration using another set of `features`. @@ -106,7 +106,7 @@ public: other.save_configuration(stream); this->load_configuration(stream); } - + /// \cond SKIP_IN_MANUAL ~Random_forest_classifier () { @@ -114,7 +114,7 @@ public: delete m_rfc; } /// \endcond - + /// @} /// \name Training @@ -130,7 +130,7 @@ public: train(ground_truth, reset_trees, num_trees, max_depth); } /// \endcond - + /*! \brief Runs the training algorithm. @@ -179,7 +179,7 @@ public: std::vector gt; std::vector ft; - + for (std::size_t i = 0; i < ground_truth.size(); ++ i) { int g = int(ground_truth[i]); @@ -193,7 +193,7 @@ public: CGAL_CLASSIFICATION_CERR << "Using " << gt.size() << " inliers" << std::endl; - CGAL::internal::liblearning::DataView2D label_vector (&(gt[0]), gt.size(), 1); + CGAL::internal::liblearning::DataView2D label_vector (&(gt[0]), gt.size(), 1); CGAL::internal::liblearning::DataView2D feature_vector(&(ft[0]), gt.size(), ft.size() / gt.size()); if (m_rfc != nullptr && reset_trees) @@ -201,12 +201,12 @@ public: delete m_rfc; m_rfc = nullptr; } - + if (m_rfc == nullptr) m_rfc = new Forest (params); CGAL::internal::liblearning::RandomForest::AxisAlignedRandomSplitGenerator generator; - + m_rfc->train (feature_vector, label_vector, CGAL::internal::liblearning::DataView2D(), generator, 0, reset_trees, m_labels.size()); } @@ -215,7 +215,7 @@ public: void operator() (std::size_t item_index, std::vector& out) const { out.resize (m_labels.size(), 0.); - + std::vector ft; ft.reserve (m_features.size()); for (std::size_t f = 0; f < m_features.size(); ++ f) @@ -224,18 +224,18 @@ public: std::vector prob (m_labels.size()); m_rfc->evaluate (ft.data(), prob.data()); - + for (std::size_t i = 0; i < out.size(); ++ i) out[i] = (std::min) (1.f, (std::max) (0.f, prob[i])); } /// \endcond - + /// @} /// \name Miscellaneous /// @{ - + /*! \brief Computes, for each feature, how many nodes in the forest uses it as a split criterion. @@ -265,12 +265,12 @@ public: count.resize(m_features.size(), 0); return m_rfc->get_feature_usage(count); } - + /// @} /// \name Input/Output /// @{ - + /*! \brief Saves the current configuration in the stream `output`. @@ -304,7 +304,7 @@ public: if (m_rfc != nullptr) delete m_rfc; m_rfc = new Forest (params); - + boost::iostreams::filtering_istream ins; ins.push(boost::iostreams::gzip_decompressor()); ins.push(input); diff --git a/Classification/include/CGAL/Classification/Local_eigen_analysis.h b/Classification/include/CGAL/Classification/Local_eigen_analysis.h index d25cf4cfd0b..e5da6b15b74 100644 --- a/Classification/include/CGAL/Classification/Local_eigen_analysis.h +++ b/Classification/include/CGAL/Classification/Local_eigen_analysis.h @@ -58,7 +58,7 @@ class Local_eigen_analysis { public: typedef std::array Eigenvalues; ///< Eigenvalues (sorted in ascending order) - + private: #ifdef CGAL_LINKED_WITH_TBB @@ -71,9 +71,9 @@ private: const NeighborQuery& m_neighbor_query; float& m_mean_range; std::mutex& m_mutex; - + public: - + Compute_eigen_values (Local_eigen_analysis& eigen, const PointRange& input, PointMap point_map, @@ -83,7 +83,7 @@ private: : m_eigen (eigen), m_input (input), m_point_map (point_map), m_neighbor_query (neighbor_query), m_mean_range (mean_range), m_mutex (mutex) { } - + void operator()(const tbb::blocked_range& r) const { std::vector neighbors; @@ -102,7 +102,7 @@ private: (CGAL::squared_distance (get(m_point_map, *(m_input.begin() + i)), get(m_point_map, *(m_input.begin() + neighbors.back()))))); m_mutex.unlock(); - + m_eigen.compute (i, get(m_point_map, *(m_input.begin()+i)), neighbor_points); } @@ -116,15 +116,15 @@ private: typedef typename boost::graph_traits::face_descriptor face_descriptor; typedef typename boost::property_map::type::value_type face_index; typedef typename boost::graph_traits::face_iterator face_iterator; - + Local_eigen_analysis& m_eigen; const FaceListGraph& m_input; const NeighborQuery& m_neighbor_query; float& m_mean_range; std::mutex& m_mutex; - + public: - + Compute_eigen_values_graph (Local_eigen_analysis& eigen, const FaceListGraph& input, const NeighborQuery& neighbor_query, @@ -133,7 +133,7 @@ private: : m_eigen (eigen), m_input (input), m_neighbor_query (neighbor_query), m_mean_range (mean_range), m_mutex (mutex) { } - + void operator()(const tbb::blocked_range& r) const { face_iterator begin = faces(m_input).first; @@ -146,7 +146,7 @@ private: m_mutex.lock(); m_mean_range += m_eigen.face_radius(fd, m_input); m_mutex.unlock(); - + m_eigen.compute_triangles (m_input, fd, neighbors); } @@ -154,15 +154,15 @@ private: }; #endif - + template class Compute_clusters_eigen_values { Local_eigen_analysis& m_eigen; const ClusterRange& m_input; - + public: - + Compute_clusters_eigen_values (Local_eigen_analysis& eigen, const ClusterRange& input) : m_eigen (eigen), m_input (input) @@ -194,7 +194,7 @@ private: typedef std::array float3; typedef std::array float2; typedef std::array cfloat2; - + struct Content { std::vector eigenvalues; @@ -204,7 +204,7 @@ private: }; boost::shared_ptr m_content; // To avoid copies with named constructors - + public: /// \cond SKIP_IN_MANUAL @@ -214,7 +214,7 @@ public: /// \name Named Constructors /// @{ - /*! + /*! \brief Computes the local eigen analysis of an input point set based on a local neighborhood. @@ -261,9 +261,9 @@ public: out.m_content->eigenvalues.resize (input.size()); out.m_content->centroids.resize (input.size()); out.m_content->smallest_eigenvectors.resize (input.size()); - + out.m_content->mean_range = 0.; - + #ifndef CGAL_LINKED_WITH_TBB CGAL_static_assertion_msg (!(boost::is_convertible::value), "Parallel_tag is enabled but TBB is unavailable."); @@ -290,7 +290,7 @@ public: out.m_content->mean_range += float(CGAL::sqrt (CGAL::squared_distance (get(point_map, *(input.begin() + i)), get(point_map, *(input.begin() + neighbors.back()))))); - + out.compute (i, get(point_map, *(input.begin()+i)), neighbor_points); } @@ -299,13 +299,13 @@ public: return out; } - - - /*! + + + /*! \brief Computes the local eigen analysis of an input face graph based on a local neighborhood. - \tparam FaceListGraph model of `FaceListGraph`. + \tparam FaceListGraph model of `FaceListGraph`. \tparam NeighborQuery model of `NeighborQuery` \tparam ConcurrencyTag enables sequential versus parallel algorithm. Possible values are `Parallel_tag` (default value if %CGAL @@ -343,15 +343,15 @@ public: Local_eigen_analysis out; out.m_content = boost::make_shared(); - + Face_range range (faces(input)); out.m_content->eigenvalues.resize (range.size()); out.m_content->centroids.resize (range.size()); out.m_content->smallest_eigenvectors.resize (range.size()); - + out.m_content->mean_range = 0.; - + #ifndef CGAL_LINKED_WITH_TBB CGAL_static_assertion_msg (!(boost::is_convertible::value), "Parallel_tag is enabled but TBB is unavailable."); @@ -373,18 +373,18 @@ public: neighbor_query (fd, std::back_inserter (neighbors)); out.m_content->mean_range += out.face_radius(fd, input); - + out.compute_triangles (input, fd, neighbors); } } - + out.m_content->mean_range /= range.size(); return out; } - - /*! + + /*! \brief Computes the local eigen analysis of an input set of point clusters based on a local neighborhood. @@ -419,17 +419,17 @@ public: { Local_eigen_analysis out; out.m_content = boost::make_shared(); - + out.m_content->eigenvalues.resize (input.size()); out.m_content->centroids.resize (input.size()); out.m_content->smallest_eigenvectors.resize (input.size()); - + out.m_content->mean_range = 0.; Compute_clusters_eigen_values f(out, input); - + #ifndef CGAL_LINKED_WITH_TBB CGAL_static_assertion_msg (!(boost::is_convertible::value), "Parallel_tag is enabled but TBB is unavailable."); @@ -506,7 +506,7 @@ private: const FaceListGraph& g) { typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; - + float out = 0.f; for(halfedge_descriptor hd : halfedges_around_face(halfedge(fd, g), g)) { @@ -521,7 +521,7 @@ private: void compute (std::size_t index, const Point& query, std::vector& neighbor_points) { typedef typename Kernel_traits::Kernel::Vector_3 Vector; - + if (neighbor_points.size() == 0) { m_content->eigenvalues[index] = make_array (compressed_float(0), compressed_float(0)); @@ -532,9 +532,9 @@ private: Point centroid = CGAL::centroid (neighbor_points.begin(), neighbor_points.end()); m_content->centroids[index] = make_array( float(centroid.x()), float(centroid.y()), float(centroid.z()) ); - + std::array covariance = make_array( 0.f, 0.f, 0.f, 0.f, 0.f, 0.f ); - + for (std::size_t i = 0; i < neighbor_points.size(); ++ i) { Vector d = neighbor_points[i] - centroid; @@ -559,10 +559,10 @@ private: if (sum > 0.f) for (std::size_t i = 0; i < 3; ++ i) evalues[i] = evalues[i] / sum; - + m_content->eigenvalues[index] = make_array(compress_float (evalues[1]), compress_float (evalues[2])); - + sum = evectors[0] + evectors[1] + evectors[2]; if (sum > 0.f) for (std::size_t i = 0; i < 3; ++ i) @@ -578,7 +578,7 @@ private: typedef typename boost::property_map::type::value_type Point; typedef typename Kernel_traits::Kernel Kernel; typedef typename Kernel::Triangle_3 Triangle; - + typedef typename boost::graph_traits::face_descriptor face_descriptor; typedef typename boost::graph_traits::face_iterator face_iterator; @@ -595,7 +595,7 @@ private: tr.end(), Kernel(), CGAL::Dimension_tag<2>()); m_content->centroids[get(get(CGAL::face_index,g), query)] = {{ float(c.x()), float(c.y()), float(c.z()) }}; - + m_content->smallest_eigenvectors[get(get(CGAL::face_index,g), query)] = {{ 0.f, 0.f }}; return; } @@ -620,9 +620,9 @@ private: CGAL::internal::assemble_covariance_matrix_3 (triangles.begin(), triangles.end(), covariance, c, Kernel(), (Triangle*)nullptr, CGAL::Dimension_tag<2>(), DiagonalizeTraits()); - + m_content->centroids[get(get(CGAL::face_index,g), query)] = {{ float(c.x()), float(c.y()), float(c.z()) }}; - + std::array evalues = {{ 0.f, 0.f, 0.f }}; std::array evectors = {{ 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, @@ -640,19 +640,19 @@ private: m_content->eigenvalues[get(get(CGAL::face_index,g), query)] = make_array(compress_float (evalues[1]), compress_float (evalues[2])); - + sum = evectors[0] + evectors[1] + evectors[2]; if (sum > 0.f) for (std::size_t i = 0; i < 3; ++ i) evectors[i] = evectors[i] / sum; m_content->smallest_eigenvectors[get(get(CGAL::face_index,g), query)] = {{ float(evectors[0]), float(evectors[1]), }}; } - + }; - + } - + } diff --git a/Classification/include/CGAL/Classification/Mesh_feature_generator.h b/Classification/include/CGAL/Classification/Mesh_feature_generator.h index b68fce17bc8..601b059c916 100644 --- a/Classification/include/CGAL/Classification/Mesh_feature_generator.h +++ b/Classification/include/CGAL/Classification/Mesh_feature_generator.h @@ -73,7 +73,7 @@ namespace Classification { not be deleted before the feature set. \tparam GeomTraits model of \cgal Kernel. - \tparam FaceListGraph model of `FaceListGraph`. + \tparam FaceListGraph model of `FaceListGraph`. \tparam PointMap model of `ReadablePropertyMap` whose key type is `boost::graph_traits::%face_descriptor` and value type is `GeomTraits::Point_3`. @@ -99,7 +99,7 @@ template > class Mesh_feature_generator { - + public: typedef typename GeomTraits::Iso_cuboid_3 Iso_cuboid_3; @@ -109,14 +109,14 @@ public: typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; typedef typename boost::graph_traits::face_iterator face_iterator; typedef typename CGAL::Iterator_range Face_range; - + typedef typename PointMap::value_type Point; typedef CGAL::Identity_property_map Face_map; /// \endcond public: - + typedef Classification::Planimetric_grid Planimetric_grid; typedef Classification::Mesh_neighborhood @@ -125,7 +125,7 @@ public: /// \cond SKIP_IN_MANUAL typedef Classification::Feature_handle Feature_handle; - + typedef Classification::Feature::Distance_to_plane Distance_to_plane; typedef Classification::Feature::Elevation @@ -142,7 +142,7 @@ public: Verticality; typedef Classification::Feature::Eigenvalue Eigenvalue; /// \endcond - + private: struct Scale @@ -151,7 +151,7 @@ private: Planimetric_grid* grid; Local_eigen_analysis* eigen; float voxel_size; - + Scale (const FaceListGraph& input, const Face_range& range, PointMap point_map, @@ -164,12 +164,12 @@ private: t.start(); neighborhood = new Neighborhood (input); t.stop(); - + CGAL_CLASSIFICATION_CERR << "Neighborhood computed in " << t.time() << " second(s)" << std::endl; t.reset(); t.start(); - + eigen = new Local_eigen_analysis (Local_eigen_analysis::create_from_face_graph (input, neighborhood->n_ring_neighbor_query(nb_scale + 1), @@ -214,7 +214,7 @@ private: float grid_resolution() const { return voxel_size; } float radius_neighbors() const { return voxel_size * 3; } float radius_dtm() const { return voxel_size * 10; } - + }; Iso_cuboid_3 m_bbox; @@ -223,13 +223,13 @@ private: const FaceListGraph& m_input; Face_range m_range; PointMap m_point_map; - + public: - + /// \name Constructor /// @{ - + /*! \brief Initializes a feature generator from an input range. @@ -238,7 +238,7 @@ public: `CGAL::compute_average_spacing()` using 6 neighbors. The data structures needed (`Neighborhood`, `Planimetric_grid` and `Local_eigen_analysis`) are computed at `nb_scales` recursively - larger scales. + larger scales. \param input input mesh. \param point_map property map to access a representative point of @@ -260,14 +260,14 @@ public: boost::make_transform_iterator (m_range.end(), CGAL::Property_map_to_unary_function(m_point_map))); CGAL::Real_timer t; t.start(); - + m_scales.reserve (nb_scales); - + m_scales.push_back (new Scale (m_input, m_range, m_point_map, m_bbox, voxel_size, 0)); - + if (voxel_size == -1.f) voxel_size = m_scales[0]->grid_resolution(); - + for (std::size_t i = 1; i < nb_scales; ++ i) { voxel_size *= 2; @@ -279,7 +279,7 @@ public: } /// @} - + /// \cond SKIP_IN_MANUAL virtual ~Mesh_feature_generator() { @@ -371,17 +371,17 @@ public: \brief Returns the local eigen analysis structure at scale `scale`. */ const Local_eigen_analysis& eigen(std::size_t scale = 0) const { return *(m_scales[scale]->eigen); } - + /// @} /// \name Parameters /// @{ - + /*! \brief Returns the number of scales that were computed. */ std::size_t number_of_scales() const { return m_scales.size(); } - + /*! \brief Returns the grid resolution at scale `scale`. This resolution is the length and width of a cell of the @@ -404,7 +404,7 @@ public: float radius_dtm(std::size_t scale = 0) const { return m_scales[scale]->radius_dtm(); } /// @} - + private: void clear() @@ -418,7 +418,7 @@ private: } // namespace Classification - + } // namespace CGAL diff --git a/Classification/include/CGAL/Classification/Point_set_feature_generator.h b/Classification/include/CGAL/Classification/Point_set_feature_generator.h index 58e58bb54dc..1167bc9e8ca 100644 --- a/Classification/include/CGAL/Classification/Point_set_feature_generator.h +++ b/Classification/include/CGAL/Classification/Point_set_feature_generator.h @@ -100,7 +100,7 @@ template Planimetric_grid; typedef Classification::Point_set_neighborhood @@ -135,7 +135,7 @@ public: typedef Classification::Feature::Verticality Verticality; typedef Classification::Feature::Eigenvalue Eigenvalue; - + typedef typename Neighborhood::K_neighbor_query Neighbor_query; #ifdef CGAL_CLASSIFICATION_USE_GRADIENT_OF_FEATURE @@ -143,7 +143,7 @@ public: Gradient_of_feature; #endif /// \endcond - + private: struct Scale @@ -152,7 +152,7 @@ private: Planimetric_grid* grid; Local_eigen_analysis* eigen; float voxel_size; - + Scale (const PointRange& input, PointMap point_map, const Iso_cuboid_3& bbox, float voxel_size, Planimetric_grid* lower_grid = nullptr) @@ -165,7 +165,7 @@ private: else neighborhood = new Neighborhood (input, point_map, voxel_size); t.stop(); - + if (lower_grid == nullptr) CGAL_CLASSIFICATION_CERR << "Neighborhood computed in " << t.time() << " second(s)" << std::endl; else @@ -173,11 +173,11 @@ private: << " computed in " << t.time() << " second(s)" << std::endl; t.reset(); t.start(); - + eigen = new Local_eigen_analysis (Local_eigen_analysis::create_from_point_set (input, point_map, neighborhood->k_neighbor_query(12), ConcurrencyTag(), DiagonalizeTraits())); - + float range = eigen->mean_range(); if (this->voxel_size < 0) this->voxel_size = range; @@ -218,7 +218,7 @@ private: float grid_resolution() const { return voxel_size; } float radius_neighbors() const { return voxel_size * 3; } float radius_dtm() const { return voxel_size * 10; } - + }; Iso_cuboid_3 m_bbox; @@ -226,12 +226,12 @@ private: const PointRange& m_input; PointMap m_point_map; - + public: - + /// \name Constructor /// @{ - + /*! \brief Initializes a feature generator from an input range. @@ -240,7 +240,7 @@ public: `CGAL::compute_average_spacing()` using 6 neighbors. The data structures needed (`Neighborhood`, `Planimetric_grid` and `Local_eigen_analysis`) are computed at `nb_scales` recursively - larger scales. + larger scales. \param input point range. \param point_map property map to access the input points. @@ -260,14 +260,14 @@ public: boost::make_transform_iterator (m_input.end(), CGAL::Property_map_to_unary_function(m_point_map))); CGAL::Real_timer t; t.start(); - + m_scales.reserve (nb_scales); - + m_scales.push_back (new Scale (m_input, m_point_map, m_bbox, voxel_size)); if (voxel_size == -1.f) voxel_size = m_scales[0]->grid_resolution(); - + for (std::size_t i = 1; i < nb_scales; ++ i) { voxel_size *= 2; @@ -279,7 +279,7 @@ public: } /// @} - + /// \cond SKIP_IN_MANUAL virtual ~Point_set_feature_generator() { @@ -422,12 +422,12 @@ public: /// \name Parameters /// @{ - + /*! \brief Returns the number of scales that were computed. */ std::size_t number_of_scales() const { return m_scales.size(); } - + /*! \brief Returns the grid resolution at scale `scale`. This resolution is the length and width of a cell of the @@ -451,7 +451,7 @@ public: /// @} - + private: void clear() @@ -500,7 +500,7 @@ private: } // namespace Classification - + } // namespace CGAL diff --git a/Classification/include/CGAL/Classification/Point_set_neighborhood.h b/Classification/include/CGAL/Classification/Point_set_neighborhood.h index 7ecfecb2492..8b5b52c7872 100644 --- a/Classification/include/CGAL/Classification/Point_set_neighborhood.h +++ b/Classification/include/CGAL/Classification/Point_set_neighborhood.h @@ -56,14 +56,14 @@ namespace Classification { template class Point_set_neighborhood { - + typedef typename GeomTraits::FT FT; typedef typename GeomTraits::Point_3 Point; - + class My_point_property_map{ const PointRange* input; PointMap point_map; - + public: typedef Point value_type; typedef const value_type& reference; @@ -88,7 +88,7 @@ class Point_set_neighborhood Tree* m_tree; Distance m_distance; - + public: /*! @@ -210,7 +210,7 @@ public: std::vector indices; My_point_property_map pmap (&input, point_map); voxelize_point_set(input.size(), indices, pmap, voxel_size); - + m_tree = new Tree (indices.begin(), indices.end(), Splitter(), Search_traits (pmap)); @@ -219,7 +219,7 @@ public: } /// @} - + /// \cond SKIP_IN_MANUAL ~Point_set_neighborhood () { @@ -311,10 +311,10 @@ private: } } }; - + } - + } diff --git a/Classification/include/CGAL/Classification/classify.h b/Classification/include/CGAL/Classification/classify.h index 83779d5518a..88ed32aa677 100644 --- a/Classification/include/CGAL/Classification/classify.h +++ b/Classification/include/CGAL/Classification/classify.h @@ -41,7 +41,7 @@ namespace internal { const Label_set& m_labels; const Classifier& m_classifier; LabelIndexRange& m_out; - + public: Classify_functor (const Label_set& labels, @@ -49,7 +49,7 @@ namespace internal { LabelIndexRange& out) : m_labels (labels), m_classifier (classifier), m_out (out) { } - + #ifdef CGAL_LINKED_WITH_TBB void operator()(const tbb::blocked_range& r) const { @@ -57,13 +57,13 @@ namespace internal { apply(s); } #endif // CGAL_LINKED_WITH_TBB - + inline void apply (std::size_t s) const { - std::size_t nb_class_best=0; + std::size_t nb_class_best=0; std::vector values; m_classifier (s, values); - + float val_class_best = 0.f; for(std::size_t k = 0; k < m_labels.size(); ++ k) { @@ -86,7 +86,7 @@ namespace internal { const Classifier& m_classifier; LabelIndexRange& m_out; ProbabilitiesRanges& m_prob; - + public: Classify_detailed_output_functor (const Label_set& labels, @@ -95,7 +95,7 @@ namespace internal { ProbabilitiesRanges& prob) : m_labels (labels), m_classifier (classifier), m_out (out), m_prob (prob) { } - + #ifdef CGAL_LINKED_WITH_TBB void operator()(const tbb::blocked_range& r) const { @@ -103,13 +103,13 @@ namespace internal { apply(s); } #endif // CGAL_LINKED_WITH_TBB - + inline void apply (std::size_t s) const { - std::size_t nb_class_best=0; + std::size_t nb_class_best=0; std::vector values; m_classifier (s, values); - + float val_class_best = 0.f; for(std::size_t k = 0; k < m_labels.size(); ++ k) { @@ -132,7 +132,7 @@ namespace internal { const Label_set& m_labels; const Classifier& m_classifier; std::vector >& m_values; - + public: Classify_functor_local_smoothing_preprocessing @@ -142,7 +142,7 @@ namespace internal { : m_labels (labels), m_classifier (classifier), m_values (values) { } -#ifdef CGAL_LINKED_WITH_TBB +#ifdef CGAL_LINKED_WITH_TBB void operator()(const tbb::blocked_range& r) const { for (std::size_t s = r.begin(); s != r.end(); ++ s) @@ -158,7 +158,7 @@ namespace internal { m_values[k][s] = values[k]; } }; - + template class Classify_functor_local_smoothing { @@ -168,7 +168,7 @@ namespace internal { const std::vector >& m_values; const NeighborQuery& m_neighbor_query; LabelIndexRange& m_out; - + public: Classify_functor_local_smoothing (const ItemRange& input, @@ -183,7 +183,7 @@ namespace internal { m_out (out) { } -#ifdef CGAL_LINKED_WITH_TBB +#ifdef CGAL_LINKED_WITH_TBB void operator()(const tbb::blocked_range& r) const { for (std::size_t s = r.begin(); s != r.end(); ++ s) @@ -201,7 +201,7 @@ namespace internal { for (std::size_t j = 0; j < m_values.size(); ++ j) mean[j] += m_values[j][neighbors[n]]; - std::size_t nb_class_best=0; + std::size_t nb_class_best=0; float val_class_best = 0.f; for(std::size_t k = 0; k < mean.size(); ++ k) { @@ -239,7 +239,7 @@ namespace internal { #else typedef CGAL::internal::Alpha_expansion_graph_cut_boykov_kolmogorov Alpha_expansion; #endif - + public: Classify_functor_graphcut (const ItemRange& input, @@ -264,12 +264,12 @@ namespace internal { } #endif // CGAL_LINKED_WITH_TBB - + inline void apply (std::size_t sub) const { if (m_indices[sub].empty()) return; - + std::vector > edges; std::vector edge_weights; std::vector > probability_matrix @@ -279,7 +279,7 @@ namespace internal { for (std::size_t j = 0; j < m_indices[sub].size(); ++ j) { std::size_t s = m_indices[sub][j]; - + std::vector neighbors; m_neighbor_query (get(m_item_map, *(m_input.begin()+s)), std::back_inserter (neighbors)); @@ -300,7 +300,7 @@ namespace internal { { float value = values[k]; probability_matrix[k][j] = -std::log(value); - + if(val_class_best < value) { val_class_best = value; @@ -309,7 +309,7 @@ namespace internal { } assigned_label[j] = nb_class_best; } - + Alpha_expansion graphcut; graphcut(edges, edge_weights, probability_matrix, assigned_label); @@ -320,11 +320,11 @@ namespace internal { }; } // namespace internal - -/// \endcond - - /*! +/// \endcond + + + /*! \ingroup PkgClassificationMain \brief Runs the classification algorithm without any regularization. @@ -335,7 +335,7 @@ namespace internal { \tparam ConcurrencyTag enables sequential versus parallel algorithm. Possible values are `Parallel_if_available_tag`, `Parallel_tag` or `Sequential_tag`. - + \tparam ItemRange model of `ConstRange`. Its iterator type is `RandomAccessIterator`. Its value type depends on the data that is classified (for example, `CGAL::Point_3` or `CGAL::Triangle_3`). @@ -414,7 +414,7 @@ namespace internal { } /// \endcond - /*! + /*! \ingroup PkgClassificationMain \brief Runs the classification algorithm with a local smoothing. @@ -464,7 +464,7 @@ namespace internal { f1 (labels, classifier, values); internal::Classify_functor_local_smoothing f2 (input, item_map, labels, values, neighbor_query, output); - + #ifndef CGAL_LINKED_WITH_TBB CGAL_static_assertion_msg (!(boost::is_convertible::value), "Parallel_tag is enabled but TBB is unavailable."); @@ -484,7 +484,7 @@ namespace internal { } } - /*! + /*! \ingroup PkgClassificationMain \brief Runs the classification algorithm with a global @@ -578,7 +578,7 @@ namespace internal { std::vector > indices (nb); std::vector > input_to_indices(input.size()); - + for (std::size_t s = 0; s < input.size(); ++ s) { CGAL::Bbox_3 b = get(item_map, *(input.begin() + s)).bbox(); @@ -596,7 +596,7 @@ namespace internal { internal::Classify_functor_graphcut f (input, item_map, labels, classifier, neighbor_query, strength, indices, input_to_indices, output); - + #ifndef CGAL_LINKED_WITH_TBB CGAL_static_assertion_msg (!(boost::is_convertible::value), "Parallel_tag is enabled but TBB is unavailable."); diff --git a/Classification/test/Classification/CMakeLists.txt b/Classification/test/Classification/CMakeLists.txt index c108ca45a56..9dc6193801a 100644 --- a/Classification/test/Classification/CMakeLists.txt +++ b/Classification/test/Classification/CMakeLists.txt @@ -10,7 +10,7 @@ find_package( CGAL QUIET COMPONENTS ) if ( NOT CGAL_FOUND ) message(STATUS "This project requires the CGAL library, and will not be compiled.") - return() + return() endif() # Boost and its components @@ -18,7 +18,7 @@ find_package( Boost REQUIRED ) if ( NOT Boost_FOUND ) message(STATUS "This project requires the Boost library, and will not be compiled.") - return() + return() endif() set(Classification_dependencies_met TRUE) diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map.h b/Combinatorial_map/include/CGAL/Combinatorial_map.h index 1551bff9f46..538fc6fb7be 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map.h @@ -255,7 +255,7 @@ namespace CGAL { // (here we cannot use CGAL::Unique_hash_map because it does not provide // iterators... boost::unordered_map - local_dartmap; + local_dartmap; if (origin_to_copy==NULL) // Used local_dartmap if user does not provides its own unordered_map { origin_to_copy=&local_dartmap; } @@ -269,7 +269,7 @@ namespace CGAL { (*origin_to_copy)[it]=new_dart; if (copy_to_origin!=NULL) { (*copy_to_origin)[new_dart]=it; } - + internal::Copy_dart_info_functor::run (static_cast(amap), static_cast(*this), it, new_dart, dartinfoconverter); @@ -468,7 +468,7 @@ namespace CGAL { // iterators... boost::unordered_map ::halfedge_descriptor, - Dart_handle> local_dartmap; + Dart_handle> local_dartmap; if (origin_to_copy==NULL) // Used local_dartmap if user does not provides its own unordered_map { origin_to_copy=&local_dartmap; } @@ -494,7 +494,7 @@ namespace CGAL { basic_link_beta(dartmap_iter->second, (*origin_to_copy)[CM_ADL_next(dartmap_iter->first, heg)], 1); - + if (!CGAL::is_border(CM_ADL_opposite(dartmap_iter->first, heg), heg) && (dartmap_iter->first)first, heg)) { @@ -506,7 +506,7 @@ namespace CGAL { CGAL_assertion (is_valid()); } - + /** Clear the combinatorial map. Remove all darts and all attributes. * Note that reserved marks are not free. */ @@ -1091,7 +1091,7 @@ namespace CGAL { bool belong_to_same_cell(Dart_const_handle adart1, Dart_const_handle adart2) const { return CGAL::belong_to_same_cell(*this, adart1, adart2); } - + template bool is_whole_cell_unmarked(Dart_const_handle adart, size_type amark) const { return CGAL::is_whole_cell_unmarked(*this, adart, amark); } @@ -2623,16 +2623,16 @@ namespace CGAL { CGAL_assertion((!this->template is_free<1>(d1))); /* CGAL_assertion((belong_to_same_cell<0>(this->template beta<1>(d1), d2))); */ - + if (d2==beta<2>(d1)) { return 0; } - + Dart_const_handle dd1=d1; std::size_t res=1; while (beta<1>(dd1)!=d2) { if (this->template is_free<2>(beta<1>(dd1))) { return std::numeric_limits::max(); } - + ++res; dd1=beta<1, 2>(dd1); @@ -2649,7 +2649,7 @@ namespace CGAL { CGAL_assertion((!this->template is_free<1>(d1))); /* CGAL_assertion((belong_to_same_cell<0>(this->template beta<1>(d1), d2))); */ - + if (d2==beta<2>(d1)) { return 0; } if (this->template is_free<2>(d1) || this->template is_free<2>(d2)) @@ -2663,10 +2663,10 @@ namespace CGAL { { if (this->template is_free<2>(beta<0>(dd1))) { return std::numeric_limits::max(); } - + ++res; dd1=beta<0, 2>(dd1); - + CGAL_assertion(!this->template is_free<0>(dd1)); CGAL_assertion(beta<0>(dd1)==d2 || dd1!=d1); } @@ -3341,7 +3341,7 @@ namespace CGAL { #if defined(CGAL_CMAP_DART_DEPRECATED) && !defined(CGAL_NO_DEPRECATED_CODE) CGAL_USE(testDartInfo); #endif - + typedef Combinatorial_map_base Map2; bool match = true; @@ -4717,6 +4717,6 @@ namespace CGAL { #endif #include - + #endif // CGAL_COMBINATORIAL_MAP_H // // EOF // diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map_basic_operations.h b/Combinatorial_map/include/CGAL/Combinatorial_map_basic_operations.h index 2c289df31bc..97d925e2198 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map_basic_operations.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map_basic_operations.h @@ -30,7 +30,7 @@ namespace CGAL * @return true iff the two darts belong to the same orbit. */ template < class Map, class Iterator > - bool belong_to_same_orbit(const Map & amap, + bool belong_to_same_orbit(const Map & amap, typename Map::Dart_const_handle adart1, typename Map::Dart_const_handle adart2) { @@ -53,7 +53,7 @@ namespace CGAL * @return true iff all the darts are marked. */ template < class Map, class Iterator > - bool is_whole_orbit_marked(const Map & amap, + bool is_whole_orbit_marked(const Map & amap, typename Map::Dart_const_handle adart, typename Map::size_type amark) { @@ -76,7 +76,7 @@ namespace CGAL * @return true iff all the darts are unmarked. */ template < class Map, class Iterator > - bool is_whole_orbit_unmarked(const Map & amap, + bool is_whole_orbit_unmarked(const Map & amap, typename Map::Dart_const_handle adart, typename Map::size_type amark) { @@ -122,7 +122,7 @@ namespace CGAL * @pre The whole orbit must be marked. */ template < class Map, class Iterator > - typename Map::size_type unmark_orbit(const Map & amap, + typename Map::size_type unmark_orbit(const Map & amap, typename Map::Dart_const_handle adart, typename Map::size_type amark) { @@ -140,7 +140,7 @@ namespace CGAL * @return true iff the two darts belong to the same cell. */ template < class Map, unsigned int i, unsigned int d> - bool belong_to_same_cell(const Map & amap, + bool belong_to_same_cell(const Map & amap, typename Map::Dart_const_handle adart1, typename Map::Dart_const_handle adart2) { @@ -150,7 +150,7 @@ namespace CGAL } template < class Map, unsigned int i> - bool belong_to_same_cell(const Map & amap, + bool belong_to_same_cell(const Map & amap, typename Map::Dart_const_handle adart1, typename Map::Dart_const_handle adart2) { @@ -165,20 +165,20 @@ namespace CGAL * @return true iff all the darts are marked. */ template < class Map, unsigned int i, unsigned int d> - bool is_whole_cell_marked(const Map & amap, + bool is_whole_cell_marked(const Map & amap, typename Map::Dart_const_handle adart, typename Map::size_type amark) - { + { return CGAL::is_whole_orbit_marked::const_iterator> (amap, adart, amark); } template < class Map, unsigned int i> - bool is_whole_cell_marked(const Map & amap, + bool is_whole_cell_marked(const Map & amap, typename Map::Dart_const_handle adart, typename Map::size_type amark) - { + { return CGAL::is_whole_cell_marked(amap,adart,amark); } @@ -189,20 +189,20 @@ namespace CGAL * @return true iff all the darts are marked. */ template < class Map, unsigned int i, unsigned int d > - bool is_whole_cell_unmarked(const Map & amap, + bool is_whole_cell_unmarked(const Map & amap, typename Map::Dart_const_handle adart, typename Map::size_type amark) - { + { return CGAL::is_whole_orbit_unmarked::const_iterator> (amap, adart, amark); } template < class Map, unsigned int i> - bool is_whole_cell_unmarked(const Map & amap, + bool is_whole_cell_unmarked(const Map & amap, typename Map::Dart_const_handle adart, typename Map::size_type amark) - { + { return CGAL::is_whole_cell_unmarked (amap,adart,amark); } @@ -215,15 +215,15 @@ namespace CGAL * @pre The whole cell must be unmarked. */ template < class Map, unsigned int i, unsigned int d > - typename Map::size_type mark_cell(const Map & amap, + typename Map::size_type mark_cell(const Map & amap, typename Map::Dart_const_handle adart, typename Map::size_type amark) { return CGAL::mark_orbit::const_iterator> (amap, adart, amark); } - + template < class Map, unsigned int i> - typename Map::size_type mark_cell(const Map & amap, + typename Map::size_type mark_cell(const Map & amap, typename Map::Dart_const_handle adart, typename Map::size_type amark) { return CGAL::mark_cell(amap, adart, amark);} @@ -236,7 +236,7 @@ namespace CGAL * @pre The whole cell must be marked. */ template < class Map, unsigned int i, unsigned int d > - typename Map::size_type unmark_cell(const Map & amap, + typename Map::size_type unmark_cell(const Map & amap, typename Map::Dart_const_handle adart, typename Map::size_type amark) { return CGAL::unmark_orbit - typename Map::size_type unmark_cell(const Map & amap, + typename Map::size_type unmark_cell(const Map & amap, typename Map::Dart_const_handle adart, typename Map::size_type amark) { return CGAL::unmark_cell(amap, adart, amark); } - + /** Compute the degree of a given i-cell c. * The degree is the number of distinct i+1 cells incident to c. - * @param amap a combinatorial map. + * @param amap a combinatorial map. * @param adart a dart of the cell. * @return the degree of the cell. */ template < class Map, unsigned int i > - typename Map::size_type degree(const Map & amap, + typename Map::size_type degree(const Map & amap, typename Map::Dart_const_handle adart) { CGAL_assertion(adart != nullptr); - + typename Map::size_type nbIncident = 0; typename Map::size_type mark; typename Map::size_type treated; @@ -278,7 +278,7 @@ namespace CGAL } amap.mark(it,mark); } - + amap.negate_mark(mark); for (it.rewind(); it.cont(); ++it) { @@ -286,30 +286,30 @@ namespace CGAL { CGAL::unmark_cell(amap, it, treated); } amap.mark(it,mark); } - + amap.negate_mark(mark); CGAL_assertion( amap.is_whole_map_unmarked(mark) ); CGAL_assertion( amap.is_whole_map_unmarked(treated) ); amap.free_mark(mark); amap.free_mark(treated); - + CGAL_assertion(nbIncident != 0); return nbIncident; } /** Compute the co-degree of a given i-cell c. * The co-degree is the number of distinct i-1 cells incident to c. - * @param amap a combinatorial map. + * @param amap a combinatorial map. * @param adart a dart of the cell. * @return the co-degree of the cell. */ template < class Map, unsigned int i > - typename Map::size_type codegree(const Map & amap, + typename Map::size_type codegree(const Map & amap, typename Map::Dart_const_handle adart) { CGAL_assertion(adart != nullptr); - + typename Map::size_type nbIncident = 0; typename Map::size_type mark; typename Map::size_type treated; @@ -327,11 +327,11 @@ namespace CGAL } amap.mark(it,mark); } - + amap.negate_mark(mark); for (it.rewind(); it.cont(); ++it) { - if (amap.is_marked(it, treated)) + if (amap.is_marked(it, treated)) { CGAL::unmark_cell(amap, it, treated); } amap.mark(it,mark); } @@ -342,7 +342,7 @@ namespace CGAL amap.free_mark(mark); amap.free_mark(treated); - + CGAL_assertion(nbIncident != 0); return nbIncident; } diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map_storages.h b/Combinatorial_map/include/CGAL/Combinatorial_map_storages.h index 70ab1e3b1dd..3dd6ba813e7 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map_storages.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map_storages.h @@ -36,7 +36,7 @@ namespace CGAL { // Storage of darts with compact container, beta with handles template class Combinatorial_map_storage_1 - { + { public: typedef Combinatorial_map_storage_1 Self; typedef CGAL::Tag_false Use_index; @@ -228,7 +228,7 @@ namespace CGAL { CGAL_assertion( ah!=nullptr ); return ah->is_valid(); } - + // accessors and modifiers to the attribute ref counting given its handle template std::size_t get_attribute_ref_counting diff --git a/Combinatorial_map/include/CGAL/Face_graph_wrapper.h b/Combinatorial_map/include/CGAL/Face_graph_wrapper.h index a0915e45758..f9ab018a185 100644 --- a/Combinatorial_map/include/CGAL/Face_graph_wrapper.h +++ b/Combinatorial_map/include/CGAL/Face_graph_wrapper.h @@ -25,11 +25,11 @@ namespace CGAL template class Combinatorial_map_base; - + template class Generalized_map_base; - + template @@ -49,7 +49,7 @@ namespace CGAL template class Map, typename Storage> class Linear_cell_complex_for_combinatorial_map; - + template @@ -64,7 +64,7 @@ namespace CGAL template class Polygonal_schema_with_generalized_map; } - + //////////////////////////////////////////////////////////////////////////////// /** Class Face_graph_wrapper: to wrap any model of FaceGraph into a * Combinatorial map. For now, only for const models, i.e. does not support @@ -85,7 +85,7 @@ public: // typedef My_halfedge_iterator iterator; // typedef My_halfedge_iterator const_iterator; // TODO ? }; - + typedef typename boost::graph_traits::halfedge_descriptor Dart_handle; typedef typename boost::graph_traits::halfedge_descriptor Dart_const_handle; @@ -106,7 +106,7 @@ public: typedef typename boost::graph_traits::edge_descriptor edge_descriptor; typedef typename boost::graph_traits::face_descriptor face_descriptor; typedef boost::undirected_tag directed_category; - typedef boost::disallow_parallel_edge_tag edge_parallel_category; + typedef boost::disallow_parallel_edge_tag edge_parallel_category; struct SM_graph_traversal_category : public virtual boost::bidirectional_graph_tag, public virtual boost::vertex_list_graph_tag, @@ -114,7 +114,7 @@ public: {}; typedef SM_graph_traversal_category traversal_category; - + Face_graph_wrapper(const HEG& f) : m_fg(f), mdarts(*this), m_nb_darts(0), @@ -142,7 +142,7 @@ public: const HEG& get_fg() const { return m_fg; } - + template bool is_free(Dart_const_handle /* dh */) const { return false; } // Not possible to have a free dart with an HEG. @@ -156,7 +156,7 @@ public: { CGAL_assertion(B1>=0 && B1<=static_cast(dimension)); if (B1==1) return Get_beta::value(m_fg, ADart); - if (B1==2) return Get_beta::value(m_fg, ADart); + if (B1==2) return Get_beta::value(m_fg, ADart); return Get_beta::value(m_fg, ADart); } template @@ -168,15 +168,15 @@ public: bool is_empty() const { return number_of_darts()==0; } - + /* ?? bool is_dart_used(Dart_const_handle dh) const { return true; ?? } */ - + int highest_nonfree_dimension(Dart_const_handle /* dh */) const { return 2; } Dart_const_handle previous(Dart_const_handle ADart) const - { return get_beta<0>(ADart); } + { return get_beta<0>(ADart); } Dart_const_handle next(Dart_const_handle ADart) const { return get_beta<1>(ADart); } Dart_const_handle opposite(Dart_const_handle dh) const @@ -190,7 +190,7 @@ public: Dart_const_handle opposite(Dart_const_handle ADart) const { return this->template get_beta(ADart); } Dart_const_handle other_orientation(Dart_const_handle ADart) const - { return ADart; } + { return ADart; } bool is_previous_exist(Dart_const_handle) const { return true; } @@ -216,10 +216,10 @@ public: Dart_const_handle beta(Dart_const_handle ADart) const { return CGAL::internal::Beta_functor_static:: run(*this, ADart); } - + size_type number_of_darts() const { return m_nb_darts; } - + size_type number_of_halfedges() const { return number_of_darts(); } @@ -231,27 +231,27 @@ public: CGAL_assertion(amarknull_dart_handle ); CGAL_assertion( is_reserved(amark) ); - + if (!is_marked(adart, amark)) return; - + --mnb_marked_darts[amark]; flip_dart_mark(adart, amark); } - + void unmark_all(size_type amark) const { CGAL_assertion( is_reserved(amark) ); - + if ( is_whole_map_marked(amark) ) { negate_mark(amark); @@ -366,44 +366,44 @@ public: } CGAL_assertion(is_whole_map_unmarked(amark)); } - + void free_mark(size_type amark) const { CGAL_assertion( is_reserved(amark) ); - + if ( mnb_times_reserved_marks[amark]>1 ) { --mnb_times_reserved_marks[amark]; return; } - + unmark_all(amark); - + // 1) We remove amark from the array mused_marks_stack by // replacing it with the last mark in this array. mused_marks_stack[mindex_marks[amark]] = mused_marks_stack[--mnb_used_marks]; mindex_marks[mused_marks_stack[mnb_used_marks]] = mindex_marks[amark]; - + // 2) We add amark in the array mfree_marks_stack and update its index. mfree_marks_stack[ mnb_used_marks ]=amark; mindex_marks[amark] = mnb_used_marks; - + mnb_times_reserved_marks[amark]=0; } - + bool is_without_boundary(unsigned int i) const { CGAL_assertion(1<=i && i<=dimension); if (i==1) return true; - + for ( typename Dart_range::const_iterator it(darts().begin()), itend(darts().end()); it!=itend; ++it) { if (is_perforated(it)) return false; } return true; } - + bool is_without_boundary() const { return is_without_boundary(2); } @@ -429,7 +429,7 @@ public: } return msize; } - + bool empty() const { return mmap.is_empty(); } private: @@ -506,7 +506,7 @@ public: } return msize; } - + bool empty() const { return mmap.is_empty(); } private: @@ -556,7 +556,7 @@ public: { if (*it==adart2) { return true; } } return false; } - + template bool is_whole_cell_unmarked(Dart_const_handle adart, size_type amark) const { @@ -591,7 +591,7 @@ public: else if (i==1) { return mark_cell<1>(adart, amark); } else if (i==2) { return mark_cell<2>(adart, amark); } return mark_cell<3>(adart, amark); - } + } template size_type unmark_cell(Dart_const_handle adart, size_type amark) const @@ -615,7 +615,7 @@ public: res[i]=0; marks[i]=INVALID_MARK; } - + // Mark reservation for (unsigned int i=0; i res; size_type m=get_new_mark(); negate_mark(m); // We mark all the cells. - + res=count_marked_cells(m, acells); - + negate_mark(m); // We unmark the cells free_mark(m); - + return res; } std::vector count_all_cells() const { std::vector dim(dimension+2); - + for ( unsigned int i=0; i<=dimension+1; ++i) { dim[i]=i; } - + return count_cells(dim); } @@ -703,9 +703,9 @@ public: std::vector cells(dimension+2); for ( unsigned int i=0; i<=dimension+1; ++i) { cells[i]=i; } - + std::vector res=count_cells(cells); - + os<<"#Darts="< @@ -49,7 +49,7 @@ struct Get_beta { typedef typename boost::graph_traits::halfedge_descriptor Dart_const_handle; - static Dart_const_handle value(const HEG& /*heg*/, Dart_const_handle /*dh*/) + static Dart_const_handle value(const HEG& /*heg*/, Dart_const_handle /*dh*/) { /* CGAL_static_assertion(false);*/ std::cout<<"ERROR Get_beta"< struct Get_beta { typedef typename boost::graph_traits::halfedge_descriptor Dart_const_handle; - static Dart_const_handle value(const HEG& heg, Dart_const_handle dh) + static Dart_const_handle value(const HEG& heg, Dart_const_handle dh) { return prev(dh, heg); } }; template struct Get_beta { typedef typename boost::graph_traits::halfedge_descriptor Dart_const_handle; - static Dart_const_handle value(const HEG& heg, Dart_const_handle dh) + static Dart_const_handle value(const HEG& heg, Dart_const_handle dh) { return next(dh, heg); } }; template struct Get_beta { typedef typename boost::graph_traits::halfedge_descriptor Dart_const_handle; - static Dart_const_handle value(const HEG& heg, Dart_const_handle dh) + static Dart_const_handle value(const HEG& heg, Dart_const_handle dh) { //if (Is_free::value(heg, dh)) return Dart_const_handle(); return opposite(dh, heg); @@ -82,6 +82,6 @@ struct Get_beta }; //////////////////////////////////////////////////////////////////////////////// } // namespace CGAL - + #endif // CGAL_FUNCTORS_FOR_FACE_GRAPH_WRAPPER_H // // EOF // diff --git a/Combinatorial_map/include/CGAL/Iterators_for_face_graph_wrapper.h b/Combinatorial_map/include/CGAL/Iterators_for_face_graph_wrapper.h index d30d5889b22..7ef268e86b7 100644 --- a/Combinatorial_map/include/CGAL/Iterators_for_face_graph_wrapper.h +++ b/Combinatorial_map/include/CGAL/Iterators_for_face_graph_wrapper.h @@ -18,7 +18,7 @@ namespace CGAL { - + //**************************************************************************** /* Class CMap_dart_iterator_basic_of_all: to iterate onto all the * darts of the face graph. @@ -52,9 +52,9 @@ namespace CGAL FGW_dart_iterator_basic_of_all(const FGW_dart_iterator_basic_of_all& other): mmap(other.mmap), - m_it(other.m_it) + m_it(other.m_it) {} - + operator Dart_handle() const { return operator*(); } @@ -63,7 +63,7 @@ namespace CGAL bool operator!=(const Self& other) const { return !(operator==(other)); } - + /// Prefix ++ operator. Self& operator++() { @@ -75,7 +75,7 @@ namespace CGAL } /*while(m_it!=halfedges(this->mmap.get_fg()).end() && is_border(*m_it, this->mmap.get_fg())); */ - + return *this; } @@ -88,7 +88,7 @@ namespace CGAL CGAL_assertion(m_it!=halfedges(this->mmap.get_fg()).end()); return *m_it; } - + protected: const Map& mmap; typename boost::graph_traits::halfedge_iterator m_it; @@ -100,10 +100,10 @@ namespace CGAL { public: typedef FGW_basis_for_cell_iterator Self; - typedef Map_ Map; + typedef Map_ Map; typedef typename Map::Dart_handle Dart_handle; typedef typename Map::size_type size_type; - + /// Main constructor. FGW_basis_for_cell_iterator(const Map& amap, Dart_handle adart): mmap(amap), @@ -125,7 +125,7 @@ namespace CGAL bool operator!=(const Self& other) const { return !(this->operator==(other)); } - + operator Dart_handle() const { return operator*(); } @@ -134,7 +134,7 @@ namespace CGAL CGAL_assertion(m_curdart!=Dart_handle()); return m_curdart; } - + protected: const Map& mmap; Dart_handle m_firstdart, m_curdart; @@ -151,10 +151,10 @@ namespace CGAL public: typedef FGW_cell_iterator Self; typedef FGW_basis_for_cell_iterator Base; - typedef Map_ Map; + typedef Map_ Map; typedef typename Map::Dart_handle Dart_handle; typedef typename Map::size_type size_type; - + FGW_cell_iterator(const Map& amap, Dart_handle adart) : Base(amap, adart), m_second_way(false) {} @@ -180,7 +180,7 @@ namespace CGAL else { this->m_curdart=this->mmap.template beta<2, 1>(this->m_curdart); - if (this->m_curdart==this->m_firstdart) + if (this->m_curdart==this->m_firstdart) { this->m_curdart=Dart_handle(); } } } @@ -191,14 +191,14 @@ namespace CGAL { this->m_curdart=Dart_handle(); } else { this->m_curdart=this->mmap.template beta<2>(this->m_curdart); } } - + return *this; } /// Postfix ++ operator. Self operator++(int) { Self res=*this; operator ++(); return res; } - + protected: /// True if we already found a border dart, and thus turn in the second way bool m_second_way; @@ -209,10 +209,10 @@ class FGW_cell_iterator: public FGW_basis_for_cell_iterator // E public: typedef FGW_cell_iterator Self; typedef FGW_basis_for_cell_iterator Base; - typedef Map_ Map; + typedef Map_ Map; typedef typename Map::Dart_handle Dart_handle; typedef typename Map::size_type size_type; - + FGW_cell_iterator(const Map& amap, Dart_handle adart) : Base(amap, adart) {} @@ -232,13 +232,13 @@ class FGW_cell_iterator: public FGW_basis_for_cell_iterator // E } else { this->m_curdart=Dart_handle(); } - + return *this; } - + /// Postfix ++ operator. Self operator++(int) - { Self res=*this; operator ++(); return res; } + { Self res=*this; operator ++(); return res; } }; template class FGW_cell_iterator: public FGW_basis_for_cell_iterator // Face @@ -246,13 +246,13 @@ class FGW_cell_iterator: public FGW_basis_for_cell_iterator // Fa public: typedef FGW_cell_iterator Self; typedef FGW_basis_for_cell_iterator Base; - typedef Map_ Map; + typedef Map_ Map; typedef typename Map::Dart_handle Dart_handle; typedef typename Map::size_type size_type; - + FGW_cell_iterator(const Map& amap, Dart_handle adart) : Base(amap, adart) {} - + /// Constructor with two darts in parameter (for end iterator). FGW_cell_iterator(const Map& amap, Dart_handle adart, Dart_handle d2): Base(amap, adart, d2) @@ -264,10 +264,10 @@ public: this->m_curdart=this->mmap.template beta<1>(this->m_curdart); if (this->m_curdart==this->m_firstdart) { this->m_curdart=Dart_handle(); } - + return *this; } - + /// Postfix ++ operator. Self operator++(int) { Self res=*this; operator ++(); return res; } @@ -278,13 +278,13 @@ class FGW_cell_iterator: public FGW_basis_for_cell_iterator // CC public: typedef FGW_cell_iterator Self; typedef FGW_basis_for_cell_iterator Base; - typedef Map_ Map; + typedef Map_ Map; typedef typename Map::Dart_handle Dart_handle; typedef typename Map::size_type size_type; - + FGW_cell_iterator(const Map& amap, Dart_handle adart) : Base(amap, adart) { m_mark=this->mmap.get_new_mark(); } - + /// Constructor with two darts in parameter (for end iterator). FGW_cell_iterator(const Map& amap, Dart_handle adart, Dart_handle d2): Base(amap, adart, d2) @@ -312,14 +312,14 @@ public: { this->m_curdart=Dart_handle(); } else { this->m_curdart=m_to_treat.top(); m_to_treat.pop(); } - + return *this; } - + /// Postfix ++ operator. Self operator++(int) { Self res=*this; operator ++(); return res; } - + protected: typename Map_::size_type m_mark; std::stack m_to_treat; diff --git a/Combinatorial_map/test/Combinatorial_map/CMakeLists.txt b/Combinatorial_map/test/Combinatorial_map/CMakeLists.txt index 98a88794f8a..7374b0f2f0d 100644 --- a/Combinatorial_map/test/Combinatorial_map/CMakeLists.txt +++ b/Combinatorial_map/test/Combinatorial_map/CMakeLists.txt @@ -22,8 +22,8 @@ if ( CGAL_FOUND ) endif() else() - + message(STATUS "This program requires the CGAL library, and will not be compiled.") - + endif() diff --git a/Combinatorial_map/test/Combinatorial_map/Combinatorial_map_copy_test.cpp b/Combinatorial_map/test/Combinatorial_map/Combinatorial_map_copy_test.cpp index 27de63ed00d..eb054e1114f 100644 --- a/Combinatorial_map/test/Combinatorial_map/Combinatorial_map_copy_test.cpp +++ b/Combinatorial_map/test/Combinatorial_map/Combinatorial_map_copy_test.cpp @@ -413,16 +413,16 @@ bool testCopy() Map1 map2p(map2); assert(map2p.is_valid()); if ( map2.is_isomorphic_to(map2p) ) { assert(false); return false; } - if ( !map2.is_isomorphic_to(map2p, false, false) ) + if ( !map2.is_isomorphic_to(map2p, false, false) ) { assert(false); return false; } Map3 map2t(map2); assert(map2t.is_valid()); if ( map2.is_isomorphic_to(map2t) ) { assert(false); return false; } - if ( !map2.is_isomorphic_to(map2t, false, false) ) + if ( !map2.is_isomorphic_to(map2t, false, false) ) { assert(false); return false; } if ( map2p.is_isomorphic_to(map2t) ) { assert(false); return false; } - if ( !map2p.is_isomorphic_to(map2t, false, false) ) + if ( !map2p.is_isomorphic_to(map2t, false, false) ) { assert(false); return false; } Map1 map3p(map3); assert(map3p.is_valid()); @@ -432,7 +432,7 @@ bool testCopy() Map2 map3t(map3); assert(map3t.is_valid()); if ( map3.is_isomorphic_to(map3t) ) { assert(false); return false; } - if ( !map3.is_isomorphic_to(map3t, false, false) ) + if ( !map3.is_isomorphic_to(map3t, false, false) ) { assert(false); return false; } if ( map3p.is_isomorphic_to(map3t) ) { assert(false); return false; } @@ -463,7 +463,7 @@ bool testCopy() Map7 map5c(map5); assert(map5c.is_valid()); if ( map5.is_isomorphic_to(map5c) ) { assert(false); return false; } - if ( !map5.is_isomorphic_to(map5c, false, false) ) + if ( !map5.is_isomorphic_to(map5c, false, false) ) { assert(false); return false; } assert( map5c.number_of_attributes<0>()==0 && map5c.number_of_attributes<2>()==map5.number_of_attributes<2>() ); @@ -593,12 +593,12 @@ bool testCopy() bool testImportFromHalfedge() { bool res=true; - + HDS hds; CGAL::HalfedgeDS_decorator decorator(hds); decorator.create_loop(); decorator.create_segment(); - + Map1 map1; map1.import_from_halfedge_graph(hds); Map2 map2; map2.import_from_halfedge_graph(hds); Map3 map3; map3.import_from_halfedge_graph(hds); diff --git a/Combinatorial_map/test/Combinatorial_map/Combinatorial_map_test.cpp b/Combinatorial_map/test/Combinatorial_map/Combinatorial_map_test.cpp index bb0a850e1b1..df3b764e1e7 100644 --- a/Combinatorial_map/test/Combinatorial_map/Combinatorial_map_test.cpp +++ b/Combinatorial_map/test/Combinatorial_map/Combinatorial_map_test.cpp @@ -73,7 +73,7 @@ struct Map_3_dart_max_items_3 struct MonInfo { - MonInfo(int i=0) : mnb(i==0?rand():i), ptr(reinterpret_cast(this)) + MonInfo(int i=0) : mnb(i==0?rand():i), ptr(reinterpret_cast(this)) {} int mnb; std::string s; @@ -187,7 +187,7 @@ bool test_get_new_mark() map.free_mark(mark); // This is never supposed to occur. return false; } - + for (Map1::size_type i=0; i>m; - + CGAL::Face_graph_wrapper fgw1(m); std::vector cells=fgw1.count_all_cells(); if (cells[0]!=1487 || cells[1]!=4406 || cells[2]!=2921 || diff --git a/Convex_hull_2/doc/Convex_hull_2/CGAL/ch_jarvis.h b/Convex_hull_2/doc/Convex_hull_2/CGAL/ch_jarvis.h index d9af9b3f99d..54061777377 100644 --- a/Convex_hull_2/doc/Convex_hull_2/CGAL/ch_jarvis.h +++ b/Convex_hull_2/doc/Convex_hull_2/CGAL/ch_jarvis.h @@ -11,38 +11,38 @@ sequence is returned. It is not specified at which point the cyclic sequence of extreme points is cut into a linear sequence. \pre The source range [`first`,`beyond`) does not contain `result`. -The default traits class `Default_traits` is the kernel in which the -value type of `ForwardIterator` is defined. +The default traits class `Default_traits` is the kernel in which the +value type of `ForwardIterator` is defined. \cgalHeading{Requirements} -
    -
  1. The value type of `ForwardIterator` and -`OutputIterator` is equivalent to `Traits::Point_2`. -
  2. `Traits` defines the following subset of types from -the concept `ConvexHullTraits_2` and their corresponding member -functions that return instances of these types: -
      -
    • `Traits::Point_2`, -
    • `Traits::Equal_2`, -
    • `Traits::Less_rotate_ccw_2`, -
    • `Traits::Less_xy_2`. -
    -
+
    +
  1. The value type of `ForwardIterator` and +`OutputIterator` is equivalent to `Traits::Point_2`. +
  2. `Traits` defines the following subset of types from +the concept `ConvexHullTraits_2` and their corresponding member +functions that return instances of these types: +
      +
    • `Traits::Point_2`, +
    • `Traits::Equal_2`, +
    • `Traits::Less_rotate_ccw_2`, +
    • `Traits::Less_xy_2`. +
    +
-\sa `CGAL::ch_akl_toussaint()` -\sa `CGAL::ch_bykat()` -\sa `CGAL::ch_eddy()` -\sa `CGAL::ch_graham_andrew()` -\sa `CGAL::ch_jarvis_march()` -\sa `CGAL::ch_melkman()` -\sa `CGAL::convex_hull_2()` +\sa `CGAL::ch_akl_toussaint()` +\sa `CGAL::ch_bykat()` +\sa `CGAL::ch_eddy()` +\sa `CGAL::ch_graham_andrew()` +\sa `CGAL::ch_jarvis_march()` +\sa `CGAL::ch_melkman()` +\sa `CGAL::convex_hull_2()` \cgalHeading{Implementation} -This function uses the Jarvis march (gift-wrapping) -algorithm \cgalCite{j-ichfs-73}. This algorithm requires \f$ O(n h)\f$ time -in the worst case for \f$ n\f$ input points with \f$ h\f$ extreme points. +This function uses the Jarvis march (gift-wrapping) +algorithm \cgalCite{j-ichfs-73}. This algorithm requires \f$ O(n h)\f$ time +in the worst case for \f$ n\f$ input points with \f$ h\f$ extreme points. */ @@ -60,42 +60,42 @@ namespace CGAL { /*! \ingroup PkgConvexHull2Subsequence -generates the counterclockwise sequence of extreme -points from a given set of input points that line between two input points. +generates the counterclockwise sequence of extreme +points from a given set of input points that line between two input points. More precisely, it generates the counterclockwise subsequence of -extreme points between `start_p` and `stop_p` of the -points in the range [`first`,`beyond`), starting at -position `result` with point `start_p`. The last point -generated is the point preceding `stop_p` in the +extreme points between `start_p` and `stop_p` of the +points in the range [`first`,`beyond`), starting at +position `result` with point `start_p`. The last point +generated is the point preceding `stop_p` in the counterclockwise order of extreme points. -The default traits class `Default_traits` is the kernel in which the -type `ForwardIterator::value_type` is defined. +The default traits class `Default_traits` is the kernel in which the +type `ForwardIterator::value_type` is defined. \cgalHeading{Requirements} -
    -
  1. `ForwardIterator::value_type` and -`OutputIterator::value_type` -are equivalent to `Traits::Point_2`. -
  2. `Traits` defines the following subset of types from -the concept `ConvexHullTraits_2` and their corresponding member -functions that return instances of these types: -
      -
    • `Traits::Point_2`, -
    • `Traits::Equal_2`, -
    • `Traits::Less_rotate_ccw_2`. -
    -
+
    +
  1. `ForwardIterator::value_type` and +`OutputIterator::value_type` +are equivalent to `Traits::Point_2`. +
  2. `Traits` defines the following subset of types from +the concept `ConvexHullTraits_2` and their corresponding member +functions that return instances of these types: +
      +
    • `Traits::Point_2`, +
    • `Traits::Equal_2`, +
    • `Traits::Less_rotate_ccw_2`. +
    +
-\sa `CGAL::ch_jarvis()` -\sa `CGAL::lower_hull_points_2()` -\sa `CGAL::upper_hull_points_2()` +\sa `CGAL::ch_jarvis()` +\sa `CGAL::lower_hull_points_2()` +\sa `CGAL::upper_hull_points_2()` \cgalHeading{Implementation} -The function uses the Jarvis march (gift-wrapping) algorithm \cgalCite{j-ichfs-73}. +The function uses the Jarvis march (gift-wrapping) algorithm \cgalCite{j-ichfs-73}. This algorithm requires \f$ O(n h)\f$ time in the worst case for \f$ n\f$ input points with \f$ h\f$ extreme points diff --git a/Convex_hull_3/doc/Convex_hull_3/CGAL/convex_hull_3.h b/Convex_hull_3/doc/Convex_hull_3/CGAL/convex_hull_3.h index 78e5d46a00f..e22a0443690 100644 --- a/Convex_hull_3/doc/Convex_hull_3/CGAL/convex_hull_3.h +++ b/Convex_hull_3/doc/Convex_hull_3/CGAL/convex_hull_3.h @@ -42,11 +42,11 @@ void convex_hull_3(InputIterator first, InputIterator last, PolygonMesh& pm, con * the convex hull is stored in `pm`. Note that the convex hull will be triangulated, * that is `pm` will contain only triangular faces. * if the convex hull is a point or a segment, endpoints will be added in `pm` as isolated vertices. - * + * * \tparam VertexListGraph a model of `VertexListGraph`. * \tparam PolygonMesh must be a model of `MutableFaceGraph`. * \tparam NamedParameters a sequence of named parameters - * + * * \param g the graph * \param pm the `PolygonMesh` that will contain the convex hull * \param np optional sequence of named parameters among the ones listed below diff --git a/Convex_hull_3/examples/Convex_hull_3/CMakeLists.txt b/Convex_hull_3/examples/Convex_hull_3/CMakeLists.txt index a5b3583a751..cb303aca822 100644 --- a/Convex_hull_3/examples/Convex_hull_3/CMakeLists.txt +++ b/Convex_hull_3/examples/Convex_hull_3/CMakeLists.txt @@ -12,7 +12,7 @@ find_package( CGAL QUIET COMPONENTS ) if ( NOT CGAL_FOUND ) message(STATUS "This project requires the CGAL library, and will not be compiled.") - return() + return() endif() @@ -23,7 +23,7 @@ if ( NOT Boost_FOUND ) message(STATUS "This project requires the Boost library, and will not be compiled.") - return() + return() endif() diff --git a/Convex_hull_3/examples/Convex_hull_3/graph_hull_3.cpp b/Convex_hull_3/examples/Convex_hull_3/graph_hull_3.cpp index 1769315fe5b..b07df73c1da 100644 --- a/Convex_hull_3/examples/Convex_hull_3/graph_hull_3.cpp +++ b/Convex_hull_3/examples/Convex_hull_3/graph_hull_3.cpp @@ -14,14 +14,14 @@ typedef CGAL::Surface_mesh Surface_mesh; int main(int argc, char* argv[]) { std::ifstream in( (argc>1)? argv[1] : "data/star.off"); - + Surface_mesh poly; if(!(in >> poly)) { std::cerr<<"Could not find input file."< Traits_xy_3; typedef CGAL::Projection_traits_yz_3 Traits_yz_3; typedef CGAL::Projection_traits_xz_3 Traits_xz_3; - + Traits_xy_3 construct_traits_xy_3_object()const {return Traits_xy_3();} Traits_yz_3 construct_traits_yz_3_object()const @@ -444,7 +444,7 @@ void coplanar_3_hull(InputIterator first, InputIterator beyond, typedef typename PTraits::Traits_xy_3 Traits_xy_3; typedef typename PTraits::Traits_yz_3 Traits_yz_3; typedef typename PTraits::Traits_xz_3 Traits_xz_3; - + PTraits ptraits(traits); std::list CH_2; @@ -562,7 +562,7 @@ farthest_outside_point(Face_handle f, std::list& outside_set, typedef typename std::list::iterator Outside_set_iterator; CGAL_ch_assertion(!outside_set.empty()); - typename Traits::Plane_3 plane = + typename Traits::Plane_3 plane = traits.construct_plane_3_object()(f->vertex(0)->point(), f->vertex(1)->point(), f->vertex(2)->point()); @@ -629,7 +629,7 @@ ch_quickhull_3_scan(TDS_2& tds, typedef typename TDS_2::Edge Edge; typedef typename TDS_2::Face_handle Face_handle; typedef typename TDS_2::Vertex_handle Vertex_handle; - typedef typename Traits::Point_3 Point_3; + typedef typename Traits::Point_3 Point_3; typedef std::list Outside_set; typedef typename std::list::iterator Outside_set_iterator; typedef std::map Border_edges; @@ -765,8 +765,8 @@ ch_quickhull_polyhedron_3(std::list& points, InputIterator point3_it, Polyhedron_3& P, const Traits& traits) { - typedef typename Traits::Point_3 Point_3; - typedef typename Traits::Plane_3 Plane_3; + typedef typename Traits::Point_3 Point_3; + typedef typename Traits::Plane_3 Plane_3; typedef typename std::list::iterator P3_iterator; typedef Triangulation_data_structure_2< @@ -855,7 +855,7 @@ void convex_hull_3(InputIterator first, InputIterator beyond, Object& ch_object, const Traits& traits) { - typedef typename Traits::Point_3 Point_3; + typedef typename Traits::Point_3 Point_3; typedef std::list Point_3_list; typedef typename Point_3_list::iterator P3_iterator; typedef std::pair P3_iterator_pair; @@ -1053,7 +1053,7 @@ void convex_hull_3(InputIterator first, InputIterator beyond, template void convex_hull_3(const VertexListGraph& g, - PolygonMesh& pm, + PolygonMesh& pm, const NamedParameters& np) { typedef typename GetVertexPointMap::const_type Vpmap; @@ -1061,7 +1061,7 @@ void convex_hull_3(const VertexListGraph& g, Vpmap vpm = CGAL::parameters::choose_parameter( CGAL::parameters::get_parameter(np, internal_np::vertex_point), get_const_property_map(boost::vertex_point, g)); - + Vpmap_fct v2p(vpm); convex_hull_3(boost::make_transform_iterator(vertices(g).begin(), v2p), boost::make_transform_iterator(vertices(g).end(), v2p), pm); diff --git a/Convex_hull_3/test/Convex_hull_3/test_ch_3_ambiguity.cpp b/Convex_hull_3/test/Convex_hull_3/test_ch_3_ambiguity.cpp index 0b67fa73bdc..4cae9d67639 100644 --- a/Convex_hull_3/test/Convex_hull_3/test_ch_3_ambiguity.cpp +++ b/Convex_hull_3/test/Convex_hull_3/test_ch_3_ambiguity.cpp @@ -15,14 +15,14 @@ typedef CGAL::Surface_mesh Surface_mesh; int main(int argc, char* argv[]) { std::ifstream in( (argc>1)? argv[1] : "data/cross.off"); - + Surface_mesh poly; if(!in || !(in >> poly)) { std::cerr<<"Could not find a correct input file."<`http://eigen.tuxfamily.org`. -\subsection thirdpartyOpenGR OpenGR +\subsection thirdpartyOpenGR OpenGR \sc{OpenGR} is a set C++ libraries for 3D Global Registration released under the terms of the APACHE V2 licence. @@ -147,7 +147,7 @@ packages. In order to use \sc{OpenGR} in \cgal programs, the provided CMake func The \sc{OpenGR} web site is `https://github.com/STORM-IRIT/OpenGR`. -\subsection thirdpartylibpointmatcher PointMatcher +\subsection thirdpartylibpointmatcher PointMatcher \sc{libpointmatcher} is a modular library implementing the Iterative Closest Point (ICP) algorithm for aligning point clouds, released under a permissive BSD license. diff --git a/Filtered_kernel/include/CGAL/Kernel_profiler.h b/Filtered_kernel/include/CGAL/Kernel_profiler.h index d592de79fc9..20611510e94 100644 --- a/Filtered_kernel/include/CGAL/Kernel_profiler.h +++ b/Filtered_kernel/include/CGAL/Kernel_profiler.h @@ -6,7 +6,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Sylvain Pion @@ -38,8 +38,8 @@ struct Primitive_profiler result_type operator()(A&& ... a) const { - CGAL_KERNEL_PROFILER; - return P::operator()(std::forward(a)...); + CGAL_KERNEL_PROFILER; + return P::operator()(std::forward(a)...); } }; diff --git a/Filtered_kernel/include/CGAL/Lazy.h b/Filtered_kernel/include/CGAL/Lazy.h index dd3616d4a7e..1dc7f2f12a2 100644 --- a/Filtered_kernel/include/CGAL/Lazy.h +++ b/Filtered_kernel/include/CGAL/Lazy.h @@ -54,7 +54,7 @@ template class Lazy_kernel_base; - + template class Lazy; template @@ -284,14 +284,14 @@ public: os << std::endl; if(! is_lazy()){ for(int i = 0; i < level; i++){ - os << " "; + os << " "; } os << "Exact: "; print_at(os, *et); os << std::endl; #ifdef CGAL_LAZY_KERNEL_DEBUG_SHOW_TYPEID for(int i = 0; i < level; i++){ - os << " "; + os << " "; } os << " (type: " << typeid(*et).name() << ")" << std::endl; #endif // CGAL_LAZY_KERNEL_DEBUG_SHOW_TYPEID @@ -420,11 +420,11 @@ struct Approx_converter const Null_vector& operator()(const Null_vector& n) const { return n; } - + const Bbox_2& operator()(const Bbox_2& b) const { return b; } - + const Bbox_3& operator()(const Bbox_3& b) const { return b; } @@ -445,11 +445,11 @@ struct Exact_converter const Null_vector& operator()(const Null_vector& n) const { return n; } - + const Bbox_2& operator()(const Bbox_2& b) const { return b; } - + const Bbox_3& operator()(const Bbox_3& b) const { return b; } @@ -475,7 +475,7 @@ class Lazy_rep_with_vector_1 public: void - update_exact() const + update_exact() const { // TODO : This looks really unfinished... std::vector vec; @@ -671,13 +671,13 @@ class Lazy : public Handle class Approximate_kernel_, class E2A_> friend struct Lazy_kernel; - + template friend class Lazy_kernel_base; - + public : typedef Lazy Self; @@ -881,10 +881,10 @@ make_lazy(const Object& eto) } CGAL_Kernel_obj(Point_2) -CGAL_Kernel_obj(Point_3) +CGAL_Kernel_obj(Point_3) #undef CGAL_Kernel_obj - + std::cerr << "object_cast inside Lazy_construction_rep::operator() failed. It needs more else if's (#2)" << std::endl; std::cerr << "dynamic type of the Object : " << eto.type().name() << std::endl; @@ -927,7 +927,7 @@ struct Ith { typedef std::pair > Pair_type_2; if(const Pair_type_1 *p1 = object_cast(&v[i])) - return p1->first; + return p1->first; else if(const Pair_type_2 *p2 = object_cast(&v[i])) return p2->first; @@ -1176,11 +1176,11 @@ public: for (unsigned int i = 0; i < lv.approx().size(); i++) { // FIXME : I'm not sure how this work... #define CGAL_Kernel_obj(X) if (object_cast(& (lv.approx()[i]))) { \ - *it++ = make_object(typename LK::X(new Lazy_rep_n, \ + *it++ = make_object(typename LK::X(new Lazy_rep_n, \ Ith, E2A, Lazy_vector> \ (Ith(i), Ith(i), lv))); \ continue; \ - } + } #include @@ -1194,9 +1194,9 @@ public: std::vector exact_objects; ec(CGAL::exact(l1), CGAL::exact(l2), std::back_inserter(exact_objects)); for (std::vector::const_iterator oit = exact_objects.begin(); - oit != exact_objects.end(); - ++oit){ - *it++ = make_lazy(*oit); + oit != exact_objects.end(); + ++oit){ + *it++ = make_lazy(*oit); } } return it; @@ -1255,9 +1255,9 @@ public: #define CGAL_Kernel_obj(X) \ if (object_cast(& (lo.approx()))) { \ - typedef Lazy_rep_n< typename AK::X, typename EK::X, Object_cast, Object_cast, E2A, Lazy_object> Lcr; \ - Lcr * lcr = new Lcr(Object_cast(), Object_cast(), lo); \ - return make_object(typename LK::X(lcr)); \ + typedef Lazy_rep_n< typename AK::X, typename EK::X, Object_cast, Object_cast, E2A, Lazy_object> Lcr; \ + Lcr * lcr = new Lcr(Object_cast(), Object_cast(), lo); \ + return make_object(typename LK::X(lcr)); \ } #include @@ -1288,15 +1288,15 @@ public: #define CGAL_Kernel_obj(X) \ if (object_cast(& (lo.approx()))) { \ - typedef Lazy_rep_n, Object_cast, E2A, Lazy_object> Lcr; \ - Lcr * lcr = new Lcr(Object_cast(), Object_cast(), lo); \ - return make_object(typename LK::X(lcr)); \ + typedef Lazy_rep_n, Object_cast, E2A, Lazy_object> Lcr; \ + Lcr * lcr = new Lcr(Object_cast(), Object_cast(), lo); \ + return make_object(typename LK::X(lcr)); \ } #include // We now check vector - + #define CGAL_Kernel_obj(X) \ { \ const std::vector* v_ptr;\ @@ -1313,7 +1313,7 @@ public: } CGAL_Kernel_obj(Point_2) -CGAL_Kernel_obj(Point_3) +CGAL_Kernel_obj(Point_3) #undef CGAL_Kernel_obj std::cerr << "object_cast inside Lazy_construction_rep::operator() failed. It needs more else if's (#1)" << std::endl; @@ -1342,9 +1342,9 @@ CGAL_Kernel_obj(Point_3) #define CGAL_Kernel_obj(X) \ if (object_cast(& (lo.approx()))) { \ - typedef Lazy_rep_n, Object_cast, E2A, Lazy_object> Lcr; \ - Lcr * lcr = new Lcr(Object_cast(), Object_cast(), lo); \ - return make_object(typename LK::X(lcr)); \ + typedef Lazy_rep_n, Object_cast, E2A, Lazy_object> Lcr; \ + Lcr * lcr = new Lcr(Object_cast(), Object_cast(), lo); \ + return make_object(typename LK::X(lcr)); \ } #include @@ -1367,7 +1367,7 @@ CGAL_Kernel_obj(Point_3) //____________________________________________________________ // The magic functor that has Lazy as result type. -// Two versions are distinguished: one that needs to fiddle +// Two versions are distinguished: one that needs to fiddle // with result_of and another that can forward the result types. namespace internal { @@ -1394,7 +1394,7 @@ struct Variant_cast { T& operator()(boost::optional< boost::variant< BOOST_VARIANT_ENUM_PARAMS(U) > >& o) const { // can throw but should never because we always build it inside - // a static visitor with the right type, if it throws bad_get + // a static visitor with the right type, if it throws bad_get return boost::get(*o); } }; @@ -1405,7 +1405,7 @@ struct Fill_lazy_variant_visitor_2 : boost::static_visitor<> { Fill_lazy_variant_visitor_2(Result& r, Origin& o) : r(&r), o(&o) {} Result* r; Origin* o; - + template void operator()(const T&) { // the equivalent type we are currently matching in the lazy kernel @@ -1415,24 +1415,24 @@ struct Fill_lazy_variant_visitor_2 : boost::static_visitor<> { typedef Lazy_rep_n, Variant_cast, typename LK::E2A, Origin> Lcr; Lcr * lcr = new Lcr(Variant_cast(), Variant_cast(), *o); - + *r = LKT(lcr); } - + template void operator()(const std::vector& t) { typedef T AKT; typedef typename Type_mapper::type EKT; - typedef typename Type_mapper::type LKT; + typedef typename Type_mapper::type LKT; std::vector V; - V.resize(t.size()); + V.resize(t.size()); for (unsigned int i = 0; i < t.size(); i++) { V[i] = LKT(new Lazy_rep_n, Ith_for_intersection, typename LK::E2A, Origin> (Ith_for_intersection(i), Ith_for_intersection(i), *o)); } - + *r = V; } }; @@ -1441,14 +1441,14 @@ template struct Fill_lazy_variant_visitor_0 : boost::static_visitor<> { Fill_lazy_variant_visitor_0(Result& r) : r(&r) {} Result* r; - + template void operator()(const T& t) { // the equivalent type we are currently matching in the lazy kernel typedef T EKT; typedef typename Type_mapper::type AKT; typedef typename Type_mapper::type LKT; - + *r = LKT(new Lazy_rep_0(t)); } @@ -1459,11 +1459,11 @@ struct Fill_lazy_variant_visitor_0 : boost::static_visitor<> { typedef typename Type_mapper::type LKT; std::vector V; - V.resize(t.size()); + V.resize(t.size()); for (unsigned int i = 0; i < t.size(); i++) { V[i] = LKT(new Lazy_rep_0(t[i])); } - + *r = V; } }; @@ -1499,19 +1499,19 @@ struct Lazy_construction_variant { typename result::type operator()(const L1& l1, const L2& l2) const { typedef typename cpp11::result_of::type result_type; - - typedef typename cpp11::result_of::type, + + typedef typename cpp11::result_of::type, typename Type_mapper::type)>::type AT; - typedef typename cpp11::result_of::type, + typedef typename cpp11::result_of::type, typename Type_mapper::type)>::type ET; - + CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); Protect_FPU_rounding P; try { Lazy lazy(new Lazy_rep_n(AC(), EC(), l1, l2)); - // the approximate result requires the trait with types from the AK + // the approximate result requires the trait with types from the AK AT approx_v = lazy.approx(); // the result we build result_type res; @@ -1524,7 +1524,7 @@ struct Lazy_construction_variant { // the static visitor fills the result_type with the correct unwrapped type internal::Fill_lazy_variant_visitor_2< result_type, AK, LK, EK, Lazy > visitor(res, lazy); boost::apply_visitor(visitor, *approx_v); - + return res; } catch (Uncertain_conversion_exception&) { CGAL_BRANCH_PROFILER_BRANCH(tmp); @@ -1547,11 +1547,11 @@ struct Lazy_construction_variant { typename result::type operator()(const L1& l1, const L2& l2, const L3& l3) const { typedef typename result::type result_type; - - typedef typename cpp11::result_of::type, + + typedef typename cpp11::result_of::type, typename Type_mapper::type, typename Type_mapper::type)>::type AT; - typedef typename cpp11::result_of::type, + typedef typename cpp11::result_of::type, typename Type_mapper::type, typename Type_mapper::type)>::type ET; @@ -1560,7 +1560,7 @@ struct Lazy_construction_variant { try { Lazy lazy(new Lazy_rep_n(AC(), EC(), l1, l2, l3)); - // the approximate result requires the trait with types from the AK + // the approximate result requires the trait with types from the AK AT approx_v = lazy.approx(); // the result we build result_type res; @@ -1573,7 +1573,7 @@ struct Lazy_construction_variant { // the static visitor fills the result_type with the correct unwrapped type internal::Fill_lazy_variant_visitor_2< result_type, AK, LK, EK, Lazy > visitor(res, lazy); boost::apply_visitor(visitor, *approx_v); - + return res; } catch (Uncertain_conversion_exception&) { CGAL_BRANCH_PROFILER_BRANCH(tmp); @@ -1593,7 +1593,7 @@ struct Lazy_construction_variant { } }; -template::value && internal::has_result_type::value > struct Lazy_construction; @@ -1605,13 +1605,13 @@ struct Lazy_construction { typedef typename LK::Approximate_kernel AK; typedef typename LK::Exact_kernel EK; - typedef typename boost::remove_cv< + typedef typename boost::remove_cv< typename boost::remove_reference < typename AC::result_type >::type >::type AT; - typedef typename boost::remove_cv< + typedef typename boost::remove_cv< typename boost::remove_reference < typename EC::result_type >::type >::type ET; typedef typename Default::Get::type E2A; - + typedef typename Type_mapper::type result_type; CGAL_NO_UNIQUE_ADDRESS AC ac; @@ -1631,9 +1631,9 @@ struct Lazy_construction { Protect_FPU_rounding P2(CGAL_FE_TONEAREST); \ return result_type( Handle(new Lazy_rep_0(ec( BOOST_PP_ENUM(n, CGAL_LEXACT, _) ))) ); \ } \ - } + } - // arity 1-8 + // arity 1-8 BOOST_PP_REPEAT_FROM_TO(1, 9, CGAL_CONSTRUCTION_OPERATOR, _) // nullary @@ -1645,7 +1645,7 @@ struct Lazy_construction { } #undef CGAL_CONSTRUCTION_OPERATOR - + }; @@ -1698,9 +1698,9 @@ struct result { \ Protect_FPU_rounding P2(CGAL_FE_TONEAREST); \ return result_type( Handle(new Lazy_rep_0(ec( BOOST_PP_ENUM(n, CGAL_LEXACT, _) ))) ); \ } \ - } + } - // arity 1-8 + // arity 1-8 BOOST_PP_REPEAT_FROM_TO(1, 9, CGAL_CONSTRUCTION_OPERATOR, _) // nullary diff --git a/Filtered_kernel/include/CGAL/internal/Static_filters/Coplanar_3.h b/Filtered_kernel/include/CGAL/internal/Static_filters/Coplanar_3.h index 20fbade4402..fedf31fcba9 100644 --- a/Filtered_kernel/include/CGAL/internal/Static_filters/Coplanar_3.h +++ b/Filtered_kernel/include/CGAL/internal/Static_filters/Coplanar_3.h @@ -35,7 +35,7 @@ public: - result_type + result_type operator()(const Point_3& p,const Point_3& q, const Point_3& r, const Point_3& s) const { return Orientation_3()(p,q,r,s) == COPLANAR; diff --git a/Filtered_kernel/include/CGAL/internal/Static_filters/Static_filters.h b/Filtered_kernel/include/CGAL/internal/Static_filters/Static_filters.h index 55bd1d3778b..7d03fa1217c 100644 --- a/Filtered_kernel/include/CGAL/internal/Static_filters/Static_filters.h +++ b/Filtered_kernel/include/CGAL/internal/Static_filters/Static_filters.h @@ -6,10 +6,10 @@ // $URL$ // $Id$ // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Sylvain Pion - + #ifndef CGAL_INTERNAL_STATIC_FILTERS_H #define CGAL_INTERNAL_STATIC_FILTERS_H @@ -303,11 +303,11 @@ public: Do_intersect_3 do_intersect_3_object() const { return Do_intersect_3(); } - + Do_intersect_2 do_intersect_2_object() const { return Do_intersect_2(); } - + #endif // NOT CGAL_NO_DO_INTERSECT_STATIC_FILTERS // The two following are for degenerate cases, so I'll update them later. diff --git a/Generalized_map/include/CGAL/Generalized_map.h b/Generalized_map/include/CGAL/Generalized_map.h index 2b39468477f..bec3b9a187f 100644 --- a/Generalized_map/include/CGAL/Generalized_map.h +++ b/Generalized_map/include/CGAL/Generalized_map.h @@ -905,7 +905,7 @@ namespace CGAL { bool belong_to_same_cell(Dart_const_handle adart1, Dart_const_handle adart2) const { return CGAL::belong_to_same_cell(*this, adart1, adart2); } - + template bool is_whole_cell_unmarked(Dart_const_handle adart, size_type amark) const { return CGAL::is_whole_cell_unmarked(*this, adart, amark); } @@ -1726,16 +1726,16 @@ namespace CGAL { { CGAL_assertion((!this->template is_free<1>(d1))); /* CGAL_assertion((belong_to_same_cell<0>(this->next(d1), d2))); */ - + if (d2==opposite2(d1)) { return 0; } - + Dart_const_handle dd1=d1; std::size_t res=1; while (next(dd1)!=d2) { if (this->template is_free<2>(next(dd1))) { return std::numeric_limits::max(); } - + ++res; dd1=opposite2(next(dd1)); @@ -1768,7 +1768,7 @@ namespace CGAL { ++res; dd1=opposite2(previous(dd1)); - + CGAL_assertion(!this->template is_free<0>(dd1)); CGAL_assertion(previous(dd1)==d2 || dd1!=d1); } diff --git a/Generalized_map/include/CGAL/Generalized_map_storages.h b/Generalized_map/include/CGAL/Generalized_map_storages.h index 2e27d2acdb6..51200c733fa 100644 --- a/Generalized_map/include/CGAL/Generalized_map_storages.h +++ b/Generalized_map/include/CGAL/Generalized_map_storages.h @@ -66,7 +66,7 @@ namespace CGAL { typedef Items_ Items; typedef Alloc_ Alloc; - + template struct Container_for_attributes : public Compact_container::template rebind_alloc > @@ -224,7 +224,7 @@ namespace CGAL { CGAL_assertion( ah!=nullptr ); return ah->is_valid(); } - + // accessors and modifiers to the attribute ref counting given its handle template std::size_t get_attribute_ref_counting diff --git a/Generator/doc/Generator/CGAL/point_generators_2.h b/Generator/doc/Generator/CGAL/point_generators_2.h index f22f8aa8497..86110aa1ba8 100644 --- a/Generator/doc/Generator/CGAL/point_generators_2.h +++ b/Generator/doc/Generator/CGAL/point_generators_2.h @@ -286,7 +286,7 @@ distributed inside a triangle. The default `Creator` is template< typename Point_2, typename Creator > class Random_points_in_triangle_2 { public: - + /// \name Types /// @{ diff --git a/Generator/doc/Generator/CGAL/point_generators_3.h b/Generator/doc/Generator/CGAL/point_generators_3.h index 1eb5c014f0b..6c7fd598515 100644 --- a/Generator/doc/Generator/CGAL/point_generators_3.h +++ b/Generator/doc/Generator/CGAL/point_generators_3.h @@ -164,7 +164,7 @@ get_default_random()); } /* end namespace CGAL */ namespace CGAL { - + /*! The class `Random_points_in_triangle_3` is an input iterator creating points uniformly @@ -182,7 +182,7 @@ distributed inside a 3D triangle. The default `Creator` is template< typename Point_3, typename Creator > class Random_points_in_triangle_3 { public: - + /// \name Types /// @{ @@ -304,7 +304,7 @@ Random& rnd = get_default_random()); } /* end namespace CGAL */ namespace CGAL { - + /*! The class `Random_points_in_tetrahedron_3` is an input iterator creating points uniformly @@ -322,7 +322,7 @@ distributed inside a tetrahedron. The default `Creator` is template< typename Point_3, typename Creator > class Random_points_in_tetrahedron_3 { public: - + /// \name Types /// @{ @@ -376,7 +376,7 @@ get_default_random()); /// @} }; /* end Random_points_in_tetrahedron_3 */ - + } /* end namespace CGAL */ namespace CGAL { diff --git a/Generator/examples/Generator/CMakeLists.txt b/Generator/examples/Generator/CMakeLists.txt index 0fa1a97db40..c5ac751d26c 100644 --- a/Generator/examples/Generator/CMakeLists.txt +++ b/Generator/examples/Generator/CMakeLists.txt @@ -12,7 +12,7 @@ if ( CGAL_FOUND ) # Use Eigen find_package(Eigen3 3.1.0 QUIET) #(3.1.0 or greater) - + # create a target per cppfile file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) foreach(cppfile ${cppfiles}) @@ -28,8 +28,8 @@ if ( CGAL_FOUND ) endforeach() else() - + message(STATUS "This program requires the CGAL library, and will not be compiled.") - + endif() diff --git a/Generator/include/CGAL/point_generators_d.h b/Generator/include/CGAL/point_generators_d.h index 9fc0b0b9193..4d85f26af47 100644 --- a/Generator/include/CGAL/point_generators_d.h +++ b/Generator/include/CGAL/point_generators_d.h @@ -32,8 +32,8 @@ class Random_points_in_ball_d : public Random_generator_base

{ int dimension; public: typedef Random_points_in_ball_d

This; - Random_points_in_ball_d( int dim, double a = 1, - Random& rnd = get_default_random()) + Random_points_in_ball_d( int dim, double a = 1, + Random& rnd = get_default_random()) // g is an input iterator creating points of type `P' uniformly // distributed in the open sphere with radius r, i.e. |`*g'| < r . : Random_generator_base

( a, rnd), dimension(dim) { generate_point(); } @@ -54,9 +54,9 @@ Random_points_in_ball_d

:: generate_point() { double norm = 0; std::vector< double > coord(dimension); - + for(int i=0; i_rnd.get_double(); a = std::sqrt( -2* std::log(1-a) ); @@ -80,8 +80,8 @@ class Random_points_on_sphere_d : public Random_generator_base

{ int dimension; public: typedef Random_points_on_sphere_d

This; - Random_points_on_sphere_d( int dim, double a = 1, - Random& rnd = get_default_random()) + Random_points_on_sphere_d( int dim, double a = 1, + Random& rnd = get_default_random()) // g is an input iterator creating points of type `P' uniformly // distributed on the sphere with radius r, i.e. |`*g'| == r . : Random_generator_base

( a, rnd), dimension(dim) { generate_point(); } @@ -102,7 +102,7 @@ Random_points_on_sphere_d

:: generate_point() { double norm = 0; std::vector< double > coord(dimension); - + for(int i=0; i_rnd.get_double(); @@ -124,8 +124,8 @@ class Random_points_in_cube_d : public Random_generator_base

{ int dimension; public: typedef Random_points_in_cube_d

This; - Random_points_in_cube_d( int dim, double a = 1, - Random& rnd = get_default_random()) + Random_points_in_cube_d( int dim, double a = 1, + Random& rnd = get_default_random()) : Random_generator_base

( a, rnd), dimension(dim) { generate_point(); } This& operator++() { generate_point(); @@ -155,17 +155,17 @@ generate_point() { template OutputIterator -points_on_cube_grid_d( int dimension, double a, - std::size_t n, OutputIterator o, Creator creator) +points_on_cube_grid_d( int dimension, double a, + std::size_t n, OutputIterator o, Creator creator) { // typedef typename OutputIterator::container_type::value_type Point; if (n == 0) return o; - + // take m smallest such that m^dimension > n int m=int(std::floor(std::pow(static_cast(n),1/(double)dimension))); - while(true) { + while(true) { int nn=1; for (int i=0; i=n) break; @@ -184,8 +184,8 @@ points_on_cube_grid_d( int dimension, double a, std::size_t i=0; while (true) { //compute point - for(j=0; j< dimension; ++j) { - coord[j]=base+step*indices[j]; + for(j=0; j< dimension; ++j) { + coord[j]=base+step*indices[j]; } *o = creator(coord.begin(), coord.end() ); ++i; @@ -196,7 +196,7 @@ points_on_cube_grid_d( int dimension, double a, // increment and reset smaller indices CGAL_assertion(j0) { --j; indices[j]=0; } + while(j>0) { --j; indices[j]=0; } } return o; } diff --git a/Generator/test/Generator/CMakeLists.txt b/Generator/test/Generator/CMakeLists.txt index 0eb1657d2a9..3f24895ab6a 100644 --- a/Generator/test/Generator/CMakeLists.txt +++ b/Generator/test/Generator/CMakeLists.txt @@ -26,8 +26,8 @@ if ( CGAL_FOUND ) endforeach() else() - + message(STATUS "This program requires the CGAL library, and will not be compiled.") - + endif() diff --git a/GraphicsView/demo/Polygon/CMakeLists.txt b/GraphicsView/demo/Polygon/CMakeLists.txt index 1a84a55e34a..4ef96ffcf74 100644 --- a/GraphicsView/demo/Polygon/CMakeLists.txt +++ b/GraphicsView/demo/Polygon/CMakeLists.txt @@ -41,7 +41,7 @@ if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND ) # qrc files (resources files, that contain icons, at least) qt5_add_resources ( CGAL_Qt5_RESOURCE_FILES ./Polygon_2.qrc ) -# add_library( CGAL SHARED IMPORTED ) +# add_library( CGAL SHARED IMPORTED ) # SET_PROPERTY(TARGET CGAL PROPERTY IMPORTED_LOCATION ${CGAL_LIBRARY} ) # The executable itself. diff --git a/GraphicsView/include/CGAL/Buffer_for_vao.h b/GraphicsView/include/CGAL/Buffer_for_vao.h index a166558b25f..932cb56f784 100644 --- a/GraphicsView/include/CGAL/Buffer_for_vao.h +++ b/GraphicsView/include/CGAL/Buffer_for_vao.h @@ -6,7 +6,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Guillaume Damiand @@ -57,7 +57,7 @@ namespace internal normal); ++nb; } - + assert(nb>0); return (typename Kernel_traits::Kernel::Construct_scaled_vector_3() (normal, 1.0/nb)); @@ -189,18 +189,18 @@ public: bool has_flat_normal() const { return m_flat_normal_buffer!=nullptr; } - + bool has_gouraud_normal() const { return m_gouraud_normal_buffer!=nullptr; } bool has_zero_x() const - { return m_zero_x; } + { return m_zero_x; } bool has_zero_y() const - { return m_zero_y; } + { return m_zero_y; } bool has_zero_z() const - { return m_zero_z; } + { return m_zero_z; } void negate_normals() { @@ -212,19 +212,19 @@ public: { (*array)[i]=-(*array)[i]; } } } - + // 1.1) Add a point, without color. Return the index of the added point. template std::size_t add_point(const KPoint& kp) { if (!has_position()) return (std::size_t)-1; - + Local_point p=get_local_point(kp); add_point_in_buffer(p, *m_pos_buffer); if (m_bb!=nullptr) { (*m_bb)=(*m_bb)+p.bbox(); } - + if (m_zero_x && p.x()!=0) { m_zero_x=false; } if (m_zero_y && p.y()!=0) { m_zero_y=false; } if (m_zero_z && p.z()!=0) { m_zero_z=false; } @@ -265,7 +265,7 @@ public: add_point(kp1); add_point(kp2); } - + // 2.2) Add a segment, with color. template void add_segment(const KPoint& kp1, const KPoint& kp2, const CGAL::Color& c) @@ -273,7 +273,7 @@ public: add_segment(kp1, kp2); add_color(c); add_color(c); - } + } // 2.3) Add an indexed segment, without color. template @@ -324,7 +324,7 @@ public: /// @return true iff a face has begun. bool is_a_face_started() const { return m_face_started; } - + // 3.1) Add a face, without color, without normal. void face_begin() { face_begin_internal(false, false); } @@ -369,7 +369,7 @@ public: } return false; } - + /// Add a point at the end of the current face /// @param p the point to add /// @p_normal the vertex normal at this point (for Gouraud shading) @@ -385,7 +385,7 @@ public: } /// Add an indexed point at the end of the current face, without giving the vertex normal. - /// When Indexation is used, it is not possible to use flat shading or multiple colors + /// When Indexation is used, it is not possible to use flat shading or multiple colors /// for face sor edges. /// Note that we still need the point itself, in order to triangulate the face when necessary. template @@ -398,7 +398,7 @@ public: } return false; } - + /// End the face: compute the triangulation. void face_end() { @@ -408,7 +408,7 @@ public: { /* std::cerr<<"PB: you try to triangulate a face with "<(m_points_of_face)); @@ -444,7 +444,7 @@ public: { if (m_points_of_face.size()==4) { convex_quadrangular_face_end_internal(normal); } // Convex quad - else + else { convex_face_end_internal(normal); } // Convex face with > 4 vertices } else @@ -515,10 +515,10 @@ public: const Local_point& S=facet[id]; const Local_point& T=facet[(id+1==facet.size())?0:id+1]; Local_vector V1=Local_vector((T-S).x(), (T-S).y(), (T-S).z()); - + const Local_point& U=facet[(id+2>=facet.size())?id+2-facet.size():id+2]; Local_vector V2=Local_vector((U-T).x(), (U-T).y(), (U-T).z()); - + local_orientation=Local_kernel::Orientation_3()(V1, V2, normal) ; if(local_orientation!=CGAL::ZERO && local_orientation!=orientation) @@ -537,7 +537,7 @@ protected: std::cerr<<"You cannot start a new face before to finish the previous one."<0) - { - add_indexed_point(m_indices_of_points_of_face[i]); + { + add_indexed_point(m_indices_of_points_of_face[i]); } else { add_point(m_points_of_face[i]); // Add the position of the point if (m_started_face_is_colored) - { add_color(m_color_of_face); } // Add the color + { add_color(m_color_of_face); } // Add the color add_flat_normal(normal); // Add the flat normal // Its smooth normal (if given by the user) if (m_vertex_normals_for_face.size()>0) @@ -575,7 +575,7 @@ protected: } } } - + void convex_quadrangular_face_end_internal(const Local_vector& normal) { // Add indices when they exist @@ -584,7 +584,7 @@ protected: add_indexed_point(m_indices_of_points_of_face[0]); add_indexed_point(m_indices_of_points_of_face[1]); add_indexed_point(m_indices_of_points_of_face[2]); - + add_indexed_point(m_indices_of_points_of_face[0]); add_indexed_point(m_indices_of_points_of_face[2]); add_indexed_point(m_indices_of_points_of_face[3]); @@ -609,7 +609,7 @@ protected: add_flat_normal(normal); if (m_vertex_normals_for_face.size()==0) - { add_gouraud_normal(normal); } + { add_gouraud_normal(normal); } } if (m_vertex_normals_for_face.size()>0) @@ -617,14 +617,14 @@ protected: add_gouraud_normal(m_vertex_normals_for_face[0]); add_gouraud_normal(m_vertex_normals_for_face[1]); add_gouraud_normal(m_vertex_normals_for_face[2]); - + add_gouraud_normal(m_vertex_normals_for_face[0]); add_gouraud_normal(m_vertex_normals_for_face[2]); add_gouraud_normal(m_vertex_normals_for_face[3]); } } } - + void convex_face_end_internal(const Local_vector& normal) { for(std::size_t i=1; imax(p1,p2) std::map > edges; @@ -687,13 +687,13 @@ protected: p1=m_points_of_face[i]; p2=m_points_of_face[i==0?m_points_of_face.size()-1:i-1]; if (p2 m; m[p2]=1; edges[p1]=m; } else if (edges[p1].count(p2)==0) { edges[p1][p2]=1; } else { ++(edges[p1][p2]); } } - + // (1) We insert all the edges as contraint in the CDT. typename CDT::Vertex_handle previous=nullptr, first=nullptr; for (unsigned int i=0; iinfo().v=m_vertex_normals_for_face[i]; } else @@ -709,7 +709,7 @@ protected: if (m_indices_of_points_of_face.size()>0) { vh->info().index=m_indices_of_points_of_face[i]; } - + if(previous!=nullptr && previous!=vh) { p1=m_points_of_face[i]; p2=m_points_of_face[i-1]; @@ -719,7 +719,7 @@ protected: } previous=vh; } - + if (previous!=nullptr && previous!=first) { p1=m_points_of_face[m_points_of_face.size()-1]; p2=m_points_of_face[0]; @@ -727,9 +727,9 @@ protected: if ((edges[p1][p2])%2==1) // odd number of time => constraint { cdt.insert_constraint(previous, first); } } - + // (2) We mark all external triangles - // (2.1) We initialize is_external and is_process values + // (2.1) We initialize is_external and is_process values for(typename CDT::All_faces_iterator fit = cdt.all_faces_begin(), fitend = cdt.all_faces_end(); fit!=fitend; ++fit) { @@ -762,10 +762,10 @@ protected: } } } - + if ( face_internal!=nullptr ) { face_queue.push(face_internal); } - + while(!face_queue.empty()) { typename CDT::Face_handle fh = face_queue.front(); @@ -784,8 +784,8 @@ protected: } } } - - // (3) Now we iterates on the internal faces to add the vertices + + // (3) Now we iterates on the internal faces to add the vertices // and the normals to the appropriate vectors for(typename CDT::Finite_faces_iterator ffit=cdt.finite_faces_begin(), ffitend = cdt.finite_faces_end(); ffit!=ffitend; ++ffit) @@ -793,7 +793,7 @@ protected: if(!ffit->info().is_external) { for(unsigned int i=0; i<3; ++i) - { + { // Add indices when they exist if (m_indices_of_points_of_face.size()>0) { add_indexed_point(ffit->vertex(i)->info().index); } @@ -832,7 +832,7 @@ protected: if (m_color_buffer!=nullptr) { add_color_in_buffer(acolor, *m_color_buffer); } } - + template void add_flat_normal(const KVector& kv) { @@ -899,7 +899,7 @@ protected: bool m_zero_z; /// True iff all points have z==0 bool m_inverse_normal;; - + // Local variables, used when we started a new face.g bool m_face_started; bool m_started_face_is_colored; diff --git a/GraphicsView/include/CGAL/Qt/Basic_viewer_qt.h b/GraphicsView/include/CGAL/Qt/Basic_viewer_qt.h index cc15c5c9676..61cb1d9cd73 100644 --- a/GraphicsView/include/CGAL/Qt/Basic_viewer_qt.h +++ b/GraphicsView/include/CGAL/Qt/Basic_viewer_qt.h @@ -6,7 +6,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Guillaume Damiand @@ -96,11 +96,11 @@ const char fragment_source_color[] = "void main(void) { \n" " highp vec3 L = light_pos.xyz - fP.xyz; \n" " highp vec3 V = -fP.xyz; \n" - + " highp vec3 N = normalize(fN); \n" " L = normalize(L); \n" " V = normalize(V); \n" - + " highp vec3 R = reflect(-L, N); \n" " highp vec4 diffuse = max(dot(N,L), 0.0) * light_diff * fColor; \n" " highp vec4 specular = pow(max(dot(R,V), 0.0), spec_power) * light_spec; \n" @@ -143,14 +143,14 @@ const char vertex_source_color_comp[] = "attribute highp vec4 vertex;\n" "attribute highp vec3 normal;\n" "attribute highp vec3 color;\n" - + "uniform highp mat4 mvp_matrix;\n" "uniform highp mat4 mv_matrix; \n" - + "varying highp vec4 fP; \n" "varying highp vec3 fN; \n" "varying highp vec4 fColor; \n" - + "uniform highp float point_size; \n" "void main(void)\n" "{\n" @@ -176,20 +176,20 @@ const char fragment_source_color_comp[] = "uniform highp vec4 light_spec; \n" "uniform highp vec4 light_amb; \n" "uniform highp float spec_power ; \n" - + "void main(void) { \n" - + " highp vec3 L = light_pos.xyz - fP.xyz; \n" " highp vec3 V = -fP.xyz; \n" - + " highp vec3 N = normalize(fN); \n" " L = normalize(L); \n" " V = normalize(V); \n" - + " highp vec3 R = reflect(-L, N); \n" " highp vec4 diffuse = max(dot(N,L), 0.0) * light_diff * fColor; \n" " highp vec4 specular = pow(max(dot(R,V), 0.0), spec_power) * light_spec; \n" - + "gl_FragColor = light_amb*fColor + diffuse ; \n" "} \n" "\n" @@ -372,7 +372,7 @@ public: bool has_zero_x() const { return - m_buffer_for_mono_points.has_zero_x() && + m_buffer_for_mono_points.has_zero_x() && m_buffer_for_colored_points.has_zero_x() && m_buffer_for_mono_segments.has_zero_x() && m_buffer_for_colored_segments.has_zero_x() && @@ -382,12 +382,12 @@ public: m_buffer_for_colored_rays.has_zero_x() && m_buffer_for_mono_lines.has_zero_x() && m_buffer_for_colored_lines.has_zero_x(); - } + } bool has_zero_y() const { return - m_buffer_for_mono_points.has_zero_y() && + m_buffer_for_mono_points.has_zero_y() && m_buffer_for_colored_points.has_zero_y() && m_buffer_for_mono_segments.has_zero_y() && m_buffer_for_colored_segments.has_zero_y() && @@ -398,11 +398,11 @@ public: m_buffer_for_mono_lines.has_zero_y() && m_buffer_for_colored_lines.has_zero_y(); } - + bool has_zero_z() const { return - m_buffer_for_mono_points.has_zero_z() && + m_buffer_for_mono_points.has_zero_z() && m_buffer_for_colored_points.has_zero_z() && m_buffer_for_mono_segments.has_zero_z() && m_buffer_for_colored_segments.has_zero_z() && @@ -413,7 +413,7 @@ public: m_buffer_for_mono_lines.has_zero_z() && m_buffer_for_colored_lines.has_zero_z(); } - + template void add_point(const KPoint& p) { m_buffer_for_mono_points.add_point(p); } @@ -585,19 +585,19 @@ protected: } // Vertices and segments shader - - const char* source_ = isOpenGL_4_3() + + const char* source_ = isOpenGL_4_3() ? vertex_source_p_l : vertex_source_p_l_comp; - + QOpenGLShader *vertex_shader_p_l = new QOpenGLShader(QOpenGLShader::Vertex); if(!vertex_shader_p_l->compileSourceCode(source_)) { std::cerr<<"Compiling vertex source FAILED"<compileSourceCode(source_)) { std::cerr<<"Compiling fragmentsource FAILED"<compileSourceCode(source_)) { std::cerr<<"Compiling vertex source FAILED"<compileSourceCode(source_)) { std::cerr<<"Compiling fragmentsource FAILED"<setViewDirection(CGAL::qglviewer::Vec(-cx,-cy,-cz)); constraint.setRotationConstraintDirection(CGAL::qglviewer::Vec(cx, cy, cz)); camera()->frame()->setConstraint(&constraint); @@ -1194,7 +1194,7 @@ protected: (CGAL::qglviewer::Vec(std::get<0>(m_texts[i]).x(), std::get<0>(m_texts[i]).y(), std::get<0>(m_texts[i]).z())); - + drawText((int)screenPos[0], (int)screenPos[1], std::get<1>(m_texts[i])); } glEnable(GL_LIGHTING); @@ -1244,7 +1244,7 @@ protected: glHint(GL_LINE_SMOOTH_HINT, GL_FASTEST); compile_shaders(); - + CGAL::Bbox_3 bb; if (bb==bounding_box()) // Case of "empty" bounding box { @@ -1487,7 +1487,7 @@ protected: bool m_use_mono_color; bool m_inverse_normal; bool m_draw_text; - + double m_size_points; double m_size_edges; double m_size_rays; @@ -1585,7 +1585,7 @@ namespace CGAL template void draw(const T&, const char* ="", bool=false) - { + { std::cerr<<"Impossible to draw, CGAL_USE_BASIC_VIEWER is not defined."<_headers\" and \"pkg__deps\" for each package" FALSE) unset(CGAL_COMPUTE_DEPENDENCIES CACHE) # remove that variable, no longer used @@ -1131,7 +1131,7 @@ because IPE_FOUND is false.") set(flag "-E") endif() if(NOT DEFINED CGAL_CHECK_SYNTAX_ONLY) - execute_process(COMMAND + execute_process(COMMAND ${CMAKE_CXX_COMPILER} -x c++ ${flag} ${CGAL_MODULES_DIR}/config/support/test_syntaxonly.cpp ERROR_QUIET RESULT_VARIABLE ok) @@ -1331,7 +1331,7 @@ ${CMAKE_CURRENT_SOURCE_DIR}/../${package}/include/${header}" list(REMOVE_DUPLICATES packages_deps) endif() endforeach() # loop on packages - + #Now check that a cpp file including all documented headers compiles file(WRITE ${CGAL_BINARY_DIR}/test_headers.cpp "#define BOOST_PARAMETER_MAX_ARITY 12 \n") foreach(header ${list_of_headers_to_test}) @@ -1339,7 +1339,7 @@ ${CMAKE_CURRENT_SOURCE_DIR}/../${package}/include/${header}" endforeach() #loop on headers to include in test file file(APPEND ${CGAL_BINARY_DIR}/test_headers.cpp "int main(){}\n") - add_custom_target(check_headers + add_custom_target(check_headers DEPENDS ${check_pkg_target_list}) string(REPLACE " " ";" compile_options ${compile_options}) @@ -1347,7 +1347,7 @@ ${CMAKE_CURRENT_SOURCE_DIR}/../${package}/include/${header}" add_custom_command(TARGET check_headers POST_BUILD COMMAND ${CMAKE_CXX_COMPILER} - ${compile_options} ${include_options} + ${compile_options} ${include_options} -x c++ -fsyntax-only ${CGAL_BINARY_DIR}/test_headers.cpp ) diff --git a/Installation/include/CGAL/Surface_mesh/Surface_mesh_fwd.h b/Installation/include/CGAL/Surface_mesh/Surface_mesh_fwd.h index 95b8da61f33..2aba1c91a43 100644 --- a/Installation/include/CGAL/Surface_mesh/Surface_mesh_fwd.h +++ b/Installation/include/CGAL/Surface_mesh/Surface_mesh_fwd.h @@ -20,7 +20,7 @@ namespace CGAL { template class Surface_mesh; - + } // CGAL #endif diff --git a/Intersections_3/test/Intersections_3/call_test.cpp b/Intersections_3/test/Intersections_3/call_test.cpp index 96da5418020..1f27833ad8d 100644 --- a/Intersections_3/test/Intersections_3/call_test.cpp +++ b/Intersections_3/test/Intersections_3/call_test.cpp @@ -82,7 +82,7 @@ int main(int argc, char**) // special CGAL::cpp11::result_of::type plplpl = CGAL::intersection(Pl(), Pl(), Pl()); - + call_intersection_global(Tr(), S()); call_intersection_global(Tr(), L()); call_intersection_global(Tr(), Pl()); @@ -109,7 +109,7 @@ int main(int argc, char**) call_intersection_global(Bbox_3(), R()); // with kernel - + call_intersection_with_kernel(S(), S(), K()); call_intersection_with_kernel(S(), L(), K()); call_intersection_with_kernel(S(), Pl(), K()); @@ -159,14 +159,14 @@ int main(int argc, char**) call_intersection_with_kernel(Bbox_3(), S(), K()); call_intersection_with_kernel(Bbox_3(), R(), K()); - // The doc defines calls to do_intersect for these objects + // The doc defines calls to do_intersect for these objects // Plane_3 // Line_3 // Ray_3 // Segment_3 // Triangle_3. - // Bbox_3. + // Bbox_3. call_do_intersect_global(Pl(), Pl()); call_do_intersect_global(Pl(), L()); call_do_intersect_global(Pl(), R()); @@ -216,7 +216,7 @@ int main(int argc, char**) call_do_intersect_global(Bbox_3(), Tr()); call_do_intersect_global(Bbox_3(), Sph()); call_do_intersect_global(Bbox_3(), Bbox_3()); - + // with_kernel call_do_intersect_with_kernel(Pl(), Pl(), K()); call_do_intersect_with_kernel(Pl(), L(), K()); diff --git a/Jet_fitting_3/examples/Jet_fitting_3/CMakeLists.txt b/Jet_fitting_3/examples/Jet_fitting_3/CMakeLists.txt index d53b00b46a6..b52c55f79a3 100644 --- a/Jet_fitting_3/examples/Jet_fitting_3/CMakeLists.txt +++ b/Jet_fitting_3/examples/Jet_fitting_3/CMakeLists.txt @@ -33,7 +33,7 @@ if ( CGAL_FOUND ) CGAL_target_use_Eigen(Mesh_estimation) create_single_source_cgal_program( "Single_estimation.cpp" ) CGAL_target_use_Eigen(Single_estimation) - + else() message(STATUS "NOTICE: This program requires Eigen 3.1 (or greater) and will not be compiled.") endif() diff --git a/Kernel_23/doc/Kernel_23/CGAL/Filtered_predicate.h b/Kernel_23/doc/Kernel_23/CGAL/Filtered_predicate.h index b08e4274f56..bad95b0defa 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Filtered_predicate.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Filtered_predicate.h @@ -4,67 +4,67 @@ namespace CGAL { /*! \ingroup kernel_classes -`Filtered_predicate` is an adaptor for predicate function objects that allows -one to produce efficient and exact predicates. It is used to build -`CGAL::Filtered_kernel` and can be used for other -predicates too. +`Filtered_predicate` is an adaptor for predicate function objects that allows +one to produce efficient and exact predicates. It is used to build +`CGAL::Filtered_kernel` and can be used for other +predicates too. -`EP` is the exact but supposedly slow predicate that is able to evaluate -the predicate correctly. It will be called only when the filtering predicate, -`FP`, cannot compute the correct result. This failure of `FP` must be -done by throwing an exception. +`EP` is the exact but supposedly slow predicate that is able to evaluate +the predicate correctly. It will be called only when the filtering predicate, +`FP`, cannot compute the correct result. This failure of `FP` must be +done by throwing an exception. -To convert the geometric objects that are the arguments of the predicate, -we use the function objects `C2E` and `C2F`, which must be of the form -`Cartesian_converter` or `Homogeneous_converter`. +To convert the geometric objects that are the arguments of the predicate, +we use the function objects `C2E` and `C2F`, which must be of the form +`Cartesian_converter` or `Homogeneous_converter`. \cgalHeading{Example} -The following example defines an efficient and exact version of the -orientation predicate over three points using the Cartesian representation -with double coordinates and without reference counting -(`Simple_cartesian::Point_2`). -Of course, the orientation predicate can already be found in the kernel, but -you can follow this example to filter your own predicates. -It uses the fast but inexact predicate based on interval arithmetic for -filtering and the slow but exact predicate based on multi-precision floats -when the filtering predicate fails. +The following example defines an efficient and exact version of the +orientation predicate over three points using the Cartesian representation +with double coordinates and without reference counting +(`Simple_cartesian::Point_2`). +Of course, the orientation predicate can already be found in the kernel, but +you can follow this example to filter your own predicates. +It uses the fast but inexact predicate based on interval arithmetic for +filtering and the slow but exact predicate based on multi-precision floats +when the filtering predicate fails. -\cgalExample{Filtered_kernel/Filtered_predicate.cpp} +\cgalExample{Filtered_kernel/Filtered_predicate.cpp} */ template< typename EP, typename FP, typename C2E, typename C2F > class Filtered_predicate { public: -/// \name Types +/// \name Types /// @{ /*! -The return type of the function operators. -It must also be the same type as `EP::result_type`. -*/ -typedef FP::result_type result_type; +The return type of the function operators. +It must also be the same type as `EP::result_type`. +*/ +typedef FP::result_type result_type; -/// @} +/// @} -/// \name Creation +/// \name Creation /// @{ /*! -%Default constructor. -*/ -Filtered_predicate(); +%Default constructor. +*/ +Filtered_predicate(); -/// @} +/// @} -/// \name Operations +/// \name Operations /// @{ /*! -The function operator for predicates. -*/ -template result_type operator()(A a...); +The function operator for predicates. +*/ +template result_type operator()(A a...); /// @} diff --git a/Kernel_23/include/CGAL/Kernel/interface_macros.h b/Kernel_23/include/CGAL/Kernel/interface_macros.h index 908a6dd277c..9993c699f02 100644 --- a/Kernel_23/include/CGAL/Kernel/interface_macros.h +++ b/Kernel_23/include/CGAL/Kernel/interface_macros.h @@ -1,16 +1,16 @@ -// Copyright (c) 2000-2004 +// Copyright (c) 2000-2004 // Utrecht University (The Netherlands), // ETH Zurich (Switzerland), // INRIA Sophia-Antipolis (France), // Max-Planck-Institute Saarbruecken (Germany), -// and Tel-Aviv University (Israel). All rights reserved. +// and Tel-Aviv University (Israel). All rights reserved. // // This file is part of CGAL (www.cgal.org) // // $URL$ // $Id$ // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Herve Bronnimann, Sylvain Pion, Susan Hert @@ -67,49 +67,49 @@ CGAL_Kernel_obj(Circle_3) CGAL_Kernel_pred(Angle_2, - angle_2_object) + angle_2_object) CGAL_Kernel_pred(Angle_3, - angle_3_object) + angle_3_object) CGAL_Kernel_pred(Are_ordered_along_line_2, - are_ordered_along_line_2_object) + are_ordered_along_line_2_object) CGAL_Kernel_pred(Are_ordered_along_line_3, - are_ordered_along_line_3_object) + are_ordered_along_line_3_object) CGAL_Kernel_pred(Are_parallel_2, - are_parallel_2_object) + are_parallel_2_object) CGAL_Kernel_pred(Are_parallel_3, - are_parallel_3_object) + are_parallel_3_object) CGAL_Kernel_pred(Are_strictly_ordered_along_line_2, - are_strictly_ordered_along_line_2_object) + are_strictly_ordered_along_line_2_object) CGAL_Kernel_pred(Are_strictly_ordered_along_line_3, - are_strictly_ordered_along_line_3_object) + are_strictly_ordered_along_line_3_object) CGAL_Kernel_cons(Assign_2, - assign_2_object) + assign_2_object) CGAL_Kernel_cons(Assign_3, - assign_3_object) + assign_3_object) CGAL_Kernel_pred(Bounded_side_2, - bounded_side_2_object) + bounded_side_2_object) CGAL_Kernel_pred(Bounded_side_3, - bounded_side_3_object) + bounded_side_3_object) CGAL_Kernel_pred(Collinear_are_ordered_along_line_2, - collinear_are_ordered_along_line_2_object) + collinear_are_ordered_along_line_2_object) CGAL_Kernel_pred(Collinear_are_ordered_along_line_3, - collinear_are_ordered_along_line_3_object) + collinear_are_ordered_along_line_3_object) CGAL_Kernel_pred(Collinear_are_strictly_ordered_along_line_2, - collinear_are_strictly_ordered_along_line_2_object) + collinear_are_strictly_ordered_along_line_2_object) CGAL_Kernel_pred(Collinear_are_strictly_ordered_along_line_3, - collinear_are_strictly_ordered_along_line_3_object) + collinear_are_strictly_ordered_along_line_3_object) CGAL_Kernel_pred(Collinear_has_on_2, - collinear_has_on_2_object) + collinear_has_on_2_object) CGAL_Kernel_pred_RT(Collinear_2, collinear_2_object) CGAL_Kernel_pred_RT(Collinear_3, collinear_3_object) CGAL_Kernel_pred(Compare_angle_with_x_axis_2, - compare_angle_with_x_axis_2_object) + compare_angle_with_x_axis_2_object) CGAL_Kernel_pred(Compare_dihedral_angle_3, - compare_dihedral_angle_3_object) + compare_dihedral_angle_3_object) CGAL_Kernel_pred(Compare_distance_2, - compare_distance_2_object) + compare_distance_2_object) CGAL_Kernel_pred(Compare_distance_3, compare_distance_3_object) CGAL_Kernel_pred_RT(Compare_power_distance_2, @@ -117,189 +117,189 @@ CGAL_Kernel_pred_RT(Compare_power_distance_2, CGAL_Kernel_pred_RT(Compare_power_distance_3, compare_power_distance_3_object) CGAL_Kernel_pred(Compare_slope_2, - compare_slope_2_object) + compare_slope_2_object) CGAL_Kernel_pred(Compare_slope_3, - compare_slope_3_object) + compare_slope_3_object) CGAL_Kernel_pred(Compare_squared_distance_2, - compare_squared_distance_2_object) + compare_squared_distance_2_object) CGAL_Kernel_pred(Compare_squared_distance_3, - compare_squared_distance_3_object) + compare_squared_distance_3_object) CGAL_Kernel_pred(Compare_squared_radius_3, - compare_squared_radius_3_object) + compare_squared_radius_3_object) CGAL_Kernel_pred(Compare_weighted_squared_radius_3, compare_weighted_squared_radius_3_object) CGAL_Kernel_pred(Compare_x_at_y_2, - compare_x_at_y_2_object) + compare_x_at_y_2_object) CGAL_Kernel_pred(Compare_xyz_3, - compare_xyz_3_object) + compare_xyz_3_object) CGAL_Kernel_pred(Compare_xy_2, - compare_xy_2_object) + compare_xy_2_object) CGAL_Kernel_pred(Compare_xy_3, - compare_xy_3_object) + compare_xy_3_object) CGAL_Kernel_pred(Compare_x_2, - compare_x_2_object) + compare_x_2_object) CGAL_Kernel_pred(Compare_x_3, - compare_x_3_object) + compare_x_3_object) CGAL_Kernel_pred(Compare_y_at_x_2, - compare_y_at_x_2_object) + compare_y_at_x_2_object) CGAL_Kernel_pred(Compare_y_2, - compare_y_2_object) + compare_y_2_object) CGAL_Kernel_pred(Compare_y_3, - compare_y_3_object) + compare_y_3_object) CGAL_Kernel_pred(Compare_yx_2, - compare_yx_2_object) + compare_yx_2_object) CGAL_Kernel_pred(Compare_z_3, - compare_z_3_object) + compare_z_3_object) CGAL_Kernel_cons(Compute_a_2, - compute_a_2_object) + compute_a_2_object) CGAL_Kernel_cons(Compute_a_3, - compute_a_3_object) + compute_a_3_object) CGAL_Kernel_cons(Compute_b_2, - compute_b_2_object) + compute_b_2_object) CGAL_Kernel_cons(Compute_b_3, - compute_b_3_object) + compute_b_3_object) CGAL_Kernel_cons(Compute_c_2, - compute_c_2_object) + compute_c_2_object) CGAL_Kernel_cons(Compute_c_3, - compute_c_3_object) + compute_c_3_object) CGAL_Kernel_cons(Compute_d_3, - compute_d_3_object) + compute_d_3_object) CGAL_Kernel_cons(Compute_approximate_angle_3, - compute_approximate_angle_3_object) + compute_approximate_angle_3_object) CGAL_Kernel_cons(Compute_approximate_dihedral_angle_3, - compute_approximate_dihedral_angle_3_object) + compute_approximate_dihedral_angle_3_object) CGAL_Kernel_cons(Compute_approximate_area_3, compute_approximate_area_3_object) CGAL_Kernel_cons(Compute_approximate_squared_length_3, compute_approximate_squared_length_3_object) CGAL_Kernel_cons(Compute_area_2, - compute_area_2_object) + compute_area_2_object) CGAL_Kernel_cons(Compute_area_3, - compute_area_3_object) + compute_area_3_object) CGAL_Kernel_cons(Compute_area_divided_by_pi_3, - compute_area_divided_by_pi_3_object) + compute_area_divided_by_pi_3_object) CGAL_Kernel_cons(Compute_determinant_2, - compute_determinant_2_object) + compute_determinant_2_object) CGAL_Kernel_cons(Compute_determinant_3, - compute_determinant_3_object) + compute_determinant_3_object) CGAL_Kernel_cons(Compute_L_infinity_distance_2, - compute_L_infinity_distance_2_object) + compute_L_infinity_distance_2_object) CGAL_Kernel_cons(Compute_L_infinity_distance_3, compute_L_infinity_distance_3_object) CGAL_Kernel_cons(Compute_scalar_product_2, - compute_scalar_product_2_object) + compute_scalar_product_2_object) CGAL_Kernel_cons(Compute_scalar_product_3, - compute_scalar_product_3_object) + compute_scalar_product_3_object) CGAL_Kernel_cons(Compute_squared_area_3, - compute_squared_area_3_object) + compute_squared_area_3_object) CGAL_Kernel_cons(Compute_squared_distance_2, - compute_squared_distance_2_object) + compute_squared_distance_2_object) CGAL_Kernel_cons(Compute_squared_distance_3, - compute_squared_distance_3_object) + compute_squared_distance_3_object) CGAL_Kernel_cons(Compute_squared_length_2, - compute_squared_length_2_object) + compute_squared_length_2_object) CGAL_Kernel_cons(Compute_squared_length_3, - compute_squared_length_3_object) + compute_squared_length_3_object) CGAL_Kernel_cons(Compute_squared_length_divided_by_pi_square_3, compute_squared_length_divided_by_pi_square_3_object) CGAL_Kernel_cons(Compute_squared_radius_2, - compute_squared_radius_2_object) + compute_squared_radius_2_object) CGAL_Kernel_cons(Compute_squared_radius_3, - compute_squared_radius_3_object) + compute_squared_radius_3_object) CGAL_Kernel_cons(Compute_volume_3, - compute_volume_3_object) + compute_volume_3_object) CGAL_Kernel_cons(Compute_x_2, - compute_x_2_object) + compute_x_2_object) CGAL_Kernel_cons(Compute_x_3, - compute_x_3_object) + compute_x_3_object) CGAL_Kernel_cons(Compute_y_2, - compute_y_2_object) + compute_y_2_object) CGAL_Kernel_cons(Compute_y_3, - compute_y_3_object) + compute_y_3_object) CGAL_Kernel_cons(Compute_z_3, - compute_z_3_object) + compute_z_3_object) CGAL_Kernel_cons(Compute_dx_2, - compute_dx_2_object) + compute_dx_2_object) CGAL_Kernel_cons(Compute_dx_3, - compute_dx_3_object) + compute_dx_3_object) CGAL_Kernel_cons(Compute_dy_2, - compute_dy_2_object) + compute_dy_2_object) CGAL_Kernel_cons(Compute_dy_3, - compute_dy_3_object) + compute_dy_3_object) CGAL_Kernel_cons(Compute_dz_3, - compute_dz_3_object) + compute_dz_3_object) CGAL_Kernel_cons(Compute_hx_2, - compute_hx_2_object) + compute_hx_2_object) CGAL_Kernel_cons(Compute_hx_3, - compute_hx_3_object) + compute_hx_3_object) CGAL_Kernel_cons(Compute_hy_2, - compute_hy_2_object) + compute_hy_2_object) CGAL_Kernel_cons(Compute_hy_3, - compute_hy_3_object) + compute_hy_3_object) CGAL_Kernel_cons(Compute_hz_3, - compute_hz_3_object) + compute_hz_3_object) CGAL_Kernel_cons(Compute_hw_2, - compute_hw_2_object) + compute_hw_2_object) CGAL_Kernel_cons(Compute_hw_3, - compute_hw_3_object) + compute_hw_3_object) CGAL_Kernel_cons(Compute_x_at_y_2, - compute_x_at_y_2_object) + compute_x_at_y_2_object) CGAL_Kernel_cons(Compute_y_at_x_2, - compute_y_at_x_2_object) + compute_y_at_x_2_object) CGAL_Kernel_cons(Compute_xmin_2, - compute_xmin_2_object) + compute_xmin_2_object) CGAL_Kernel_cons(Compute_xmax_2, - compute_xmax_2_object) + compute_xmax_2_object) CGAL_Kernel_cons(Compute_ymin_2, - compute_ymin_2_object) + compute_ymin_2_object) CGAL_Kernel_cons(Compute_ymax_2, - compute_ymax_2_object) + compute_ymax_2_object) CGAL_Kernel_cons(Compute_xmin_3, - compute_xmin_3_object) + compute_xmin_3_object) CGAL_Kernel_cons(Compute_xmax_3, - compute_xmax_3_object) + compute_xmax_3_object) CGAL_Kernel_cons(Compute_ymin_3, - compute_ymin_3_object) + compute_ymin_3_object) CGAL_Kernel_cons(Compute_ymax_3, - compute_ymax_3_object) + compute_ymax_3_object) CGAL_Kernel_cons(Compute_zmin_3, - compute_zmin_3_object) + compute_zmin_3_object) CGAL_Kernel_cons(Compute_zmax_3, - compute_zmax_3_object) + compute_zmax_3_object) CGAL_Kernel_cons(Compute_weight_2, compute_weight_2_object) CGAL_Kernel_cons(Compute_weight_3, compute_weight_3_object) CGAL_Kernel_cons(Construct_barycenter_2, - construct_barycenter_2_object) + construct_barycenter_2_object) CGAL_Kernel_cons(Construct_barycenter_3, - construct_barycenter_3_object) + construct_barycenter_3_object) CGAL_Kernel_cons(Construct_base_vector_3, - construct_base_vector_3_object) + construct_base_vector_3_object) CGAL_Kernel_cons(Construct_bisector_2, - construct_bisector_2_object) + construct_bisector_2_object) CGAL_Kernel_cons(Construct_bisector_3, - construct_bisector_3_object) + construct_bisector_3_object) CGAL_Kernel_cons(Construct_center_2, - construct_center_2_object) + construct_center_2_object) CGAL_Kernel_cons(Construct_center_3, - construct_center_3_object) + construct_center_3_object) CGAL_Kernel_cons(Construct_centroid_2, - construct_centroid_2_object) + construct_centroid_2_object) CGAL_Kernel_cons(Construct_centroid_3, - construct_centroid_3_object) + construct_centroid_3_object) CGAL_Kernel_cons(Construct_circle_2, - construct_circle_2_object) + construct_circle_2_object) CGAL_Kernel_cons(Construct_circle_3, - construct_circle_3_object) + construct_circle_3_object) CGAL_Kernel_cons(Construct_circumcenter_2, - construct_circumcenter_2_object) + construct_circumcenter_2_object) CGAL_Kernel_cons(Construct_weighted_circumcenter_2, - construct_weighted_circumcenter_2_object) + construct_weighted_circumcenter_2_object) CGAL_Kernel_cons(Construct_circumcenter_3, - construct_circumcenter_3_object) + construct_circumcenter_3_object) CGAL_Kernel_cons(Construct_weighted_circumcenter_3, - construct_weighted_circumcenter_3_object) + construct_weighted_circumcenter_3_object) CGAL_Kernel_cons(Compute_power_product_2, compute_power_product_2_object) CGAL_Kernel_cons(Compute_power_product_3, @@ -311,29 +311,29 @@ CGAL_Kernel_cons(Compute_squared_radius_smallest_orthogonal_sphere_3, CGAL_Kernel_cons(Compute_power_distance_to_power_sphere_3, compute_power_distance_to_power_sphere_3_object) CGAL_Kernel_cons(Construct_cross_product_vector_3, - construct_cross_product_vector_3_object) + construct_cross_product_vector_3_object) CGAL_Kernel_cons(Construct_direction_2, - construct_direction_2_object) + construct_direction_2_object) CGAL_Kernel_cons(Construct_direction_3, - construct_direction_3_object) + construct_direction_3_object) CGAL_Kernel_cons(Construct_equidistant_line_3, - construct_equidistant_line_3_object) + construct_equidistant_line_3_object) CGAL_Kernel_cons(Construct_iso_cuboid_3, - construct_iso_cuboid_3_object) + construct_iso_cuboid_3_object) CGAL_Kernel_cons(Construct_iso_rectangle_2, - construct_iso_rectangle_2_object) + construct_iso_rectangle_2_object) CGAL_Kernel_cons(Construct_lifted_point_3, - construct_lifted_point_3_object) + construct_lifted_point_3_object) CGAL_Kernel_cons(Construct_line_2, - construct_line_2_object) + construct_line_2_object) CGAL_Kernel_cons(Construct_line_3, - construct_line_3_object) + construct_line_3_object) CGAL_Kernel_cons(Construct_line_line_intersection_point_3, construct_line_line_intersection_point_3_object) CGAL_Kernel_cons(Construct_midpoint_2, - construct_midpoint_2_object) + construct_midpoint_2_object) CGAL_Kernel_cons(Construct_midpoint_3, - construct_midpoint_3_object) + construct_midpoint_3_object) CGAL_Kernel_cons(Construct_min_vertex_2, construct_min_vertex_2_object) CGAL_Kernel_cons(Construct_max_vertex_2, @@ -349,205 +349,205 @@ CGAL_Kernel_cons(Construct_object_2, CGAL_Kernel_cons(Construct_object_3, construct_object_3_object) CGAL_Kernel_cons(Construct_opposite_circle_2, - construct_opposite_circle_2_object) + construct_opposite_circle_2_object) CGAL_Kernel_cons(Construct_opposite_direction_2, - construct_opposite_direction_2_object) + construct_opposite_direction_2_object) CGAL_Kernel_cons(Construct_opposite_direction_3, - construct_opposite_direction_3_object) + construct_opposite_direction_3_object) CGAL_Kernel_cons(Construct_opposite_line_2, - construct_opposite_line_2_object) + construct_opposite_line_2_object) CGAL_Kernel_cons(Construct_opposite_line_3, - construct_opposite_line_3_object) + construct_opposite_line_3_object) CGAL_Kernel_cons(Construct_opposite_plane_3, - construct_opposite_plane_3_object) + construct_opposite_plane_3_object) CGAL_Kernel_cons(Construct_opposite_ray_2, - construct_opposite_ray_2_object) + construct_opposite_ray_2_object) CGAL_Kernel_cons(Construct_opposite_ray_3, - construct_opposite_ray_3_object) + construct_opposite_ray_3_object) CGAL_Kernel_cons(Construct_opposite_segment_2, - construct_opposite_segment_2_object) + construct_opposite_segment_2_object) CGAL_Kernel_cons(Construct_opposite_segment_3, - construct_opposite_segment_3_object) + construct_opposite_segment_3_object) CGAL_Kernel_cons(Construct_opposite_sphere_3, - construct_opposite_sphere_3_object) + construct_opposite_sphere_3_object) CGAL_Kernel_cons(Construct_opposite_triangle_2, - construct_opposite_triangle_2_object) + construct_opposite_triangle_2_object) CGAL_Kernel_cons(Construct_opposite_vector_2, - construct_opposite_vector_2_object) + construct_opposite_vector_2_object) CGAL_Kernel_cons(Construct_difference_of_vectors_2, - construct_difference_of_vectors_2_object) + construct_difference_of_vectors_2_object) CGAL_Kernel_cons(Construct_difference_of_vectors_3, - construct_difference_of_vectors_3_object) + construct_difference_of_vectors_3_object) CGAL_Kernel_cons(Construct_sum_of_vectors_2, - construct_sum_of_vectors_2_object) + construct_sum_of_vectors_2_object) CGAL_Kernel_cons(Construct_sum_of_vectors_3, - construct_sum_of_vectors_3_object) + construct_sum_of_vectors_3_object) CGAL_Kernel_cons(Construct_opposite_vector_3, - construct_opposite_vector_3_object) + construct_opposite_vector_3_object) CGAL_Kernel_cons(Construct_orthogonal_vector_3, - construct_orthogonal_vector_3_object) + construct_orthogonal_vector_3_object) CGAL_Kernel_cons(Construct_perpendicular_direction_2, - construct_perpendicular_direction_2_object) + construct_perpendicular_direction_2_object) CGAL_Kernel_cons(Construct_perpendicular_line_2, - construct_perpendicular_line_2_object) + construct_perpendicular_line_2_object) CGAL_Kernel_cons(Construct_perpendicular_line_3, - construct_perpendicular_line_3_object) + construct_perpendicular_line_3_object) CGAL_Kernel_cons(Construct_perpendicular_plane_3, - construct_perpendicular_plane_3_object) + construct_perpendicular_plane_3_object) CGAL_Kernel_cons(Construct_perpendicular_vector_2, - construct_perpendicular_vector_2_object) + construct_perpendicular_vector_2_object) CGAL_Kernel_cons(Construct_plane_3, - construct_plane_3_object) + construct_plane_3_object) CGAL_Kernel_cons(Construct_plane_line_intersection_point_3, construct_plane_line_intersection_point_3_object) CGAL_Kernel_cons(Construct_point_on_2, - construct_point_on_2_object) + construct_point_on_2_object) CGAL_Kernel_cons(Construct_point_on_3, - construct_point_on_3_object) + construct_point_on_3_object) CGAL_Kernel_cons(Construct_point_2, - construct_point_2_object) + construct_point_2_object) CGAL_Kernel_cons(Construct_radical_axis_2, - construct_radical_axis_2_object) + construct_radical_axis_2_object) CGAL_Kernel_cons(Construct_weighted_point_2, - construct_weighted_point_2_object) + construct_weighted_point_2_object) CGAL_Kernel_cons(Construct_point_3, - construct_point_3_object) + construct_point_3_object) CGAL_Kernel_cons(Construct_weighted_point_3, - construct_weighted_point_3_object) + construct_weighted_point_3_object) CGAL_Kernel_cons(Construct_projected_point_2, - construct_projected_point_2_object) + construct_projected_point_2_object) CGAL_Kernel_cons(Construct_projected_point_3, - construct_projected_point_3_object) + construct_projected_point_3_object) CGAL_Kernel_cons(Construct_projected_xy_point_2, - construct_projected_xy_point_2_object) + construct_projected_xy_point_2_object) CGAL_Kernel_cons(Construct_radical_line_2, - construct_radical_line_2_object) + construct_radical_line_2_object) CGAL_Kernel_cons(Construct_radical_plane_3, construct_radical_plane_3_object) CGAL_Kernel_cons(Construct_ray_2, - construct_ray_2_object) + construct_ray_2_object) CGAL_Kernel_cons(Construct_ray_3, - construct_ray_3_object) + construct_ray_3_object) CGAL_Kernel_cons(Construct_scaled_vector_2, - construct_scaled_vector_2_object) + construct_scaled_vector_2_object) CGAL_Kernel_cons(Construct_divided_vector_2, - construct_divided_vector_2_object) + construct_divided_vector_2_object) CGAL_Kernel_cons(Construct_divided_vector_3, - construct_divided_vector_3_object) + construct_divided_vector_3_object) CGAL_Kernel_cons(Construct_scaled_vector_3, - construct_scaled_vector_3_object) + construct_scaled_vector_3_object) CGAL_Kernel_cons(Construct_second_point_2, - construct_second_point_2_object) + construct_second_point_2_object) CGAL_Kernel_cons(Construct_second_point_3, - construct_second_point_3_object) + construct_second_point_3_object) CGAL_Kernel_cons(Construct_segment_2, - construct_segment_2_object) + construct_segment_2_object) CGAL_Kernel_cons(Construct_segment_3, - construct_segment_3_object) + construct_segment_3_object) CGAL_Kernel_cons(Construct_source_2, - construct_source_2_object) + construct_source_2_object) CGAL_Kernel_cons(Construct_source_3, - construct_source_3_object) + construct_source_3_object) CGAL_Kernel_cons(Construct_sphere_3, - construct_sphere_3_object) + construct_sphere_3_object) CGAL_Kernel_cons(Construct_supporting_plane_3, - construct_supporting_plane_3_object) + construct_supporting_plane_3_object) CGAL_Kernel_cons(Construct_target_2, - construct_target_2_object) + construct_target_2_object) CGAL_Kernel_cons(Construct_target_3, - construct_target_3_object) + construct_target_3_object) CGAL_Kernel_cons(Construct_tetrahedron_3, - construct_tetrahedron_3_object) + construct_tetrahedron_3_object) CGAL_Kernel_cons(Construct_translated_point_2, - construct_translated_point_2_object) + construct_translated_point_2_object) CGAL_Kernel_cons(Construct_translated_point_3, - construct_translated_point_3_object) + construct_translated_point_3_object) CGAL_Kernel_cons(Construct_triangle_2, - construct_triangle_2_object) + construct_triangle_2_object) CGAL_Kernel_cons(Construct_triangle_3, - construct_triangle_3_object) + construct_triangle_3_object) CGAL_Kernel_cons(Construct_unit_normal_3, construct_unit_normal_3_object) CGAL_Kernel_cons(Construct_vector_2, - construct_vector_2_object) + construct_vector_2_object) CGAL_Kernel_cons(Construct_vector_3, - construct_vector_3_object) + construct_vector_3_object) CGAL_Kernel_cons(Construct_vertex_2, - construct_vertex_2_object) + construct_vertex_2_object) CGAL_Kernel_cons(Construct_vertex_3, - construct_vertex_3_object) + construct_vertex_3_object) CGAL_Kernel_cons(Construct_bbox_2, - construct_bbox_2_object) + construct_bbox_2_object) CGAL_Kernel_cons(Construct_bbox_3, - construct_bbox_3_object) + construct_bbox_3_object) CGAL_Kernel_cons(Construct_cartesian_const_iterator_2, - construct_cartesian_const_iterator_2_object) + construct_cartesian_const_iterator_2_object) CGAL_Kernel_cons(Construct_cartesian_const_iterator_3, - construct_cartesian_const_iterator_3_object) + construct_cartesian_const_iterator_3_object) CGAL_Kernel_pred_RT(Coplanar_orientation_3, coplanar_orientation_3_object) CGAL_Kernel_pred_RT(Coplanar_side_of_bounded_circle_3, coplanar_side_of_bounded_circle_3_object) CGAL_Kernel_pred_RT(Coplanar_3, - coplanar_3_object) + coplanar_3_object) CGAL_Kernel_pred(Counterclockwise_in_between_2, - counterclockwise_in_between_2_object) + counterclockwise_in_between_2_object) CGAL_Kernel_pred(Do_intersect_2, - do_intersect_2_object) + do_intersect_2_object) CGAL_Kernel_pred(Do_intersect_3, - do_intersect_3_object) + do_intersect_3_object) CGAL_Kernel_pred(Equal_xy_3, - equal_xy_3_object) + equal_xy_3_object) CGAL_Kernel_pred(Equal_x_2, - equal_x_2_object) + equal_x_2_object) CGAL_Kernel_pred(Equal_x_3, - equal_x_3_object) + equal_x_3_object) CGAL_Kernel_pred(Equal_y_2, - equal_y_2_object) + equal_y_2_object) CGAL_Kernel_pred(Equal_y_3, - equal_y_3_object) + equal_y_3_object) CGAL_Kernel_pred(Equal_z_3, - equal_z_3_object) + equal_z_3_object) CGAL_Kernel_pred(Equal_2, - equal_2_object) + equal_2_object) CGAL_Kernel_pred(Equal_3, - equal_3_object) + equal_3_object) CGAL_Kernel_pred(Has_on_boundary_2, - has_on_boundary_2_object) + has_on_boundary_2_object) CGAL_Kernel_pred(Has_on_boundary_3, - has_on_boundary_3_object) + has_on_boundary_3_object) CGAL_Kernel_pred(Has_on_bounded_side_2, - has_on_bounded_side_2_object) + has_on_bounded_side_2_object) CGAL_Kernel_pred(Has_on_bounded_side_3, - has_on_bounded_side_3_object) + has_on_bounded_side_3_object) CGAL_Kernel_pred(Has_on_negative_side_2, - has_on_negative_side_2_object) + has_on_negative_side_2_object) CGAL_Kernel_pred(Has_on_negative_side_3, - has_on_negative_side_3_object) + has_on_negative_side_3_object) CGAL_Kernel_pred(Has_on_positive_side_2, - has_on_positive_side_2_object) + has_on_positive_side_2_object) CGAL_Kernel_pred(Has_on_positive_side_3, - has_on_positive_side_3_object) + has_on_positive_side_3_object) CGAL_Kernel_pred(Has_on_unbounded_side_2, - has_on_unbounded_side_2_object) + has_on_unbounded_side_2_object) CGAL_Kernel_pred(Has_on_unbounded_side_3, - has_on_unbounded_side_3_object) + has_on_unbounded_side_3_object) CGAL_Kernel_pred(Has_on_2, - has_on_2_object) + has_on_2_object) CGAL_Kernel_pred(Has_on_3, - has_on_3_object) + has_on_3_object) CGAL_Kernel_cons(Intersect_2, - intersect_2_object) + intersect_2_object) CGAL_Kernel_cons(Intersect_3, - intersect_3_object) + intersect_3_object) CGAL_Kernel_pred(Is_degenerate_2, - is_degenerate_2_object) + is_degenerate_2_object) CGAL_Kernel_pred_RT(Is_degenerate_3, is_degenerate_3_object) CGAL_Kernel_pred(Is_horizontal_2, - is_horizontal_2_object) + is_horizontal_2_object) CGAL_Kernel_pred(Is_vertical_2, - is_vertical_2_object) + is_vertical_2_object) CGAL_Kernel_pred(Left_turn_2, left_turn_2_object) CGAL_Kernel_pred(Less_distance_to_point_2, @@ -555,37 +555,37 @@ CGAL_Kernel_pred(Less_distance_to_point_2, CGAL_Kernel_pred(Less_distance_to_point_3, less_distance_to_point_3_object) CGAL_Kernel_pred(Less_rotate_ccw_2, - less_rotate_ccw_2_object) + less_rotate_ccw_2_object) CGAL_Kernel_pred(Less_signed_distance_to_line_2, less_signed_distance_to_line_2_object) CGAL_Kernel_pred(Less_signed_distance_to_plane_3, - less_signed_distance_to_plane_3_object) + less_signed_distance_to_plane_3_object) CGAL_Kernel_pred(Less_xyz_3, - less_xyz_3_object) + less_xyz_3_object) CGAL_Kernel_pred(Less_xy_2, - less_xy_2_object) + less_xy_2_object) CGAL_Kernel_pred(Less_xy_3, - less_xy_3_object) + less_xy_3_object) CGAL_Kernel_pred(Less_x_2, - less_x_2_object) + less_x_2_object) CGAL_Kernel_pred(Less_x_3, - less_x_3_object) + less_x_3_object) CGAL_Kernel_pred(Less_yx_2, - less_yx_2_object) + less_yx_2_object) CGAL_Kernel_pred(Less_y_2, - less_y_2_object) + less_y_2_object) CGAL_Kernel_pred(Less_y_3, - less_y_3_object) + less_y_3_object) CGAL_Kernel_pred(Less_z_3, - less_z_3_object) + less_z_3_object) CGAL_Kernel_pred_RT(Orientation_2, - orientation_2_object) + orientation_2_object) CGAL_Kernel_pred_RT(Orientation_3, - orientation_3_object) + orientation_3_object) CGAL_Kernel_pred(Oriented_side_2, - oriented_side_2_object) + oriented_side_2_object) CGAL_Kernel_pred(Oriented_side_3, - oriented_side_3_object) + oriented_side_3_object) CGAL_Kernel_pred(Power_side_of_bounded_power_circle_2, power_side_of_bounded_power_circle_2_object) CGAL_Kernel_pred(Power_side_of_bounded_power_sphere_3, @@ -595,13 +595,13 @@ CGAL_Kernel_pred_RT(Power_side_of_oriented_power_circle_2, CGAL_Kernel_pred_RT(Power_side_of_oriented_power_sphere_3, power_side_of_oriented_power_sphere_3_object) CGAL_Kernel_pred_RT(Side_of_bounded_circle_2, - side_of_bounded_circle_2_object) + side_of_bounded_circle_2_object) CGAL_Kernel_pred_RT(Side_of_bounded_sphere_3, - side_of_bounded_sphere_3_object) + side_of_bounded_sphere_3_object) CGAL_Kernel_pred_RT(Side_of_oriented_circle_2, - side_of_oriented_circle_2_object) + side_of_oriented_circle_2_object) CGAL_Kernel_pred_RT(Side_of_oriented_sphere_3, - side_of_oriented_sphere_3_object) + side_of_oriented_sphere_3_object) #undef CGAL_Kernel_pred_RT #undef CGAL_Kernel_pred diff --git a/Kernel_23/include/CGAL/Kernel_checker.h b/Kernel_23/include/CGAL/Kernel_checker.h index 483ab5b645d..b16a3d4806c 100644 --- a/Kernel_23/include/CGAL/Kernel_checker.h +++ b/Kernel_23/include/CGAL/Kernel_checker.h @@ -1,16 +1,16 @@ -// Copyright (c) 2001 +// Copyright (c) 2001 // Utrecht University (The Netherlands), // ETH Zurich (Switzerland), // INRIA Sophia-Antipolis (France), // Max-Planck-Institute Saarbruecken (Germany), -// and Tel-Aviv University (Israel). All rights reserved. +// and Tel-Aviv University (Israel). All rights reserved. // // This file is part of CGAL (www.cgal.org) // // $URL$ // $Id$ // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Sylvain Pion // Mael Rouxel-Labbé diff --git a/Kernel_23/include/CGAL/Vector_2.h b/Kernel_23/include/CGAL/Vector_2.h index 67f07e5e3e6..fed404db54b 100644 --- a/Kernel_23/include/CGAL/Vector_2.h +++ b/Kernel_23/include/CGAL/Vector_2.h @@ -1,9 +1,9 @@ -// Copyright (c) 1999 +// Copyright (c) 1999 // Utrecht University (The Netherlands), // ETH Zurich (Switzerland), // INRIA Sophia-Antipolis (France), // Max-Planck-Institute Saarbruecken (Germany), -// and Tel-Aviv University (Israel). All rights reserved. +// and Tel-Aviv University (Israel). All rights reserved. // // This file is part of CGAL (www.cgal.org) // diff --git a/Kernel_23/include/CGAL/Vector_3.h b/Kernel_23/include/CGAL/Vector_3.h index 077da5d649d..9304ca4701b 100644 --- a/Kernel_23/include/CGAL/Vector_3.h +++ b/Kernel_23/include/CGAL/Vector_3.h @@ -1,16 +1,16 @@ -// Copyright (c) 1999 +// Copyright (c) 1999 // Utrecht University (The Netherlands), // ETH Zurich (Switzerland), // INRIA Sophia-Antipolis (France), // Max-Planck-Institute Saarbruecken (Germany), -// and Tel-Aviv University (Israel). All rights reserved. +// and Tel-Aviv University (Israel). All rights reserved. // // This file is part of CGAL (www.cgal.org) // // $URL$ // $Id$ // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Andreas Fabri, Stefan Schirra @@ -266,7 +266,7 @@ public: template std::ostream& -insert(std::ostream& os, const Vector_3& v, const Cartesian_tag&) +insert(std::ostream& os, const Vector_3& v, const Cartesian_tag&) { switch(get_mode(os)) { case IO::ASCII : @@ -314,7 +314,7 @@ operator<<(std::ostream& os, const Vector_3& v) template std::istream& -extract(std::istream& is, Vector_3& v, const Cartesian_tag&) +extract(std::istream& is, Vector_3& v, const Cartesian_tag&) { typename R::FT x(0), y(0), z(0); switch(get_mode(is)) { @@ -339,7 +339,7 @@ extract(std::istream& is, Vector_3& v, const Cartesian_tag&) template std::istream& -extract(std::istream& is, Vector_3& v, const Homogeneous_tag&) +extract(std::istream& is, Vector_3& v, const Homogeneous_tag&) { typename R::RT hx, hy, hz, hw; switch(get_mode(is)) diff --git a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_ray_3.h b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_ray_3.h index 22e200263fb..4fba797170d 100644 --- a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_ray_3.h +++ b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_ray_3.h @@ -1,19 +1,19 @@ -// Copyright (c) 1999 +// Copyright (c) 1999 // Utrecht University (The Netherlands), // ETH Zurich (Switzerland), // INRIA Sophia-Antipolis (France), // Max-Planck-Institute Saarbruecken (Germany), -// and Tel-Aviv University (Israel). All rights reserved. +// and Tel-Aviv University (Israel). All rights reserved. // // This file is part of CGAL (www.cgal.org) // // $URL$ // $Id$ // SPDX-License-Identifier: LGPL-3.0-or-later -// +// // // Author(s) : Stefan Schirra - + #ifndef CGAL__TEST_CLS_RAY_3_H #define CGAL__TEST_CLS_RAY_3_H diff --git a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_segment_3.h b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_segment_3.h index a020f307028..3a35447a500 100644 --- a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_segment_3.h +++ b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_segment_3.h @@ -1,19 +1,19 @@ -// Copyright (c) 1999 +// Copyright (c) 1999 // Utrecht University (The Netherlands), // ETH Zurich (Switzerland), // INRIA Sophia-Antipolis (France), // Max-Planck-Institute Saarbruecken (Germany), -// and Tel-Aviv University (Israel). All rights reserved. +// and Tel-Aviv University (Israel). All rights reserved. // // This file is part of CGAL (www.cgal.org) // // $URL$ // $Id$ // SPDX-License-Identifier: LGPL-3.0-or-later -// +// // // Author(s) : Stefan Schirra - + #ifndef CGAL__TEST_CLS_SEGMENT_3_H #define CGAL__TEST_CLS_SEGMENT_3_H diff --git a/Kernel_d/include/CGAL/Kernel_d/function_objects.h b/Kernel_d/include/CGAL/Kernel_d/function_objects.h index 25d8c84628f..221c3c7bbdb 100644 --- a/Kernel_d/include/CGAL/Kernel_d/function_objects.h +++ b/Kernel_d/include/CGAL/Kernel_d/function_objects.h @@ -1,16 +1,16 @@ -// Copyright (c) 1999 +// Copyright (c) 1999 // Utrecht University (The Netherlands), // ETH Zurich (Switzerland), // INRIA Sophia-Antipolis (France), // Max-Planck-Institute Saarbruecken (Germany), -// and Tel-Aviv University (Israel). All rights reserved. +// and Tel-Aviv University (Israel). All rights reserved. // // This file is part of CGAL (www.cgal.org) // // $URL$ // $Id$ // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Stefan Schirra @@ -71,29 +71,29 @@ private: typedef typename R::Hyperplane_d Hyperplane_d; public: - template + template struct result; template - struct result + struct result { typedef boost::optional< boost::variant< Point_d, Line_d > > type; }; template struct result { typedef boost::optional< boost::variant< Point_d, Segment_d > > type; }; - template + template struct result : result { }; template - struct result + struct result { typedef boost::optional< boost::variant< Point_d, Segment_d > > type; }; template struct result { typedef boost::optional< boost::variant< Point_d, Ray_d > > type; }; - template + template struct result : result { }; @@ -106,25 +106,25 @@ public: { }; template - struct result + struct result { typedef boost::optional< boost::variant< Point_d, Segment_d, Ray_d > > type; }; template - struct result + struct result { typedef boost::optional< boost::variant< Point_d, Line_d > > type; }; template struct result : result { }; template - struct result + struct result { typedef boost::optional< boost::variant< Point_d, Ray_d > > type; }; template - struct result : result + struct result : result { }; template - struct result + struct result { typedef boost::optional< boost::variant< Point_d, Segment_d > > type; }; template struct result : result diff --git a/Linear_cell_complex/examples/Linear_cell_complex/CMakeLists.txt b/Linear_cell_complex/examples/Linear_cell_complex/CMakeLists.txt index d9edd8915d6..12f9e6ab63c 100644 --- a/Linear_cell_complex/examples/Linear_cell_complex/CMakeLists.txt +++ b/Linear_cell_complex/examples/Linear_cell_complex/CMakeLists.txt @@ -31,7 +31,7 @@ if (CGAL_FOUND) create_single_source_cgal_program("gmap_linear_cell_complex_3.cpp") create_single_source_cgal_program("linear_cell_complex_3.cpp") create_single_source_cgal_program("linear_cell_complex_3_attributes_management.cpp") - create_single_source_cgal_program("linear_cell_complex_3_operations.cpp") + create_single_source_cgal_program("linear_cell_complex_3_operations.cpp") create_single_source_cgal_program("linear_cell_complex_3_with_colored_vertices.cpp") create_single_source_cgal_program("linear_cell_complex_3_with_mypoint.cpp") create_single_source_cgal_program("linear_cell_complex_4.cpp") diff --git a/Linear_cell_complex/examples/Linear_cell_complex/basic_viewer.h b/Linear_cell_complex/examples/Linear_cell_complex/basic_viewer.h index 1abc71c12cc..db5a49f847f 100644 --- a/Linear_cell_complex/examples/Linear_cell_complex/basic_viewer.h +++ b/Linear_cell_complex/examples/Linear_cell_complex/basic_viewer.h @@ -46,10 +46,10 @@ const char vertex_source_mono[] = "#version 120 \n" "attribute highp vec4 vertex;\n" "attribute highp vec3 normal;\n" - + "uniform highp mat4 mvp_matrix;\n" "uniform highp mat4 mv_matrix; \n" - + "varying highp vec4 fP; \n" "varying highp vec3 fN; \n" "void main(void)\n" @@ -66,10 +66,10 @@ const char vertex_source_color[] = "attribute highp vec4 vertex;\n" "attribute highp vec3 normal;\n" "attribute highp vec3 color;\n" - + "uniform highp mat4 mvp_matrix;\n" "uniform highp mat4 mv_matrix; \n" - + "varying highp vec4 fP; \n" "varying highp vec3 fN; \n" "varying highp vec4 fColor; \n" @@ -94,20 +94,20 @@ const char fragment_source_mono[] = "uniform highp vec4 light_spec; \n" "uniform highp vec4 light_amb; \n" "uniform float spec_power ; \n" - + "void main(void) { \n" - + " highp vec3 L = light_pos.xyz - fP.xyz; \n" " highp vec3 V = -fP.xyz; \n" - + " highp vec3 N = normalize(fN); \n" " L = normalize(L); \n" " V = normalize(V); \n" - + " highp vec3 R = reflect(-L, N); \n" " highp vec4 diffuse = max(dot(N,L), 0.0) * light_diff * color; \n" " highp vec4 specular = pow(max(dot(R,V), 0.0), spec_power) * light_spec; \n" - + "gl_FragColor = light_amb*color + diffuse ; \n" "} \n" "\n" @@ -124,20 +124,20 @@ const char fragment_source_color[] = "uniform highp vec4 light_spec; \n" "uniform highp vec4 light_amb; \n" "uniform float spec_power ; \n" - + "void main(void) { \n" - + " highp vec3 L = light_pos.xyz - fP.xyz; \n" " highp vec3 V = -fP.xyz; \n" - + " highp vec3 N = normalize(fN); \n" " L = normalize(L); \n" " V = normalize(V); \n" - + " highp vec3 R = reflect(-L, N); \n" " highp vec4 diffuse = max(dot(N,L), 0.0) * light_diff * fColor; \n" " highp vec4 specular = pow(max(dot(R,V), 0.0), spec_power) * light_spec; \n" - + "gl_FragColor = light_amb*fColor + diffuse ; \n" "} \n" "\n" @@ -231,7 +231,7 @@ public: m_inverse_normal(false), m_empty(true), m_size_points(7.), - m_size_edges(3.1), + m_size_edges(3.1), m_vertices_mono_color(51, 51, 178), m_edges_mono_color(51, 51, 148), m_faces_mono_color(180, 125, 200), @@ -265,12 +265,12 @@ public: void clear() { for (unsigned int i=0; i& point_vector) { point_vector.push_back(p.x()); @@ -296,7 +296,7 @@ public: normal_vector.push_back(n.y()); normal_vector.push_back(n.z()); } - + void add_mono_point(const Local_point& p) { add_point(p, arrays[POS_MONO_POINTS]); } @@ -305,13 +305,13 @@ public: add_point(p, arrays[POS_COLORED_POINTS]); add_color(acolor, arrays[COLOR_POINTS]); } - + void add_mono_segment(const Local_point& p1, const Local_point& p2) { add_point(p1, arrays[POS_MONO_SEGMENTS]); add_point(p2, arrays[POS_MONO_SEGMENTS]); } - + void add_colored_segment(const Local_point& p1, const Local_point& p2, const CGAL::Color& acolor) { @@ -327,7 +327,7 @@ public: std::cerr<<"You cannot start a new face before to finish the previous one."<(points_of_face); if (points_of_face.size()==3) // Triangle: no need to triangulate @@ -457,7 +457,7 @@ public: cdt.insert_constraint(previous, first); // (2) We mark all external triangles - // (2.1) We initialize is_external and is_process values + // (2.1) We initialize is_external and is_process values for(typename CDT::All_faces_iterator fit = cdt.all_faces_begin(), fitend = cdt.all_faces_end(); fit!=fitend; ++fit) { @@ -493,7 +493,7 @@ public: if ( face_internal!=NULL ) face_queue.push(face_internal); - + while(! face_queue.empty() ) { typename CDT::Face_handle fh = face_queue.front(); @@ -530,7 +530,7 @@ public: // Its color if (m_started_face_is_colored) { add_color(color_of_face, arrays[COLOR_FACES]); } - + // Its flat normal add_normal(normal, arrays[m_started_face_is_colored? FLAT_NORMAL_COLORED_FACES: @@ -554,29 +554,29 @@ public: points_of_face.clear(); vertex_normals_for_face.clear(); } - + protected: - + void compile_shaders() { rendering_program_mono.removeAllShaders(); rendering_program_color.removeAllShaders(); /*rendering_program_p_l_mono.removeAllShaders(); rendering_program_p_l_color.removeAllShaders(); */ - + // Create the buffers for (int i=0; icompileSourceCode(vertex_source_mono)) @@ -588,7 +588,7 @@ protected: if(!rendering_program_mono.addShader(vertex_shader_mono)) { std::cerr<<"adding vertex shader FAILED"<modifiers(); @@ -975,7 +975,7 @@ protected: { m_inverse_normal=!m_inverse_normal; negate_all_normals(); - compile_shaders(); + compile_shaders(); initialize_buffers(); displayMessage(QString("Inverse normal=%1.").arg(m_inverse_normal?"true":"false")); updateGL(); @@ -1126,7 +1126,7 @@ private: bool m_use_mono_color; bool m_inverse_normal; bool m_empty; - + double m_size_points; double m_size_edges; @@ -1137,7 +1137,7 @@ private: bool m_are_buffers_initialized; CGAL::Bbox_3 bb; - + //Shaders elements int vertexLocation[NB_VAO_BUFFERS]; int normalsLocation; @@ -1147,7 +1147,7 @@ private: int colorLocation2; int lightLocation[5]; - enum + enum { POS_MONO_POINTS=0, POS_COLORED_POINTS, POS_MONO_SEGMENTS, diff --git a/Linear_cell_complex/include/CGAL/CMap_linear_cell_complex_storages.h b/Linear_cell_complex/include/CGAL/CMap_linear_cell_complex_storages.h index ef414af8759..d9e14b49652 100644 --- a/Linear_cell_complex/include/CGAL/CMap_linear_cell_complex_storages.h +++ b/Linear_cell_complex/include/CGAL/CMap_linear_cell_complex_storages.h @@ -85,7 +85,7 @@ namespace CGAL { struct Container_for_attributes : public Compact_container::template rebind_alloc > {}; - + /// Typedef for attributes typedef typename internal::template Get_attributes_tuple::type Attributes; @@ -251,7 +251,7 @@ namespace CGAL { CGAL_assertion( ah!=nullptr ); return ah->is_valid(); } - + // accessors and modifiers to the attribute ref counting given its handle template std::size_t get_attribute_ref_counting diff --git a/Linear_cell_complex/include/CGAL/GMap_linear_cell_complex_storages.h b/Linear_cell_complex/include/CGAL/GMap_linear_cell_complex_storages.h index 7a75e7824b9..6c91c0af856 100644 --- a/Linear_cell_complex/include/CGAL/GMap_linear_cell_complex_storages.h +++ b/Linear_cell_complex/include/CGAL/GMap_linear_cell_complex_storages.h @@ -243,7 +243,7 @@ namespace CGAL { CGAL_assertion( ah!=nullptr ); return ah->is_valid(); } - + // accessors and modifiers to the attribute ref counting given its handle template std::size_t get_attribute_ref_counting diff --git a/Linear_cell_complex/include/CGAL/Linear_cell_complex_base.h b/Linear_cell_complex/include/CGAL/Linear_cell_complex_base.h index 1507e27c253..f517f768eba 100644 --- a/Linear_cell_complex/include/CGAL/Linear_cell_complex_base.h +++ b/Linear_cell_complex/include/CGAL/Linear_cell_complex_base.h @@ -113,7 +113,7 @@ namespace CGAL { using Base::point_of_vertex_attribute; using Base::other_extremity; using Base::darts; - + using Base::are_attributes_automatically_managed; using Base::mark; using Base::is_marked; @@ -125,7 +125,7 @@ namespace CGAL { using Base::opposite; using Base::is_next_exist; using Base::is_previous_exist; - + using Base::make_segment; using Base::make_triangle; using Base::make_quadrangle; diff --git a/Linear_cell_complex/include/CGAL/Linear_cell_complex_for_combinatorial_map.h b/Linear_cell_complex/include/CGAL/Linear_cell_complex_for_combinatorial_map.h index 48519960458..5d7d85b8c85 100644 --- a/Linear_cell_complex/include/CGAL/Linear_cell_complex_for_combinatorial_map.h +++ b/Linear_cell_complex/include/CGAL/Linear_cell_complex_for_combinatorial_map.h @@ -111,7 +111,7 @@ namespace CGAL { Linear_cell_complex_for_combinatorial_map (const Linear_cell_complex_for_combinatorial_map& alcc) : Base(alcc) - {} + {} template void import_from_halfedge_graph(const HEG& heg , diff --git a/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h b/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h index a23567726dd..93806563219 100644 --- a/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h +++ b/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h @@ -21,7 +21,7 @@ namespace CGAL { - + // Default color functor; user can change it to have its own face color struct DefaultDrawingFunctorLCC { @@ -146,7 +146,7 @@ struct LCC_geom_utils } }; -// Viewer class for LCC +// Viewer class for LCC template class SimpleLCCViewerQt : public Basic_viewer_qt { @@ -155,7 +155,7 @@ class SimpleLCCViewerQt : public Basic_viewer_qt typedef typename LCC::Traits Kernel; typedef typename Kernel::Point Point; typedef typename Kernel::Vector Vector; - + public: /// Construct the viewer. /// @param alcc the lcc to view @@ -168,7 +168,7 @@ public: bool anofaces=false, const DrawingFunctorLCC& drawing_functor=DrawingFunctorLCC()) : // First draw: vertices; edges, faces; multi-color; inverse normal - Base(parent, title, true, true, true, false, false), + Base(parent, title, true, true, true, false, false), lcc(alcc), m_nofaces(anofaces), m_random_face_color(false), @@ -184,7 +184,7 @@ protected: compute_elements(); if (doredraw) { redraw(); } } - + void compute_face(Dart_const_handle dh, Dart_const_handle voldh) { if (m_nofaces || !m_drawing_functor.draw_face(*lcc, dh)) return; @@ -204,7 +204,7 @@ protected: { CGAL::Random random((unsigned int)(lcc->darts().index(dh))); CGAL::Color c=get_random_color(random); - face_begin(c); + face_begin(c); } else if (m_drawing_functor.colored_face(*lcc, dh)) { @@ -260,7 +260,7 @@ protected: { clear(); if (lcc==nullptr) return; - + typename LCC::size_type markvolumes = lcc->get_new_mark(); typename LCC::size_type markfaces = lcc->get_new_mark(); typename LCC::size_type markedges = lcc->get_new_mark(); @@ -331,13 +331,13 @@ protected: lcc->free_mark(markedges); lcc->free_mark(markvertices); } - + virtual void init() { Base::init(); setKeyDescription(::Qt::Key_C, "Toggles random face colors"); } - + virtual void keyPressEvent(QKeyEvent *e) { const ::Qt::KeyboardModifiers modifiers = e->modifiers(); @@ -350,7 +350,7 @@ protected: } else { Base::keyPressEvent(e); } // Call the base method to process others/classicals key - + // Call: * compute_elements() if the model changed, followed by // * redraw() if some viewing parameters changed that implies some // modifications of the buffers @@ -386,7 +386,7 @@ void draw(const CGAL_LCC_TYPE& alcc, #else bool cgal_test_suite=qEnvironmentVariableIsSet("CGAL_TEST_SUITE"); #endif - + if (!cgal_test_suite) { int argc=1; diff --git a/Mesh_2/include/CGAL/Delaunay_mesh_size_criteria_2.h b/Mesh_2/include/CGAL/Delaunay_mesh_size_criteria_2.h index 62de1a1e3de..eb3bb083b00 100644 --- a/Mesh_2/include/CGAL/Delaunay_mesh_size_criteria_2.h +++ b/Mesh_2/include/CGAL/Delaunay_mesh_size_criteria_2.h @@ -6,7 +6,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Laurent RINEAU @@ -25,7 +25,7 @@ namespace CGAL { template -class Delaunay_mesh_size_criteria_2 : +class Delaunay_mesh_size_criteria_2 : public virtual Delaunay_mesh_criteria_2 { protected: @@ -35,7 +35,7 @@ protected: public: typedef Delaunay_mesh_criteria_2 Base; - Delaunay_mesh_size_criteria_2(const double aspect_bound = 0.125, + Delaunay_mesh_size_criteria_2(const double aspect_bound = 0.125, const double size_bound = 0, const Geom_traits& traits = Geom_traits()) : Base(aspect_bound, traits), sizebound(size_bound) {} @@ -63,20 +63,20 @@ public: bool operator<(const Quality& q) const { if( size() > 1 ) - if( q.size() > 1 ) - return ( size() > q.size() ); - else - return true; // *this is big but not q + if( q.size() > 1 ) + return ( size() > q.size() ); + else + return true; // *this is big but not q else - if( q.size() > 1 ) - return false; // q is big but not *this + if( q.size() > 1 ) + return false; // q is big but not *this return( sine() < q.sine() ); } std::ostream& operator<<(std::ostream& out) const { return out << "(size=" << size() - << ", sine=" << sine() << ")"; + << ", sine=" << sine() << ")"; } }; @@ -88,7 +88,7 @@ public: typedef typename Base::Is_bad::Point_2 Point_2; Is_bad(const double aspect_bound, - const double size_bound, + const double size_bound, const Geom_traits& traits) : Base::Is_bad(aspect_bound, traits), squared_size_bound(size_bound * size_bound) {} @@ -96,88 +96,88 @@ public: Mesh_2::Face_badness operator()(const Quality q) const { if( q.size() > 1 ) - return Mesh_2::IMPERATIVELY_BAD; + return Mesh_2::IMPERATIVELY_BAD; if( q.sine() < this->B ) - return Mesh_2::BAD; + return Mesh_2::BAD; else - return Mesh_2::NOT_BAD; + return Mesh_2::NOT_BAD; } Mesh_2::Face_badness operator()(const typename CDT::Face_handle& fh, - Quality& q) const + Quality& q) const { typedef typename CDT::Geom_traits Geom_traits; typedef typename Geom_traits::Compute_area_2 Compute_area_2; typedef typename Geom_traits::Compute_squared_distance_2 - Compute_squared_distance_2; + Compute_squared_distance_2; - Compute_squared_distance_2 squared_distance = - this->traits.compute_squared_distance_2_object(); + Compute_squared_distance_2 squared_distance = + this->traits.compute_squared_distance_2_object(); const Point_2& pa = fh->vertex(0)->point(); const Point_2& pb = fh->vertex(1)->point(); const Point_2& pc = fh->vertex(2)->point(); double - a = CGAL::to_double(squared_distance(pb, pc)), - b = CGAL::to_double(squared_distance(pc, pa)), - c = CGAL::to_double(squared_distance(pa, pb)); - + a = CGAL::to_double(squared_distance(pb, pc)), + b = CGAL::to_double(squared_distance(pc, pa)), + c = CGAL::to_double(squared_distance(pa, pb)); + double max_sq_length; // squared max edge length double second_max_sq_length; - + if(a 1 ) - { - q.first = 1; // (do not compute sine) - return Mesh_2::IMPERATIVELY_BAD; - } - } + { + // std::cerr << squared_size_bound << std::endl; + q.second = max_sq_length / squared_size_bound; + // normalized by size bound to deal + // with size field + if( q.size() > 1 ) + { + q.first = 1; // (do not compute sine) + return Mesh_2::IMPERATIVELY_BAD; + } + } Compute_area_2 area_2 = this->traits.compute_area_2_object(); double area = 2*CGAL::to_double(area_2(pa, pb, pc)); q.first = (area * area) / (max_sq_length * second_max_sq_length); // (sine) - + if( q.sine() < this->B ) - return Mesh_2::BAD; + return Mesh_2::BAD; else - return Mesh_2::NOT_BAD; + return Mesh_2::NOT_BAD; } }; Is_bad is_bad_object() const - { return Is_bad(this->bound(), size_bound(), + { return Is_bad(this->bound(), size_bound(), this->traits /* from the bad class */); } }; diff --git a/Mesh_2/include/CGAL/Mesh_2/Clusters.h b/Mesh_2/include/CGAL/Mesh_2/Clusters.h index c1529bd96b8..7ac17276f29 100644 --- a/Mesh_2/include/CGAL/Mesh_2/Clusters.h +++ b/Mesh_2/include/CGAL/Mesh_2/Clusters.h @@ -7,7 +7,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Laurent Rineau @@ -25,10 +25,10 @@ namespace CGAL { -namespace Mesh_2 +namespace Mesh_2 { - namespace details + namespace details { template class Is_edge_constrained { @@ -36,7 +36,7 @@ namespace Mesh_2 public: typedef Is_edge_constrained Self; typedef typename Tr::Edge_circulator Edge_circulator; - + Is_edge_constrained(const Tr& tr) : tr_(&tr) {} @@ -57,7 +57,7 @@ class Clusters typedef FT Squared_length; /** \c Cluster - * Each vertex can have several clusters. + * Each vertex can have several clusters. */ Cluster_map cluster_map; @@ -184,7 +184,7 @@ private: void create_clusters_of_vertex(const Vertex_handle v); /** - * Adds the sequence [\c begin, \c end] to the cluster \c c and adds it + * Adds the sequence [\c begin, \c end] to the cluster \c c and adds it * to the clusters of the vertex \c v. */ void construct_cluster(const Vertex_handle v, @@ -195,9 +195,9 @@ private: public: /** \name Functions to manage clusters during the refinement process. */ - /** + /** * Update the cluster of [\c va,\c vb], putting \c vm instead of \c vb. - * If reduction=false, the edge [va,vm] is not set reduced. + * If reduction=false, the edge [va,vm] is not set reduced. */ void update_cluster(Cluster& c, iterator it, const Vertex_handle va, const Vertex_handle vb, @@ -276,7 +276,7 @@ public: return Cluster_vertices_iterator(cluster_map.end()); } - unsigned int number_of_clusters_at_vertex(const Vertex_handle& vh) const + unsigned int number_of_clusters_at_vertex(const Vertex_handle& vh) const { typedef typename Cluster_map::const_iterator Iterator; typedef std::pair Range; @@ -381,7 +381,7 @@ get_cluster(Vertex_handle va, Vertex_handle vb, Cluster& c, template bool Clusters:: get_cluster(Vertex_handle va, Vertex_handle vb, Cluster& c, - iterator& it) + iterator& it) { typedef std::pair Range; @@ -535,7 +535,7 @@ is_small_angle(const Point& pleft, const Point& pmiddle, const Point& pright) const { - typename Geom_traits::Angle_2 angle = + typename Geom_traits::Angle_2 angle = tr.geom_traits().angle_2_object(); typename Geom_traits::Orientation_2 orient = tr.geom_traits().orientation_2_object(); @@ -576,7 +576,7 @@ squared_cosine_of_angle_times_4(const Point& pb, const Point& pa, return (num*num)/(b*c); } - + } // end namespace Mesh_2 } // end namespace CGAL diff --git a/Mesh_2/include/CGAL/Mesh_2/Refine_edges.h b/Mesh_2/include/CGAL/Mesh_2/Refine_edges.h index 3420990ed3c..f66e077ae28 100644 --- a/Mesh_2/include/CGAL/Mesh_2/Refine_edges.h +++ b/Mesh_2/include/CGAL/Mesh_2/Refine_edges.h @@ -6,7 +6,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Laurent RINEAU @@ -32,7 +32,7 @@ namespace CGAL { /** * \namespace Mesh_2 * Defines classes that are not yet documented. - * + * * \namespace Mesh_2::details * Namespace for internal use. */ @@ -109,10 +109,10 @@ namespace Mesh_2 { const Vertex_handle& vi = fh->vertex(i); const Vertex_handle& mvi = tr.tds().mirror_vertex(fh, i); - return( ( tr.is_infinite(vi) || + return( ( tr.is_infinite(vi) || this->operator()(tr, va, vb, vi->point()) ) && - ( tr.is_infinite(mvi) || + ( tr.is_infinite(mvi) || this->operator()(tr, va, vb, mvi->point()) ) ); } @@ -127,7 +127,7 @@ namespace Mesh_2 { CGAL_assume_code( bool should_be_true = ) tr.is_edge(va, vb, fh, i); CGAL_assume( should_be_true == true ); - + return this->operator()(tr, fh, i); } @@ -220,15 +220,15 @@ namespace Mesh_2 { private: /** Private function that computes the two vertex vi and mvi that are - one each side of the edge (fh, i) (vi is in fh and mvi is in - fh->neighbor(i)) and return true if one of them is infinite. + one each side of the edge (fh, i) (vi is in fh and mvi is in + fh->neighbor(i)) and return true if one of them is infinite. */ bool aux_get_vi_mvi(const Tr& tr, - const Face_handle& fh, - const int i, - Vertex_handle& vi, - Vertex_handle& mvi) const + const Face_handle& fh, + const int i, + Vertex_handle& vi, + Vertex_handle& mvi) const { vi = fh->vertex(i); mvi = tr.tds().mirror_vertex(fh, i); @@ -237,21 +237,21 @@ namespace Mesh_2 { } /** Private function that returns true if the vertex vs is outside the - oriented circle passing through vp, vq and vr. + oriented circle passing through vp, vq and vr. */ bool aux_outside_of_circle(const Tr& tr, - const Vertex_handle& vp, - const Vertex_handle& vq, - const Vertex_handle& vr, - const Vertex_handle& vs) const + const Vertex_handle& vp, + const Vertex_handle& vq, + const Vertex_handle& vr, + const Vertex_handle& vs) const { typedef typename Geom_traits::Side_of_oriented_circle_2 Side_of_oriented_circle_2; Side_of_oriented_circle_2 in_circle = tr.geom_traits().side_of_oriented_circle_2_object(); - + const Point& p = vp->point(); const Point& q = vq->point(); const Point& r = vr->point(); @@ -274,7 +274,7 @@ namespace Mesh_2 { template < class Tr, class Is_locally_conform = Is_locally_conforming_Gabriel, - class Container = + class Container = typename details::Refine_edges_base_types::Default_container > class Refine_edges_base : @@ -285,7 +285,7 @@ class Refine_edges_base : public: typedef typename Tr::Finite_edges_iterator Finite_edges_iterator; typedef typename Tr::Face_circulator Face_circulator; - + typedef typename Tr::Vertex_handle Vertex_handle; typedef typename Tr::Face_handle Face_handle; typedef typename Tr::Edge Edge; @@ -332,7 +332,7 @@ protected: for(Finite_edges_iterator ei = tr.finite_edges_begin(); ei != tr.finite_edges_end(); - ++ei) + ++ei) { if(ei->first->is_constrained(ei->second) && !is_locally_conform(tr, ei->first, ei->second) ) @@ -347,7 +347,7 @@ protected: // with constraint hierarchy for(typename Tr::Subconstraint_iterator it = tr.subconstraints_begin(); - it != tr.subconstraints_end(); ++it) + it != tr.subconstraints_end(); ++it) { const Vertex_handle& v1 = it->first.first; const Vertex_handle& v2 = it->first.second; @@ -432,7 +432,7 @@ public: const bool n_does_conflict = (zone.locate_type == Tr::EDGE) || triangulation_ref_impl().test_conflict(p, n); - CGAL_assertion(f_does_conflict || + CGAL_assertion(f_does_conflict || n_does_conflict); const int ni = triangulation_ref_impl().tds().mirror_index(f, i); @@ -447,7 +447,7 @@ public: *edges_out++ = std::make_pair(n, ni); } - std::pair pit = + std::pair pit = std::make_pair(faces_out,edges_out); if(f_does_conflict) { @@ -459,17 +459,17 @@ public: pit = triangulation_ref_impl().propagate_conflicts(p,n,Tr::ccw(ni),pit); pit = triangulation_ref_impl().propagate_conflicts(p,n,Tr:: cw(ni),pit); } - return zone; + return zone; } Vertex_handle insert_impl(const Point& p, Zone& zone) { return triangulation_ref_impl().star_hole(p, - zone.boundary_edges.begin(), - zone.boundary_edges.end(), - zone.faces.begin(), - zone.faces.end() - ); + zone.boundary_edges.begin(), + zone.boundary_edges.end(), + zone.faces.begin(), + zone.faces.end() + ); } /** Scans all constrained edges and put them in the queue if they are @@ -496,7 +496,7 @@ public: Saves the handles of the edge that will be split. This function is overridden in class Refine_edge_with_clusters. */ - Point refinement_point_impl(const Edge& edge) + Point refinement_point_impl(const Edge& edge) { typename Geom_traits::Construct_midpoint_2 midpoint = tr.geom_traits().construct_midpoint_2_object(); @@ -518,20 +518,20 @@ public: */ Mesher_level_conflict_status test_point_conflict_from_superior_impl(const Point& p, - Zone& zone) + Zone& zone) { Mesher_level_conflict_status status = NO_CONFLICT; - + for(typename Zone::Edges_iterator eit = zone.boundary_edges.begin(); eit != zone.boundary_edges.end(); ++eit) - { + { const Face_handle& fh = eit->first; const int& i = eit->second; if(fh->is_constrained(i) && !is_locally_conform(tr, fh, i, p)) { add_constrained_edge_to_be_conformed(*eit); - status = CONFLICT_BUT_ELEMENT_CAN_BE_RECONSIDERED; + status = CONFLICT_BUT_ELEMENT_CAN_BE_RECONSIDERED; } } @@ -540,7 +540,7 @@ public: /** Unmark as constrained. */ void before_insertion_impl(const Edge& e, const Point&, - const Zone&) + const Zone&) { const Face_handle& f = e.first; const int& i = e.second; @@ -553,7 +553,7 @@ public: * Scans the edges of the star boundary, to test if they are both * locally conforming. If not, push them in the list of edges to be * conformed. - * + * */ void after_insertion_impl(const Vertex_handle& v) { @@ -576,7 +576,7 @@ public: } while( fc != fcbegin ); Face_handle fh; - int index = 0; // Avoids a warning. + int index = 0; // Avoids a warning. // We know that is_edge must return true, and is_edge will assign something to index // but the compiler does not so it will issue a maybe uninitialized warning @@ -599,7 +599,7 @@ public: if(!is_locally_conform(tr, va, v)) add_constrained_edge_to_be_conformed(va, v); - + if(!is_locally_conform(tr, vb, v)) add_constrained_edge_to_be_conformed(vb, v); } // end after_insertion_impl @@ -625,7 +625,7 @@ protected: } private: /** \name DEBUGGING TYPES AND DATAS */ - class From_pair_of_vertex_to_edge + class From_pair_of_vertex_to_edge : public CGAL::cpp98::unary_function { Tr& tr; @@ -683,31 +683,31 @@ public: /** \name DEBUGGING FUNCTIONS */ typedef Triangulation_mesher_level_traits_2 Triangulation_traits; typedef Mesher_level < - Tr, + Tr, Self, typename Tr::Edge, Null_mesher_level, - Triangulation_traits> Edges_mesher_level; + Triangulation_traits> Edges_mesher_level; }; // end Refine_edges_types } // end namespace details template , typename Base = Refine_edges_base > -struct Refine_edges : - public Base, - public details::Refine_edges_types >::Edges_mesher_level { typedef Refine_edges Self; typedef typename details::Refine_edges_types Types; + Self> Types; typedef typename Types::Edges_mesher_level Mesher; public: - Refine_edges(Tr& t, - Null_mesher_level& null_level) + Refine_edges(Tr& t, + Null_mesher_level& null_level) : Base(t), Mesher(null_level) { } diff --git a/Mesh_3/examples/Mesh_3/CMakeLists.txt b/Mesh_3/examples/Mesh_3/CMakeLists.txt index a6f7848d200..7a259ab4037 100644 --- a/Mesh_3/examples/Mesh_3/CMakeLists.txt +++ b/Mesh_3/examples/Mesh_3/CMakeLists.txt @@ -29,7 +29,7 @@ if ( CGAL_FOUND ) option(CGAL_ACTIVATE_CONCURRENT_MESH_3 "Activate parallelism in Mesh_3" OFF) - + # And add -DCGAL_CONCURRENT_MESH_3 if that option is ON if( CGAL_ACTIVATE_CONCURRENT_MESH_3 OR ENV{CGAL_ACTIVATE_CONCURRENT_MESH_3} ) add_definitions( -DCGAL_CONCURRENT_MESH_3 ) @@ -42,14 +42,14 @@ if ( CGAL_FOUND ) find_package( TBB ) endif( LINK_WITH_TBB ) endif() - + # Use Eigen find_package(Eigen3 3.1.0 REQUIRED) #(3.1.0 or greater) if (NOT EIGEN3_FOUND) message(STATUS "This project requires the Eigen library, and will not be compiled.") return() endif() - + find_package(VTK QUIET COMPONENTS vtkImagingGeneral vtkIOImage NO_MODULE) if(VTK_FOUND) if(VTK_USE_FILE) @@ -71,58 +71,58 @@ if ( CGAL_FOUND ) # Compilable examples create_single_source_cgal_program( "mesh_hybrid_mesh_domain.cpp" ) CGAL_target_use_Eigen(mesh_hybrid_mesh_domain) - + create_single_source_cgal_program( "mesh_implicit_sphere.cpp" ) CGAL_target_use_Eigen(mesh_implicit_sphere) - + create_single_source_cgal_program( "mesh_implicit_sphere_variable_size.cpp" ) CGAL_target_use_Eigen(mesh_implicit_sphere_variable_size) - + create_single_source_cgal_program( "mesh_two_implicit_spheres_with_balls.cpp" ) CGAL_target_use_Eigen(mesh_two_implicit_spheres_with_balls) - + create_single_source_cgal_program( "mesh_implicit_domains_2.cpp" "implicit_functions.cpp" ) CGAL_target_use_Eigen(mesh_implicit_domains_2) - + create_single_source_cgal_program( "mesh_cubes_intersection.cpp" ) CGAL_target_use_Eigen(mesh_cubes_intersection) - + create_single_source_cgal_program( "mesh_cubes_intersection_with_features.cpp" ) CGAL_target_use_Eigen(mesh_cubes_intersection_with_features) - + create_single_source_cgal_program( "mesh_implicit_domains.cpp" "implicit_functions.cpp" ) CGAL_target_use_Eigen(mesh_implicit_domains) - + create_single_source_cgal_program( "mesh_polyhedral_domain.cpp" ) CGAL_target_use_Eigen(mesh_polyhedral_domain) - + create_single_source_cgal_program( "mesh_polyhedral_domain_sm.cpp" ) CGAL_target_use_Eigen(mesh_polyhedral_domain_sm) - + create_single_source_cgal_program( "mesh_polyhedral_domain_with_surface_inside.cpp" ) CGAL_target_use_Eigen(mesh_polyhedral_domain_with_surface_inside) - + create_single_source_cgal_program( "remesh_polyhedral_surface.cpp" ) CGAL_target_use_Eigen(remesh_polyhedral_surface) - + create_single_source_cgal_program( "remesh_polyhedral_surface_sm.cpp" ) CGAL_target_use_Eigen(remesh_polyhedral_surface_sm) - + create_single_source_cgal_program( "mesh_polyhedral_domain_with_features.cpp" ) CGAL_target_use_Eigen(mesh_polyhedral_domain_with_features) - + create_single_source_cgal_program( "mesh_polyhedral_domain_with_features_sm.cpp" ) CGAL_target_use_Eigen(mesh_polyhedral_domain_with_features_sm) - + create_single_source_cgal_program( "mesh_polyhedral_domain_with_lipschitz_sizing.cpp" ) CGAL_target_use_Eigen(mesh_polyhedral_domain_with_lipschitz_sizing) - + create_single_source_cgal_program( "mesh_polyhedral_complex.cpp" ) CGAL_target_use_Eigen(mesh_polyhedral_complex) - + create_single_source_cgal_program( "mesh_polyhedral_complex_sm.cpp" ) CGAL_target_use_Eigen(mesh_polyhedral_complex_sm) - + if( WITH_CGAL_ImageIO ) if( VTK_FOUND AND ("${VTK_VERSION_MAJOR}" GREATER "5" OR VTK_VERSION VERSION_GREATER 5) ) add_executable ( mesh_3D_gray_vtk_image mesh_3D_gray_vtk_image.cpp ) @@ -131,16 +131,16 @@ if ( CGAL_FOUND ) cgal_add_test( mesh_3D_gray_vtk_image ) add_to_cached_list( CGAL_EXECUTABLE_TARGETS mesh_3D_gray_vtk_image ) endif() - + create_single_source_cgal_program( "mesh_3D_gray_image.cpp" ) CGAL_target_use_Eigen(mesh_3D_gray_image) - + create_single_source_cgal_program( "mesh_3D_gray_image_multiple_values.cpp" ) CGAL_target_use_Eigen(mesh_3D_gray_image_multiple_values) - + create_single_source_cgal_program( "mesh_3D_image_with_features.cpp" ) CGAL_target_use_Eigen(mesh_3D_image_with_features) - + if( CGAL_ImageIO_USE_ZLIB ) create_single_source_cgal_program( "mesh_optimization_example.cpp" ) CGAL_target_use_Eigen(mesh_optimization_example) @@ -150,7 +150,7 @@ if ( CGAL_FOUND ) create_single_source_cgal_program( "mesh_3D_image.cpp" ) CGAL_target_use_Eigen(mesh_3D_image) - + create_single_source_cgal_program( "mesh_3D_image_with_custom_initialization.cpp" ) CGAL_target_use_Eigen(mesh_3D_image_with_custom_initialization) @@ -162,7 +162,7 @@ if ( CGAL_FOUND ) else() message( STATUS "NOTICE: Some examples need the CGAL_ImageIO library, and will not be compiled." ) endif() - + # create_single_source_cgal_program( "mesh_polyhedral_implicit_function.cpp" ) # create_single_source_cgal_program( "mesh_polyhedral_surface_tolerance_region.cpp" ) # create_single_source_cgal_program( "mesh_polyhedral_edge_tolerance_region.cpp" ) diff --git a/Mesh_3/include/CGAL/IO/Complex_3_in_triangulation_3_to_vtk.h b/Mesh_3/include/CGAL/IO/Complex_3_in_triangulation_3_to_vtk.h index c18be2bc370..2d101a4ea92 100644 --- a/Mesh_3/include/CGAL/IO/Complex_3_in_triangulation_3_to_vtk.h +++ b/Mesh_3/include/CGAL/IO/Complex_3_in_triangulation_3_to_vtk.h @@ -28,8 +28,8 @@ namespace CGAL { //if export_complex is false, there must be no far point. template -vtkUnstructuredGrid* -output_c3t3_to_vtk_unstructured_grid(const C3T3& c3t3, +vtkUnstructuredGrid* +output_c3t3_to_vtk_unstructured_grid(const C3T3& c3t3, vtkUnstructuredGrid* grid = 0, bool export_complex = true) { @@ -50,7 +50,7 @@ output_c3t3_to_vtk_unstructured_grid(const C3T3& c3t3, boost::unordered_map V; vtkIdType inum = 0; - for(typename Triangulation::Finite_vertices_iterator + for(typename Triangulation::Finite_vertices_iterator vit = tr.finite_vertices_begin(), end = tr.finite_vertices_end(); vit != end; @@ -66,10 +66,10 @@ output_c3t3_to_vtk_unstructured_grid(const C3T3& c3t3, V[vit] = inum++; } } - for(typename C3T3::Facets_in_complex_iterator + for(typename C3T3::Facets_in_complex_iterator fit = c3t3.facets_in_complex_begin(), end = c3t3.facets_in_complex_end(); - fit != end; ++fit) + fit != end; ++fit) { vtkIdType cell[3]; int j=0; @@ -81,10 +81,10 @@ output_c3t3_to_vtk_unstructured_grid(const C3T3& c3t3, } if(export_complex) { - for(typename C3T3::Cells_in_complex_iterator + for(typename C3T3::Cells_in_complex_iterator cit = c3t3.cells_in_complex_begin(), end = c3t3.cells_in_complex_end(); - cit != end; ++cit) + cit != end; ++cit) { vtkIdType cell[4]; for (int i = 0; i < 4; ++i) @@ -96,7 +96,7 @@ output_c3t3_to_vtk_unstructured_grid(const C3T3& c3t3, { for(auto cit = tr.finite_cells_begin(), end = tr.finite_cells_end(); - cit != end; ++cit) + cit != end; ++cit) { if(!c3t3.is_in_complex(cit)) { diff --git a/Mesh_3/include/CGAL/IO/File_maya.h b/Mesh_3/include/CGAL/IO/File_maya.h index dfb7398d498..15a38ee55ad 100644 --- a/Mesh_3/include/CGAL/IO/File_maya.h +++ b/Mesh_3/include/CGAL/IO/File_maya.h @@ -29,11 +29,11 @@ namespace CGAL { //------------------------------------------------------- // IO functions //------------------------------------------------------- - + template void -output_to_maya(std::ostream& os, - const C3T3& c3t3, +output_to_maya(std::ostream& os, + const C3T3& c3t3, bool surfaceOnly = true) { typedef typename C3T3::Triangulation Tr; @@ -49,7 +49,7 @@ output_to_maya(std::ostream& os, #ifdef CGAL_MESH_3_IO_VERBOSE std::cerr << "Output to maya:\n"; #endif - + const Tr& tr = c3t3.triangulation(); //------------------------------------------------------- @@ -80,13 +80,13 @@ output_to_maya(std::ostream& os, os << " setAttr \".cuvs\" -type \"string\" \"map1\";" << std::endl; os << " setAttr \".dcol\" yes;" << std::endl; os << " setAttr \".dcc\" -type \"string\" \"Ambient+Diffuse\";" << std::endl; - + os << " connectAttr \"" << name << "Shape.iog\" \":initialShadingGroup.dsm\" -na;\n\n"; - + //------------------------------------------------------- // Colors //------------------------------------------------------ - + /*os << " setAttr \".ccls\" -type \"string\" \"colorSet\";\n"; os << " setAttr \".clst[0].clsn\" -type \"string\" \"colorSet\";\n"; os << " setAttr \".clst[0].rprt\" 3;\n"; @@ -95,11 +95,11 @@ output_to_maya(std::ostream& os, os << " 100 250 50" << std::endl; os << " 0 200 200" << std::endl; os << " ;\n";*/ - + //------------------------------------------------------- // Vertices //------------------------------------------------------ - + boost::unordered_map V; std::stringstream vertices_sstr; int num_vertices = 0; @@ -115,7 +115,7 @@ output_to_maya(std::ostream& os, vertices_sstr << " " << CGAL::to_double(p.x()) << " " << CGAL::to_double(p.y()) << " " << CGAL::to_double(p.z()) << std::endl; } } - + os << " setAttr -s " << num_vertices << " \".vt[0:" << num_vertices-1 << "]\"" << std::endl; os << vertices_sstr.str(); os << ";\n"; @@ -139,7 +139,7 @@ output_to_maya(std::ostream& os, //------------------------------------------------------- typename C3T3::size_type number_of_triangles = c3t3.number_of_facets_in_complex(); - + std::stringstream facets_sstr; //std::stringstream normals_sstr; @@ -152,7 +152,7 @@ output_to_maya(std::ostream& os, // Surface only if (surfaceOnly) { - facets_sstr << " setAttr -s " << number_of_triangles + facets_sstr << " setAttr -s " << number_of_triangles << " \".fc[0:" << number_of_triangles-1 << "]\" -type \"polyFaces\" \n"; int c = 0; for( Facet_iterator fit = c3t3.facets_in_complex_begin(); @@ -168,9 +168,9 @@ output_to_maya(std::ostream& os, indices[j] = V[vh]; //points[j] = tr.point(fit->first, i); } - + // Reverse triangle orientation? - bool reverse_triangle = + bool reverse_triangle = (fit->second % 2 == 0 && !c3t3.is_in_complex(fit->first)) || (fit->second % 2 != 0 && c3t3.is_in_complex(fit->first)); if (reverse_triangle) @@ -199,7 +199,7 @@ output_to_maya(std::ostream& os, // ith edge of triangle facets_sstr << pos << " "; } - + // 1 triangles facets_sstr << std::endl; // Colors @@ -209,7 +209,7 @@ output_to_maya(std::ostream& os, // Tetrahedra = 4 facets for each else { - facets_sstr << " setAttr -s " << 4*c3t3.number_of_cells_in_complex() + facets_sstr << " setAttr -s " << 4*c3t3.number_of_cells_in_complex() << " \".fc[0:" << 4*c3t3.number_of_cells_in_complex()-1 << "]\" -type \"polyFaces\" \n"; int c = 0; for( Cell_iterator cit = c3t3.cells_in_complex_begin(); @@ -227,7 +227,7 @@ output_to_maya(std::ostream& os, indices[j] = V[vh]; //points[j] = tr.point(cit, i); } - + // Reverse triangle orientation? bool reverse_triangle = (facet_i % 2 != 0 && c3t3.is_in_complex(cit, facet_i)); if (reverse_triangle) @@ -256,7 +256,7 @@ output_to_maya(std::ostream& os, // ith edge of triangle facets_sstr << pos << " "; } - + // 1 triangles facets_sstr << std::endl; // Colors @@ -266,30 +266,30 @@ output_to_maya(std::ostream& os, } facets_sstr << ";\n\n"; //normals_sstr << ";\n\n"; - + //------------------------------------------------------- // Edges //------------------------------------------------------- - os << " setAttr -s " << edges.size() << " \".ed[0:" + os << " setAttr -s " << edges.size() << " \".ed[0:" << edges.size() - 1 << "]\"" << std::endl; for (EdgeList::const_iterator it = edges.begin(), it_end = edges.end() ; it != it_end ; ++it) os << " " << it->first << " " << it->second << " " << 0 << std::endl; os << ";\n"; - + //------------------------------------------------------- // Normals //------------------------------------------------------- - + //os << normals_sstr.str(); //------------------------------------------------------- // Facets //------------------------------------------------------- - + os << facets_sstr.str(); - + //------------------------------------------------------- // Tetrahedra //------------------------------------------------------- diff --git a/Mesh_3/include/CGAL/Mesh_3/Mesh_complex_3_in_triangulation_3_base.h b/Mesh_3/include/CGAL/Mesh_3/Mesh_complex_3_in_triangulation_3_base.h index 398a5bd524d..02b31a987b9 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Mesh_complex_3_in_triangulation_3_base.h +++ b/Mesh_3/include/CGAL/Mesh_3/Mesh_complex_3_in_triangulation_3_base.h @@ -88,12 +88,12 @@ namespace Mesh_3 { // computes and return an ordered pair of Vertex Pair_of_vertices make_ordered_pair(const Vertex_handle vh1, const Vertex_handle vh2) const { - if (vh1 < vh2) { - return std::make_pair(vh1, vh2); - } - else { - return std::make_pair(vh2, vh1); - } + if (vh1 < vh2) { + return std::make_pair(vh1, vh2); + } + else { + return std::make_pair(vh2, vh1); + } } // same from an Edge @@ -268,7 +268,7 @@ public: int number_of_boundary_incident_edges = 0; // could be a bool for (typename std::vector::iterator eit=edges.begin(), end = edges.end(); - eit != end; eit++) + eit != end; eit++) { switch( face_status(*eit) ) { @@ -318,7 +318,7 @@ public: #ifdef CGAL_LINKED_WITH_TBB typename Edge_facet_counter::const_accessor accessor; if(!edge_facet_counter_.find(accessor, - this->make_ordered_pair(edge))) + this->make_ordered_pair(edge))) return NOT_IN_COMPLEX; switch(accessor->second) #else // not CGAL_LINKED_WITH_TBB @@ -443,7 +443,7 @@ public: // Call global function CGAL::output_to_medit(os,*this,rebind,show_patches); } - + /// Outputs the mesh to maya void output_to_maya(std::ofstream& os, bool surfaceOnly = true) const @@ -574,12 +574,12 @@ private: #ifndef CGAL_LINKED_WITH_TBB ++edge_facet_counter_[this->make_ordered_pair(edge_va, edge_vb)]; #else // CGAL_LINKED_WITH_TBB - { - typename Edge_facet_counter::accessor accessor; - edge_facet_counter_.insert(accessor, - this->make_ordered_pair(edge_va, edge_vb)); - ++accessor->second; - } + { + typename Edge_facet_counter::accessor accessor; + edge_facet_counter_.insert(accessor, + this->make_ordered_pair(edge_va, edge_vb)); + ++accessor->second; + } #endif // CGAL_LINKED_WITH_TBB const std::size_t n = edge_va->cached_number_of_incident_facets(); @@ -604,9 +604,9 @@ private: { // fill the union find std::vector non_filtered_facets; if(tr_.is_parallel()) { - tr_.incident_facets_threadsafe(v, std::back_inserter(non_filtered_facets)); + tr_.incident_facets_threadsafe(v, std::back_inserter(non_filtered_facets)); } else { - tr_.incident_facets(v, std::back_inserter(non_filtered_facets)); + tr_.incident_facets(v, std::back_inserter(non_filtered_facets)); } for(typename std::vector::iterator @@ -632,15 +632,15 @@ private: const Cell_handle& ch = (*it).first; const int& i = (*it).second; for(int j=0; j < 3; ++j) { - const Vertex_handle w = ch->vertex(tr_.vertex_triple_index(i,j)); - if(w != v){ - Vertex_set_map_iterator vsm_it = vsmap.find(w); - if(vsm_it != vsmap.end()){ - facets.unify_sets(vsm_it->second, it); - } else { - vsmap.insert(std::make_pair(w, it)); - } - } + const Vertex_handle w = ch->vertex(tr_.vertex_triple_index(i,j)); + if(w != v){ + Vertex_set_map_iterator vsm_it = vsmap.find(w); + if(vsm_it != vsmap.end()){ + facets.unify_sets(vsm_it->second, it); + } else { + vsmap.insert(std::make_pair(w, it)); + } + } } } const std::size_t nb_components = facets.number_of_sets(); @@ -649,7 +649,7 @@ private: v->set_c2t3_cache(n, nb_components); return nb_components; } - + //------------------------------------------------------- // Traversal //------------------------------------------------------- @@ -852,7 +852,7 @@ private: { typedef size_type type; }; - + template struct Init_number_of_elements { @@ -862,7 +862,7 @@ private: a = b; } }; - + template struct Swap_elements { @@ -879,7 +879,7 @@ private: { typedef std::atomic type; }; - + template struct Init_number_of_elements { @@ -889,7 +889,7 @@ private: a = b.load(); } }; - + template struct Swap_elements { @@ -946,12 +946,12 @@ Mesh_complex_3_in_triangulation_3_base::add_to_complex( Vertex_handle edge_va = cell->vertex(edge_index_va); Vertex_handle edge_vb = cell->vertex(edge_index_vb); #ifdef CGAL_LINKED_WITH_TBB - { - typename Edge_facet_counter::accessor accessor; - edge_facet_counter_.insert(accessor, - this->make_ordered_pair(edge_va, edge_vb)); - ++accessor->second; - } + { + typename Edge_facet_counter::accessor accessor; + edge_facet_counter_.insert(accessor, + this->make_ordered_pair(edge_va, edge_vb)); + ++accessor->second; + } #else // not CGAL_LINKED_WITH_TBB ++edge_facet_counter_[this->make_ordered_pair(edge_va, edge_vb)]; #endif // not CGAL_LINKED_WITH_TBB @@ -996,12 +996,12 @@ Mesh_complex_3_in_triangulation_3_base::remove_from_complex(const Facet& const Vertex_handle edge_va = cell->vertex(edge_index_va); const Vertex_handle edge_vb = cell->vertex(edge_index_vb); #ifdef CGAL_LINKED_WITH_TBB - { - typename Edge_facet_counter::accessor accessor; - edge_facet_counter_.insert(accessor, - this->make_ordered_pair(edge_va, edge_vb)); - --accessor->second; - } + { + typename Edge_facet_counter::accessor accessor; + edge_facet_counter_.insert(accessor, + this->make_ordered_pair(edge_va, edge_vb)); + --accessor->second; + } #else // not CGAL_LINKED_WITH_TBB --edge_facet_counter_[this->make_ordered_pair(edge_va, edge_vb)]; #endif // not CGAL_LINKED_WITH_TBB diff --git a/Mesh_3/include/CGAL/Mesh_3/Refine_facets_manifold_base.h b/Mesh_3/include/CGAL/Mesh_3/Refine_facets_manifold_base.h index 1568ea059aa..3038ce6383f 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Refine_facets_manifold_base.h +++ b/Mesh_3/include/CGAL/Mesh_3/Refine_facets_manifold_base.h @@ -219,7 +219,7 @@ private: << biggest_sq_dist << std::endl; #endif // CGAL_MESHES_DEBUG_REFINEMENT_POINTS - for (++fcirc; *fcirc != first_facet; ++fcirc) + for (++fcirc; *fcirc != first_facet; ++fcirc) { while(!this->r_c3t3_.is_in_complex(*fcirc)) ++fcirc; if(*fcirc == first_facet) break; @@ -247,7 +247,7 @@ private: // Actions to perform on a facet inside the conflict zone void - before_insertion_handle_facet_inside_conflict_zone (const Facet& f) + before_insertion_handle_facet_inside_conflict_zone (const Facet& f) { #ifdef CGAL_LINKED_WITH_TBB // Sequential only @@ -544,7 +544,7 @@ public: // foreach f in star(v) for (typename Facets::iterator fit = facets.begin(); fit != facets.end(); - ++fit) + ++fit) { // foreach edge of *fit const Cell_handle cell = fit->first; @@ -564,7 +564,7 @@ public: // edges are tried to be inserted several times // TODO one day: test if the edge is still singular if ( (this->r_c3t3_.face_status(edge) == C3t3::SINGULAR) || - ( (!m_with_boundary) && + ( (!m_with_boundary) && (this->r_c3t3_.face_status(edge) == C3t3::BOUNDARY) ) ) { diff --git a/Mesh_3/include/CGAL/Mesh_3/experimental/Lipschitz_sizing_experimental.h b/Mesh_3/include/CGAL/Mesh_3/experimental/Lipschitz_sizing_experimental.h index f010b11bc38..2288db7ef27 100644 --- a/Mesh_3/include/CGAL/Mesh_3/experimental/Lipschitz_sizing_experimental.h +++ b/Mesh_3/include/CGAL/Mesh_3/experimental/Lipschitz_sizing_experimental.h @@ -201,7 +201,7 @@ public: const typename MeshDomain::Curve_index& curve_id = m_domain.curve_index(index); const Patches_ids& ids = patches_ids_map[curve_id]; - + if (m_domain_is_a_box && ids.size() == 2) { //we are on an edge of the box diff --git a/Mesh_3/include/CGAL/Polyhedral_mesh_domain_3.h b/Mesh_3/include/CGAL/Polyhedral_mesh_domain_3.h index 42abf9d1256..7b9fbd23f95 100644 --- a/Mesh_3/include/CGAL/Polyhedral_mesh_domain_3.h +++ b/Mesh_3/include/CGAL/Polyhedral_mesh_domain_3.h @@ -163,7 +163,7 @@ public: template struct Primitive_type { - //setting OneFaceGraphPerTree to false transforms the id type into + //setting OneFaceGraphPerTree to false transforms the id type into //std::pair. typedef AABB_face_graph_triangle_primitive::const_type, CGAL::Tag_false> type; @@ -180,7 +180,7 @@ public: } }; // Primitive_type (for non-Polyhedron_3) - + public: typedef typename Primitive_type::type Ins_fctor_primitive; typedef CGAL::AABB_traits Ins_fctor_traits; @@ -652,7 +652,7 @@ public: Query_cache &qc = query_cache.local(); return qc.has_cache && (qc.cached_query == Cached_query(q)); #else - return query_cache.has_cache + return query_cache.has_cache && (query_cache.cached_query == Cached_query(q)); #endif } @@ -760,5 +760,5 @@ Is_in_domain::operator()(const Point_3& p) const } // end namespace CGAL #include - + #endif // POLYHEDRAL_MESH_TRAITS_3_H_ diff --git a/Mesh_3/test/Mesh_3/CMakeLists.txt b/Mesh_3/test/Mesh_3/CMakeLists.txt index bd6221a9aa6..ee17ea5e154 100644 --- a/Mesh_3/test/Mesh_3/CMakeLists.txt +++ b/Mesh_3/test/Mesh_3/CMakeLists.txt @@ -23,7 +23,7 @@ if ( CGAL_FOUND ) message(STATUS "This project requires the Eigen library, and will not be compiled.") return() endif() - + create_single_source_cgal_program( "test_boost_has_xxx.cpp" ) create_single_source_cgal_program( "test_c3t3.cpp" ) create_single_source_cgal_program( "test_mesh_capsule_var_distance_bound.cpp" ) @@ -94,7 +94,7 @@ if ( CGAL_FOUND ) CGAL_target_use_Eigen(${target}) endif() endforeach() - + foreach(target test_meshing_verbose test_meshing_polyhedron_with_features @@ -115,8 +115,8 @@ if ( CGAL_FOUND ) endforeach() else() - + message(STATUS "This program requires the CGAL library, and will not be compiled.") - + endif() diff --git a/Mesh_3/test/Mesh_3/test_mesh_3_issue_1554.cpp b/Mesh_3/test/Mesh_3/test_mesh_3_issue_1554.cpp index c64f5455ffb..fe31c62f6a4 100644 --- a/Mesh_3/test/Mesh_3/test_mesh_3_issue_1554.cpp +++ b/Mesh_3/test/Mesh_3/test_mesh_3_issue_1554.cpp @@ -13,7 +13,7 @@ #include -// Domain +// Domain typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef CGAL::Mesh_polyhedron_3::type Polyhedron; typedef CGAL::Polyhedral_mesh_domain_with_features_3 Mesh_domain; @@ -54,7 +54,7 @@ int main(int argc, char*argv[]) Polyhedron poly; in >> poly; Mesh_domain domain(poly); - + // Get sharp features domain.detect_features(); @@ -64,7 +64,7 @@ int main(int argc, char*argv[]) facet_size = 0.037, facet_distance = 0.0037, cell_radius_edge_ratio = 3); - + // Mesh generation C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, no_perturb(), no_exude()); diff --git a/Mesh_3/test/Mesh_3/test_mesh_capsule_var_distance_bound.cpp b/Mesh_3/test/Mesh_3/test_mesh_capsule_var_distance_bound.cpp index 71312d17a4a..b0c54cb5e74 100644 --- a/Mesh_3/test/Mesh_3/test_mesh_capsule_var_distance_bound.cpp +++ b/Mesh_3/test/Mesh_3/test_mesh_capsule_var_distance_bound.cpp @@ -50,7 +50,7 @@ auto field = [](const Point& p, const int, const Mesh_domain::Index) #else struct Field { typedef ::FT FT; - + FT operator()(const Point& p, const int, const Mesh_domain::Index) const { if(p.z() > 2) return 0.025; if(p.z() < -3) return 0.01; @@ -67,8 +67,8 @@ int main() // Mesh criteria Mesh_criteria criteria(facet_angle=30, facet_size=0.5, - facet_distance=field); - + facet_distance=field); + // Mesh generation C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria); diff --git a/Mesh_3/test/Mesh_3/test_mesh_polyhedral_domain_with_features_deprecated.cpp b/Mesh_3/test/Mesh_3/test_mesh_polyhedral_domain_with_features_deprecated.cpp index 5fd13080c01..12cf7cc11c6 100644 --- a/Mesh_3/test/Mesh_3/test_mesh_polyhedral_domain_with_features_deprecated.cpp +++ b/Mesh_3/test/Mesh_3/test_mesh_polyhedral_domain_with_features_deprecated.cpp @@ -9,7 +9,7 @@ #include #include -// Domain +// Domain typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef CGAL::Mesh_polyhedron_3::type Polyhedron; typedef CGAL::Polyhedral_mesh_domain_with_features_3 Mesh_domain; @@ -32,7 +32,7 @@ int main() { // Create domain Mesh_domain domain("data/cube.off"); - + // Get sharp features domain.detect_features(); @@ -40,7 +40,7 @@ int main() Mesh_criteria criteria(edge_size = 0.3, facet_angle = 25, facet_size = 0.3, facet_distance = 0.1, cell_radius_edge_ratio = 3, cell_size = 0.3); - + // Mesh generation C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria); diff --git a/Nef_3/doc/Nef_3/CGAL/draw_nef_3.h b/Nef_3/doc/Nef_3/CGAL/draw_nef_3.h index 3ec9c0b2a8c..21540073efe 100644 --- a/Nef_3/doc/Nef_3/CGAL/draw_nef_3.h +++ b/Nef_3/doc/Nef_3/CGAL/draw_nef_3.h @@ -1,9 +1,9 @@ namespace CGAL { - + /*! \ingroup PkgDrawNef3 -Open a new window and draws `anef3`, the `Nef_polyhedron_3`. A call to this function is blocking, that is the program continues as soon as the user closes the window. +Open a new window and draws `anef3`, the `Nef_polyhedron_3`. A call to this function is blocking, that is the program continues as soon as the user closes the window. This function requires CGAL_Qt5, and is only available if the flag CGAL_USE_BASIC_VIEWER is defined at compile time. \tparam Nef3 a model of the `Nef_polyhedron_3` concept. \param anef3 the nef polyhedron to draw. diff --git a/Nef_3/doc/Nef_3/Nef_3.txt b/Nef_3/doc/Nef_3/Nef_3.txt index c4d45087f12..952ce600f28 100644 --- a/Nef_3/doc/Nef_3/Nef_3.txt +++ b/Nef_3/doc/Nef_3/Nef_3.txt @@ -1,7 +1,7 @@ namespace CGAL { /*! -\mainpage User Manual +\mainpage User Manual \anchor Chapter_3D_Boolean_Operations_on_Nef_Polyhedra \anchor chapterNef3 @@ -56,7 +56,7 @@ structure that is closed under Boolean operations and with all their generality. Starting from halfspaces (and also directly from oriented 2-manifolds), we can work with set union, set intersection, set difference, set complement, interior, exterior, boundary, closure, and -regularization operations (see Section \ref sectoinRegularized +regularization operations (see Section \ref sectoinRegularized for an explanation of regularized set operations). In essence, we can evaluate a CSG-tree with halfspaces as primitives and convert it into a B-rep representation. @@ -95,16 +95,16 @@ if \f$ K = \mathbb{R}^{+} K\f$ (i.e., \f$ \forall p \in K, \forall \lambda > 0: if \f$ K = x + \mathbb{R}^{+} (K - x)\f$. A cone \f$ K\f$ is called a pyramid if \f$ K\f$ is a polyhedron. -Now let \f$ P \in \mathbb{R}^d\f$ be a polyhedron and \f$ x \in \mathbb{R}^d\f$. There is a -neighborhood \f$ U_0(x)\f$ of \f$ x\f$ such that the pyramid \f$ Q := x + \mathbb{R}^{+} +Now let \f$ P \in \mathbb{R}^d\f$ be a polyhedron and \f$ x \in \mathbb{R}^d\f$. There is a +neighborhood \f$ U_0(x)\f$ of \f$ x\f$ such that the pyramid \f$ Q := x + \mathbb{R}^{+} ((P \cap U(x)) - x)\f$ is the same for all neighborhoods \f$ U(x) \subseteq U_0(x)\f$. \f$ Q\f$ is called the local pyramid of \f$ P\f$ in \f$ x\f$ and -denoted \f$ \pyr_P(x)\f$. +denoted \f$ \pyr_P(x)\f$. Definition: Let \f$ P \in \mathbb{R}^d\f$ be a polyhedron and \f$ x, y \in \mathbb{R}^d\f$ be two points. We define an equivalence relation \f$ x \sim y\f$ iff -\f$ \pyr_P(x) = \pyr_P(y)\f$. The equivalence classes of \f$ \sim\f$ -are the faces of \f$ P\f$. The dimension of a face \f$ s\f$ is the +\f$ \pyr_P(x) = \pyr_P(y)\f$. The equivalence classes of \f$ \sim\f$ +are the faces of \f$ P\f$. The dimension of a face \f$ s\f$ is the dimension of its affine hull, \f$ \dim s := \dim \aff s\f$. In other words, a face \f$ s\f$ of \f$ P\f$ is a maximal non-empty subset @@ -125,13 +125,13 @@ open sets, e.g., an edge does not contain its end-vertices. We illustrate the definitions with an example in the plane. Given the closed halfspaces -\f[ +\f[ \begin{array}{lllll} h_1: y \ge 0,\ \ \ & h_2: x - y \ge 0,\ \ \ & h_3: x + y \le 3,\ \ \ & h_4: x - y \ge 1,\ \ \ & -h_5: x + y \le 2, +h_5: x + y \le 2, \end{array} \f] we define our polyhedron \f$ P := ( h_1 \cap h_2 \cap h_3) - ( h_4 \cap h_5)\f$. @@ -152,18 +152,18 @@ we define our polyhedron \f$ P := ( h_1 \cap h_2 \cap h_3) - ( h_4 \cap h_5)\f$. The left figure illustrates the polyhedron with -its partially closed and partially open boundary, i.e., vertex +its partially closed and partially open boundary, i.e., vertex \f$ v_4, v_5, v_6\f$, and edges \f$ e_4\f$ and \f$ e_5\f$ are not part of \f$ P\f$. The local pyramids for the faces are \f$ \pyr_P(f_1) = \emptyset\f$ and \f$ \pyr_P(f_2) = \mathbb{R}^2\f$. Examples for the local pyramids of edges are the closed halfspace \f$ h_2\f$ for the edge \f$ e_1\f$, \f$ \pyr_P(e_1) = h_2\f$, -and the open halfspace that is the complement of \f$ h_4\f$ for the +and the open halfspace that is the complement of \f$ h_4\f$ for the edge \f$ e_5\f$, \f$ \pyr_P(e_5) = \{(x,y) | x - y < 1\}\f$. The edge \f$ e_3\f$ consists actually of two disconnected parts, both with the same local pyramid \f$ \pyr_P(e_3) = h_1\f$. In our data structure, we will represent the two connected components of the edge \f$ e_3\f$ separately. -The figure on the right +The figure on the right lists all local pyramids for this example. The local pyramids of each vertex are represented by @@ -173,9 +173,9 @@ sphere (see next two figures), which together with the set-selection mark for each item (i.e.\ vertices, edges, loops and faces) forms a two-dimensional Nef polyhedron embedded in the sphere. We add the set-selection mark for the vertex and call the -resulting structure the sphere map of the vertex. +resulting structure the sphere map of the vertex. We use the prefix \f$ s\f$ to distinguish the elements of the sphere map -from the three-dimensional elements. See Chapter +from the three-dimensional elements. See Chapter \ref Chapter_2D_Boolean_Operations_on_Nef_Polygons_Embedded_on_the_Sphere for further details. @@ -187,8 +187,8 @@ but not easily accessible representation of the polyhedron. We enrich the data structure with more explicit representations of all the faces and incidences between them. -\image html snc.png -\image latex snc.png +\image html snc.png +\image latex snc.png We depart slightly from the definition of faces in a Nef polyhedron; we represent the connected components of a face individually and do @@ -198,7 +198,7 @@ pyramid) as this is not needed in our algorithms. We discuss features in the increasing order of dimension.

-
edges:
+
edges:
We store two oppositely oriented edges for each edge and have a pointer from one oriented edge to its opposite edge. Such an oriented edge can be identified with an svertex @@ -207,24 +207,24 @@ the corresponding opposite svertex in the other sphere map.
edge uses:
An edge can have many incident facets (non-manifold situation). We introduce two oppositely oriented edge-uses for each incident -facet; one for each orientation of the facet. An edge-use points -to its corresponding oriented edge and to its oriented facet. -We can identify an edge-use with an oriented sedge in the +facet; one for each orientation of the facet. An edge-use points +to its corresponding oriented edge and to its oriented facet. +We can identify an edge-use with an oriented sedge in the sphere map, or, in the special case also with an sloop. Without mentioning it explicitly in the remainder, all references to sedge can also refer to sloop.
facets:
-We store oriented facets as boundary cycles of oriented -edge-uses. We have a distinguished outer boundary cycle and +We store oriented facets as boundary cycles of oriented +edge-uses. We have a distinguished outer boundary cycle and several (or maybe none) inner boundary cycles representing holes -in the facet. Boundary cycles are linked in one direction. We can +in the facet. Boundary cycles are linked in one direction. We can access the other traversal direction when we switch to the oppositely oriented facet, i.e., by using the opposite edge-use.
shells:
The volume boundary decomposes into different connected components, the shells. A shell consists of a connected set -of facets, edges, and vertices incident to this volume. Facets +of facets, edges, and vertices incident to this volume. Facets around an edge form a radial order that is captured in the radial order of sedges around an svertex in the sphere map. Using this information, we can trace a shell from @@ -243,7 +243,7 @@ Complex, SNC for short \cgalCite{cgal:ghhkm-bosnc-03}. However, in \cgal we identify the names and call the SNC data structure `Nef_polyhedron_3`. -\section sectionNef_3InfiBox Infimaximal Box +\section sectionNef_3InfiBox Infimaximal Box We call a Nef polyhedron bounded if its boundary is bounded, i.e., finite, and unbounded otherwise. Note that unbounded @@ -278,20 +278,20 @@ kernels - `Extended_cartesian` and with a polynomial type as coordinate number type. As long as an extended kernel is used, the full functionality provided -by the `Nef_polyhedron_3` class is available. If a kernel that -does not use polynomials to represent coordinates is used, it is not +by the `Nef_polyhedron_3` class is available. If a kernel that +does not use polynomials to represent coordinates is used, it is not possible to create or load unbounded Nef polyhedra, but all other operations work as expected. We provided both possibilities, since the restriction to bounded Nef polyhedra improves considerably space requirements (plain number type instead of polynomial), and runtime performance. -\section sectoinRegularized Regularized Set Operations +\section sectoinRegularized Regularized Set Operations Since manifolds are not closed under Boolean operations, Requicha proposes to use regularized set operations \cgalCite{cgal:km-st-76}, cgal:r-rrstm-80. A set is regular, if it equals the closure -of its interior. A regularized set operation is defined as the +of its interior. A regularized set operation is defined as the standard set operation followed by a regularization of the result. Regularized sets are closed under regularized set operations. @@ -372,7 +372,7 @@ one selects all boundary items. \subsection Nef_3Transformation Transformation -Using the `std::transform` function, a Nef polyhedron can be translated, +Using the `std::transform` function, a Nef polyhedron can be translated, rotated and scaled. The usage is shown in the following example: \cgalExample{Nef_3/transformation.cpp} @@ -419,7 +419,7 @@ kernel type, but by a `Nef_polynomial` parametrized by that number type. The example iterates all vertices of a given Nef polyhedron and decides whether -it is an standard vertex or a vertex on the infimaximal box. Furthermore, it +it is an standard vertex or a vertex on the infimaximal box. Furthermore, it tests whether any of the vertices is at \f$ (R,R,R)\f$. Recall that \f$ R\f$ was the symbolical value, large but finite, for the size of the infimaximal box. @@ -449,7 +449,7 @@ traits class, and on the output operators of the used number type. Therefore, it is necessary to use the same kernel and the same number type for input and output operations. -We recommend the use of the \cgal kernels `Homogeneous`, +We recommend the use of the \cgal kernels `Homogeneous`, `Exact_predicates_exact_constructions_kernel`, or `Extended_homogeneous`. The homogeneous kernel provides reliable fast performance. In combination with `leda_integer` it is the fastest kernel for `Nef_polyhedron_3`. The @@ -480,17 +480,17 @@ standard kernel. \subsection Nef_3ExploringaSphereMap Exploring a Sphere Map -A sphere map is explored by using the function `get_sphere_map()`, which +A sphere map is explored by using the function `get_sphere_map()`, which returns the sphere map of the specified vertex as a `Nef_polyhedron_S2`. `Nef_polyhedron_S2` provides the functionality necessary for the exploration. Note, that one has to use -the type `Nef_polyhedron_S2` as specified in `Nef_polyhedron_3` as +the type `Nef_polyhedron_S2` as specified in `Nef_polyhedron_3` as is shown in the following example. \cgalExample{Nef_3/exploration_SM.cpp} -\subsection subsectionNef_3ShellExploration Exploring Shells +\subsection subsectionNef_3ShellExploration Exploring Shells A shell of a Nef polyhedron is the connected part of the surface incident to a certain volume. Each halffacet, sface and @@ -521,11 +521,11 @@ We discuss how sfaces, shalfedges, and sloops belong to the shells with a closeup view of the situation at the antenna foot. As you can see, there are three items on the sphere map - a shalfloop for each halffacet which intersects the sphere, and an svertex where the -antenna intersects the sphere. The upper shalfloop lies on the -halffacet which is oriented outwards and is therefore also +antenna intersects the sphere. The upper shalfloop lies on the +halffacet which is oriented outwards and is therefore also oriented outwards. This shalfloop and the svertex belong to the second shell. -The other shalfloop lies on the inwards oriented halffacet and is +The other shalfloop lies on the inwards oriented halffacet and is oriented inwards, too. This shalfloop belongs to the third shell. `Nef_polyhedron_3` offers a visitor interface to explore a shell @@ -547,12 +547,12 @@ once. There are no further requirements on that class. In the example, the class `Shell_explorer` is passed as second argument to `visit_shell_objects`. Its task is to find the lexicographically -smallest vertex of a shell. Its internal state consists of three variables. +smallest vertex of a shell. Its internal state consists of three variables. The first one is a reference to the explored Nef polyhedron. This reference is often necessary to retrieve information from the Nef polyhedron. The second variable `v_min` stores the smallest vertex found so far, and the third variable `first` is initialized to `false` to signal that no -vertex has been visited so far. After the first vertex has been visited +vertex has been visited so far. After the first vertex has been visited `first` is changed to `true`. `Shell_explorer` provides further member functions. After the @@ -584,6 +584,6 @@ the `Object_handle` can represent a `Vertex_const_handle`, a \cgalExample{Nef_3/nef_3_point_location.cpp} -*/ +*/ } /* namespace CGAL */ diff --git a/Nef_3/examples/Nef_3/CMakeLists.txt b/Nef_3/examples/Nef_3/CMakeLists.txt index 3ae02207f06..1dc62e9b098 100644 --- a/Nef_3/examples/Nef_3/CMakeLists.txt +++ b/Nef_3/examples/Nef_3/CMakeLists.txt @@ -9,7 +9,7 @@ project( Nef_3_Examples ) find_package(CGAL COMPONENTS Qt5) if(CGAL_Qt5_FOUND) - add_definitions(-DCGAL_USE_BASIC_VIEWER -DQT_NO_KEYWORDS) + add_definitions(-DCGAL_USE_BASIC_VIEWER -DQT_NO_KEYWORDS) endif() if ( CGAL_FOUND ) @@ -21,12 +21,12 @@ if ( CGAL_FOUND ) endforeach() if(CGAL_Qt5_FOUND) - target_link_libraries(draw_nef_3 PUBLIC CGAL::CGAL_Qt5) + target_link_libraries(draw_nef_3 PUBLIC CGAL::CGAL_Qt5) endif() else() - + message(STATUS "This program requires the CGAL library, and will not be compiled.") - + endif() diff --git a/Nef_3/include/CGAL/Nef_3/K3_tree.h b/Nef_3/include/CGAL/Nef_3/K3_tree.h index 765ab11aa71..6c4a3fa6f42 100644 --- a/Nef_3/include/CGAL/Nef_3/K3_tree.h +++ b/Nef_3/include/CGAL/Nef_3/K3_tree.h @@ -6,7 +6,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Miguel Granados // Peter Hachenberger @@ -71,9 +71,9 @@ struct Compare_triangle_3 { for( int i = 0; i < 3; ++i) { Comparison_result c = compare_xyz( t1[v1[i]], t2[v2[i]]); if( c == SMALLER) - return true; + return true; else if( c == LARGER) - return false; + return false; } return false; // the two triangles are equivalent } @@ -83,7 +83,7 @@ template class K3_tree { -template class Smaller_than { @@ -118,7 +118,7 @@ private: }; -template class Smaller_than, Object, Vertex, Coordinate> { @@ -129,11 +129,11 @@ public: bool operator()( const Vertex& v1, const Vertex& v2) { switch(coord) { case 0: return CGAL::to_interval(v1->point().x()).second < - CGAL::to_interval(v2->point().x()).first; + CGAL::to_interval(v2->point().x()).first; case 1: return CGAL::to_interval(v1->point().y()).second < - CGAL::to_interval(v2->point().y()).first; + CGAL::to_interval(v2->point().y()).first; case 2: return CGAL::to_interval(v1->point().z()).second < - CGAL::to_interval(v2->point().z()).first; + CGAL::to_interval(v2->point().z()).first; default: CGAL_error(); } return false; @@ -145,11 +145,11 @@ public: CGAL::assign(v2,o2); switch(coord) { case 0: return CGAL::to_interval(v1->point().x()).second < - CGAL::to_interval(v2->point().x()).first; + CGAL::to_interval(v2->point().x()).first; case 1: return CGAL::to_interval(v1->point().y()).second < - CGAL::to_interval(v2->point().y()).first; + CGAL::to_interval(v2->point().y()).first; case 2: return CGAL::to_interval(v1->point().z()).second < - CGAL::to_interval(v2->point().z()).first; + CGAL::to_interval(v2->point().z()).first; default: CGAL_error(); } return false; @@ -172,7 +172,7 @@ private: typedef typename CT::Finite_faces_iterator Finite_face_iterator; typedef typename CT::Edge Edge; - typedef typename SNC_structure::Halffacet_cycle_iterator + typedef typename SNC_structure::Halffacet_cycle_iterator Halffacet_cycle_iterator; typedef typename SNC_structure::SHalfedge_around_facet_circulator SHalfedge_around_facet_circulator; @@ -185,18 +185,18 @@ private: template Triangulation_handler(Halffacet_handle f) : visited(false) { - typedef typename SNC_structure::Halffacet_cycle_iterator + typedef typename SNC_structure::Halffacet_cycle_iterator Halffacet_cycle_iterator; typedef typename SNC_structure::SHalfedge_around_facet_circulator SHalfedge_around_facet_circulator; Halffacet_cycle_iterator fci; for(fci=f->facet_cycles_begin(); fci!=f->facet_cycles_end(); ++fci) { - if(fci.is_shalfedge()) { + if(fci.is_shalfedge()) { SHalfedge_around_facet_circulator sfc(fci), send(sfc); - CGAL_For_all(sfc,send) { - ct.insert_constraint(sfc->source()->source()->point(), - sfc->source()->twin()->source()->point()); + CGAL_For_all(sfc,send) { + ct.insert_constraint(sfc->source()->source()->point(), + sfc->source()->twin()->source()->point()); } } } @@ -214,22 +214,22 @@ private: typename CT::Face_handle first = vc; traverse_triangulation(first, first->index(opposite)); - + fi = ct.finite_faces_begin(); } void traverse_triangulation(Face_handle f, int parent) { visited[f] = true; if(!ct.is_constrained(Edge(f,ct.cw(parent))) && !visited[f->neighbor(ct.cw(parent))]) { - Face_handle child(f->neighbor(ct.cw(parent))); - traverse_triangulation(child, child->index(f)); - } + Face_handle child(f->neighbor(ct.cw(parent))); + traverse_triangulation(child, child->index(f)); + } if(!ct.is_constrained(Edge(f,ct.cw(parent))) && !visited[f->neighbor(ct.cw(parent))]) { - Face_handle child(f->neighbor(ct.cw(parent))); - traverse_triangulation(child, child->index(f)); - } - } - + Face_handle child(f->neighbor(ct.cw(parent))); + traverse_triangulation(child, child->index(f)); + } + } + template bool get_next_triangle(Triangle_3& tr) { if(fi == ct.finite_faces_end()) return false; @@ -248,7 +248,7 @@ public: friend class Objects_around_box; public: - + typedef typename Traits::SNC_decorator SNC_decorator; typedef typename Traits::Infimaximal_box Infimaximal_box; typedef typename Traits::Vertex_handle Vertex_handle; @@ -285,15 +285,15 @@ typedef typename Kernel::FT FT; typedef Smaller_than< Kernel, Object_handle, - Vertex_handle, + Vertex_handle, int> Smaller_; class Node { friend class K3_tree; public: - Node( Node* p, Node* l, Node* r, Plane_3 pl, const Object_list& O) : - parent_node(p), left_node(l), right_node(r), splitting_plane(pl), - object_list(O) { + Node( Node* p, Node* l, Node* r, Plane_3 pl, const Object_list& O) : + parent_node(p), left_node(l), right_node(r), splitting_plane(pl), + object_list(O) { if(l == 0) point_on_plane = Point_3(); else @@ -312,20 +312,20 @@ public: void transform(const Aff_transformation_3& t) { if(left_node != 0) { - CGAL_assertion(right_node != 0); - left_node->transform(t); - right_node->transform(t); - splitting_plane = splitting_plane.transform(t); -#ifdef CGAL_NEF3_TRIANGULATE_FACETS + CGAL_assertion(right_node != 0); + left_node->transform(t); + right_node->transform(t); + splitting_plane = splitting_plane.transform(t); +#ifdef CGAL_NEF3_TRIANGULATE_FACETS } else { Halffacet_triangle_handle tri; typename Object_list::iterator o; for(o = object_list.begin(); o != object_list.end(); ++o) if(assign(tri,*o)) { tri.transform(t); - *o = make_object(tri); + *o = make_object(tri); } -#endif // CGAL_NEF3_TRIANGULATE_FACETS +#endif // CGAL_NEF3_TRIANGULATE_FACETS } } @@ -344,33 +344,33 @@ public: std::size_t leafs(int mask = 255, int lower_limit = 0) { std::size_t s = 0; - Halffacet_handle f; + Halffacet_handle f; Halfedge_handle e; Vertex_handle v; typename Object_list::iterator o; - if(mask == 0) + if(mask == 0) s = 1; else { for(o = object_list.begin(); o != object_list.end(); ++o) { - if((mask & 1) && assign(v,*o)) - ++s; - else if((mask&2) && assign(e,*o)) - ++s; - else if(((mask&4) || (mask&8)) && assign(f,*o)) { - if(mask&4) - ++s; - else { - int length = 0; - typename Traits::SHalfedge_around_facet_circulator safc(f->facet_cycles_begin()), - send(safc); - while(++length < lower_limit && ++safc != send) ; - if(length >= lower_limit) - ++s; - } - } + if((mask & 1) && assign(v,*o)) + ++s; + else if((mask&2) && assign(e,*o)) + ++s; + else if(((mask&4) || (mask&8)) && assign(f,*o)) { + if(mask&4) + ++s; + else { + int length = 0; + typename Traits::SHalfedge_around_facet_circulator safc(f->facet_cycles_begin()), + send(safc); + while(++length < lower_limit && ++safc != send) ; + if(length >= lower_limit) + ++s; + } + } } } - + if(left_node != 0) s += left_node->leafs(mask, lower_limit); if(right_node != 0) @@ -423,7 +423,7 @@ public: right_node->add_vertex(v, depth+1); } - + friend std::ostream& operator<< (std::ostream& os, const Node* node) { CGAL_assertion( node != 0); @@ -441,7 +441,7 @@ friend std::ostream& operator<< return os; } - + ~Node() { CGAL_NEF_TRACEN("~Node: deleting node..."); if( !is_leaf()) { @@ -462,7 +462,7 @@ private: public: - class Objects_around_segment + class Objects_around_segment { public: class Iterator; @@ -473,7 +473,7 @@ public: bool initialized; public: Objects_around_segment() : initialized(false) {} - Objects_around_segment( const K3_tree& k, const Segment_3& s) : + Objects_around_segment( const K3_tree& k, const Segment_3& s) : root_node(k.root), segment(s), initialized(true) { CGAL_NEF_TRACEN("Objects_around_segment: input segment: "<objects(); } Self& operator++() { - + if( S.empty()) node = 0; // end of the iterator else { @@ -566,19 +566,19 @@ else { return *this; } - bool operator==(const Self& i) const { - return (node == i.node); + bool operator==(const Self& i) const { + return (node == i.node); } - bool operator!=(const Self& i) const { - return !(*this == i); + bool operator!=(const Self& i) const { + return !(*this == i); } private: - const Node* get_node() const { + const Node* get_node() const { CGAL_assertion( node != 0); return node; } - -inline + +inline const Node* get_child_by_side( const Node* node, Oriented_side side) { CGAL_assertion( node != nullptr); CGAL_assertion( side != ON_ORIENTED_BOUNDARY); @@ -589,7 +589,7 @@ const Node* get_child_by_side( const Node* node, Oriented_side side) { return node->right(); } -void divide_segment_by_plane( Segment_3 s, Plane_3 pl, +void divide_segment_by_plane( Segment_3 s, Plane_3 pl, Segment_3& s1, Segment_3& s2) { Object o = traits.intersect_object()( pl, s); Point_3 ip; @@ -610,7 +610,7 @@ void divide_segment_by_plane( Segment_3 s, Plane_3 pl, { typedef Objects_around_segment Base; protected: - Traits traits; + Traits traits; public: Objects_along_ray( const K3_tree& k, const Ray_3& r) { CGAL_NEF_TRACEN("Objects_along_ray: input ray: "< CGAL::abs(vec[1]) ? 0 : 1); - c = (CGAL::abs(vec[2]) > CGAL::abs(vec[c]) ? 2 : c); + int c = (CGAL::abs(vec[0]) > CGAL::abs(vec[1]) ? 0 : 1); + c = (CGAL::abs(vec[2]) > CGAL::abs(vec[c]) ? 2 : c); - Point_3 pt_on_minus_x_plane = vec[c] < 0 ? - Point_3(FT(b.min_coord(0)), FT(b.min_coord(1)),FT(b.min_coord(2))) : - Point_3(FT(b.max_coord(0)), FT(b.max_coord(1)),FT(b.max_coord(2))); - // We compute the intersection between a plane with normal vector in + Point_3 pt_on_minus_x_plane = vec[c] < 0 ? + Point_3(FT(b.min_coord(0)), FT(b.min_coord(1)),FT(b.min_coord(2))) : + Point_3(FT(b.max_coord(0)), FT(b.max_coord(1)),FT(b.max_coord(2))); + // We compute the intersection between a plane with normal vector in // the minus x direction and located at the minimum point of the bounding box, and the input ray. When the ray does not intersect the bounding volume, there won't be any object hit, so it is safe to construct a segment that simply lay in the unbounded side of the bounding box. This approach is taken instead of somehow (efficiently) report that there was no hit object, in order to mantain a clear interface with the Iterator class. - Plane_3 pl_on_minus_x; + Plane_3 pl_on_minus_x; if(c==0) - pl_on_minus_x = Plane_3(pt_on_minus_x_plane, Vector_3( 1, 0, 0)); + pl_on_minus_x = Plane_3(pt_on_minus_x_plane, Vector_3( 1, 0, 0)); else if(c==1) - pl_on_minus_x = Plane_3(pt_on_minus_x_plane, Vector_3( 0, 1, 0)); + pl_on_minus_x = Plane_3(pt_on_minus_x_plane, Vector_3( 0, 1, 0)); else { - CGAL_assertion_msg(c==2, "wrong value"); - pl_on_minus_x = Plane_3(pt_on_minus_x_plane, Vector_3( 0, 0, 1)); + CGAL_assertion_msg(c==2, "wrong value"); + pl_on_minus_x = Plane_3(pt_on_minus_x_plane, Vector_3( 0, 0, 1)); } Object o = traits.intersect_object()( pl_on_minus_x, r); if( !CGAL::assign( q, o) || pl_on_minus_x.has_on(p)) - q = r.source() + vec; + q = r.source() + vec; else - q = normalized(q); + q = normalized(q); Base::initialize( k, Segment_3( p, q)); } }; @@ -655,15 +655,15 @@ class Objects_around_box { public: Objects_around_box() : initialized(false) {} - Objects_around_box(const K3_tree& k, const Bounding_box_3& b) : + Objects_around_box(const K3_tree& k, const Bounding_box_3& b) : root_node(k.root), box(b), initialized(true) {} - + void initialize( const K3_tree& k, const Bounding_box_3& b) { root_node = k.root; box = b; initialized = true; } - + public: Iterator begin() const { CGAL_assertion( initialized == true); @@ -694,63 +694,63 @@ class Objects_around_box { Iterator( const Self& i) : S(i.S), node(i.node) {} - const Object_list& operator*() const { + const Object_list& operator*() const { CGAL_assertion( node != 0); return node->objects(); } - + Self& operator++() { - + if(S.empty()) - node = 0; // end of the iterator + node = 0; // end of the iterator else { - while( !S.empty()) { - const Node* n = S.front().first; - Bounding_box_3 b = S.front().second; - S.pop_front(); - if( n->is_leaf()) { - node = n; - break; - } else { - Point_3 pmin(b.min_coord(0), b.min_coord(1), b.min_coord(2)); - Point_3 pmax(b.max_coord(0), b.max_coord(1), b.max_coord(2)); - Oriented_side src_side = - n->plane().oriented_side(pmax); - Oriented_side tgt_side = - n->plane().oriented_side(pmin); - if( src_side == tgt_side && - src_side != ON_ORIENTED_BOUNDARY) - S.push_front( Candidate( get_child_by_side( n, src_side), b)); - else { - S.push_front( Candidate( get_child_by_side( n, tgt_side), b)); - S.push_front( Candidate( get_child_by_side( n, src_side), b)); - } - } - } + while( !S.empty()) { + const Node* n = S.front().first; + Bounding_box_3 b = S.front().second; + S.pop_front(); + if( n->is_leaf()) { + node = n; + break; + } else { + Point_3 pmin(b.min_coord(0), b.min_coord(1), b.min_coord(2)); + Point_3 pmax(b.max_coord(0), b.max_coord(1), b.max_coord(2)); + Oriented_side src_side = + n->plane().oriented_side(pmax); + Oriented_side tgt_side = + n->plane().oriented_side(pmin); + if( src_side == tgt_side && + src_side != ON_ORIENTED_BOUNDARY) + S.push_front( Candidate( get_child_by_side( n, src_side), b)); + else { + S.push_front( Candidate( get_child_by_side( n, tgt_side), b)); + S.push_front( Candidate( get_child_by_side( n, src_side), b)); + } + } + } } return *this; } - bool operator==(const Self& i) const { - return (node == i.node); + bool operator==(const Self& i) const { + return (node == i.node); } - bool operator!=(const Self& i) const { - return !(*this == i); + bool operator!=(const Self& i) const { + return !(*this == i); } private: - const Node* get_node() const { + const Node* get_node() const { CGAL_assertion( node != 0); return node; } - - inline + + inline const Node* get_child_by_side( const Node* node, Oriented_side side) { CGAL_assertion( node != nullptr); CGAL_assertion( side != ON_ORIENTED_BOUNDARY); if( side == ON_NEGATIVE_SIDE) { - return node->left(); + return node->left(); } CGAL_assertion( side == ON_POSITIVE_SIDE); return node->right(); @@ -768,9 +768,9 @@ private: Bounding_box_3 bounding_box; public: template - K3_tree(SNC_structure* W) + K3_tree(SNC_structure* W) #ifdef CGAL_NEF_EXPLOIT_REFERENCE_COUNTING - : reference_counted(false) + : reference_counted(false) #endif { @@ -813,26 +813,26 @@ public: if(c == 0) { Triangulation_handler th(f); while(th.get_next_triangle(tr)) { - triangles.push_front(tr); + triangles.push_front(tr); Halffacet_triangle_handle th( f, *triangles.begin()); objects.push_back(make_object(th)); } } else if(c == 1) { Triangulation_handler th(f); while(th.get_next_triangle(tr)) { - triangles.push_front(tr); + triangles.push_front(tr); Halffacet_triangle_handle th( f, *triangles.begin()); objects.push_back(make_object(th)); } } else if(c == 2) { Triangulation_handler th(f); while(th.get_next_triangle(tr)) { - triangles.push_front(tr); + triangles.push_front(tr); Halffacet_triangle_handle th( f, *triangles.begin()); objects.push_back(make_object(th)); } - } else - CGAL_error_msg( "wrong value"); + } else + CGAL_error_msg( "wrong value"); } else objects.push_back(make_object(Halffacet_handle(f))); #else @@ -844,7 +844,7 @@ public: } K3_tree(Object_list& objects, Object_iterator& v_end) { - + typename Object_list::difference_type n_vertices = std::distance(objects.begin(),v_end); CGAL_NEF_TRACEN("K3_tree(): n_vertices = " << std::distance(objects.begin(),v_end)); std::frexp( (double) n_vertices, &max_depth); @@ -853,8 +853,8 @@ typename Object_list::difference_type n_vertices = std::distance(objects.begin() Objects_bbox objects_bbox = traits.objects_bbox_object(); bounding_box = objects_bbox(objects); //CGAL_NEF_TRACEN("bounding box:"< v_mark(false); Unique_hash_map< Halfedge_handle, bool> e_mark(false); Unique_hash_map< Halffacet_handle, bool> f_mark(false); std::map< Triangle_3, bool, Compare_triangle_3 > t_mark; - for( typename Objects_around_segment::Iterator oar = objects.begin(); - oar != objects.end(); ++oar) { + for( typename Objects_around_segment::Iterator oar = objects.begin(); + oar != objects.end(); ++oar) { for( typename Object_list::const_iterator o = (*oar).begin(); - o != (*oar).end(); ++o) { // TODO: implement operator->(...) - Vertex_handle v; - Halfedge_handle e; - Halffacet_handle f; + o != (*oar).end(); ++o) { // TODO: implement operator->(...) + Vertex_handle v; + Halfedge_handle e; + Halffacet_handle f; #ifdef CGAL_NEF3_TRIANGULATE_FACETS - Halffacet_triangle_handle t; + Halffacet_triangle_handle t; #endif #ifdef CGAL_NEF3_FACET_WITH_BOX - Partial_facet pf; + Partial_facet pf; #endif - if( CGAL::assign( v, *o)) { - if( !v_mark[v]) { - O.push_back(*o); - v_mark[v] = true; - } - } - else if( CGAL::assign( e, *o)) { - if( !e_mark [e]) { - O.push_back(*o); - e_mark[e] = true; - } - } - else if( CGAL::assign( f, *o)) { - if( !f_mark[f]) { - O.push_back(*o); - f_mark[f] = true; - } - } + if( CGAL::assign( v, *o)) { + if( !v_mark[v]) { + O.push_back(*o); + v_mark[v] = true; + } + } + else if( CGAL::assign( e, *o)) { + if( !e_mark [e]) { + O.push_back(*o); + e_mark[e] = true; + } + } + else if( CGAL::assign( f, *o)) { + if( !f_mark[f]) { + O.push_back(*o); + f_mark[f] = true; + } + } #ifdef CGAL_NEF3_TRIANGULATE_FACETS - else if(CGAL::assign(t, *o)) { - Triangle_3 tr = t.get_triangle(); - if( !t_mark[tr]) { - O.push_back(*o); - t_mark[tr] = true; - } - } + else if(CGAL::assign(t, *o)) { + Triangle_3 tr = t.get_triangle(); + if( !t_mark[tr]) { + O.push_back(*o); + t_mark[tr] = true; + } + } #endif #ifdef CGAL_NEF3_FACET_WITH_BOX - else if(CGAL::assign(pf, *o)) { - CGAL_error_msg( "wrong type"); - } + else if(CGAL::assign(pf, *o)) { + CGAL_error_msg( "wrong type"); + } #endif - else - CGAL_error_msg( "wrong handle"); + else + CGAL_error_msg( "wrong handle"); } } return O; @@ -936,24 +936,24 @@ typename Object_list::difference_type n_vertices = std::distance(objects.begin() } void add_edge(Halfedge_handle e) { - root->add_edge(e,0); + root->add_edge(e,0); } void add_vertex(Vertex_handle v) { root->add_vertex(v,0); } - class BBox_updater { + class BBox_updater { Bounding_box_3 b; - public: + public: BBox_updater() {} void pre_visit(const Node*) {} void post_visit(const Node* n) { typename Object_list::const_iterator o; - for( o = n->objects().begin(); - o != n->objects().end(); ++o) { + for( o = n->objects().begin(); + o != n->objects().end(); ++o) { Vertex_handle v; if( CGAL::assign( v, *o)) b.extend(v->point()); @@ -963,7 +963,7 @@ typename Object_list::difference_type n_vertices = std::distance(objects.begin() Bounding_box_3 box() const{ return b; } - + }; template @@ -989,7 +989,7 @@ typename Object_list::difference_type n_vertices = std::distance(objects.begin() bounding_box = bbup.box(); } - + #ifdef CODE_DOES_NOT_WORK_WITH_BOTH_KERNELS_AT_THE_SAME_TIME template friend std::ostream& operator<< @@ -999,7 +999,7 @@ friend std::ostream& operator<< } #endif std::string dump_object_list( const Object_list& O, int level = 0) { - std::stringstream os; + std::stringstream os; typename Object_list::size_type v_count = 0, e_count = 0, f_count = 0; typename Object_list::const_iterator o; Vertex_handle v; @@ -1020,7 +1020,7 @@ std::string dump_object_list( const Object_list& O, int level = 0) { } else if( CGAL::assign( e, *o)) { if( level) os << e->source()->point() << "->" - << e->twin()->source()->point() << std::endl; + << e->twin()->source()->point() << std::endl; ++e_count; } else if( CGAL::assign( f, *o)) { @@ -1031,15 +1031,15 @@ std::string dump_object_list( const Object_list& O, int level = 0) { else if( CGAL::assign(t, *o)) { if( level) os << "triangle" << std::endl; ++t_count; - } + } #endif #ifdef CGAL_NEF3_FACET_WITH_BOX else if( CGAL::assign(pf, *o)) { if( level) pf.debug(); - ++p_count; + ++p_count; } #endif - else + else CGAL_error_msg( "wrong handle"); } os << v_count << "v " << e_count << "e " << f_count << "f "; @@ -1052,15 +1052,15 @@ std::string dump_object_list( const Object_list& O, int level = 0) { return os.str(); } -bool update( Unique_hash_map& V, - Unique_hash_map& E, +bool update( Unique_hash_map& V, + Unique_hash_map& E, Unique_hash_map& F) { return update( root, V, E, F); } bool update( Node* node, - Unique_hash_map& V, - Unique_hash_map& E, + Unique_hash_map& V, + Unique_hash_map& E, Unique_hash_map& F) { CGAL_assertion( node != 0); if( node->is_leaf()) { @@ -1083,7 +1083,7 @@ bool update( Node* node, if( !E[e]) { O->erase(o); updated = true; - } + } } else if( CGAL::assign( f, *o)) { if( !F[f]) { @@ -1110,10 +1110,10 @@ bool update( Node* node, } private: - + template -Node* build_kdtree(Object_list& O, Object_iterator v_end, - Depth depth, Node* parent=0, int non_efective_splits=0) { +Node* build_kdtree(Object_list& O, Object_iterator v_end, + Depth depth, Node* parent=0, int non_efective_splits=0) { CGAL_precondition( depth >= 0); CGAL_NEF_TRACEN( "build_kdtree: "< -bool classify_objects(Object_iterator start, Object_iterator end, +bool classify_objects(Object_iterator start, Object_iterator end, Plane_3 partition_plane, Side_of_plane& sop, OutputIterator o1, OutputIterator o2, Depth depth) { typename Object_list::difference_type on_oriented_boundary = 0; typename Object_list::const_iterator o; - + Point_3 point_on_plane(partition_plane.point()); for( o = start; o != end; ++o) { @@ -1206,11 +1206,11 @@ bool classify_objects(Object_iterator start, Object_iterator end, if(CGAL::assign(pf, *o)) { Partial_facet pfn,pfp; if(pf.divide(partition_plane, pfn, pfp)) { - *o1 = make_object(pfn); - ++o1; - *o2 = make_object(pfp); - ++o2; - continue; + *o1 = make_object(pfn); + ++o1; + *o2 = make_object(pfp); + ++o2; + continue; } } #endif @@ -1238,7 +1238,7 @@ Plane_3 construct_splitting_plane(Object_iterator start, Object_iterator end, CGAL_assertion(n>1); std::nth_element(start, start+n/2, end, - Smaller_(depth%3)); + Smaller_(depth%3)); Vertex_handle v; median = start+n/2; @@ -1261,7 +1261,7 @@ const Node *locate_cell_containing( const Point_3& p, const Node* node) const { Oriented_side side = node->plane().oriented_side(p); if( side == ON_NEGATIVE_SIDE || side == ON_ORIENTED_BOUNDARY) return locate_cell_containing( p, node->left()); - else { // side == ON_POSITIVE_SIDE + else { // side == ON_POSITIVE_SIDE CGAL_assertion( side == ON_POSITIVE_SIDE); return locate_cell_containing( p, node->right()); } @@ -1276,7 +1276,7 @@ const Object_list& locate( const Point_3& p, const Node* node) const { bool is_point_on_cell( const Point_3& p, const Node* target, const Node* current) const { CGAL_precondition( target != 0 && current != 0); if( current->is_leaf()) - return (current == target); + return (current == target); Oriented_side side = current->plane().oriented_side(p); if( side == ON_NEGATIVE_SIDE) return is_point_on_cell( p, target, current->left()); diff --git a/Nef_3/include/CGAL/Nef_3/SNC_point_locator.h b/Nef_3/include/CGAL/Nef_3/SNC_point_locator.h index 74586d759d5..966ac064b88 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_point_locator.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_point_locator.h @@ -6,7 +6,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Miguel Granados @@ -63,16 +63,16 @@ class SNC_point_locator protected: std::string version_; // time for construction, point location, ray shooting and intersection test - mutable Timer ct_t, pl_t, rs_t, it_t; + mutable Timer ct_t, pl_t, rs_t, it_t; -public: +public: typedef typename SNC_structure::Object_handle Object_handle; typedef typename SNC_structure::Point_3 Point_3; typedef typename SNC_structure::Segment_3 Segment_3; typedef typename SNC_structure::Ray_3 Ray_3; typedef typename SNC_structure::Vector_3 Vector_3; - typedef typename SNC_structure::Aff_transformation_3 + typedef typename SNC_structure::Aff_transformation_3 Aff_transformation_3; typedef typename Decorator_traits::Vertex_handle Vertex_handle; @@ -91,7 +91,7 @@ public: virtual Object_handle shoot(const Ray_3& s, int mask=255) const = 0; virtual void intersect_with_edges( Halfedge_handle edge, - const Intersection_call_back& call_back) + const Intersection_call_back& call_back) const = 0; virtual void intersect_with_facets( Halfedge_handle edge, @@ -99,14 +99,14 @@ public: const = 0; virtual void intersect_with_edges_and_facets( Halfedge_handle edge, - const Intersection_call_back& call_back) const = 0; + const Intersection_call_back& call_back) const = 0; - class Intersection_call_back + class Intersection_call_back { public: - virtual void operator()( Halfedge_handle edge, Object_handle object, + virtual void operator()( Halfedge_handle edge, Object_handle object, const Point_3& intersection_point) const = 0; - + virtual ~Intersection_call_back() {} }; @@ -116,8 +116,8 @@ public: virtual void transform(const Aff_transformation_3& t) = 0; - //virtual bool update( Unique_hash_map& V, - // Unique_hash_map& E, + //virtual bool update( Unique_hash_map& V, + // Unique_hash_map& E, // Unique_hash_map& F) = 0; virtual void add_facet(Halffacet_handle) {} @@ -134,7 +134,7 @@ public: CGAL_NEF_CLOG("intersection_time: "< -class SNC_point_locator_by_spatial_subdivision : +class SNC_point_locator_by_spatial_subdivision : public SNC_point_locator, public SNC_decorator -{ +{ typedef SNC_decorator Base; typedef CGAL::SNC_point_locator SNC_point_locator; typedef CGAL::SNC_point_locator_by_spatial_subdivision Self; @@ -161,10 +161,10 @@ public: typedef typename CGAL::K3_tree K3_tree; typedef K3_tree SNC_candidate_provider; - + typedef typename SNC_structure::Object_handle Object_handle; #ifdef CGAL_NEF3_TRIANGULATE_FACETS - typedef typename Decorator_traits::Halffacet_triangle_handle + typedef typename Decorator_traits::Halffacet_triangle_handle Halffacet_triangle_handle; #endif #ifdef CGAL_NEF3_FACET_WITH_BOX @@ -176,7 +176,7 @@ public: typedef typename SNC_structure::Ray_3 Ray_3; typedef typename SNC_structure::Vector_3 Vector_3; typedef typename SNC_structure::Triangle_3 Triangle_3; - typedef typename SNC_structure::Aff_transformation_3 + typedef typename SNC_structure::Aff_transformation_3 Aff_transformation_3; typedef typename SNC_structure::Infi_box Infi_box; @@ -191,10 +191,10 @@ public: typedef typename Decorator_traits::Halffacet_iterator Halffacet_iterator; typedef typename Decorator_traits::Volume_handle Volume_handle; - typedef typename Decorator_traits::Halffacet_cycle_iterator + typedef typename Decorator_traits::Halffacet_cycle_iterator Halffacet_cycle_iterator; - typedef typename Decorator_traits::SHalfedge_around_facet_circulator - SHalfedge_around_facet_circulator; + typedef typename Decorator_traits::SHalfedge_around_facet_circulator + SHalfedge_around_facet_circulator; typedef typename SNC_candidate_provider::Object_list Object_list; typedef typename Object_list::iterator Object_list_iterator; @@ -205,10 +205,10 @@ public: using Base::get_visible_facet; public: - SNC_point_locator_by_spatial_subdivision() : + SNC_point_locator_by_spatial_subdivision() : initialized(false), candidate_provider(0) {} -#ifdef CGAL_NEF3_TRIANGULATE_FACETS +#ifdef CGAL_NEF3_TRIANGULATE_FACETS template class Triangulation_handler { @@ -232,13 +232,13 @@ public: Halffacet_cycle_iterator fci; for(fci=f->facet_cycles_begin(); fci!=f->facet_cycles_end(); ++fci) { - if(fci.is_shalfedge()) { + if(fci.is_shalfedge()) { SHalfedge_around_facet_circulator sfc(fci), send(sfc); - CGAL_For_all(sfc,send) { + CGAL_For_all(sfc,send) { CGAL_NEF_TRACEN(" insert constraint" << sfc->source()->source()->point() - << "->" << sfc->source()->twin()->source()->point()); - ct.insert_constraint(sfc->source()->source()->point(), - sfc->source()->twin()->source()->point()); + << "->" << sfc->source()->twin()->source()->point()); + ct.insert_constraint(sfc->source()->source()->point(), + sfc->source()->twin()->source()->point()); } } } @@ -262,9 +262,9 @@ public: /* for(fi = ct.finite_faces_begin(); fi != ct.finite_faces_end(); ++fi) - CGAL_NEF_TRACEN(" finite face " - << Triangle_3(fi->vertex(0)->point(), fi->vertex(1)->point(), fi->vertex(2)->point()) - << "was visited " << visited[fi]); + CGAL_NEF_TRACEN(" finite face " + << Triangle_3(fi->vertex(0)->point(), fi->vertex(1)->point(), fi->vertex(2)->point()) + << "was visited " << visited[fi]); */ fi = ct.finite_faces_begin(); @@ -273,15 +273,15 @@ public: void traverse_triangulation(Face_handle f, int parent) { visited[f] = true; if(!ct.is_constrained(Edge(f,ct.cw(parent))) && !visited[f->neighbor(ct.cw(parent))]) { - Face_handle child(f->neighbor(ct.cw(parent))); - traverse_triangulation(child, child->index(f)); - } + Face_handle child(f->neighbor(ct.cw(parent))); + traverse_triangulation(child, child->index(f)); + } if(!ct.is_constrained(Edge(f,ct.ccw(parent))) && !visited[f->neighbor(ct.ccw(parent))]) { - Face_handle child(f->neighbor(ct.ccw(parent))); - traverse_triangulation(child, child->index(f)); - } - } - + Face_handle child(f->neighbor(ct.ccw(parent))); + traverse_triangulation(child, child->index(f)); + } + } + template bool get_next_triangle(Triangle_3& tr) { while(fi != ct.finite_faces_end() && visited[fi] == false) ++fi; @@ -332,41 +332,41 @@ public: while(++length < stop && ++safc != send); if(length >= stop) { - CGAL_NEF_TRACEN("triangulate facet " << f->plane()); - - typedef typename CGAL::Projection_traits_xy_3 XY; - typedef typename CGAL::Projection_traits_yz_3 YZ; - typedef typename CGAL::Projection_traits_xz_3 XZ; - - Triangle_3 tr; - - Vector_3 orth = f->plane().orthogonal_vector(); - int c = CGAL::abs(orth[0]) > CGAL::abs(orth[1]) ? 0 : 1; - c = CGAL::abs(orth[2]) > CGAL::abs(orth[c]) ? 2 : c; - - if(c == 0) { - Triangulation_handler th(f); - while(th.get_next_triangle(tr)) { - Halffacet_triangle_handle th( f, tr); - objects.push_back(make_object(th)); - CGAL_NEF_TRACEN("add triangle " << tr); - } - } else if(c == 1) { - Triangulation_handler th(f); - while(th.get_next_triangle(tr)) { - Halffacet_triangle_handle th( f, tr); - objects.push_back(make_object(th)); - CGAL_NEF_TRACEN("add triangle " << tr); - } - } else if(c == 2) { - Triangulation_handler th(f); - while(th.get_next_triangle(tr)) { - Halffacet_triangle_handle th( f, tr); - objects.push_back(make_object(th)); - CGAL_NEF_TRACEN("add triangle " << tr); - } - } else - CGAL_error_msg( "wrong value"); + CGAL_NEF_TRACEN("triangulate facet " << f->plane()); + + typedef typename CGAL::Projection_traits_xy_3 XY; + typedef typename CGAL::Projection_traits_yz_3 YZ; + typedef typename CGAL::Projection_traits_xz_3 XZ; + + Triangle_3 tr; + + Vector_3 orth = f->plane().orthogonal_vector(); + int c = CGAL::abs(orth[0]) > CGAL::abs(orth[1]) ? 0 : 1; + c = CGAL::abs(orth[2]) > CGAL::abs(orth[c]) ? 2 : c; + + if(c == 0) { + Triangulation_handler th(f); + while(th.get_next_triangle(tr)) { + Halffacet_triangle_handle th( f, tr); + objects.push_back(make_object(th)); + CGAL_NEF_TRACEN("add triangle " << tr); + } + } else if(c == 1) { + Triangulation_handler th(f); + while(th.get_next_triangle(tr)) { + Halffacet_triangle_handle th( f, tr); + objects.push_back(make_object(th)); + CGAL_NEF_TRACEN("add triangle " << tr); + } + } else if(c == 2) { + Triangulation_handler th(f); + while(th.get_next_triangle(tr)) { + Halffacet_triangle_handle th( f, tr); + objects.push_back(make_object(th)); + CGAL_NEF_TRACEN("add triangle " << tr); + } + } else + CGAL_error_msg( "wrong value"); } else { CGAL_NEF_TRACEN("add facet " << f->plane()); objects.push_back(make_object(Halffacet_handle(f))); @@ -382,9 +382,9 @@ public: int stop = CGAL_NEF3_PARTITION_MINIMUM; while(++length < stop && ++safc != send); if(length >= stop) { - CGAL_NEF_TRACEN("use Partial facets "); - Partial_facet pf(f); - objects.push_back(make_object(pf)); + CGAL_NEF_TRACEN("use Partial facets "); + Partial_facet pf(f); + objects.push_back(make_object(pf)); } else { objects.push_back(make_object(Halffacet_handle(f))); } @@ -404,16 +404,16 @@ public: initialized = true; } - virtual Self* clone() const { - return new Self; + virtual Self* clone() const { + return new Self; } virtual void transform(const Aff_transformation_3& t) { candidate_provider->transform(t); } - virtual bool update( Unique_hash_map& V, - Unique_hash_map& E, + virtual bool update( Unique_hash_map& V, + Unique_hash_map& E, Unique_hash_map& F) { CGAL_NEF_TIMER(ct_t.start()); CGAL_assertion( initialized); @@ -423,8 +423,8 @@ public: } virtual ~SNC_point_locator_by_spatial_subdivision() { - CGAL_warning(initialized || - candidate_provider == 0); // required? + CGAL_warning(initialized || + candidate_provider == 0); // required? if(initialized) delete candidate_provider; } @@ -448,100 +448,100 @@ public: Halffacet_handle f; Objects_around_box oab; - typename Objects_around_box::Iterator + typename Objects_around_box::Iterator objects_iterator(oab.begin()); for( ; objects_iterator != oab.end(); ++objects_iterator) { Object_list candidates = *objects_iterator; Object_list_iterator o; CGAL_for_each( o, candidates) { - if(CGAL::assign(v, *o)) { - if(point_in_box(box, v->point())) - return true; - } else if(CGAL::assign(e, *o)) { - Point_3 ip; - Point_3 pmin(box.min_coord(0), box.min_coord(1), box.min_coord(2)); - Point_3 pmax(box.max_coord(0), box.max_coord(1), box.max_coord(2)); - Segment_3 seg(e->source()->point(), - e->twin()->source()->point()); + if(CGAL::assign(v, *o)) { + if(point_in_box(box, v->point())) + return true; + } else if(CGAL::assign(e, *o)) { + Point_3 ip; + Point_3 pmin(box.min_coord(0), box.min_coord(1), box.min_coord(2)); + Point_3 pmax(box.max_coord(0), box.max_coord(1), box.max_coord(2)); + Segment_3 seg(e->source()->point(), + e->twin()->source()->point()); - Plane_3 pl(pmin, Vector_3(1,0,0)); - Object o = intersection(pl, seg); - if(CGAL::assign(ip,o) && point_in_box(box, ip)) - return true; - pl = Plane_3(pmin, Vector_3(0,1,0)); - o = intersection(pl, seg); - if(CGAL::assign(ip,o) && point_in_box(box, ip)) - return true; - pl = Plane_3(pmin, Vector_3(0,0,1)); - o = intersection(pl, seg); - if(CGAL::assign(ip,o) && point_in_box(box, ip)) - return true; - pl = Plane_3(pmax, Vector_3(1,0,0)); - o = intersection(pl, seg); - if(CGAL::assign(ip,o) && point_in_box(box, ip)) - return true; - pl = Plane_3(pmax, Vector_3(0,1,0)); - o = intersection(pl, seg); - if(CGAL::assign(ip,o) && point_in_box(box, ip)) - return true; - pl = Plane_3(pmax, Vector_3(0,0,1)); - o = intersection(pl, seg); - if(CGAL::assign(ip,o) && point_in_box(box, ip)) - return true; - } else if(CGAL::assign(f, *o)) { - Segment_3 seg(Point_3(box.min_coord(0), box.min_coord(1), box.min_coord(2)), - Point_3(box.min_coord(0), box.min_coord(1), box.max_coord(2))); - if(is.does_intersect_internally(seg, f)) - return true; - seg = Segment_3(Point_3(box.max_coord(0), box.min_coord(1), box.min_coord(2)), - Point_3(box.max_coord(0), box.min_coord(1), box.max_coord(2))); - if(is.does_intersect_internally(seg, f)) - return true; - seg = Segment_3(Point_3(box.min_coord(0), box.max_coord(1), box.min_coord(2)), - Point_3(box.min_coord(0), box.max_coord(1), box.max_coord(2))); - if(is.does_intersect_internally(seg, f)) - return true; - seg = Segment_3(Point_3(box.max_coord(0), box.max_coord(1), box.min_coord(2)), - Point_3(box.max_coord(0), box.max_coord(1), box.max_coord(2))); - if(is.does_intersect_internally(seg, f)) - return true; + Plane_3 pl(pmin, Vector_3(1,0,0)); + Object o = intersection(pl, seg); + if(CGAL::assign(ip,o) && point_in_box(box, ip)) + return true; + pl = Plane_3(pmin, Vector_3(0,1,0)); + o = intersection(pl, seg); + if(CGAL::assign(ip,o) && point_in_box(box, ip)) + return true; + pl = Plane_3(pmin, Vector_3(0,0,1)); + o = intersection(pl, seg); + if(CGAL::assign(ip,o) && point_in_box(box, ip)) + return true; + pl = Plane_3(pmax, Vector_3(1,0,0)); + o = intersection(pl, seg); + if(CGAL::assign(ip,o) && point_in_box(box, ip)) + return true; + pl = Plane_3(pmax, Vector_3(0,1,0)); + o = intersection(pl, seg); + if(CGAL::assign(ip,o) && point_in_box(box, ip)) + return true; + pl = Plane_3(pmax, Vector_3(0,0,1)); + o = intersection(pl, seg); + if(CGAL::assign(ip,o) && point_in_box(box, ip)) + return true; + } else if(CGAL::assign(f, *o)) { + Segment_3 seg(Point_3(box.min_coord(0), box.min_coord(1), box.min_coord(2)), + Point_3(box.min_coord(0), box.min_coord(1), box.max_coord(2))); + if(is.does_intersect_internally(seg, f)) + return true; + seg = Segment_3(Point_3(box.max_coord(0), box.min_coord(1), box.min_coord(2)), + Point_3(box.max_coord(0), box.min_coord(1), box.max_coord(2))); + if(is.does_intersect_internally(seg, f)) + return true; + seg = Segment_3(Point_3(box.min_coord(0), box.max_coord(1), box.min_coord(2)), + Point_3(box.min_coord(0), box.max_coord(1), box.max_coord(2))); + if(is.does_intersect_internally(seg, f)) + return true; + seg = Segment_3(Point_3(box.max_coord(0), box.max_coord(1), box.min_coord(2)), + Point_3(box.max_coord(0), box.max_coord(1), box.max_coord(2))); + if(is.does_intersect_internally(seg, f)) + return true; - seg = Segment_3(Point_3(box.min_coord(0), box.min_coord(1), box.min_coord(2)), - Point_3(box.min_coord(0), box.max_coord(1), box.min_coord(2))); - if(is.does_intersect_internally(seg, f)) - return true; - seg = Segment_3(Point_3(box.max_coord(0), box.min_coord(1), box.min_coord(2)), - Point_3(box.max_coord(0), box.max_coord(1), box.min_coord(2))); - if(is.does_intersect_internally(seg, f)) - return true; - seg = Segment_3(Point_3(box.min_coord(0), box.min_coord(1), box.max_coord(2)), - Point_3(box.min_coord(0), box.max_coord(1), box.max_coord(2))); - if(is.does_intersect_internally(seg, f)) - return true; - seg = Segment_3(Point_3(box.max_coord(0), box.min_coord(1), box.max_coord(2)), - Point_3(box.max_coord(0), box.max_coord(1), box.max_coord(2))); - if(is.does_intersect_internally(seg, f)) - return true; + seg = Segment_3(Point_3(box.min_coord(0), box.min_coord(1), box.min_coord(2)), + Point_3(box.min_coord(0), box.max_coord(1), box.min_coord(2))); + if(is.does_intersect_internally(seg, f)) + return true; + seg = Segment_3(Point_3(box.max_coord(0), box.min_coord(1), box.min_coord(2)), + Point_3(box.max_coord(0), box.max_coord(1), box.min_coord(2))); + if(is.does_intersect_internally(seg, f)) + return true; + seg = Segment_3(Point_3(box.min_coord(0), box.min_coord(1), box.max_coord(2)), + Point_3(box.min_coord(0), box.max_coord(1), box.max_coord(2))); + if(is.does_intersect_internally(seg, f)) + return true; + seg = Segment_3(Point_3(box.max_coord(0), box.min_coord(1), box.max_coord(2)), + Point_3(box.max_coord(0), box.max_coord(1), box.max_coord(2))); + if(is.does_intersect_internally(seg, f)) + return true; - seg = Segment_3(Point_3(box.min_coord(0), box.min_coord(1), box.min_coord(2)), - Point_3(box.max_coord(0), box.min_coord(1), box.min_coord(2))); - if(is.does_intersect_internally(seg, f)) - return true; - seg = Segment_3(Point_3(box.min_coord(0), box.max_coord(1), box.min_coord(2)), - Point_3(box.max_coord(0), box.max_coord(1), box.min_coord(2))); - if(is.does_intersect_internally(seg, f)) - return true; - seg = Segment_3(Point_3(box.min_coord(0), box.min_coord(1), box.max_coord(2)), - Point_3(box.max_coord(0), box.min_coord(1), box.max_coord(2))); - if(is.does_intersect_internally(seg, f)) - return true; - seg = Segment_3(Point_3(box.min_coord(0), box.max_coord(1), box.max_coord(2)), - Point_3(box.max_coord(0), box.max_coord(1), box.max_coord(2))); - if(is.does_intersect_internally(seg, f)) - return true; + seg = Segment_3(Point_3(box.min_coord(0), box.min_coord(1), box.min_coord(2)), + Point_3(box.max_coord(0), box.min_coord(1), box.min_coord(2))); + if(is.does_intersect_internally(seg, f)) + return true; + seg = Segment_3(Point_3(box.min_coord(0), box.max_coord(1), box.min_coord(2)), + Point_3(box.max_coord(0), box.max_coord(1), box.min_coord(2))); + if(is.does_intersect_internally(seg, f)) + return true; + seg = Segment_3(Point_3(box.min_coord(0), box.min_coord(1), box.max_coord(2)), + Point_3(box.max_coord(0), box.min_coord(1), box.max_coord(2))); + if(is.does_intersect_internally(seg, f)) + return true; + seg = Segment_3(Point_3(box.min_coord(0), box.max_coord(1), box.max_coord(2)), + Point_3(box.max_coord(0), box.max_coord(1), box.max_coord(2))); + if(is.does_intersect_internally(seg, f)) + return true; - } else - CGAL_assertion_msg(false, "wrong handle"); + } else + CGAL_assertion_msg(false, "wrong handle"); } } return false; @@ -576,7 +576,7 @@ public: _CGAL_NEF_TRACEN("the ray intersects the vertex"); _CGAL_NEF_TRACEN("prev. intersection? "<point())) continue; eor = v->point(); @@ -593,14 +593,14 @@ public: _CGAL_NEF_TRACEN("ray intersects edge on "<is_point_on_cell( q, objects_iterator)); if( !candidate_provider->is_point_on_cell( q, objects_iterator)) continue; - eor = q; + eor = q; result = make_object(e); hit = true; _CGAL_NEF_TRACEN("the edge becomes the new hit object"); @@ -615,31 +615,31 @@ public: _CGAL_NEF_TRACEN("prev. intersection? "<is_point_on_cell( q, objects_iterator)); if( !candidate_provider->is_point_on_cell( q, objects_iterator)) - continue; + continue; eor = q; result = make_object(f); - hit = true; + hit = true; _CGAL_NEF_TRACEN("the facet becomes the new hit object"); } } #ifdef CGAL_NEF3_FACET_WITH_BOX - else if( CGAL::assign(pf, *o) && ((mask&4) != 0)) { - CGAL_NEF_TRACEN("new ray shooting"); + else if( CGAL::assign(pf, *o) && ((mask&4) != 0)) { + CGAL_NEF_TRACEN("new ray shooting"); Point_3 q; if( is.does_intersect_internally( ray, pf, q) ) { if( hit && !has_smaller_distance_to_point( ray.source(), q, eor)) - continue; + continue; if( !candidate_provider->is_point_on_cell( q, objects_iterator)) - continue; + continue; eor = q; result = make_object(pf.f); - hit = true; + hit = true; } - } + } #endif #ifdef CGAL_NEF3_TRIANGULATE_FACETS else if( CGAL::assign( t, *o) && ((mask&8) != 0)) { @@ -662,7 +662,7 @@ public: continue; eor = q; result = make_object(Halffacet_handle(t)); - hit = true; + hit = true; _CGAL_NEF_TRACEN("the facet becomes the new hit object"); } } @@ -722,18 +722,18 @@ public: Triangle_3 tr = t.get_triangle(); if( tr.has_on(p)) { _CGAL_NEF_TRACEN("found on triangle "<point(),p); if(tmp_distance < min_distance) { - result = make_object(v); + result = make_object(v); min_distance = tmp_distance; } ++o; - } + } CGAL::assign(v, result); Segment_3 s(p,v->point()); @@ -806,81 +806,81 @@ public: // TODO: das geht effizienter Object_list_iterator of(o); while(of != candidates.end() && assign(e, *of)) ++of; - + typename SNC_structure::SHalfedge_iterator sei; - for(sei=v->shalfedges_begin(); sei!=v->shalfedges_end(); ++sei){ + for(sei=v->shalfedges_begin(); sei!=v->shalfedges_end(); ++sei){ if(sei->is_twin()) continue; Halffacet_handle fout = sei->facet(); if(fout->is_twin()) fout = fout->twin(); - Object_list_iterator ofc(of); + Object_list_iterator ofc(of); for(;ofc!=candidates.end();++ofc) { - if(CGAL::assign(f,*ofc)) { - if(f == fout->twin()) - std::cerr << "shit" << std::endl; - if(f == fout) { - Object_list_iterator oe(ofc); - --ofc; - candidates.erase(oe); - } - } + if(CGAL::assign(f,*ofc)) { + if(f == fout->twin()) + std::cerr << "shit" << std::endl; + if(f == fout) { + Object_list_iterator oe(ofc); + --ofc; + candidates.erase(oe); + } + } } } */ for(;o!=candidates.end();++o) { if( CGAL::assign( e, *o)) { - // if(first && - // (e->source() == v || e->twin()->source() == v)) continue; - Segment_3 ss(e->source()->point(),e->twin()->source()->point()); - CGAL_NEF_TRACEN("test edge " << e->source()->point() << "->" << e->twin()->source()->point()); - if(is.does_contain_internally(ss, p) ) { - _CGAL_NEF_TRACEN("found on edge "<< ss); + // if(first && + // (e->source() == v || e->twin()->source() == v)) continue; + Segment_3 ss(e->source()->point(),e->twin()->source()->point()); + CGAL_NEF_TRACEN("test edge " << e->source()->point() << "->" << e->twin()->source()->point()); + if(is.does_contain_internally(ss, p) ) { + _CGAL_NEF_TRACEN("found on edge "<< ss); return make_object(e); } - if(is.does_intersect_internally(s, ss, ip)) { - // first = false; - s = Segment_3(p, normalized(ip)); - result = make_object(e); + if(is.does_intersect_internally(s, ss, ip)) { + // first = false; + s = Segment_3(p, normalized(ip)); + result = make_object(e); } - } else + } else if( CGAL::assign( f, *o)) { - CGAL_NEF_TRACEN("test facet " << f->plane()); + CGAL_NEF_TRACEN("test facet " << f->plane()); if (is.does_contain_internally(f,p) ) { _CGAL_NEF_TRACEN("found on facet..."); return make_object(f); } if( is.does_intersect_internally(s,f,ip)) { s = Segment_3(p, normalized(ip)); - result = make_object(f); + result = make_object(f); } #ifdef CGAL_NEF3_FACET_WITH_BOX } else if( CGAL::assign(pf, *o)) { - CGAL_NEF_TRACEN("new locate "); - if ( is.does_contain_internally( pf, p) ) { - _CGAL_NEF_TRACEN("found on partial facet..."); - return make_object(pf.f); - } - if( is.does_intersect_internally(s,pf,ip)) { + CGAL_NEF_TRACEN("new locate "); + if ( is.does_contain_internally( pf, p) ) { + _CGAL_NEF_TRACEN("found on partial facet..."); + return make_object(pf.f); + } + if( is.does_intersect_internally(s,pf,ip)) { s = Segment_3(p, normalized(ip)); - result = make_object(pf.f); + result = make_object(pf.f); } #endif #ifdef CGAL_NEF3_TRIANGULATE_FACETS } else if( CGAL::assign(t, *o)) { CGAL_NEF_TRACEN("test triangle of facet " << t->plane()); Triangle_3 tr = t.get_triangle(); - CGAL_NEF_TRACEN("trying triangle "<sncp()) { - CGAL_assertion(!is.does_intersect_internally(s,f,ip)); + CGAL_assertion(!is.does_intersect_internally(s,f,ip)); } - + Halfedge_iterator ec; CGAL_forall_edges(ec, *this->sncp()) { - Segment_3 ss(ec->source()->point(), ec->twin()->source()->point()); - CGAL_assertion(!is.does_intersect_internally(s,ss,ip)); + Segment_3 ss(ec->source()->point(), ec->twin()->source()->point()); + CGAL_assertion(!is.does_intersect_internally(s,ss,ip)); } Vertex_iterator vc; CGAL_forall_vertices(vc, *this->sncp()) { - std::cerr << "test vertex " << vc->point() << std::endl; - CGAL_assertion(vc->point() == s.target() || !s.has_on(vc->point())); + std::cerr << "test vertex " << vc->point() << std::endl; + CGAL_assertion(vc->point() == s.target() || !s.has_on(vc->point())); } */ @@ -921,47 +921,47 @@ public: CGAL_assertion(CGAL::assign(se,so)); CGAL_NEF_TRACEN("intersect segment " << s << " with edges"); for(;ox!=candidates.end();++ox) { - if(!CGAL::assign(e,*ox)) continue; - CGAL_NEF_TRACEN("test edge " << e->source()->point() << "->" << e->twin()->source()->point()); - if(is.does_intersect_internally(s,Segment_3(e->source()->point(),e->twin()->source()->point()),ip)) { - s = Segment_3(p, normalized(ip)); - result = make_object(e); + if(!CGAL::assign(e,*ox)) continue; + CGAL_NEF_TRACEN("test edge " << e->source()->point() << "->" << e->twin()->source()->point()); + if(is.does_intersect_internally(s,Segment_3(e->source()->point(),e->twin()->source()->point()),ip)) { + s = Segment_3(p, normalized(ip)); + result = make_object(e); } } CGAL_assertion(CGAL::assign(e,result)); CGAL::assign(e,result); - f = get_visible_facet(e, Ray_3(p, s.target())); + f = get_visible_facet(e, Ray_3(p, s.target())); if( f != Halffacet_handle()) - return f->incident_volume(); + return f->incident_volume(); SM_decorator SD(&*v); // now, the vertex has no incident facets CGAL_assertion( SD.number_of_sfaces() == 1); - return SD.sfaces_begin()->volume(); + return SD.sfaces_begin()->volume(); */ } else if( CGAL::assign( f, result)) { _CGAL_NEF_TRACEN("facet hit, obtaining volume..."); if(f->plane().oriented_side(p) == ON_NEGATIVE_SIDE) - f = f->twin(); + f = f->twin(); return make_object(f->incident_volume()); #ifdef CGAL_NEF3_FACET_WITH_BOX } else if( CGAL::assign(pf, *o)) { CGAL_error_msg( "should not be executed"); Halffacet_handle f = pf.f; if(f->plane().oriented_side(p) == ON_NEGATIVE_SIDE) - f = f->twin(); - return make_object(f->incident_volume()); + f = f->twin(); + return make_object(f->incident_volume()); #endif #ifdef CGAL_NEF3_TRIANGULATE_FACETS } else if( CGAL::assign(t, result)) { f = t; _CGAL_NEF_TRACEN("facet hit, obtaining volume..."); if(f->plane().oriented_side(p) == ON_NEGATIVE_SIDE) - f = f->twin(); + f = f->twin(); return make_object(f->incident_volume()); #endif } else if( CGAL::assign(e, result)) { SM_decorator SD(&*e->source()); if( SD.is_isolated(e)) - return make_object(e->incident_sface()->volume()); + return make_object(e->incident_sface()->volume()); return make_object(get_visible_facet(e,Ray_3(s.source(),s.to_vector()))->incident_volume()); } CGAL_error_msg( "wrong handle type"); @@ -970,7 +970,7 @@ public: } virtual void intersect_with_edges_and_facets( Halfedge_handle e0, - const typename SNC_point_locator::Intersection_call_back& call_back) const { + const typename SNC_point_locator::Intersection_call_back& call_back) const { CGAL_NEF_TIMER(it_t.start()); CGAL_assertion( initialized); @@ -1005,7 +1005,7 @@ public: Point_3 q; if( is.does_intersect_internally( s, Segment_3(e->source()->point(), - e->twin()->source()->point()), q)) { + e->twin()->source()->point()), q)) { q = normalized(q); call_back( e0, make_object(Halfedge_handle(e)), q); _CGAL_NEF_TRACEN("edge intersects edge "<<' '<<&*e<< Segment_3(e->source()->point(), @@ -1025,24 +1025,24 @@ public: } } #ifdef CGAL_NEF3_FACET_WITH_BOX - else if( CGAL::assign(pf, *o)) { - CGAL_error_msg( "not implemented yet"); - } + else if( CGAL::assign(pf, *o)) { + CGAL_error_msg( "not implemented yet"); + } #endif #ifdef CGAL_NEF3_TRIANGULATE_FACETS else if( CGAL::assign( t, *o)) { Point_3 q; Triangle_3 tr = t.get_triangle(); - if( f_mark[t]) - continue; - _CGAL_NEF_TRACEN("trying with triangle "<plane()<<" on "<source()->point(), - e->twin()->source()->point()), q)) { + e->twin()->source()->point()), q)) { q = normalized(q); call_back( e0, make_object(Halfedge_handle(e)), q); _CGAL_NEF_TRACEN("edge intersects edge "<<' '<<&*e<< Segment_3(e->source()->point(), @@ -1093,9 +1093,9 @@ public: /* do nothing */ } #ifdef CGAL_NEF3_FACET_WITH_BOX - else if( CGAL::assign(pf, *o)) { - CGAL_error_msg( "not implemented yet"); - } + else if( CGAL::assign(pf, *o)) { + CGAL_error_msg( "not implemented yet"); + } #endif #ifdef CGAL_NEF3_TRIANGULATE_FACETS else if( CGAL::assign( t, *o)) { @@ -1108,7 +1108,7 @@ public: CGAL_NEF_TIMER(it_t.stop()); } - virtual void intersect_with_facets( Halfedge_handle e0, + virtual void intersect_with_facets( Halfedge_handle e0, const typename SNC_point_locator::Intersection_call_back& call_back) const { CGAL_NEF_TIMER(it_t.start()); CGAL_assertion( initialized); @@ -1151,22 +1151,22 @@ public: } #ifdef CGAL_NEF3_FACET_WITH_BOX else if( CGAL::assign(pf, *o)) { - CGAL_error_msg( "not implemented yet"); + CGAL_error_msg( "not implemented yet"); } #endif #ifdef CGAL_NEF3_TRIANGULATE_FACETS else if( CGAL::assign( t, *o)) { Point_3 q; Triangle_3 tr = t.get_triangle(); - if( f_mark[t]) - continue; - _CGAL_NEF_TRACEN("trying with triangle "<plane()<<" on "<add_edge(e); + candidate_provider->add_edge(e); } void add_vertex(Vertex_handle v) { @@ -1234,8 +1234,8 @@ private: #ifdef CGAL_NEF3_POINT_LOCATOR_NAIVE template -class SNC_point_locator_naive : - public SNC_ray_shooter, +class SNC_point_locator_naive : + public SNC_ray_shooter, public SNC_point_locator { typedef typename SNC_decorator::SNC_structure SNC_structure; @@ -1251,7 +1251,7 @@ public: typedef typename SNC_decorator::Point_3 Point_3; typedef typename SNC_decorator::Segment_3 Segment_3; typedef typename SNC_decorator::Ray_3 Ray_3; - typedef typename SNC_structure::Aff_transformation_3 + typedef typename SNC_structure::Aff_transformation_3 Aff_transformation_3; typedef typename Decorator_traits::Vertex_handle Vertex_handle; @@ -1264,22 +1264,22 @@ public: public: SNC_point_locator_naive() : initialized(false) {} - virtual void initialize(SNC_structure* W) { + virtual void initialize(SNC_structure* W) { CGAL_NEF_TIMER(ct_t.start()); this->version_ = std::string("Naive Point Locator (tm)"); CGAL_NEF_CLOG(version()); CGAL_assertion( W != nullptr); - Base::initialize(W); + Base::initialize(W); initialized = true; CGAL_NEF_TIMER(ct_t.stop()); } - virtual Self* clone() const { - return new Self; + virtual Self* clone() const { + return new Self; } - virtual bool update( Unique_hash_map& V, - Unique_hash_map& E, + virtual bool update( Unique_hash_map& V, + Unique_hash_map& E, Unique_hash_map& F) { CGAL_NEF_TIMER(ct_t.start()); CGAL_assertion( initialized); @@ -1307,11 +1307,11 @@ public: virtual void intersect_with_edges_and_facets(Halfedge_handle e0, const typename SNC_point_locator::Intersection_call_back& call_back) const { - intersect_with_edges(e0,call_back); - intersect_with_facets(e0,call_back); + intersect_with_edges(e0,call_back); + intersect_with_facets(e0,call_back); } - virtual void intersect_with_edges( Halfedge_handle e0, + virtual void intersect_with_edges( Halfedge_handle e0, const typename SNC_point_locator::Intersection_call_back& call_back) const { CGAL_NEF_TIMER(it_t.start()); CGAL_assertion( initialized); @@ -1338,7 +1338,7 @@ public: CGAL_NEF_TIMER(it_t.stop()); } - virtual void intersect_with_facets( Halfedge_handle e0, + virtual void intersect_with_facets( Halfedge_handle e0, const typename SNC_point_locator::Intersection_call_back& call_back) const { CGAL_NEF_TIMER(it_t.start()); CGAL_assertion( initialized); diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Kernel_d_interface.h b/NewKernel_d/include/CGAL/NewKernel_d/Kernel_d_interface.h index 01008336965..23e2fad48d0 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Kernel_d_interface.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Kernel_d_interface.h @@ -23,150 +23,150 @@ template struct Kernel_d_interface : public Base_ { constexpr Kernel_d_interface(){} constexpr Kernel_d_interface(int d):Base_(d){} - typedef Base_ Base; - typedef Kernel_d_interface Kernel; - typedef Base_ R_; // for the macros - typedef typename Get_type::type RT; - typedef typename Get_type::type FT; - typedef typename Get_type::type Boolean; - typedef typename Get_type::type Sign; - typedef typename Get_type::type Comparison_result; - typedef typename Get_type::type Orientation; - typedef typename Get_type::type Oriented_side; - typedef typename Get_type::type Bounded_side; - typedef typename Get_type::type Angle; - typedef typename Get_type::type Flat_orientation_d; - typedef typename Get_type::type Point_d; - typedef typename Get_type::type Vector_d; - typedef typename Get_type::type Segment_d; - typedef typename Get_type::type Sphere_d; - typedef typename Get_type::type Hyperplane_d; - typedef Vector_d Direction_d; - typedef typename Get_type::type Line_d; - typedef typename Get_type::type Ray_d; - typedef typename Get_type::type Iso_box_d; - typedef typename Get_type::type Aff_transformation_d; - typedef typename Get_type::type Weighted_point_d; - typedef typename Get_functor::type Compute_coordinate_d; - typedef typename Get_functor::type Compare_lexicographically_d; - typedef typename Get_functor::type Equal_d; - typedef typename Get_functor::type Less_lexicographically_d; - typedef typename Get_functor::type Less_or_equal_lexicographically_d; - // FIXME: and vectors? - typedef typename Get_functor::type Orientation_d; - typedef typename Get_functor::type Less_coordinate_d; - typedef typename Get_functor::type Point_dimension_d; - typedef typename Get_functor::type Side_of_oriented_sphere_d; - typedef typename Get_functor::type Power_side_of_power_sphere_d; + typedef Base_ Base; + typedef Kernel_d_interface Kernel; + typedef Base_ R_; // for the macros + typedef typename Get_type::type RT; + typedef typename Get_type::type FT; + typedef typename Get_type::type Boolean; + typedef typename Get_type::type Sign; + typedef typename Get_type::type Comparison_result; + typedef typename Get_type::type Orientation; + typedef typename Get_type::type Oriented_side; + typedef typename Get_type::type Bounded_side; + typedef typename Get_type::type Angle; + typedef typename Get_type::type Flat_orientation_d; + typedef typename Get_type::type Point_d; + typedef typename Get_type::type Vector_d; + typedef typename Get_type::type Segment_d; + typedef typename Get_type::type Sphere_d; + typedef typename Get_type::type Hyperplane_d; + typedef Vector_d Direction_d; + typedef typename Get_type::type Line_d; + typedef typename Get_type::type Ray_d; + typedef typename Get_type::type Iso_box_d; + typedef typename Get_type::type Aff_transformation_d; + typedef typename Get_type::type Weighted_point_d; + typedef typename Get_functor::type Compute_coordinate_d; + typedef typename Get_functor::type Compare_lexicographically_d; + typedef typename Get_functor::type Equal_d; + typedef typename Get_functor::type Less_lexicographically_d; + typedef typename Get_functor::type Less_or_equal_lexicographically_d; + // FIXME: and vectors? + typedef typename Get_functor::type Orientation_d; + typedef typename Get_functor::type Less_coordinate_d; + typedef typename Get_functor::type Point_dimension_d; + typedef typename Get_functor::type Side_of_oriented_sphere_d; + typedef typename Get_functor::type Power_side_of_power_sphere_d; typedef typename Get_functor::type Power_side_of_bounded_power_sphere_d; - typedef typename Get_functor::type Power_center_d; - typedef typename Get_functor::type Power_distance_d; - typedef typename Get_functor::type Contained_in_affine_hull_d; - typedef typename Get_functor::type Construct_flat_orientation_d; - typedef typename Get_functor::type In_flat_orientation_d; - typedef typename Get_functor::type In_flat_side_of_oriented_sphere_d; - typedef typename Get_functor::type In_flat_power_side_of_power_sphere_d; - typedef typename Get_functor::type Point_to_vector_d; - typedef typename Get_functor::type Vector_to_point_d; - typedef typename Get_functor::type Translated_point_d; - typedef typename Get_functor::type Scaled_vector_d; - typedef typename Get_functor::type Difference_of_vectors_d; - typedef typename Get_functor::type Difference_of_points_d; - //typedef typename Get_functor >::type Construct_point_d; - struct Construct_point_d : private Store_kernel { - typedef Kernel R_; // for the macro - CGAL_FUNCTOR_INIT_STORE(Construct_point_d) - typedef typename Get_functor >::type CP; - typedef Point_d result_type; - Point_d operator()(Weighted_point_d const&wp)const{ - return typename Get_functor::type(this->kernel())(wp); - } - Point_d operator()(Weighted_point_d &wp)const{ - return typename Get_functor::type(this->kernel())(wp); - } - Point_d operator()(Weighted_point_d &&wp)const{ - return typename Get_functor::type(this->kernel())(std::move(wp)); - } - Point_d operator()(Weighted_point_d const&&wp)const{ - return typename Get_functor::type(this->kernel())(std::move(wp)); - } - template - decltype(auto) - operator()(T&&...t)const{ - return CP(this->kernel())(std::forward(t)...); - } - }; - typedef typename Get_functor >::type Construct_vector_d; - typedef typename Get_functor >::type Construct_segment_d; - typedef typename Get_functor >::type Construct_sphere_d; - typedef typename Get_functor >::type Construct_hyperplane_d; - typedef Construct_vector_d Construct_direction_d; - typedef typename Get_functor >::type Construct_line_d; - typedef typename Get_functor >::type Construct_ray_d; - typedef typename Get_functor >::type Construct_iso_box_d; - typedef typename Get_functor >::type Construct_aff_transformation_d; - typedef typename Get_functor >::type Construct_weighted_point_d; - typedef typename Get_functor::type Midpoint_d; - struct Component_accessor_d : private Store_kernel { - typedef Kernel R_; // for the macro - CGAL_FUNCTOR_INIT_STORE(Component_accessor_d) - int dimension(Point_d const&p){ - return this->kernel().point_dimension_d_object()(p); - } - FT cartesian(Point_d const&p, int i){ - return this->kernel().compute_coordinate_d_object()(p,i); - } - RT homogeneous(Point_d const&p, int i){ - if (i == dimension(p)) - return 1; - return cartesian(p, i); - } - }; - struct Construct_cartesian_const_iterator_d : private Store_kernel { - CGAL_FUNCTOR_INIT_STORE(Construct_cartesian_const_iterator_d) - typedef typename Get_functor >::type CPI; - typedef typename Get_functor >::type CVI; - // FIXME: The following sometimes breaks compilation. The typedef below forces instantiation of this, which forces Point_d, which itself (in the wrapper) needs the derived kernel to tell it what the base kernel is, and that's a cycle. The exact circumstances are not clear, g++ and clang++ are ok in both C++03 and C++11, it is only clang in C++11 without CGAL_CXX11 that breaks. Relying on CPI::result_type is great for Epick_d but not Epeck_d. - //typedef typename CGAL::decay::type>::type result_type; - //typedef typename CGAL::decay::type result_type; - //typedef decltype(std::declval()(std::declval(),Begin_tag{})) result_type; - // HACK - typedef typename Base::Point_cartesian_const_iterator result_type; - // Kernel_d requires a common iterator type for points and vectors - // TODO: provide this mixed functor in preKernel? - //CGAL_static_assertion((boost::is_same::type>::type, result_type>::value)); - //CGAL_static_assertion((boost::is_same::type, result_type>::value)); - template - auto operator()(Point_d const&p, Tag_ t)const{ - return CPI(this->kernel())(p,t); - } - template - auto operator()(typename First_if_different::Type const&v, Tag_ t)const{ - return CVI(this->kernel())(v,t); - } + typedef typename Get_functor::type Power_center_d; + typedef typename Get_functor::type Power_distance_d; + typedef typename Get_functor::type Contained_in_affine_hull_d; + typedef typename Get_functor::type Construct_flat_orientation_d; + typedef typename Get_functor::type In_flat_orientation_d; + typedef typename Get_functor::type In_flat_side_of_oriented_sphere_d; + typedef typename Get_functor::type In_flat_power_side_of_power_sphere_d; + typedef typename Get_functor::type Point_to_vector_d; + typedef typename Get_functor::type Vector_to_point_d; + typedef typename Get_functor::type Translated_point_d; + typedef typename Get_functor::type Scaled_vector_d; + typedef typename Get_functor::type Difference_of_vectors_d; + typedef typename Get_functor::type Difference_of_points_d; + //typedef typename Get_functor >::type Construct_point_d; + struct Construct_point_d : private Store_kernel { + typedef Kernel R_; // for the macro + CGAL_FUNCTOR_INIT_STORE(Construct_point_d) + typedef typename Get_functor >::type CP; + typedef Point_d result_type; + Point_d operator()(Weighted_point_d const&wp)const{ + return typename Get_functor::type(this->kernel())(wp); + } + Point_d operator()(Weighted_point_d &wp)const{ + return typename Get_functor::type(this->kernel())(wp); + } + Point_d operator()(Weighted_point_d &&wp)const{ + return typename Get_functor::type(this->kernel())(std::move(wp)); + } + Point_d operator()(Weighted_point_d const&&wp)const{ + return typename Get_functor::type(this->kernel())(std::move(wp)); + } + template + decltype(auto) + operator()(T&&...t)const{ + return CP(this->kernel())(std::forward(t)...); + } + }; + typedef typename Get_functor >::type Construct_vector_d; + typedef typename Get_functor >::type Construct_segment_d; + typedef typename Get_functor >::type Construct_sphere_d; + typedef typename Get_functor >::type Construct_hyperplane_d; + typedef Construct_vector_d Construct_direction_d; + typedef typename Get_functor >::type Construct_line_d; + typedef typename Get_functor >::type Construct_ray_d; + typedef typename Get_functor >::type Construct_iso_box_d; + typedef typename Get_functor >::type Construct_aff_transformation_d; + typedef typename Get_functor >::type Construct_weighted_point_d; + typedef typename Get_functor::type Midpoint_d; + struct Component_accessor_d : private Store_kernel { + typedef Kernel R_; // for the macro + CGAL_FUNCTOR_INIT_STORE(Component_accessor_d) + int dimension(Point_d const&p){ + return this->kernel().point_dimension_d_object()(p); + } + FT cartesian(Point_d const&p, int i){ + return this->kernel().compute_coordinate_d_object()(p,i); + } + RT homogeneous(Point_d const&p, int i){ + if (i == dimension(p)) + return 1; + return cartesian(p, i); + } + }; + struct Construct_cartesian_const_iterator_d : private Store_kernel { + CGAL_FUNCTOR_INIT_STORE(Construct_cartesian_const_iterator_d) + typedef typename Get_functor >::type CPI; + typedef typename Get_functor >::type CVI; + // FIXME: The following sometimes breaks compilation. The typedef below forces instantiation of this, which forces Point_d, which itself (in the wrapper) needs the derived kernel to tell it what the base kernel is, and that's a cycle. The exact circumstances are not clear, g++ and clang++ are ok in both C++03 and C++11, it is only clang in C++11 without CGAL_CXX11 that breaks. Relying on CPI::result_type is great for Epick_d but not Epeck_d. + //typedef typename CGAL::decay::type>::type result_type; + //typedef typename CGAL::decay::type result_type; + //typedef decltype(std::declval()(std::declval(),Begin_tag{})) result_type; + // HACK + typedef typename Base::Point_cartesian_const_iterator result_type; + // Kernel_d requires a common iterator type for points and vectors + // TODO: provide this mixed functor in preKernel? + //CGAL_static_assertion((boost::is_same::type>::type, result_type>::value)); + //CGAL_static_assertion((boost::is_same::type, result_type>::value)); + template + auto operator()(Point_d const&p, Tag_ t)const{ + return CPI(this->kernel())(p,t); + } + template + auto operator()(typename First_if_different::Type const&v, Tag_ t)const{ + return CVI(this->kernel())(v,t); + } - template - auto operator()(Obj const&o)const{ - return operator()(o, Begin_tag()); - } - auto operator()(Point_d const&p, int)const{ - return operator()(p, End_tag()); - } - auto operator()(typename First_if_different::Type const&v, int)const{ - return operator()(v, End_tag()); - } - }; - struct Compute_squared_radius_d : private Store_kernel { - typedef Kernel R_; // for the macro - CGAL_FUNCTOR_INIT_STORE(Compute_squared_radius_d) - typedef FT result_type; - template FT operator()(S&& s)const{ - return typename Get_functor::type(this->kernel())(std::forward(s)); - } - template FT operator()(I b, I e)const{ - return typename Get_functor::type(this->kernel())(b,e); - } - }; + template + auto operator()(Obj const&o)const{ + return operator()(o, Begin_tag()); + } + auto operator()(Point_d const&p, int)const{ + return operator()(p, End_tag()); + } + auto operator()(typename First_if_different::Type const&v, int)const{ + return operator()(v, End_tag()); + } + }; + struct Compute_squared_radius_d : private Store_kernel { + typedef Kernel R_; // for the macro + CGAL_FUNCTOR_INIT_STORE(Compute_squared_radius_d) + typedef FT result_type; + template FT operator()(S&& s)const{ + return typename Get_functor::type(this->kernel())(std::forward(s)); + } + template FT operator()(I b, I e)const{ + return typename Get_functor::type(this->kernel())(b,e); + } + }; struct Compute_squared_radius_smallest_orthogonal_sphere_d : private Store_kernel { typedef Kernel R_; // for the macro CGAL_FUNCTOR_INIT_STORE(Compute_squared_radius_smallest_orthogonal_sphere_d) @@ -177,112 +177,112 @@ template struct Kernel_d_interface : public Base_ { return pw(pc(b,e)); } }; - typedef typename Construct_cartesian_const_iterator_d::result_type Cartesian_const_iterator_d; - typedef typename Get_functor::type Squared_distance_d; - typedef typename Get_functor::type Squared_length_d; - typedef typename Get_functor::type Scalar_product_d; - typedef typename Get_functor::type Affine_rank_d; - typedef typename Get_functor::type Affinely_independent_d; - typedef typename Get_functor::type Contained_in_linear_hull_d; - typedef typename Get_functor::type Contained_in_simplex_d; - typedef typename Get_functor::type Has_on_positive_side_d; - typedef typename Get_functor::type Linear_rank_d; - typedef typename Get_functor::type Linearly_independent_d; - typedef typename Get_functor::type Oriented_side_d; - typedef typename Get_functor::type Side_of_bounded_sphere_d; + typedef typename Construct_cartesian_const_iterator_d::result_type Cartesian_const_iterator_d; + typedef typename Get_functor::type Squared_distance_d; + typedef typename Get_functor::type Squared_length_d; + typedef typename Get_functor::type Scalar_product_d; + typedef typename Get_functor::type Affine_rank_d; + typedef typename Get_functor::type Affinely_independent_d; + typedef typename Get_functor::type Contained_in_linear_hull_d; + typedef typename Get_functor::type Contained_in_simplex_d; + typedef typename Get_functor::type Has_on_positive_side_d; + typedef typename Get_functor::type Linear_rank_d; + typedef typename Get_functor::type Linearly_independent_d; + typedef typename Get_functor::type Oriented_side_d; + typedef typename Get_functor::type Side_of_bounded_sphere_d; - typedef typename Get_functor::type Center_of_sphere_d; - typedef Center_of_sphere_d Construct_center_d; // RangeSearchTraits - typedef typename Get_functor::type Construct_circumcenter_d; - typedef typename Get_functor::type Value_at_d; - typedef typename Get_functor::type Point_of_sphere_d; - typedef typename Get_functor::type Orthogonal_vector_d; - typedef typename Get_functor::type Linear_base_d; - typedef typename Get_functor::type Construct_min_vertex_d; - typedef typename Get_functor::type Construct_max_vertex_d; + typedef typename Get_functor::type Center_of_sphere_d; + typedef Center_of_sphere_d Construct_center_d; // RangeSearchTraits + typedef typename Get_functor::type Construct_circumcenter_d; + typedef typename Get_functor::type Value_at_d; + typedef typename Get_functor::type Point_of_sphere_d; + typedef typename Get_functor::type Orthogonal_vector_d; + typedef typename Get_functor::type Linear_base_d; + typedef typename Get_functor::type Construct_min_vertex_d; + typedef typename Get_functor::type Construct_max_vertex_d; - typedef typename Get_functor::type Compute_weight_d; - typedef typename Get_functor::type Point_drop_weight_d; + typedef typename Get_functor::type Compute_weight_d; + typedef typename Get_functor::type Point_drop_weight_d; - //TODO: - //typedef ??? Intersect_d; + //TODO: + //typedef ??? Intersect_d; - Compute_coordinate_d compute_coordinate_d_object()const{ return Compute_coordinate_d(*this); } - Has_on_positive_side_d has_on_positive_side_d_object()const{ return Has_on_positive_side_d(*this); } - Compare_lexicographically_d compare_lexicographically_d_object()const{ return Compare_lexicographically_d(*this); } - Equal_d equal_d_object()const{ return Equal_d(*this); } - Less_lexicographically_d less_lexicographically_d_object()const{ return Less_lexicographically_d(*this); } - Less_or_equal_lexicographically_d less_or_equal_lexicographically_d_object()const{ return Less_or_equal_lexicographically_d(*this); } - Less_coordinate_d less_coordinate_d_object()const{ return Less_coordinate_d(*this); } - Orientation_d orientation_d_object()const{ return Orientation_d(*this); } - Oriented_side_d oriented_side_d_object()const{ return Oriented_side_d(*this); } - Point_dimension_d point_dimension_d_object()const{ return Point_dimension_d(*this); } - Point_of_sphere_d point_of_sphere_d_object()const{ return Point_of_sphere_d(*this); } - Side_of_oriented_sphere_d side_of_oriented_sphere_d_object()const{ return Side_of_oriented_sphere_d(*this); } - Power_side_of_power_sphere_d power_side_of_power_sphere_d_object()const{ return Power_side_of_power_sphere_d(*this); } + Compute_coordinate_d compute_coordinate_d_object()const{ return Compute_coordinate_d(*this); } + Has_on_positive_side_d has_on_positive_side_d_object()const{ return Has_on_positive_side_d(*this); } + Compare_lexicographically_d compare_lexicographically_d_object()const{ return Compare_lexicographically_d(*this); } + Equal_d equal_d_object()const{ return Equal_d(*this); } + Less_lexicographically_d less_lexicographically_d_object()const{ return Less_lexicographically_d(*this); } + Less_or_equal_lexicographically_d less_or_equal_lexicographically_d_object()const{ return Less_or_equal_lexicographically_d(*this); } + Less_coordinate_d less_coordinate_d_object()const{ return Less_coordinate_d(*this); } + Orientation_d orientation_d_object()const{ return Orientation_d(*this); } + Oriented_side_d oriented_side_d_object()const{ return Oriented_side_d(*this); } + Point_dimension_d point_dimension_d_object()const{ return Point_dimension_d(*this); } + Point_of_sphere_d point_of_sphere_d_object()const{ return Point_of_sphere_d(*this); } + Side_of_oriented_sphere_d side_of_oriented_sphere_d_object()const{ return Side_of_oriented_sphere_d(*this); } + Power_side_of_power_sphere_d power_side_of_power_sphere_d_object()const{ return Power_side_of_power_sphere_d(*this); } Power_side_of_bounded_power_sphere_d power_side_of_bounded_power_sphere_d_object()const{ return Power_side_of_bounded_power_sphere_d(*this); } - Power_center_d power_center_d_object()const{ return Power_center_d(*this); } - Power_distance_d power_distance_d_object()const{ return Power_distance_d(*this); } - Side_of_bounded_sphere_d side_of_bounded_sphere_d_object()const{ return Side_of_bounded_sphere_d(*this); } - Contained_in_affine_hull_d contained_in_affine_hull_d_object()const{ return Contained_in_affine_hull_d(*this); } - Contained_in_linear_hull_d contained_in_linear_hull_d_object()const{ return Contained_in_linear_hull_d(*this); } - Contained_in_simplex_d contained_in_simplex_d_object()const{ return Contained_in_simplex_d(*this); } - Construct_flat_orientation_d construct_flat_orientation_d_object()const{ return Construct_flat_orientation_d(*this); } - In_flat_orientation_d in_flat_orientation_d_object()const{ return In_flat_orientation_d(*this); } - In_flat_side_of_oriented_sphere_d in_flat_side_of_oriented_sphere_d_object()const{ return In_flat_side_of_oriented_sphere_d(*this); } - In_flat_power_side_of_power_sphere_d in_flat_power_side_of_power_sphere_d_object()const{ return In_flat_power_side_of_power_sphere_d(*this); } - Point_to_vector_d point_to_vector_d_object()const{ return Point_to_vector_d(*this); } - Vector_to_point_d vector_to_point_d_object()const{ return Vector_to_point_d(*this); } - Translated_point_d translated_point_d_object()const{ return Translated_point_d(*this); } - Scaled_vector_d scaled_vector_d_object()const{ return Scaled_vector_d(*this); } - Difference_of_vectors_d difference_of_vectors_d_object()const{ return Difference_of_vectors_d(*this); } - Difference_of_points_d difference_of_points_d_object()const{ return Difference_of_points_d(*this); } - Affine_rank_d affine_rank_d_object()const{ return Affine_rank_d(*this); } - Affinely_independent_d affinely_independent_d_object()const{ return Affinely_independent_d(*this); } - Linear_base_d linear_base_d_object()const{ return Linear_base_d(*this); } - Linear_rank_d linear_rank_d_object()const{ return Linear_rank_d(*this); } - Linearly_independent_d linearly_independent_d_object()const{ return Linearly_independent_d(*this); } - Midpoint_d midpoint_d_object()const{ return Midpoint_d(*this); } - Value_at_d value_at_d_object()const{ return Value_at_d(*this); } - /// Intersect_d intersect_d_object()const{ return Intersect_d(*this); } - Component_accessor_d component_accessor_d_object()const{ return Component_accessor_d(*this); } - Orthogonal_vector_d orthogonal_vector_d_object()const{ return Orthogonal_vector_d(*this); } - Construct_cartesian_const_iterator_d construct_cartesian_const_iterator_d_object()const{ return Construct_cartesian_const_iterator_d(*this); } - Construct_point_d construct_point_d_object()const{ return Construct_point_d(*this); } - Construct_vector_d construct_vector_d_object()const{ return Construct_vector_d(*this); } - Construct_segment_d construct_segment_d_object()const{ return Construct_segment_d(*this); } - Construct_sphere_d construct_sphere_d_object()const{ return Construct_sphere_d(*this); } - Construct_hyperplane_d construct_hyperplane_d_object()const{ return Construct_hyperplane_d(*this); } - Compute_squared_radius_d compute_squared_radius_d_object()const{ return Compute_squared_radius_d(*this); } + Power_center_d power_center_d_object()const{ return Power_center_d(*this); } + Power_distance_d power_distance_d_object()const{ return Power_distance_d(*this); } + Side_of_bounded_sphere_d side_of_bounded_sphere_d_object()const{ return Side_of_bounded_sphere_d(*this); } + Contained_in_affine_hull_d contained_in_affine_hull_d_object()const{ return Contained_in_affine_hull_d(*this); } + Contained_in_linear_hull_d contained_in_linear_hull_d_object()const{ return Contained_in_linear_hull_d(*this); } + Contained_in_simplex_d contained_in_simplex_d_object()const{ return Contained_in_simplex_d(*this); } + Construct_flat_orientation_d construct_flat_orientation_d_object()const{ return Construct_flat_orientation_d(*this); } + In_flat_orientation_d in_flat_orientation_d_object()const{ return In_flat_orientation_d(*this); } + In_flat_side_of_oriented_sphere_d in_flat_side_of_oriented_sphere_d_object()const{ return In_flat_side_of_oriented_sphere_d(*this); } + In_flat_power_side_of_power_sphere_d in_flat_power_side_of_power_sphere_d_object()const{ return In_flat_power_side_of_power_sphere_d(*this); } + Point_to_vector_d point_to_vector_d_object()const{ return Point_to_vector_d(*this); } + Vector_to_point_d vector_to_point_d_object()const{ return Vector_to_point_d(*this); } + Translated_point_d translated_point_d_object()const{ return Translated_point_d(*this); } + Scaled_vector_d scaled_vector_d_object()const{ return Scaled_vector_d(*this); } + Difference_of_vectors_d difference_of_vectors_d_object()const{ return Difference_of_vectors_d(*this); } + Difference_of_points_d difference_of_points_d_object()const{ return Difference_of_points_d(*this); } + Affine_rank_d affine_rank_d_object()const{ return Affine_rank_d(*this); } + Affinely_independent_d affinely_independent_d_object()const{ return Affinely_independent_d(*this); } + Linear_base_d linear_base_d_object()const{ return Linear_base_d(*this); } + Linear_rank_d linear_rank_d_object()const{ return Linear_rank_d(*this); } + Linearly_independent_d linearly_independent_d_object()const{ return Linearly_independent_d(*this); } + Midpoint_d midpoint_d_object()const{ return Midpoint_d(*this); } + Value_at_d value_at_d_object()const{ return Value_at_d(*this); } + /// Intersect_d intersect_d_object()const{ return Intersect_d(*this); } + Component_accessor_d component_accessor_d_object()const{ return Component_accessor_d(*this); } + Orthogonal_vector_d orthogonal_vector_d_object()const{ return Orthogonal_vector_d(*this); } + Construct_cartesian_const_iterator_d construct_cartesian_const_iterator_d_object()const{ return Construct_cartesian_const_iterator_d(*this); } + Construct_point_d construct_point_d_object()const{ return Construct_point_d(*this); } + Construct_vector_d construct_vector_d_object()const{ return Construct_vector_d(*this); } + Construct_segment_d construct_segment_d_object()const{ return Construct_segment_d(*this); } + Construct_sphere_d construct_sphere_d_object()const{ return Construct_sphere_d(*this); } + Construct_hyperplane_d construct_hyperplane_d_object()const{ return Construct_hyperplane_d(*this); } + Compute_squared_radius_d compute_squared_radius_d_object()const{ return Compute_squared_radius_d(*this); } Compute_squared_radius_smallest_orthogonal_sphere_d compute_squared_radius_smallest_orthogonal_sphere_d_object()const{ return Compute_squared_radius_smallest_orthogonal_sphere_d(*this); } - Squared_distance_d squared_distance_d_object()const{ return Squared_distance_d(*this); } - Squared_length_d squared_length_d_object()const{ return Squared_length_d(*this); } - Scalar_product_d scalar_product_d_object()const{ return Scalar_product_d(*this); } - Center_of_sphere_d center_of_sphere_d_object()const{ return Center_of_sphere_d(*this); } - Construct_circumcenter_d construct_circumcenter_d_object()const{ return Construct_circumcenter_d(*this); } - Construct_direction_d construct_direction_d_object()const{ return Construct_direction_d(*this); } - Construct_line_d construct_line_d_object()const{ return Construct_line_d(*this); } - Construct_ray_d construct_ray_d_object()const{ return Construct_ray_d(*this); } - Construct_iso_box_d construct_iso_box_d_object()const{ return Construct_iso_box_d(*this); } - Construct_aff_transformation_d construct_aff_transformation_d_object()const{ return Construct_aff_transformation_d(*this); } - Construct_min_vertex_d construct_min_vertex_d_object()const{ return Construct_min_vertex_d(*this); } - Construct_max_vertex_d construct_max_vertex_d_object()const{ return Construct_max_vertex_d(*this); } - Construct_weighted_point_d construct_weighted_point_d_object()const{ return Construct_weighted_point_d(*this); } + Squared_distance_d squared_distance_d_object()const{ return Squared_distance_d(*this); } + Squared_length_d squared_length_d_object()const{ return Squared_length_d(*this); } + Scalar_product_d scalar_product_d_object()const{ return Scalar_product_d(*this); } + Center_of_sphere_d center_of_sphere_d_object()const{ return Center_of_sphere_d(*this); } + Construct_circumcenter_d construct_circumcenter_d_object()const{ return Construct_circumcenter_d(*this); } + Construct_direction_d construct_direction_d_object()const{ return Construct_direction_d(*this); } + Construct_line_d construct_line_d_object()const{ return Construct_line_d(*this); } + Construct_ray_d construct_ray_d_object()const{ return Construct_ray_d(*this); } + Construct_iso_box_d construct_iso_box_d_object()const{ return Construct_iso_box_d(*this); } + Construct_aff_transformation_d construct_aff_transformation_d_object()const{ return Construct_aff_transformation_d(*this); } + Construct_min_vertex_d construct_min_vertex_d_object()const{ return Construct_min_vertex_d(*this); } + Construct_max_vertex_d construct_max_vertex_d_object()const{ return Construct_max_vertex_d(*this); } + Construct_weighted_point_d construct_weighted_point_d_object()const{ return Construct_weighted_point_d(*this); } - Compute_weight_d compute_weight_d_object()const{ return Compute_weight_d(*this); } - Point_drop_weight_d point_drop_weight_d_object()const{ return Point_drop_weight_d(*this); } + Compute_weight_d compute_weight_d_object()const{ return Compute_weight_d(*this); } + Point_drop_weight_d point_drop_weight_d_object()const{ return Point_drop_weight_d(*this); } - // Dummies for those required functors missing a concept. - typedef Null_functor Position_on_line_d; - Position_on_line_d position_on_line_d_object()const{return Null_functor();} - typedef Null_functor Barycentric_coordinates_d; - Barycentric_coordinates_d barycentric_coordinates_d_object()const{return Null_functor();} + // Dummies for those required functors missing a concept. + typedef Null_functor Position_on_line_d; + Position_on_line_d position_on_line_d_object()const{return Null_functor();} + typedef Null_functor Barycentric_coordinates_d; + Barycentric_coordinates_d barycentric_coordinates_d_object()const{return Null_functor();} - /* Not provided because they don't make sense here: - Lift_to_paraboloid_d - Project_along_d_axis_d - */ + /* Not provided because they don't make sense here: + Lift_to_paraboloid_d + Project_along_d_axis_d + */ }; } diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Types/Weighted_point.h b/NewKernel_d/include/CGAL/NewKernel_d/Types/Weighted_point.h index e1ca315a997..8dfe875b8c8 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Types/Weighted_point.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Types/Weighted_point.h @@ -16,26 +16,26 @@ namespace CGAL { namespace KerD { template class Weighted_point { - typedef typename Get_type::type FT_; - typedef typename Get_type::type Point_; - Point_ c_; - FT_ w_; + typedef typename Get_type::type FT_; + typedef typename Get_type::type Point_; + Point_ c_; + FT_ w_; - public: - Weighted_point(){} - Weighted_point(Point_ const&p, FT_ const&w): c_(p), w_(w) {} - // TODO: Add a piecewise constructor? + public: + Weighted_point(){} + Weighted_point(Point_ const&p, FT_ const&w): c_(p), w_(w) {} + // TODO: Add a piecewise constructor? - Point_ const& point()const{return c_;} - FT_ const& weight()const{return w_;} + Point_ const& point()const{return c_;} + FT_ const& weight()const{return w_;} }; } namespace CartesianDKernelFunctors { template struct Construct_weighted_point : Store_kernel { CGAL_FUNCTOR_INIT_STORE(Construct_weighted_point) - typedef typename Get_type::type result_type; - typedef typename Get_type::type Point; + typedef typename Get_type::type result_type; + typedef typename Get_type::type Point; typedef typename Get_type::type FT; result_type operator()(Point const&a, FT const&b)const{ return result_type(a,b); @@ -46,7 +46,7 @@ template struct Construct_weighted_point : Store_kernel { #if defined(BOOST_MSVC) && (BOOST_MSVC == 1900) # pragma warning(push) # pragma warning(disable: 4309) -#endif +#endif return result_type(cp(),0); #if defined(BOOST_MSVC) && (BOOST_MSVC == 1900) # pragma warning(pop) @@ -56,8 +56,8 @@ template struct Construct_weighted_point : Store_kernel { template struct Point_drop_weight { CGAL_FUNCTOR_INIT_IGNORE(Point_drop_weight) - typedef typename Get_type::type argument_type; - typedef typename Get_type::type const& result_type; + typedef typename Get_type::type argument_type; + typedef typename Get_type::type const& result_type; // Returning a reference is fragile result_type operator()(argument_type const&s)const{ @@ -67,8 +67,8 @@ template struct Point_drop_weight { template struct Point_weight { CGAL_FUNCTOR_INIT_IGNORE(Point_weight) - typedef typename Get_type::type argument_type; - typedef typename Get_type::type result_type; + typedef typename Get_type::type argument_type; + typedef typename Get_type::type result_type; result_type operator()(argument_type const&s)const{ return s.weight(); @@ -77,9 +77,9 @@ template struct Point_weight { template struct Power_distance : private Store_kernel { CGAL_FUNCTOR_INIT_STORE(Power_distance) - typedef typename Get_type::type first_argument_type; - typedef first_argument_type second_argument_type; - typedef typename Get_type::type result_type; + typedef typename Get_type::type first_argument_type; + typedef first_argument_type second_argument_type; + typedef typename Get_type::type result_type; result_type operator()(first_argument_type const&a, second_argument_type const&b)const{ typename Get_functor::type pdw(this->kernel()); @@ -90,9 +90,9 @@ template struct Power_distance : private Store_kernel { }; template struct Power_distance_to_point : private Store_kernel { CGAL_FUNCTOR_INIT_STORE(Power_distance_to_point) - typedef typename Get_type::type first_argument_type; - typedef typename Get_type::type second_argument_type; - typedef typename Get_type::type result_type; + typedef typename Get_type::type first_argument_type; + typedef typename Get_type::type second_argument_type; + typedef typename Get_type::type result_type; result_type operator()(first_argument_type const&a, second_argument_type const&b)const{ typename Get_functor::type pdw(this->kernel()); @@ -113,12 +113,12 @@ template struct Power_side_of_power_sphere : private Store_kernel typename Get_functor::type pdw(this->kernel()); typename Get_functor::type pw(this->kernel()); return ptr ( - make_transforming_iterator (f, pdw), - make_transforming_iterator (e, pdw), - make_transforming_iterator (f, pw), - make_transforming_iterator (e, pw), - pdw (p0), - pw (p0)); + make_transforming_iterator (f, pdw), + make_transforming_iterator (e, pdw), + make_transforming_iterator (f, pw), + make_transforming_iterator (e, pw), + pdw (p0), + pw (p0)); } }; @@ -133,22 +133,22 @@ template struct In_flat_power_side_of_power_sphere : private Store_ker typename Get_functor::type pdw(this->kernel()); typename Get_functor::type pw(this->kernel()); return ptr ( - fo, - make_transforming_iterator (f, pdw), - make_transforming_iterator (e, pdw), - make_transforming_iterator (f, pw), - make_transforming_iterator (e, pw), - pdw (p0), - pw (p0)); + fo, + make_transforming_iterator (f, pdw), + make_transforming_iterator (e, pdw), + make_transforming_iterator (f, pw), + make_transforming_iterator (e, pw), + pdw (p0), + pw (p0)); } }; // Construct a point at (weighted) distance 0 from all the input template struct Power_center : Store_kernel { CGAL_FUNCTOR_INIT_STORE(Power_center) - typedef typename Get_type::type WPoint; + typedef typename Get_type::type WPoint; typedef WPoint result_type; - typedef typename Get_type::type Point; + typedef typename Get_type::type Point; typedef typename Get_type::type FT; template result_type operator()(Iter f, Iter e)const{ diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Point_d.h b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Point_d.h index 5c0dce2db1f..7716c54bf05 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Point_d.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Point_d.h @@ -27,13 +27,13 @@ namespace Wrap { template class Point_d : public Get_type::type - // Deriving won't work if the point is just a __m256d. - // Test boost/std::is_class for instance + // Deriving won't work if the point is just a __m256d. + // Test boost/std::is_class for instance { - typedef typename Get_type::type RT_; - typedef typename Get_type::type FT_; - typedef typename R_::Kernel_base Kbase; - typedef typename Get_type::type Vector_; + typedef typename Get_type::type RT_; + typedef typename Get_type::type FT_; + typedef typename R_::Kernel_base Kbase; + typedef typename Get_type::type Vector_; typedef typename Get_functor >::type CPBase; typedef typename Get_functor::type CCBase; typedef typename Get_functor >::type CPI; @@ -67,19 +67,19 @@ public: # pragma warning(push) # pragma warning(disable: 4309) #endif - + template::type...>,std::tuple >::value>::type> explicit Point_d(U&&...u) - : Rep(CPBase()(std::forward(u)...)){} + : Rep(CPBase()(std::forward(u)...)){} #if defined(BOOST_MSVC) && (BOOST_MSVC == 1900) # pragma warning(pop) #endif - + // // called from Construct_point_d // template explicit Point_d(Eval_functor&&,U&&...u) -// : Rep(Eval_functor(), std::forward(u)...){} +// : Rep(Eval_functor(), std::forward(u)...){} template explicit Point_d(Eval_functor&&,F&&f,U&&...u) - : Rep(std::forward(f)(std::forward(u)...)){} + : Rep(std::forward(f)(std::forward(u)...)){} #if 0 // the new standard may make this necessary @@ -111,18 +111,18 @@ public: } decltype(auto) cartesian(int i)const{ - return CCBase()(rep(),i); + return CCBase()(rep(),i); } decltype(auto) operator[](int i)const{ - return CCBase()(rep(),i); + return CCBase()(rep(),i); } decltype(auto) cartesian_begin()const{ - return CPI()(rep(),Begin_tag()); + return CPI()(rep(),Begin_tag()); } decltype(auto) cartesian_end()const{ - return CPI()(rep(),End_tag()); + return CPI()(rep(),End_tag()); } int dimension() const { @@ -145,14 +145,14 @@ public: { os << p.dimension(); for(; b != e; ++b){ - os << " " << *b; + os << " " << *b; } } else { write(os, p.dimension()); for(; b != e; ++b){ - write(os, *b); + write(os, *b); } } return os; @@ -174,12 +174,12 @@ public: if(is_ascii(is)) { for(int i=0;i> iformat(coords[i]); + is >> iformat(coords[i]); } else { for(int i=0;i Point_d::Point_d(Point_d &)=default; //template //Vector_d operator+(const Vector_d& v,const Vector_d& w) const //{ -// return typename R::template Construct::type()(v,w); +// return typename R::template Construct::type()(v,w); //} // //template //Vector_d operator-(const Vector_d& v,const Vector_d& w) const //{ -// return typename R::template Construct::type()(v,w); +// return typename R::template Construct::type()(v,w); //} } //namespace Wrap diff --git a/NewKernel_d/include/CGAL/NewKernel_d/function_objects_cartesian.h b/NewKernel_d/include/CGAL/NewKernel_d/function_objects_cartesian.h index 8cfabbb5518..5f534070db2 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/function_objects_cartesian.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/function_objects_cartesian.h @@ -33,99 +33,99 @@ namespace CartesianDKernelFunctors { namespace internal { template struct Dimension_at_most { enum { value = false }; }; template struct Dimension_at_most,b> { - enum { value = (a <= b) }; + enum { value = (a <= b) }; }; } template::value> struct Orientation_of_points : private Store_kernel { - CGAL_FUNCTOR_INIT_STORE(Orientation_of_points) - typedef R_ R; - typedef typename Get_type::type Point; - typedef typename Get_type::type result_type; - typedef typename R::LA::Square_matrix Matrix; + CGAL_FUNCTOR_INIT_STORE(Orientation_of_points) + typedef R_ R; + typedef typename Get_type::type Point; + typedef typename Get_type::type result_type; + typedef typename R::LA::Square_matrix Matrix; - template - result_type operator()(Iter f, Iter e)const{ - typename Get_functor::type c(this->kernel()); - typename Get_functor::type pd(this->kernel()); - Point const& p0=*f++; - int d=pd(p0); - Matrix m(d,d); - // FIXME: this writes the vector coordinates in lines ? check all the other uses in this file, this may be wrong for some. - for(int i=0;f!=e;++f,++i) { - Point const& p=*f; - for(int j=0;j + result_type operator()(Iter f, Iter e)const{ + typename Get_functor::type c(this->kernel()); + typename Get_functor::type pd(this->kernel()); + Point const& p0=*f++; + int d=pd(p0); + Matrix m(d,d); + // FIXME: this writes the vector coordinates in lines ? check all the other uses in this file, this may be wrong for some. + for(int i=0;f!=e;++f,++i) { + Point const& p=*f; + for(int j=0;j,typename R::Default_ambient_dimension>::value>::type> - template =3)>::type> - result_type operator()(U&&...u) const { - return operator()({std::forward(u)...}); - } + // Since the dimension is at least 2, there are at least 3 points and no ambiguity with iterators. + // template ,typename R::Default_ambient_dimension>::value>::type> + template =3)>::type> + result_type operator()(U&&...u) const { + return operator()({std::forward(u)...}); + } - template - result_type operator()(std::initializer_list

l) const { - return operator()(l.begin(),l.end()); - } + template + result_type operator()(std::initializer_list

l) const { + return operator()(l.begin(),l.end()); + } }; template struct Orientation_of_points,true> : private Store_kernel { - CGAL_FUNCTOR_INIT_STORE(Orientation_of_points) - typedef R_ R; - typedef typename Get_type::type RT; - typedef typename Get_type::type Point; - typedef typename Get_type::type result_type; - templatestruct Help; - templatestruct Help > { - template result_type operator()(C const&c,P const&x,T&&t)const{ - return sign_of_determinant(c(std::get(t),I%d)-c(x,I%d)...); - } - }; - template result_type operator()(P0 const&x,P&&...p)const{ - static_assert(d==sizeof...(P),"Wrong number of arguments"); - typename Get_functor::type c(this->kernel()); - return Help>()(c,x,std::forward_as_tuple(std::forward

(p)...)); - } + CGAL_FUNCTOR_INIT_STORE(Orientation_of_points) + typedef R_ R; + typedef typename Get_type::type RT; + typedef typename Get_type::type Point; + typedef typename Get_type::type result_type; + templatestruct Help; + templatestruct Help > { + template result_type operator()(C const&c,P const&x,T&&t)const{ + return sign_of_determinant(c(std::get(t),I%d)-c(x,I%d)...); + } + }; + template result_type operator()(P0 const&x,P&&...p)const{ + static_assert(d==sizeof...(P),"Wrong number of arguments"); + typename Get_functor::type c(this->kernel()); + return Help>()(c,x,std::forward_as_tuple(std::forward

(p)...)); + } - template result_type help2(Dimension_tag, Iter f, Iter const&e, U&&...u)const{ - auto const&p=*f; - return help2(Dimension_tag(),++f,e,std::forward(u)...,p); - } - template result_type help2(Dimension_tag<0>, Iter CGAL_assertion_code(f), Iter const& CGAL_assertion_code(e), U&&...u)const{ - CGAL_assertion(f==e); - return operator()(std::forward(u)...); - } - template - result_type operator()(Iter f, Iter e)const{ - return help2(Dimension_tag(),f,e); - } + template result_type help2(Dimension_tag, Iter f, Iter const&e, U&&...u)const{ + auto const&p=*f; + return help2(Dimension_tag(),++f,e,std::forward(u)...,p); + } + template result_type help2(Dimension_tag<0>, Iter CGAL_assertion_code(f), Iter const& CGAL_assertion_code(e), U&&...u)const{ + CGAL_assertion(f==e); + return operator()(std::forward(u)...); + } + template + result_type operator()(Iter f, Iter e)const{ + return help2(Dimension_tag(),f,e); + } }; template struct Orientation_of_points,true> : private Store_kernel { - CGAL_FUNCTOR_INIT_STORE(Orientation_of_points) - typedef R_ R; - typedef typename Get_type::type RT; - typedef typename Get_type::type Point; - typedef typename Get_type::type result_type; - result_type operator()(Point const&x, Point const&y) const { - typename Get_functor::type c(this->kernel()); - // No sign_of_determinant(RT) :-( - return CGAL::compare(c(y,0),c(x,0)); - } - template - result_type operator()(Iter f, Iter CGAL_assertion_code(e))const{ - Point const&x=*f; - Point const&y=*++f; - CGAL_assertion(++f==e); - return operator()(x,y); - } + CGAL_FUNCTOR_INIT_STORE(Orientation_of_points) + typedef R_ R; + typedef typename Get_type::type RT; + typedef typename Get_type::type Point; + typedef typename Get_type::type result_type; + result_type operator()(Point const&x, Point const&y) const { + typename Get_functor::type c(this->kernel()); + // No sign_of_determinant(RT) :-( + return CGAL::compare(c(y,0),c(x,0)); + } + template + result_type operator()(Iter f, Iter CGAL_assertion_code(e))const{ + Point const&x=*f; + Point const&y=*++f; + CGAL_assertion(++f==e); + return operator()(x,y); + } }; } @@ -133,40 +133,40 @@ CGAL_KD_DEFAULT_FUNCTOR(Orientation_of_points_tag,(CartesianDKernelFunctors::Ori namespace CartesianDKernelFunctors { template struct Orientation_of_vectors : private Store_kernel { - CGAL_FUNCTOR_INIT_STORE(Orientation_of_vectors) - typedef R_ R; - typedef typename Get_type::type Vector; - typedef typename Get_type::type result_type; - typedef typename R::LA::Square_matrix Matrix; + CGAL_FUNCTOR_INIT_STORE(Orientation_of_vectors) + typedef R_ R; + typedef typename Get_type::type Vector; + typedef typename Get_type::type result_type; + typedef typename R::LA::Square_matrix Matrix; - template - result_type operator()(Iter f, Iter e)const{ - typename Get_functor::type c(this->kernel()); - typename Get_functor::type vd(this->kernel()); - Vector const& v0=*f; - int d=vd(v0); - Matrix m(d,d); - for(int j=0;j + result_type operator()(Iter f, Iter e)const{ + typename Get_functor::type c(this->kernel()); + typename Get_functor::type vd(this->kernel()); + Vector const& v0=*f; + int d=vd(v0); + Matrix m(d,d); + for(int j=0;j=3)>::type> - result_type operator()(U&&...u) const { - return operator()({std::forward(u)...}); - } + template =3)>::type> + result_type operator()(U&&...u) const { + return operator()({std::forward(u)...}); + } - template - result_type operator()(std::initializer_list l) const { - return operator()(l.begin(),l.end()); - } + template + result_type operator()(std::initializer_list l) const { + return operator()(l.begin(),l.end()); + } }; } @@ -174,33 +174,33 @@ CGAL_KD_DEFAULT_FUNCTOR(Orientation_of_vectors_tag,(CartesianDKernelFunctors::Or namespace CartesianDKernelFunctors { template struct Linear_rank : private Store_kernel { - CGAL_FUNCTOR_INIT_STORE(Linear_rank) - typedef R_ R; - typedef typename Get_type::type Vector; - // Computing a sensible Uncertain is not worth it - typedef int result_type; - typedef typename R::LA::Dynamic_matrix Matrix; + CGAL_FUNCTOR_INIT_STORE(Linear_rank) + typedef R_ R; + typedef typename Get_type::type Vector; + // Computing a sensible Uncertain is not worth it + typedef int result_type; + typedef typename R::LA::Dynamic_matrix Matrix; - template - result_type operator()(Iter f, Iter e)const{ - typename Get_functor::type c(this->kernel()); - typename Get_functor::type vd(this->kernel()); - std::ptrdiff_t n=std::distance(f,e); - if (n==0) return 0; - Vector const& v0 = *f; - int d=vd(v0); - Matrix m(d,n); - for(int j=0;j + result_type operator()(Iter f, Iter e)const{ + typename Get_functor::type c(this->kernel()); + typename Get_functor::type vd(this->kernel()); + std::ptrdiff_t n=std::distance(f,e); + if (n==0) return 0; + Vector const& v0 = *f; + int d=vd(v0); + Matrix m(d,n); + for(int j=0;j struct Linearly_independent : private Store_kernel { - CGAL_FUNCTOR_INIT_STORE(Linearly_independent) - typedef R_ R; - typedef typename Get_type::type result_type; + CGAL_FUNCTOR_INIT_STORE(Linearly_independent) + typedef R_ R; + typedef typename Get_type::type result_type; - template - result_type operator()(Iter f, Iter e)const{ - typename Get_functor::type vd(this->kernel()); - std::ptrdiff_t n=std::distance(f,e); - int d=vd(*f); - if (n>d) return false; - typename Get_functor::type lr(this->kernel()); - return lr(f,e) == n; - } + template + result_type operator()(Iter f, Iter e)const{ + typename Get_functor::type vd(this->kernel()); + std::ptrdiff_t n=std::distance(f,e); + int d=vd(*f); + if (n>d) return false; + typename Get_functor::type lr(this->kernel()); + return lr(f,e) == n; + } }; } @@ -228,37 +228,37 @@ CGAL_KD_DEFAULT_FUNCTOR(Linearly_independent_tag,(CartesianDKernelFunctors::Line namespace CartesianDKernelFunctors { template struct Contained_in_linear_hull : private Store_kernel { - CGAL_FUNCTOR_INIT_STORE(Contained_in_linear_hull) - typedef R_ R; - typedef typename Get_type::type Vector; - // Computing a sensible Uncertain is not worth it - typedef bool result_type; - typedef typename R::LA::Dynamic_matrix Matrix; + CGAL_FUNCTOR_INIT_STORE(Contained_in_linear_hull) + typedef R_ R; + typedef typename Get_type::type Vector; + // Computing a sensible Uncertain is not worth it + typedef bool result_type; + typedef typename R::LA::Dynamic_matrix Matrix; - template - result_type operator()(Iter f, Iter e,V const&w)const{ - typename Get_functor::type c(this->kernel()); - typename Get_functor::type vd(this->kernel()); - std::ptrdiff_t n=std::distance(f,e); - if (n==0) return false; - int d=vd(w); - Matrix m(d,n+1); - for(int i=0; f!=e; ++f,++i){ - Vector const& v = *f; - for(int j=0;j + result_type operator()(Iter f, Iter e,V const&w)const{ + typename Get_functor::type c(this->kernel()); + typename Get_functor::type vd(this->kernel()); + std::ptrdiff_t n=std::distance(f,e); + if (n==0) return false; + int d=vd(w); + Matrix m(d,n+1); + for(int i=0; f!=e; ++f,++i){ + Vector const& v = *f; + for(int j=0;j struct Affine_rank : private Store_kernel { - CGAL_FUNCTOR_INIT_STORE(Affine_rank) - typedef R_ R; - typedef typename Get_type::type Point; - // Computing a sensible Uncertain is not worth it - typedef int result_type; - typedef typename R::LA::Dynamic_matrix Matrix; + CGAL_FUNCTOR_INIT_STORE(Affine_rank) + typedef R_ R; + typedef typename Get_type::type Point; + // Computing a sensible Uncertain is not worth it + typedef int result_type; + typedef typename R::LA::Dynamic_matrix Matrix; - template - result_type operator()(Iter f, Iter e)const{ - typename Get_functor::type c(this->kernel()); - typename Get_functor::type pd(this->kernel()); - int n=(int)std::distance(f,e); - if (--n<=0) return n; - Point const& p0 = *f; - int d=pd(p0); - Matrix m(d,n); - for(int i=0; ++f!=e; ++i){ - Point const& p = *f; - for(int j=0;j + result_type operator()(Iter f, Iter e)const{ + typename Get_functor::type c(this->kernel()); + typename Get_functor::type pd(this->kernel()); + int n=(int)std::distance(f,e); + if (--n<=0) return n; + Point const& p0 = *f; + int d=pd(p0); + Matrix m(d,n); + for(int i=0; ++f!=e; ++i){ + Point const& p = *f; + for(int j=0;j struct Affinely_independent : private Store_kernel { - CGAL_FUNCTOR_INIT_STORE(Affinely_independent) - typedef R_ R; - typedef typename Get_type::type result_type; + CGAL_FUNCTOR_INIT_STORE(Affinely_independent) + typedef R_ R; + typedef typename Get_type::type result_type; - template - result_type operator()(Iter f, Iter e)const{ - typename Get_functor::type pd(this->kernel()); - std::ptrdiff_t n=std::distance(f,e); - int d=pd(*f); - if (--n>d) return false; - typename Get_functor::type ar(this->kernel()); - return ar(f,e) == n; - } + template + result_type operator()(Iter f, Iter e)const{ + typename Get_functor::type pd(this->kernel()); + std::ptrdiff_t n=std::distance(f,e); + int d=pd(*f); + if (--n>d) return false; + typename Get_functor::type ar(this->kernel()); + return ar(f,e) == n; + } }; } @@ -318,50 +318,50 @@ CGAL_KD_DEFAULT_FUNCTOR(Affinely_independent_tag,(CartesianDKernelFunctors::Affi namespace CartesianDKernelFunctors { template struct Contained_in_simplex : private Store_kernel { - CGAL_FUNCTOR_INIT_STORE(Contained_in_simplex) - typedef R_ R; - typedef typename Get_type::type Point; - // Computing a sensible Uncertain<*> is not worth it - // typedef typename Get_type::type result_type; - typedef bool result_type; - typedef typename Increment_dimension::type D1; - typedef typename Increment_dimension::type D2; - typedef typename R::LA::template Rebind_dimension::Other LA; - typedef typename LA::Dynamic_matrix Matrix; - typedef typename LA::Dynamic_vector DynVec; - typedef typename LA::Vector Vec; + CGAL_FUNCTOR_INIT_STORE(Contained_in_simplex) + typedef R_ R; + typedef typename Get_type::type Point; + // Computing a sensible Uncertain<*> is not worth it + // typedef typename Get_type::type result_type; + typedef bool result_type; + typedef typename Increment_dimension::type D1; + typedef typename Increment_dimension::type D2; + typedef typename R::LA::template Rebind_dimension::Other LA; + typedef typename LA::Dynamic_matrix Matrix; + typedef typename LA::Dynamic_vector DynVec; + typedef typename LA::Vector Vec; - template - result_type operator()(Iter f, Iter e, P const&q)const{ - typename Get_functor::type c(this->kernel()); - typename Get_functor::type pd(this->kernel()); - std::ptrdiff_t n=std::distance(f,e); - if (n==0) return false; - int d=pd(q); - Matrix m(d+1,n); - DynVec a(n); - // FIXME: Should use the proper vector constructor (Iterator_and_last) - Vec b(d+1); - for(int j=0;j + result_type operator()(Iter f, Iter e, P const&q)const{ + typename Get_functor::type c(this->kernel()); + typename Get_functor::type pd(this->kernel()); + std::ptrdiff_t n=std::distance(f,e); + if (n==0) return false; + int d=pd(q); + Matrix m(d+1,n); + DynVec a(n); + // FIXME: Should use the proper vector constructor (Iterator_and_last) + Vec b(d+1); + for(int j=0;j Ref_ operator()(Mat const& m, std::ptrdiff_t row)const{ - return m(row,col); + return m(row,col); } }; } template struct Linear_base : private Store_kernel { - CGAL_FUNCTOR_INIT_STORE(Linear_base) - typedef R_ R; - typedef typename Get_type::type Vector; - typedef typename Get_type::type FT; - typedef void result_type; - typedef typename R::LA::Dynamic_matrix Matrix; + CGAL_FUNCTOR_INIT_STORE(Linear_base) + typedef R_ R; + typedef typename Get_type::type Vector; + typedef typename Get_type::type FT; + typedef void result_type; + typedef typename R::LA::Dynamic_matrix Matrix; - template - result_type operator()(Iter f, Iter e, Oter o)const{ - typename Get_functor::type c(this->kernel()); - typename Get_functor::type vd(this->kernel()); - typename Get_functor >::type cv(this->kernel()); - std::ptrdiff_t n=std::distance(f,e); - if (n==0) return; - Vector const& v0 = *f; - int d=vd(v0); - Matrix m(d,n); - for(int j=0;j()(0,0)) - Ref; - typedef Iterator_from_indices > IFI; - *o++ = cv(IFI(b,0,i),IFI(b,d,i)); - } - } + template + result_type operator()(Iter f, Iter e, Oter o)const{ + typename Get_functor::type c(this->kernel()); + typename Get_functor::type vd(this->kernel()); + typename Get_functor >::type cv(this->kernel()); + std::ptrdiff_t n=std::distance(f,e); + if (n==0) return; + Vector const& v0 = *f; + int d=vd(v0); + Matrix m(d,n); + for(int j=0;j()(0,0)) + Ref; + typedef Iterator_from_indices > IFI; + *o++ = cv(IFI(b,0,i),IFI(b,d,i)); + } + } }; } @@ -425,105 +425,105 @@ CGAL_KD_DEFAULT_FUNCTOR(Linear_base_tag,(CartesianDKernelFunctors::Linear_base::value> struct Orientation : private Store_kernel { - CGAL_FUNCTOR_INIT_STORE(Orientation) - typedef R_ R; - typedef typename Get_type::type Vector; - typedef typename Get_type::type Point; - typedef typename Get_type::type result_type; - typedef typename Get_functor::type OP; - typedef typename Get_functor::type OV; + CGAL_FUNCTOR_INIT_STORE(Orientation) + typedef R_ R; + typedef typename Get_type::type Vector; + typedef typename Get_type::type Point; + typedef typename Get_type::type result_type; + typedef typename Get_functor::type OP; + typedef typename Get_functor::type OV; - //FIXME!!! - //when Point and Vector are distinct types, the dispatch should be made - //in a way that doesn't instantiate a conversion from Point to Vector - template - result_type operator()(Iter const&f, Iter const& e)const{ - typename Get_functor::type pd(this->kernel()); - typename std::iterator_traits::difference_type d=std::distance(f,e); - int dim=pd(*f); // BAD - if(d==dim) return OV(this->kernel())(f,e); - CGAL_assertion(d==dim+1); - return OP(this->kernel())(f,e); - } - //TODO: version that takes objects directly instead of iterators + //FIXME!!! + //when Point and Vector are distinct types, the dispatch should be made + //in a way that doesn't instantiate a conversion from Point to Vector + template + result_type operator()(Iter const&f, Iter const& e)const{ + typename Get_functor::type pd(this->kernel()); + typename std::iterator_traits::difference_type d=std::distance(f,e); + int dim=pd(*f); // BAD + if(d==dim) return OV(this->kernel())(f,e); + CGAL_assertion(d==dim+1); + return OP(this->kernel())(f,e); + } + //TODO: version that takes objects directly instead of iterators }; template struct Orientation : private Store_kernel { - CGAL_FUNCTOR_INIT_STORE(Orientation) - typedef R_ R; - typedef typename Get_type::type Vector; - typedef typename Get_type::type Point; - typedef typename Get_type::type result_type; - typedef typename Get_functor::type OP; - typedef typename Get_functor::type OV; - typedef typename R::LA::Square_matrix Matrix; + CGAL_FUNCTOR_INIT_STORE(Orientation) + typedef R_ R; + typedef typename Get_type::type Vector; + typedef typename Get_type::type Point; + typedef typename Get_type::type result_type; + typedef typename Get_functor::type OP; + typedef typename Get_functor::type OV; + typedef typename R::LA::Square_matrix Matrix; - //FIXME!!! - //when Point and Vector are distinct types, the dispatch should be made - //in a way that doesn't instantiate a conversion from Point to Vector - template - typename boost::enable_if,result_type>::type - operator()(Iter const&f, Iter const& e)const{ - return OP(this->kernel())(f,e); - } - template - typename boost::enable_if,result_type>::type - operator()(Iter const&f, Iter const& e)const{ - return OV(this->kernel())(f,e); - } - //TODO: version that takes objects directly instead of iterators + //FIXME!!! + //when Point and Vector are distinct types, the dispatch should be made + //in a way that doesn't instantiate a conversion from Point to Vector + template + typename boost::enable_if,result_type>::type + operator()(Iter const&f, Iter const& e)const{ + return OP(this->kernel())(f,e); + } + template + typename boost::enable_if,result_type>::type + operator()(Iter const&f, Iter const& e)const{ + return OV(this->kernel())(f,e); + } + //TODO: version that takes objects directly instead of iterators }; } #endif namespace CartesianDKernelFunctors { template struct Power_side_of_power_sphere_raw : private Store_kernel { - CGAL_FUNCTOR_INIT_STORE(Power_side_of_power_sphere_raw) - typedef R_ R; - typedef typename Get_type::type RT; - typedef typename Get_type::type FT; - typedef typename Get_type::type Point; - typedef typename Get_type::type result_type; - typedef typename Increment_dimension::type D1; - typedef typename Increment_dimension::type D2; - typedef typename R::LA::template Rebind_dimension::Other LA; - typedef typename LA::Square_matrix Matrix; + CGAL_FUNCTOR_INIT_STORE(Power_side_of_power_sphere_raw) + typedef R_ R; + typedef typename Get_type::type RT; + typedef typename Get_type::type FT; + typedef typename Get_type::type Point; + typedef typename Get_type::type result_type; + typedef typename Increment_dimension::type D1; + typedef typename Increment_dimension::type D2; + typedef typename R::LA::template Rebind_dimension::Other LA; + typedef typename LA::Square_matrix Matrix; - template - result_type operator()(IterP f, IterP const& e, IterW fw, IterW const&/*ew*/, Pt const& p0, Wt const& w0) const { - typedef typename Get_functor::type Sqdo; - typename Get_functor::type c(this->kernel()); - typename Get_functor::type pd(this->kernel()); + template + result_type operator()(IterP f, IterP const& e, IterW fw, IterW const&/*ew*/, Pt const& p0, Wt const& w0) const { + typedef typename Get_functor::type Sqdo; + typename Get_functor::type c(this->kernel()); + typename Get_functor::type pd(this->kernel()); - int d=pd(p0); - Matrix m(d+1,d+1); - if(CGAL::Is_stored::value) { - Sqdo sqdo(this->kernel()); - FT const& h0 = sqdo(p0) - w0; - for(int i=0;f!=e;++f,++fw,++i) { - Point const& p=*f; - for(int j=0;j::value) { + Sqdo sqdo(this->kernel()); + FT const& h0 = sqdo(p0) - w0; + for(int i=0;f!=e;++f,++fw,++i) { + Point const& p=*f; + for(int j=0;j struct Side_of_oriented_sphere : private Store_kernel { - CGAL_FUNCTOR_INIT_STORE(Side_of_oriented_sphere) - typedef R_ R; - typedef typename Get_type::type RT; - typedef typename Get_type::type Point; - typedef typename Get_type::type result_type; - typedef typename Increment_dimension::type D1; - typedef typename Increment_dimension::type D2; - typedef typename R::LA::template Rebind_dimension::Other LA; - typedef typename LA::Square_matrix Matrix; + CGAL_FUNCTOR_INIT_STORE(Side_of_oriented_sphere) + typedef R_ R; + typedef typename Get_type::type RT; + typedef typename Get_type::type Point; + typedef typename Get_type::type result_type; + typedef typename Increment_dimension::type D1; + typedef typename Increment_dimension::type D2; + typedef typename R::LA::template Rebind_dimension::Other LA; + typedef typename LA::Square_matrix Matrix; - /* Undocumented, removed - template - result_type operator()(Iter f, Iter const& e)const{ - Point const& p0=*f++; // *--e ? - return this->operator()(f,e,p0); - } - */ + /* Undocumented, removed + template + result_type operator()(Iter f, Iter const& e)const{ + Point const& p0=*f++; // *--e ? + return this->operator()(f,e,p0); + } + */ - template - result_type operator()(Iter f, Iter const& e, Point const& p0) const { - typedef typename Get_functor::type Sqdo; - typename Get_functor::type c(this->kernel()); - typename Get_functor::type pd(this->kernel()); + template + result_type operator()(Iter f, Iter const& e, Point const& p0) const { + typedef typename Get_functor::type Sqdo; + typename Get_functor::type c(this->kernel()); + typename Get_functor::type pd(this->kernel()); - int d=pd(p0); - Matrix m(d+1,d+1); - if(CGAL::Is_stored::value) { - Sqdo sqdo(this->kernel()); - for(int i=0;f!=e;++f,++i) { - Point const& p=*f; - for(int j=0;j::value) { + Sqdo sqdo(this->kernel()); + for(int i=0;f!=e;++f,++i) { + Point const& p=*f; + for(int j=0;j=4)>::type> - result_type operator()(U&&...u) const { - return operator()({std::forward(u)...}); - } + template =4)>::type> + result_type operator()(U&&...u) const { + return operator()({std::forward(u)...}); + } - template - result_type operator()(std::initializer_list

l) const { - return operator()(l.begin(),l.end()); - } + template + result_type operator()(std::initializer_list

l) const { + return operator()(l.begin(),l.end()); + } }; } @@ -628,11 +628,11 @@ template struct Construct_circumcenter : Store_kernel { // Write the point coordinates in lines. int i; for(i=0; ++f!=e; ++i) { - Point const& p=*f; - for(int j=0;j struct Construct_circumcenter : Store_kernel { int j,i=0; // We are doing a quadratic number of *f, which can be costly with transforming_iterator. for(Iter f2=f;f2!=e;++f2,++i){ - Point const& p2=*f2; - b(i)=m(i,i)=sdo(p2); - j=0; - for(Iter f3=f;f3!=e;++f3,++j){ - m(j,i)=m(i,j)=sp(p2,*f3); - } + Point const& p2=*f2; + b(i)=m(i,i)=sdo(p2); + j=0; + for(Iter f3=f;f3!=e;++f3,++j){ + m(j,i)=m(i,j)=sp(p2,*f3); + } } for(i=1;i struct Construct_circumcenter : Store_kernel { for(i=0;i struct Side_of_bounded_sphere : private Store_kernel { - CGAL_FUNCTOR_INIT_STORE(Side_of_bounded_sphere) - typedef R_ R; - typedef typename Get_type::type Point; - typedef typename Get_type::type result_type; + CGAL_FUNCTOR_INIT_STORE(Side_of_bounded_sphere) + typedef R_ R; + typedef typename Get_type::type Point; + typedef typename Get_type::type result_type; - template - result_type operator()(Iter f, Iter const& e) const { - Point const& p0 = *f++; // *--e ? - typename Get_functor::type pd(this->kernel()); - //FIXME: Doesn't work for non-full dimension. - CGAL_assertion (std::distance(f,e) == pd(p0)+1); - return operator() (f, e, p0); - } + template + result_type operator()(Iter f, Iter const& e) const { + Point const& p0 = *f++; // *--e ? + typename Get_functor::type pd(this->kernel()); + //FIXME: Doesn't work for non-full dimension. + CGAL_assertion (std::distance(f,e) == pd(p0)+1); + return operator() (f, e, p0); + } - template - result_type operator()(Iter const& f, Iter const& e, Point const& p0) const { - typename Get_functor::type sos (this->kernel()); - typename Get_functor::type op (this->kernel()); - // enum_cast is not very generic, but since this function isn't supposed to remain like this... - return enum_cast (sos (f, e, p0) * op (f, e)); - } + template + result_type operator()(Iter const& f, Iter const& e, Point const& p0) const { + typename Get_functor::type sos (this->kernel()); + typename Get_functor::type op (this->kernel()); + // enum_cast is not very generic, but since this function isn't supposed to remain like this... + return enum_cast (sos (f, e, p0) * op (f, e)); + } - template =4)>::type> - result_type operator()(U&&...u) const { - return operator()({std::forward(u)...}); - } + template =4)>::type> + result_type operator()(U&&...u) const { + return operator()({std::forward(u)...}); + } - template - result_type operator()(std::initializer_list

l) const { - return operator()(l.begin(),l.end()); - } + template + result_type operator()(std::initializer_list

l) const { + return operator()(l.begin(),l.end()); + } }; } @@ -758,17 +758,17 @@ CGAL_KD_DEFAULT_FUNCTOR(Side_of_bounded_sphere_tag,(CartesianDKernelFunctors::Si namespace CartesianDKernelFunctors { template struct Side_of_bounded_circumsphere : private Store_kernel { - CGAL_FUNCTOR_INIT_STORE(Side_of_bounded_circumsphere) - typedef typename Get_type::type result_type; + CGAL_FUNCTOR_INIT_STORE(Side_of_bounded_circumsphere) + typedef typename Get_type::type result_type; - template - result_type operator()(Iter f, Iter const& e, P const& p0) const { - // TODO: Special case when the dimension is full. - typename Get_functor::type cc(this->kernel()); - typename Get_functor::type cd(this->kernel()); + template + result_type operator()(Iter f, Iter const& e, P const& p0) const { + // TODO: Special case when the dimension is full. + typename Get_functor::type cc(this->kernel()); + typename Get_functor::type cd(this->kernel()); - return enum_cast(cd(cc(f, e), *f, p0)); - } + return enum_cast(cd(cc(f, e), *f, p0)); + } }; } @@ -776,19 +776,19 @@ CGAL_KD_DEFAULT_FUNCTOR(Side_of_bounded_circumsphere_tag,(CartesianDKernelFuncto namespace CartesianDKernelFunctors { template struct Point_to_vector : private Store_kernel { - CGAL_FUNCTOR_INIT_STORE(Point_to_vector) - typedef R_ R; - typedef typename Get_type::type RT; - typedef typename Get_type::type Vector; - typedef typename Get_type::type Point; - typedef typename Get_functor >::type CV; - typedef typename Get_functor >::type CI; - typedef Vector result_type; - typedef Point argument_type; - result_type operator()(argument_type const&v)const{ - CI ci(this->kernel()); - return CV(this->kernel())(ci(v,Begin_tag()),ci(v,End_tag())); - } + CGAL_FUNCTOR_INIT_STORE(Point_to_vector) + typedef R_ R; + typedef typename Get_type::type RT; + typedef typename Get_type::type Vector; + typedef typename Get_type::type Point; + typedef typename Get_functor >::type CV; + typedef typename Get_functor >::type CI; + typedef Vector result_type; + typedef Point argument_type; + result_type operator()(argument_type const&v)const{ + CI ci(this->kernel()); + return CV(this->kernel())(ci(v,Begin_tag()),ci(v,End_tag())); + } }; } @@ -796,19 +796,19 @@ CGAL_KD_DEFAULT_FUNCTOR(Point_to_vector_tag,(CartesianDKernelFunctors::Point_to_ namespace CartesianDKernelFunctors { template struct Vector_to_point : private Store_kernel { - CGAL_FUNCTOR_INIT_STORE(Vector_to_point) - typedef R_ R; - typedef typename Get_type::type RT; - typedef typename Get_type::type Vector; - typedef typename Get_type::type Point; - typedef typename Get_functor >::type CP; - typedef typename Get_functor >::type CI; - typedef Point result_type; - typedef Vector argument_type; - result_type operator()(argument_type const&v)const{ - CI ci(this->kernel()); - return CP(this->kernel())(ci(v,Begin_tag()),ci(v,End_tag())); - } + CGAL_FUNCTOR_INIT_STORE(Vector_to_point) + typedef R_ R; + typedef typename Get_type::type RT; + typedef typename Get_type::type Vector; + typedef typename Get_type::type Point; + typedef typename Get_functor >::type CP; + typedef typename Get_functor >::type CI; + typedef Point result_type; + typedef Vector argument_type; + result_type operator()(argument_type const&v)const{ + CI ci(this->kernel()); + return CP(this->kernel())(ci(v,Begin_tag()),ci(v,End_tag())); + } }; } @@ -816,18 +816,18 @@ CGAL_KD_DEFAULT_FUNCTOR(Vector_to_point_tag,(CartesianDKernelFunctors::Vector_to namespace CartesianDKernelFunctors { template struct Opposite_vector : private Store_kernel { - CGAL_FUNCTOR_INIT_STORE(Opposite_vector) - typedef R_ R; - typedef typename Get_type::type RT; - typedef typename Get_type::type Vector; - typedef typename Get_functor >::type CV; - typedef typename Get_functor >::type CI; - typedef Vector result_type; - typedef Vector argument_type; - result_type operator()(Vector const&v)const{ - CI ci(this->kernel()); - return CV(this->kernel())(make_transforming_iterator(ci(v,Begin_tag()),std::negate()),make_transforming_iterator(ci(v,End_tag()),std::negate())); - } + CGAL_FUNCTOR_INIT_STORE(Opposite_vector) + typedef R_ R; + typedef typename Get_type::type RT; + typedef typename Get_type::type Vector; + typedef typename Get_functor >::type CV; + typedef typename Get_functor >::type CI; + typedef Vector result_type; + typedef Vector argument_type; + result_type operator()(Vector const&v)const{ + CI ci(this->kernel()); + return CV(this->kernel())(make_transforming_iterator(ci(v,Begin_tag()),std::negate()),make_transforming_iterator(ci(v,End_tag()),std::negate())); + } }; } @@ -835,19 +835,19 @@ CGAL_KD_DEFAULT_FUNCTOR(Opposite_vector_tag,(CartesianDKernelFunctors::Opposite_ namespace CartesianDKernelFunctors { template struct Scaled_vector : private Store_kernel { - CGAL_FUNCTOR_INIT_STORE(Scaled_vector) - typedef R_ R; - typedef typename Get_type::type FT; - typedef typename Get_type::type Vector; - typedef typename Get_functor >::type CV; - typedef typename Get_functor >::type CI; - typedef Vector result_type; - typedef Vector first_argument_type; - typedef FT second_argument_type; - result_type operator()(Vector const&v,FT const& s)const{ - CI ci(this->kernel()); - return CV(this->kernel())(make_transforming_iterator(ci(v,Begin_tag()),Scale(s)),make_transforming_iterator(ci(v,End_tag()),Scale(s))); - } + CGAL_FUNCTOR_INIT_STORE(Scaled_vector) + typedef R_ R; + typedef typename Get_type::type FT; + typedef typename Get_type::type Vector; + typedef typename Get_functor >::type CV; + typedef typename Get_functor >::type CI; + typedef Vector result_type; + typedef Vector first_argument_type; + typedef FT second_argument_type; + result_type operator()(Vector const&v,FT const& s)const{ + CI ci(this->kernel()); + return CV(this->kernel())(make_transforming_iterator(ci(v,Begin_tag()),Scale(s)),make_transforming_iterator(ci(v,End_tag()),Scale(s))); + } }; } @@ -855,19 +855,19 @@ CGAL_KD_DEFAULT_FUNCTOR(Scaled_vector_tag,(CartesianDKernelFunctors::Scaled_vect namespace CartesianDKernelFunctors { template struct Sum_of_vectors : private Store_kernel { - CGAL_FUNCTOR_INIT_STORE(Sum_of_vectors) - typedef R_ R; - typedef typename Get_type::type RT; - typedef typename Get_type::type Vector; - typedef typename Get_functor >::type CV; - typedef typename Get_functor >::type CI; - typedef Vector result_type; - typedef Vector first_argument_type; - typedef Vector second_argument_type; - result_type operator()(Vector const&a, Vector const&b)const{ - CI ci(this->kernel()); - return CV(this->kernel())(make_transforming_pair_iterator(ci(a,Begin_tag()),ci(b,Begin_tag()),std::plus()),make_transforming_pair_iterator(ci(a,End_tag()),ci(b,End_tag()),std::plus())); - } + CGAL_FUNCTOR_INIT_STORE(Sum_of_vectors) + typedef R_ R; + typedef typename Get_type::type RT; + typedef typename Get_type::type Vector; + typedef typename Get_functor >::type CV; + typedef typename Get_functor >::type CI; + typedef Vector result_type; + typedef Vector first_argument_type; + typedef Vector second_argument_type; + result_type operator()(Vector const&a, Vector const&b)const{ + CI ci(this->kernel()); + return CV(this->kernel())(make_transforming_pair_iterator(ci(a,Begin_tag()),ci(b,Begin_tag()),std::plus()),make_transforming_pair_iterator(ci(a,End_tag()),ci(b,End_tag()),std::plus())); + } }; } @@ -875,19 +875,19 @@ CGAL_KD_DEFAULT_FUNCTOR(Sum_of_vectors_tag,(CartesianDKernelFunctors::Sum_of_vec namespace CartesianDKernelFunctors { template struct Difference_of_vectors : private Store_kernel { - CGAL_FUNCTOR_INIT_STORE(Difference_of_vectors) - typedef R_ R; - typedef typename Get_type::type RT; - typedef typename Get_type::type Vector; - typedef typename Get_functor >::type CV; - typedef typename Get_functor >::type CI; - typedef Vector result_type; - typedef Vector first_argument_type; - typedef Vector second_argument_type; - result_type operator()(Vector const&a, Vector const&b)const{ - CI ci(this->kernel()); - return CV(this->kernel())(make_transforming_pair_iterator(ci(a,Begin_tag()),ci(b,Begin_tag()),std::minus()),make_transforming_pair_iterator(ci(a,End_tag()),ci(b,End_tag()),std::minus())); - } + CGAL_FUNCTOR_INIT_STORE(Difference_of_vectors) + typedef R_ R; + typedef typename Get_type::type RT; + typedef typename Get_type::type Vector; + typedef typename Get_functor >::type CV; + typedef typename Get_functor >::type CI; + typedef Vector result_type; + typedef Vector first_argument_type; + typedef Vector second_argument_type; + result_type operator()(Vector const&a, Vector const&b)const{ + CI ci(this->kernel()); + return CV(this->kernel())(make_transforming_pair_iterator(ci(a,Begin_tag()),ci(b,Begin_tag()),std::minus()),make_transforming_pair_iterator(ci(a,End_tag()),ci(b,End_tag()),std::minus())); + } }; } @@ -895,22 +895,22 @@ CGAL_KD_DEFAULT_FUNCTOR(Difference_of_vectors_tag,(CartesianDKernelFunctors::Dif namespace CartesianDKernelFunctors { template struct Translated_point : private Store_kernel { - CGAL_FUNCTOR_INIT_STORE(Translated_point) - typedef R_ R; - typedef typename Get_type::type RT; - typedef typename Get_type::type Vector; - typedef typename Get_type::type Point; - typedef typename Get_functor >::type CP; - typedef typename Get_functor >::type CVI; - typedef typename Get_functor >::type CPI; - typedef Point result_type; - typedef Point first_argument_type; - typedef Vector second_argument_type; - result_type operator()(Point const&a, Vector const&b)const{ - CVI cvi(this->kernel()); - CPI cpi(this->kernel()); - return CP(this->kernel())(make_transforming_pair_iterator(cpi(a,Begin_tag()),cvi(b,Begin_tag()),std::plus()),make_transforming_pair_iterator(cpi(a,End_tag()),cvi(b,End_tag()),std::plus())); - } + CGAL_FUNCTOR_INIT_STORE(Translated_point) + typedef R_ R; + typedef typename Get_type::type RT; + typedef typename Get_type::type Vector; + typedef typename Get_type::type Point; + typedef typename Get_functor >::type CP; + typedef typename Get_functor >::type CVI; + typedef typename Get_functor >::type CPI; + typedef Point result_type; + typedef Point first_argument_type; + typedef Vector second_argument_type; + result_type operator()(Point const&a, Vector const&b)const{ + CVI cvi(this->kernel()); + CPI cpi(this->kernel()); + return CP(this->kernel())(make_transforming_pair_iterator(cpi(a,Begin_tag()),cvi(b,Begin_tag()),std::plus()),make_transforming_pair_iterator(cpi(a,End_tag()),cvi(b,End_tag()),std::plus())); + } }; } @@ -918,20 +918,20 @@ CGAL_KD_DEFAULT_FUNCTOR(Translated_point_tag,(CartesianDKernelFunctors::Translat namespace CartesianDKernelFunctors { template struct Difference_of_points : private Store_kernel { - CGAL_FUNCTOR_INIT_STORE(Difference_of_points) - typedef R_ R; - typedef typename Get_type::type RT; - typedef typename Get_type::type Point; - typedef typename Get_type::type Vector; - typedef typename Get_functor >::type CV; - typedef typename Get_functor >::type CI; - typedef Vector result_type; - typedef Point first_argument_type; - typedef Point second_argument_type; - result_type operator()(Point const&a, Point const&b)const{ - CI ci(this->kernel()); - return CV(this->kernel())(make_transforming_pair_iterator(ci(a,Begin_tag()),ci(b,Begin_tag()),std::minus()),make_transforming_pair_iterator(ci(a,End_tag()),ci(b,End_tag()),std::minus())); - } + CGAL_FUNCTOR_INIT_STORE(Difference_of_points) + typedef R_ R; + typedef typename Get_type::type RT; + typedef typename Get_type::type Point; + typedef typename Get_type::type Vector; + typedef typename Get_functor >::type CV; + typedef typename Get_functor >::type CI; + typedef Vector result_type; + typedef Point first_argument_type; + typedef Point second_argument_type; + result_type operator()(Point const&a, Point const&b)const{ + CI ci(this->kernel()); + return CV(this->kernel())(make_transforming_pair_iterator(ci(a,Begin_tag()),ci(b,Begin_tag()),std::minus()),make_transforming_pair_iterator(ci(a,End_tag()),ci(b,End_tag()),std::minus())); + } }; } @@ -939,28 +939,28 @@ CGAL_KD_DEFAULT_FUNCTOR(Difference_of_points_tag,(CartesianDKernelFunctors::Diff namespace CartesianDKernelFunctors { template struct Midpoint : private Store_kernel { - CGAL_FUNCTOR_INIT_STORE(Midpoint) - typedef R_ R; - typedef typename Get_type::type FT; - typedef typename Get_type::type RT; - typedef typename Get_type::type Point; - typedef typename Get_functor >::type CP; - typedef typename Get_functor >::type CI; - typedef Point result_type; - typedef Point first_argument_type; - typedef Point second_argument_type; - // There is a division, but it will be cast to RT afterwards anyway, so maybe we could use RT. - struct Average : CGAL::cpp98::binary_function { - FT operator()(FT const&a, RT const&b)const{ - return (a+b)/2; - } - }; - result_type operator()(Point const&a, Point const&b)const{ - CI ci(this->kernel()); - //Divide half(2); - //return CP(this->kernel())(make_transforming_iterator(make_transforming_pair_iterator(ci.begin(a),ci.begin(b),std::plus()),half),make_transforming_iterator(make_transforming_pair_iterator(ci.end(a),ci.end(b),std::plus()),half)); - return CP(this->kernel())(make_transforming_pair_iterator(ci(a,Begin_tag()),ci(b,Begin_tag()),Average()),make_transforming_pair_iterator(ci(a,End_tag()),ci(b,End_tag()),Average())); - } + CGAL_FUNCTOR_INIT_STORE(Midpoint) + typedef R_ R; + typedef typename Get_type::type FT; + typedef typename Get_type::type RT; + typedef typename Get_type::type Point; + typedef typename Get_functor >::type CP; + typedef typename Get_functor >::type CI; + typedef Point result_type; + typedef Point first_argument_type; + typedef Point second_argument_type; + // There is a division, but it will be cast to RT afterwards anyway, so maybe we could use RT. + struct Average : CGAL::cpp98::binary_function { + FT operator()(FT const&a, RT const&b)const{ + return (a+b)/2; + } + }; + result_type operator()(Point const&a, Point const&b)const{ + CI ci(this->kernel()); + //Divide half(2); + //return CP(this->kernel())(make_transforming_iterator(make_transforming_pair_iterator(ci.begin(a),ci.begin(b),std::plus()),half),make_transforming_iterator(make_transforming_pair_iterator(ci.end(a),ci.end(b),std::plus()),half)); + return CP(this->kernel())(make_transforming_pair_iterator(ci(a,Begin_tag()),ci(b,Begin_tag()),Average()),make_transforming_pair_iterator(ci(a,End_tag()),ci(b,End_tag()),Average())); + } }; } @@ -968,19 +968,19 @@ CGAL_KD_DEFAULT_FUNCTOR(Midpoint_tag,(CartesianDKernelFunctors::Midpoint),(Po namespace CartesianDKernelFunctors { template struct Squared_length : private Store_kernel { - CGAL_FUNCTOR_INIT_STORE(Squared_length) - typedef R_ R; - typedef typename Get_type::type RT; - typedef typename Get_type::type Vector; - typedef typename Get_functor >::type CI; - typedef RT result_type; - typedef Vector argument_type; - result_type operator()(Vector const&a)const{ - CI ci(this->kernel()); - typename Algebraic_structure_traits::Square f; - // TODO: avoid this RT(0)+... - return std::accumulate(make_transforming_iterator(ci(a,Begin_tag()),f),make_transforming_iterator(ci(a,End_tag()),f),RT(0)); - } + CGAL_FUNCTOR_INIT_STORE(Squared_length) + typedef R_ R; + typedef typename Get_type::type RT; + typedef typename Get_type::type Vector; + typedef typename Get_functor >::type CI; + typedef RT result_type; + typedef Vector argument_type; + result_type operator()(Vector const&a)const{ + CI ci(this->kernel()); + typename Algebraic_structure_traits::Square f; + // TODO: avoid this RT(0)+... + return std::accumulate(make_transforming_iterator(ci(a,Begin_tag()),f),make_transforming_iterator(ci(a,End_tag()),f),RT(0)); + } }; } @@ -988,19 +988,19 @@ CGAL_KD_DEFAULT_FUNCTOR(Squared_length_tag,(CartesianDKernelFunctors::Squared_le namespace CartesianDKernelFunctors { template struct Squared_distance_to_origin : private Store_kernel { - CGAL_FUNCTOR_INIT_STORE(Squared_distance_to_origin) - typedef R_ R; - typedef typename Get_type::type RT; - typedef typename Get_type::type Point; - typedef typename Get_functor >::type CI; - typedef RT result_type; - typedef Point argument_type; - result_type operator()(Point const&a)const{ - CI ci(this->kernel()); - typename Algebraic_structure_traits::Square f; - // TODO: avoid this RT(0)+... - return std::accumulate(make_transforming_iterator(ci(a,Begin_tag()),f),make_transforming_iterator(ci(a,End_tag()),f),RT(0)); - } + CGAL_FUNCTOR_INIT_STORE(Squared_distance_to_origin) + typedef R_ R; + typedef typename Get_type::type RT; + typedef typename Get_type::type Point; + typedef typename Get_functor >::type CI; + typedef RT result_type; + typedef Point argument_type; + result_type operator()(Point const&a)const{ + CI ci(this->kernel()); + typename Algebraic_structure_traits::Square f; + // TODO: avoid this RT(0)+... + return std::accumulate(make_transforming_iterator(ci(a,Begin_tag()),f),make_transforming_iterator(ci(a,End_tag()),f),RT(0)); + } }; } @@ -1008,25 +1008,25 @@ CGAL_KD_DEFAULT_FUNCTOR(Squared_distance_to_origin_tag,(CartesianDKernelFunctors namespace CartesianDKernelFunctors { template struct Squared_distance : private Store_kernel { - CGAL_FUNCTOR_INIT_STORE(Squared_distance) - typedef R_ R; - typedef typename Get_type::type RT; - typedef typename Get_type::type Point; - typedef typename Get_functor >::type CI; - typedef RT result_type; - typedef Point first_argument_type; - typedef Point second_argument_type; - struct Sq_diff : CGAL::cpp98::binary_function { - RT operator()(RT const&a, RT const&b)const{ - return CGAL::square(a-b); - } - }; - result_type operator()(Point const&a, Point const&b)const{ - CI ci(this->kernel()); - Sq_diff f; - // TODO: avoid this RT(0)+... - return std::accumulate(make_transforming_pair_iterator(ci(a,Begin_tag()),ci(b,Begin_tag()),f),make_transforming_pair_iterator(ci(a,End_tag()),ci(b,End_tag()),f),RT(0)); - } + CGAL_FUNCTOR_INIT_STORE(Squared_distance) + typedef R_ R; + typedef typename Get_type::type RT; + typedef typename Get_type::type Point; + typedef typename Get_functor >::type CI; + typedef RT result_type; + typedef Point first_argument_type; + typedef Point second_argument_type; + struct Sq_diff : CGAL::cpp98::binary_function { + RT operator()(RT const&a, RT const&b)const{ + return CGAL::square(a-b); + } + }; + result_type operator()(Point const&a, Point const&b)const{ + CI ci(this->kernel()); + Sq_diff f; + // TODO: avoid this RT(0)+... + return std::accumulate(make_transforming_pair_iterator(ci(a,Begin_tag()),ci(b,Begin_tag()),f),make_transforming_pair_iterator(ci(a,End_tag()),ci(b,End_tag()),f),RT(0)); + } }; } @@ -1047,9 +1047,9 @@ template struct Scalar_product : private Store_kernel { std::multiplies f; // TODO: avoid this RT(0)+... return std::accumulate( - make_transforming_pair_iterator(ci(a,Begin_tag()),ci(b,Begin_tag()),f), - make_transforming_pair_iterator(ci(a, End_tag()),ci(b, End_tag()),f), - RT(0)); + make_transforming_pair_iterator(ci(a,Begin_tag()),ci(b,Begin_tag()),f), + make_transforming_pair_iterator(ci(a, End_tag()),ci(b, End_tag()),f), + RT(0)); } }; } @@ -1058,23 +1058,23 @@ CGAL_KD_DEFAULT_FUNCTOR(Scalar_product_tag,(CartesianDKernelFunctors::Scalar_pro namespace CartesianDKernelFunctors { template struct Compare_distance : private Store_kernel { - CGAL_FUNCTOR_INIT_STORE(Compare_distance) - typedef R_ R; - typedef typename Get_type::type Point; - typedef typename Get_functor::type CSD; - typedef typename Get_type::type result_type; - typedef Point first_argument_type; - typedef Point second_argument_type; - typedef Point third_argument_type; // why am I doing this already? - typedef Point fourth_argument_type; - result_type operator()(Point const&a, Point const&b, Point const&c)const{ - CSD csd(this->kernel()); - return CGAL_NTS compare(csd(a,b),csd(a,c)); - } - result_type operator()(Point const&a, Point const&b, Point const&c, Point const&d)const{ - CSD csd(this->kernel()); - return CGAL_NTS compare(csd(a,b),csd(c,d)); - } + CGAL_FUNCTOR_INIT_STORE(Compare_distance) + typedef R_ R; + typedef typename Get_type::type Point; + typedef typename Get_functor::type CSD; + typedef typename Get_type::type result_type; + typedef Point first_argument_type; + typedef Point second_argument_type; + typedef Point third_argument_type; // why am I doing this already? + typedef Point fourth_argument_type; + result_type operator()(Point const&a, Point const&b, Point const&c)const{ + CSD csd(this->kernel()); + return CGAL_NTS compare(csd(a,b),csd(a,c)); + } + result_type operator()(Point const&a, Point const&b, Point const&c, Point const&d)const{ + CSD csd(this->kernel()); + return CGAL_NTS compare(csd(a,b),csd(c,d)); + } }; } @@ -1082,19 +1082,19 @@ CGAL_KD_DEFAULT_FUNCTOR(Compare_distance_tag,(CartesianDKernelFunctors::Compare_ namespace CartesianDKernelFunctors { template struct Less_point_cartesian_coordinate : private Store_kernel { - CGAL_FUNCTOR_INIT_STORE(Less_point_cartesian_coordinate) - typedef R_ R; - typedef typename Get_type::type result_type; - typedef typename Get_functor::type Cc; - // TODO: This is_exact thing should be reengineered. - // the goal is to have a way to tell: don't filter this - typedef typename CGAL::Is_exact Is_exact; + CGAL_FUNCTOR_INIT_STORE(Less_point_cartesian_coordinate) + typedef R_ R; + typedef typename Get_type::type result_type; + typedef typename Get_functor::type Cc; + // TODO: This is_exact thing should be reengineered. + // the goal is to have a way to tell: don't filter this + typedef typename CGAL::Is_exact Is_exact; - template - result_type operator()(V const&a, W const&b, I i)const{ - Cc c(this->kernel()); - return c(a,i) + result_type operator()(V const&a, W const&b, I i)const{ + Cc c(this->kernel()); + return c(a,i) struct Compare_point_cartesian_coordinate : private Store_kernel { - CGAL_FUNCTOR_INIT_STORE(Compare_point_cartesian_coordinate) - typedef R_ R; - typedef typename Get_type::type result_type; - typedef typename Get_functor::type Cc; - // TODO: This is_exact thing should be reengineered. - // the goal is to have a way to tell: don't filter this - typedef typename CGAL::Is_exact Is_exact; + CGAL_FUNCTOR_INIT_STORE(Compare_point_cartesian_coordinate) + typedef R_ R; + typedef typename Get_type::type result_type; + typedef typename Get_functor::type Cc; + // TODO: This is_exact thing should be reengineered. + // the goal is to have a way to tell: don't filter this + typedef typename CGAL::Is_exact Is_exact; - template - result_type operator()(V const&a, W const&b, I i)const{ - Cc c(this->kernel()); - return CGAL_NTS compare(c(a,i),c(b,i)); - } + template + result_type operator()(V const&a, W const&b, I i)const{ + Cc c(this->kernel()); + return CGAL_NTS compare(c(a,i),c(b,i)); + } }; } @@ -1122,29 +1122,29 @@ CGAL_KD_DEFAULT_FUNCTOR(Compare_point_cartesian_coordinate_tag,(CartesianDKernel namespace CartesianDKernelFunctors { template struct Compare_lexicographically : private Store_kernel { - CGAL_FUNCTOR_INIT_STORE(Compare_lexicographically) - typedef R_ R; - typedef typename Get_type::type result_type; - typedef typename Get_functor >::type CI; - // TODO: This is_exact thing should be reengineered. - // the goal is to have a way to tell: don't filter this - typedef typename CGAL::Is_exact Is_exact; + CGAL_FUNCTOR_INIT_STORE(Compare_lexicographically) + typedef R_ R; + typedef typename Get_type::type result_type; + typedef typename Get_functor >::type CI; + // TODO: This is_exact thing should be reengineered. + // the goal is to have a way to tell: don't filter this + typedef typename CGAL::Is_exact Is_exact; - template - result_type operator()(V const&a, W const&b)const{ - CI c(this->kernel()); + template + result_type operator()(V const&a, W const&b)const{ + CI c(this->kernel()); auto a_begin=c(a,Begin_tag()); auto b_begin=c(b,Begin_tag()); auto a_end=c(a,End_tag()); - result_type res; - // can't we do slightly better for Uncertain<*> ? - // after res=...; if(is_uncertain(res))return indeterminate(); - do res=CGAL_NTS compare(*a_begin++,*b_begin++); - while(a_begin!=a_end && res==EQUAL); - return res; - } + result_type res; + // can't we do slightly better for Uncertain<*> ? + // after res=...; if(is_uncertain(res))return indeterminate(); + do res=CGAL_NTS compare(*a_begin++,*b_begin++); + while(a_begin!=a_end && res==EQUAL); + return res; + } }; } @@ -1152,17 +1152,17 @@ CGAL_KD_DEFAULT_FUNCTOR(Compare_lexicographically_tag,(CartesianDKernelFunctors: namespace CartesianDKernelFunctors { template struct Less_lexicographically : private Store_kernel { - CGAL_FUNCTOR_INIT_STORE(Less_lexicographically) - typedef R_ R; - typedef typename Get_type::type result_type; - typedef typename Get_functor::type CL; - typedef typename CGAL::Is_exact Is_exact; + CGAL_FUNCTOR_INIT_STORE(Less_lexicographically) + typedef R_ R; + typedef typename Get_type::type result_type; + typedef typename Get_functor::type CL; + typedef typename CGAL::Is_exact Is_exact; - template - result_type operator() (V const&a, W const&b) const { - CL c (this->kernel()); - return c(a,b) < 0; - } + template + result_type operator() (V const&a, W const&b) const { + CL c (this->kernel()); + return c(a,b) < 0; + } }; } @@ -1170,17 +1170,17 @@ CGAL_KD_DEFAULT_FUNCTOR(Less_lexicographically_tag,(CartesianDKernelFunctors::Le namespace CartesianDKernelFunctors { template struct Less_or_equal_lexicographically : private Store_kernel { - CGAL_FUNCTOR_INIT_STORE(Less_or_equal_lexicographically) - typedef R_ R; - typedef typename Get_type::type result_type; - typedef typename Get_functor::type CL; - typedef typename CGAL::Is_exact Is_exact; + CGAL_FUNCTOR_INIT_STORE(Less_or_equal_lexicographically) + typedef R_ R; + typedef typename Get_type::type result_type; + typedef typename Get_functor::type CL; + typedef typename CGAL::Is_exact Is_exact; - template - result_type operator() (V const&a, W const&b) const { - CL c (this->kernel()); - return c(a,b) <= 0; - } + template + result_type operator() (V const&a, W const&b) const { + CL c (this->kernel()); + return c(a,b) <= 0; + } }; } @@ -1188,29 +1188,29 @@ CGAL_KD_DEFAULT_FUNCTOR(Less_or_equal_lexicographically_tag,(CartesianDKernelFun namespace CartesianDKernelFunctors { template struct Equal_points : private Store_kernel { - CGAL_FUNCTOR_INIT_STORE(Equal_points) - typedef R_ R; - typedef typename Get_type::type result_type; - typedef typename Get_functor >::type CI; - // TODO: This is_exact thing should be reengineered. - // the goal is to have a way to tell: don't filter this - typedef typename CGAL::Is_exact Is_exact; + CGAL_FUNCTOR_INIT_STORE(Equal_points) + typedef R_ R; + typedef typename Get_type::type result_type; + typedef typename Get_functor >::type CI; + // TODO: This is_exact thing should be reengineered. + // the goal is to have a way to tell: don't filter this + typedef typename CGAL::Is_exact Is_exact; - template - result_type operator()(V const&a, W const&b)const{ - CI c(this->kernel()); + template + result_type operator()(V const&a, W const&b)const{ + CI c(this->kernel()); auto a_begin=c(a,Begin_tag()); auto b_begin=c(b,Begin_tag()); auto a_end=c(a,End_tag()); - result_type res = true; - // Is using CGAL::possibly for Uncertain really an optimization? - do res = res & (*a_begin++ == *b_begin++); - while(a_begin!=a_end && possibly(res)); - return res; - } + result_type res = true; + // Is using CGAL::possibly for Uncertain really an optimization? + do res = res & (*a_begin++ == *b_begin++); + while(a_begin!=a_end && possibly(res)); + return res; + } }; } @@ -1218,29 +1218,29 @@ CGAL_KD_DEFAULT_FUNCTOR(Equal_points_tag,(CartesianDKernelFunctors::Equal_points namespace CartesianDKernelFunctors { template struct Oriented_side : private Store_kernel { - CGAL_FUNCTOR_INIT_STORE(Oriented_side) - typedef R_ R; - typedef typename Get_type::type result_type; - typedef typename Get_type::type Point; - typedef typename Get_type::type Hyperplane; - typedef typename Get_type::type Sphere; - typedef typename Get_functor::type VA; - typedef typename Get_functor::type HT; - typedef typename Get_functor::type SD; - typedef typename Get_functor::type SR; - typedef typename Get_functor::type CS; + CGAL_FUNCTOR_INIT_STORE(Oriented_side) + typedef R_ R; + typedef typename Get_type::type result_type; + typedef typename Get_type::type Point; + typedef typename Get_type::type Hyperplane; + typedef typename Get_type::type Sphere; + typedef typename Get_functor::type VA; + typedef typename Get_functor::type HT; + typedef typename Get_functor::type SD; + typedef typename Get_functor::type SR; + typedef typename Get_functor::type CS; - result_type operator()(Hyperplane const&h, Point const&p)const{ - HT ht(this->kernel()); - VA va(this->kernel()); - return CGAL::compare(va(h,p),ht(h)); - } - result_type operator()(Sphere const&s, Point const&p)const{ - SD sd(this->kernel()); - SR sr(this->kernel()); - CS cs(this->kernel()); - return CGAL::compare(sd(cs(s),p),sr(s)); - } + result_type operator()(Hyperplane const&h, Point const&p)const{ + HT ht(this->kernel()); + VA va(this->kernel()); + return CGAL::compare(va(h,p),ht(h)); + } + result_type operator()(Sphere const&s, Point const&p)const{ + SD sd(this->kernel()); + SR sr(this->kernel()); + CS cs(this->kernel()); + return CGAL::compare(sd(cs(s),p),sr(s)); + } }; } @@ -1248,16 +1248,16 @@ CGAL_KD_DEFAULT_FUNCTOR(Oriented_side_tag,(CartesianDKernelFunctors::Oriented_si namespace CartesianDKernelFunctors { template struct Has_on_positive_side : private Store_kernel { - CGAL_FUNCTOR_INIT_STORE(Has_on_positive_side) - typedef R_ R; - typedef typename Get_type::type result_type; - typedef typename Get_functor::type OS; + CGAL_FUNCTOR_INIT_STORE(Has_on_positive_side) + typedef R_ R; + typedef typename Get_type::type result_type; + typedef typename Get_functor::type OS; - template - result_type operator()(Obj const&o, Pt const&p)const{ - OS os(this->kernel()); - return os(o,p) == ON_POSITIVE_SIDE; - } + template + result_type operator()(Obj const&o, Pt const&p)const{ + OS os(this->kernel()); + return os(o,p) == ON_POSITIVE_SIDE; + } }; } diff --git a/NewKernel_d/include/CGAL/NewKernel_d/functor_tags.h b/NewKernel_d/include/CGAL/NewKernel_d/functor_tags.h index 043982bf862..99a28ab578f 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/functor_tags.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/functor_tags.h @@ -36,91 +36,91 @@ namespace CGAL { class Null_type {~Null_type();}; // no such object should be created - // To construct iterators - struct Begin_tag {}; - struct End_tag {}; + // To construct iterators + struct Begin_tag {}; + struct End_tag {}; - // Functor category - struct Predicate_tag {}; - struct Construct_tag {}; - struct Construct_iterator_tag {}; - struct Compute_tag {}; - struct Misc_tag {}; + // Functor category + struct Predicate_tag {}; + struct Construct_tag {}; + struct Construct_iterator_tag {}; + struct Compute_tag {}; + struct Misc_tag {}; - struct No_filter_tag {}; + struct No_filter_tag {}; - templatestruct Construct_ttag {}; - templatestruct Convert_ttag {}; + templatestruct Construct_ttag {}; + templatestruct Convert_ttag {}; - template struct Get_functor_category { typedef Misc_tag type; }; - template struct Typedef_tag_type; - //template struct Read_tag_type {}; + template struct Get_functor_category { typedef Misc_tag type; }; + template struct Typedef_tag_type; + //template struct Read_tag_type {}; - template - struct Provides_type - : Has_type_different_from, Null_type> {}; + template + struct Provides_type + : Has_type_different_from, Null_type> {}; - template - struct Provides_functor - : Has_type_different_from, Null_functor> {}; + template + struct Provides_functor + : Has_type_different_from, Null_functor> {}; - template::type::value> - struct Provides_functors : boost::mpl::and_ < - Provides_functor::type>, - Provides_functors::type> > {}; - template - struct Provides_functors : boost::true_type {}; + template::type::value> + struct Provides_functors : boost::mpl::and_ < + Provides_functor::type>, + Provides_functors::type> > {}; + template + struct Provides_functors : boost::true_type {}; - template::type::value> - struct Provides_types : boost::mpl::and_ < - Provides_type::type>, - Provides_types::type> > {}; - template - struct Provides_types : boost::true_type {}; + template::type::value> + struct Provides_types : boost::mpl::and_ < + Provides_type::type>, + Provides_types::type> > {}; + template + struct Provides_types : boost::true_type {}; - namespace internal { BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(has_Type,template Type,false) } - template::value /* false */> - struct Provides_type_i : boost::false_type {}; - template - struct Provides_type_i - : Has_type_different_from, Null_type> {}; + namespace internal { BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(has_Type,template Type,false) } + template::value /* false */> + struct Provides_type_i : boost::false_type {}; + template + struct Provides_type_i + : Has_type_different_from, Null_type> {}; - //// This version does not like Functor - //namespace internal { BOOST_MPL_HAS_XXX_TEMPLATE_NAMED_DEF(has_Functor,Functor,false) } - // This version lets us use non-type template parameters, but fails with older EDG-based compilers (Intel 14). - namespace internal { BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(has_Functor,template Functor,false) } + //// This version does not like Functor + //namespace internal { BOOST_MPL_HAS_XXX_TEMPLATE_NAMED_DEF(has_Functor,Functor,false) } + // This version lets us use non-type template parameters, but fails with older EDG-based compilers (Intel 14). + namespace internal { BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(has_Functor,template Functor,false) } - template::value /* false */> - struct Provides_functor_i : boost::false_type {}; - template - struct Provides_functor_i - : Has_type_different_from, Null_functor> {}; + template::value /* false */> + struct Provides_functor_i : boost::false_type {}; + template + struct Provides_functor_i + : Has_type_different_from, Null_functor> {}; - // TODO: Refine this a bit. - template ::value, - //bool=Provides_functor_i::value, - bool = internal::has_Functor::value - > - struct Inherit_functor : K::template Functor {}; - template - struct Inherit_functor {}; + // TODO: Refine this a bit. + template ::value, + //bool=Provides_functor_i::value, + bool = internal::has_Functor::value + > + struct Inherit_functor : K::template Functor {}; + template + struct Inherit_functor {}; - template ::value> - struct Inherit_type : K::template Type {}; - template - struct Inherit_type {}; + template ::value> + struct Inherit_type : K::template Type {}; + template + struct Inherit_type {}; - struct Number_tag {}; - struct Discrete_tag {}; - struct Object_tag {}; - template struct Get_type_category { - // The lazy kernel uses it too eagerly, - // so it currently needs a default. - typedef Null_tag type; - }; + struct Number_tag {}; + struct Discrete_tag {}; + struct Object_tag {}; + template struct Get_type_category { + // The lazy kernel uses it too eagerly, + // so it currently needs a default. + typedef Null_tag type; + }; #define CGAL_DECL_OBJ_(X,Y) \ template \ @@ -136,80 +136,80 @@ namespace CGAL { //template //struct Read_tag_type { typedef typename Kernel::X type; } - // Not exactly objects, but the extras can't hurt. - CGAL_DECL_OBJ(FT, Number); - CGAL_DECL_OBJ(RT, Number); + // Not exactly objects, but the extras can't hurt. + CGAL_DECL_OBJ(FT, Number); + CGAL_DECL_OBJ(RT, Number); - CGAL_DECL_OBJ(Bool, Discrete); // Boolean_tag is already taken, and is a template :-( - CGAL_DECL_OBJ(Comparison_result, Discrete); - CGAL_DECL_OBJ(Sign, Discrete); - CGAL_DECL_OBJ(Orientation, Discrete); // Note: duplicate with the functor tag! - CGAL_DECL_OBJ(Oriented_side, Discrete); - CGAL_DECL_OBJ(Bounded_side, Discrete); - CGAL_DECL_OBJ(Angle, Discrete); - CGAL_DECL_OBJ(Flat_orientation, Discrete); + CGAL_DECL_OBJ(Bool, Discrete); // Boolean_tag is already taken, and is a template :-( + CGAL_DECL_OBJ(Comparison_result, Discrete); + CGAL_DECL_OBJ(Sign, Discrete); + CGAL_DECL_OBJ(Orientation, Discrete); // Note: duplicate with the functor tag! + CGAL_DECL_OBJ(Oriented_side, Discrete); + CGAL_DECL_OBJ(Bounded_side, Discrete); + CGAL_DECL_OBJ(Angle, Discrete); + CGAL_DECL_OBJ(Flat_orientation, Discrete); - CGAL_DECL_OBJ(Vector, Object); - CGAL_DECL_OBJ(Point, Object); - CGAL_DECL_OBJ(Segment, Object); - CGAL_DECL_OBJ(Sphere, Object); - CGAL_DECL_OBJ(Line, Object); - CGAL_DECL_OBJ(Direction, Object); - CGAL_DECL_OBJ(Hyperplane, Object); - CGAL_DECL_OBJ(Ray, Object); - CGAL_DECL_OBJ(Iso_box, Object); - CGAL_DECL_OBJ(Bbox, Object); - CGAL_DECL_OBJ(Aff_transformation, Object); - CGAL_DECL_OBJ(Weighted_point, Object); + CGAL_DECL_OBJ(Vector, Object); + CGAL_DECL_OBJ(Point, Object); + CGAL_DECL_OBJ(Segment, Object); + CGAL_DECL_OBJ(Sphere, Object); + CGAL_DECL_OBJ(Line, Object); + CGAL_DECL_OBJ(Direction, Object); + CGAL_DECL_OBJ(Hyperplane, Object); + CGAL_DECL_OBJ(Ray, Object); + CGAL_DECL_OBJ(Iso_box, Object); + CGAL_DECL_OBJ(Bbox, Object); + CGAL_DECL_OBJ(Aff_transformation, Object); + CGAL_DECL_OBJ(Weighted_point, Object); #undef CGAL_DECL_OBJ_ #undef CGAL_DECL_OBJ // Intel fails with those, and they are not so useful. -// CGAL_KD_DEFAULT_TYPE(RT_tag,(typename Get_type::type),(),()); -// CGAL_KD_DEFAULT_TYPE(FT_tag,(CGAL::Quotient::type>),(),()); +// CGAL_KD_DEFAULT_TYPE(RT_tag,(typename Get_type::type),(),()); +// CGAL_KD_DEFAULT_TYPE(FT_tag,(CGAL::Quotient::type>),(),()); #define CGAL_SMURF2(A,B) CGAL_KD_DEFAULT_TYPE(A##_tag,(typename Same_uncertainty_nt::type>::type),(RT_tag),()) #define CGAL_SMURF1(A) CGAL_SMURF2(A,CGAL::A) - CGAL_SMURF2(Bool, bool); - CGAL_SMURF1(Sign); - CGAL_SMURF1(Comparison_result); - CGAL_SMURF1(Orientation); - CGAL_SMURF1(Oriented_side); - CGAL_SMURF1(Bounded_side); - CGAL_SMURF1(Angle); + CGAL_SMURF2(Bool, bool); + CGAL_SMURF1(Sign); + CGAL_SMURF1(Comparison_result); + CGAL_SMURF1(Orientation); + CGAL_SMURF1(Oriented_side); + CGAL_SMURF1(Bounded_side); + CGAL_SMURF1(Angle); #undef CGAL_SMURF1 #undef CGAL_SMURF2 - // TODO: replace with Get_type_category - template struct is_NT_tag { enum { value = false }; }; - template<> struct is_NT_tag { enum { value = true }; }; - template<> struct is_NT_tag { enum { value = true }; }; + // TODO: replace with Get_type_category + template struct is_NT_tag { enum { value = false }; }; + template<> struct is_NT_tag { enum { value = true }; }; + template<> struct is_NT_tag { enum { value = true }; }; - template struct iterator_tag_traits { - enum { is_iterator = false, has_nth_element = false }; - typedef Null_tag value_tag; - }; + template struct iterator_tag_traits { + enum { is_iterator = false, has_nth_element = false }; + typedef Null_tag value_tag; + }; - templatestruct map_result_tag{typedef Null_type type;}; - templatestruct map_result_tag >{typedef T type;}; + templatestruct map_result_tag{typedef Null_type type;}; + templatestruct map_result_tag >{typedef T type;}; #define CGAL_DECL_COMPUTE(X) struct X##_tag {}; \ - template<>struct map_result_tag{typedef FT_tag type;}; \ - templatestruct Get_functor_category{typedef Compute_tag type;} - CGAL_DECL_COMPUTE(Compute_point_cartesian_coordinate); - CGAL_DECL_COMPUTE(Compute_vector_cartesian_coordinate); - CGAL_DECL_COMPUTE(Compute_homogeneous_coordinate); - CGAL_DECL_COMPUTE(Squared_distance); - CGAL_DECL_COMPUTE(Squared_distance_to_origin); - CGAL_DECL_COMPUTE(Squared_length); - CGAL_DECL_COMPUTE(Squared_radius); - CGAL_DECL_COMPUTE(Squared_circumradius); - CGAL_DECL_COMPUTE(Scalar_product); - CGAL_DECL_COMPUTE(Hyperplane_translation); - CGAL_DECL_COMPUTE(Value_at); - CGAL_DECL_COMPUTE(Point_weight); - CGAL_DECL_COMPUTE(Power_distance); - CGAL_DECL_COMPUTE(Power_distance_to_point); + template<>struct map_result_tag{typedef FT_tag type;}; \ + templatestruct Get_functor_category{typedef Compute_tag type;} + CGAL_DECL_COMPUTE(Compute_point_cartesian_coordinate); + CGAL_DECL_COMPUTE(Compute_vector_cartesian_coordinate); + CGAL_DECL_COMPUTE(Compute_homogeneous_coordinate); + CGAL_DECL_COMPUTE(Squared_distance); + CGAL_DECL_COMPUTE(Squared_distance_to_origin); + CGAL_DECL_COMPUTE(Squared_length); + CGAL_DECL_COMPUTE(Squared_radius); + CGAL_DECL_COMPUTE(Squared_circumradius); + CGAL_DECL_COMPUTE(Scalar_product); + CGAL_DECL_COMPUTE(Hyperplane_translation); + CGAL_DECL_COMPUTE(Value_at); + CGAL_DECL_COMPUTE(Point_weight); + CGAL_DECL_COMPUTE(Power_distance); + CGAL_DECL_COMPUTE(Power_distance_to_point); #undef CGAL_DECL_COMPUTE #define CGAL_DECL_ITER_OBJ(X,Y,Z,C) struct X##_tag {}; \ @@ -228,126 +228,126 @@ namespace CGAL { //template //struct Read_tag_type { typedef typename Kernel::X type; } - CGAL_DECL_ITER_OBJ(Vector_cartesian_const_iterator, FT, Compute_vector_cartesian_coordinate, Vector); - CGAL_DECL_ITER_OBJ(Point_cartesian_const_iterator, FT, Compute_point_cartesian_coordinate, Point); + CGAL_DECL_ITER_OBJ(Vector_cartesian_const_iterator, FT, Compute_vector_cartesian_coordinate, Vector); + CGAL_DECL_ITER_OBJ(Point_cartesian_const_iterator, FT, Compute_point_cartesian_coordinate, Point); #undef CGAL_DECL_ITER_OBJ - templatestruct Get_functor_category,B,C> : - boost::mpl::if_c::is_iterator, - Construct_iterator_tag, - Construct_tag> {}; + templatestruct Get_functor_category,B,C> : + boost::mpl::if_c::is_iterator, + Construct_iterator_tag, + Construct_tag> {}; - // Really? - templatestruct Get_functor_category,B,C>{typedef Misc_tag type;}; + // Really? + templatestruct Get_functor_category,B,C>{typedef Misc_tag type;}; #define CGAL_DECL_CONSTRUCT(X,Y) struct X##_tag {}; \ - template<>struct map_result_tag{typedef Y##_tag type;}; \ - templatestruct Get_functor_category{typedef Construct_tag type;} - CGAL_DECL_CONSTRUCT(Midpoint,Point); - CGAL_DECL_CONSTRUCT(Center_of_sphere,Point); - CGAL_DECL_CONSTRUCT(Point_of_sphere,Point); - CGAL_DECL_CONSTRUCT(Segment_extremity,Point); - CGAL_DECL_CONSTRUCT(Sum_of_vectors,Vector); - CGAL_DECL_CONSTRUCT(Difference_of_vectors,Vector); - CGAL_DECL_CONSTRUCT(Opposite_vector,Vector); - CGAL_DECL_CONSTRUCT(Scaled_vector,Vector); - CGAL_DECL_CONSTRUCT(Orthogonal_vector,Vector); - CGAL_DECL_CONSTRUCT(Difference_of_points,Vector); - CGAL_DECL_CONSTRUCT(Translated_point,Point); - CGAL_DECL_CONSTRUCT(Point_to_vector,Vector); - CGAL_DECL_CONSTRUCT(Vector_to_point,Point); - CGAL_DECL_CONSTRUCT(Construct_min_vertex,Point); - CGAL_DECL_CONSTRUCT(Construct_max_vertex,Point); - CGAL_DECL_CONSTRUCT(Construct_circumcenter,Point); - CGAL_DECL_CONSTRUCT(Point_drop_weight,Point); - CGAL_DECL_CONSTRUCT(Power_center,Weighted_point); + template<>struct map_result_tag{typedef Y##_tag type;}; \ + templatestruct Get_functor_category{typedef Construct_tag type;} + CGAL_DECL_CONSTRUCT(Midpoint,Point); + CGAL_DECL_CONSTRUCT(Center_of_sphere,Point); + CGAL_DECL_CONSTRUCT(Point_of_sphere,Point); + CGAL_DECL_CONSTRUCT(Segment_extremity,Point); + CGAL_DECL_CONSTRUCT(Sum_of_vectors,Vector); + CGAL_DECL_CONSTRUCT(Difference_of_vectors,Vector); + CGAL_DECL_CONSTRUCT(Opposite_vector,Vector); + CGAL_DECL_CONSTRUCT(Scaled_vector,Vector); + CGAL_DECL_CONSTRUCT(Orthogonal_vector,Vector); + CGAL_DECL_CONSTRUCT(Difference_of_points,Vector); + CGAL_DECL_CONSTRUCT(Translated_point,Point); + CGAL_DECL_CONSTRUCT(Point_to_vector,Vector); + CGAL_DECL_CONSTRUCT(Vector_to_point,Point); + CGAL_DECL_CONSTRUCT(Construct_min_vertex,Point); + CGAL_DECL_CONSTRUCT(Construct_max_vertex,Point); + CGAL_DECL_CONSTRUCT(Construct_circumcenter,Point); + CGAL_DECL_CONSTRUCT(Point_drop_weight,Point); + CGAL_DECL_CONSTRUCT(Power_center,Weighted_point); #undef CGAL_DECL_CONSTRUCT #if 0 #define CGAL_DECL_ITER_CONSTRUCT(X,Y) struct X##_tag {}; \ - template<>struct map_result_tag{typedef Y##_tag type;}; \ - template<>struct map_functor_type{typedef Construct_iterator_tag type;} - CGAL_DECL_ITER_CONSTRUCT(Construct_point_cartesian_const_iterator,Point_cartesian_const_iterator); - CGAL_DECL_ITER_CONSTRUCT(Construct_vector_cartesian_const_iterator,Vector_cartesian_const_iterator); + template<>struct map_result_tag{typedef Y##_tag type;}; \ + template<>struct map_functor_type{typedef Construct_iterator_tag type;} + CGAL_DECL_ITER_CONSTRUCT(Construct_point_cartesian_const_iterator,Point_cartesian_const_iterator); + CGAL_DECL_ITER_CONSTRUCT(Construct_vector_cartesian_const_iterator,Vector_cartesian_const_iterator); #undef CGAL_DECL_ITER_CONSTRUCT #endif - //FIXME: choose a convention: prefix with Predicate_ ? + //FIXME: choose a convention: prefix with Predicate_ ? #define CGAL_DECL_PREDICATE_(X) \ - templatestruct Get_functor_category{typedef Predicate_tag type;} + templatestruct Get_functor_category{typedef Predicate_tag type;} #define CGAL_DECL_PREDICATE(X) struct X##_tag {}; \ - CGAL_DECL_PREDICATE_(X) - CGAL_DECL_PREDICATE(Less_point_cartesian_coordinate); - CGAL_DECL_PREDICATE(Compare_point_cartesian_coordinate); - CGAL_DECL_PREDICATE(Compare_distance); - CGAL_DECL_PREDICATE(Compare_lexicographically); - CGAL_DECL_PREDICATE(Less_lexicographically); - CGAL_DECL_PREDICATE(Less_or_equal_lexicographically); - CGAL_DECL_PREDICATE(Equal_points); - CGAL_DECL_PREDICATE(Has_on_positive_side); - CGAL_DECL_PREDICATE_(Orientation); // duplicate with the type - CGAL_DECL_PREDICATE_(Oriented_side); // duplicate with the type - CGAL_DECL_PREDICATE(Orientation_of_points); - CGAL_DECL_PREDICATE(Orientation_of_vectors); - CGAL_DECL_PREDICATE(Side_of_oriented_sphere); - CGAL_DECL_PREDICATE(Side_of_bounded_sphere); - CGAL_DECL_PREDICATE(Side_of_bounded_circumsphere); - CGAL_DECL_PREDICATE(Contained_in_affine_hull); - CGAL_DECL_PREDICATE(In_flat_orientation); - CGAL_DECL_PREDICATE(In_flat_side_of_oriented_sphere); - CGAL_DECL_PREDICATE(Construct_flat_orientation); // Making it a predicate is a questionable choice, it should be possible to let it be a construction for some implementations. Not sure how to do that... TODO - CGAL_DECL_PREDICATE(Linear_rank); - CGAL_DECL_PREDICATE(Affine_rank); - CGAL_DECL_PREDICATE(Linearly_independent); - CGAL_DECL_PREDICATE(Affinely_independent); - CGAL_DECL_PREDICATE(Contained_in_linear_hull); - CGAL_DECL_PREDICATE(Contained_in_simplex); - CGAL_DECL_PREDICATE(Power_side_of_power_sphere_raw); - CGAL_DECL_PREDICATE(Power_side_of_power_sphere); + CGAL_DECL_PREDICATE_(X) + CGAL_DECL_PREDICATE(Less_point_cartesian_coordinate); + CGAL_DECL_PREDICATE(Compare_point_cartesian_coordinate); + CGAL_DECL_PREDICATE(Compare_distance); + CGAL_DECL_PREDICATE(Compare_lexicographically); + CGAL_DECL_PREDICATE(Less_lexicographically); + CGAL_DECL_PREDICATE(Less_or_equal_lexicographically); + CGAL_DECL_PREDICATE(Equal_points); + CGAL_DECL_PREDICATE(Has_on_positive_side); + CGAL_DECL_PREDICATE_(Orientation); // duplicate with the type + CGAL_DECL_PREDICATE_(Oriented_side); // duplicate with the type + CGAL_DECL_PREDICATE(Orientation_of_points); + CGAL_DECL_PREDICATE(Orientation_of_vectors); + CGAL_DECL_PREDICATE(Side_of_oriented_sphere); + CGAL_DECL_PREDICATE(Side_of_bounded_sphere); + CGAL_DECL_PREDICATE(Side_of_bounded_circumsphere); + CGAL_DECL_PREDICATE(Contained_in_affine_hull); + CGAL_DECL_PREDICATE(In_flat_orientation); + CGAL_DECL_PREDICATE(In_flat_side_of_oriented_sphere); + CGAL_DECL_PREDICATE(Construct_flat_orientation); // Making it a predicate is a questionable choice, it should be possible to let it be a construction for some implementations. Not sure how to do that... TODO + CGAL_DECL_PREDICATE(Linear_rank); + CGAL_DECL_PREDICATE(Affine_rank); + CGAL_DECL_PREDICATE(Linearly_independent); + CGAL_DECL_PREDICATE(Affinely_independent); + CGAL_DECL_PREDICATE(Contained_in_linear_hull); + CGAL_DECL_PREDICATE(Contained_in_simplex); + CGAL_DECL_PREDICATE(Power_side_of_power_sphere_raw); + CGAL_DECL_PREDICATE(Power_side_of_power_sphere); CGAL_DECL_PREDICATE(Power_side_of_bounded_power_circumsphere); - CGAL_DECL_PREDICATE(In_flat_power_side_of_power_sphere_raw); - CGAL_DECL_PREDICATE(In_flat_power_side_of_power_sphere); + CGAL_DECL_PREDICATE(In_flat_power_side_of_power_sphere_raw); + CGAL_DECL_PREDICATE(In_flat_power_side_of_power_sphere); #undef CGAL_DECL_PREDICATE #define CGAL_DECL_MISC(X) struct X##_tag {}; \ - templatestruct Get_functor_category{typedef Misc_tag type;} - //TODO: split into _begin and _end ? - //CGAL_DECL_MISC(Construct_point_cartesian_const_iterator); - //CGAL_DECL_MISC(Construct_vector_cartesian_const_iterator); - CGAL_DECL_MISC(Point_dimension); - CGAL_DECL_MISC(Vector_dimension); - CGAL_DECL_MISC(Linear_base); // Find a more appropriate category? + templatestruct Get_functor_category{typedef Misc_tag type;} + //TODO: split into _begin and _end ? + //CGAL_DECL_MISC(Construct_point_cartesian_const_iterator); + //CGAL_DECL_MISC(Construct_vector_cartesian_const_iterator); + CGAL_DECL_MISC(Point_dimension); + CGAL_DECL_MISC(Vector_dimension); + CGAL_DECL_MISC(Linear_base); // Find a more appropriate category? #undef CGAL_DECL_MISC - // Properties for LA - struct Has_extra_dimension_tag {}; - struct Has_vector_plus_minus_tag {}; - struct Has_vector_scalar_ops_tag {}; - struct Has_dot_product_tag {}; - struct Has_determinant_of_vectors_tag {}; - struct Has_determinant_of_points_tag {}; - struct Has_determinant_of_iterator_to_vectors_tag {}; - struct Has_determinant_of_iterator_to_points_tag {}; - struct Has_determinant_of_vectors_omit_last_tag {}; - struct Stores_squared_norm_tag {}; + // Properties for LA + struct Has_extra_dimension_tag {}; + struct Has_vector_plus_minus_tag {}; + struct Has_vector_scalar_ops_tag {}; + struct Has_dot_product_tag {}; + struct Has_determinant_of_vectors_tag {}; + struct Has_determinant_of_points_tag {}; + struct Has_determinant_of_iterator_to_vectors_tag {}; + struct Has_determinant_of_iterator_to_points_tag {}; + struct Has_determinant_of_vectors_omit_last_tag {}; + struct Stores_squared_norm_tag {}; - template struct Preserved_by_non_linear_extra_coordinate - : boost::false_type {}; - template<> struct Preserved_by_non_linear_extra_coordinate - : boost::true_type {}; - template<> struct Preserved_by_non_linear_extra_coordinate - : boost::true_type {}; - template<> struct Preserved_by_non_linear_extra_coordinate - : boost::true_type {}; - template<> struct Preserved_by_non_linear_extra_coordinate - : boost::true_type {}; - template<> struct Preserved_by_non_linear_extra_coordinate - : boost::true_type {}; - template<> struct Preserved_by_non_linear_extra_coordinate - : boost::true_type {}; + template struct Preserved_by_non_linear_extra_coordinate + : boost::false_type {}; + template<> struct Preserved_by_non_linear_extra_coordinate + : boost::true_type {}; + template<> struct Preserved_by_non_linear_extra_coordinate + : boost::true_type {}; + template<> struct Preserved_by_non_linear_extra_coordinate + : boost::true_type {}; + template<> struct Preserved_by_non_linear_extra_coordinate + : boost::true_type {}; + template<> struct Preserved_by_non_linear_extra_coordinate + : boost::true_type {}; + template<> struct Preserved_by_non_linear_extra_coordinate + : boost::true_type {}; - // Kernel properties - struct Point_stores_squared_distance_to_origin_tag {}; + // Kernel properties + struct Point_stores_squared_distance_to_origin_tag {}; } #endif // CGAL_FUNCTOR_TAGS_H diff --git a/NewKernel_d/test/NewKernel_d/CMakeLists.txt b/NewKernel_d/test/NewKernel_d/CMakeLists.txt index 8f7ee2b990c..e315981083a 100644 --- a/NewKernel_d/test/NewKernel_d/CMakeLists.txt +++ b/NewKernel_d/test/NewKernel_d/CMakeLists.txt @@ -27,8 +27,8 @@ if ( CGAL_FOUND ) endif() else() - + message(STATUS "NOTICE: This program requires the CGAL library, and will not be compiled.") - + endif() diff --git a/NewKernel_d/test/NewKernel_d/Epick_d.cpp b/NewKernel_d/test/NewKernel_d/Epick_d.cpp index 7a4a3b8ac24..21c64288380 100644 --- a/NewKernel_d/test/NewKernel_d/Epick_d.cpp +++ b/NewKernel_d/test/NewKernel_d/Epick_d.cpp @@ -42,8 +42,8 @@ CGAL::Cartesian_static_filters, // Yes, it is silly to pu >, RC > { - RC(){} - RC(int){} + RC(){} + RC(int){} }; struct K0 : RC {}; diff --git a/Number_types/include/CGAL/GMP/Gmpq_type.h b/Number_types/include/CGAL/GMP/Gmpq_type.h index e339590b8d1..54776eb5b78 100644 --- a/Number_types/include/CGAL/GMP/Gmpq_type.h +++ b/Number_types/include/CGAL/GMP/Gmpq_type.h @@ -1,9 +1,9 @@ -// Copyright (c) 2002,2003 +// Copyright (c) 2002,2003 // Utrecht University (The Netherlands), // ETH Zurich (Switzerland), // INRIA Sophia-Antipolis (France), // Max-Planck-Institute Saarbruecken (Germany), -// and Tel-Aviv University (Israel). All rights reserved. +// and Tel-Aviv University (Israel). All rights reserved. // // This file is part of CGAL (www.cgal.org) // diff --git a/Number_types/include/CGAL/Lazy_exact_nt.h b/Number_types/include/CGAL/Lazy_exact_nt.h index 41e2c597981..b0c401a3797 100644 --- a/Number_types/include/CGAL/Lazy_exact_nt.h +++ b/Number_types/include/CGAL/Lazy_exact_nt.h @@ -226,7 +226,7 @@ struct Lazy_exact_binary : public Lazy_exact_nt_rep mutable Lazy_exact_nt op2; Lazy_exact_binary (const Interval_nt &i, - const Lazy_exact_nt &a, const Lazy_exact_nt &b) + const Lazy_exact_nt &a, const Lazy_exact_nt &b) : Lazy_exact_nt_rep(i), op1(a), op2(b) { this->set_depth((std::max)(op1.depth(), op2.depth()) + 1); @@ -284,7 +284,7 @@ CGAL_LAZY_UNARY_OP(CGAL_NTS sqrt, Lazy_exact_Sqrt) template \ struct NAME : public Lazy_exact_binary \ { \ - typedef typename Lazy_exact_binary::AT::Protector P; \ + typedef typename Lazy_exact_binary::AT::Protector P; \ NAME (const Lazy_exact_nt &a, const Lazy_exact_nt &b) \ : Lazy_exact_binary((P(), a.approx() OP b.approx()), a, b) {} \ \ @@ -312,7 +312,7 @@ struct Lazy_exact_Min : public Lazy_exact_binary void update_exact() const { this->et = new ET((CGAL::min)(this->op1.exact(), this->op2.exact())); - if (!this->approx().is_point()) + if (!this->approx().is_point()) this->at = CGAL_NTS to_interval(*(this->et)); this->prune_dag(); } @@ -328,7 +328,7 @@ struct Lazy_exact_Max : public Lazy_exact_binary void update_exact() const { this->et = new ET((CGAL::max)(this->op1.exact(), this->op2.exact())); - if (!this->approx().is_point()) + if (!this->approx().is_point()) this->at = CGAL_NTS to_interval(*(this->et)); this->prune_dag(); } @@ -1010,9 +1010,9 @@ public: typedef typename INTERN_LAZY_EXACT_NT::Div_mod_selector , typename AST_ET::Div_mod > ::Div_mod Div_mod; - + typedef typename INTERN_LAZY_EXACT_NT::Inverse_selector - , typename AST_ET::Inverse > ::Inverse Inverse; + , typename AST_ET::Inverse > ::Inverse Inverse; }; @@ -1287,13 +1287,13 @@ struct Max > } }; -template inline +template inline Lazy_exact_nt min BOOST_PREVENT_MACRO_SUBSTITUTION( const Lazy_exact_nt & x, const Lazy_exact_nt & y){ return CGAL::Min > ()(x,y); } -template inline +template inline Lazy_exact_nt max BOOST_PREVENT_MACRO_SUBSTITUTION( const Lazy_exact_nt & x, const Lazy_exact_nt & y){ @@ -1386,8 +1386,8 @@ public: typedef Lazy_exact_nt NT; typedef ::CGAL::Tag_false Is_modularizable; typedef ::CGAL::Null_functor Residue_type; - typedef ::CGAL::Null_functor Modular_image; - typedef ::CGAL::Null_functor Modular_image_representative; + typedef ::CGAL::Null_functor Modular_image; + typedef ::CGAL::Null_functor Modular_image_representative; }; template< typename ET > @@ -1409,11 +1409,11 @@ public: typename MT_ET::Modular_image_representative modular_image_representative; return NT(modular_image_representative(x)); } - }; + }; }; } // namespace INTERN_LAZY_EXACT_NT -template < typename ET > +template < typename ET > class Modular_traits > :public INTERN_LAZY_EXACT_NT::Modular_traits_base ::Is_modularizable>{}; diff --git a/Number_types/include/CGAL/Sqrt_extension/Eigen_NumTraits.h b/Number_types/include/CGAL/Sqrt_extension/Eigen_NumTraits.h index dc934692689..b9bea7f0d10 100644 --- a/Number_types/include/CGAL/Sqrt_extension/Eigen_NumTraits.h +++ b/Number_types/include/CGAL/Sqrt_extension/Eigen_NumTraits.h @@ -28,7 +28,7 @@ namespace Eigen { AddCost = 2*NumTraits::AddCost+NumTraits::ReadCost, MulCost = 5*NumTraits::MulCost+2*NumTraits::AddCost }; - + typedef CGAL::Sqrt_extension Real; typedef Real NonInteger; typedef Real Nested; diff --git a/Number_types/test/Number_types/CMakeLists.txt b/Number_types/test/Number_types/CMakeLists.txt index 0bb60b63e1d..a10e4a8ee8b 100644 --- a/Number_types/test/Number_types/CMakeLists.txt +++ b/Number_types/test/Number_types/CMakeLists.txt @@ -79,13 +79,13 @@ if ( CGAL_FOUND ) create_single_source_cgal_program( "Gmpfr_bug.cpp" ) create_single_source_cgal_program( "Quotient_new.cpp" ) create_single_source_cgal_program( "test_nt_Coercion_traits.cpp" ) - + create_single_source_cgal_program( "eigen.cpp" ) find_package(Eigen3 3.2.0) #(requires 3.2.0 or greater) if (EIGEN3_FOUND) cgal_target_use_Eigen(eigen) endif() - + else( CGAL_FOUND ) message(STATUS diff --git a/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/scene.h b/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/scene.h index 5693f0fbb30..758fc216ef4 100644 --- a/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/scene.h +++ b/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/scene.h @@ -92,7 +92,7 @@ private: return K::Point_3 (sample.point().x(), sample.point().y(), 0.); } }; - + // data std::vector m_samples; @@ -106,10 +106,10 @@ private: double m_bbox_x; double m_bbox_y; double m_bbox_size; - + //Random CGAL::Random random; - + template Vector random_vec(const double scale) { @@ -410,7 +410,7 @@ public: 3); std::cerr << "Average spacing = " << spacing << std::endl; } - + void print_vertex(Vertex vertex) { std::cout << "vertex " << vertex << std::endl; } @@ -639,7 +639,7 @@ public: if (view_tolerance) draw_tolerance(viewer); - + if (view_edges) m_pwsrec->draw_edges(0.5f * line_thickness, 0.9f, 0.9f, 0.9f); diff --git a/Periodic_2_triangulation_2/doc/Periodic_2_triangulation_2/CGAL/draw_periodic_2_triangulation_2.h b/Periodic_2_triangulation_2/doc/Periodic_2_triangulation_2/CGAL/draw_periodic_2_triangulation_2.h index 6365c1c51c8..36f39390db8 100644 --- a/Periodic_2_triangulation_2/doc/Periodic_2_triangulation_2/CGAL/draw_periodic_2_triangulation_2.h +++ b/Periodic_2_triangulation_2/doc/Periodic_2_triangulation_2/CGAL/draw_periodic_2_triangulation_2.h @@ -1,9 +1,9 @@ namespace CGAL { - + /*! \ingroup PkgDrawPeriodic2Triangulation2 -opens a new window and draws `ap2t2`, the `Periodic_2_Triangulation_2`. A call to this function is blocking, that is the program continues as soon as the user closes the window. +opens a new window and draws `ap2t2`, the `Periodic_2_Triangulation_2`. A call to this function is blocking, that is the program continues as soon as the user closes the window. This function requires CGAL_Qt5, and is only available if the flag CGAL_USE_BASIC_VIEWER is defined at compile time. \tparam P2T2 a model of the `Periodic_2TriangulationTraits_2` concept. \param ap2t2 the 2D periodic trinagulation to draw. diff --git a/Periodic_2_triangulation_2/doc/Periodic_2_triangulation_2/PackageDescription.txt b/Periodic_2_triangulation_2/doc/Periodic_2_triangulation_2/PackageDescription.txt index 4f3a46a85b1..57f1542511d 100644 --- a/Periodic_2_triangulation_2/doc/Periodic_2_triangulation_2/PackageDescription.txt +++ b/Periodic_2_triangulation_2/doc/Periodic_2_triangulation_2/PackageDescription.txt @@ -25,16 +25,16 @@ /*! \addtogroup PkgPeriodic2Triangulation2Ref - + \cgalPkgDescriptionBegin{2D Periodic Triangulations,PkgPeriodic2Triangulation2} \cgalPkgPicture{Periodic_2_triangulation_2/fig/p2Delaunay2_thumb.png} - + \cgalPkgSummaryBegin \cgalPkgAuthor{Nico Kruithof} \cgalPkgDesc{This package allows to build and handle triangulations of point sets in the two dimensional flat torus. Triangulations are built incrementally and can be modified by insertion or removal of vertices. They offer point location facilities. The package provides Delaunay triangulations and offers nearest neighbor queries and primitives to build the dual Voronoi diagrams.} \cgalPkgManuals{Chapter_2D_Periodic_Triangulations,PkgPeriodic2Triangulation2Ref} \cgalPkgSummaryEnd - + \cgalPkgShortInfoBegin \cgalPkgSince{4.3} \cgalPkgDependsOn{\ref PkgTriangulation2} @@ -42,9 +42,9 @@ \cgalPkgLicense{\ref licensesGPL "GPL"} \cgalPkgDemo{Periodic Delaunay Triangulation,Periodic_2_Delaunay_triangulation_2.zip} \cgalPkgShortInfoEnd - + \cgalPkgDescriptionEnd - + The main classes of the 2D Periodic Triangulation package are `CGAL::Periodic_2_triangulation_2` and `CGAL::Periodic_2_Delaunay_triangulation_2`. They contain functionality diff --git a/Periodic_2_triangulation_2/doc/Periodic_2_triangulation_2/Periodic_2_triangulation_2.txt b/Periodic_2_triangulation_2/doc/Periodic_2_triangulation_2/Periodic_2_triangulation_2.txt index 26a3cce21d1..0db671e9a6f 100644 --- a/Periodic_2_triangulation_2/doc/Periodic_2_triangulation_2/Periodic_2_triangulation_2.txt +++ b/Periodic_2_triangulation_2/doc/Periodic_2_triangulation_2/Periodic_2_triangulation_2.txt @@ -4,7 +4,7 @@ namespace CGAL { /*! -\mainpage User Manual +\mainpage User Manual \anchor Chapter_2D_Periodic_Triangulations \anchor chapterP2Triangulation2 @@ -23,7 +23,7 @@ do not intersect or share a common \f$ j\f$-face, \f$ jvertex, edge and face, respectively. -\section P2Triangulation2secspace The Flat Torus +\section P2Triangulation2secspace The Flat Torus The 2D Periodic Triangulation package computes triangulations in the space \f$ \mathbb T_c^2\f$, which is defined as follows: Let \f$ c\in\mathbb @@ -50,7 +50,7 @@ There are simplices containing points inside the original domain but also points outside it. The points outside the original domain are periodic copies of points inside the original domain. So, to specify a simplex we need points together with some additional -information that determines the respective periodic copy of each point. +information that determines the respective periodic copy of each point. The set of representatives of an element of \f$ \mathbb T_c^2\f$ is a square point grid. We address each representative by a two-dimensional integer vector \f$ (o_x,o_y)\f$, called offset. It @@ -65,7 +65,7 @@ Offsets in a face. \cgalFigureEnd -\section P2Triangulation2secintro Representation +\section P2Triangulation2secintro Representation A triangulation is a collection of vertices and faces that are linked together through incidence and adjacency relations. Each face gives @@ -101,7 +101,7 @@ space, which is a 9-sheeted covering space of \f$ \mathbb T_c^2\f$ (see \cgalFigureRef{P2Triangulation2figcovering}). \cgalFigureBegin{P2Triangulation2figcovering, one_cover.png, one_and_nine_cover.png} -The same periodic triangulation in 1-sheeted covering space and 9-sheeted covering space. +The same periodic triangulation in 1-sheeted covering space and 9-sheeted covering space. \cgalFigureEnd The machinery that manages the copies is largely hidden from the @@ -120,7 +120,7 @@ covering the `Vertex_handle`s and `Face_handle`s referencing deleted items becomes invalid. In the data structure each vertex stores the input point it -corresponds to. If we are computing in 9-sheeted covering +corresponds to. If we are computing in 9-sheeted covering space, each vertex stores the representative inside the original domain it corresponds to. So, the 9 vertices corresponding to the same element of \f$ \mathbb T_c^2\f$ all store the same @@ -167,7 +167,7 @@ data structure at each operation. The locate queries are also overwritten to take advantage of the data structure for a fast processing. -\section P2Triangulation2secdesign Software Design +\section P2Triangulation2secdesign Software Design We have chosen the prefix ``Periodic_2'' to emphasize that the triangulation is periodic in all two directions of space. There are @@ -190,7 +190,7 @@ They are built as layers on top of a triangulation data structure, which stores their combinatorial structure. This separation between the geometry and the combinatorics is reflected in the software design by the fact that the triangulation classes take two template -parameters: +parameters: - the geometric traits class, which provides the type of points to use as well as the elementary operations on them (predicates and constructions). Furthermore it contains the offset type. The concept @@ -208,7 +208,7 @@ parameters: `Periodic_2TriangulationFaceBase_2` and `Periodic_2TriangulationVertexBase_2` as template parameters. -\subsection P2Triangulation2secTraits The Geometric Traits Parameter +\subsection P2Triangulation2secTraits The Geometric Traits Parameter The first template parameter of the periodic triangulation class `Periodic_2_triangulation_2` is the geometric traits @@ -251,7 +251,7 @@ segments, triangles, and tetrahedra are used. The second parameter `Periodic_2Offset_2` defaults to `Periodic_2_offset_2`. -\subsection P2Triangulation2sectds The Triangulation Data Structure Parameter +\subsection P2Triangulation2sectds The Triangulation Data Structure Parameter The second template parameter of the main classes `Periodic_2_triangulation_2` and @@ -284,7 +284,7 @@ way. Also the classes `Triangulation_vertex_base_with_info_2` and `Triangulation_face_base_with_info_2` can be reused directly, see also Example \ref P2T2ExampleColor. -\section P2Triangulation2secexamples Examples +\section P2Triangulation2secexamples Examples \subsection P2T2ExampleBasic Basic example @@ -301,7 +301,7 @@ the triangulation data structure. The following two examples show how the user can plug his own vertex base in a triangulation. Changing the face base is similar. -\subsubsection P2T2ExampleColor Adding a color +\subsubsection P2T2ExampleColor Adding a color If the user does not need to add a type in a vertex that depends on the `TriangulationDataStructure_2` (e.g. a `Vertex_handle` or @@ -403,7 +403,7 @@ A 2D periodic triangulation can be visualized by calling the \link PkgDrawPeriod - STORED Display all geometric primitives as they are stored in Triangulation_data_structure_2; - UNIQUE Display only one representative of each geometric primitive even if the triangulation is computed in multiply sheeted covering space; - STORED_COVER_DOMAIN Same as STORED but also display all primitives whose intersection with the original domain of the current covering space is non-empty; -- UNIQUE_COVER_DOMAIN Same as UNIQUE but also display all primitives whose intersection with the original domain of the current covering space is non-empty. +- UNIQUE_COVER_DOMAIN Same as UNIQUE but also display all primitives whose intersection with the original domain of the current covering space is non-empty. The domain can also be visualized by a key press. To see how to visualize the Periodic Triangulation in various modes, press key H when the viewer window is active and go to Keyboard tab. See \cgalFigureRef{P2Triangulation2figdraw1} and \cgalFigureRef{P2Triangulation2figdraw2}. @@ -419,13 +419,13 @@ Result of the run of the draw_periodic_2_triangulation_2 program for display mod The periodic 2D-triangulation is based on the 2D triangulation package developed by Mariette Yvinec and inspired by the periodic 3D-triangulation package developed by Manuel Caroli and Monique Teillaud. The periodic -3D-triangulation package is described in Manuel's PhD thesis +3D-triangulation package is described in Manuel's PhD thesis \cgalCite{cgal:c-tpsos-10} Triangulating Point Sets in Orbit Spaces and \cgalCite{cgal:ct-c3pt-09}. In 2009, Nico Kruithof started implementation of the `Periodic_2_triangulation_2` package. -*/ +*/ } /* namespace CGAL */ \\\\\\\\\\\\ diff --git a/Periodic_2_triangulation_2/examples/Periodic_2_triangulation_2/CMakeLists.txt b/Periodic_2_triangulation_2/examples/Periodic_2_triangulation_2/CMakeLists.txt index 849f222a5df..77aa297fabc 100644 --- a/Periodic_2_triangulation_2/examples/Periodic_2_triangulation_2/CMakeLists.txt +++ b/Periodic_2_triangulation_2/examples/Periodic_2_triangulation_2/CMakeLists.txt @@ -24,8 +24,8 @@ if ( CGAL_FOUND ) target_link_libraries(draw_periodic_2_triangulation_2 PUBLIC CGAL::CGAL_Qt5) endif() else() - + message(STATUS "This program requires the CGAL library, and will not be compiled.") - + endif() diff --git a/Periodic_2_triangulation_2/examples/Periodic_2_triangulation_2/draw_periodic_2_triangulation_2.cpp b/Periodic_2_triangulation_2/examples/Periodic_2_triangulation_2/draw_periodic_2_triangulation_2.cpp index 28a49c76731..c99cf2361d0 100644 --- a/Periodic_2_triangulation_2/examples/Periodic_2_triangulation_2/draw_periodic_2_triangulation_2.cpp +++ b/Periodic_2_triangulation_2/examples/Periodic_2_triangulation_2/draw_periodic_2_triangulation_2.cpp @@ -24,13 +24,13 @@ int main(int argc, char* argv[]) while (ifs >> p) { T.insert(p); } CGAL_assertion(T.is_valid()); - + if( T.is_triangulation_in_1_sheet()) { T.convert_to_9_sheeted_covering(); } - + // Draw the periodic triangulation CGAL::draw(T); } - + return EXIT_SUCCESS; } diff --git a/Periodic_3_mesh_3/examples/Periodic_3_mesh_3/CMakeLists.txt b/Periodic_3_mesh_3/examples/Periodic_3_mesh_3/CMakeLists.txt index 8b1fb98c95f..bcb9a3247c0 100644 --- a/Periodic_3_mesh_3/examples/Periodic_3_mesh_3/CMakeLists.txt +++ b/Periodic_3_mesh_3/examples/Periodic_3_mesh_3/CMakeLists.txt @@ -14,7 +14,7 @@ find_package( CGAL QUIET COMPONENTS ImageIO ) if ( CGAL_FOUND ) include( ${CGAL_USE_FILE} ) -else() +else() message(STATUS "This project requires the CGAL library, and will not be compiled.") return() endif() diff --git a/Periodic_3_mesh_3/test/Periodic_3_mesh_3/CMakeLists.txt b/Periodic_3_mesh_3/test/Periodic_3_mesh_3/CMakeLists.txt index d1929fd2bbb..3a3f69e79d7 100644 --- a/Periodic_3_mesh_3/test/Periodic_3_mesh_3/CMakeLists.txt +++ b/Periodic_3_mesh_3/test/Periodic_3_mesh_3/CMakeLists.txt @@ -27,7 +27,7 @@ if ( CGAL_FOUND ) CGAL_target_use_Eigen(test_implicit_shapes_with_features) create_single_source_cgal_program( "test_triply_periodic_minimal_surfaces.cpp" ) CGAL_target_use_Eigen(test_triply_periodic_minimal_surfaces) - + else() message(STATUS "This program requires the CGAL library, and will not be compiled.") diff --git a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/include/CGAL/_test_cls_periodic_3_tds_cell.h b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/include/CGAL/_test_cls_periodic_3_tds_cell.h index fb949a078fc..ac037a6b065 100644 --- a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/include/CGAL/_test_cls_periodic_3_tds_cell.h +++ b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/include/CGAL/_test_cls_periodic_3_tds_cell.h @@ -6,7 +6,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Rebufat Francois (Francois.Rebufat@sophia.inria.fr) diff --git a/Point_set_3/examples/Point_set_3/CMakeLists.txt b/Point_set_3/examples/Point_set_3/CMakeLists.txt index 21055796731..172e045e4d2 100644 --- a/Point_set_3/examples/Point_set_3/CMakeLists.txt +++ b/Point_set_3/examples/Point_set_3/CMakeLists.txt @@ -12,7 +12,7 @@ find_package( CGAL QUIET COMPONENTS Qt5 ) if ( NOT CGAL_FOUND ) message(STATUS "This project requires the CGAL library, and will not be compiled.") - return() + return() endif() @@ -27,7 +27,7 @@ if ( NOT Boost_FOUND ) message(STATUS "This project requires the Boost library, and will not be compiled.") - return() + return() endif() @@ -40,7 +40,7 @@ create_single_source_cgal_program( "point_set_property.cpp" ) create_single_source_cgal_program( "point_set_read_xyz.cpp" ) create_single_source_cgal_program( "point_set_advanced.cpp" ) -set(needed_cxx_features cxx_rvalue_references cxx_variadic_templates) +set(needed_cxx_features cxx_rvalue_references cxx_variadic_templates) create_single_source_cgal_program( "point_set_read_ply.cpp" CXX_FEATURES ${needed_cxx_features} ) find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater) diff --git a/Point_set_processing_3/doc/Point_set_processing_3/NamedParameters.txt b/Point_set_processing_3/doc/Point_set_processing_3/NamedParameters.txt index 7f7c42ad9eb..412250023a6 100644 --- a/Point_set_processing_3/doc/Point_set_processing_3/NamedParameters.txt +++ b/Point_set_processing_3/doc/Point_set_processing_3/NamedParameters.txt @@ -5,7 +5,7 @@ In this package, all functions optional parameters are implemented as BGL optional named parameters (see \ref BGLNamedParameters for more information on how to use them). Since the parameters of the various point set processing functions defined in this -package are redundant, their long descriptions are centralized below. +package are redundant, their long descriptions are centralized below. In the following, we assume that the following types are provided as template parameters of point set processing functions and classes. Note that, for some of these functions, the type is more specific. diff --git a/Point_set_processing_3/doc/Point_set_processing_3/PackageDescription.txt b/Point_set_processing_3/doc/Point_set_processing_3/PackageDescription.txt index 51df668b49d..78e0ba58613 100644 --- a/Point_set_processing_3/doc/Point_set_processing_3/PackageDescription.txt +++ b/Point_set_processing_3/doc/Point_set_processing_3/PackageDescription.txt @@ -35,7 +35,7 @@ format. \cgalPkgSummaryEnd \cgalPkgShortInfoBegin \cgalPkgSince{3.5} -\cgalPkgDependsOn{\ref PkgSolverInterface} +\cgalPkgDependsOn{\ref PkgSolverInterface} \cgalPkgBib{cgal:ass-psp} \cgalPkgLicense{\ref licensesGPL "GPL"} \cgalPkgDemo{Polyhedron demo,polyhedron_3.zip} diff --git a/Point_set_processing_3/doc/Point_set_processing_3/Point_set_processing_3.txt b/Point_set_processing_3/doc/Point_set_processing_3/Point_set_processing_3.txt index 63a5ac80806..b408d95b7bd 100644 --- a/Point_set_processing_3/doc/Point_set_processing_3/Point_set_processing_3.txt +++ b/Point_set_processing_3/doc/Point_set_processing_3/Point_set_processing_3.txt @@ -1,7 +1,7 @@ namespace CGAL { /*! -\mainpage User Manual +\mainpage User Manual \anchor Chapter_Point_Set_Processing \anchor chappoint_set_processing_3 @@ -22,12 +22,12 @@ Point set processing. Left: 275K points sampled on the statue of an elephant wit In the context of surface reconstruction we can position the elements of this component along the common surface reconstruction pipeline (\cgalFigureRef{Point_set_processing_3figpipeline}) which involves the -following steps: +following steps: -# Scanning and scan registration to produce a set of points or points with normals; -# Outlier removal; --# Simplification to reduce the number of input points; --# Smoothing to reduce noise in the input data; +-# Simplification to reduce the number of input points; +-# Smoothing to reduce noise in the input data; -# Normal estimation and orientation when the normals are not already provided by the acquisition device; and -# Surface reconstruction. Chapter \ref Chapter_Poisson_Surface_Reconstruction "Poisson Surface Reconstruction" @@ -84,9 +84,9 @@ The following classes described in Chapter \ref PkgPropertyMap provide property maps for the implementations of points with normals listed above: -- `Identity_property_map` -- `First_of_pair_property_map` and `Second_of_pair_property_map` -- `Nth_of_tuple_property_map` +- `Identity_property_map` +- `First_of_pair_property_map` and `Second_of_pair_property_map` +- `Nth_of_tuple_property_map` `Identity_property_map` is the default value of the position property map expected by all functions in this component. @@ -96,7 +96,7 @@ See below examples using pair and tuple property maps. Users of this package may use other types to represent positions and normals if they implement the corresponding property maps. -Points and normals can even be stored in separate containers +Points and normals can even be stored in separate containers and accessed by their index, as any built-in vector is also a property map. @@ -128,7 +128,7 @@ parameters (than can be deduced automatically in simple cases) are moved to the end of the function in a single named parameter object (see \ref BGLNamedParameters). The code translated to the current API becomes: - + \code std::vector points; @@ -295,7 +295,7 @@ The 4 functions presented here work both with 2D points and 3D points and they shouldn't be used if the point sets do not sample a curve in 2D or a surface in 3D. -\subsection Point_set_processing_3Example_scale_estimation_global Global Scale Example +\subsection Point_set_processing_3Example_scale_estimation_global Global Scale Example The following example reads a 3D point set in the `xyz` format and: @@ -338,7 +338,7 @@ one point set w.r.t. another and directly aligns it to it. \subsection Point_set_processing_3Examples_registration_OpenGR OpenGR Example -The following example reads two point sets and aligns them using the +The following example reads two point sets and aligns them using the \ref thirdpartyOpenGR library, using the Super4PCS algorithm: \cgalExample{Point_set_processing_3/registration_with_OpenGR.cpp} @@ -387,7 +387,7 @@ defined by the parameter delta (accuracy). Using too wide values will slow down the algorithm by increasing the size of the congruent set, while using to small values prevents to find a solution. This parameter impacts other steps of -the algorithm, see the paper \cgalCite{cgal:mam-sffgp-14} for more details. +the algorithm, see the paper \cgalCite{cgal:mam-sffgp-14} for more details. \subsubsection Point_set_processing_3Examples_registration_OpenGR_parameter_normal Parameter: maximum normal deviation @@ -400,7 +400,7 @@ candidates that should indeed have been matched and may thus result in a quality \subsubsection Point_set_processing_3Examples_registration_OpenGR_parameter_overlap Parameter: overlap -Ratio of expected overlap between the two point sets: it is ranging between 0 (no overlap) to 1 (100% overlap). +Ratio of expected overlap between the two point sets: it is ranging between 0 (no overlap) to 1 (100% overlap). The overlap parameter controls the size of the basis used for registration, as shown below: @@ -409,7 +409,7 @@ The effect of varying overlap parameter on the size of the basis used for regist \cgalFigureEnd Usually, the larger the overlap, the faster the algorithm. -When the overlap is unknown, a simple way to set this parameter is to start from +When the overlap is unknown, a simple way to set this parameter is to start from 100% overlap, and decrease the value until obtaining a good result. Using too small values will slow down the algorithm, and reduce the accuracy of the result. @@ -422,7 +422,7 @@ randomly, it is recommended to use a large time value to explore the whole space \subsection Point_set_processing_3Examples_registration_PointMatcher PointMatcher Example -The following example reads two point sets and aligns them using the +The following example reads two point sets and aligns them using the \ref thirdpartylibpointmatcher library, using the ICP algorithm. It also shows how to customize ICP algorithm by using possible configurations: \cgalExample{Point_set_processing_3/registration_with_pointmatcher.cpp} @@ -461,7 +461,7 @@ The method used for matching (linking) the points from to the points in the refe Corresponds to `matcher` configuration module of \ref thirdpartylibpointmatcher library. The matcher should be chosen and set from possible components of -the `matcher` configuration module. +the `matcher` configuration module. See libpointmatcher documentation for possible configurations. @@ -476,7 +476,7 @@ range. Corresponds to `outlierFilters` configuration module of \ref thirdpartylibpointmatcher library. The filters should be chosen and set from possible components of -the `outlierFilters` configuration module. +the `outlierFilters` configuration module. See libpointmatcher documentation for possible configurations. @@ -487,7 +487,7 @@ the error between the point sets. Corresponds to `errorMinimizer` configuration module of \ref thirdpartylibpointmatcher library. The error minimizer should be chosen and set from possible components of -the `errorMinimizer` configuration module. +the `errorMinimizer` configuration module. See libpointmatcher documentation for possible configurations. @@ -498,7 +498,7 @@ typically provide deeper scrutiny than the logger. Corresponds to `inspector` configuration module of \ref thirdpartylibpointmatcher library. The inspector should be chosen and set from possible components of -the `inspector` configuration module. +the `inspector` configuration module. See libpointmatcher documentation for possible configurations. @@ -510,7 +510,7 @@ does not get effected by this configuration. Corresponds to `logger` configuration module of \ref thirdpartylibpointmatcher library. The logger should be chosen and set from possible components of -the `logger` configuration module. +the `logger` configuration module. See libpointmatcher documentation for possible configurations. @@ -524,7 +524,7 @@ The following example reads two point sets and aligns them by using both \ref thirdpartyOpenGR and \ref thirdpartylibpointmatcher libraries, respectively. It depicts a use case where a coarse estimation of a registration transformation is done using the Super4PCS algorithm. Then, a fine registration from this coarse -registration using the ICP algorithm. +registration using the ICP algorithm. \cgalExample{Point_set_processing_3/registration_with_opengr_pointmatcher_pipeline.cpp} \cgalFigureRef{Point_set_processing_3tableRegistrationRegistration_visualization_table} demonstrates @@ -601,7 +601,7 @@ above-mentioned example was used. \cgalFigureCaptionBegin{Point_set_processing_3tableRegistrationRegistration_visualization_table} Visualization of registered hippo scans with different registration methods. Two scans are used: red as the reference, green as the one for which the transformation -is computed and applied. To obtain the results, the example code given in +is computed and applied. To obtain the results, the example code given in \ref Point_set_processing_3Examples_registration_OpenGR , \ref Point_set_processing_3Examples_registration_PointMatcher , \ref Point_set_processing_3Examples_registration_OpenGR_PointMatcher_Pipeline @@ -652,7 +652,7 @@ simplification of the point set through local clusters directly selected by the user or it automatically adapts to the local variation of the point set. -Function `wlop_simplify_and_regularize_point_set()` not only simplifies, +Function `wlop_simplify_and_regularize_point_set()` not only simplifies, but also regularizes downsampled points. This is an implementation of the Weighted Locally Optimal Projection (WLOP) algorithm \cgalCite{wlop-2009}. @@ -714,7 +714,7 @@ Computing density weights for each point is an optional preprocessing. For examp \cgalFigureBegin{Point_set_processing_3figWLOP_parameter_density, WLOP_parameter_density.jpg} -Comparison between with and without density: Left: input. Middle: `require_uniform_sampling = false`. Right: `require_uniform_sampling=true`. +Comparison between with and without density: Left: input. Middle: `require_uniform_sampling = false`. Right: `require_uniform_sampling=true`. \cgalFigureEnd \subsubsection Point_set_processing_3WLOP_parameter_neighborhood_size Parameter: neighbor_radius @@ -725,14 +725,14 @@ Comparison between different sizes of neighbor radius. \cgalFigureEnd \subsubsection Point_set_processing_3WLOP_parallel_performance Parallel Performance -A parallel version of WLOP is provided and requires the executable to be linked against the +A parallel version of WLOP is provided and requires the executable to be linked against the Intel TBB library. To control the number of threads used, the user may use the tbb::task_scheduler_init class. -See the TBB documentation +See the TBB documentation for more details. We provide below a speed-up chart generated using the parallel version of the WLOP algorithm. The machine used is a PC running Windows 7 64-bits with a 4-core i7-4700HQ@2.40GHz CPU with 8GB of RAM. \cgalFigureBegin{Point_set_processing_3figWLOP_parallel_performance, parallel_WLOP_performance.jpg} -Parallel WLOP speed-up, compared to the sequential version of the algorithm. +Parallel WLOP speed-up, compared to the sequential version of the algorithm. \cgalFigureEnd @@ -742,11 +742,11 @@ Two smoothing functions are devised to smooth an input point set. Function `jet_smooth_point_set()` smooths the input point set by projecting each point onto a smooth parametric surface patch -(so-called jet surface) fitted over its nearest neighbors. +(so-called jet surface) fitted over its nearest neighbors. Function `bilateral_smooth_point_set()` smooths the input point set by iteratively projecting each point onto the implicit surface patch fitted over its nearest neighbors. -Bilateral projection preserves sharp features according to the normal (gradient) information. +Bilateral projection preserves sharp features according to the normal (gradient) information. Normals are thus required as input. For more details, see section 4 of \cgalCite{ear-2013}. For both functions, the user can either specify a fixed number of @@ -754,7 +754,7 @@ nearest neighbors or a fixed spherical neighborhood radius. \subsection Point_set_processing_3Example_jet_smoothing Jet Smoothing Example -The following example generates a set of 9 points close to the `xy` +The following example generates a set of 9 points close to the `xy` plane and smooths them using 8 nearest neighbors: \cgalExample{Point_set_processing_3/jet_smoothing_example.cpp} @@ -769,14 +769,14 @@ Comparison for two smoothing methods: Left: Input, 250K points, normal-color map \subsubsection Point_set_processing_3Bilateral_smoothing_parallel_performance Parallel -Performance: -A parallel version of bilateral smoothing is provided and requires the executable to be linked against the +Performance: +A parallel version of bilateral smoothing is provided and requires the executable to be linked against the Intel TBB library. The number of threads used is controlled through the tbb::task_scheduler_init class. See the TBB documentation for more details. We provide below a speed-up chart generated using the parallel version of the bilateral smoothing algorithm. The machine used is a PC running Windows 7 64-bits with a 4-core i7-4700HQ@2.40GHz CPU with 8GB of RAM. \cgalFigureBegin{Point_set_processing_3Bilateral_smoothing_parallel_performance, parallel_bilateral_smooth_point_set_performance.jpg} -Parallel bilateral smoothing speed-up, compared to the sequential version of the algorithm. +Parallel bilateral smoothing speed-up, compared to the sequential version of the algorithm. \cgalFigureEnd \section Point_set_processing_3NormalEstimation Normal Estimation @@ -808,9 +808,9 @@ of nearest neighbors or a fixed spherical neighborhood radius. Function `mst_orient_normals()` orients the normals of a set of points with unoriented normals using the method described by Hoppe et -al. in Surface reconstruction from unorganized points \cgalCite{cgal:hddms-srup-92}. +al. in Surface reconstruction from unorganized points \cgalCite{cgal:hddms-srup-92}. More specifically, this method constructs a -Riemannian graph over the input points (the graph of the +Riemannian graph over the input points (the graph of the nearest neighbor points) and propagates a seed normal orientation within a minimum spanning tree computed over this graph. The result is an oriented normal vector for each input unoriented normal, except for @@ -844,7 +844,7 @@ The following example reads a point set from a file, upsamples it to get a dense \subsubsection Point_set_processing_3Upsample_Parameter1 Parameter: edge_sensitivity This parameter controls where the new points are inserted. Larger values of edge-sensitivity give higher priority to inserting points along the sharp features. -For example, as shown in the following figure, high value is preferable when one wants to insert more points on sharp features, where the local gradient is high, e.g., darts, cusps, creases and corners. In contrast, points are evenly inserted when edge_sensitivity is set to 0. The range of possible value is [0, 1]. +For example, as shown in the following figure, high value is preferable when one wants to insert more points on sharp features, where the local gradient is high, e.g., darts, cusps, creases and corners. In contrast, points are evenly inserted when edge_sensitivity is set to 0. The range of possible value is [0, 1]. \cgalFigureBegin{Point_set_processing_3figUpsample_edge_sensitivity, upsample_edge_sensitivity.jpg} @@ -855,14 +855,14 @@ Upsampling for different edge-sensitivity parameter values. The input containing This parameter controls the preservation of sharp features. \cgalFigureBegin{Point_set_processing_3figUpsample_sharpness_angle, upsample_sharpness_angle.jpg} -Upsampling for different sharpness_angle parameter values. The input containing 850 points is upsampled to 425K points in all cases depicted. +Upsampling for different sharpness_angle parameter values. The input containing 850 points is upsampled to 425K points in all cases depicted. \cgalFigureEnd \subsubsection Point_set_processing_3upsample_neighborhood_size Parameter: neighbor_radius Usually, the neighborhood of sample points should include at least one ring of neighboring sample points. Using small neighborhood size may not be able to insert new points. Using big neighborhood size can fill small holes, but points inserted on the edges could be irregular. The function will use a neighborhood size estimation if this parameter value is set to default or smaller than zero. \cgalFigureBegin{Point_set_processing_3figupsample_neighborhood_size, upsample_neighborhood_size.jpg} -Comparison between different sizes of neighbor radius. +Comparison between different sizes of neighbor radius. \cgalFigureEnd \section Point_set_processing_3FeaturesEstimation Feature Edges Estimation @@ -886,7 +886,7 @@ points that are on sharp edges: The function `structure_point_set()` generates a structured version of the input point set assigned to a set of planes. Such an input can be -produced by a shape detection algorithm (see \ref PkgShapeDetectionRef). +produced by a shape detection algorithm (see \ref PkgShapeDetectionRef). Point set structuring is based on the article \cgalCite{cgal:la-srpss-13}. - __Planes__: inliers of each detected plane are replaced by sets of @@ -966,6 +966,6 @@ Started from GSoC'2019, Necip Fazil Yildiran with the help of Nicolas Mellado an libraries that perform registration on two point sets. -*/ +*/ } /* namespace CGAL */ diff --git a/Point_set_processing_3/doc/Point_set_processing_3/examples.txt b/Point_set_processing_3/doc/Point_set_processing_3/examples.txt index 32ee499ff83..3cdfe3727b9 100644 --- a/Point_set_processing_3/doc/Point_set_processing_3/examples.txt +++ b/Point_set_processing_3/doc/Point_set_processing_3/examples.txt @@ -12,7 +12,7 @@ \example Point_set_processing_3/remove_outliers_example.cpp \example Point_set_processing_3/grid_simplification_example.cpp \example Point_set_processing_3/grid_simplify_indices.cpp -\example Point_set_processing_3/hierarchy_simplification_example.cpp +\example Point_set_processing_3/hierarchy_simplification_example.cpp \example Point_set_processing_3/jet_smoothing_example.cpp \example Point_set_processing_3/normals_example.cpp \example Point_set_processing_3/wlop_simplify_and_regularize_point_set_example.cpp diff --git a/Point_set_processing_3/examples/Point_set_processing_3/CMakeLists.txt b/Point_set_processing_3/examples/Point_set_processing_3/CMakeLists.txt index 532d19c5cf5..36412ac7b68 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/CMakeLists.txt +++ b/Point_set_processing_3/examples/Point_set_processing_3/CMakeLists.txt @@ -14,7 +14,7 @@ if ( CGAL_FOUND ) if (MSVC) # Quit warning in the lasreader add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS) - + if ( CMAKE_SIZEOF_VOID_P EQUAL 4 ) # Allow Windows 32bit applications to use up to 3GB of RAM SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE") @@ -30,7 +30,7 @@ if ( CGAL_FOUND ) option(CGAL_ACTIVATE_CONCURRENT_PSP3 "Enable concurrency" OFF) - + if( CGAL_ACTIVATE_CONCURRENT_PSP3 OR ENV{CGAL_ACTIVATE_CONCURRENT_PSP3} ) find_package( TBB REQUIRED ) endif() @@ -50,7 +50,7 @@ if ( CGAL_FOUND ) create_single_source_cgal_program( "read_ply_points_with_colors_example.cpp" ) create_single_source_cgal_program( "write_ply_points_example.cpp" ) - + find_package(LASLIB) if (LASLIB_FOUND) create_single_source_cgal_program( "read_las_example.cpp" ) @@ -58,17 +58,17 @@ if ( CGAL_FOUND ) else() message(STATUS "NOTICE : the LAS reader test requires LASlib and will not be compiled.") endif() - + # Use Eigen find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater) if (EIGEN3_FOUND) # Executables that require Eigen create_single_source_cgal_program( "jet_smoothing_example.cpp" ) CGAL_target_use_Eigen(jet_smoothing_example) - + create_single_source_cgal_program( "normal_estimation.cpp" ) CGAL_target_use_Eigen(normal_estimation) - + create_single_source_cgal_program( "edges_example.cpp" ) # Executables that require libpointmatcher @@ -80,7 +80,7 @@ if ( CGAL_FOUND ) else() message(STATUS "NOTICE : the registration_with_pointmatcher test requires libpointmatcher and will not be compiled.") endif() - + # Executables that require OpenGR find_package(OpenGR QUIET) if (OpenGR_FOUND) @@ -102,13 +102,13 @@ if ( CGAL_FOUND ) endif() CGAL_target_use_Eigen(edges_example) - + create_single_source_cgal_program( "callback_example.cpp" ) CGAL_target_use_Eigen(callback_example) - + create_single_source_cgal_program( "scale_estimation_example.cpp" ) CGAL_target_use_Eigen(scale_estimation_example) - + create_single_source_cgal_program( "scale_estimation_2d_example.cpp" ) CGAL_target_use_Eigen(scale_estimation_2d_example) diff --git a/Point_set_processing_3/examples/Point_set_processing_3/average_spacing_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/average_spacing_example.cpp index 776f640c83c..3f28e3c5cc8 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/average_spacing_example.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/average_spacing_example.cpp @@ -24,7 +24,7 @@ int main(int argc, char*argv[]) // Reads a .xyz point set file in points. // As the point is the second element of the tuple (that is with index 1) // we use a property map that accesses the 1st element of the tuple. - + std::vector points; std::ifstream stream(fname); if (!stream || diff --git a/Point_set_processing_3/examples/Point_set_processing_3/bilateral_smooth_point_set_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/bilateral_smooth_point_set_example.cpp index 0f87a437e4a..2501ba061c4 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/bilateral_smooth_point_set_example.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/bilateral_smooth_point_set_example.cpp @@ -43,7 +43,7 @@ int main(int argc, char*argv[]) double sharpness_angle = 25; // control sharpness of the result. // The bigger the smoother the result will be int iter_number = 3; // number of times the projection is applied - + for (int i = 0; i < iter_number; ++i) { /* double error = */ @@ -54,7 +54,7 @@ int main(int argc, char*argv[]) normal_map(CGAL::Second_of_pair_property_map()). sharpness_angle (sharpness_angle)); } - + //// Save point set. std::ofstream out(output_filename); out.precision(17); diff --git a/Point_set_processing_3/examples/Point_set_processing_3/callback_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/callback_example.cpp index addaaeefaa3..aee58b48726 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/callback_example.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/callback_example.cpp @@ -36,7 +36,7 @@ struct Progress_to_std_cerr_callback t_start = timer.time(); t_latest = t_start; } - + bool operator()(double advancement) const { // Avoid calling time() at every single iteration, which could @@ -50,7 +50,7 @@ struct Progress_to_std_cerr_callback { std::cerr << "\r" // Return at the beginning of same line and overwrite << name << ": " << int(advancement * 100) << "%"; - + if (advancement == 1) std::cerr << std::endl; t_latest = t; @@ -64,7 +64,7 @@ struct Progress_to_std_cerr_callback int main (int argc, char* argv[]) { int N = (argc > 1) ? boost::lexical_cast(argv[1]) : 1000; - + // Generate N points on a sphere of radius 100. std::vector points; points.reserve (N); diff --git a/Point_set_processing_3/examples/Point_set_processing_3/edge_aware_upsample_point_set_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/edge_aware_upsample_point_set_example.cpp index 173c07e9f1c..702648af475 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/edge_aware_upsample_point_set_example.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/edge_aware_upsample_point_set_example.cpp @@ -39,11 +39,11 @@ int main(int argc, char* argv[]) //Algorithm parameters const double sharpness_angle = 25; // control sharpness of the result. - const double edge_sensitivity = 0; // higher values will sample more points near the edges + const double edge_sensitivity = 0; // higher values will sample more points near the edges const double neighbor_radius = 0.25; // initial size of neighborhood. const std::size_t number_of_output_points = points.size() * 4; - //Run algorithm + //Run algorithm CGAL::edge_aware_upsample_point_set( points, std::back_inserter(points), @@ -55,7 +55,7 @@ int main(int argc, char* argv[]) number_of_output_points(number_of_output_points)); // Saves point set. - std::ofstream out(output_filename); + std::ofstream out(output_filename); out.precision(17); if (!out || !CGAL::write_xyz_points( diff --git a/Point_set_processing_3/examples/Point_set_processing_3/normals_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/normals_example.cpp index 629b836555d..54b6f5b9d15 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/normals_example.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/normals_example.cpp @@ -63,7 +63,7 @@ int main(int argc, char*argv[]) CGAL::parameters::point_map(CGAL::First_of_pair_property_map()). normal_map(CGAL::Second_of_pair_property_map())); } - + // Orients normals. // Note: mst_orient_normals() requires a range of points // as well as property maps to access each point's position and normal. diff --git a/Point_set_processing_3/examples/Point_set_processing_3/registration_with_OpenGR.cpp b/Point_set_processing_3/examples/Point_set_processing_3/registration_with_OpenGR.cpp index c418d78523e..ae11db41dbf 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/registration_with_OpenGR.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/registration_with_OpenGR.cpp @@ -46,7 +46,7 @@ int main(int argc, const char** argv) return EXIT_FAILURE; } input.close(); - + // EITHER call the registration method Super4PCS from OpenGR to get the transformation to apply to pwns2 // std::pair res = CGAL::OpenGR::compute_registration_transformation(pwns1, pwns2, diff --git a/Point_set_processing_3/examples/Point_set_processing_3/registration_with_opengr_pointmatcher_pipeline.cpp b/Point_set_processing_3/examples/Point_set_processing_3/registration_with_opengr_pointmatcher_pipeline.cpp index 5093ed485a8..2af66826d73 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/registration_with_opengr_pointmatcher_pipeline.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/registration_with_opengr_pointmatcher_pipeline.cpp @@ -49,7 +49,7 @@ int main(int argc, const char** argv) return EXIT_FAILURE; } input.close(); - + std::cerr << "Computing registration transformation using OpenGR Super4PCS.." << std::endl; // First, compute registration transformation using OpenGR Super4PCS K::Aff_transformation_3 res = @@ -66,7 +66,7 @@ int main(int argc, const char** argv) // by OpenGR as initial transformation, and apply the transformation to pwns2 // bool converged = CGAL::pointmatcher::register_point_sets - (pwns1, pwns2, + (pwns1, pwns2, params::point_map(Point_map()).normal_map(Normal_map()), params::point_map(Point_map()).normal_map(Normal_map()) .transformation(res)); diff --git a/Point_set_processing_3/examples/Point_set_processing_3/registration_with_pointmatcher.cpp b/Point_set_processing_3/examples/Point_set_processing_3/registration_with_pointmatcher.cpp index d0827f416d4..f4de0556667 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/registration_with_pointmatcher.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/registration_with_pointmatcher.cpp @@ -49,7 +49,7 @@ int main(int argc, const char** argv) return EXIT_FAILURE; } input.close(); - + // // Prepare ICP config // @@ -68,7 +68,7 @@ int main(int argc, const char** argv) point_set_2_filters.push_back( ICP_config { /*.name=*/"MinDistDataPointsFilter" , /*.params=*/{ {"minDist", "0.5" }} } ); point_set_2_filters.push_back( ICP_config { /*.name=*/"RandomSamplingDataPointsFilter", /*.params=*/{ {"prob" , "0.05"}} } ); - // Prepare matcher function + // Prepare matcher function ICP_config matcher { /*.name=*/"KDTreeMatcher", /*.params=*/{ {"knn", "1"}, {"epsilon", "3.16"} } }; // Prepare outlier filters @@ -83,7 +83,7 @@ int main(int argc, const char** argv) transformation_checkers.push_back( ICP_config { /*.name=*/"CounterTransformationChecker", /*.params=*/{ {"maxIterationCount", "150" }} } ); transformation_checkers.push_back( ICP_config { /*.name=*/"DifferentialTransformationChecker", /*.params=*/{ {"minDiffRotErr" , "0.001" }, {"minDiffTransErr", "0.01" }, - {"smoothLength" , "4" } } + {"smoothLength" , "4" } } } ); // Prepare inspector ICP_config inspector { /*.name=*/"NullInspector" }; @@ -96,7 +96,7 @@ int main(int argc, const char** argv) // EITHER call the ICP registration method pointmatcher to get the transformation to apply to pwns2 std::pair res = CGAL::pointmatcher::compute_registration_transformation - (pwns1, pwns2, + (pwns1, pwns2, params::point_map(Point_map()).normal_map(Normal_map()) .point_set_filters(point_set_1_filters) .matcher(matcher) @@ -110,14 +110,14 @@ int main(int argc, const char** argv) .transformation(identity_transform) /* initial transform for pwns2. * default value is already identity transform. * a proper initial transform could be given, for example, - * a transform returned from a coarse registration algorithm. + * a transform returned from a coarse registration algorithm. * */ ); // OR call the ICP registration method from pointmatcher and apply the transformation to pwn2 bool converged = CGAL::pointmatcher::register_point_sets - (pwns1, pwns2, + (pwns1, pwns2, params::point_map(Point_map()).normal_map(Normal_map()) .point_set_filters(point_set_1_filters) .matcher(matcher) diff --git a/Point_set_processing_3/examples/Point_set_processing_3/scale_estimation_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/scale_estimation_example.cpp index a85f56bea45..b28fcebd9b1 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/scale_estimation_example.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/scale_estimation_example.cpp @@ -23,10 +23,10 @@ int main (int argc, char** argv) { const char* fname = (argc>1)?argv[1]:"data/sphere_20k.xyz"; - + CGAL::Timer task_timer; - - std::vector points; + + std::vector points; std::ifstream stream(fname); // read input @@ -36,12 +36,12 @@ int main (int argc, char** argv) std::cerr << "Error: can't read input file" << std::endl; return EXIT_FAILURE; } - + // estimate k scale task_timer.start(); std::size_t k_scale = CGAL::estimate_global_k_neighbor_scale (points); task_timer.stop(); - + // Example: use estimated k as scale for jet smoothing CGAL::jet_smooth_point_set (points, static_cast(k_scale)); @@ -55,7 +55,7 @@ int main (int argc, char** argv) points.erase (CGAL::grid_simplify_point_set (points, range_scale), points.end()); - + // print some informations on runtime std::size_t memory = CGAL::Memory_sizer().virtual_size(); double time = task_timer.time(); diff --git a/Point_set_processing_3/examples/Point_set_processing_3/wlop_simplify_and_regularize_point_set_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/wlop_simplify_and_regularize_point_set_example.cpp index d6ef47246fe..b6afc296766 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/wlop_simplify_and_regularize_point_set_example.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/wlop_simplify_and_regularize_point_set_example.cpp @@ -40,7 +40,7 @@ int main(int argc, char** argv) (points, std::back_inserter(output), CGAL::parameters::select_percentage(retain_percentage). neighbor_radius (neighbor_radius)); - + std::ofstream out(output_filename); out.precision(17); if (!out || !CGAL::write_xyz_points( diff --git a/Point_set_processing_3/include/CGAL/IO/read_las_points.h b/Point_set_processing_3/include/CGAL/IO/read_las_points.h index fde0db5e573..34a5daf30b6 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_las_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_las_points.h @@ -89,7 +89,7 @@ namespace CGAL { I }; } - + template struct Base { @@ -123,7 +123,7 @@ namespace CGAL { /** \ingroup PkgPointSetProcessing3IOLas - + Generates a %LAS property handler to read 3D points. Points are constructed from the input the using 3 %LAS properties `LAS_property::X`, `LAS_property::Y` and `LAS_property::Z`. @@ -141,9 +141,9 @@ namespace CGAL { return std::make_tuple (point_map, typename Kernel_traits::Kernel::Construct_point_3(), LAS_property::X(), LAS_property::Y(), LAS_property::Z()); } - + /// \cond SKIP_IN_MANUAL - + namespace internal { namespace LAS { @@ -191,7 +191,7 @@ namespace internal { inline void get_value(const LASpoint& r, unsigned short& v, LAS_property::I&) { v = r.get_I(); } - + template struct Filler { @@ -234,7 +234,7 @@ namespace internal { get_value(r, std::get<0>(values), std::get<2>(wrappers)); } }; - + template void process_properties (const LASpoint& reader, OutputValueType& new_element, std::pair >&& current); @@ -245,7 +245,7 @@ namespace internal { std::pair >&& current, NextPropertyBinder&& next, PropertyMapBinders&& ... properties); - + template (std::get<1>(current), values); put (std::get<0>(current), new_element, new_value); } - + template ::fill(reader, values, current); PmapValueType new_value = call_functor(std::get<1>(current), values); put (std::get<0>(current), new_element, new_value); - + process_properties (reader, new_element, std::forward(next), std::forward(properties)...); } @@ -308,9 +308,9 @@ namespace internal { } } // namespace LAS - + } // namespace internal - + /// \endcond @@ -396,7 +396,7 @@ bool read_las_points_with_properties (std::istream& stream, } lasreader.close(); - + return true; } @@ -435,7 +435,7 @@ bool read_las_points_with_properties (std::istream& stream, If this parameter is omitted, `CGAL::Identity_property_map` is used.\cgalParamEnd \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `Kernel`\cgalParamEnd \cgalNamedParamsEnd - + \return true on success. \cgalRequiresCPP11 @@ -460,7 +460,7 @@ bool read_las_points(std::istream& stream, using parameters::get_parameter; typedef Point_set_processing_3::Fake_point_range PointRange; - + typedef typename CGAL::GetPointMap::type PointMap; PointMap point_map = choose_parameter(get_parameter(np, internal_np::point_map)); @@ -506,7 +506,7 @@ read_las_points( } #ifndef CGAL_NO_DEPRECATED_CODE -// deprecated API +// deprecated API template < typename OutputIteratorValueType, typename OutputIterator, typename PointMap > diff --git a/Point_set_processing_3/include/CGAL/IO/read_off_points.h b/Point_set_processing_3/include/CGAL/IO/read_off_points.h index 84a8a18828e..c3f6beab6e7 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_off_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_off_points.h @@ -80,7 +80,7 @@ read_off_points( using parameters::get_parameter; typedef Point_set_processing_3::Fake_point_range PointRange; - + // basic geometric types typedef typename CGAL::GetPointMap::type PointMap; typedef typename Point_set_processing_3::GetNormalMap::type NormalMap; @@ -219,7 +219,7 @@ read_off_points( } #ifndef CGAL_NO_DEPRECATED_CODE -// deprecated API +// deprecated API template diff --git a/Point_set_processing_3/include/CGAL/IO/read_ply_points.h b/Point_set_processing_3/include/CGAL/IO/read_ply_points.h index e9af2bd49e0..2e45e550bdf 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_ply_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_ply_points.h @@ -40,7 +40,7 @@ namespace CGAL { #ifdef DOXYGEN_RUNNING // Document some parts from Stream_support here for convenience /** \ingroup PkgPointSetProcessing3IOPly - + Class used to identify a %PLY property as a type and a name. \sa `read_ply_points_with_properties()` @@ -55,7 +55,7 @@ namespace CGAL { /** \ingroup PkgPointSetProcessing3IOPly - + Generates a %PLY property handler to read 3D points. Points are constructed from the input using 3 %PLY properties of type `FT` and named `x`, `y` and `z`. `FT` is `float` if the points use @@ -73,7 +73,7 @@ namespace CGAL { /** \ingroup PkgPointSetProcessing3IOPly - + Generates a %PLY property handler to read 3D normal vectors. Vectors are constructed from the input using 3 PLY properties of type `FT` and named `nx`, `ny` and `nz`. `FT` @@ -133,7 +133,7 @@ bool read_ply_points_with_properties (std::istream& stream, PropertyHandler&& ... properties) { typedef typename value_type_traits::type OutputValueType; - + if(!stream) { std::cerr << "Error: cannot open file" << std::endl; @@ -141,13 +141,13 @@ bool read_ply_points_with_properties (std::istream& stream, } internal::PLY::PLY_reader reader; - + if (!(reader.init (stream))) { stream.setstate(std::ios::failbit); return false; } - + for (std::size_t i = 0; i < reader.number_of_elements(); ++ i) { internal::PLY::PLY_element& element = reader.element(i); @@ -183,12 +183,12 @@ bool read_ply_points_with_properties (std::istream& stream, PropertyHandler&& ... properties) { typedef typename value_type_traits::type OutputValueType; - + return read_ply_points_with_properties (stream, output, std::forward(properties)...); } /// \endcond - + /** \ingroup PkgPointSetProcessing3IOPly Reads points (positions + normals, if available) from a .ply @@ -236,7 +236,7 @@ bool read_ply_points(std::istream& stream, using parameters::get_parameter; typedef Point_set_processing_3::Fake_point_range PointRange; - + // basic geometric types typedef typename CGAL::GetPointMap::type PointMap; typedef typename Point_set_processing_3::GetNormalMap::type NormalMap; @@ -257,7 +257,7 @@ bool read_ply_points(std::istream& stream, } -/// \cond SKIP_IN_MANUAL +/// \cond SKIP_IN_MANUAL // variant with default NP template @@ -355,7 +355,7 @@ bool read_ply_points_and_normals(std::istream& stream, ///< input stream. CGAL::parameters::normal_map (normal_map)); } -// deprecated API +// deprecated API template PointRange; - + // basic geometric types typedef typename CGAL::GetPointMap::type PointMap; typedef typename Point_set_processing_3::GetNormalMap::type NormalMap; @@ -90,11 +90,11 @@ read_xyz_points( PointMap point_map = choose_parameter(get_parameter(np, internal_np::point_map)); NormalMap normal_map = choose_parameter(get_parameter(np, internal_np::normal_map)); - + // value_type_traits is a workaround as back_insert_iterator's value_type is void //typedef typename value_type_traits::type Enriched_point; typedef OutputIteratorValueType Enriched_point; - + typedef typename Kernel::FT FT; typedef typename Kernel::Point_3 Point; typedef typename Kernel::Vector_3 Vector; @@ -149,14 +149,14 @@ read_xyz_points( } Enriched_point pwn; put(point_map, pwn, point); // point_map[pwn] = point - + if (has_normals) put(normal_map, pwn, normal); // normal_map[pwn] = normal - + *output++ = pwn; continue; - } - + } + } // ...or skips number of points on first line (optional) if (lineNumber == 1 && std::istringstream(line) >> pointsCount) @@ -211,7 +211,7 @@ read_xyz_points( } #ifndef CGAL_NO_DEPRECATED_CODE -// deprecated API +// deprecated API template @@ -328,7 +328,7 @@ read_xyz_points_and_normals( CGAL::parameters::normal_map (normal_map)); } -// deprecated API +// deprecated API template diff --git a/Point_set_processing_3/include/CGAL/IO/write_las_points.h b/Point_set_processing_3/include/CGAL/IO/write_las_points.h index 82206c0a891..d6d19c983d8 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_las_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_las_points.h @@ -60,8 +60,8 @@ namespace CGAL { /** \ingroup PkgPointSetProcessing3IOLas - - Generates a %LAS property handler to write 3D points. + + Generates a %LAS property handler to write 3D points. \sa `write_las_points_with_properties()` @@ -75,7 +75,7 @@ namespace CGAL { } /// \cond SKIP_IN_MANUAL - + namespace internal { namespace LAS { @@ -116,7 +116,7 @@ namespace internal { { r.set_B(v); } inline void output_value(LASpoint& r, const unsigned short& v, LAS_property::I&) { r.set_I(v); } - + template void output_properties (LASpoint&, ForwardIterator) @@ -150,9 +150,9 @@ namespace internal { } } // namespace LAS - + } // namespace internal - + /// \endcond @@ -207,7 +207,7 @@ bool write_las_points_with_properties (std::ostream& stream, ///< output stream (points.begin(), CGAL::Property_map_to_unary_function(std::get<0>(point_property))), boost::make_transform_iterator (points.end(), CGAL::Property_map_to_unary_function(std::get<0>(point_property)))); - + LASheader header; header.x_scale_factor = 1e-9 * (bbox.xmax() - bbox.xmin()); header.y_scale_factor = 1e-9 * (bbox.ymax() - bbox.ymin()); @@ -223,7 +223,7 @@ bool write_las_points_with_properties (std::ostream& stream, ///< output stream LASwriterLAS laswriter; laswriter.open (stream, &header); - + // Write positions + normals for(typename PointRange::const_iterator it = points.begin(); it != points.end(); it++) { @@ -247,7 +247,7 @@ bool write_las_points_with_properties (std::ostream& stream, ///< output stream /** \ingroup PkgPointSetProcessing3IOLas Saves the range of `points` (positions only) to a - .las stream. + .las stream. \tparam PointRange is a model of `ConstRange`. The value type of its iterator is the key type of the named parameter `point_map`. @@ -311,8 +311,8 @@ write_las_points( (stream, points, CGAL::parameters::point_map(point_map)); } - -// deprecated API + +// deprecated API template < typename ForwardIterator > CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::write_las_points(), please update your code") bool diff --git a/Point_set_processing_3/include/CGAL/IO/write_off_points.h b/Point_set_processing_3/include/CGAL/IO/write_off_points.h index 2c681d5373c..06574809fbe 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_off_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_off_points.h @@ -32,7 +32,7 @@ namespace CGAL { The function writes for each point a line with the x y z position followed by the nx ny nz normal (if available). - \note The `precision()` + \note The `precision()` of the output stream might not be sufficient depending on the data to be written. \tparam PointRange is a model of `ConstRange`. The value type of @@ -112,7 +112,7 @@ write_off_points( } #ifndef CGAL_NO_DEPRECATED_CODE -// deprecated API +// deprecated API template CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::write_off_points(), please update your code") diff --git a/Point_set_processing_3/include/CGAL/IO/write_ply_points.h b/Point_set_processing_3/include/CGAL/IO/write_ply_points.h index 0776660e1b9..de3db9eca9c 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_ply_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_ply_points.h @@ -36,7 +36,7 @@ namespace CGAL { #ifdef DOXYGEN_RUNNING // Document some parts from Stream_support here for convenience /** \ingroup PkgPointSetProcessing3IOPly - + Generates a %PLY property handler to write 3D points. Points are written as 3 %PLY properties of type `FT` and named `x`, `y` and `z`. `FT` is `float` if the points use @@ -52,7 +52,7 @@ namespace CGAL { /** \ingroup PkgPointSetProcessing3IOPly - + Generates a %PLY property handler to write 3D normal vectors. Vectors are written as 3 %PLY properties of type `FT` and named `nx`, `ny` and `nz`. `FT` is `float` if the vectors use @@ -75,7 +75,7 @@ namespace internal { } // namespace PLY - + } // namespace internal /// \endcond @@ -133,11 +133,11 @@ write_ply_points_with_properties( << ((get_mode(stream) == IO::BINARY) ? "format binary_little_endian 1.0" : "format ascii 1.0") << std::endl << "comment Generated by the CGAL library" << std::endl << "element vertex " << points.size() << std::endl; - + internal::PLY::output_property_header (stream, std::forward(properties)...); - + stream << "end_header" << std::endl; - + // Write positions + normals for(typename PointRange::const_iterator it = points.begin(); it != points.end(); it++) @@ -193,7 +193,7 @@ write_ply_points( PointMap point_map = choose_parameter(get_parameter(np, internal_np::point_map)); NormalMap normal_map = choose_parameter(get_parameter(np, internal_np::normal_map)); - + if (has_normals) return write_ply_points_with_properties( stream, points, @@ -237,7 +237,7 @@ write_ply_points_and_normals( CGAL::parameters::point_map (point_map). normal_map (normal_map)); } - + // deprecated API template @@ -171,7 +171,7 @@ write_xyz_points_and_normals( CGAL::parameters::normal_map(normal_map)); } -// deprecated API +// deprecated API template @@ -209,7 +209,7 @@ write_xyz_points( CGAL::parameters::point_map(point_map)); } -// deprecated API +// deprecated API template CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::write_xyz_points(), please update your code") diff --git a/Point_set_processing_3/include/CGAL/OpenGR/compute_registration_transformation.h b/Point_set_processing_3/include/CGAL/OpenGR/compute_registration_transformation.h index 80294dab7e4..152f577fdb1 100644 --- a/Point_set_processing_3/include/CGAL/OpenGR/compute_registration_transformation.h +++ b/Point_set_processing_3/include/CGAL/OpenGR/compute_registration_transformation.h @@ -145,7 +145,7 @@ compute_registration_transformation(const PointRange1& range1, const PointRan /** \ingroup PkgPointSetProcessing3Algorithms - + Computes the registration of `point_set_2` with respect to `point_set_1` and returns the corresponding affine transformation along with the registration score. diff --git a/Point_set_processing_3/include/CGAL/OpenGR/register_point_sets.h b/Point_set_processing_3/include/CGAL/OpenGR/register_point_sets.h index cfa8983296f..0fa48a907ba 100644 --- a/Point_set_processing_3/include/CGAL/OpenGR/register_point_sets.h +++ b/Point_set_processing_3/include/CGAL/OpenGR/register_point_sets.h @@ -66,7 +66,7 @@ register_point_sets(const PointRange1& range1, PointRange2& range2, /** \ingroup PkgPointSetProcessing3Algorithms - + Computes the registration of `point_set_2` with respect to `point_set_1` and applies it. diff --git a/Point_set_processing_3/include/CGAL/Point_set_processing_3/internal/Search_traits_vertex_handle_3.h b/Point_set_processing_3/include/CGAL/Point_set_processing_3/internal/Search_traits_vertex_handle_3.h index e7581e8bc6d..b399d87bb6c 100644 --- a/Point_set_processing_3/include/CGAL/Point_set_processing_3/internal/Search_traits_vertex_handle_3.h +++ b/Point_set_processing_3/include/CGAL/Point_set_processing_3/internal/Search_traits_vertex_handle_3.h @@ -93,7 +93,7 @@ struct Kernel_traits< internal::Point_vertex_handle_3 > { }; }; - namespace internal { + namespace internal { /// Functor with two function operators, which return the begin and /// past the end iterator for the Cartesian coordinates. @@ -214,7 +214,7 @@ struct Euclidean_distance_vertex_handle_3 h=p.z(); dists[2] = (h >= (b.min_coord(2)+b.max_coord(2))/2.0)? h-b.min_coord(2) : b.max_coord(2)-h; - + double d2 = dists[2]*dists[2]; return d0 + d1 + d2; @@ -248,7 +248,7 @@ class Search_traits_vertex_handle_3 > {}; - } // namespace internal + } // namespace internal /// \endcond } //namespace CGAL diff --git a/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h b/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h index 5767f93b949..35fce6f1992 100644 --- a/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h +++ b/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h @@ -7,7 +7,7 @@ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // -// Author(s) : Shihao Wu, Clement Jamin, Pierre Alliez +// Author(s) : Shihao Wu, Clement Jamin, Pierre Alliez #ifndef CGAL_BILATERAL_SMOOTH_POINT_SET_H #define CGAL_BILATERAL_SMOOTH_POINT_SET_H @@ -43,7 +43,7 @@ #include #include #include -#include +#include #include #endif // CGAL_LINKED_WITH_TBB @@ -55,7 +55,7 @@ #endif // CGAL_LINKED_WITH_TBB -//#define CGAL_PSP3_VERBOSE +//#define CGAL_PSP3_VERBOSE namespace CGAL { @@ -86,7 +86,7 @@ public: Kd_tree_element(const Kd_tree_element& other) : Base(other), index(other.index) {} - + Kd_tree_element& operator=(const Kd_tree_element&)=default; }; @@ -109,13 +109,13 @@ public: /// Compute bilateral projection for each point /// according to their KNN neighborhood points -/// +/// /// \pre `k >= 2`, radius > 0 , sharpness_angle > 0 && sharpness_angle < 90 /// /// @tparam Kernel Geometric traits class. /// @tparam Tree KD-tree. /// -/// @return +/// @return template CGAL::Point_with_normal_3 @@ -143,12 +143,12 @@ compute_denoise_projection( FT iradius16 = -(FT)4.0/radius2; FT project_dist_sum = FT(0.0); FT project_weight_sum = FT(0.0); - Vector normal_sum = CGAL::NULL_VECTOR; + Vector normal_sum = CGAL::NULL_VECTOR; FT cos_sigma = cos(sharpness_angle * CGAL_PI / 180.0); FT sharpness_bandwidth = std::pow((CGAL::max)(1e-8, 1 - cos_sigma), 2); - typename std::vector >::const_iterator + typename std::vector >::const_iterator pwn_iter = neighbor_pwns.begin(); for (; pwn_iter != neighbor_pwns.end(); ++pwn_iter) { @@ -173,8 +173,8 @@ compute_denoise_projection( Vector update_normal = normal_sum / project_weight_sum; update_normal = update_normal / sqrt(update_normal.squared_length()); - Point update_point = query.position() - update_normal * - (project_dist_sum / project_weight_sum); + Point update_point = query.position() - update_normal * + (project_dist_sum / project_weight_sum); return Pwn(update_point, update_normal); } @@ -239,7 +239,7 @@ class Compute_pwns_neighbors { typedef typename CGAL::Point_with_normal_3 Pwn; typedef typename std::vector > Pwns; - typedef typename std::vector > + typedef typename std::vector > Pwns_neighbors; typedef typename Kernel::FT FT; @@ -258,9 +258,9 @@ public: cpp11::atomic& interrupted) : m_k(k), m_neighbor_radius (neighbor_radius), m_tree(tree) , m_pwns(pwns), m_pwns_neighbors(neighbors) - , advancement (advancement), interrupted (interrupted) {} + , advancement (advancement), interrupted (interrupted) {} - void operator() ( const tbb::blocked_range& r ) const + void operator() ( const tbb::blocked_range& r ) const { for (size_t i = r.begin(); i!=r.end(); i++) { @@ -269,17 +269,17 @@ public: CGAL::Point_set_processing_3::internal::neighbor_query (m_pwns[i], m_tree, m_k, m_neighbor_radius, m_pwns_neighbors[i]); - + ++ advancement; } } }; -/// \endcond +/// \endcond /// \cond SKIP_IN_MANUAL /// This is for parallelization of function: compute_denoise_projection() template -class Pwn_updater +class Pwn_updater { typedef typename CGAL::Point_with_normal_3 Pwn; typedef typename std::vector > Pwns; @@ -294,32 +294,32 @@ class Pwn_updater cpp11::atomic& interrupted; public: - Pwn_updater(FT sharpness, + Pwn_updater(FT sharpness, FT r, Pwns *in, - Pwns *out, + Pwns *out, std::vector >* neighbors, cpp11::atomic& advancement, - cpp11::atomic& interrupted): - sharpness_angle(sharpness), + cpp11::atomic& interrupted): + sharpness_angle(sharpness), radius(r), pwns(in), update_pwns(out), pwns_neighbors(neighbors), advancement (advancement), - interrupted (interrupted) {} + interrupted (interrupted) {} - void operator() ( const tbb::blocked_range& r ) const - { - for (size_t i = r.begin(); i != r.end(); ++i) + void operator() ( const tbb::blocked_range& r ) const + { + for (size_t i = r.begin(); i != r.end(); ++i) { if (interrupted) break; (*update_pwns)[i] = bilateral_smooth_point_set_internal:: - compute_denoise_projection((*pwns)[i], - (*pwns_neighbors)[i], + compute_denoise_projection((*pwns)[i], + (*pwns_neighbors)[i], radius, - sharpness_angle); + sharpness_angle); ++ advancement; } } @@ -335,17 +335,17 @@ public: /** \ingroup PkgPointSetProcessing3Algorithms - - This function smooths an input point set by iteratively projecting each + + This function smooths an input point set by iteratively projecting each point onto the implicit surface patch fitted over its nearest neighbors. Bilateral projection preserves sharp features according to the normal - (gradient) information. Both point positions and normals will be modified. - For more details, please see section 4 in \cgalCite{ear-2013}. + (gradient) information. Both point positions and normals will be modified. + For more details, please see section 4 in \cgalCite{ear-2013}. - A parallel version of this function is provided and requires the executable to be + A parallel version of this function is provided and requires the executable to be linked against the Intel TBB library. To control the number of threads used, the user may use the tbb::task_scheduler_init class. - See the TBB documentation + See the TBB documentation for more details. \pre Normals must be unit vectors @@ -398,7 +398,7 @@ bilateral_smooth_point_set( { using parameters::choose_parameter; using parameters::get_parameter; - + // basic geometric types typedef typename CGAL::GetPointMap::type PointMap; typedef typename Point_set_processing_3::GetNormalMap::type NormalMap; @@ -407,15 +407,15 @@ bilateral_smooth_point_set( CGAL_static_assertion_msg(!(boost::is_same::NoMap>::value), "Error: no normal map"); - + typedef typename CGAL::Point_with_normal_3 Pwn; typedef typename std::vector > Pwns; typedef typename Kernel::FT FT; - + double sharpness_angle = choose_parameter(get_parameter(np, internal_np::sharpness_angle), 30.); const std::function& callback = choose_parameter(get_parameter(np, internal_np::callback), std::function()); - + CGAL_point_set_processing_precondition(points.begin() != points.end()); CGAL_point_set_processing_precondition(k > 1); @@ -429,7 +429,7 @@ bilateral_smooth_point_set( PointMap point_map = choose_parameter(get_parameter(np, internal_np::point_map)); NormalMap normal_map = choose_parameter(get_parameter(np, internal_np::normal_map)); FT neighbor_radius = choose_parameter(get_parameter(np, internal_np::neighbor_radius), FT(0)); - + // copy points and normals Pwns pwns; for(typename PointRange::iterator it = points.begin(); it != points.end(); ++it) @@ -437,7 +437,7 @@ bilateral_smooth_point_set( typename boost::property_traits::reference p = get(point_map, *it); typename boost::property_traits::reference n = get(normal_map, *it); CGAL_point_set_processing_precondition(n.squared_length() > 1e-10); - + pwns.push_back(Pwn(p, n)); } @@ -450,7 +450,7 @@ bilateral_smooth_point_set( std::vector > treeElements; treeElements.reserve(pwns.size()); - typename std::vector >::iterator + typename std::vector >::iterator pwn_iter = pwns.begin(); for (unsigned int i = 0; pwn_iter != pwns.end(); ++pwn_iter) { @@ -462,15 +462,15 @@ bilateral_smooth_point_set( CGAL::Real_timer task_timer; task_timer.start(); #endif - FT guess_neighbor_radius = 0.0; + FT guess_neighbor_radius = 0.0; for(pwn_iter = pwns.begin(); pwn_iter != pwns.end(); ++pwn_iter) { FT max_spacing = bilateral_smooth_point_set_internal:: compute_max_spacing(*pwn_iter, tree, k); - guess_neighbor_radius = (CGAL::max)(max_spacing, guess_neighbor_radius); + guess_neighbor_radius = (CGAL::max)(max_spacing, guess_neighbor_radius); } - + #ifdef CGAL_PSP3_VERBOSE task_timer.stop(); #endif @@ -488,10 +488,10 @@ bilateral_smooth_point_set( // compute all neighbors std::vector > pwns_neighbors; pwns_neighbors.resize(nb_points); - + #ifndef CGAL_LINKED_WITH_TBB CGAL_static_assertion_msg (!(boost::is_convertible::value), - "Parallel_tag is enabled but TBB is unavailable."); + "Parallel_tag is enabled but TBB is unavailable."); #else if (boost::is_convertible::value) { @@ -504,10 +504,10 @@ bilateral_smooth_point_set( tbb::parallel_for(tbb::blocked_range(0, nb_points), f); bool interrupted = parallel_callback.interrupted(); - + // We interrupt by hand as counter only goes halfway and won't terminate by itself parallel_callback.interrupted() = true; - parallel_callback.join(); + parallel_callback.join(); // If interrupted during this step, nothing is computed, we return NaN if (interrupted) @@ -516,7 +516,7 @@ bilateral_smooth_point_set( else #endif { - typename std::vector >::iterator + typename std::vector >::iterator pwns_iter = pwns_neighbors.begin(); std::size_t nb = 0; @@ -529,7 +529,7 @@ bilateral_smooth_point_set( return std::numeric_limits::quiet_NaN(); } } - + #ifdef CGAL_PSP3_VERBOSE task_timer.stop(); memory = CGAL::Memory_sizer().virtual_size(); @@ -548,7 +548,7 @@ bilateral_smooth_point_set( { Point_set_processing_3::internal::Parallel_callback parallel_callback (callback, 2 * nb_points, nb_points); - + //tbb::task_scheduler_init init(4); tbb::blocked_range block(0, nb_points); Pwn_updater pwn_updater(sharpness_angle, @@ -570,26 +570,26 @@ bilateral_smooth_point_set( #endif // CGAL_LINKED_WITH_TBB { std::size_t nb = nb_points; - - typename std::vector >::iterator + + typename std::vector >::iterator update_iter = update_pwns.begin(); - typename std::vector >::iterator + typename std::vector >::iterator neighbor_iter = pwns_neighbors.begin(); - for(pwn_iter = pwns.begin(); pwn_iter != pwns.end(); + for(pwn_iter = pwns.begin(); pwn_iter != pwns.end(); ++pwn_iter, ++update_iter, ++neighbor_iter, ++ nb) { *update_iter = bilateral_smooth_point_set_internal:: compute_denoise_projection - (*pwn_iter, - *neighbor_iter, - guess_neighbor_radius, + (*pwn_iter, + *neighbor_iter, + guess_neighbor_radius, sharpness_angle); if (callback && !callback ((nb+1) / double(2. * nb_points))) return std::numeric_limits::quiet_NaN(); } } #ifdef CGAL_PSP3_VERBOSE - task_timer.stop(); + task_timer.stop(); memory = CGAL::Memory_sizer().virtual_size(); std::cout << "done: " << task_timer.time() << " seconds, " << (memory>>20) << " Mb allocated" << std::endl; @@ -604,12 +604,12 @@ bilateral_smooth_point_set( put (point_map, *it, update_pwns[i].position()); put (normal_map, *it, update_pwns[i].normal()); } - + return sum_move_error / nb_points; } /// \cond SKIP_IN_MANUAL -// variant with default NP +// variant with default NP template double diff --git a/Point_set_processing_3/include/CGAL/compute_average_spacing.h b/Point_set_processing_3/include/CGAL/compute_average_spacing.h index aaa05bbeb92..c9f86dee613 100644 --- a/Point_set_processing_3/include/CGAL/compute_average_spacing.h +++ b/Point_set_processing_3/include/CGAL/compute_average_spacing.h @@ -112,22 +112,22 @@ compute_average_spacing(const typename Kernel::Point_3& query, ///< 3D point who public: Compute_average_spacings(Tree& tree, unsigned int k, std::vector& points, - std::vector& output, + std::vector& output, cpp11::atomic& advancement, cpp11::atomic& interrupted) : tree(tree), k (k), input (points), output (output) , advancement (advancement) , interrupted (interrupted) { } - + void operator()(const tbb::blocked_range& r) const { for( std::size_t i = r.begin(); i != r.end(); ++i) { if (interrupted) break; - - output[i] = CGAL::internal::compute_average_spacing(input[i], tree, k); + + output[i] = CGAL::internal::compute_average_spacing(input[i], tree, k); ++ advancement; } } @@ -178,7 +178,7 @@ compute_average_spacing(const typename Kernel::Point_3& query, ///< 3D point who of `points`. */ template #ifdef DOXYGEN_RUNNING @@ -220,7 +220,7 @@ compute_average_spacing( // Instanciate a KD-tree search. // Note: We have to convert each input iterator to Point_3. - std::vector kd_tree_points; + std::vector kd_tree_points; for(typename PointRange::const_iterator it = points.begin(); it != points.end(); it++) kd_tree_points.push_back(get(point_map, *it)); Tree tree(kd_tree_points.begin(), kd_tree_points.end()); @@ -232,13 +232,13 @@ compute_average_spacing( #ifndef CGAL_LINKED_WITH_TBB CGAL_static_assertion_msg (!(boost::is_convertible::value), - "Parallel_tag is enabled but TBB is unavailable."); + "Parallel_tag is enabled but TBB is unavailable."); #else if (boost::is_convertible::value) { Point_set_processing_3::internal::Parallel_callback parallel_callback (callback, kd_tree_points.size()); - + std::vector spacings (kd_tree_points.size (), -1); CGAL::internal::Compute_average_spacings f (tree, k, kd_tree_points, spacings, @@ -270,7 +270,7 @@ compute_average_spacing( } } } - + // return average spacing return sum_spacings / (FT)(nb); } diff --git a/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h b/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h index 03906230d3b..5ff3d0d77fc 100644 --- a/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h +++ b/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h @@ -7,7 +7,7 @@ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // -// Author(s) : Shihao Wu, Clement Jamin, Pierre Alliez +// Author(s) : Shihao Wu, Clement Jamin, Pierre Alliez #ifndef CGAL_UPSAMPLE_POINT_SET_H #define CGAL_UPSAMPLE_POINT_SET_H @@ -44,8 +44,8 @@ namespace upsample_internal{ /// For each query point, select a best "base point" in its neighborhoods. /// Then, a new point will be interpolated between query point and "base point". -/// This is the key part of the upsample algorithm -/// +/// This is the key part of the upsample algorithm +/// /// \pre `radius > 0` /// /// @tparam Kernel Geometric traits class. @@ -55,7 +55,7 @@ template typename Kernel::FT base_point_selection( const rich_grid_internal::Rich_point& query, ///< 3D point to project - const std::vector >& + const std::vector >& neighbor_points,///< neighbor sample points const typename Kernel::FT edge_sensitivity,///< edge sensitivity parameter unsigned int& output_base_index ///< base point index @@ -88,7 +88,7 @@ base_point_selection( Vector diff_v_t = t - v.pt; Point mid_point = v.pt + (diff_v_t * FT(0.5)); - + FT dot_produce = std::pow((FT(2.0) - vm * tm), edge_sensitivity); Vector diff_t_mid = mid_point - t; @@ -117,12 +117,12 @@ base_point_selection( } } - return best_dist2; + return best_dist2; } /// For each new inserted point, we need to do the following job /// 1, get neighbor information from the two "parent points" -/// 2, update position and determine normal by bilateral projection +/// 2, update position and determine normal by bilateral projection /// 3, update neighbor information again /// /// \pre `radius > 0` @@ -180,7 +180,7 @@ update_new_point( new_v.neighbors.clear(); std::set::iterator set_iter; - for (set_iter = neighbor_indexes.begin(); + for (set_iter = neighbor_indexes.begin(); set_iter != neighbor_indexes.end(); ++set_iter) { Rich_point& t = rich_point_set[*set_iter]; @@ -192,7 +192,7 @@ update_new_point( } } - // 2, update position and normal by bilateral projection + // 2, update position and normal by bilateral projection const unsigned int candidate_num = 2; // we have two normal candidates: // we say father's is 0 // mother's is 1 @@ -203,7 +203,7 @@ update_new_point( std::vector project_dist_sum(candidate_num, FT(0.0)); std::vector weight_sum(candidate_num, FT(0.0)); std::vector normal_sum(candidate_num, NULL_VECTOR); - + FT radius16 = FT(-4.0) / radius2; for (unsigned int i = 0; i < new_v.neighbors.size(); ++i) @@ -249,7 +249,7 @@ update_new_point( // 3, update neighbor information again new_v.neighbors.clear(); - for (set_iter = neighbor_indexes.begin(); + for (set_iter = neighbor_indexes.begin(); set_iter != neighbor_indexes.end(); ++set_iter) { Rich_point& t = rich_point_set[*set_iter]; @@ -273,21 +273,21 @@ update_new_point( /** \ingroup PkgPointSetProcessing3Algorithms - This method progressively upsamples the point set while - approaching the edge singularities (detected by normal variation), which - generates a denser point set from an input point set. This has applications - in point-based rendering, hole filling, and sparse surface reconstruction. + This method progressively upsamples the point set while + approaching the edge singularities (detected by normal variation), which + generates a denser point set from an input point set. This has applications + in point-based rendering, hole filling, and sparse surface reconstruction. Normals of points are required as input. For more details, please refer to \cgalCite{ear-2013}. - + \tparam ConcurrencyTag enables sequential versus parallel versions of `compute_average_spacing()` (called internally). Possible values are `Sequential_tag`, `Parallel_tag`, and `Parallel_if_available_tag`. \tparam PointRange is a model of `ConstRange`. The value type of its iterator is the key type of the named parameter `point_map`. - \tparam OutputIterator Type of the output iterator. - The type of the objects put in it is + \tparam OutputIterator Type of the output iterator. + The type of the objects put in it is `std::pair`. - Note that the user may use a + Note that the user may use a function_output_iterator to match specific needs. @@ -311,7 +311,7 @@ update_new_point( */ template OutputIterator edge_aware_upsample_point_set( @@ -321,7 +321,7 @@ edge_aware_upsample_point_set( { using parameters::choose_parameter; using parameters::get_parameter; - + // basic geometric types typedef typename CGAL::GetPointMap::type PointMap; typedef typename Point_set_processing_3::GetNormalMap::type NormalMap; @@ -330,7 +330,7 @@ edge_aware_upsample_point_set( CGAL_static_assertion_msg(!(boost::is_same::NoMap>::value), "Error: no normal map"); - + typedef typename Kernel::Point_3 Point; typedef typename Kernel::Vector_3 Vector; typedef typename Kernel::FT FT; @@ -348,12 +348,12 @@ edge_aware_upsample_point_set( // trick in case the output iterator add points to the input container typename PointRange::const_iterator begin = points.begin(); typename PointRange::const_iterator end = points.end(); - + // preconditions CGAL_point_set_processing_precondition(begin != end); - CGAL_point_set_processing_precondition(sharpness_angle >= 0 + CGAL_point_set_processing_precondition(sharpness_angle >= 0 &&sharpness_angle <= 90); - CGAL_point_set_processing_precondition(edge_sensitivity >= 0 + CGAL_point_set_processing_precondition(edge_sensitivity >= 0 &&edge_sensitivity <= 1); CGAL_point_set_processing_precondition(neighbor_radius > 0); @@ -374,13 +374,13 @@ edge_aware_upsample_point_set( std::cout << "neighbor radius: " << neighbor_radius << std::endl; #endif } - + Real_timer task_timer; // copy rich point set std::vector rich_point_set(number_of_input); CGAL::Bbox_3 bbox(0., 0., 0., 0., 0., 0.); - + typename PointRange::const_iterator it = begin; // point iterator for(unsigned int i = 0; it != end; ++it, ++i) { @@ -424,7 +424,7 @@ edge_aware_upsample_point_set( current_radius); } #ifdef CGAL_PSP3_VERBOSE - std::cout << "current radius: " << current_radius << std::endl; + std::cout << "current radius: " << current_radius << std::endl; #endif std::size_t current_size = rich_point_set.size(); @@ -468,7 +468,7 @@ edge_aware_upsample_point_set( sum_density = 0.; count_density = 1; - FT density_pass_threshold2 = density_pass_threshold * + FT density_pass_threshold2 = density_pass_threshold * density_pass_threshold; #ifdef CGAL_PSP3_VERBOSE std::cout << "pass_threshold: " << density_pass_threshold << std::endl; @@ -502,7 +502,7 @@ edge_aware_upsample_point_set( neighbor_rich_points[n] = rich_point_set[v.neighbors[n]]; } - // select base point + // select base point unsigned int base_index = 0; FT density2 = upsample_internal:: base_point_selection(v, @@ -536,10 +536,10 @@ edge_aware_upsample_point_set( is_pass_threshold.push_back(false); //update new rich point - upsample_internal::update_new_point(new_point_index, - father_index, - mother_index, - rich_point_set, + upsample_internal::update_new_point(new_point_index, + father_index, + mother_index, + rich_point_set, current_radius, sharpness_bandwidth); @@ -551,8 +551,8 @@ edge_aware_upsample_point_set( #ifdef CGAL_PSP3_VERBOSE std::cout << "current size: " << rich_point_set.size() << std::endl; #endif - if (count_not_pass == 0 || - loop >= max_loop_time || + if (count_not_pass == 0 || + loop >= max_loop_time || rich_point_set.size() >= number_of_output_points) { break; @@ -573,7 +573,7 @@ edge_aware_upsample_point_set( Vector normal = v.normal; *output++ = std::make_pair(point, normal); } - + return output; } @@ -582,7 +582,7 @@ edge_aware_upsample_point_set( // variant with default NP template + typename OutputIterator> OutputIterator edge_aware_upsample_point_set( const PointRange& points, diff --git a/Point_set_processing_3/include/CGAL/estimate_scale.h b/Point_set_processing_3/include/CGAL/estimate_scale.h index 0b58e29cba3..235cba83c27 100644 --- a/Point_set_processing_3/include/CGAL/estimate_scale.h +++ b/Point_set_processing_3/include/CGAL/estimate_scale.h @@ -51,7 +51,7 @@ class Quick_multiscale_approximate_knn_distance }; - + template class Quick_multiscale_approximate_knn_distance { @@ -69,7 +69,7 @@ class Quick_multiscale_approximate_knn_distance::reference operator() (const ValueType& v) const { return get(point_map, v); } }; - + std::size_t m_cluster_size; std::vector m_trees; std::vector m_weights; @@ -86,18 +86,18 @@ public: { typedef Pmap_unary_function::value_type, PointMap> Unary_f; - + // Avoid moving points of input as the range is const std::vector kd_tree_points; std::copy (boost::make_transform_iterator (first, Unary_f(point_map)), boost::make_transform_iterator (beyond, Unary_f(point_map)), std::back_inserter (kd_tree_points)); - + m_trees.push_back (new Tree (kd_tree_points.begin(), kd_tree_points.end())); m_weights.push_back (1.); std::size_t nb_pts = m_trees[0]->size(); - + std::size_t nb_trees = 0; while (nb_pts > m_cluster_size) { @@ -167,15 +167,15 @@ public: } } } - - + + template void compute_scale (InputIterator query, PointMap point_map, std::size_t& k, FT& d) { if (m_precomputed_factor.empty()) precompute_factors(); - + k = 0; d = 0.; @@ -190,7 +190,7 @@ public: ? m_trees[t]->size() : m_weights[t+1] / m_weights[t]))); Iterator it = search.begin(); - + if (t != 0) // Skip first point except on first scale ++ it; @@ -201,11 +201,11 @@ public: if (nb < 6.) // do not consider values under 6 continue; - + // sqrt(sum_sq_distances / nb) / nb^(5/12) // Computed in log space with precomputed factor for time optimization FT dist = 0.5 * std::log (sum_sq_distances) - m_precomputed_factor[index ++]; - + if (dist < dist_min) { dist_min = dist; @@ -218,7 +218,7 @@ public: }; - + template class Quick_multiscale_approximate_knn_distance { @@ -248,7 +248,7 @@ class Quick_multiscale_approximate_knn_distance::reference p2 = get(pmap.point_map, p); @@ -273,7 +273,7 @@ class Quick_multiscale_approximate_knn_distance m_point_sets; std::vector m_weights; std::vector m_precomputed_factor; - + public: template @@ -295,7 +295,7 @@ public: m_point_sets.push_back (new Point_set (search_points.begin(), search_points.end())); m_weights.push_back (1.); - + std::size_t nb_pts = m_point_sets[0]->number_of_vertices(); std::size_t nb_trees = 0; while (nb_pts > m_cluster_size) @@ -369,7 +369,7 @@ public: } } } - + template void compute_scale (InputIterator query, PointMap point_map, std::size_t& k, FT& d) @@ -384,7 +384,7 @@ public: FT sum_sq_distances = 0.; FT nb = 0.; std::size_t index = 0; - + typename boost::property_traits::reference pquery = get(point_map, *query); for (std::size_t t = 0; t < m_point_sets.size(); ++ t) @@ -411,7 +411,7 @@ public: // sqrt(sum_sq_distances / nb) / nb^(3/4) // Computed in log space with precomputed factor for time optimization FT dist = 0.5 * std::log (sum_sq_distances) - m_precomputed_factor[index ++]; - + if (dist < dist_min) { dist_min = dist; @@ -433,7 +433,7 @@ public: // Public section // ---------------------------------------------------------------------------- -/** +/** \ingroup PkgPointSetProcessing3Algorithms Estimates the local scale in a K nearest neighbors sense on a set @@ -527,7 +527,7 @@ estimate_local_k_neighbor_scales( } /// \endcond -/** +/** \ingroup PkgPointSetProcessing3Algorithms Estimates the global scale in a K nearest neighbors sense. The @@ -583,9 +583,9 @@ estimate_global_k_neighbor_scale(const PointRange& points) return estimate_global_k_neighbor_scale (points, CGAL::Point_set_processing_3::parameters::all_default(points)); } -/// \endcond +/// \endcond -/** +/** \ingroup PkgPointSetProcessing3Algorithms Estimates the local scale in a range sense on a set of @@ -640,7 +640,7 @@ estimate_local_range_scales( { using parameters::choose_parameter; using parameters::get_parameter; - + typedef typename CGAL::GetPointMap::const_type PointMap; typedef typename Point_set_processing_3::GetQueryPointMap::const_type QueryPointMap; typedef typename Point_set_processing_3::GetK::Kernel Kernel; @@ -663,7 +663,7 @@ estimate_local_range_scales( } /// \cond SKIP_IN_MANUAL -// variant with default NP +// variant with default NP template ::value_type Point; public: - Hash_epsilon_points_3 (double epsilon, PointMap p_map) + Hash_epsilon_points_3 (double epsilon, PointMap p_map) : m_epsilon (epsilon), point_map(p_map) { CGAL_point_set_processing_precondition(epsilon > 0); @@ -92,7 +92,7 @@ private: typedef typename boost::property_traits::value_type Point; public: - Equal_epsilon_points_3 (const double& epsilon, PointMap p_map) + Equal_epsilon_points_3 (const double& epsilon, PointMap p_map) : m_epsilon (epsilon), point_map(p_map) { CGAL_point_set_processing_precondition(epsilon > 0); @@ -201,7 +201,7 @@ grid_simplify_point_set( { using parameters::choose_parameter; using parameters::get_parameter; - + typedef typename CGAL::GetPointMap::const_type PointMap; PointMap point_map = choose_parameter(get_parameter(np, internal_np::point_map)); const std::function& callback = choose_parameter(get_parameter(np, internal_np::callback), diff --git a/Point_set_processing_3/include/CGAL/hierarchy_simplify_point_set.h b/Point_set_processing_3/include/CGAL/hierarchy_simplify_point_set.h index c0b3c2f1610..318f1589465 100644 --- a/Point_set_processing_3/include/CGAL/hierarchy_simplify_point_set.h +++ b/Point_set_processing_3/include/CGAL/hierarchy_simplify_point_set.h @@ -42,13 +42,13 @@ namespace CGAL { namespace internal { template < typename InputIterator, - typename PointMap, - typename K > + typename PointMap, + typename K > typename K::Point_3 - hsps_centroid(InputIterator begin, - InputIterator end, - PointMap& point_map, - const K&) + hsps_centroid(InputIterator begin, + InputIterator end, + PointMap& point_map, + const K&) { typedef typename K::Point_3 Point; typedef typename K::FT FT; @@ -57,27 +57,27 @@ namespace CGAL { FT x = (FT)0., y = (FT)0., z = (FT)0.; unsigned int nb_pts = 0; - while(begin != end) - { - typename boost::property_traits::reference point = + while(begin != end) + { + typename boost::property_traits::reference point = get(point_map, *begin); - x += point.x (); y += point.y (); z += point.z (); - ++ nb_pts; - ++ begin; - } + x += point.x (); y += point.y (); z += point.z (); + ++ nb_pts; + ++ begin; + } return Point (x/nb_pts, y/nb_pts, z/nb_pts); } template < typename Input_type, - typename PointMap, - typename K > + typename PointMap, + typename K > void hsc_terminate_cluster (std::list& cluster, - std::list& points_to_keep, - std::list& points_to_remove, - PointMap& point_map, - const typename K::Point_3& centroid, - const K&) + std::list& points_to_keep, + std::list& points_to_remove, + PointMap& point_map, + const typename K::Point_3& centroid, + const K&) { typedef typename std::list::iterator Iterator; typedef typename K::FT FT; @@ -86,19 +86,19 @@ namespace CGAL { typename std::list::iterator point_min; for (Iterator it = cluster.begin (); it != cluster.end (); ++ it) - { - FT dist = CGAL::squared_distance (get(point_map, *it), centroid); - if (dist < dist_min) - { - dist_min = dist; - point_min = it; - } - } + { + FT dist = CGAL::squared_distance (get(point_map, *it), centroid); + if (dist < dist_min) + { + dist_min = dist; + point_min = it; + } + } points_to_keep.splice (points_to_keep.end (), cluster, point_min); points_to_remove.splice (points_to_remove.end (), cluster, cluster.begin (), cluster.end ()); - } - + } + @@ -107,18 +107,18 @@ namespace CGAL { /** \ingroup PkgPointSetProcessing3Algorithms - + Recursively split the point set in smaller clusters until the clusters have less than `size` elements or until their variation - factor is below `var_max`. - + factor is below `var_max`. + This method modifies the order of input points so as to pack all remaining points first, and returns an iterator over the first point to remove (see erase-remove idiom). For this reason it should not be called on sorted containers. - + \pre `0 < maximum_variation < 1/3` \pre `size > 0` - + \tparam PointRange is a model of `Range`. The value type of its iterator is the key type of the named parameter `point_map`. @@ -147,14 +147,14 @@ namespace CGAL { \return iterator over the first point to remove. */ template + typename NamedParameters> typename PointRange::iterator hierarchy_simplify_point_set (PointRange& points, const NamedParameters& np) { using parameters::choose_parameter; using parameters::get_parameter; - + // basic geometric types typedef typename CGAL::GetPointMap::type PointMap; typedef typename Point_set_processing_3::GetK::Kernel Kernel; @@ -186,7 +186,7 @@ namespace CGAL { // The first cluster is the whole input point set clusters_stack.push_front (cluster (std::list(), Point (0., 0., 0.))); std::copy (points.begin(), points.end(), std::back_inserter (clusters_stack.front ().first)); - + clusters_stack.front ().second = internal::hsps_centroid (clusters_stack.front ().first.begin (), clusters_stack.front ().first.end (), point_map, Kernel()); @@ -195,138 +195,138 @@ namespace CGAL { std::list points_to_remove; std::size_t nb_done = 0; - + while (!(clusters_stack.empty ())) { - cluster_iterator current_cluster = clusters_stack.begin (); + cluster_iterator current_cluster = clusters_stack.begin (); - // If the cluster only has 1 element, we add it to the list of - // output points - if (current_cluster->first.size () == 1) - { - points_to_keep.splice (points_to_keep.end (), current_cluster->first, - current_cluster->first.begin ()); - clusters_stack.pop_front (); + // If the cluster only has 1 element, we add it to the list of + // output points + if (current_cluster->first.size () == 1) + { + points_to_keep.splice (points_to_keep.end (), current_cluster->first, + current_cluster->first.begin ()); + clusters_stack.pop_front (); ++ nb_done; - continue; - } + continue; + } - // Compute the covariance matrix of the set - std::array covariance = {{ 0., 0., 0., 0., 0., 0. }}; + // Compute the covariance matrix of the set + std::array covariance = {{ 0., 0., 0., 0., 0., 0. }}; - for (typename std::list::iterator it = current_cluster->first.begin (); - it != current_cluster->first.end (); ++ it) - { - const Point& point = get(point_map, *it); - Vector d = point - current_cluster->second; - covariance[0] += d.x () * d.x (); - covariance[1] += d.x () * d.y (); - covariance[2] += d.x () * d.z (); - covariance[3] += d.y () * d.y (); - covariance[4] += d.y () * d.z (); - covariance[5] += d.z () * d.z (); - } + for (typename std::list::iterator it = current_cluster->first.begin (); + it != current_cluster->first.end (); ++ it) + { + const Point& point = get(point_map, *it); + Vector d = point - current_cluster->second; + covariance[0] += d.x () * d.x (); + covariance[1] += d.x () * d.y (); + covariance[2] += d.x () * d.z (); + covariance[3] += d.y () * d.y (); + covariance[4] += d.y () * d.z (); + covariance[5] += d.z () * d.z (); + } - std::array eigenvalues = {{ 0., 0., 0. }}; - std::array eigenvectors = {{ 0., 0., 0., - 0., 0., 0., - 0., 0., 0. }}; - // Linear algebra = get eigenvalues and eigenvectors for - // PCA-like analysis - DiagonalizeTraits::diagonalize_selfadjoint_covariance_matrix - (covariance, eigenvalues, eigenvectors); - - // Variation of the set defined as lambda_min / (lambda_0 + lambda_1 + lambda_2) - double var = eigenvalues[0] / (eigenvalues[0] + eigenvalues[1] + eigenvalues[2]); + std::array eigenvalues = {{ 0., 0., 0. }}; + std::array eigenvectors = {{ 0., 0., 0., + 0., 0., 0., + 0., 0., 0. }}; + // Linear algebra = get eigenvalues and eigenvectors for + // PCA-like analysis + DiagonalizeTraits::diagonalize_selfadjoint_covariance_matrix + (covariance, eigenvalues, eigenvectors); - // Split the set if size OR variance of the cluster is too large - if (current_cluster->first.size () > size || var > var_max) - { - clusters_stack.push_front (cluster (std::list(), Point (0., 0., 0.))); - cluster_iterator negative_side = clusters_stack.begin (); - // positive_side is built directly from current_cluster - - // The plane which splits the point set into 2 point sets: - // * Normal to the eigenvector with highest eigenvalue - // * Passes through the centroid of the set - Vector v (eigenvectors[6], eigenvectors[7], eigenvectors[8]); + // Variation of the set defined as lambda_min / (lambda_0 + lambda_1 + lambda_2) + double var = eigenvalues[0] / (eigenvalues[0] + eigenvalues[1] + eigenvalues[2]); - std::size_t current_cluster_size = 0; - typename std::list::iterator it = current_cluster->first.begin (); - while (it != current_cluster->first.end ()) - { - typename std::list::iterator current = it ++; + // Split the set if size OR variance of the cluster is too large + if (current_cluster->first.size () > size || var > var_max) + { + clusters_stack.push_front (cluster (std::list(), Point (0., 0., 0.))); + cluster_iterator negative_side = clusters_stack.begin (); + // positive_side is built directly from current_cluster + + // The plane which splits the point set into 2 point sets: + // * Normal to the eigenvector with highest eigenvalue + // * Passes through the centroid of the set + Vector v (eigenvectors[6], eigenvectors[7], eigenvectors[8]); + + std::size_t current_cluster_size = 0; + typename std::list::iterator it = current_cluster->first.begin (); + while (it != current_cluster->first.end ()) + { + typename std::list::iterator current = it ++; const Point& point = get(point_map, *current); - // Test if point is on negative side of plane and - // transfer it to the negative_side cluster if it is - if (Vector (current_cluster->second, point) * v < 0) - negative_side->first.splice (negative_side->first.end (), - current_cluster->first, current); - ++ current_cluster_size; - } + // Test if point is on negative side of plane and + // transfer it to the negative_side cluster if it is + if (Vector (current_cluster->second, point) * v < 0) + negative_side->first.splice (negative_side->first.end (), + current_cluster->first, current); + ++ current_cluster_size; + } - // If one of the clusters is empty, stop to avoid infinite - // loop and keep the non-empty one - if (current_cluster->first.empty () || negative_side->first.empty ()) - { - cluster_iterator nonempty = (current_cluster->first.empty () - ? negative_side : current_cluster); + // If one of the clusters is empty, stop to avoid infinite + // loop and keep the non-empty one + if (current_cluster->first.empty () || negative_side->first.empty ()) + { + cluster_iterator nonempty = (current_cluster->first.empty () + ? negative_side : current_cluster); nb_done += nonempty->first.size(); - // Compute the centroid - nonempty->second = internal::hsps_centroid (nonempty->first.begin (), - nonempty->first.end (), - point_map, Kernel()); - - internal::hsc_terminate_cluster (nonempty->first, - points_to_keep, - points_to_remove, - point_map, - nonempty->second, - Kernel ()); - - clusters_stack.pop_front (); - clusters_stack.pop_front (); - } - else - { - // Save old centroid for faster computation - Point old_centroid = current_cluster->second; - - // Compute the first centroid - current_cluster->second = internal::hsps_centroid (current_cluster->first.begin (), - current_cluster->first.end (), - point_map, Kernel()); + // Compute the centroid + nonempty->second = internal::hsps_centroid (nonempty->first.begin (), + nonempty->first.end (), + point_map, Kernel()); - // The second centroid can be computed with the first and - // the old ones : - // centroid_neg = (n_total * old_centroid - n_pos * first_centroid) - // / n_neg; - negative_side->second = Point ((current_cluster_size * old_centroid.x () - - current_cluster->first.size () * current_cluster->second.x ()) - / negative_side->first.size (), - (current_cluster_size * old_centroid.y () - - current_cluster->first.size () * current_cluster->second.y ()) - / negative_side->first.size (), - (current_cluster_size * old_centroid.z () - - current_cluster->first.size () * current_cluster->second.z ()) - / negative_side->first.size ()); - } - } - // If the size/variance are small enough, add the centroid as - // and output point - else - { + internal::hsc_terminate_cluster (nonempty->first, + points_to_keep, + points_to_remove, + point_map, + nonempty->second, + Kernel ()); + + clusters_stack.pop_front (); + clusters_stack.pop_front (); + } + else + { + // Save old centroid for faster computation + Point old_centroid = current_cluster->second; + + // Compute the first centroid + current_cluster->second = internal::hsps_centroid (current_cluster->first.begin (), + current_cluster->first.end (), + point_map, Kernel()); + + // The second centroid can be computed with the first and + // the old ones : + // centroid_neg = (n_total * old_centroid - n_pos * first_centroid) + // / n_neg; + negative_side->second = Point ((current_cluster_size * old_centroid.x () + - current_cluster->first.size () * current_cluster->second.x ()) + / negative_side->first.size (), + (current_cluster_size * old_centroid.y () + - current_cluster->first.size () * current_cluster->second.y ()) + / negative_side->first.size (), + (current_cluster_size * old_centroid.z () + - current_cluster->first.size () * current_cluster->second.z ()) + / negative_side->first.size ()); + } + } + // If the size/variance are small enough, add the centroid as + // and output point + else + { nb_done += current_cluster->first.size(); - internal::hsc_terminate_cluster (current_cluster->first, - points_to_keep, - points_to_remove, - point_map, - current_cluster->second, - Kernel ()); - clusters_stack.pop_front (); - } + internal::hsc_terminate_cluster (current_cluster->first, + points_to_keep, + points_to_remove, + point_map, + current_cluster->second, + Kernel ()); + clusters_stack.pop_front (); + } if (callback && !callback (nb_done / double (points.size()))) break; @@ -334,7 +334,7 @@ namespace CGAL { if (callback) callback (1.); - + typename PointRange::iterator first_point_to_remove = std::copy (points_to_keep.begin(), points_to_keep.end(), points.begin()); std::copy (points_to_remove.begin(), points_to_remove.end(), first_point_to_remove); @@ -353,7 +353,7 @@ namespace CGAL { return hierarchy_simplify_point_set (points, CGAL::Point_set_processing_3::parameters::all_default(points)); } - /// \endcond + /// \endcond } // namespace CGAL diff --git a/Point_set_processing_3/include/CGAL/jet_estimate_normals.h b/Point_set_processing_3/include/CGAL/jet_estimate_normals.h index 20092e838c3..16e3e131d29 100644 --- a/Point_set_processing_3/include/CGAL/jet_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/jet_estimate_normals.h @@ -36,7 +36,7 @@ #include #include #include -#include +#include #endif // CGAL_LINKED_WITH_TBB namespace CGAL { @@ -81,7 +81,7 @@ jet_estimate_normal(const typename Kernel::Point_3& query, ///< point to compute std::vector points; CGAL::Point_set_processing_3::internal::neighbor_query (query, tree, k, neighbor_radius, points); - + // performs jet fitting Monge_jet_fitting monge_fit; const unsigned int degree_monge = 1; // we seek for normal and not more. @@ -118,7 +118,7 @@ jet_estimate_normal(const typename Kernel::Point_3& query, ///< point to compute , advancement (advancement) , interrupted (interrupted) { } - + void operator()(const tbb::blocked_range& r) const { for( std::size_t i = r.begin(); i != r.end(); ++i) @@ -134,7 +134,7 @@ jet_estimate_normal(const typename Kernel::Point_3& query, ///< point to compute #endif // CGAL_LINKED_WITH_TBB - + } /* namespace internal */ /// \endcond @@ -187,7 +187,7 @@ jet_estimate_normal(const typename Kernel::Point_3& query, ///< point to compute \cgalNamedParamsEnd */ template void @@ -198,7 +198,7 @@ jet_estimate_normals( { using parameters::choose_parameter; using parameters::get_parameter; - + CGAL_TRACE("Calls jet_estimate_normals()\n"); // basic geometric types @@ -219,7 +219,7 @@ jet_estimate_normals( NormalMap normal_map = choose_parameter(get_parameter(np, internal_np::normal_map)); unsigned int degree_fitting = choose_parameter(get_parameter(np, internal_np::degree_fitting), 2); FT neighbor_radius = choose_parameter(get_parameter(np, internal_np::neighbor_radius), FT(0)); - + const std::function& callback = choose_parameter(get_parameter(np, internal_np::callback), std::function()); @@ -248,7 +248,7 @@ jet_estimate_normals( // Instanciate a KD-tree search. // Note: We have to convert each input iterator to Point_3. - std::vector kd_tree_points; + std::vector kd_tree_points; for(it = points.begin(); it != points.end(); it++) kd_tree_points.push_back(get(point_map, *it)); Tree tree(kd_tree_points.begin(), kd_tree_points.end()); @@ -260,13 +260,13 @@ jet_estimate_normals( // vectors (already normalized) #ifndef CGAL_LINKED_WITH_TBB CGAL_static_assertion_msg (!(boost::is_convertible::value), - "Parallel_tag is enabled but TBB is unavailable."); + "Parallel_tag is enabled but TBB is unavailable."); #else if (boost::is_convertible::value) { Point_set_processing_3::internal::Parallel_callback parallel_callback (callback, kd_tree_points.size()); - + std::vector normals (kd_tree_points.size (), CGAL::NULL_VECTOR); CGAL::internal::Jet_estimate_normals @@ -287,15 +287,15 @@ jet_estimate_normals( { std::size_t nb = 0; for(it = points.begin(); it != points.end(); it++, ++ nb) - { - Vector normal = internal::jet_estimate_normal( - get(point_map,*it), - tree, k, neighbor_radius, degree_fitting); + { + Vector normal = internal::jet_estimate_normal( + get(point_map,*it), + tree, k, neighbor_radius, degree_fitting); - put(normal_map, *it, normal); // normal_map[it] = normal + put(normal_map, *it, normal); // normal_map[it] = normal if (callback && !callback ((nb+1) / double(kd_tree_points.size()))) break; - } + } } @@ -307,7 +307,7 @@ jet_estimate_normals( /// \cond SKIP_IN_MANUAL // variant with default NP template + typename PointRange> void jet_estimate_normals( PointRange& points, diff --git a/Point_set_processing_3/include/CGAL/jet_smooth_point_set.h b/Point_set_processing_3/include/CGAL/jet_smooth_point_set.h index 316fe9f8a90..1d089fb5c80 100644 --- a/Point_set_processing_3/include/CGAL/jet_smooth_point_set.h +++ b/Point_set_processing_3/include/CGAL/jet_smooth_point_set.h @@ -35,7 +35,7 @@ #include #include #include -#include +#include #endif // CGAL_LINKED_WITH_TBB namespace CGAL { @@ -78,8 +78,8 @@ jet_smooth_point( Simple_cartesian, SvdTraits> Monge_jet_fitting; typedef typename Monge_jet_fitting::Monge_form Monge_form; - - std::vector points; + + std::vector points; CGAL::Point_set_processing_3::internal::neighbor_query (query, tree, k, neighbor_radius, points); @@ -118,17 +118,17 @@ jet_smooth_point( , advancement (advancement) , interrupted (interrupted) { } - + void operator()(const tbb::blocked_range& r) const { for( std::size_t i = r.begin(); i != r.end(); ++i) { if (interrupted) break; - output[i] = CGAL::internal::jet_smooth_point(input[i], tree, k, + output[i] = CGAL::internal::jet_smooth_point(input[i], tree, k, neighbor_radius, - degree_fitting, - degree_monge); + degree_fitting, + degree_monge); ++ advancement; } } @@ -191,7 +191,7 @@ jet_smooth_point( */ template void @@ -202,7 +202,7 @@ jet_smooth_point_set( { using parameters::choose_parameter; using parameters::get_parameter; - + // basic geometric types typedef typename CGAL::GetPointMap::type PointMap; typedef typename Point_set_processing_3::GetK::Kernel Kernel; @@ -234,12 +234,12 @@ jet_smooth_point_set( // precondition: at least 2 nearest neighbors CGAL_point_set_processing_precondition(k >= 2); - + typename PointRange::iterator it; // Instanciate a KD-tree search. // Note: We have to convert each input iterator to Point_3. - std::vector kd_tree_points; + std::vector kd_tree_points; for(it = points.begin(); it != points.end(); it++) kd_tree_points.push_back(get(point_map, *it)); Tree tree(kd_tree_points.begin(), kd_tree_points.end()); @@ -249,13 +249,13 @@ jet_smooth_point_set( #ifndef CGAL_LINKED_WITH_TBB CGAL_static_assertion_msg (!(boost::is_convertible::value), - "Parallel_tag is enabled but TBB is unavailable."); + "Parallel_tag is enabled but TBB is unavailable."); #else if (boost::is_convertible::value) { Point_set_processing_3::internal::Parallel_callback parallel_callback (callback, kd_tree_points.size()); - + std::vector mutated_points (kd_tree_points.size (), CGAL::ORIGIN); CGAL::internal::Jet_smooth_pwns f (tree, k, neighbor_radius, kd_tree_points, degree_fitting, degree_monge, @@ -276,14 +276,14 @@ jet_smooth_point_set( { std::size_t nb = 0; for(it = points.begin(); it != points.end(); it++, ++ nb) - { - const typename boost::property_traits::reference p = get(point_map, *it); - put(point_map, *it , - internal::jet_smooth_point( + { + const typename boost::property_traits::reference p = get(point_map, *it); + put(point_map, *it , + internal::jet_smooth_point( p,tree,k,neighbor_radius,degree_fitting,degree_monge) ); if (callback && !callback ((nb+1) / double(kd_tree_points.size()))) break; - } + } } } @@ -291,7 +291,7 @@ jet_smooth_point_set( /// \cond SKIP_IN_MANUAL // variant with default NP template + typename PointRange> void jet_smooth_point_set( PointRange& points, @@ -301,7 +301,7 @@ jet_smooth_point_set( (points, k, CGAL::Point_set_processing_3::parameters::all_default(points)); } /// \endcond - + } //namespace CGAL diff --git a/Point_set_processing_3/include/CGAL/mst_orient_normals.h b/Point_set_processing_3/include/CGAL/mst_orient_normals.h index 7339317d4e8..0415170bfa5 100644 --- a/Point_set_processing_3/include/CGAL/mst_orient_normals.h +++ b/Point_set_processing_3/include/CGAL/mst_orient_normals.h @@ -125,7 +125,7 @@ public: typedef value_type reference; private: - + ForwardIterator m_source_point; public: @@ -188,7 +188,7 @@ struct Propagate_normal_orientation // Gets target vertex_descriptor target_vertex = target(edge, mst_graph); bool& target_normal_is_oriented = ((MST_graph&)mst_graph)[target_vertex].is_oriented; - + // special case if vertex is source vertex (and thus has no related point/normal) if (source_vertex == m_source) { @@ -202,7 +202,7 @@ struct Propagate_normal_orientation // Gets target Vector_ref target_normal = get( mst_graph.m_normal_map, *(mst_graph[target_vertex].input_point) ); - + if ( ! target_normal_is_oriented ) { // -> -> @@ -261,10 +261,10 @@ mst_find_source( ForwardIterator top_point = first; for (ForwardIterator v = ++first; v != beyond; v++) { - + double top_z = get(point_map,*top_point).z(); // top_point's Z coordinate double z = get(point_map,*v).z(); - + if (top_z < z) top_point = v; } @@ -348,7 +348,7 @@ create_riemannian_graph( std::vector kd_tree_points; kd_tree_points.reserve(num_input_points); for (ForwardIterator it = first; it != beyond; it++) { - + Point_ref point = get(point_map, *it); Point_vertex_handle_3 point_wrapper(point.x(), point.y(), point.z(), it); kd_tree_points.push_back(point_wrapper); @@ -387,7 +387,7 @@ create_riemannian_graph( { std::size_t it_index = get(index_map,it); Vector_ref it_normal_vector = get(normal_map,*it); - + Point_ref point = get(point_map, *it); Point_vertex_handle_3 point_wrapper(point.x(), point.y(), point.z(), it); std::vector neighbor_points; @@ -411,7 +411,7 @@ create_riemannian_graph( // -> -> // Computes edge weight = 1 - | normal1 * normal2 | // where normal1 and normal2 are the normal at the edge extremities. - + Vector_ref neighbor_normal_vector = get(normal_map,*neighbor); double weight = 1.0 - std::abs(it_normal_vector * neighbor_normal_vector); if (weight < 0) @@ -432,7 +432,7 @@ create_riemannian_graph( riemannian_graph_weight_map[e] = 0.; } - + } return riemannian_graph; @@ -496,7 +496,7 @@ create_mst_graph( // Computes Minimum Spanning Tree. std::size_t source_point_index = num_input_points; - + Riemannian_graph_weight_map riemannian_graph_weight_map = get(boost::edge_weight, riemannian_graph); typedef std::vector PredecessorMap; PredecessorMap predecessor(num_input_points + 1); @@ -524,11 +524,11 @@ create_mst_graph( mst_graph[v].input_point = it; mst_graph[v].is_oriented = false; } - + typename MST_graph::vertex_descriptor v = add_vertex(mst_graph); CGAL_point_set_processing_assertion(v == source_point_index); mst_graph[v].is_oriented = true; - + // add edges for (std::size_t i=0; i < predecessor.size(); i++) // add edges { @@ -553,7 +553,7 @@ create_mst_graph( // Public section // ---------------------------------------------------------------------------- -/** +/** \ingroup PkgPointSetProcessing3Algorithms Orients the normals of the range of `points` using the propagation of a seed orientation through a minimum spanning tree of the Riemannian graph. @@ -588,7 +588,7 @@ create_mst_graph( limit is wanted, use `k=0`.\cgalParamEnd \cgalParamBegin{point_is_constrained_map} a model of `ReadablePropertyMap` with value type `bool`. Points with a `true` value will be used as seed points: their normal will be considered as already - oriented, it won't be altered and it will be propagated to its neighbors. If this parameter is omitted, + oriented, it won't be altered and it will be propagated to its neighbors. If this parameter is omitted, the highest point (highest Z coordinate) will be used as the unique seed with an upward oriented normal\cgalParamEnd \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `Kernel`\cgalParamEnd @@ -694,7 +694,7 @@ mst_orient_normals( const std::size_t num_input_points = distance(points.begin(), points.end()); std::size_t source_point_index = num_input_points; - + // Traverse the point set along the MST to propagate source_point's orientation Propagate_normal_orientation orienter(source_point_index); diff --git a/Point_set_processing_3/include/CGAL/pca_estimate_normals.h b/Point_set_processing_3/include/CGAL/pca_estimate_normals.h index 3a8b28bfe35..4225b9081b7 100644 --- a/Point_set_processing_3/include/CGAL/pca_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/pca_estimate_normals.h @@ -37,7 +37,7 @@ #include #include #include -#include +#include #endif // CGAL_LINKED_WITH_TBB namespace CGAL { @@ -74,7 +74,7 @@ pca_estimate_normal(const typename Kernel::Point_3& query, ///< point to compute std::vector points; CGAL::Point_set_processing_3::internal::neighbor_query (query, tree, k, neighbor_radius, points); - + // performs plane fitting by point-based PCA Plane plane; linear_least_squares_fitting_3(points.begin(),points.end(),plane,Dimension_tag<0>()); @@ -109,7 +109,7 @@ pca_estimate_normal(const typename Kernel::Point_3& query, ///< point to compute , advancement (advancement) , interrupted (interrupted) { } - + void operator()(const tbb::blocked_range& r) const { for( std::size_t i = r.begin(); i != r.end(); ++i) @@ -123,7 +123,7 @@ pca_estimate_normal(const typename Kernel::Point_3& query, ///< point to compute }; #endif // CGAL_LINKED_WITH_TBB - + } /* namespace internal */ /// \endcond @@ -176,7 +176,7 @@ pca_estimate_normal(const typename Kernel::Point_3& query, ///< point to compute \cgalNamedParamsEnd */ template void @@ -231,7 +231,7 @@ pca_estimate_normals( // Instanciate a KD-tree search. // Note: We have to convert each input iterator to Point_3. - std::vector kd_tree_points; + std::vector kd_tree_points; for(it = points.begin(); it != points.end(); it++) kd_tree_points.push_back(get(point_map, *it)); Tree tree(kd_tree_points.begin(), kd_tree_points.end()); @@ -243,13 +243,13 @@ pca_estimate_normals( // vectors (already normalized) #ifndef CGAL_LINKED_WITH_TBB CGAL_static_assertion_msg (!(boost::is_convertible::value), - "Parallel_tag is enabled but TBB is unavailable."); + "Parallel_tag is enabled but TBB is unavailable."); #else if (boost::is_convertible::value) { Point_set_processing_3::internal::Parallel_callback parallel_callback (callback, kd_tree_points.size()); - + std::vector normals (kd_tree_points.size (), CGAL::NULL_VECTOR); CGAL::internal::PCA_estimate_normals @@ -269,18 +269,18 @@ pca_estimate_normals( { std::size_t nb = 0; for(it = points.begin(); it != points.end(); it++, ++ nb) - { - Vector normal = internal::pca_estimate_normal( - get(point_map,*it), - tree, - k, neighbor_radius); + { + Vector normal = internal::pca_estimate_normal( + get(point_map,*it), + tree, + k, neighbor_radius); - put(normal_map, *it, normal); // normal_map[it] = normal + put(normal_map, *it, normal); // normal_map[it] = normal if (callback && !callback ((nb+1) / double(kd_tree_points.size()))) break; - } + } } - + memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE(" %ld Mb allocated\n", memory>>20); CGAL_TRACE("End of pca_estimate_normals()\n"); } @@ -288,7 +288,7 @@ pca_estimate_normals( /// \cond SKIP_IN_MANUAL // variant with default NP template void pca_estimate_normals( diff --git a/Point_set_processing_3/include/CGAL/pointmatcher/compute_registration_transformation.h b/Point_set_processing_3/include/CGAL/pointmatcher/compute_registration_transformation.h index 93f9aac39f6..64a4e6530a0 100644 --- a/Point_set_processing_3/include/CGAL/pointmatcher/compute_registration_transformation.h +++ b/Point_set_processing_3/include/CGAL/pointmatcher/compute_registration_transformation.h @@ -39,7 +39,7 @@ using ICP = typename PointMatcher::ICP; /*! \ingroup PkgPointSetProcessing3Algorithms - + \brief The class `ICP_config` is designed to handle preparing and passing configurations to the registration methods `CGAL::pointmatcher::compute_registration_transformation()` and `CGAL::pointmatcher::register_point_sets()`. @@ -48,7 +48,7 @@ using ICP = typename PointMatcher::ICP; of \ref thirdpartylibpointmatcher library. The name and the parameters of any configuration for the corresponding registration methods are directly passed to \ref thirdpartylibpointmatcher library to be parsed and registered at the - \ref thirdpartylibpointmatcher side. + \ref thirdpartylibpointmatcher side. */ struct ICP_config { /// The name of the configuration component @@ -62,7 +62,7 @@ namespace internal { void dump_invalid_point_matcher_config_exception_msg(const PointMatcherSupport::InvalidElement& err) { std::cerr << "ERROR Invalid configuration for PM::ICP, omitting configuration: " << std::endl; - std::cerr << " " << err.what() << std::endl; + std::cerr << " " << err.what() << std::endl; } template @@ -73,7 +73,7 @@ construct_icp(const NamedParameters1& np1, const NamedParameters2& np2) using parameters::choose_parameter; using parameters::get_parameter; - + ICP icp; icp.setDefault(); @@ -89,7 +89,7 @@ construct_icp(const NamedParameters1& np1, const NamedParameters2& np2) icp.loadFromYaml(*pointmatcher_config); return icp; } - + // In CGAL, point_set_1 is the reference while point_set_2 is the data // However, in pointmatcher, the order is reverse: point_set_1 is the data while point_set_2 is the reference // Therefore, filter params from np1 applies to reference data points while params from np2 applies to reading data points @@ -102,7 +102,7 @@ construct_icp(const NamedParameters1& np1, const NamedParameters2& np2) } else { // Some config chain is given: clear default values and use the provided configs icp.referenceDataPointsFilters.clear(); - + for(const auto& conf : reference_data_points_filter_configs) { try { @@ -120,7 +120,7 @@ construct_icp(const NamedParameters1& np1, const NamedParameters2& np2) } else { // Some config chain is given: clear default values and use the provided configs icp.readingDataPointsFilters.clear(); - + for(const auto& conf : reading_data_points_filter_configs) { try { @@ -234,13 +234,13 @@ copy_cgal_points_to_pm_matrix pm_points(1, idx) = pos.y(); pm_points(2, idx) = pos.z(); pm_points(3, idx) = Scalar(1.); - + // normal const auto& normal = get (vector_map, p); pm_normals(0, idx) = normal.x(); pm_normals(1, idx) = normal.y(); pm_normals(2, idx) = normal.z(); - + ++idx; } } @@ -260,17 +260,17 @@ compute_registration_transformation(const PointRange1& range1, const PointRange2 ICP icp) { using Scalar = typename Kernel::FT; - + using PM = PointMatcher; using PM_cloud = typename PM::DataPoints; using PM_matrix = typename PM::Matrix; using PM_transform = typename PM::Transformation; using PM_transform_params = typename PM::TransformationParameters; - + // ref_points: 1, points: 2 std::size_t nb_ref_points = range1.size(); std::size_t nb_points = range2.size(); - + PM_matrix ref_points_pos_matrix = PM_matrix (4, nb_ref_points); PM_matrix ref_points_normal_matrix = PM_matrix (3, nb_ref_points); PM_matrix points_pos_matrix = PM_matrix (4, nb_points); @@ -290,23 +290,23 @@ compute_registration_transformation(const PointRange1& range1, const PointRange2 vector_map2, points_pos_matrix, // out points_normal_matrix); // out - + auto construct_PM_cloud = [](const PM_matrix& positions, const PM_matrix& normals) -> PM_cloud { PM_cloud cloud; - + cloud.addFeature("x", positions.row(0)); cloud.addFeature("y", positions.row(1)); cloud.addFeature("z", positions.row(2)); cloud.addFeature("pad", positions.row(3)); cloud.addDescriptor("normals", normals); - + return cloud; }; PM_cloud ref_cloud = construct_PM_cloud(ref_points_pos_matrix, ref_points_normal_matrix); PM_cloud cloud = construct_PM_cloud(points_pos_matrix, points_normal_matrix); - + PM_transform_params pm_transform_params = PM_transform_params::Identity(4,4); // Convert CGAL transform to pm transform @@ -315,21 +315,21 @@ compute_registration_transformation(const PointRange1& range1, const PointRange2 pm_transform_params(i,j) = initial_transform.m(i,j); bool converged = false; - try + try { - const PM_transform_params prior = pm_transform_params; - pm_transform_params = icp(cloud, ref_cloud, prior); + const PM_transform_params prior = pm_transform_params; + pm_transform_params = icp(cloud, ref_cloud, prior); converged = true; - } - catch (typename PM::ConvergenceError& error) - { - std::cerr << "ERROR CGAL::pointmatcher registration (PM::ICP) failed to converge: " << std::endl; - std::cerr << " " << error.what() << std::endl; + } + catch (typename PM::ConvergenceError& error) + { + std::cerr << "ERROR CGAL::pointmatcher registration (PM::ICP) failed to converge: " << std::endl; + std::cerr << " " << error.what() << std::endl; converged = false; - } + } - // Rigid transformation - std::shared_ptr transform = PM::get().REG(Transformation).create("RigidTransformation"); + // Rigid transformation + std::shared_ptr transform = PM::get().REG(Transformation).create("RigidTransformation"); pm_transform_params = transform->correctParameters(pm_transform_params); typename Kernel::Aff_transformation_3 cgal_transform @@ -355,7 +355,7 @@ compute_registration_transformation(const PointRange1& range1, const PointRange2 // point_set_1 is reference while point_set_2 is data /** \ingroup PkgPointSetProcessing3Algorithms - + Computes the registration of `point_set_2` with respect to `point_set_1` and returns the corresponding affine transformation. Registration is computed using the Iterative Closest Point (ICP) algorithm. @@ -376,26 +376,26 @@ compute_registration_transformation(const PointRange1& range1, const PointRange2 type is the value type of the iterator of `PointRange1` and whose value type `geom_traits::Vector_3`.\cgalParamEnd - \cgalParamBegin{point_set_filters} is a model of `Range`. The value type of - its iterator is `ICP_config`. - + \cgalParamBegin{point_set_filters} is a model of `Range`. The value type of + its iterator is `ICP_config`. + The chain of filters to be applied to the reference point cloud. The reference point cloud is processed into an intermediate point cloud with the given chain of filters to be used in the alignment procedure. The chain is organized with the forward traversal order of the point set filters range. - + The chain of point set filters are applied only once at the beginning of the ICP procedure, i.e., before the first iteration of the ICP algorithm. - + The filters can have several purposes, including but are not limited to i) removal of noisy points which render alignment of point clouds difficult, - ii) removal of redundant points so as to speed up alignment, iii) addition - of descriptive information to the points such as a surface normal vector, + ii) removal of redundant points so as to speed up alignment, iii) addition + of descriptive information to the points such as a surface normal vector, or the direction from the point to the sensor. Corresponds to `referenceDataPointsFilters` configuration module of \ref thirdpartylibpointmatcher library. The filters should be chosen and set from possible components of - the `referenceDataPointsFilters` configuration module. + the `referenceDataPointsFilters` configuration module. See libpointmatcher documentation for possible configurations. @@ -403,12 +403,12 @@ compute_registration_transformation(const PointRange1& range1, const PointRange2 \cgalParamEnd \cgalParamBegin{matcher} is a model of `ICP_config`. - The method used for matching (linking) the points from `point_set_2`, to the + The method used for matching (linking) the points from `point_set_2`, to the points in the reference cloud, `point_set_1`. - + Corresponds to `matcher` configuration module of \ref thirdpartylibpointmatcher library. The matcher should be chosen and set from possible components of - the `matcher` configuration module. + the `matcher` configuration module. See libpointmatcher documentation for possible configurations. @@ -416,7 +416,7 @@ compute_registration_transformation(const PointRange1& range1, const PointRange2 \cgalParamEnd - \cgalParamBegin{outlier_filters} is a model of `Range`. The value type of + \cgalParamBegin{outlier_filters} is a model of `Range`. The value type of its iterator is `ICP_config`. The chain of filters to be applied to the matched (linked) point clouds after each processing iteration of the ICP algorithm to remove the links which do not @@ -427,7 +427,7 @@ compute_registration_transformation(const PointRange1& range1, const PointRange2 Corresponds to `outlierFilters` configuration module of \ref thirdpartylibpointmatcher library. The filters should be chosen and set from possible components of - the `outlierFilters` configuration module. + the `outlierFilters` configuration module. See libpointmatcher documentation for possible configurations. @@ -440,14 +440,14 @@ compute_registration_transformation(const PointRange1& range1, const PointRange2 Corresponds to `errorMinimizer` configuration module of \ref thirdpartylibpointmatcher library. The error minimizer should be chosen and set from possible components of - the `errorMinimizer` configuration module. + the `errorMinimizer` configuration module. See libpointmatcher documentation for possible configurations. If this parameter is omitted, `PointToPlaneErrorMinimizer` is used. \cgalParamEnd - \cgalParamBegin{transformation_checkers} is a model of `Range`. The value type of + \cgalParamBegin{transformation_checkers} is a model of `Range`. The value type of its iterator is `ICP_config`. The chain of transformation checkers. A transformation checker can stop the iteration depending on the conditions it defines. @@ -457,21 +457,21 @@ compute_registration_transformation(const PointRange1& range1, const PointRange2 Corresponds to `transformationCheckers` configuration module of \ref thirdpartylibpointmatcher library. The transformation checkers should be chosen and set from possible components of - the `transformationCheckers` configuration module. + the `transformationCheckers` configuration module. See libpointmatcher documentation for possible configurations. If this parameter is omitted, the chain of `CounterTransformationChecker` and `DifferentialTransformationChecker` is used. \cgalParamEnd - + \cgalParamBegin{inspector} is a model of `ICP_config`. The inspector allows to log data at different steps for analysis. Inspectors typically provide deeper scrutiny than the logger. Corresponds to `inspector` configuration module of \ref thirdpartylibpointmatcher library. The inspector should be chosen and set from possible components of - the `inspector` configuration module. + the `inspector` configuration module. See libpointmatcher documentation for possible configurations. @@ -485,13 +485,13 @@ compute_registration_transformation(const PointRange1& range1, const PointRange2 Corresponds to `logger` configuration module of \ref thirdpartylibpointmatcher library. The logger should be chosen and set from possible components of - the `logger` configuration module. + the `logger` configuration module. See libpointmatcher documentation for possible configurations. If this parameter is omitted, `NullLogger` is used. \cgalParamEnd - + \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `Kernel`\cgalParamEnd @@ -507,33 +507,33 @@ compute_registration_transformation(const PointRange1& range1, const PointRange2 type is the value type of the iterator of `PointRange2` and whose value type `geom_traits::Vector_3`.\cgalParamEnd - \cgalParamBegin{point_set_filters} is a model of `Range`. The value type of + \cgalParamBegin{point_set_filters} is a model of `Range`. The value type of its iterator is `ICP_config`. The chain of filters to be applied to the point cloud, `point_set_2`. The point cloud is processed into an intermediate point cloud with the given chain of filters to be used in the alignment procedure. The chain is organized with the forward traversal order of the point set filters range. - + The chain of point set filters are applied only once at the beginning of the ICP procedure, i.e., before the first iteration of ICP algorithm. - + The filters can have several purposes, including but are not limited to i) removal of noisy points which render alignment of point clouds difficult, - ii) removal of redundant points so as to speed up alignment, iii) addition - of descriptive information to the points such as a surface normal vector, + ii) removal of redundant points so as to speed up alignment, iii) addition + of descriptive information to the points such as a surface normal vector, or the direction from the point to the sensor. Corresponds to `readingDataPointsFilters` configuration module of \ref thirdpartylibpointmatcher library. The filters should be chosen and set from possible components of - the `readingDataPointsFilters` configuration module. + the `readingDataPointsFilters` configuration module. See libpointmatcher documentation for possible configurations. If this parameter is omitted, `SamplingSurfaceNormalDataPointsFilter` is used. \cgalParamEnd - \cgalParamBegin{transformation} The affine transformation that is used as the + \cgalParamBegin{transformation} The affine transformation that is used as the initial transformation for `point_set_2`. If this parameter is omitted, identity transformation is used. @@ -544,7 +544,7 @@ compute_registration_transformation(const PointRange1& range1, const PointRange2 to `point_set_2` to make it registered w.r.t. `point_set_1` and the boolean value indicating if the registration converged. The second of the pair is `true` if converged, `false` otherwise. A log why it failed to - converge is written to `std::cerr` if the registration cannot converge. + converge is written to `std::cerr` if the registration cannot converge. */ template diff --git a/Point_set_processing_3/include/CGAL/pointmatcher/register_point_sets.h b/Point_set_processing_3/include/CGAL/pointmatcher/register_point_sets.h index 0110b968b4a..20a9e7e3e77 100644 --- a/Point_set_processing_3/include/CGAL/pointmatcher/register_point_sets.h +++ b/Point_set_processing_3/include/CGAL/pointmatcher/register_point_sets.h @@ -34,7 +34,7 @@ namespace pointmatcher { // point_set_1 is reference while point_set_2 is data /** \ingroup PkgPointSetProcessing3Algorithms - + Computes the registration of `point_set_2` with respect to `point_set_1` and applies it. @@ -60,26 +60,26 @@ namespace pointmatcher { type is the value type of the iterator of `PointRange1` and whose value type `geom_traits::Vector_3`.\cgalParamEnd - \cgalParamBegin{point_set_filters} is a model of `Range`. The value type of - its iterator is `ICP_config`. - + \cgalParamBegin{point_set_filters} is a model of `Range`. The value type of + its iterator is `ICP_config`. + The chain of filters to be applied to the reference point cloud. The reference point cloud is processed into an intermediate point cloud with the given chain of filters to be used in the alignment procedure. The chain is organized with the forward traversal order of the point set filters range. - + The chain of point set filters are applied only once at the beginning of the ICP procedure, i.e., before the first iteration of the ICP algorithm. - + The filters can have several purposes, including but are not limited to i) removal of noisy points which render alignment of point clouds difficult, - ii) removal of redundant points so as to speed up alignment, iii) addition - of descriptive information to the points such as a surface normal vector, + ii) removal of redundant points so as to speed up alignment, iii) addition + of descriptive information to the points such as a surface normal vector, or the direction from the point to the sensor. Corresponds to `referenceDataPointsFilters` configuration module of \ref thirdpartylibpointmatcher library. The filters should be chosen and set from possible components of - the `referenceDataPointsFilters` configuration module. + the `referenceDataPointsFilters` configuration module. See libpointmatcher documentation for possible configurations. @@ -87,19 +87,19 @@ namespace pointmatcher { \cgalParamEnd \cgalParamBegin{matcher} is a model of `ICP_config`. - The method used for matching (linking) the points from `point_set_2`, to the + The method used for matching (linking) the points from `point_set_2`, to the points in the reference cloud, `point_set_1`. - + Corresponds to `matcher` configuration module of \ref thirdpartylibpointmatcher library. The matcher should be chosen and set from possible components of - the `matcher` configuration module. + the `matcher` configuration module. See libpointmatcher documentation for possible configurations. If this parameter is omitted, `KDTreeMatcher` is used. \cgalParamEnd - \cgalParamBegin{outlier_filters} is a model of `Range`. The value type of + \cgalParamBegin{outlier_filters} is a model of `Range`. The value type of its iterator is `ICP_config`. The chain of filters to be applied to the matched (linked) point clouds after each processing iteration of the ICP algorithm to remove the links which do not @@ -110,7 +110,7 @@ namespace pointmatcher { Corresponds to `outlierFilters` configuration module of \ref thirdpartylibpointmatcher library. The filters should be chosen and set from possible components of - the `outlierFilters` configuration module. + the `outlierFilters` configuration module. See libpointmatcher documentation for possible configurations. @@ -123,38 +123,38 @@ namespace pointmatcher { Corresponds to `errorMinimizer` configuration module of \ref thirdpartylibpointmatcher library. The error minimizer should be chosen and set from possible components of - the `errorMinimizer` configuration module. + the `errorMinimizer` configuration module. See libpointmatcher documentation for possible configurations. If this parameter is omitted, `PointToPlaneErrorMinimizer` is used. \cgalParamEnd - \cgalParamBegin{transformation_checkers} is a model of `Range`. The value type of + \cgalParamBegin{transformation_checkers} is a model of `Range`. The value type of its iterator is `ICP_config`. The chain of transformation checkers. A transformation checker can stop the iteration depending on the conditions it defines. - + The chain is organized with the forward traversal order of the transformation checkers range. Corresponds to `transformationCheckers` configuration module of \ref thirdpartylibpointmatcher library. The transformation checkers should be chosen and set from possible components of - the `transformationCheckers` configuration module. + the `transformationCheckers` configuration module. See libpointmatcher documentation for possible configurations. If this parameter is omitted, the chain of `CounterTransformationChecker` and `DifferentialTransformationChecker` is used. \cgalParamEnd - + \cgalParamBegin{inspector} is a model of `ICP_config`. The inspector allows to log data at different steps for analysis. Inspectors typically provide deeper scrutiny than the logger. Corresponds to `inspector` configuration module of \ref thirdpartylibpointmatcher library. The inspector should be chosen and set from possible components of - the `inspector` configuration module. + the `inspector` configuration module. See libpointmatcher documentation for possible configurations. @@ -168,7 +168,7 @@ namespace pointmatcher { Corresponds to `logger` configuration module of \ref thirdpartylibpointmatcher library. The logger should be chosen and set from possible components of - the `logger` configuration module. + the `logger` configuration module. See libpointmatcher documentation for possible configurations. @@ -189,33 +189,33 @@ namespace pointmatcher { type is the value type of the iterator of `PointRange2` and whose value type `geom_traits::Vector_3`.\cgalParamEnd - \cgalParamBegin{point_set_filters} is a model of `Range`. The value type of + \cgalParamBegin{point_set_filters} is a model of `Range`. The value type of its iterator is `ICP_config`. The chain of filters to be applied to the point cloud, `point_set_2`. The point cloud is processed into an intermediate point cloud with the given chain of filters to be used in the alignment procedure. The chain is organized with the forward traversal order of the point set filters range. - + The chain of point set filters are applied only once at the beginning of the ICP procedure, i.e., before the first iteration of ICP algorithm. - + The filters can have several purposes, including but are not limited to i) removal of noisy points which render alignment of point clouds difficult, - ii) removal of redundant points so as to speed up alignment, iii) addition - of descriptive information to the points such as a surface normal vector, + ii) removal of redundant points so as to speed up alignment, iii) addition + of descriptive information to the points such as a surface normal vector, or the direction from the point to the sensor. Corresponds to `readingDataPointsFilters` configuration module of \ref thirdpartylibpointmatcher library. The filters should be chosen and set from possible components of - the `readingDataPointsFilters` configuration module. + the `readingDataPointsFilters` configuration module. See libpointmatcher documentation for possible configurations. If this parameter is omitted, `SamplingSurfaceNormalDataPointsFilter` is used. \cgalParamEnd - \cgalParamBegin{transformation} The affine transformation that is used as the + \cgalParamBegin{transformation} The affine transformation that is used as the initial transformation for `point_set_2`. If this parameter is omitted, identity transformation is used. @@ -223,7 +223,7 @@ namespace pointmatcher { \cgalNamedParamsEnd \return `true` if registration is converged, `false` otherwise. A log why it - failed to converge is written to `std::cerr` if the registration cannot converge. + failed to converge is written to `std::cerr` if the registration cannot converge. */ template @@ -241,7 +241,7 @@ register_point_sets (const PointRange1& point_set_1, PointRange2& point_set_2, std::pair res = compute_registration_transformation(point_set_1, point_set_2, np1, np2); - // property map type of point_set_2 + // property map type of point_set_2 typedef typename CGAL::GetPointMap::type PointMap2; PointMap2 point_map2 = choose_parameter(get_parameter(np2, internal_np::point_map), PointMap2()); diff --git a/Point_set_processing_3/include/CGAL/remove_outliers.h b/Point_set_processing_3/include/CGAL/remove_outliers.h index 55b7e4011ce..008ef8f5c0d 100644 --- a/Point_set_processing_3/include/CGAL/remove_outliers.h +++ b/Point_set_processing_3/include/CGAL/remove_outliers.h @@ -146,7 +146,7 @@ remove_outliers( { using parameters::choose_parameter; using parameters::get_parameter; - + // geometric types typedef typename CGAL::GetPointMap::type PointMap; typedef typename Point_set_processing_3::GetK::Kernel Kernel; @@ -158,9 +158,9 @@ remove_outliers( double threshold_distance = choose_parameter(get_parameter(np, internal_np::threshold_distance), 0.); const std::function& callback = choose_parameter(get_parameter(np, internal_np::callback), std::function()); - + typedef typename Kernel::FT FT; - + // basic geometric types typedef typename Kernel::Point_3 Point; @@ -186,7 +186,7 @@ remove_outliers( // Instanciate a KD-tree search. // Note: We have to convert each input iterator to Point_3. - std::vector kd_tree_points; + std::vector kd_tree_points; for(it = points.begin(); it != points.end(); it++) kd_tree_points.push_back( get(point_map, *it) ); Tree tree(kd_tree_points.begin(), kd_tree_points.end()); diff --git a/Point_set_processing_3/include/CGAL/structure_point_set.h b/Point_set_processing_3/include/CGAL/structure_point_set.h index 10f4ec1f446..c9f882617df 100644 --- a/Point_set_processing_3/include/CGAL/structure_point_set.h +++ b/Point_set_processing_3/include/CGAL/structure_point_set.h @@ -92,7 +92,7 @@ public: CREASE = 2, ///< Structure coherent, facet adjacent to an edge PLANAR = 3 ///< Structure coherent, facet inside a planar section }; - + private: class My_point_property_map{ @@ -101,10 +101,10 @@ private: typedef Point value_type; typedef const value_type& reference; typedef std::size_t key_type; - typedef boost::lvalue_property_map_tag category; + typedef boost::lvalue_property_map_tag category; My_point_property_map (const std::vector& pts) : points (pts) {} reference operator[] (key_type k) const { return points[k]; } - friend inline reference get (const My_point_property_map& ppmap, key_type i) + friend inline reference get (const My_point_property_map& ppmap, key_type i) { return ppmap[i]; } }; @@ -137,18 +137,18 @@ private: active = true; } }; - + std::vector m_points; std::vector m_normals; std::vector m_indices; std::vector m_status; - + std::vector m_planes; std::vector > m_indices_of_assigned_points; std::vector m_edges; std::vector m_corners; - + public: @@ -223,7 +223,7 @@ public: PlaneMap plane_map = choose_parameter(get_parameter(np, internal_np::plane_map)); PlaneIndexMap index_map = choose_parameter(get_parameter(np, internal_np::plane_index_map)); double attraction_factor = choose_parameter(get_parameter(np, internal_np::attraction_factor), 3.); - + m_points.reserve(points.size()); m_normals.reserve(points.size()); m_indices_of_assigned_points.resize (planes.size()); @@ -305,7 +305,7 @@ public: m_status[f[1]] == POINT && m_status[f[2]] == POINT) return FREEFORM; - + // 1- PLANAR CASE if (m_status[f[0]] == PLANE && m_status[f[1]] == PLANE && @@ -337,7 +337,7 @@ public: else return INCOHERENT; } - + // 2- CREASE CASES if (sa == EDGE && sb == EDGE && sc == PLANE) { @@ -373,7 +373,7 @@ public: m_edges[a].planes[1] != m_edges[b].planes[0] && m_edges[a].planes[1] != m_edges[b].planes[1])) return INCOHERENT; - + for (std::size_t j = 0; j < m_corners[c].planes.size (); ++ j) { if (m_corners[c].planes[j] == m_edges[a].planes[0]) @@ -398,7 +398,7 @@ public: for (std::size_t j = 0; j < m_corners[c].planes.size (); ++ j) if (m_corners[c].planes[j] == a) return VERTEX; - + return INCOHERENT; } else if (sa == PLANE && sb == EDGE) @@ -406,7 +406,7 @@ public: bool pa = false, b0 = false, b1 = false; if (a != m_edges[b].planes[0] && a != m_edges[b].planes[1]) return INCOHERENT; - + for (std::size_t j = 0; j < m_corners[c].planes.size (); ++ j) { if (m_corners[c].planes[j] == a) @@ -426,7 +426,7 @@ public: bool a0 = false, a1 = false, pb = false; if (b != m_edges[a].planes[0] && b != m_edges[a].planes[1]) return INCOHERENT; - + for (std::size_t j = 0; j < m_corners[c].planes.size (); ++ j) { if (m_corners[c].planes[j] == b) @@ -451,7 +451,7 @@ public: } - /// \cond SKIP_IN_MANUAL + /// \cond SKIP_IN_MANUAL private: @@ -461,7 +461,7 @@ private: std::vector normals; std::vector indices; std::vector status; - + for (std::size_t i = 0; i < m_points.size (); ++ i) if (m_status[i] != SKIPPED) { @@ -472,7 +472,7 @@ private: status.back () = PLANE; indices.push_back (m_indices[i]); } - + m_points.swap (points); m_normals.swap (normals); m_indices.swap (indices); @@ -484,28 +484,28 @@ private: { if (m_planes.empty ()) return; - + double radius = epsilon * attraction_factor; #ifdef CGAL_PSP3_VERBOSE std::cerr << "Computing planar points... " << std::endl; #endif - + project_inliers (); resample_planes (epsilon); - + #ifdef CGAL_PSP3_VERBOSE std::cerr << " -> Done" << std::endl; std::cerr << "Finding adjacent primitives... " << std::endl; #endif - + find_pairs_of_adjacent_primitives (radius); #ifdef CGAL_PSP3_VERBOSE std::cerr << " -> Found " << m_edges.size () << " pair(s) of adjacent primitives." << std::endl; std::cerr << "Computing edges... " << std::endl; #endif - + compute_edges (epsilon); #ifdef CGAL_PSP3_VERBOSE @@ -523,7 +523,7 @@ private: std::cerr << "Computating first set of corners... " << std::endl; #endif - + compute_corners (radius); #ifdef CGAL_PSP3_VERBOSE @@ -532,7 +532,7 @@ private: { std::size_t size_before = m_points.size (); #endif - + merge_corners (radius); #ifdef CGAL_PSP3_VERBOSE @@ -541,14 +541,14 @@ private: std::cerr << "Computing corner directions... " << std::endl; #endif - + compute_corner_directions (epsilon); #ifdef CGAL_PSP3_VERBOSE std::cerr << " -> Done" << std::endl; std::cerr << "Refining sampling... " << std::endl; #endif - + refine_sampling (epsilon); #ifdef CGAL_PSP3_VERBOSE @@ -556,7 +556,7 @@ private: std::cerr << "Cleaning data set... " << std::endl; #endif - + clean (); #ifdef CGAL_PSP3_VERBOSE @@ -585,7 +585,7 @@ private: Vector vortho = plane.orthogonal_vector(); Vector b1 = plane.base1(); Vector b2 = plane.base2(); - + b1 = b1 / std::sqrt (b1 * b1); b2 = b2 / std::sqrt (b2 * b2); @@ -605,7 +605,7 @@ private: CGAL::Bbox_2 box_2d = CGAL::bbox_2 (points_2d.begin(), points_2d.end()); std::size_t Nx = static_cast((box_2d.xmax() - box_2d.xmin()) / grid_length) + 1; std::size_t Ny = static_cast((box_2d.ymax() - box_2d.ymin()) / grid_length) + 1; - + std::vector > Mask (Nx, std::vector (Ny, false)); std::vector > Mask_border (Nx, std::vector (Ny, false)); std::vector > > @@ -627,8 +627,8 @@ private: && Mask[i-1][j] && Mask[i][j-1] && Mask[i][j+1] && Mask[i+1][j] ) Mask[i][j]=true; - - //finding mask border in 8-connexity + + //finding mask border in 8-connexity for (std::size_t j = 1; j < Ny - 1; ++ j) for (std::size_t i = 1; i < Nx - 1; ++ i) if( Mask[i][j] && @@ -637,7 +637,7 @@ private: !Mask[i][j+1] || !Mask[i+1][j-1] || !Mask[i+1][j]|| !Mask[i+1][j+1] ) ) Mask_border[i][j]=true; - + for (std::size_t j = 0; j < Ny; ++ j) { if (Mask[0][j]) @@ -659,12 +659,12 @@ private: for (std::size_t i = 0; i < Nx; ++ i) if( point_map[i][j].size()>0) { - //inside: recenter (cell center) the first point of the cell and desactivate the others points + //inside: recenter (cell center) the first point of the cell and desactivate the others points if (!Mask_border[i][j] && Mask[i][j]) { double x2pt = (i+0.5) * grid_length + box_2d.xmin(); double y2pt = (j+0.4) * grid_length + box_2d.ymin(); - + if (i%2 == 1) { x2pt = (i+0.5) * grid_length + box_2d.xmin(); @@ -748,11 +748,11 @@ private: continue; Fuzzy_sphere query (i, radius, 0., tree.traits()); - + std::vector neighbors; tree.search (std::back_inserter (neighbors), query); - + for (std::size_t k = 0; k < neighbors.size(); ++ k) { std::size_t ind_k = m_indices[neighbors[k]]; @@ -775,7 +775,7 @@ private: for (std::size_t i = 0; i < m_edges.size(); ++ i) { const Plane& plane1 = m_planes[m_edges[i].planes[0]]; - const Plane& plane2 = m_planes[m_edges[i].planes[1]]; + const Plane& plane2 = m_planes[m_edges[i].planes[1]]; double angle_A = std::acos (CGAL::abs (plane1.orthogonal_vector() * plane2.orthogonal_vector())); double angle_B = CGAL_PI - angle_A; @@ -800,12 +800,12 @@ private: #endif continue; } - + Vector direction_p1 (0., 0., 0.); for (std::size_t k = 0; k < m_indices_of_assigned_points[m_edges[i].planes[0]].size(); ++ k) { std::size_t index_point = m_indices_of_assigned_points[m_edges[i].planes[0]][k]; - + const Point& point = m_points[index_point]; Point projected = m_edges[i].support.projection (point); if (std::sqrt (CGAL::squared_distance (point, projected)) @@ -820,7 +820,7 @@ private: for (std::size_t k = 0; k < m_indices_of_assigned_points[m_edges[i].planes[1]].size(); ++ k) { std::size_t index_point = m_indices_of_assigned_points[m_edges[i].planes[1]][k]; - + const Point& point = m_points[index_point]; Point projected = m_edges[i].support.projection (point); if (std::sqrt (CGAL::squared_distance (point, projected)) @@ -832,7 +832,7 @@ private: direction_p2 = direction_p2 / std::sqrt (direction_p2 * direction_p2); double angle = std::acos (direction_p1 * direction_p2); - + if (direction_p1.squared_length() == 0 || direction_p2.squared_length() == 0 || (CGAL::abs (angle - angle_A) > 1e-2 @@ -847,7 +847,7 @@ private: { double d_DeltaEdge = std::sqrt (2.) * epsilon; double r_edge = d_DeltaEdge / 2.; - + for (std::size_t i = 0; i < m_edges.size(); ++ i) { const Plane& plane1 = m_planes[m_edges[i].planes[0]]; @@ -861,7 +861,7 @@ private: } Vector normal = 0.5 * plane1.orthogonal_vector () + 0.5 * plane2.orthogonal_vector(); - + //find set of points close ( intersection_points; for (std::size_t k = 0; k < m_indices_of_assigned_points[m_edges[i].planes[0]].size(); ++ k) @@ -893,7 +893,7 @@ private: Point Pmin = t0p; Point Pmax = t0p; Vector dir = line.to_vector (); - + //compute the segment of the edge for (std::size_t k = 0; k < intersection_points.size(); ++ k) { @@ -901,7 +901,7 @@ private: const Point& point = m_points[ind]; Point projected = line.projection (point); double d = Vector (t0p, projected) * dir; - + if (d < dmin) { dmin = d; @@ -966,7 +966,7 @@ private: if (CGAL::squared_distance (line, m_points[inde]) < d_DeltaEdge * d_DeltaEdge) m_status[inde] = SKIPPED; // Deactive points too close (except best, see below) - + double distance = CGAL::squared_distance (perfect, m_points[inde]); if (distance < dist_min) { @@ -994,13 +994,13 @@ private: Point anchor (seg[0].x() + (seg[1].x() - seg[0].x()) * (j + 1) / double(number_of_division), seg[0].y() + (seg[1].y() - seg[0].y()) * (j + 1) / double(number_of_division), seg[0].z() + (seg[1].z() - seg[0].z()) * (j + 1) / double(number_of_division)); - - Plane ortho = seg.supporting_line().perpendicular_plane(anchor); + + Plane ortho = seg.supporting_line().perpendicular_plane(anchor); std::vector pts1, pts2; //Computation of the permanent angle and directions for (std::size_t k = 0; k < division_tab[j].size(); ++ k) - { + { std::size_t inde = division_tab[j][k]; std::size_t plane = m_indices[inde]; if (plane == m_edges[i].planes[0]) @@ -1046,7 +1046,7 @@ private: #endif } - + result = CGAL::intersection (plane2,ortho); if (result) { @@ -1083,7 +1083,7 @@ private: #endif } } - + //if not information enough (not enough edges to create //anchor) we unactivate the edge, else we update the angle //and directions @@ -1115,7 +1115,7 @@ private: { if (plane_edge_adj[i].size () < 2) continue; - + for (std::size_t j = 0; j < plane_edge_adj[i].size ()- 1; ++ j) for (std::size_t k = j + 1; k < plane_edge_adj[i].size (); ++ k) { @@ -1131,7 +1131,7 @@ private: std::set::iterator end = edge_adj[i].end(); end --; - + for (std::set::iterator jit = edge_adj[i].begin (); jit != end; ++ jit) { @@ -1147,7 +1147,7 @@ private: std::size_t k = *kit; if (k < j) continue; - + std::set planes; planes.insert (m_edges[i].planes[0]); planes.insert (m_edges[i].planes[1]); @@ -1176,7 +1176,7 @@ private: typename cpp11::result_of::type result = CGAL::intersection(plane1, plane2); - + if (result) { if (const Line* l = boost::get(&*result)) @@ -1227,17 +1227,17 @@ private: // test if point is in bbox + delta CGAL::Bbox_3 bbox = CGAL::bbox_3 (m_points.begin (), m_points.end ()); - + double margin_x = 0.1 * (bbox.xmax() - bbox.xmin()); double X_min = bbox.xmin() - margin_x; - double X_max = bbox.xmax() + margin_x; + double X_max = bbox.xmax() + margin_x; double margin_y = 0.1 * (bbox.ymax() - bbox.ymin()); double Y_min = bbox.ymin() - margin_y; - double Y_max = bbox.ymax() + margin_y; + double Y_max = bbox.ymax() + margin_y; double margin_z = 0.1* (bbox.zmax() - bbox.zmin()); double Z_min = bbox.zmin() - margin_z; double Z_max = bbox.zmax() + margin_z; - + if ((m_corners[i].support.x() < X_min) || (m_corners[i].support.x() > X_max) || (m_corners[i].support.y() < Y_min) || (m_corners[i].support.y() > Y_max) || (m_corners[i].support.z() < Z_min) || (m_corners[i].support.z() > Z_max)) @@ -1276,7 +1276,7 @@ private: continue; int count_plane_number=3; - + for (std::size_t kb = k + 1; kb < m_corners.size(); ++ kb) { if (!(m_corners[kb].active)) @@ -1289,7 +1289,7 @@ private: for (std::size_t i = 0; i < m_corners[kb].planes.size (); ++ i) { - bool testtt = true; + bool testtt = true; for (std::size_t l = 0; l < m_corners[k].planes.size(); ++ l) if (m_corners[kb].planes[i] == m_corners[k].planes[l]) { @@ -1315,7 +1315,7 @@ private: m_corners[k].edges.push_back (m_corners[kb].edges[j]); } - + //update barycenter m_corners[k].support = CGAL::barycenter (m_corners[k].support, count_plane_number, m_corners[kb].support, count_new_plane); @@ -1327,7 +1327,7 @@ private: for (std::size_t i = 0; i < m_corners[k].planes.size(); ++ i) normal = normal + (1. / (double)(m_corners[k].planes.size())) * m_planes[m_corners[k].planes[i]].orthogonal_vector(); - + m_points.push_back (m_corners[k].support); m_normals.push_back (normal); m_indices.push_back (k); @@ -1342,7 +1342,7 @@ private: for (std::size_t ed = 0; ed < m_corners[k].edges.size(); ++ ed) { if (m_corners[k].edges[ed] < m_edges.size()) - { + { const Edge& edge = m_edges[m_corners[k].edges[ed]]; Vector direction (0., 0., 0.); @@ -1364,7 +1364,7 @@ private: } } } - + void refine_sampling (double epsilon) { double d_DeltaEdge = std::sqrt (2.) * epsilon; @@ -1373,7 +1373,7 @@ private: { if (!(m_corners[k].active)) continue; - + for (std::size_t ed = 0; ed < m_corners[k].edges.size(); ++ ed) { const Edge& edge = m_edges[m_corners[k].edges[ed]]; @@ -1384,7 +1384,7 @@ private: if (CGAL::squared_distance (m_corners[k].support, m_points[edge.indices[i]]) < d_DeltaEdge * d_DeltaEdge) m_status[edge.indices[i]] = SKIPPED; - + //if too close from a corner (non dominant side), ->remove if (m_corners[k].directions[ed].squared_length() > 0 && (m_corners[k].directions[ed] @@ -1393,7 +1393,7 @@ private: < 4 * d_DeltaEdge * d_DeltaEdge)) m_status[edge.indices[i]] = SKIPPED; } - + } } @@ -1401,12 +1401,12 @@ private: { if (!(m_corners[k].active)) continue; - + for (std::size_t ed = 0; ed < m_corners[k].edges.size(); ++ ed) { if (m_corners[k].directions[ed].squared_length() <= 0.) continue; - + Edge& edge = m_edges[m_corners[k].edges[ed]]; //rajouter un edge a epsilon du cote dominant si pas de point entre SS_edge/2 et 3/2*SS_edge @@ -1440,7 +1440,7 @@ private: m_indices.push_back (m_corners[k].edges[ed]); edge.indices.push_back (m_points.size() - 1); } - + //rajouter un edge a 1/3 epsilon du cote dominant Point new_edge = m_corners[k].support + m_corners[k].directions[ed] * d_DeltaEdge / 3; m_points.push_back (new_edge); @@ -1453,18 +1453,18 @@ private: } } - /// \endcond + /// \endcond }; - + // ---------------------------------------------------------------------------- // Public section // ---------------------------------------------------------------------------- -/** +/** \ingroup PkgPointSetProcessing3Algorithms This is an implementation of the Point Set Structuring algorithm. This diff --git a/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h b/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h index 5c243828181..2c2e083793f 100644 --- a/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h @@ -265,7 +265,7 @@ compute_vcm (const PointRange& points, PointMap point_map = choose_parameter(get_parameter(np, internal_np::point_map)); Kernel kernel; - + // First, compute the VCM for each point std::vector< std::array > cov; std::size_t N = 20; @@ -303,7 +303,7 @@ compute_vcm (const PointRange& points, } /// \endcond - + /// \cond SKIP_IN_MANUAL template (get_parameter(np, internal_np::point_map)); NormalMap normal_map = choose_parameter(get_parameter(np, internal_np::normal_map)); - + typedef std::array Covariance; - + // Compute the VCM and convolve it std::vector cov; if (nb_neighbors_convolve == -1) { @@ -383,7 +383,7 @@ vcm_estimate_normals_internal (PointRange& points, /// @endcond -/** +/** \ingroup PkgPointSetProcessing3Algorithms Estimates normal directions of the range of `points` using the Voronoi Covariance Measure with a radius for the convolution. diff --git a/Point_set_processing_3/include/CGAL/wlop_simplify_and_regularize_point_set.h b/Point_set_processing_3/include/CGAL/wlop_simplify_and_regularize_point_set.h index 4a05708e00e..e7743317485 100644 --- a/Point_set_processing_3/include/CGAL/wlop_simplify_and_regularize_point_set.h +++ b/Point_set_processing_3/include/CGAL/wlop_simplify_and_regularize_point_set.h @@ -7,7 +7,7 @@ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // -// Author(s) : Shihao Wu, Clement Jamin, Pierre Alliez +// Author(s) : Shihao Wu, Clement Jamin, Pierre Alliez #ifndef CGAL_wlop_simplify_and_regularize_point_set_H #define CGAL_wlop_simplify_and_regularize_point_set_H @@ -36,7 +36,7 @@ #include #include #include -#include +#include #endif // CGAL_LINKED_WITH_TBB #include @@ -87,9 +87,9 @@ public: typedef typename Kernel::Point_3 PointType; }; -/// Compute average and repulsion term, then +/// Compute average and repulsion term, then /// compute and update sample point locations -/// +/// /// \pre `radius > 0` /// /// @tparam Kernel Geometric traits class. @@ -105,8 +105,8 @@ compute_update_sample_point( const Tree& original_kd_tree, ///< original Kd-tree const Tree& sample_kd_tree, ///< sample Kd-tree const typename Kernel::FT radius, ///< neighborhood radius square - const std::vector& original_densities, ///< - const std::vector& sample_densities ///< + const std::vector& original_densities, ///< + const std::vector& sample_densities ///< ) { CGAL_point_set_processing_precondition(radius > 0); @@ -130,7 +130,7 @@ compute_update_sample_point( //Compute average term FT radius2 = radius * radius; - Vector average = CGAL::NULL_VECTOR; + Vector average = CGAL::NULL_VECTOR; FT weight = (FT)0.0, average_weight_sum = (FT)0.0; FT iradius16 = -(FT)4.0 / radius2; @@ -162,10 +162,10 @@ compute_update_sample_point( } else { - average = average / average_weight_sum; + average = average / average_weight_sum; } neighbor_original_points.clear(); - + //Compute repulsion term @@ -175,7 +175,7 @@ compute_update_sample_point( weight = (FT)0.0; FT repulsion_weight_sum = (FT)0.0; - Vector repulsion = CGAL::NULL_VECTOR; + Vector repulsion = CGAL::NULL_VECTOR; iter = neighbor_sample_points.begin(); for(; iter != neighbor_sample_points.end(); ++iter) @@ -188,9 +188,9 @@ compute_update_sample_point( FT dist2 = CGAL::squared_distance(query, np); if (dist2 < 1e-10) continue; FT dist = std::sqrt(dist2); - + weight = std::exp(dist2 * iradius16) * std::pow(FT(1.0) / dist, 2); // L1 - + if (!is_sample_densities_empty) { weight *= sample_densities[sample_index]; @@ -208,7 +208,7 @@ compute_update_sample_point( } else { - repulsion = repulsion / repulsion_weight_sum; + repulsion = repulsion / repulsion_weight_sum; } neighbor_sample_points.clear(); @@ -220,7 +220,7 @@ compute_update_sample_point( /// Compute density weight for each original points, /// according to their neighbor original points -/// +/// /// \pre `k >= 2`, radius > 0 /// /// @tparam Kernel Geometric traits class. @@ -240,7 +240,7 @@ compute_density_weight_for_original_point( // basic geometric types typedef typename Kernel::Point_3 Point; typedef typename Kernel::FT FT; - + //types for range search typedef simplify_and_regularize_internal::Kd_tree_element Kd_tree_point; typedef simplify_and_regularize_internal::Kd_tree_traits Traits; @@ -266,7 +266,7 @@ compute_density_weight_for_original_point( FT dist2 = CGAL::squared_distance(query, np); if (dist2 < 1e-8) continue; - + density_weight += std::exp(dist2 * iradius16); } @@ -277,7 +277,7 @@ compute_density_weight_for_original_point( /// Compute density weight for sample point, /// according to their neighbor sample points -/// +/// /// \pre `k >= 2`, radius > 0 /// /// @tparam Kernel Geometric traits class. @@ -321,7 +321,7 @@ compute_density_weight_for_sample_point( FT dist2 = CGAL::squared_distance(query, np); density_weight += std::exp(dist2 * iradius16); } - + return density_weight; } @@ -333,18 +333,18 @@ compute_density_weight_for_sample_point( /// \cond SKIP_IN_MANUAL /// This is for parallelization of function: compute_denoise_projection() template -class Sample_point_updater +class Sample_point_updater { typedef typename Kernel::Point_3 Point; typedef typename Kernel::FT FT; std::vector &update_sample_points; std::vector &sample_points; - const Tree &original_kd_tree; - const Tree &sample_kd_tree; - const typename Kernel::FT radius; + const Tree &original_kd_tree; + const Tree &sample_kd_tree; + const typename Kernel::FT radius; const std::vector &original_densities; - const std::vector &sample_densities; + const std::vector &sample_densities; cpp11::atomic& advancement; cpp11::atomic& interrupted; @@ -352,14 +352,14 @@ public: Sample_point_updater( std::vector &out, std::vector &in, - const Tree &_original_kd_tree, - const Tree &_sample_kd_tree, + const Tree &_original_kd_tree, + const Tree &_sample_kd_tree, const typename Kernel::FT _radius, const std::vector &_original_densities, const std::vector &_sample_densities, cpp11::atomic& advancement, cpp11::atomic& interrupted): - update_sample_points(out), + update_sample_points(out), sample_points(in), original_kd_tree(_original_kd_tree), sample_kd_tree(_sample_kd_tree), @@ -367,27 +367,27 @@ public: original_densities(_original_densities), sample_densities(_sample_densities), advancement (advancement), - interrupted (interrupted) {} + interrupted (interrupted) {} - void operator() ( const tbb::blocked_range& r ) const - { - for (size_t i = r.begin(); i != r.end(); ++i) + void operator() ( const tbb::blocked_range& r ) const + { + for (size_t i = r.begin(); i != r.end(); ++i) { if (interrupted) break; update_sample_points[i] = simplify_and_regularize_internal:: compute_update_sample_point( - sample_points[i], + sample_points[i], original_kd_tree, sample_kd_tree, - radius, + radius, original_densities, sample_densities); ++ advancement; } } }; -/// \endcond +/// \endcond #endif // CGAL_LINKED_WITH_TBB @@ -398,24 +398,24 @@ public: /** \ingroup PkgPointSetProcessing3Algorithms This is an implementation of the Weighted Locally Optimal Projection (WLOP) simplification algorithm. - The WLOP simplification algorithm can produce a set of - denoised, outlier-free and evenly distributed particles over the original - dense point cloud. + The WLOP simplification algorithm can produce a set of + denoised, outlier-free and evenly distributed particles over the original + dense point cloud. The core of the algorithm is a Weighted Locally Optimal Projection operator - with a density uniformization term. + with a density uniformization term. For more details, please refer to \cgalCite{wlop-2009}. - A parallel version of WLOP is provided and requires the executable to be + A parallel version of WLOP is provided and requires the executable to be linked against the Intel TBB library. To control the number of threads used, the user may use the tbb::task_scheduler_init class. - See the TBB documentation + See the TBB documentation for more details. \tparam ConcurrencyTag enables sequential versus parallel algorithm. Possible values are `Sequential_tag`, `Parallel_tag`, and `Parallel_if_available_tag`. \tparam PointRange is a model of `Range`. The value type of its iterator is the key type of the named parameter `point_map`. - \tparam OutputIterator Type of the output iterator. + \tparam OutputIterator Type of the output iterator. It must accept objects of type `geom_traits::Point_3`. \param points input point range. @@ -427,11 +427,11 @@ public: If this parameter is omitted, `CGAL::Identity_property_map` is used.\cgalParamEnd \cgalParamBegin{normal_map} a model of `ReadWritePropertyMap` with value type `geom_traits::Vector_3`.\cgalParamEnd - \cgalParamBegin{select_percentage} percentage of points to retain. The default value is set to + \cgalParamBegin{select_percentage} percentage of points to retain. The default value is set to 5 (\%).\cgalParamEnd \cgalParamBegin{neighbor_radius} spherical neighborhood radius. This is a key parameter that needs to be - finely tuned. The result will be irregular if too small, but a larger value will impact the runtime. In - practice, choosing a radius such that the neighborhood of each sample point includes at least two rings + finely tuned. The result will be irregular if too small, but a larger value will impact the runtime. In + practice, choosing a radius such that the neighborhood of each sample point includes at least two rings of neighboring sample points gives satisfactory result. If this parameter is not provided, it is automatically set to 8 times the average spacing of the point set.\cgalParamEnd \cgalParamBegin{number_of_iterations} number of iterations to solve the optimsation problem. The default @@ -462,7 +462,7 @@ wlop_simplify_and_regularize_point_set( { using parameters::choose_parameter; using parameters::get_parameter; - + // basic geometric types typedef typename CGAL::GetPointMap::type PointMap; typedef typename Point_set_processing_3::GetK::Kernel Kernel; @@ -488,15 +488,15 @@ wlop_simplify_and_regularize_point_set( // to fix: should have at least three distinct points // but this is costly to check CGAL_point_set_processing_precondition(points.begin() != points.end()); - CGAL_point_set_processing_precondition(select_percentage >= 0 + CGAL_point_set_processing_precondition(select_percentage >= 0 && select_percentage <= 100); // Random shuffle CGAL::cpp98::random_shuffle (points.begin(), points.end()); - // Computes original(input) and sample points size + // Computes original(input) and sample points size std::size_t number_of_original = std::distance(points.begin(), points.end()); - std::size_t number_of_sample = (std::size_t)(FT(number_of_original) * + std::size_t number_of_sample = (std::size_t)(FT(number_of_original) * (select_percentage / FT(100.0))); std::size_t first_index_to_sample = number_of_original - number_of_sample; @@ -509,13 +509,13 @@ wlop_simplify_and_regularize_point_set( //Copy sample points std::vector sample_points; sample_points.reserve(number_of_sample); - unsigned int i; + unsigned int i; for(it = first_sample_iter; it != points.end(); ++it) { sample_points.push_back(get(point_map, *it)); } - + //compute default neighbor_radius, if no radius in if (radius < 0) { @@ -536,13 +536,13 @@ wlop_simplify_and_regularize_point_set( std::vector original_treeElements; for (it = first_original_iter, i=0 ; it != points.end() ; ++it, ++i) original_treeElements.push_back( Kd_tree_element(get(point_map, *it), i) ); - Kd_Tree original_kd_tree(original_treeElements.begin(), + Kd_Tree original_kd_tree(original_treeElements.begin(), original_treeElements.end()); std::vector update_sample_points(number_of_sample); typename std::vector::iterator sample_iter; - + // Compute original density weight for original points if user needed std::vector original_density_weights; @@ -555,7 +555,7 @@ wlop_simplify_and_regularize_point_set( compute_density_weight_for_original_point ( get(point_map, *it), - original_kd_tree, + original_kd_tree, radius); original_density_weights.push_back(density); @@ -581,29 +581,29 @@ wlop_simplify_and_regularize_point_set( { FT density = simplify_and_regularize_internal:: compute_density_weight_for_sample_point - (*sample_iter, - sample_kd_tree, + (*sample_iter, + sample_kd_tree, radius); sample_density_weights.push_back(density); } - + typename std::vector::iterator update_iter = update_sample_points.begin(); #ifndef CGAL_LINKED_WITH_TBB CGAL_static_assertion_msg (!(boost::is_convertible::value), - "Parallel_tag is enabled but TBB is unavailable."); + "Parallel_tag is enabled but TBB is unavailable."); #else //parallel if (boost::is_convertible::value) { Point_set_processing_3::internal::Parallel_callback parallel_callback (callback, iter_number * number_of_sample, iter_n * number_of_sample); - + tbb::blocked_range block(0, number_of_sample); Sample_point_updater sample_updater( update_sample_points, - sample_points, + sample_points, original_kd_tree, sample_kd_tree, radius2, @@ -615,10 +615,10 @@ wlop_simplify_and_regularize_point_set( tbb::parallel_for(block, sample_updater); bool interrupted = parallel_callback.interrupted(); - + // We interrupt by hand as counter only goes halfway and won't terminate by itself parallel_callback.interrupted() = true; - parallel_callback.join(); + parallel_callback.join(); // If interrupted during this step, nothing is computed, we return NaN if (interrupted) @@ -645,7 +645,7 @@ wlop_simplify_and_regularize_point_set( return output; } } - + sample_iter = sample_points.begin(); for (update_iter = update_sample_points.begin(); update_iter != update_sample_points.end(); @@ -656,7 +656,7 @@ wlop_simplify_and_regularize_point_set( } // final output - for(sample_iter = sample_points.begin(); + for(sample_iter = sample_points.begin(); sample_iter != sample_points.end(); ++sample_iter) { *output++ = *sample_iter; diff --git a/Point_set_processing_3/test/Point_set_processing_3/CMakeLists.txt b/Point_set_processing_3/test/Point_set_processing_3/CMakeLists.txt index 1b5e1a80746..f057bb7332b 100644 --- a/Point_set_processing_3/test/Point_set_processing_3/CMakeLists.txt +++ b/Point_set_processing_3/test/Point_set_processing_3/CMakeLists.txt @@ -44,19 +44,19 @@ if ( CGAL_FOUND ) # Executables that require Eigen create_single_source_cgal_program( "normal_estimation_test.cpp" ) CGAL_target_use_Eigen(normal_estimation_test) - + create_single_source_cgal_program( "hierarchy_simplification_test.cpp" ) CGAL_target_use_Eigen(hierarchy_simplification_test) - + create_single_source_cgal_program( "smoothing_test.cpp" ) CGAL_target_use_Eigen(smoothing_test) create_single_source_cgal_program( "vcm_plane_test.cpp" ) CGAL_target_use_Eigen(vcm_plane_test) - + create_single_source_cgal_program( "vcm_all_test.cpp" ) CGAL_target_use_Eigen(vcm_all_test) - + create_single_source_cgal_program( "jet_pointer_as_property_map.cpp" ) CGAL_target_use_Eigen(jet_pointer_as_property_map) else() diff --git a/Point_set_processing_3/test/Point_set_processing_3/edge_aware_upsample_test.cpp b/Point_set_processing_3/test/Point_set_processing_3/edge_aware_upsample_test.cpp index 613bf126a06..ba3cb19c2f1 100644 --- a/Point_set_processing_3/test/Point_set_processing_3/edge_aware_upsample_test.cpp +++ b/Point_set_processing_3/test/Point_set_processing_3/edge_aware_upsample_test.cpp @@ -42,7 +42,7 @@ typedef CGAL::Parallel_if_available_tag Concurrency_tag; // Tests // ---------------------------------------------------------------------------- -void test_edge_aware_upsample(std::vector& points, // input point set +void test_edge_aware_upsample(std::vector& points, // input point set double sharpness_sigma, //control sharpness double edge_sensitivity,// more points will up-sample on edge double neighbor_radius, // initial neighbors size. @@ -54,7 +54,7 @@ void test_edge_aware_upsample(std::vector& points, // input poi << sharpness_sigma << "%, number_of_output_points=" << points.size() * times_of_output_points << ")...\n"; - //Run algorithm + //Run algorithm CGAL::edge_aware_upsample_point_set( points, std::back_inserter(points), CGAL::parameters::point_map(CGAL::First_of_pair_property_map()). @@ -124,7 +124,7 @@ int main(int argc, char * argv[]) std::ifstream stream(input_filename.c_str()); if(stream && CGAL::read_xyz_points - (stream, + (stream, std::back_inserter(points), CGAL::parameters::point_map(CGAL::First_of_pair_property_map()). normal_map(CGAL::Second_of_pair_property_map()))) @@ -142,7 +142,7 @@ int main(int argc, char * argv[]) // Test //*************************************** - test_edge_aware_upsample(points, + test_edge_aware_upsample(points, sharpness_sigma, edge_sensitivity, neighbor_radius, diff --git a/Point_set_processing_3/test/Point_set_processing_3/normal_estimation_test.cpp b/Point_set_processing_3/test/Point_set_processing_3/normal_estimation_test.cpp index 36e0adf0320..3cb97d2c876 100644 --- a/Point_set_processing_3/test/Point_set_processing_3/normal_estimation_test.cpp +++ b/Point_set_processing_3/test/Point_set_processing_3/normal_estimation_test.cpp @@ -128,7 +128,7 @@ bool run_pca_estimate_normals(PointList& points, // input points + output normal CGAL::pca_estimate_normals (points, nb_neighbors_pca_normals, CGAL::parameters::normal_map(CGAL::make_normal_of_point_with_normal_map(PointList::value_type()))); - + std::size_t memory = CGAL::Memory_sizer().virtual_size(); std::cerr << "done: " << task_timer.time() << " seconds, " @@ -152,8 +152,8 @@ bool run_jet_estimate_normals(PointList& points, // input points + output normal CGAL::jet_estimate_normals (points, nb_neighbors_jet_fitting_normals, - CGAL::parameters::normal_map(CGAL::make_normal_of_point_with_normal_map(PointList::value_type()))); - + CGAL::parameters::normal_map(CGAL::make_normal_of_point_with_normal_map(PointList::value_type()))); + std::size_t memory = CGAL::Memory_sizer().virtual_size(); std::cerr << "done: " << task_timer.time() << " seconds, " @@ -239,10 +239,10 @@ bool run_mst_orient_normals(PointList& points, // input points + input/output no std::cerr << "Orients Normals with a Minimum Spanning Tree (k="<< nb_neighbors_mst << ")...\n"; CGAL::Timer task_timer; task_timer.start(); - PointList::iterator unoriented_points_begin = + PointList::iterator unoriented_points_begin = CGAL::mst_orient_normals(points, nb_neighbors_mst, CGAL::parameters::normal_map(CGAL::make_normal_of_point_with_normal_map(PointList::value_type()))); - + std::size_t memory = CGAL::Memory_sizer().virtual_size(); std::cerr << "done: " << task_timer.time() << " seconds, " @@ -310,7 +310,7 @@ int main(int argc, char * argv[]) if (extension == ".off" || extension == ".OFF") { std::ifstream stream(input_filename.c_str()); - success = stream && + success = stream && CGAL::read_off_points(stream, std::back_inserter(points), CGAL::parameters::normal_map @@ -322,7 +322,7 @@ int main(int argc, char * argv[]) extension == ".pwn" || extension == ".PWN") { std::ifstream stream(input_filename.c_str()); - success = stream && + success = stream && CGAL::read_xyz_points(stream, std::back_inserter(points), CGAL::parameters::normal_map @@ -355,7 +355,7 @@ int main(int argc, char * argv[]) // Copy original normals //*************************************** - std::vector original_normals; + std::vector original_normals; bool points_have_original_normals = (points.begin()->normal() != CGAL::NULL_VECTOR); if ( points_have_original_normals ) { diff --git a/Poisson_surface_reconstruction_3/examples/Poisson_surface_reconstruction_3/CMakeLists.txt b/Poisson_surface_reconstruction_3/examples/Poisson_surface_reconstruction_3/CMakeLists.txt index 0b65cf899cf..85259f8bd2f 100644 --- a/Poisson_surface_reconstruction_3/examples/Poisson_surface_reconstruction_3/CMakeLists.txt +++ b/Poisson_surface_reconstruction_3/examples/Poisson_surface_reconstruction_3/CMakeLists.txt @@ -35,7 +35,7 @@ if ( CGAL_FOUND ) message(STATUS "NOTICE: The examples need Eigen 3.1 (or greater) will not be compiled.") endif() - + else() message(STATUS "NOTICE: This program requires the CGAL library, and will not be compiled.") diff --git a/Poisson_surface_reconstruction_3/examples/Poisson_surface_reconstruction_3/poisson_reconstruction.cpp b/Poisson_surface_reconstruction_3/examples/Poisson_surface_reconstruction_3/poisson_reconstruction.cpp index 8dc1420e9cb..6a47df2c6d9 100644 --- a/Poisson_surface_reconstruction_3/examples/Poisson_surface_reconstruction_3/poisson_reconstruction.cpp +++ b/Poisson_surface_reconstruction_3/examples/Poisson_surface_reconstruction_3/poisson_reconstruction.cpp @@ -73,7 +73,7 @@ struct Counter { std::cerr << "Counter reached " << N << std::endl; } } - + }; struct InsertVisitor { @@ -115,7 +115,7 @@ int main(int argc, char * argv[]) std::cerr << "Options:\n"; std::cerr << " -sm_radius Radius upper bound (default=100 * average spacing)\n"; std::cerr << " -sm_distance Distance upper bound (default=0.25 * average spacing)\n"; - + return EXIT_FAILURE; } @@ -232,10 +232,10 @@ int main(int argc, char * argv[]) CGAL::Timer reconstruction_timer; reconstruction_timer.start(); - + Counter counter(std::distance(points.begin(), points.end())); InsertVisitor visitor(counter) ; - + //*************************************** // Computes implicit function @@ -258,14 +258,14 @@ int main(int argc, char * argv[]) { std::cerr << "Use Eigen 3\n"; CGAL::Eigen_solver_traits::EigenType> > solver; - if ( ! function.compute_implicit_function(solver, visitor, + if ( ! function.compute_implicit_function(solver, visitor, approximation_ratio, average_spacing_ratio) ) { std::cerr << "Error: cannot compute implicit function" << std::endl; return EXIT_FAILURE; } - } + } else { std::cerr << "Error: invalid solver " << solver_name << "\n"; @@ -309,7 +309,7 @@ int main(int argc, char * argv[]) FT radius = std::sqrt(bsphere.squared_radius()); // Defines the implicit surface: requires defining a - // conservative bounding sphere centered at inner point. + // conservative bounding sphere centered at inner point. FT sm_sphere_radius = 5.0 * radius; FT sm_dichotomy_error = sm_distance*average_spacing/1000.0; // Dichotomy error must be << sm_distance Surface_3 surface(function, diff --git a/Polygon_mesh_processing/benchmark/Polygon_mesh_processing/CMakeLists.txt b/Polygon_mesh_processing/benchmark/Polygon_mesh_processing/CMakeLists.txt index 7db73683150..33c8b074104 100644 --- a/Polygon_mesh_processing/benchmark/Polygon_mesh_processing/CMakeLists.txt +++ b/Polygon_mesh_processing/benchmark/Polygon_mesh_processing/CMakeLists.txt @@ -10,7 +10,7 @@ find_package( CGAL QUIET COMPONENTS ) if ( NOT CGAL_FOUND ) message(STATUS "This project requires the CGAL library, and will not be compiled.") - return() + return() endif() @@ -21,7 +21,7 @@ if ( NOT Boost_FOUND ) message(STATUS "This project requires the Boost library, and will not be compiled.") - return() + return() endif() diff --git a/Polygon_mesh_processing/doc/Polygon_mesh_processing/NamedParameters.txt b/Polygon_mesh_processing/doc/Polygon_mesh_processing/NamedParameters.txt index 92a56bc7b64..b875258f867 100644 --- a/Polygon_mesh_processing/doc/Polygon_mesh_processing/NamedParameters.txt +++ b/Polygon_mesh_processing/doc/Polygon_mesh_processing/NamedParameters.txt @@ -347,7 +347,7 @@ Parameter used in `isotropic_remeshing()` to specify an alternative vertex proje \cgalNPEnd \cgalNPBegin{apply_per_connected_component} \anchor PMP_apply_per_connected_component -Parameter used to indicate whether an algorithm should consider each connected component +Parameter used to indicate whether an algorithm should consider each connected component of a mesh independently.\n Type: `bool` \n Default: `false` diff --git a/Polygon_mesh_processing/doc/Polygon_mesh_processing/PackageDescription.txt b/Polygon_mesh_processing/doc/Polygon_mesh_processing/PackageDescription.txt index d5b84706fa5..aa033ce874f 100644 --- a/Polygon_mesh_processing/doc/Polygon_mesh_processing/PackageDescription.txt +++ b/Polygon_mesh_processing/doc/Polygon_mesh_processing/PackageDescription.txt @@ -4,8 +4,8 @@ /// \defgroup keep_connected_components_grp Connected Components /// -/// Two faces are in the same connected component if there is a path -/// of adjacent faces such that all edges between two consecutive faces of the +/// Two faces are in the same connected component if there is a path +/// of adjacent faces such that all edges between two consecutive faces of the /// path are not marked as constrained. /// /// \ingroup PkgPolygonMeshProcessingRef @@ -65,10 +65,10 @@ /// \ingroup PkgPolygonMeshProcessingRef /*! \addtogroup PkgPolygonMeshProcessingRef - + \cgalPkgDescriptionBegin{Polygon Mesh Processing, PkgPolygonMeshProcessing} \cgalPkgPicture{hole_filling_ico.png} - + \cgalPkgSummaryBegin \cgalPkgAuthor{Sébastien Loriot, Mael Rouxel-Labbé, Jane Tournois, Ilker %O. Yaz} \cgalPkgDesc{This package provides @@ -76,7 +76,7 @@ a collection of methods and classes for polygon mesh processing, ranging from basic operations on simplices, to complex geometry processing algorithms.} \cgalPkgManuals{Chapter_PolygonMeshProcessing,PkgPolygonMeshProcessingRef} \cgalPkgSummaryEnd - + \cgalPkgShortInfoBegin \cgalPkgSince{4.7} \cgalPkgDependsOn{documented for each function; \ref PkgSolverInterface} @@ -84,7 +84,7 @@ ranging from basic operations on simplices, to complex geometry processing algor \cgalPkgLicense{\ref licensesGPL "GPL"} \cgalPkgDemo{Polyhedron demo,polyhedron_3.zip} \cgalPkgShortInfoEnd - + \cgalPkgDescriptionEnd diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt b/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt index ec36a4b70f0..acbaa7925a9 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt @@ -10,7 +10,7 @@ find_package( CGAL QUIET COMPONENTS ) if ( NOT CGAL_FOUND ) message(STATUS "This project requires the CGAL library, and will not be compiled.") - return() + return() endif() @@ -21,7 +21,7 @@ if ( NOT Boost_FOUND ) message(STATUS "This project requires the Boost library, and will not be compiled.") - return() + return() endif() diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/corefinement_LCC.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/corefinement_LCC.cpp index 5abd976cb9a..b833108479c 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/corefinement_LCC.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/corefinement_LCC.cpp @@ -38,7 +38,7 @@ int main(int argc, char* argv[]) CGAL::write_off(output, mesh1); output.close(); output.open("mesh2_refined.off"); - CGAL::write_off(output, mesh2); + CGAL::write_off(output, mesh2); output.close(); return 0; diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/isotropic_remeshing_of_patch_example.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/isotropic_remeshing_of_patch_example.cpp index 504dd5745f6..db803c04d9c 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/isotropic_remeshing_of_patch_example.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/isotropic_remeshing_of_patch_example.cpp @@ -63,7 +63,7 @@ int main(int argc, char* argv[]) seed.push_back(*(faces(mesh).first)); selected[seed.front()] = true; CGAL::expand_face_selection(seed, mesh, 5, selected, std::back_inserter(patch)); - + std::cout << " and patch of size " << patch.size() << std::endl; PMP::isotropic_remeshing(patch, target_edge_length, diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/connected_components.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/connected_components.h index 361fd938645..e5d25bc983a 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/connected_components.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/connected_components.h @@ -215,7 +215,7 @@ connected_components(const PolygonMesh& pmesh, NamedParameters, internal::No_constraint//default > ::type EdgeConstraintMap; - + EdgeConstraintMap ecmap = choose_parameter(get_parameter(np, internal_np::edge_is_constrained)); diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/distance.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/distance.h index b5098e28c2b..d4c6291c33b 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/distance.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/distance.h @@ -74,7 +74,7 @@ triangle_grid_sampling( const typename Kernel::Point_3& p0, template struct Distance_computation{ typedef typename PointRange::const_iterator::value_type Point_3; - + const AABB_tree& tree; const PointRange& sample_points; Point_3 initial_hint; diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/fair.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/fair.h index 9f34be87d15..1f4e07d3aab 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/fair.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/fair.h @@ -6,7 +6,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Ilker O. Yaz @@ -91,7 +91,7 @@ namespace internal { \cgalParamBegin{fairing_continuity} tangential continuity of the output surface patch. The larger `fairing_continuity` gets, the more fixed vertices are required \cgalParamEnd \cgalParamBegin{sparse_linear_solver} an instance of the sparse linear solver used for fairing \cgalParamEnd \cgalNamedParamsEnd - + @return `true` if fairing is successful, otherwise no vertices are relocated @pre `is_triangle_mesh(tmesh)` diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersection_callbacks.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersection_callbacks.h index fdf829e5805..d5389e9f482 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersection_callbacks.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersection_callbacks.h @@ -304,7 +304,7 @@ public: } if ( abcq==COPLANAR && - is_edge_target_incident_to_face(opposite(eh, tm), fh) ) + is_edge_target_incident_to_face(opposite(eh, tm), fh) ) { return; // no intersection (incident edge) } diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h index 32f919a55d5..2fc28eec9a6 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h @@ -6,7 +6,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Ilker O. Yaz @@ -62,11 +62,11 @@ private: bool bound_check(int i, int j) const { CGAL_assertion(i >= 0 && i < n); CGAL_assertion(j >= 0 && j < n); - CGAL_assertion(i < j); + CGAL_assertion(i < j); CGAL_USE(i); CGAL_USE(j); // previous implementation was based on directly vector and i supposed to be always smaller than j. - // this check actually can be removed and i =min(i,j) j = max(i,j) can be used for reflexive access + // this check actually can be removed and i =min(i,j) j = max(i,j) can be used for reflexive access return true; } std::vector table; @@ -81,12 +81,12 @@ public: void put(int i, int j, const T& t) { CGAL_assertion(bound_check(i,j)); - + if(t == default_) { table.erase(std::make_pair(i,j)); return; } - + std::pair inserted = table.insert(std::make_pair(std::make_pair(i,j), t)); if(!inserted.second) { inserted.first->second = t;} } @@ -107,14 +107,14 @@ public: // 5-6 typename Map::iterator it; if(b == 0) { it = table.begin(); } - else { + else { it = table.upper_bound(std::make_pair(b-1, n)); // to find first entry where entry.first == b } while(it != table.end() && it->first.first != e) { - if(it->first.second <= e) + if(it->first.second <= e) { table.erase(it++); } - else + else { ++it; } } } @@ -140,8 +140,8 @@ private: struct Is_valid_existing_edges { typedef std::vector > Edge_container; - - Is_valid_existing_edges(Edge_container& existing_edges) + + Is_valid_existing_edges(Edge_container& existing_edges) : existing_edges(existing_edges) { std::sort(existing_edges.begin(), existing_edges.end()); @@ -155,7 +155,7 @@ struct Is_valid_existing_edges template bool operator()(const std::vector&, - int v0, int v1, int v2) const + int v0, int v1, int v2) const { CGAL_assertion(v0 < v1 && v1 < v2); @@ -166,7 +166,7 @@ struct Is_valid_existing_edges if(v1 + 1 != v2 && std::binary_search(existing_edges.begin(), existing_edges.end(), std::make_pair(v1,v2)) ) { return false; } - + if(std::binary_search(existing_edges.begin(), existing_edges.end(), std::make_pair(v2,v0)) ) { return false; } @@ -180,7 +180,7 @@ struct Is_not_degenerate_triangle { template bool operator()(const std::vector& P, - int v0, int v1, int v2) const + int v0, int v1, int v2) const { return !CGAL::collinear(P[v0], P[v1], P[v2]); } @@ -194,7 +194,7 @@ struct Is_valid_existing_edges_and_degenerate_triangle template bool operator()(const std::vector& P, - int v0, int v1, int v2) const + int v0, int v1, int v2) const { return Is_not_degenerate_triangle()(P,v0,v1,v2) && is_valid_edges(P,v0,v1,v2); @@ -208,7 +208,7 @@ struct Is_valid_existing_edges_and_degenerate_triangle ************************************************************************/ // First minimizes the worst dihedral angle between patch triangles, then the total surface area as a tiebreaker. -class Weight_min_max_dihedral_and_area +class Weight_min_max_dihedral_and_area { template friend struct Weight_calculator; @@ -224,22 +224,22 @@ public: // below required by Weight concept private: template - Weight_min_max_dihedral_and_area(const std::vector& P, - const std::vector& Q, - int i, int j, int k, + Weight_min_max_dihedral_and_area(const std::vector& P, + const std::vector& Q, + int i, int j, int k, const LookupTable& lambda) { CGAL_assertion(i < j); CGAL_assertion(j < k); int n = static_cast(P.size()) -1; // because the first and last point are equal - + // The CGAL::dihedral angle is measured between the oriented triangles, that is it goes from [-pi, pi] // What we need is the angle between the normals of the triangles between [0, pi] double ang_max = 0; // Test each edge int vertices[] = {i, j, k}; - for(int e = 0; e < 3; ++e) + for(int e = 0; e < 3; ++e) { int v0 = vertices[e]; int v1 = vertices[(e+1)%3]; @@ -247,25 +247,25 @@ private: double angle = 0; // check whether the edge is border if( (v0 + 1 == v1 || (v0 == n-1 && v1 == 0) ) && !Q.empty() ) { - angle = 180 - CGAL::abs( + angle = 180 - CGAL::abs( to_double(CGAL::approximate_dihedral_angle(P[v0],P[v1],P[v_other],Q[v0])) ); } else { if(e == 2) { continue; } if(lambda.get(v0, v1) != -1){ const Point_3& p01 = P[lambda.get(v0, v1)]; - angle = 180 - CGAL::abs( + angle = 180 - CGAL::abs( to_double(CGAL::approximate_dihedral_angle(P[v0],P[v1],P[v_other],p01)) ); } } ang_max = (std::max)(ang_max, angle); } - + w = std::make_pair(ang_max, to_double(CGAL::approximate_sqrt(CGAL::squared_area(P[i],P[j],P[k])))); } public: - Weight_min_max_dihedral_and_area operator+(const Weight_min_max_dihedral_and_area& w2) const + Weight_min_max_dihedral_and_area operator+(const Weight_min_max_dihedral_and_area& w2) const { CGAL_assertion((*this) != NOT_VALID()); CGAL_assertion(w2 != NOT_VALID()); @@ -283,15 +283,15 @@ public: return w.first < w2.w.first; } - bool operator==(const Weight_min_max_dihedral_and_area& w2) const + bool operator==(const Weight_min_max_dihedral_and_area& w2) const { return w.first == w2.w.first && w.second == w2.w.second; } - bool operator!=(const Weight_min_max_dihedral_and_area& w2) const + bool operator!=(const Weight_min_max_dihedral_and_area& w2) const { return !(*this == w2); } static const Weight_min_max_dihedral_and_area DEFAULT() // rule: x + DEFAULT() == x { return Weight_min_max_dihedral_and_area(0,0); } - static const Weight_min_max_dihedral_and_area NOT_VALID() + static const Weight_min_max_dihedral_and_area NOT_VALID() { return Weight_min_max_dihedral_and_area(-1,-1); } friend std::ostream& operator<<(std::ostream& out, const Weight_min_max_dihedral_and_area& w) { @@ -311,9 +311,9 @@ private: Weight_total_edge(double total_length = 0) : total_length(total_length) { } template - Weight_total_edge(const std::vector& P, - const std::vector&, - int i, int j, int k, + Weight_total_edge(const std::vector& P, + const std::vector&, + int i, int j, int k, const LookupTable&) : total_length(0) { @@ -323,11 +323,11 @@ private: // Test each edge int vertices[] = {i, j, k}; - for(int e = 0; e < 3; ++e) + for(int e = 0; e < 3; ++e) { int v0 = vertices[e]; int v1 = vertices[(e+1)%3]; - + // check whether the edge is border bool border = (v0 + 1 == v1) || (v0 == n-1 && v1 == 0); if(!border) { @@ -337,7 +337,7 @@ private: } public: - Weight_total_edge operator+(const Weight_total_edge& w2) const + Weight_total_edge operator+(const Weight_total_edge& w2) const { CGAL_assertion((*this) != NOT_VALID()); CGAL_assertion(w2 != NOT_VALID()); @@ -345,15 +345,15 @@ public: } bool operator<(const Weight_total_edge& w2) const - { + { CGAL_assertion((*this) != NOT_VALID()); CGAL_assertion(w2 != NOT_VALID()); - return total_length < w2.total_length; + return total_length < w2.total_length; } - bool operator==(const Weight_total_edge& w2) const + bool operator==(const Weight_total_edge& w2) const { return total_length == w2.total_length; } - bool operator!=(const Weight_total_edge& w2) const + bool operator!=(const Weight_total_edge& w2) const { return !(*this == w2); } static const Weight_total_edge DEFAULT() { return Weight_total_edge(0); } // rule: x + DEFAULT() == x @@ -373,19 +373,19 @@ class Weight_incomplete private: template - Weight_incomplete(const std::vector& P, - const std::vector& Q, - int i, int j, int k, + Weight_incomplete(const std::vector& P, + const std::vector& Q, + int i, int j, int k, const LookupTable& lambda) : weight(P,Q,i,j,k,lambda), patch_size(1) { } - Weight_incomplete(const ActualWeight& weight, int patch_size) + Weight_incomplete(const ActualWeight& weight, int patch_size) : weight(weight), patch_size(patch_size) { } public: - Weight_incomplete operator+(const Weight_incomplete& w2) const + Weight_incomplete operator+(const Weight_incomplete& w2) const { CGAL_assertion((*this) != NOT_VALID()); CGAL_assertion(w2 != NOT_VALID()); @@ -404,10 +404,10 @@ public: return patch_size > w2.patch_size; // if patch size is larger, then the weight is smaller } - bool operator==(const Weight_incomplete& w2) const + bool operator==(const Weight_incomplete& w2) const { return weight == w2.weight && patch_size == w2.patch_size; } - bool operator!=(const Weight_incomplete& w2) const + bool operator!=(const Weight_incomplete& w2) const { return !(*this == w2); } static const Weight_incomplete DEFAULT() // rule: x + DEFAULT() == x @@ -426,18 +426,18 @@ public: // Weight calculator class is both responsible from calculating weights, and checking validity of triangle template -struct Weight_calculator +struct Weight_calculator { typedef Weight_ Weight; Weight_calculator(const IsValid& is_valid = IsValid()) : is_valid(is_valid) { } template - Weight operator()(const std::vector& P, - const std::vector& Q, - int i, int j, int k, - const LookupTable& lambda) const + Weight operator()(const std::vector& P, + const std::vector& Q, + int i, int j, int k, + const LookupTable& lambda) const { - if( !is_valid(P,i,j,k) ) + if( !is_valid(P,i,j,k) ) { return Weight::NOT_VALID(); } return Weight(P, Q, i,j,k, lambda); } @@ -450,7 +450,7 @@ struct Weight_calculator // It can produce a patch from both complete and incomplete lambda template struct Tracer_polyline_incomplete { - Tracer_polyline_incomplete(OutputIteratorPatch out, OutputIteratorHole out_hole) + Tracer_polyline_incomplete(OutputIteratorPatch out, OutputIteratorHole out_hole) : out(out), out_hole(out_hole) { } @@ -463,7 +463,7 @@ struct Tracer_polyline_incomplete { ranges.push(std::make_pair(v0, v1)); while(!ranges.empty()) { - std::pair r = ranges.top(); + std::pair r = ranges.top(); ranges.pop(); CGAL_assertion(r.first >= 0 && r.first < n); CGAL_assertion(r.second >= 0 && r.second < n); @@ -498,7 +498,7 @@ template struct Incident_facet_circulator; template -struct Incident_facet_circulator_base +struct Incident_facet_circulator_base { typedef typename Triangulator::Facet Facet; typedef typename Triangulator::Edge Edge; @@ -511,7 +511,7 @@ struct Incident_facet_circulator_base { return (std::min)(e.first->vertex(e.second)->info(), e.first->vertex(e.third)->info()); } int vertex_second() { return (std::max)(e.first->vertex(e.second)->info(), e.first->vertex(e.third)->info()); } - + Edge e; }; @@ -525,7 +525,7 @@ struct Incident_facet_circulator_base if(i == f.second) { continue; } // skip the vertex which is not on `f` int f3 = f.first->vertex(i)->info(); if(f3 != v0_info && f3 != v1_info) { - return f3; + return f3; } } CGAL_assertion(false); @@ -535,8 +535,8 @@ struct Incident_facet_circulator_base Edge_wrapper edge_first(Facet f, Edge e) { int v0_info = (std::min)(e.first->vertex(e.second)->info(), e.first->vertex(e.third)->info()); - return Edge(f.first, - get_vertex_index(f.first, v0_info) , + return Edge(f.first, + get_vertex_index(f.first, v0_info) , get_vertex_index(f.first, get_third(f,e))); } @@ -587,9 +587,9 @@ struct Incident_facet_circulator<2, Triangulator> int get_third() { return Incident_facet_circulator_base::get_third(it, e); } - Edge_wrapper edge_first() + Edge_wrapper edge_first() { return Incident_facet_circulator_base::edge_first(it, e); } - Edge_wrapper edge_second() + Edge_wrapper edge_second() { return Incident_facet_circulator_base::edge_second(it, e); } Facet f1, f2, it; @@ -615,12 +615,12 @@ struct Incident_facet_circulator<3, Triangulator> return *this; } operator bool() const { return it != end; } - - int get_third() + + int get_third() { return Incident_facet_circulator_base::get_third(*it, e); } - Edge_wrapper edge_first() + Edge_wrapper edge_first() { return Incident_facet_circulator_base::edge_first(*it, e); } - Edge_wrapper edge_second() + Edge_wrapper edge_second() { return Incident_facet_circulator_base::edge_second(*it, e); } Facet_circulator it; @@ -630,7 +630,7 @@ struct Incident_facet_circulator<3, Triangulator> // Another DS for search space, which can be used in triangulate_DT // It is useful for extending the search space of 3D Triangulation by appending new triangles -struct Edge_graph +struct Edge_graph { struct Edge_comp { bool operator()(std::pair p0, std::pair p1) const { @@ -683,7 +683,7 @@ struct Edge_graph typedef typename Triangulation::Finite_edges_iterator Finite_edges_iterator; n = static_cast(edge_exist.size()); - for(Finite_edges_iterator eb = tr.finite_edges_begin(); eb != tr.finite_edges_end(); ++eb) + for(Finite_edges_iterator eb = tr.finite_edges_begin(); eb != tr.finite_edges_end(); ++eb) { int v0 = eb->first->vertex(eb->second)->info(); int v1 = eb->first->vertex(eb->third )->info(); @@ -729,14 +729,14 @@ class Triangulate_hole_polyline; #ifndef CGAL_HOLE_FILLING_DO_NOT_USE_DT3 // By default Lookup_table_map is used, since Lookup_table requires n*n mem. -// Performance decrease is nearly 2x (for n = 10,000, for larger n Lookup_table just goes out of mem) +// Performance decrease is nearly 2x (for n = 10,000, for larger n Lookup_table just goes out of mem) template< class Kernel, class Tracer, class WeightCalculator, template class LookupTable = Lookup_table_map > -class Triangulate_hole_polyline_DT +class Triangulate_hole_polyline_DT { struct Auto_count { typedef std::pair result_type; @@ -767,7 +767,7 @@ public: typedef Incident_facet_circulator<2, Triangulate_hole_polyline_DT> IFC_2; typedef Incident_facet_circulator<3, Triangulate_hole_polyline_DT> IFC_3; - Weight operator()(const Polyline_3& P, + Weight operator()(const Polyline_3& P, const Polyline_3& Q, Tracer& tracer, const WeightCalculator& WC) const @@ -796,7 +796,7 @@ public: LookupTable lambda(n,-1); typename Incident_facet_circulator_base::Edge_wrapper - e_start(*boost::get<0>(res)); + e_start(*boost::get<0>(res)); if(tr.dimension() == 3) { triangulate_DT(P, Q, W, lambda, e_start, tr, WC, false); } @@ -817,12 +817,12 @@ public: tracer(lambda, 0, n-1); return W.get(0,n-1); } - + // How to handle missing border edges #if 1 return fill_by_extra_triangles(tr, edge_exist, P, Q, tracer, WC); #else - // This approach produce better patches when used with Weight_incomplete + // This approach produce better patches when used with Weight_incomplete // (which should be arranged in internal::triangulate_hole_Polyhedron, triangulate_polyline) return fill_by_incomplete_patches(tr, res.get<0>(), edge_exist, P, Q, tracer, WC); #endif @@ -842,10 +842,10 @@ private: * - edge_first() and edge_second() neighbor edges to get_third() vertex ************************************************************************/ template - void triangulate_DT(const Polyline_3& P, - const Polyline_3& Q, - LookupTable& W, - LookupTable& lambda, + void triangulate_DT(const Polyline_3& P, + const Polyline_3& Q, + LookupTable& W, + LookupTable& lambda, Edge_DT e, const Triangulation_DT& tr, const WeightCalculator& WC, @@ -877,7 +877,7 @@ private: if(WC(P,Q, v0,v2,v1, lambda) == Weight::NOT_VALID()) { continue; } // computed weight in here is not correct weight // since max dih angle requires neighbor ranges to be already computed. It is just for checking validity. - + Weight w = Weight::DEFAULT(); Edge_DT e0 = fb.edge_first(); // edge v0-v2 @@ -885,7 +885,7 @@ private: triangulate_DT(P, Q, W, lambda, e0, tr, WC, produce_incomplete); // region v0-v2 const Weight& we0 = W.get(v0, v2); - if(!produce_incomplete && we0 == Weight::NOT_VALID()) + if(!produce_incomplete && we0 == Weight::NOT_VALID()) { continue; } // not producing incomplete patches and failed to fill sub-range v0-v2, so no reason to proceed if(we0 != Weight::NOT_VALID()) // to not consider we0 if it is NOT_VALID (it is valid when produce_incomplete = true) { w = w + we0; } @@ -895,7 +895,7 @@ private: triangulate_DT(P, Q, W, lambda, e1, tr, WC, produce_incomplete); // region v2-v1 const Weight& we1 = W.get(v2, v1); - if(!produce_incomplete && we1 == Weight::NOT_VALID()) + if(!produce_incomplete && we1 == Weight::NOT_VALID()) { continue; } if(we1 != Weight::NOT_VALID()) // to not consider we1 if it is NOT_VALID (it is valid when produce_incomplete = true) { w = w + we1; } @@ -917,7 +917,7 @@ private: construct_3D_triangulation(const Polyline_3& P, std::pair h, Triangulation& tr, - std::vector& edge_exist) const + std::vector& edge_exist) const { // construct 3D tr with P[h.first], P[h.second] also assign ids from h.first to h.second boost::optional e; @@ -934,7 +934,7 @@ private: Finite_edges_iterator v_first_v_second_edge; // range.first - range.second edge for(Finite_edges_iterator eb = tr.finite_edges_begin(); eb != tr.finite_edges_end(); - ++eb) + ++eb) { int v0_id = eb->first->vertex(eb->second)->info(); int v1_id = eb->first->vertex(eb->third )->info(); @@ -964,13 +964,13 @@ private: * Try to construct hole part by part. * * What need to be improved: - * + if 3D triangulation does not contain the start-edge (edge between v0 vn-1) we directly switch to all space. + * + if 3D triangulation does not contain the start-edge (edge between v0 vn-1) we directly switch to all space. * + when switched to all-space, we use map based lookup tables. ************************************************************************/ Weight fill_by_incomplete_patches(Triangulation& tr, boost::optional start_edge, std::vector& edge_exist, - const Polyline_3& P, + const Polyline_3& P, const Polyline_3& Q, Tracer& tracer, const WeightCalculator& WC) const @@ -978,11 +978,11 @@ private: typedef std::pair Range; typedef std::back_insert_iterator > Output_hole_iterator; typedef Tracer_polyline_incomplete, Emptyset_iterator, Output_hole_iterator> Remaining_holes_tracer; - + std::vector remaining_holes; - + int n_all = P.size()-1;// because the first point and last point are equal - remaining_holes.push_back(Range(0, n_all-1)); // corresponds to start_edge + remaining_holes.push_back(Range(0, n_all-1)); // corresponds to start_edge LookupTable W(n_all, Weight::DEFAULT()); // do not forget that these default values are not changed for [i, i+1] LookupTable lambda(n_all,-1); @@ -990,15 +990,15 @@ private: while(true) { Range h = remaining_holes.back(); remaining_holes.pop_back(); - + if(start_edge) { typename IFC_3::Edge_wrapper e(*start_edge); - CGAL_assertion(h.first == e.vertex_first() && - h.second == e.vertex_second()); + CGAL_assertion(h.first == e.vertex_first() && + h.second == e.vertex_second()); } if(!start_edge) { - // switch to brute force + // switch to brute force Triangulate_hole_polyline all_space; all_space.triangulate_all(P, Q, WC, std::make_pair(h.first, h.second), W, lambda); if(W.get(h.first, h.second) == Weight::NOT_VALID()) { @@ -1009,7 +1009,7 @@ private: else { // run the algorithm typename IFC_3::Edge_wrapper e(*start_edge); - if(tr.dimension() == 3) + if(tr.dimension() == 3) { triangulate_DT(P, Q, W, lambda, e, tr, WC, true); } @@ -1019,7 +1019,7 @@ private: } // check whether there is any improvement (at least we should construct one triangle) if(W.get(h.first, h.second) == Weight::NOT_VALID()) { - // switch to brute force + // switch to brute force Triangulate_hole_polyline all_space; all_space.triangulate_all(P, Q, WC, std::make_pair(h.first, h.second), W, lambda); if(W.get(h.first, h.second) == Weight::NOT_VALID()) { @@ -1048,13 +1048,13 @@ private: } tracer(lambda, 0, n_all-1); - // W.get(0, n_all -1) is not correct weight (since we do not update weights while we are filling remaining holes), + // W.get(0, n_all -1) is not correct weight (since we do not update weights while we are filling remaining holes), // we need to recalculate it std::stack > ranges; ranges.push(std::make_pair(0, n_all-1)); Weight total_weight = Weight::DEFAULT(); while(!ranges.empty()) { - std::pair r = ranges.top(); + std::pair r = ranges.top(); ranges.pop(); if(r.first + 1 == r.second) { continue; } int la = lambda.get(r.first, r.second); @@ -1064,20 +1064,20 @@ private: } return total_weight; } - + /************************************************************************ * This approach extends the search space by adding extra triangles. * * + Initial search space is 3D Triangulation. * + For each border edge which is not inside 3DT, we add all possible triangles containing that edge to the search space. - * Example: say border edge [4-5] is not found in 3DT, then triangles = { [0,4,5] [1,4,5] [2,4,5] ... [ n-1,4,5] } + * Example: say border edge [4-5] is not found in 3DT, then triangles = { [0,4,5] [1,4,5] [2,4,5] ... [ n-1,4,5] } * are added to the search space. * * I guess this approach does not make the search space complete, since there are some cases that it still returns no patch. ************************************************************************/ - Weight fill_by_extra_triangles(const Triangulation& tr, + Weight fill_by_extra_triangles(const Triangulation& tr, const std::vector& edge_exist, - const Polyline_3& P, + const Polyline_3& P, const Polyline_3& Q, Tracer& tracer, const WeightCalculator& WC) const @@ -1088,15 +1088,15 @@ private: Edge_graph edge_graph; - if(tr.dimension() == 3) + if(tr.dimension() == 3) { edge_graph.init(tr, edge_exist); } - else + else { edge_graph.init(tr, edge_exist); } Edge_graph::Edge_wrapper e_start(std::make_pair(0, n-1)); triangulate_DT (P, Q, W, lambda, e_start, edge_graph, WC, false); - + if(W.get(0, n-1) == Weight::NOT_VALID()) { #ifndef CGAL_TEST_SUITE CGAL_warning_msg(false, "Returning no output using Delaunay triangulation.\n Falling back to the general Triangulation framework."); @@ -1136,11 +1136,11 @@ public: CGAL_assertion(P.front() == P.back()); CGAL_assertion(Q.empty() || (Q.front() == Q.back())); CGAL_assertion(Q.empty() || (P.size() == Q.size())); - + int n = static_cast(P.size()) - 1; // because the first and last point are equal LookupTable W(n,Weight::DEFAULT()); // do not forget that these default values are not changed for [i, i+1] LookupTable lambda(n,-1); - + triangulate_all(P, Q, WC, std::make_pair(0,n-1), W, lambda); if(W.get(0,n-1) == Weight::NOT_VALID() || n <= 2) { @@ -1160,23 +1160,23 @@ public: const Polyline_3& Q, const WeightCalculator& WC, std::pair range, - LookupTable& W, + LookupTable& W, LookupTable& lambda) const { for(int j = 2; j<= range.second; ++j) { // determines range (2 - 3 - 4 ) - for(int i=range.first; i<= range.second-j; ++i) { // iterates over ranges and find min triangulation in those ranges + for(int i=range.first; i<= range.second-j; ++i) { // iterates over ranges and find min triangulation in those ranges int k = i+j; // like [0-2, 1-3, 2-4, ...], [0-3, 1-4, 2-5, ...] int m_min = -1; Weight w_min = Weight::NOT_VALID(); // i is the range start (e.g. 1) k is the range end (e.g. 5) -> [1-5]. Now subdivide the region [1-5] with m -> 2,3,4 - for(int m = i+1; m + std::pair res = patch_id_to_index_map.insert(std::make_pair(pid,0)); if(res.second){ res.first->second = patch_id_to_index_map.size()-1; @@ -1361,7 +1361,7 @@ private: do { if (is_on_patch_border(nxt)) - { + { CGAL_assertion(get_patch_id(face(nxt, mesh_)) == pid); return nxt; } diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/intersection.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/intersection.h index 44965ebc8ec..ebaf53ffa92 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/intersection.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/intersection.h @@ -414,7 +414,7 @@ compute_face_face_intersection(const FaceRange& face_range1, CGAL::Bbox_3 b1 = CGAL::Polygon_mesh_processing::bbox(tm1, np1), b2 = CGAL::Polygon_mesh_processing::bbox(tm2, np2); - + if(!CGAL::do_overlap(b1, b2)) { return out; @@ -643,7 +643,7 @@ compute_face_polylines_intersection(const FaceRange& face_range, using parameters::get_parameter; CGAL_precondition(CGAL::is_triangle_mesh(tm)); - + CGAL::Bbox_3 b1,b2; b1 = CGAL::Polygon_mesh_processing::bbox(tm, np); for(std::size_t i =0; i< polyline_range.size(); ++i) @@ -651,10 +651,10 @@ compute_face_polylines_intersection(const FaceRange& face_range, b2 += CGAL::bbox_3(polyline_range[i].begin(), polyline_range[i].end()); } - + if(!CGAL::do_overlap(b1,b2)) return out; - + typedef TriangleMesh TM; typedef typename boost::graph_traits::face_descriptor face_descriptor; typedef typename GetVertexPointMap::const_type VertexPointMap; diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/random_perturbation.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/random_perturbation.h index 04a1aac09a4..aec54c22b7c 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/random_perturbation.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/random_perturbation.h @@ -104,7 +104,7 @@ namespace internal { * * @tparam VertexRange model of `Range`, holding * vertices of type `boost::graph_traits::%vertex_descriptor`. -* Its iterator type is `ForwardIterator`. +* Its iterator type is `ForwardIterator`. * @tparam TriangleMesh model of `MutableFaceGraph`. * @tparam NamedParameters a sequence of \ref pmp_namedparameters "Named Parameters" * diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/remesh.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/remesh.h index b49a6a47750..1c8b004bdd6 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/remesh.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/remesh.h @@ -346,7 +346,7 @@ void split_long_edges(const EdgeRange& edges > ::type ECMap; ECMap ecmap = choose_parameter(get_parameter(np, internal_np::edge_is_constrained), Constant_property_map(false)); - + typename internal::Incremental_remesher, // no constraint pmap internal::Connected_components_pmap, diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_polygon_soup.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_polygon_soup.h index 1230c0a7b80..b9e255f8a5d 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_polygon_soup.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_polygon_soup.h @@ -661,7 +661,7 @@ Polygon construct_canonical_polygon(const PointRange& points, reversed = false; return polygon; } - + #ifdef CGAL_PMP_REPAIR_POLYGON_SOUP_VERBOSE_PP std::cout << "Input polygon:"; diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h index a19e0906c21..562f1892814 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h @@ -88,11 +88,11 @@ struct Less_for_halfedge const VertexPointMap& vpmap; }; -//add a pair of border halfedges to be stitched. +//add a pair of border halfedges to be stitched. //Specifies if they are manifold or not in the map. template @@ -107,7 +107,7 @@ void fill_pairs(const Halfedge& he, bool insertion_ok; std::tie(set_it, insertion_ok) = border_halfedge_map.insert(std::make_pair(he,std::make_pair(1,0))); - + if ( !insertion_ok ){ // we found already a halfedge with the points ++set_it->second.first; // increase the multiplicity if(set_it->second.first == 2) @@ -133,29 +133,29 @@ void fill_pairs(const Halfedge& he, template -std::size_t num_component_wrapper(const Mesh& pmesh, - CCMap cc, +std::size_t num_component_wrapper(const Mesh& pmesh, + CCMap cc, FIMap fim) { - return CGAL::Polygon_mesh_processing::connected_components(pmesh, cc, + return CGAL::Polygon_mesh_processing::connected_components(pmesh, cc, CGAL::Polygon_mesh_processing::parameters::face_index_map(fim)); } //specialization if there is no default FIMap, create one template -std::size_t num_component_wrapper(Mesh& pmesh, - CCMap cc, +std::size_t num_component_wrapper(Mesh& pmesh, + CCMap cc, boost::cgal_no_property::type) { - + boost::unordered_map::face_descriptor, std::size_t> fim; - + //init the map std::size_t i=-1; for(typename boost::graph_traits::face_descriptor f : faces(pmesh)) fim[f]=++i; - + return CGAL::Polygon_mesh_processing::connected_components(pmesh, cc, parameters::face_index_map(boost::make_assoc_property_map(fim))); @@ -165,7 +165,7 @@ template OutputIterator collect_duplicated_stitchable_boundary_edges -(PM& pmesh, OutputIterator out, LessHedge less_hedge, +(PM& pmesh, OutputIterator out, LessHedge less_hedge, const VertexPointMap& vpmap, const CGAL_PMP_NP_CLASS& np) { typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; @@ -189,7 +189,7 @@ collect_duplicated_stitchable_boundary_edges num_component = num_component_wrapper(pmesh, cc, CGAL::get_initialized_face_index_map(pmesh, np)); border_edges_per_cc.resize(num_component); } - + for(halfedge_descriptor he : halfedges(pmesh)) { if ( !CGAL::is_border(he, pmesh) ) @@ -200,7 +200,7 @@ collect_duplicated_stitchable_boundary_edges } else { - fill_pairs(he, border_halfedge_map, halfedge_pairs, + fill_pairs(he, border_halfedge_map, halfedge_pairs, manifold_halfedge_pairs, vpmap, pmesh); } } @@ -214,7 +214,7 @@ collect_duplicated_stitchable_boundary_edges for(int j = 0; j < static_cast(border_edges_per_cc[i].size()); ++j) { halfedge_descriptor he = border_edges_per_cc[i][j]; - fill_pairs(he, border_halfedge_map_in_cc, halfedge_pairs, + fill_pairs(he, border_halfedge_map_in_cc, halfedge_pairs, manifold_halfedge_pairs, vpmap, pmesh); } // put in `out` only manifold edges from the set of edges to stitch. diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_hole.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_hole.h index 8f354ed49fb..350cfec4901 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_hole.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_hole.h @@ -6,7 +6,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// +// // Author(s) : Ilker O. Yaz #ifndef CGAL_POLYGON_MESH_PROCESSING_TRIANGULATE_HOLE_H @@ -76,7 +76,7 @@ namespace Polygon_mesh_processing { @todo Then, insert the holes vertices in the set of possibilities for connecting vertices together @todo handle the case where an island is reduced to a point - */ + */ template @@ -361,7 +361,7 @@ namespace Polygon_mesh_processing { typedef typename value_type_traits::type OutputIteratorValueType; CGAL::internal::Tracer_polyline_incomplete tracer(out, Holes_out(holes)); - + typedef typename PointRange1::iterator InIterator; typedef typename std::iterator_traits::value_type Point; typedef typename CGAL::Kernel_traits::Kernel Kernel; @@ -389,7 +389,7 @@ namespace Polygon_mesh_processing { /*! \ingroup hole_filling_grp same as above but the range of third points is omitted. They are not - taken into account in the cost computation that leads the hole filling. + taken into account in the cost computation that leads the hole filling. */ template 1) ? argv[1] : "data/blobby_3cc.off"; const bool save_output = (argc > 2) ? true : false; diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/remeshing_test_P_SM_OM.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/remeshing_test_P_SM_OM.cpp index bed1ad1c583..c57ad0ef558 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/remeshing_test_P_SM_OM.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/remeshing_test_P_SM_OM.cpp @@ -61,7 +61,7 @@ int main() PMP::isotropic_remeshing(faces(om), 0.02, om); - + om.garbage_collection(); OpenMesh::IO::write_mesh(om, "pm.off"); } @@ -77,7 +77,7 @@ int main() PMP::isotropic_remeshing(faces(om), 0.02, om); - + om.garbage_collection(); OpenMesh::IO::write_mesh(om, "tm.off"); } diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_orient_cc.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_orient_cc.cpp index 8f846d3c455..e5acb1dcf7e 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_orient_cc.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_orient_cc.cpp @@ -24,7 +24,7 @@ bool test_orientation(const TriangleMesh& tm, bool is_positive, const NamedParam using CGAL::parameters::choose_parameter; using CGAL::parameters::get_parameter; - + Vpm vpm = choose_parameter(get_parameter(np, CGAL::internal_np::vertex_point), CGAL::get_const_property_map(boost::vertex_point, tm)); diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_clip.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_clip.cpp index aa63899f127..512724ba23d 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_clip.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_clip.cpp @@ -593,16 +593,16 @@ int main() std::cout << "Polyhedron" << std::endl; test(); - + std::cout << "running test_split with Surface_mesh\n"; test_split(); - + std::cout << "running test_split_plane with Surface_mesh\n"; test_split_plane(); - + std::cout << "running test_split with Polyhedron\n"; test_split(); - + std::cout << "running test_split_plane with Polyhedron\n"; test_split_plane(); diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_stitching.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_stitching.cpp index f2ae9f68f60..cdf0f5eab8c 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_stitching.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_stitching.cpp @@ -129,7 +129,7 @@ void test_surface_mesh_cc(const char* fname, std::cerr << "Error: can not read file."; return; } - + std::size_t res = PMP::stitch_borders(mesh, params::apply_per_connected_component(true)); std::cout << "res: " << res << " (expected: " << expected_n << ")" << std::endl; diff --git a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/CMakeLists.txt b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/CMakeLists.txt index 20d0abef1c2..5fd39e6bcc1 100644 --- a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/CMakeLists.txt +++ b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/CMakeLists.txt @@ -12,7 +12,7 @@ find_package( CGAL QUIET COMPONENTS ) if ( NOT CGAL_FOUND ) message(STATUS "NOTICE: This project requires the CGAL library, and will not be compiled.") - return() + return() endif() @@ -27,7 +27,7 @@ if ( NOT Boost_FOUND ) message(STATUS "NOTICE: This project requires the Boost library, and will not be compiled.") - return() + return() endif() diff --git a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_model_complexty_control.cpp b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_model_complexty_control.cpp index 5e48efa5552..a5d9cac1b74 100644 --- a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_model_complexty_control.cpp +++ b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_model_complexty_control.cpp @@ -7,10 +7,10 @@ #ifdef CGAL_USE_SCIP // defined (or not) by CMake scripts, do not define by hand #include -typedef CGAL::SCIP_mixed_integer_program_traits MIP_Solver; +typedef CGAL::SCIP_mixed_integer_program_traits MIP_Solver; #elif defined(CGAL_USE_GLPK) // defined (or not) by CMake scripts, do not define by hand #include -typedef CGAL::GLPK_mixed_integer_program_traits MIP_Solver; +typedef CGAL::GLPK_mixed_integer_program_traits MIP_Solver; #endif @@ -21,124 +21,124 @@ typedef CGAL::GLPK_mixed_integer_program_traits MIP_Solver; #include -typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; -typedef Kernel::Point_3 Point; -typedef Kernel::Vector_3 Vector; -typedef CGAL::Polygonal_surface_reconstruction Polygonal_surface_reconstruction; -typedef CGAL::Surface_mesh Surface_mesh; +typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; +typedef Kernel::Point_3 Point; +typedef Kernel::Vector_3 Vector; +typedef CGAL::Polygonal_surface_reconstruction Polygonal_surface_reconstruction; +typedef CGAL::Surface_mesh Surface_mesh; // Point with normal, and plane index -typedef boost::tuple PNI; -typedef CGAL::Nth_of_tuple_property_map<0, PNI> Point_map; -typedef CGAL::Nth_of_tuple_property_map<1, PNI> Normal_map; -typedef CGAL::Nth_of_tuple_property_map<2, PNI> Plane_index_map; +typedef boost::tuple PNI; +typedef CGAL::Nth_of_tuple_property_map<0, PNI> Point_map; +typedef CGAL::Nth_of_tuple_property_map<1, PNI> Normal_map; +typedef CGAL::Nth_of_tuple_property_map<2, PNI> Plane_index_map; /* * The following example shows how to control the model complexity by * increasing the influence of the model complexity term. -* In this example, the intermediate results from plane extraction and +* In this example, the intermediate results from plane extraction and * candidate generation are cached and reused. */ int main() { const std::string& input_file("data/building.ply"); - std::ifstream input_stream(input_file.c_str()); + std::ifstream input_stream(input_file.c_str()); - std::vector points; // store points + std::vector points; // store points - std::cout << "Loading point cloud: " << input_file << "..."; - CGAL::Timer t; - t.start(); + std::cout << "Loading point cloud: " << input_file << "..."; + CGAL::Timer t; + t.start(); - if (!input_stream || - !CGAL::read_ply_points_with_properties( - input_stream, - std::back_inserter(points), - CGAL::make_ply_point_reader(Point_map()), - CGAL::make_ply_normal_reader(Normal_map()), - std::make_pair(Plane_index_map(), CGAL::PLY_property("segment_index")))) - { - std::cerr << "Error: cannot read file " << input_file << std::endl; - return EXIT_FAILURE; - } - else - std::cout << " Done. " << points.size() << " points. Time: " << t.time() << " sec." << std::endl; + if (!input_stream || + !CGAL::read_ply_points_with_properties( + input_stream, + std::back_inserter(points), + CGAL::make_ply_point_reader(Point_map()), + CGAL::make_ply_normal_reader(Normal_map()), + std::make_pair(Plane_index_map(), CGAL::PLY_property("segment_index")))) + { + std::cerr << "Error: cannot read file " << input_file << std::endl; + return EXIT_FAILURE; + } + else + std::cout << " Done. " << points.size() << " points. Time: " << t.time() << " sec." << std::endl; - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////// - std::cout << "Generating candidate faces..."; - t.reset(); + std::cout << "Generating candidate faces..."; + t.reset(); - Polygonal_surface_reconstruction algo( - points, - Point_map(), - Normal_map(), - Plane_index_map() - ); + Polygonal_surface_reconstruction algo( + points, + Point_map(), + Normal_map(), + Plane_index_map() + ); - std::cout << " Done. Time: " << t.time() << " sec." << std::endl; + std::cout << " Done. Time: " << t.time() << " sec." << std::endl; - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////// - // Reconstruction with complexity control - - // Model 1: more detail - Surface_mesh model; + // Reconstruction with complexity control - std::cout << "Reconstructing with complexity 0.05..."; - t.reset(); - if (!algo.reconstruct(model, 0.8, 0.15, 0.05)) { - std::cerr << " Failed: " << algo.error_message() << std::endl; - return EXIT_FAILURE; - } - else { + // Model 1: more detail + Surface_mesh model; + + std::cout << "Reconstructing with complexity 0.05..."; + t.reset(); + if (!algo.reconstruct(model, 0.8, 0.15, 0.05)) { + std::cerr << " Failed: " << algo.error_message() << std::endl; + return EXIT_FAILURE; + } + else { const std::string& output_file = "data/building_result-0.05.off"; std::ofstream output_stream(output_file.c_str()); if (output_stream && CGAL::write_off(output_stream, model)) - std::cout << " Done. Saved to " << output_file << ". Time: " << t.time() << " sec." << std::endl; - else { + std::cout << " Done. Saved to " << output_file << ". Time: " << t.time() << " sec." << std::endl; + else { std::cerr << " Failed saving file." << std::endl; return EXIT_FAILURE; } - } + } - // Model 2: a little less detail - std::cout << "Reconstructing with complexity 0.5..."; - t.reset(); - if (!algo.reconstruct(model, 0.3, 0.2, 0.5)) { - std::cerr << " Failed: " << algo.error_message() << std::endl; - return EXIT_FAILURE; - } - else { + // Model 2: a little less detail + std::cout << "Reconstructing with complexity 0.5..."; + t.reset(); + if (!algo.reconstruct(model, 0.3, 0.2, 0.5)) { + std::cerr << " Failed: " << algo.error_message() << std::endl; + return EXIT_FAILURE; + } + else { const std::string& output_file = "data/building_result-0.5.off"; std::ofstream output_stream(output_file.c_str()); if (output_stream && CGAL::write_off(output_stream, model)) - std::cout << " Done. Saved to " << output_file << ". Time: " << t.time() << " sec." << std::endl; - else { + std::cout << " Done. Saved to " << output_file << ". Time: " << t.time() << " sec." << std::endl; + else { std::cerr << " Failed saving file." << std::endl; return EXIT_FAILURE; } - } + } - // Model 3: more less detail - std::cout << "Reconstructing with complexity 0.7..."; - t.reset(); - if (!algo.reconstruct(model, 0.2, 0.1, 0.7)) { - std::cerr << " Failed: " << algo.error_message() << std::endl; - return EXIT_FAILURE; - } - else { - const std::string& output_file = "data/building_result-0.7.off"; - std::ofstream output_stream(output_file.c_str()); - if (output_stream && CGAL::write_off(output_stream, model)) - std::cout << " Done. Saved to " << output_file << ". Time: " << t.time() << " sec." << std::endl; - else { - std::cerr << " Failed saving file." << std::endl; - return EXIT_FAILURE; - } - } - return EXIT_SUCCESS; + // Model 3: more less detail + std::cout << "Reconstructing with complexity 0.7..."; + t.reset(); + if (!algo.reconstruct(model, 0.2, 0.1, 0.7)) { + std::cerr << " Failed: " << algo.error_message() << std::endl; + return EXIT_FAILURE; + } + else { + const std::string& output_file = "data/building_result-0.7.off"; + std::ofstream output_stream(output_file.c_str()); + if (output_stream && CGAL::write_off(output_stream, model)) + std::cout << " Done. Saved to " << output_file << ". Time: " << t.time() << " sec." << std::endl; + else { + std::cerr << " Failed saving file." << std::endl; + return EXIT_FAILURE; + } + } + return EXIT_SUCCESS; } diff --git a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_user_provided_planes.cpp b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_user_provided_planes.cpp index e997b671ade..faf3425693d 100644 --- a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_user_provided_planes.cpp +++ b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_user_provided_planes.cpp @@ -7,10 +7,10 @@ #ifdef CGAL_USE_SCIP // defined (or not) by CMake scripts, do not define by hand #include -typedef CGAL::SCIP_mixed_integer_program_traits MIP_Solver; +typedef CGAL::SCIP_mixed_integer_program_traits MIP_Solver; #elif defined(CGAL_USE_GLPK) // defined (or not) by CMake scripts, do not define by hand #include -typedef CGAL::GLPK_mixed_integer_program_traits MIP_Solver; +typedef CGAL::GLPK_mixed_integer_program_traits MIP_Solver; #endif @@ -21,87 +21,87 @@ typedef CGAL::GLPK_mixed_integer_program_traits MIP_Solver; #include -typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; -typedef Kernel::Point_3 Point; -typedef Kernel::Vector_3 Vector; -typedef CGAL::Polygonal_surface_reconstruction Polygonal_surface_reconstruction; -typedef CGAL::Surface_mesh Surface_mesh; +typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; +typedef Kernel::Point_3 Point; +typedef Kernel::Vector_3 Vector; +typedef CGAL::Polygonal_surface_reconstruction Polygonal_surface_reconstruction; +typedef CGAL::Surface_mesh Surface_mesh; // Point with normal, and plane index -typedef boost::tuple PNI; -typedef CGAL::Nth_of_tuple_property_map<0, PNI> Point_map; -typedef CGAL::Nth_of_tuple_property_map<1, PNI> Normal_map; -typedef CGAL::Nth_of_tuple_property_map<2, PNI> Plane_index_map; +typedef boost::tuple PNI; +typedef CGAL::Nth_of_tuple_property_map<0, PNI> Point_map; +typedef CGAL::Nth_of_tuple_property_map<1, PNI> Normal_map; +typedef CGAL::Nth_of_tuple_property_map<2, PNI> Plane_index_map; /* * The following example shows the reconstruction using user-provided * planar segments stored in PLY format. In the PLY format, a property -* named "segment_index" stores the plane index for each point (-1 if -* the point is not assigned to a plane). +* named "segment_index" stores the plane index for each point (-1 if +* the point is not assigned to a plane). */ int main() { const std::string& input_file("data/ball.ply"); - std::ifstream input_stream(input_file.c_str()); + std::ifstream input_stream(input_file.c_str()); - std::vector points; // store points + std::vector points; // store points - std::cout << "Loading point cloud: " << input_file << "..."; - CGAL::Timer t; - t.start(); + std::cout << "Loading point cloud: " << input_file << "..."; + CGAL::Timer t; + t.start(); - if (!input_stream || - !CGAL::read_ply_points_with_properties( - input_stream, - std::back_inserter(points), - CGAL::make_ply_point_reader(Point_map()), - CGAL::make_ply_normal_reader(Normal_map()), - std::make_pair(Plane_index_map(), CGAL::PLY_property("segment_index")))) - { - std::cerr << "Error: cannot read file " << input_file << std::endl; - return EXIT_FAILURE; - } - else - std::cout << " Done. " << points.size() << " points. Time: " << t.time() << " sec." << std::endl; + if (!input_stream || + !CGAL::read_ply_points_with_properties( + input_stream, + std::back_inserter(points), + CGAL::make_ply_point_reader(Point_map()), + CGAL::make_ply_normal_reader(Normal_map()), + std::make_pair(Plane_index_map(), CGAL::PLY_property("segment_index")))) + { + std::cerr << "Error: cannot read file " << input_file << std::endl; + return EXIT_FAILURE; + } + else + std::cout << " Done. " << points.size() << " points. Time: " << t.time() << " sec." << std::endl; - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////// - std::cout << "Generating candidate faces..."; - t.reset(); + std::cout << "Generating candidate faces..."; + t.reset(); - Polygonal_surface_reconstruction algo( - points, - Point_map(), - Normal_map(), - Plane_index_map() - ); + Polygonal_surface_reconstruction algo( + points, + Point_map(), + Normal_map(), + Plane_index_map() + ); - std::cout << " Done. Time: " << t.time() << " sec." << std::endl; + std::cout << " Done. Time: " << t.time() << " sec." << std::endl; - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////// - Surface_mesh model; + Surface_mesh model; - std::cout << "Reconstructing..."; - t.reset(); + std::cout << "Reconstructing..."; + t.reset(); - if (!algo.reconstruct(model)) { - std::cerr << " Failed: " << algo.error_message() << std::endl; - return EXIT_FAILURE; - } + if (!algo.reconstruct(model)) { + std::cerr << " Failed: " << algo.error_message() << std::endl; + return EXIT_FAILURE; + } - // Saves the mesh model + // Saves the mesh model const std::string& output_file("data/ball_result.off"); std::ofstream output_stream(output_file.c_str()); if (output_stream && CGAL::write_off(output_stream, model)) - std::cout << " Done. Saved to " << output_file << ". Time: " << t.time() << " sec." << std::endl; - else { + std::cout << " Done. Saved to " << output_file << ". Time: " << t.time() << " sec." << std::endl; + else { std::cerr << " Failed saving file." << std::endl; return EXIT_FAILURE; } - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_with_region_growing.cpp b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_with_region_growing.cpp index 4cc561a8ae6..8a179c15410 100644 --- a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_with_region_growing.cpp +++ b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_with_region_growing.cpp @@ -15,7 +15,7 @@ typedef CGAL::SCIP_mixed_integer_program_traits MIP_Solver; #elif defined(CGAL_USE_GLPK) // defined (or not) by CMake scripts, do not define by hand #include -typedef CGAL::GLPK_mixed_integer_program_traits MIP_Solver; +typedef CGAL::GLPK_mixed_integer_program_traits MIP_Solver; #endif @@ -24,19 +24,19 @@ typedef CGAL::GLPK_mixed_integer_program_traits MIP_Solver; #include #include -typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; +typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; typedef Kernel::FT FT; -typedef Kernel::Point_3 Point; +typedef Kernel::Point_3 Point; typedef Kernel::Vector_3 Vector; // Point with normal, and plane index. typedef boost::tuple PNI; typedef std::vector Point_vector; -typedef CGAL::Nth_of_tuple_property_map<0, PNI> Point_map; -typedef CGAL::Nth_of_tuple_property_map<1, PNI> Normal_map; -typedef CGAL::Nth_of_tuple_property_map<2, PNI> Plane_index_map; +typedef CGAL::Nth_of_tuple_property_map<0, PNI> Point_map; +typedef CGAL::Nth_of_tuple_property_map<1, PNI> Normal_map; +typedef CGAL::Nth_of_tuple_property_map<2, PNI> Plane_index_map; typedef CGAL::Shape_detection::Point_set:: Sphere_neighbor_query Neighbor_query; @@ -45,8 +45,8 @@ Least_squares_plane_fit_region Regi typedef CGAL::Shape_detection:: Region_growing Region_growing; -typedef CGAL::Surface_mesh Surface_mesh; -typedef CGAL::Polygonal_surface_reconstruction Polygonal_surface_reconstruction; +typedef CGAL::Surface_mesh Surface_mesh; +typedef CGAL::Polygonal_surface_reconstruction Polygonal_surface_reconstruction; class Index_map { diff --git a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_without_input_planes.cpp b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_without_input_planes.cpp index cd37cc996f1..3ea369b445b 100644 --- a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_without_input_planes.cpp +++ b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_without_input_planes.cpp @@ -9,12 +9,12 @@ #ifdef CGAL_USE_SCIP // defined (or not) by CMake scripts, do not define by hand #include -typedef CGAL::SCIP_mixed_integer_program_traits MIP_Solver; +typedef CGAL::SCIP_mixed_integer_program_traits MIP_Solver; #elif defined(CGAL_USE_GLPK) // defined (or not) by CMake scripts, do not define by hand #include -typedef CGAL::GLPK_mixed_integer_program_traits MIP_Solver; +typedef CGAL::GLPK_mixed_integer_program_traits MIP_Solver; #endif @@ -26,127 +26,127 @@ typedef CGAL::GLPK_mixed_integer_program_traits MIP_Solver; #include -typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; +typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; -typedef Kernel::Point_3 Point; -typedef Kernel::Vector_3 Vector; +typedef Kernel::Point_3 Point; +typedef Kernel::Vector_3 Vector; // Point with normal, and plane index -typedef boost::tuple PNI; -typedef std::vector Point_vector; -typedef CGAL::Nth_of_tuple_property_map<0, PNI> Point_map; -typedef CGAL::Nth_of_tuple_property_map<1, PNI> Normal_map; -typedef CGAL::Nth_of_tuple_property_map<2, PNI> Plane_index_map; +typedef boost::tuple PNI; +typedef std::vector Point_vector; +typedef CGAL::Nth_of_tuple_property_map<0, PNI> Point_map; +typedef CGAL::Nth_of_tuple_property_map<1, PNI> Normal_map; +typedef CGAL::Nth_of_tuple_property_map<2, PNI> Plane_index_map; typedef CGAL::Shape_detection::Efficient_RANSAC_traits Traits; typedef CGAL::Shape_detection::Efficient_RANSAC Efficient_ransac; -typedef CGAL::Shape_detection::Plane Plane; +typedef CGAL::Shape_detection::Plane Plane; typedef CGAL::Shape_detection::Point_to_shape_index_map Point_to_shape_index_map; -typedef CGAL::Polygonal_surface_reconstruction Polygonal_surface_reconstruction; -typedef CGAL::Surface_mesh Surface_mesh; +typedef CGAL::Polygonal_surface_reconstruction Polygonal_surface_reconstruction; +typedef CGAL::Surface_mesh Surface_mesh; /* * This example first extracts planes from the input point cloud -* (using RANSAC with default parameters) and then reconstructs +* (using RANSAC with default parameters) and then reconstructs * the surface model from the planes. */ int main() { - Point_vector points; + Point_vector points; - // Loads point set from a file. - const std::string input_file("data/cube.pwn"); + // Loads point set from a file. + const std::string input_file("data/cube.pwn"); std::ifstream input_stream(input_file.c_str()); - if (input_stream.fail()) { - std::cerr << "failed open file \'" <(); + // Shape detection + Efficient_ransac ransac; + ransac.set_input(points); + ransac.add_shape_factory(); - std::cout << "Extracting planes..."; - t.reset(); - ransac.detect(); + std::cout << "Extracting planes..."; + t.reset(); + ransac.detect(); - Efficient_ransac::Plane_range planes = ransac.planes(); - std::size_t num_planes = planes.size(); + Efficient_ransac::Plane_range planes = ransac.planes(); + std::size_t num_planes = planes.size(); - std::cout << " Done. " << num_planes << " planes extracted. Time: " << t.time() << " sec." << std::endl; + std::cout << " Done. " << num_planes << " planes extracted. Time: " << t.time() << " sec." << std::endl; - // Stores the plane index of each point as the third element of the tuple. - Point_to_shape_index_map shape_index_map(points, planes); - for (std::size_t i = 0; i < points.size(); ++i) { - // Uses the get function from the property map that accesses the 3rd element of the tuple. - int plane_index = get(shape_index_map, i); - points[i].get<2>() = plane_index; - } + // Stores the plane index of each point as the third element of the tuple. + Point_to_shape_index_map shape_index_map(points, planes); + for (std::size_t i = 0; i < points.size(); ++i) { + // Uses the get function from the property map that accesses the 3rd element of the tuple. + int plane_index = get(shape_index_map, i); + points[i].get<2>() = plane_index; + } - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////// - std::cout << "Generating candidate faces..."; - t.reset(); + std::cout << "Generating candidate faces..."; + t.reset(); - Polygonal_surface_reconstruction algo( - points, - Point_map(), - Normal_map(), - Plane_index_map() - ); + Polygonal_surface_reconstruction algo( + points, + Point_map(), + Normal_map(), + Plane_index_map() + ); - std::cout << " Done. Time: " << t.time() << " sec." << std::endl; + std::cout << " Done. Time: " << t.time() << " sec." << std::endl; - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////// - Surface_mesh model; + Surface_mesh model; - std::cout << "Reconstructing..."; - t.reset(); + std::cout << "Reconstructing..."; + t.reset(); - if (!algo.reconstruct(model)) { - std::cerr << " Failed: " << algo.error_message() << std::endl; - return EXIT_FAILURE; - } + if (!algo.reconstruct(model)) { + std::cerr << " Failed: " << algo.error_message() << std::endl; + return EXIT_FAILURE; + } - const std::string& output_file("data/cube_result.off"); - std::ofstream output_stream(output_file.c_str()); - if (output_stream && CGAL::write_off(output_stream, model)) - std::cout << " Done. Saved to " << output_file << ". Time: " << t.time() << " sec." << std::endl; - else { - std::cerr << " Failed saving file." << std::endl; - return EXIT_FAILURE; - } + const std::string& output_file("data/cube_result.off"); + std::ofstream output_stream(output_file.c_str()); + if (output_stream && CGAL::write_off(output_stream, model)) + std::cout << " Done. Saved to " << output_file << ". Time: " << t.time() << " sec." << std::endl; + else { + std::cerr << " Failed saving file." << std::endl; + return EXIT_FAILURE; + } - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////// - // Also stores the candidate faces as a surface mesh to a file - Surface_mesh candidate_faces; - algo.output_candidate_faces(candidate_faces); - const std::string& candidate_faces_file("data/cube_candidate_faces.off"); - std::ofstream candidate_stream(candidate_faces_file.c_str()); - if (candidate_stream && CGAL::write_off(candidate_stream, candidate_faces)) - std::cout << "Candidate faces saved to " << candidate_faces_file << "." << std::endl; + // Also stores the candidate faces as a surface mesh to a file + Surface_mesh candidate_faces; + algo.output_candidate_faces(candidate_faces); + const std::string& candidate_faces_file("data/cube_candidate_faces.off"); + std::ofstream candidate_stream(candidate_faces_file.c_str()); + if (candidate_stream && CGAL::write_off(candidate_stream, candidate_faces)) + std::cout << "Candidate faces saved to " << candidate_faces_file << "." << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/Polygonal_surface_reconstruction/include/CGAL/internal/compute_confidences.h b/Polygonal_surface_reconstruction/include/CGAL/internal/compute_confidences.h index 51eadd3ce7c..e058e4790d7 100644 --- a/Polygonal_surface_reconstruction/include/CGAL/internal/compute_confidences.h +++ b/Polygonal_surface_reconstruction/include/CGAL/internal/compute_confidences.h @@ -29,218 +29,218 @@ typedef CGAL::Parallel_if_available_tag Concurrency_tag; namespace CGAL { namespace internal { - /** - * Computes the confidences of the candidate faces. - */ + /** + * Computes the confidences of the candidate faces. + */ - template - class Candidate_confidences - { - private: - typedef typename Kernel::FT FT; - typedef typename Kernel::Point_3 Point; - typedef typename Kernel::Point_2 Point2; - typedef typename Kernel::Vector_3 Vector; - typedef typename Kernel::Line_3 Line; - typedef typename Kernel::Segment_3 Segment; - typedef typename Kernel::Plane_3 Plane; - typedef CGAL::Polygon_2 Polygon; - typedef internal::Planar_segment Planar_segment; - typedef internal::Point_set_with_planes Point_set; - typedef CGAL::Surface_mesh Polygon_mesh; - typedef typename Polygon_mesh::Face_index Face_descriptor; - typedef typename Polygon_mesh::Edge_index Edge_descriptor; - typedef typename Polygon_mesh::Vertex_index Vertex_descriptor; - typedef typename Polygon_mesh::Halfedge_index Halfedge_descriptor; + template + class Candidate_confidences + { + private: + typedef typename Kernel::FT FT; + typedef typename Kernel::Point_3 Point; + typedef typename Kernel::Point_2 Point2; + typedef typename Kernel::Vector_3 Vector; + typedef typename Kernel::Line_3 Line; + typedef typename Kernel::Segment_3 Segment; + typedef typename Kernel::Plane_3 Plane; + typedef CGAL::Polygon_2 Polygon; + typedef internal::Planar_segment Planar_segment; + typedef internal::Point_set_with_planes Point_set; + typedef CGAL::Surface_mesh Polygon_mesh; + typedef typename Polygon_mesh::Face_index Face_descriptor; + typedef typename Polygon_mesh::Edge_index Edge_descriptor; + typedef typename Polygon_mesh::Vertex_index Vertex_descriptor; + typedef typename Polygon_mesh::Halfedge_index Halfedge_descriptor; - public: - Candidate_confidences() {} - ~Candidate_confidences() {} + public: + Candidate_confidences() {} + ~Candidate_confidences() {} - /// Computes the confidence values for each face - /// - supporting point number: stored as property 'f:num_supporting_points' - /// - face area: stored as property 'f:face_area' - /// - covered area: stored as property 'f:covered_area' - void compute(const Point_set& point_set, Polygon_mesh& mesh); + /// Computes the confidence values for each face + /// - supporting point number: stored as property 'f:num_supporting_points' + /// - face area: stored as property 'f:face_area' + /// - covered area: stored as property 'f:covered_area' + void compute(const Point_set& point_set, Polygon_mesh& mesh); - private: - // Returns the indices of the supporting point for 'face' - std::vector supporting_points(Face_descriptor face, const Polygon_mesh& mesh, const Point_set& point_set); + private: + // Returns the indices of the supporting point for 'face' + std::vector supporting_points(Face_descriptor face, const Polygon_mesh& mesh, const Point_set& point_set); - inline FT triangle_area(const Point& p1, const Point& p2, const Point& p3) const { - const Vector& orth = CGAL::cross_product(Vector(p1, p2), Vector(p1, p3)); - return std::sqrt(orth.squared_length()) * FT(0.5); - } + inline FT triangle_area(const Point& p1, const Point& p2, const Point& p3) const { + const Vector& orth = CGAL::cross_product(Vector(p1, p2), Vector(p1, p3)); + return std::sqrt(orth.squared_length()) * FT(0.5); + } - FT face_area(Face_descriptor f, const Polygon_mesh& mesh) const { - FT result(0); + FT face_area(Face_descriptor f, const Polygon_mesh& mesh) const { + FT result(0); - const typename Polygon_mesh::template Property_map& coords = mesh.points(); + const typename Polygon_mesh::template Property_map& coords = mesh.points(); - Halfedge_around_face_circulator cir(mesh.halfedge(f), mesh), done(cir); - Halfedge_descriptor p_hd = *cir; - Vertex_descriptor p_vd = mesh.target(p_hd); - const Point& p = coords[p_vd]; - ++cir; + Halfedge_around_face_circulator cir(mesh.halfedge(f), mesh), done(cir); + Halfedge_descriptor p_hd = *cir; + Vertex_descriptor p_vd = mesh.target(p_hd); + const Point& p = coords[p_vd]; + ++cir; - do { - Halfedge_descriptor q_hd = *cir; - Vertex_descriptor q_vd = mesh.target(q_hd); - const Point& q = coords[q_vd]; + do { + Halfedge_descriptor q_hd = *cir; + Vertex_descriptor q_vd = mesh.target(q_hd); + const Point& q = coords[q_vd]; - Halfedge_descriptor r_hd = mesh.next(q_hd); - Vertex_descriptor r_vd = mesh.target(r_hd); - const Point& r = coords[r_vd]; + Halfedge_descriptor r_hd = mesh.next(q_hd); + Vertex_descriptor r_vd = mesh.target(r_hd); + const Point& r = coords[r_vd]; - result += triangle_area(p, q, r); + result += triangle_area(p, q, r); - ++cir; - } while (cir != done); + ++cir; + } while (cir != done); - return result; - } - }; + return result; + } + }; - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////// - // implementation + // implementation - template - std::vector Candidate_confidences::supporting_points(Face_descriptor face, const Polygon_mesh& mesh, const Point_set& point_set) { - std::vector indices; + template + std::vector Candidate_confidences::supporting_points(Face_descriptor face, const Polygon_mesh& mesh, const Point_set& point_set) { + std::vector indices; - if (face == Polygon_mesh::null_face()) - return indices; + if (face == Polygon_mesh::null_face()) + return indices; - // The supporting planar segment of each face - typename Polygon_mesh::template Property_map face_supporting_segments = - mesh.template property_map("f:supp_segment").first; + // The supporting planar segment of each face + typename Polygon_mesh::template Property_map face_supporting_segments = + mesh.template property_map("f:supp_segment").first; - Planar_segment* segment = face_supporting_segments[face]; - if (segment == nullptr) - return indices; + Planar_segment* segment = face_supporting_segments[face]; + if (segment == nullptr) + return indices; - // The supporting plane of each face - typename Polygon_mesh::template Property_map face_supporting_planes = - mesh.template property_map("f:supp_plane").first; - // We do everything by projecting the point onto the face's supporting plane - const Plane* supporting_plane = face_supporting_planes[face]; - CGAL_assertion(supporting_plane == segment->supporting_plane()); + // The supporting plane of each face + typename Polygon_mesh::template Property_map face_supporting_planes = + mesh.template property_map("f:supp_plane").first; + // We do everything by projecting the point onto the face's supporting plane + const Plane* supporting_plane = face_supporting_planes[face]; + CGAL_assertion(supporting_plane == segment->supporting_plane()); - Polygon plg; // The projection of the face onto it supporting plane - const typename Polygon_mesh::template Property_map& coords = mesh.points(); - Halfedge_around_face_circulator cir(mesh.halfedge(face), mesh), done(cir); - do { - Halfedge_descriptor hd = *cir; - Vertex_descriptor vd = mesh.target(hd); - const Point& p = coords[vd]; - const Point2& q = supporting_plane->to_2d(p); + Polygon plg; // The projection of the face onto it supporting plane + const typename Polygon_mesh::template Property_map& coords = mesh.points(); + Halfedge_around_face_circulator cir(mesh.halfedge(face), mesh), done(cir); + do { + Halfedge_descriptor hd = *cir; + Vertex_descriptor vd = mesh.target(hd); + const Point& p = coords[vd]; + const Point2& q = supporting_plane->to_2d(p); - // Removes duplicated vertices - // The last point in the polygon - if (!plg.is_empty()) { - const Point2& r = plg[plg.size() - 1]; - if (CGAL::squared_distance(q, r) < CGAL::snap_squared_distance_threshold()) - continue; - } - plg.push_back(q); + // Removes duplicated vertices + // The last point in the polygon + if (!plg.is_empty()) { + const Point2& r = plg[plg.size() - 1]; + if (CGAL::squared_distance(q, r) < CGAL::snap_squared_distance_threshold()) + continue; + } + plg.push_back(q); - ++cir; - } while (cir != done); + ++cir; + } while (cir != done); - if (plg.size() < 3 || !plg.is_simple()) - return indices; + if (plg.size() < 3 || !plg.is_simple()) + return indices; - const typename Point_set::Point_map& points = point_set.point_map(); - for (std::size_t i = 0; i < segment->size(); ++i) { - std::size_t idx = segment->at(i); - const Point& p = points[idx]; - if (plg.bounded_side(supporting_plane->to_2d(p)) == CGAL::ON_BOUNDED_SIDE) - indices.push_back(idx); - } + const typename Point_set::Point_map& points = point_set.point_map(); + for (std::size_t i = 0; i < segment->size(); ++i) { + std::size_t idx = segment->at(i); + const Point& p = points[idx]; + if (plg.bounded_side(supporting_plane->to_2d(p)) == CGAL::ON_BOUNDED_SIDE) + indices.push_back(idx); + } - return indices; - } + return indices; + } - template - void Candidate_confidences::compute(const Point_set& point_set, Polygon_mesh& mesh) { - const unsigned int K = 6; + template + void Candidate_confidences::compute(const Point_set& point_set, Polygon_mesh& mesh) { + const unsigned int K = 6; - const typename Point_set::Point_map& points = point_set.point_map(); - FT avg_spacing = compute_average_spacing(points, K); + const typename Point_set::Point_map& points = point_set.point_map(); + FT avg_spacing = compute_average_spacing(points, K); - // The number of supporting points of each face - typename Polygon_mesh::template Property_map face_num_supporting_points = - mesh.template add_property_map("f:num_supporting_points").first; + // The number of supporting points of each face + typename Polygon_mesh::template Property_map face_num_supporting_points = + mesh.template add_property_map("f:num_supporting_points").first; - // The area of each face - typename Polygon_mesh::template Property_map face_areas = - mesh.template add_property_map("f:face_area").first; + // The area of each face + typename Polygon_mesh::template Property_map face_areas = + mesh.template add_property_map("f:face_area").first; - // The point covered area of each face - typename Polygon_mesh::template Property_map face_covered_areas = - mesh.template add_property_map("f:covered_area").first; + // The point covered area of each face + typename Polygon_mesh::template Property_map face_covered_areas = + mesh.template add_property_map("f:covered_area").first; - // The supporting plane of each face - typename Polygon_mesh::template Property_map face_supporting_planes = - mesh.template property_map("f:supp_plane").first; + // The supporting plane of each face + typename Polygon_mesh::template Property_map face_supporting_planes = + mesh.template property_map("f:supp_plane").first; - FT degenerate_face_area_threshold = CGAL::snap_squared_distance_threshold() * CGAL::snap_squared_distance_threshold(); + FT degenerate_face_area_threshold = CGAL::snap_squared_distance_threshold() * CGAL::snap_squared_distance_threshold(); for(auto f : mesh.faces()) { - const Plane* supporting_plane = face_supporting_planes[f]; - // Face area - FT area = face_area(f, mesh); - face_areas[f] = area; + const Plane* supporting_plane = face_supporting_planes[f]; + // Face area + FT area = face_area(f, mesh); + face_areas[f] = area; - if (area > degenerate_face_area_threshold) { - const std::vector& indices = supporting_points(f, mesh, point_set); - face_num_supporting_points[f] = indices.size(); + if (area > degenerate_face_area_threshold) { + const std::vector& indices = supporting_points(f, mesh, point_set); + face_num_supporting_points[f] = indices.size(); - std::vector pts; - for (std::size_t i = 0; i < indices.size(); ++i) { - std::size_t idx = indices[i]; - const Point& p = points[idx]; - pts.push_back(p); - } + std::vector pts; + for (std::size_t i = 0; i < indices.size(); ++i) { + std::size_t idx = indices[i]; + const Point& p = points[idx]; + pts.push_back(p); + } - FT covered_area(0); - Alpha_shape_mesh alpha_mesh(pts.begin(), pts.end(), *supporting_plane); - Polygon_mesh covering_mesh; - FT radius = avg_spacing * FT(5.0); - if (alpha_mesh.extract_mesh(radius * radius, covering_mesh)) { - // We cannot use the area of the 3D faces, because the alpha shape mesh is - // not perfectly planar - const typename Polygon_mesh::template Property_map& coords = covering_mesh.points(); + FT covered_area(0); + Alpha_shape_mesh alpha_mesh(pts.begin(), pts.end(), *supporting_plane); + Polygon_mesh covering_mesh; + FT radius = avg_spacing * FT(5.0); + if (alpha_mesh.extract_mesh(radius * radius, covering_mesh)) { + // We cannot use the area of the 3D faces, because the alpha shape mesh is + // not perfectly planar + const typename Polygon_mesh::template Property_map& coords = covering_mesh.points(); for(auto face : covering_mesh.faces()) { - // We have to use the projected version - Polygon plg; // the projection of the face onto it supporting plane - Halfedge_around_face_circulator cir(covering_mesh.halfedge(face), covering_mesh), done(cir); - do { - Halfedge_descriptor hd = *cir; - Vertex_descriptor vd = covering_mesh.target(hd); - const Point& p = coords[vd]; - const Point2& q = supporting_plane->to_2d(p); - plg.push_back(q); - ++cir; - } while (cir != done); - covered_area += std::abs(plg.area()); - } - } + // We have to use the projected version + Polygon plg; // the projection of the face onto it supporting plane + Halfedge_around_face_circulator cir(covering_mesh.halfedge(face), covering_mesh), done(cir); + do { + Halfedge_descriptor hd = *cir; + Vertex_descriptor vd = covering_mesh.target(hd); + const Point& p = coords[vd]; + const Point2& q = supporting_plane->to_2d(p); + plg.push_back(q); + ++cir; + } while (cir != done); + covered_area += std::abs(plg.area()); + } + } - face_covered_areas[f] = covered_area; - if (covered_area > area) - face_covered_areas[f] = area; - } - else { // For tiny faces, we can simple assign zero supporting points - face_num_supporting_points[f] = 0; - face_covered_areas[f] = FT(0.0); - } - } - } + face_covered_areas[f] = covered_area; + if (covered_area > area) + face_covered_areas[f] = area; + } + else { // For tiny faces, we can simple assign zero supporting points + face_num_supporting_points[f] = 0; + face_covered_areas[f] = FT(0.0); + } + } + } - } //namespace internal + } //namespace internal } //namespace CGAL diff --git a/Polygonal_surface_reconstruction/test/Polygonal_surface_reconstruction/CMakeLists.txt b/Polygonal_surface_reconstruction/test/Polygonal_surface_reconstruction/CMakeLists.txt index 9a88f8a5dc6..fb12c54a420 100644 --- a/Polygonal_surface_reconstruction/test/Polygonal_surface_reconstruction/CMakeLists.txt +++ b/Polygonal_surface_reconstruction/test/Polygonal_surface_reconstruction/CMakeLists.txt @@ -12,7 +12,7 @@ find_package( CGAL QUIET COMPONENTS ) if ( NOT CGAL_FOUND ) message(STATUS "NOTICE: This project requires the CGAL library, and will not be compiled.") - return() + return() endif() @@ -27,7 +27,7 @@ if ( NOT Boost_FOUND ) message(STATUS "NOTICE: This project requires the Boost library, and will not be compiled.") - return() + return() endif() diff --git a/Polyhedron/demo/Polyhedron/CMakeLists.txt b/Polyhedron/demo/Polyhedron/CMakeLists.txt index 6d3f9dc346f..6a60e678a8b 100644 --- a/Polyhedron/demo/Polyhedron/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/CMakeLists.txt @@ -54,7 +54,7 @@ list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}") # Find CGAL -option( POLYHEDRON_QTSCRIPT_DEBUGGER +option( POLYHEDRON_QTSCRIPT_DEBUGGER "Activate the use of Qt Script Debugger in Polyhedron_3 demo" OFF) # Find Qt5 itself @@ -148,7 +148,7 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND) NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH DOC "Path to CGAL/Three/Scene_item.h") - + if(CGAL_THREE_HEADERS_PATH) qt5_generate_moc( "${CGAL_THREE_HEADERS_PATH}/CGAL/Three/Viewer_interface.h" "${CMAKE_CURRENT_BINARY_DIR}/Viewer_interface_moc.cpp" ) @@ -258,7 +258,7 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND) add_item(scene_edit_box_item Plugins/PCA/Scene_edit_box_item.cpp ) add_item(scene_image_item Scene_image_item.cpp) add_item(scene_surface_mesh_item Scene_surface_mesh_item.cpp) - + if(TBB_FOUND) CGAL_target_use_TBB(scene_surface_mesh_item) endif() @@ -266,7 +266,7 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND) add_item(scene_item_decorator Scene_polyhedron_item_decorator.cpp ) target_link_libraries(scene_item_decorator PUBLIC scene_surface_mesh_item) - + add_item(scene_k_ring_selection Plugins/PMP/Scene_facegraph_item_k_ring_selection.cpp) target_link_libraries(scene_k_ring_selection PUBLIC scene_surface_mesh_item) @@ -280,7 +280,7 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND) target_link_libraries(scene_shortest_path_item PUBLIC scene_item_decorator scene_surface_mesh_item scene_polylines_item) add_item(scene_movable_sm_item Plugins/AABB_tree/Scene_movable_sm_item.cpp) - + if(EIGEN3_FOUND ) add_item(scene_textured_item Scene_textured_surface_mesh_item.cpp texture.cpp) CGAL_target_use_Eigen(scene_textured_item) @@ -302,12 +302,12 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND) add_item(scene_nef_polyhedron_item Scene_nef_polyhedron_item.cpp) target_link_libraries(scene_nef_polyhedron_item PUBLIC scene_surface_mesh_item) - + add_item(scene_points_with_normal_item Scene_points_with_normal_item.cpp) if (EIGEN3_FOUND) CGAL_target_use_Eigen(scene_points_with_normal_item) endif() - + find_package(LASLIB) if (LASLIB_FOUND) CGAL_target_use_LASLIB(scene_points_with_normal_item) @@ -315,17 +315,17 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND) target_compile_definitions( scene_points_with_normal_item PUBLIC "-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS") endif() endif() - + if(TBB_FOUND) CGAL_target_use_TBB(scene_points_with_normal_item) endif() add_item(scene_polylines_item Scene_polylines_item.cpp) target_link_libraries(scene_polylines_item PUBLIC scene_basic_objects scene_points_with_normal_item) - + add_item(scene_lcc_item Scene_lcc_item.cpp) - - foreach( lib + + foreach( lib demo_framework scene_basic_objects scene_color_ramp @@ -341,7 +341,7 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND) File_loader_dialog_moc.cpp Use_ssh.cpp ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES} - ${FileLoaderDialogUI_files} ${MainWindowUI_files} ${PreferencesUI_FILES} + ${FileLoaderDialogUI_files} ${MainWindowUI_files} ${PreferencesUI_FILES} ${statisticsUI_FILES} ${SubViewerUI_files}) target_link_libraries(polyhedron_demo PUBLIC demo_framework point_dialog Qt5::Gui Qt5::OpenGL Qt5::Widgets Qt5::Script) diff --git a/Polyhedron/demo/Polyhedron/MainWindow.cpp b/Polyhedron/demo/Polyhedron/MainWindow.cpp index e4d325c567c..e05962776a6 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.cpp +++ b/Polyhedron/demo/Polyhedron/MainWindow.cpp @@ -1022,12 +1022,12 @@ void MainWindow::computeViewerBBox(CGAL::qglviewer::Vec& min, CGAL::qglviewer::V max= CGAL::qglviewer::Vec(xmax, ymax, zmax); CGAL::qglviewer::Vec bbox_center((xmin+xmax)/2, (ymin+ymax)/2, (zmin+zmax)/2); - + double bbox_diag = CGAL::approximate_sqrt( CGAL::square(xmax - xmin) + CGAL::square(ymax - ymin) + CGAL::square(zmax - zmin)); - + CGAL::qglviewer::Vec offset(0,0,0); double l_dist = (std::max)((std::abs)(bbox_center.x - viewer->offset().x), @@ -2301,7 +2301,7 @@ void MainWindow::on_actionPreferences_triggered() this, [this](const QString& text){ this->s_defaultPSRM = CGAL::Three::Three::modeFromName(text); }); - + connect(prefdiag.backFrontColor_pushButton, &QPushButton::clicked, this, [](){ qobject_cast(CGAL::Three::Three::activeViewer())->setBackFrontColors(); @@ -3290,7 +3290,7 @@ void MainWindow::setupViewer(Viewer* viewer, SubViewer* subviewer) viewer->setShareCam(b, session); }); #endif - + } void MainWindow::on_actionAdd_Viewer_triggered() diff --git a/Polyhedron/demo/Polyhedron/MainWindow.h b/Polyhedron/demo/Polyhedron/MainWindow.h index b7650b52b34..3f3cb44b8a7 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.h +++ b/Polyhedron/demo/Polyhedron/MainWindow.h @@ -55,7 +55,7 @@ namespace Ui { * It contains all the widgets, the menus and the elements of interface * of the application.*/ -class MAINWINDOW_EXPORT MainWindow : +class MAINWINDOW_EXPORT MainWindow : public CGAL::Qt::DemosMainWindow, public Messages_interface, public CGAL::Three::Three, @@ -96,7 +96,7 @@ public: bool& ok, bool add_to_scene=true); void computeViewerBBox(CGAL::qglviewer::Vec &min, CGAL::qglviewer::Vec &max); - void updateViewerBbox(Viewer* vi, bool recenter, CGAL::qglviewer::Vec min, + void updateViewerBbox(Viewer* vi, bool recenter, CGAL::qglviewer::Vec min, CGAL::qglviewer::Vec max); Q_SIGNALS: //! Is emitted when the Application is closed. @@ -144,7 +144,7 @@ public Q_SLOTS: index of the item to be reloaded as data attached to the action. The index must identify a valid `Scene_item`.*/ void reloadItem(); - + //! Loads a script. Returns true if it worked. bool loadScript(QString filename); @@ -220,7 +220,7 @@ public Q_SLOTS: void addAction(QString actionName, QString actionText, QString menuName); - + /*! Sets the scene center to the target position and makes the * scene slide to this new center. Also sets the pivotPoint of * the camera to this position. @@ -346,10 +346,10 @@ protected Q_SLOTS: //!Opens the Preferences dialog. void on_actionPreferences_triggered(); //!Save selected items if able. - void on_action_Save_triggered(); + void on_action_Save_triggered(); // save as... //!Opens a dialog to save selected item if able. - void on_actionSaveAs_triggered(); + void on_actionSaveAs_triggered(); //!Calls the function save of the current plugin if able. void save(QString filename, QList& to_save); //!Calls the function saveSnapShot of the viewer. @@ -444,11 +444,11 @@ public: /*! Evaluates a script and search for uncaught exceptions. If quiet is false, prints the *backtrace of the uncaught exceptions. */ - void evaluate_script(QString script, + void evaluate_script(QString script, const QString & fileName = QString(), const bool quiet = false); //! Calls evaluate_script(script, filename, true). - void evaluate_script_quiet(QString script, + void evaluate_script_quiet(QString script, const QString & fileName = QString()); #endif public Q_SLOTS: @@ -472,11 +472,11 @@ private Q_SLOTS: void on_actionAdd_Viewer_triggered(); void on_action_Rearrange_Viewers_triggered(); void recenterViewer(); - + private: QMap action_menu_map; }; - + struct SubViewer : public QMdiSubWindow { Q_OBJECT diff --git a/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Cut_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Cut_plugin.cpp index d23ff947d9a..3b5862b0c9b 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Cut_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Cut_plugin.cpp @@ -745,7 +745,7 @@ private: default: break; } - + Tc* tc = getTriangleContainer(0); tc->allocate(Tc::Flat_vertices, positions_quad.data(), @@ -755,8 +755,8 @@ private: tex_map.data(), static_cast(tex_map.size()*sizeof(float))); tc->getTexture()->setData(texture->getData()); - - + + tc = getTriangleContainer(1); tc->allocate(Tc::Flat_vertices, positions_quad.data(), @@ -767,7 +767,7 @@ private: positions_lines.data(), static_cast(positions_lines.size()*sizeof(float))); setBuffersFilled(true); - + } void initializeBuffers(CGAL::Three::Viewer_interface *viewer) const Q_DECL_OVERRIDE diff --git a/Polyhedron/demo/Polyhedron/Plugins/Classification/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/Classification/CMakeLists.txt index f272d98b4cd..b4a49753ce2 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Classification/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/Classification/CMakeLists.txt @@ -9,7 +9,7 @@ if(EIGEN3_FOUND) message(STATUS "NOTICE: Boost Serialization not found. Classification plugin won't be available.") set(Classification_dependencies_met FALSE) endif() - + if (NOT Boost_IOSTREAMS_FOUND) message(STATUS "NOTICE: Boost IOStreams not found. Classification plugin won't be available.") set(Classification_dependencies_met FALSE) @@ -20,7 +20,7 @@ if(EIGEN3_FOUND) message(STATUS "NOTICE: OpenCV was not found. OpenCV random forest predicate for classification won't be available.") endif() - find_package(TensorFlow QUIET) + find_package(TensorFlow QUIET) if (NOT TensorFlow_FOUND) message(STATUS "NOTICE: TensorFlow not found, Neural Network predicate for classification won't be available.") endif() @@ -30,7 +30,7 @@ if(EIGEN3_FOUND) polyhedron_demo_plugin(classification_plugin Classification_plugin Point_set_item_classification Cluster_classification Surface_mesh_item_classification ${classificationUI_FILES} KEYWORDS Classification) target_link_libraries(classification_plugin PUBLIC scene_points_with_normal_item scene_polylines_item scene_polygon_soup_item scene_surface_mesh_item scene_selection_item scene_color_ramp) - + CGAL_target_use_Eigen(classification_plugin) CGAL_target_use_Boost_IOStreams(classification_plugin) CGAL_target_use_Boost_Serialization(classification_plugin) @@ -43,7 +43,7 @@ if(EIGEN3_FOUND) if(TBB_FOUND) CGAL_target_use_TBB(classification_plugin) endif() - + add_dependencies(classification_plugin point_set_selection_plugin selection_plugin) endif() diff --git a/Polyhedron/demo/Polyhedron/Plugins/Classification/Classification_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Classification/Classification_plugin.cpp index 7ae9229ba59..43202175065 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Classification/Classification_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Classification/Classification_plugin.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include #include @@ -60,13 +60,13 @@ class Polyhedron_demo_classification_plugin : Q_OBJECT Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") - + struct LabelButton { QPushButton* color_button; QMenu* menu; char shortcut; - + QColor color; QLabel* label2; @@ -79,13 +79,13 @@ class Polyhedron_demo_classification_plugin : : shortcut (shortcut), color (color) { color_button = new QPushButton (tr("%1 (%2)").arg(name).arg((char)(std::toupper(shortcut))), parent); - + menu = new QMenu("Label Menu", color_button); QColor text_color (255, 255, 255); if (color.red() * 0.299 + color.green() * 0.587 + color.blue() * 0.114 > 128) text_color = QColor (0, 0, 0); - + QString s("QPushButton { font-weight: bold; background: #" + QString(color.red() < 16? "0" : "") + QString::number(color.red(),16) + QString(color.green() < 16? "0" : "") + QString::number(color.green(),16) @@ -98,8 +98,8 @@ class Polyhedron_demo_classification_plugin : color_button->setStyleSheet(s); color_button->setMenu(menu); - - + + label2 = new QLabel (name, parent); effect = new QComboBox; effect->addItem("Penalized"); @@ -133,14 +133,14 @@ class Polyhedron_demo_classification_plugin : public: - bool applicable(QAction*) const { + bool applicable(QAction*) const { return qobject_cast(scene->item(scene->mainSelectionIndex())) || qobject_cast(scene->item(scene->mainSelectionIndex())); } void print_message(QString message) { CGAL::Three::Three::information(message); } QList actions() const { return QList() << actionClassification; } - + using Polyhedron_demo_plugin_helper::init; void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface* m) { @@ -165,7 +165,7 @@ public: SLOT(on_add_new_label_clicked())); label_menu->addSeparator(); - + QAction* use_config_building = label_menu->addAction ("Use configuration ground/vegetation/building"); connect(use_config_building, SIGNAL(triggered()), this, SLOT(on_use_config_building_clicked())); @@ -178,17 +178,17 @@ public: label_menu->addSeparator(); - + QAction* generate = label_menu->addAction ("Create one point set item per label"); connect(generate, SIGNAL(triggered()), this, SLOT(on_generate_items_button_clicked())); label_menu->addSeparator(); - + QAction* clear_labels = label_menu->addAction ("Clear labels"); connect(clear_labels, SIGNAL(triggered()), this, SLOT(on_clear_labels_clicked())); - + ui_widget.setupUi(dock_widget); ui_widget_adv.setupUi(dock_widget_adv); addDockWidget(dock_widget); @@ -207,7 +207,7 @@ public: action_reset_local = ui_widget.training_menu->addAction ("Reset training set of selection"); connect(action_reset_local, SIGNAL(triggered()), this, SLOT(on_reset_training_set_of_selection_clicked())); - + action_reset = ui_widget.training_menu->addAction ("Reset all training sets"); connect(action_reset, SIGNAL(triggered()), this, SLOT(on_reset_training_sets_clicked())); @@ -227,7 +227,7 @@ public: action_train->setShortcut(Qt::SHIFT | Qt::Key_T); connect(action_train, SIGNAL(triggered()), this, SLOT(on_train_clicked())); - + ui_widget.classifier_menu->addSeparator(); action_run = ui_widget.classifier_menu->addAction ("Classify"); @@ -252,11 +252,11 @@ public: SLOT(on_load_config_button_clicked())); ui_widget.classifier_menu->addSeparator(); - + QAction* switch_classifier = ui_widget.classifier_menu->addAction ("Switch to another classifier..."); connect(switch_classifier, SIGNAL(triggered()), this, SLOT(on_switch_classifier_clicked())); - + connect(ui_widget.display, SIGNAL(currentIndexChanged(int)), this, SLOT(on_display_button_clicked(int))); @@ -280,7 +280,7 @@ public: { connect(scene_obj, SIGNAL(itemAboutToBeDestroyed(CGAL::Three::Scene_item*)), this, SLOT(item_about_to_be_destroyed(CGAL::Three::Scene_item*))); - + connect(scene_obj, SIGNAL(itemIndexSelected(int)), this, SLOT(update_plugin(int))); } @@ -293,7 +293,7 @@ public: public Q_SLOTS: - + void item_about_to_be_destroyed(CGAL::Three::Scene_item* scene_item) { Item_map::iterator it = item_map.find(scene_item); if (it != item_map.end()) @@ -305,7 +305,7 @@ public Q_SLOTS: } void classification_action() - { + { dock_widget->show(); dock_widget->raise(); if (Scene_points_with_normal_item* points_item @@ -328,7 +328,7 @@ public Q_SLOTS: else print_message("Warning: can't find Surface Mesh Selection plugin"); } - + on_help_clicked(); } @@ -345,7 +345,7 @@ public Q_SLOTS: if (oknotok.exec() == QMessageBox::Yes) close_classification(); } - + void close_classification() { for (Item_map::iterator it = item_map.begin(); it != item_map.end(); ++ it) @@ -424,7 +424,7 @@ public Q_SLOTS: if (classif != NULL) { enable_computation(); - + // Clear class labels for (std::size_t i = 0; i < label_buttons.size(); ++ i) { @@ -445,7 +445,7 @@ public Q_SLOTS: classif->label_color(i), get_shortcut (i, classif->label(i)->name().c_str()))); add_label_button(); - + // Enabled classif if features computed if (classif->features_computed()) enable_classif(); @@ -483,7 +483,7 @@ public Q_SLOTS: = qobject_cast(item); if (selection_item) item = selection_item->polyhedron_item(); - + Item_map::iterator it = item_map.find(item); if (it != item_map.end()) @@ -495,7 +495,7 @@ public Q_SLOTS: return NULL; } - + Item_classification_base* create_from_item(Scene_points_with_normal_item* points_item) { @@ -503,14 +503,14 @@ public Q_SLOTS: return item_map[points_item]; bool use_clusters = false; - + if (points_item->point_set()->has_property_map ("shape")) { QMessageBox::StandardButton reply = QMessageBox::question(NULL, "Point Set Classification", "This point set is divided in clusters. Do you want to classify clusters instead of points?", QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes); - + use_clusters = (reply == QMessageBox::Yes); } @@ -523,7 +523,7 @@ public Q_SLOTS: classif = new Point_set_item_classification (points_item); item_map.insert (std::make_pair (points_item, classif)); - + QApplication::restoreOverrideCursor(); update_plugin_from_item(classif); return classif; @@ -557,7 +557,7 @@ public Q_SLOTS: std::cerr << "Error: unknown classifier" << std::endl; return -1; } - + void run (Item_classification_base* classif, int method, std::size_t subdivisions = 1, double smoothing = 0.5) @@ -611,9 +611,9 @@ public Q_SLOTS: if(!classif) { print_message("Error: there is no point set classification item!"); - return; + return; } - + QMultipleInputDialog dialog ("Compute Features", mw); QSpinBox* scales = dialog.add ("Number of scales:"); scales->setRange (1, 99); @@ -629,7 +629,7 @@ public Q_SLOTS: float vsize = float(voxel_size->value()); if (vsize == 0.f) vsize = -1.f; // auto value - + classif->compute_features (std::size_t(scales->value()), vsize); update_plugin_from_item(classif); @@ -644,7 +644,7 @@ public Q_SLOTS: if(!classif) { print_message("Error: there is no point set classification item!"); - return; + return; } QString filename; @@ -679,15 +679,15 @@ public Q_SLOTS: tr("%1 (CGAL Neural Network config).xml").arg(classif->item()->name()), "CGAL TensorFlow Neural Network classification configuration (*.xml);;"); #endif - + if (filename == QString()) return; - + QApplication::setOverrideCursor(Qt::WaitCursor); classif->save_config (filename.toStdString().c_str(), classifier); - + QApplication::restoreOverrideCursor(); } @@ -699,7 +699,7 @@ public Q_SLOTS: if(!classif) { print_message("Error: there is no point set classification item!"); - return; + return; } QString filename; @@ -742,7 +742,7 @@ public Q_SLOTS: update_plugin_from_item(classif); run (classif, 0); - + QApplication::restoreOverrideCursor(); item_changed(classif->item()); } @@ -751,7 +751,7 @@ public Q_SLOTS: { float vmin = std::numeric_limits::infinity(); float vmax = std::numeric_limits::infinity(); - + classif->change_color (index, &vmin, &vmax); if (vmin == std::numeric_limits::infinity() || vmax == std::numeric_limits::infinity()) @@ -768,17 +768,17 @@ public Q_SLOTS: ui_widget.maxDisplay->setEnabled(true); ui_widget.maxDisplay->setText(tr("Max (%1)").arg(vmax)); } - + item_changed(classif->item()); } - + void on_display_button_clicked(int index) { Item_classification_base* classif = get_classification(); if(!classif) - return; + return; change_color (classif, index); } @@ -813,7 +813,7 @@ public Q_SLOTS: if (vmin == std::numeric_limits::infinity() || vmax == std::numeric_limits::infinity()) return; - + bool ok = false; vmin = float(QInputDialog::getDouble((QWidget*)mw, tr("Set display ramp minimum value (saturate under):"), @@ -825,13 +825,13 @@ public Q_SLOTS: return; int index = ui_widget.display->currentIndex(); - + classif->change_color (index, &vmin, &vmax); ui_widget.minDisplay->setText(tr("Min* (%1)").arg(vmin)); - + item_changed(classif->item()); } - + void on_max_display_button_clicked() { Item_classification_base* classif @@ -845,7 +845,7 @@ public Q_SLOTS: if (vmin == std::numeric_limits::infinity() || vmax == std::numeric_limits::infinity()) return; - + bool ok = false; vmax = float(QInputDialog::getDouble((QWidget*)mw, tr("Set display ramp maximum value (saturate over):"), @@ -857,10 +857,10 @@ public Q_SLOTS: return; int index = ui_widget.display->currentIndex(); - + classif->change_color (index, &vmin, &vmax); ui_widget.maxDisplay->setText(tr("Max* (%1)").arg(vmax)); - + item_changed(classif->item()); } @@ -871,7 +871,7 @@ public Q_SLOTS: if(!classif) { print_message("Error: there is no point set classification item!"); - return; + return; } QApplication::setOverrideCursor(Qt::WaitCursor); CGAL::Real_timer t; @@ -890,7 +890,7 @@ public Q_SLOTS: if(!classif) { print_message("Error: there is no point set classification item!"); - return; + return; } QApplication::setOverrideCursor(Qt::WaitCursor); @@ -902,7 +902,7 @@ public Q_SLOTS: QApplication::restoreOverrideCursor(); item_changed(classif->item()); } - + void on_run_graphcut_button_clicked() { Item_classification_base* classif @@ -910,7 +910,7 @@ public Q_SLOTS: if(!classif) { print_message("Error: there is no point set classification item!"); - return; + return; } QMultipleInputDialog dialog ("Classify with Graph Cut", mw); @@ -924,7 +924,7 @@ public Q_SLOTS: if (dialog.exec() != QDialog::Accepted) return; - + QApplication::setOverrideCursor(Qt::WaitCursor); CGAL::Real_timer t; t.start(); @@ -942,11 +942,11 @@ public Q_SLOTS: if(!classif) { print_message("Error: there is no point set classification item!"); - return; + return; } QPushButton* label_clicked = qobject_cast(QObject::sender()->parent()->parent()); - + if (label_clicked == NULL) std::cerr << "Error" << std::endl; else @@ -972,7 +972,7 @@ public Q_SLOTS: scene->addItem (points_item); } } - + void on_generate_items_button_clicked() { Item_classification_base* classif @@ -980,10 +980,10 @@ public Q_SLOTS: if(!classif) { print_message("Error: there is no point set classification item!"); - return; + return; } - + QApplication::setOverrideCursor(Qt::WaitCursor); std::vector new_items; @@ -996,13 +996,13 @@ public Q_SLOTS: = qobject_cast(new_items[i]); if (!points_item) continue; - + if (points_item->point_set()->empty()) delete points_item; else scene->addItem (points_item); } - + QApplication::restoreOverrideCursor(); } @@ -1010,7 +1010,7 @@ public Q_SLOTS: { classif->clear_labels(); } - + void add_new_label (Item_classification_base* classif, const std::string& name) { add_new_label (LabelButton (dock_widget, @@ -1022,7 +1022,7 @@ public Q_SLOTS: QColor color = classif->add_new_label (name.c_str()); label_buttons.back().change_color (color); } - + void on_add_new_label_clicked() { Item_classification_base* classif @@ -1030,7 +1030,7 @@ public Q_SLOTS: if(!classif) { print_message("Error: there is no point set classification item!"); - return; + return; } bool ok; @@ -1061,7 +1061,7 @@ public Q_SLOTS: if(!classif) { print_message("Error: there is no point set classification item!"); - return; + return; } if (classif->number_of_labels() != 0) @@ -1070,7 +1070,7 @@ public Q_SLOTS: = QMessageBox::question(NULL, "Classification", "Current labels will be discarded. Continue?", QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes); - + if (reply == QMessageBox::No) return; } @@ -1088,7 +1088,7 @@ public Q_SLOTS: if(!classif) { print_message("Error: there is no point set classification item!"); - return; + return; } if (classif->number_of_labels() != 0) @@ -1097,7 +1097,7 @@ public Q_SLOTS: = QMessageBox::question(NULL, "Classification", "Current labels will be discarded. Continue?", QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes); - + if (reply == QMessageBox::No) return; } @@ -1116,7 +1116,7 @@ public Q_SLOTS: if(!classif) { print_message("Error: there is no point set classification item!"); - return; + return; } if (classif->number_of_labels() != 0) @@ -1125,7 +1125,7 @@ public Q_SLOTS: = QMessageBox::question(NULL, "Classification", "Current labels will be discarded. Continue?", QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes); - + if (reply == QMessageBox::No) return; } @@ -1157,7 +1157,7 @@ public Q_SLOTS: if(!classif) { print_message("Error: there is no point set classification item!"); - return; + return; } if (classif->number_of_labels() != 0) @@ -1166,7 +1166,7 @@ public Q_SLOTS: = QMessageBox::question(NULL, "Classification", "Current labels will be discarded. Continue?", QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes); - + if (reply == QMessageBox::No) return; } @@ -1181,7 +1181,7 @@ public Q_SLOTS: if(!classif) { print_message("Error: there is no point set classification item!"); - return; + return; } classif->reset_training_sets(); @@ -1196,7 +1196,7 @@ public Q_SLOTS: if(!classif) { print_message("Error: there is no point set classification item!"); - return; + return; } classif->reset_training_set_of_selection(); @@ -1211,7 +1211,7 @@ public Q_SLOTS: if(!classif) { print_message("Error: there is no point set classification item!"); - return; + return; } QPushButton* label_clicked = qobject_cast(QObject::sender()->parent()->parent()); @@ -1224,11 +1224,11 @@ public Q_SLOTS: ui_widget.labelGrid->getItemPosition(index, &row_index, &column_index, &row_span, &column_span); int position = row_index * 3 + column_index; - + classif->reset_training_set (position); } - + item_changed(classif->item()); } @@ -1239,7 +1239,7 @@ public Q_SLOTS: if(!classif) { print_message("Error: there is no point set classification item!"); - return; + return; } classif->validate_selection(); @@ -1252,7 +1252,7 @@ public Q_SLOTS: if(!classif) { print_message("Error: there is no point set classification item!"); - return; + return; } classif->select_random_region(); @@ -1261,10 +1261,10 @@ public Q_SLOTS: CGAL::Three::Viewer_interface* viewer = CGAL::Three::Three::activeViewer(); CGAL::Bbox_3 bbox = classif->bbox(); const CGAL::qglviewer::Vec offset = CGAL::Three::Three::mainViewer()->offset(); - + viewer->camera()->fitBoundingBox(CGAL::qglviewer::Vec (bbox.xmin(), bbox.ymin(), bbox.zmin()) + offset, CGAL::qglviewer::Vec (bbox.xmax(), bbox.ymax(), bbox.zmax()) + offset); - + viewer->camera()->setPivotPoint (CGAL::qglviewer::Vec ((bbox.xmin() + bbox.xmax()) / 2., @@ -1279,7 +1279,7 @@ public Q_SLOTS: if(!classif) { print_message("Error: there is no point set classification item!"); - return; + return; } QApplication::setOverrideCursor(Qt::WaitCursor); @@ -1298,20 +1298,20 @@ public Q_SLOTS: QRadioButton* ethz = dialog.add (CGAL_CLASSIFICATION_ETHZ_ID); ethz->setChecked(true); - + QRadioButton* sowf = dialog.add (CGAL_CLASSIFICATION_SOWF_ID); #ifdef CGAL_LINKED_WITH_TENSORFLOW QRadioButton* tensorflow = dialog.add (CGAL_CLASSIFICATION_TENSORFLOW_ID); #endif - + #ifdef CGAL_LINKED_WITH_OPENCV QRadioButton* opencv = dialog.add (CGAL_CLASSIFICATION_OPENCV_ID); #endif if (dialog.exec() != QDialog::Accepted) return; - + if (ethz->isChecked()) classifier->setText(CGAL_CLASSIFICATION_ETHZ_ID); else if (sowf->isChecked()) @@ -1333,7 +1333,7 @@ public Q_SLOTS: else dock_widget_adv->hide(); } - + void on_train_clicked() { Item_classification_base* classif @@ -1341,11 +1341,11 @@ public Q_SLOTS: if(!classif) { print_message("Error: there is no point set classification item!"); - return; + return; } QMultipleInputDialog dialog ("Train Classifier", mw); - + int classifier = get_classifier(); if (classifier == 0) // SOWF { @@ -1377,10 +1377,10 @@ public Q_SLOTS: QCheckBox* restart = dialog.add ("Restart from scratch: ", "restart"); restart->setChecked (false); } - + if (dialog.exec() != QDialog::Accepted) return; - + QApplication::setOverrideCursor(Qt::WaitCursor); CGAL::Real_timer t; t.start(); @@ -1394,7 +1394,7 @@ public Q_SLOTS: char get_shortcut (std::size_t position, const char* name) { std::set used_letters; - + used_letters.insert('t'); // used for "train" used_letters.insert('s'); // used for "random select" for (std::size_t i = 0; i < label_buttons.size(); ++ i) @@ -1416,7 +1416,7 @@ public Q_SLOTS: return fallback; } - + void add_new_label (const LabelButton& label_button) { label_buttons.push_back (label_button); @@ -1427,20 +1427,20 @@ public Q_SLOTS: ui_widget.labelGrid->addWidget (label_buttons.back().color_button, x, y); - QAction* add_selection = label_buttons.back().menu->addAction ("Add selection to training set"); + QAction* add_selection = label_buttons.back().menu->addAction ("Add selection to training set"); add_selection->setShortcut(Qt::SHIFT | (Qt::Key_A + (label_button.shortcut - 'a'))); // add_selection->setShortcut(Qt::Key_0 + label_buttons.size() - 1); - + connect(add_selection, SIGNAL(triggered()), this, SLOT(on_add_selection_to_training_set_clicked())); - + QAction* reset = label_buttons.back().menu->addAction ("Reset training set"); connect(reset, SIGNAL(triggered()), this, SLOT(on_reset_training_set_clicked())); label_buttons.back().menu->addSeparator(); - + QAction* change_color = label_buttons.back().menu->addAction ("Change color"); connect(change_color, SIGNAL(triggered()), this, SLOT(on_color_changed_clicked())); @@ -1483,7 +1483,7 @@ public Q_SLOTS: if(!classif) { print_message("Error: there is no point set classification item!"); - return; + return; } QPushButton* label_clicked = qobject_cast(QObject::sender()->parent()->parent()); @@ -1498,11 +1498,11 @@ public Q_SLOTS: int position = row_index * 3 + column_index; classif->remove_label (position); - + ui_widget.labelGrid->removeWidget (label_buttons[position].color_button); label_buttons[position].color_button->deleteLater(); label_buttons[position].menu->deleteLater(); - + ui_widget_adv.gridLayout->removeWidget (label_buttons[position].label2); delete label_buttons[position].label2; ui_widget_adv.gridLayout->removeWidget (label_buttons[position].effect); @@ -1514,7 +1514,7 @@ public Q_SLOTS: int position = i - 1; int x = position / 3; int y = position % 3; - + ui_widget.labelGrid->addWidget (label_buttons[i].color_button, x, y); ui_widget_adv.gridLayout->addWidget (label_buttons[i].label2, (int)i, 0); ui_widget_adv.gridLayout->addWidget (label_buttons[i].effect, (int)i, 2); @@ -1534,7 +1534,7 @@ public Q_SLOTS: if(!classif) { print_message("Error: there is no point set classification item!"); - return; + return; } QPushButton* label_clicked = qobject_cast(QObject::sender()->parent()->parent()); @@ -1547,13 +1547,13 @@ public Q_SLOTS: ui_widget.labelGrid->getItemPosition(index, &row_index, &column_index, &row_span, &column_span); int position = row_index * 3 + column_index; - + QColor color = label_buttons[position].color; color = QColorDialog::getColor(color, (QWidget*)mw, "Change color of label"); if (!color.isValid()) return; - + label_buttons[position].change_color (color); classif->change_label_color (position, color); @@ -1569,7 +1569,7 @@ public Q_SLOTS: if(!classif) { print_message("Error: there is no point set classification item!"); - return; + return; } QPushButton* label_clicked = qobject_cast(QObject::sender()->parent()->parent()); @@ -1582,7 +1582,7 @@ public Q_SLOTS: ui_widget.labelGrid->getItemPosition(index, &row_index, &column_index, &row_span, &column_span); int position = row_index * 3 + column_index; - + bool ok; QString name = QInputDialog::getText((QWidget*)mw, @@ -1597,7 +1597,7 @@ public Q_SLOTS: classif->change_label_name (position, name.toStdString()); } - + update_plugin_from_item(classif); classif->update_color (); item_changed(classif->item()); @@ -1610,7 +1610,7 @@ public Q_SLOTS: if(!classif) { print_message("Error: there is no point set classification item!"); - return; + return; } QPushButton* label_clicked = qobject_cast(QObject::sender()->parent()->parent()); @@ -1626,7 +1626,7 @@ public Q_SLOTS: classif->add_selection_to_training_set (position); } - + item_changed(classif->item()); } @@ -1635,11 +1635,11 @@ public Q_SLOTS: Item_classification_base* classif = get_classification(); if(!classif) - return; + return; if (classif->number_of_features() <= (std::size_t)v) return; - + Item_classification_base::Feature_handle att = classif->feature(v); @@ -1669,7 +1669,7 @@ public Q_SLOTS: if(!classif) { print_message("Error: there is no point set classification item!"); - return; + return; } Item_classification_base::Feature_handle att = classif->feature(ui_widget_adv.selected_feature->currentIndex()); @@ -1690,7 +1690,7 @@ public Q_SLOTS: if(!classif) { print_message("Error: there is no point set classification item!"); - return; + return; } Item_classification_base::Feature_handle att = classif->feature(ui_widget_adv.selected_feature->currentIndex()); @@ -1741,10 +1741,10 @@ private: QAction* action_run_graphcut; QAction* action_save_config; QAction* action_load_config; - + std::vector label_buttons; QPushButton* label_button; - + Ui::Classification ui_widget; Ui::ClassificationAdvanced ui_widget_adv; diff --git a/Polyhedron/demo/Polyhedron/Plugins/Classification/Cluster_classification.cpp b/Polyhedron/demo/Polyhedron/Plugins/Classification/Cluster_classification.cpp index 2db5ec4b353..82aa38732c7 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Classification/Cluster_classification.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Classification/Cluster_classification.cpp @@ -51,7 +51,7 @@ Cluster_classification::Cluster_classification(Scene_points_with_normal_item* po bool classif_found = false; boost::tie (m_classif, classif_found) = m_points->point_set()->add_property_map("label", -1); - training_found = !training_found; // add_property_map returns false if + training_found = !training_found; // add_property_map returns false if classif_found = !classif_found; // property was already there bool las_found = false; @@ -76,11 +76,11 @@ Cluster_classification::Cluster_classification(Scene_points_with_normal_item* po training_found = true; } } - + if (training_found || classif_found) { std::vector used_indices; - + for (Point_set::const_iterator it = m_points->point_set()->begin(); it != m_points->point_set()->first_selected(); ++ it) { @@ -122,12 +122,12 @@ Cluster_classification::Cluster_classification(Scene_points_with_normal_item* po ++ current_idx; } - + for (Point_set::const_iterator it = m_points->point_set()->begin(); it != m_points->point_set()->first_selected(); ++ it) { int c = m_cluster_id[*it]; - + if (training_found) { if (std::size_t(current_idx) != used_indices.size()) // Empty indices -> reorder indices in point set @@ -153,7 +153,7 @@ Cluster_classification::Cluster_classification(Scene_points_with_normal_item* po m_clusters[c].label() = m_classif[*it]; } } - + std::map label_names; if (las_found) // Use LAS standard { @@ -196,7 +196,7 @@ Cluster_classification::Cluster_classification(Scene_points_with_normal_item* po } } } - + for (std::size_t i = 0; i < used_indices.size(); ++ i) { if (used_indices[i] == -1) @@ -227,7 +227,7 @@ Cluster_classification::Cluster_classification(Scene_points_with_normal_item* po for (std::size_t i = 0; i < m_labels.size(); ++ i) m_label_colors.push_back (this->get_new_label_color (m_labels[i]->name())); } - + update_comments_of_point_set_item(); m_sowf = new Sum_of_weighted_features (m_labels, m_features); @@ -255,7 +255,7 @@ Cluster_classification::Cluster_classification(Scene_points_with_normal_item* po m_cluster_id))); std::set > adjacencies; - + for (Delaunay::Finite_edges_iterator it = dt.finite_edges_begin(); it != dt.finite_edges_end(); ++ it) { @@ -314,13 +314,13 @@ Cluster_classification::~Cluster_classification() m_classif[*it] = -1; } } - + // For LAS saving, convert classification info in the LAS standard // if (m_input_is_las) { Point_set::Property_map las_classif = m_points->point_set()->add_property_map("classification", 0).first; - + std::vector label_indices; unsigned char custom = 19; @@ -371,14 +371,14 @@ Cluster_classification::~Cluster_classification() unsigned char lc = 1; // unclassified in LAS standard if (c != -1) lc = label_indices[std::size_t(c)]; - + las_classif[*it] = lc; int t = m_training[*it]; unsigned char lt = 1; // unclassified in LAS standard if (t != -1) lt = label_indices[std::size_t(t)]; - + m_training[*it] = int(lt); } @@ -405,7 +405,7 @@ void Cluster_classification::backup_existing_colors_and_add_new() m_points->point_set()->remove_colors(); } - + m_points->point_set()->add_colors(); } @@ -418,7 +418,7 @@ void Cluster_classification::reset_colors() for (Point_set::const_iterator it = m_points->point_set()->begin(); it != m_points->point_set()->first_selected(); ++ it) m_points->point_set()->set_color(*it, m_color[*it]); - + m_points->point_set()->remove_property_map(m_color); } } @@ -428,19 +428,19 @@ void Cluster_classification::change_color (int index, float* vmin, float* vmax) m_index_color = index; int index_color = real_index_color(); - + // Colors static Color_ramp ramp; ramp.build_rainbow(); reset_indices(); - + if (index_color == -1) // item color m_points->point_set()->remove_colors(); else { if (!m_points->point_set()->has_colors()) m_points->point_set()->add_colors(); - + if (index_color == 0) // real colors { @@ -458,11 +458,11 @@ void Cluster_classification::change_color (int index, float* vmin, float* vmax) if (cid != -1) { std::size_t c = m_clusters[cid].label(); - + if (c != std::size_t(-1)) color = m_label_colors[c]; } - + m_points->point_set()->set_color(*it, color); } } @@ -474,18 +474,18 @@ void Cluster_classification::change_color (int index, float* vmin, float* vmax) QColor color (0, 0, 0); int cid = m_cluster_id[*it]; float div = 1; - + if (cid != -1) { int c = m_clusters[cid].training(); int c2 = m_clusters[cid].label(); - + if (c != -1) color = m_label_colors[std::size_t(c)]; - + if (c != c2) div = 2; - } + } m_points->point_set()->set_color(*it, color.red() / div, color.green() / div, color.blue() / div); } } @@ -495,7 +495,7 @@ void Cluster_classification::change_color (int index, float* vmin, float* vmax) it != m_points->point_set()->first_selected(); ++ it) { int cid = m_cluster_id[*it]; - + if (cid != -1) { srand(cid); @@ -548,7 +548,7 @@ void Cluster_classification::change_color (int index, float* vmin, float* vmax) float min = std::numeric_limits::max(); float max = -std::numeric_limits::max(); - + if (vmin != NULL && vmax != NULL && *vmin != std::numeric_limits::infinity() && *vmax != std::numeric_limits::infinity()) @@ -571,7 +571,7 @@ void Cluster_classification::change_color (int index, float* vmin, float* vmax) } } } - + for (Point_set::const_iterator it = m_points->point_set()->begin(); it != m_points->point_set()->first_selected(); ++ it) { @@ -581,7 +581,7 @@ void Cluster_classification::change_color (int index, float* vmin, float* vmax) float v = (feature->value(cid) - min) / (max - min); if (v < 0.f) v = 0.f; if (v > 1.f) v = 1.f; - + m_points->point_set()->set_color(*it, ramp.r(v) * 255, ramp.g(v) * 255, ramp.b(v) * 255); } else @@ -596,7 +596,7 @@ void Cluster_classification::change_color (int index, float* vmin, float* vmax) } } } - + for (Point_set::const_iterator it = m_points->point_set()->first_selected(); it != m_points->point_set()->end(); ++ it) m_points->point_set()->set_color(*it, 255, 0, 0); @@ -605,7 +605,7 @@ void Cluster_classification::change_color (int index, float* vmin, float* vmax) int Cluster_classification::real_index_color() const { int out = m_index_color; - + if (out == 0 && m_color == Point_set::Property_map()) out = -1; return out; @@ -628,7 +628,7 @@ void Cluster_classification::compute_features (std::size_t nb_scales, float voxe CGAL_assertion (!(m_points->point_set()->empty())); reset_indices(); - + std::cerr << "Computing pointwise features with " << nb_scales << " scale(s) and "; if (voxel_size == -1) std::cerr << "automatic voxel size" << std::endl; @@ -641,9 +641,9 @@ void Cluster_classification::compute_features (std::size_t nb_scales, float voxe bool normals = m_points->point_set()->has_normal_map(); if (normals) normal_map = m_points->point_set()->normal_map(); - + bool colors = (m_color != Point_set::Property_map()); - + Point_set::Property_map echo_map; bool echo; boost::tie (echo_map, echo) = m_points->point_set()->template property_map("echo"); @@ -653,10 +653,10 @@ void Cluster_classification::compute_features (std::size_t nb_scales, float voxe Feature_set pointwise_features; Generator generator (*(m_points->point_set()), m_points->point_set()->point_map(), nb_scales, voxel_size); - + CGAL::Real_timer t; t.start(); - + #ifdef CGAL_LINKED_WITH_TBB pointwise_features.begin_parallel_additions(); #endif @@ -668,11 +668,11 @@ void Cluster_classification::compute_features (std::size_t nb_scales, float voxe generator.generate_color_based_features (pointwise_features, m_color); if (echo) generator.generate_echo_based_features (pointwise_features, echo_map); - + #ifdef CGAL_LINKED_WITH_TBB pointwise_features.end_parallel_additions(); #endif - + add_remaining_point_set_properties_as_features(pointwise_features); t.stop(); @@ -691,29 +691,29 @@ void Cluster_classification::compute_features (std::size_t nb_scales, float voxe m_features.template add (m_clusters, pointwise_features[i]); } - + #ifdef CGAL_LINKED_WITH_TBB m_features.end_parallel_additions(); m_features.begin_parallel_additions(); #endif - + for (std::size_t i = 0; i < pointwise_features.size(); ++ i) { m_features.template add (m_clusters, pointwise_features[i], m_features[i]); - } - + } + add_cluster_features(); #ifdef CGAL_LINKED_WITH_TBB m_features.end_parallel_additions(); #endif - + t.stop(); std::cerr << m_features.size() << " feature(s) computed in " << t.time() << " second(s)" << std::endl; - + delete m_sowf; m_sowf = new Sum_of_weighted_features (m_labels, m_features); if (m_ethz != NULL) @@ -755,7 +755,7 @@ void Cluster_classification::select_random_region() selected.push_back (*it); else unselected.push_back (*it); - + for (std::size_t i = 0; i < unselected.size(); ++ i) *(m_points->point_set()->begin() + i) = unselected[i]; for (std::size_t i = 0; i < selected.size(); ++ i) @@ -763,13 +763,13 @@ void Cluster_classification::select_random_region() m_points->point_set()->set_first_selected (m_points->point_set()->begin() + unselected.size()); - + } void Cluster_classification::add_remaining_point_set_properties_as_features(Feature_set& feature_set) { const std::vector& prop = m_points->point_set()->base().properties(); - + for (std::size_t i = 0; i < prop.size(); ++ i) { if (prop[i] == "index" || @@ -821,7 +821,7 @@ void Cluster_classification::train(int classifier, const QMultipleInputDialog& d std::vector nb_label (m_labels.size(), 0); std::size_t nb_total = 0; - + std::vector training; training.reserve (m_clusters.size()); for (std::size_t i = 0; i < m_clusters.size(); ++ i) @@ -833,12 +833,12 @@ void Cluster_classification::train(int classifier, const QMultipleInputDialog& d ++ nb_total; } } - + std::cerr << nb_total << " cluster(s) used for training (" << 100. * (nb_total / double(m_clusters.size())) << "% of the total):" << std::endl; for (std::size_t i = 0; i < m_labels.size(); ++ i) std::cerr << " * " << m_labels[i]->name() << ": " << nb_label[i] << " clusters(s)" << std::endl; - + std::vector indices (m_clusters.size(), -1); if (classifier == 0) @@ -906,14 +906,14 @@ void Cluster_classification::train(int classifier, const QMultipleInputDialog& d while (iss >> s) hidden_layers.push_back (std::size_t(s)); } - + m_neural_network->train (training, dialog.get("restart")->isChecked(), dialog.get("trials")->value(), dialog.get("learning_rate")->value(), dialog.get("batch_size")->value(), hidden_layers); - + CGAL::Classification::classify (m_clusters, m_labels, *m_neural_network, indices, m_label_probabilities); @@ -922,7 +922,7 @@ void Cluster_classification::train(int classifier, const QMultipleInputDialog& d for (std::size_t i = 0; i < m_clusters.size(); ++ i) m_clusters[i].label() = indices[i]; - + if (m_index_color == 1 || m_index_color == 2) change_color (m_index_color); } @@ -971,7 +971,7 @@ bool Cluster_classification::run (int method, int classifier, run (method, *m_neural_network, subdivisions, smoothing); #endif } - + return true; } diff --git a/Polyhedron/demo/Polyhedron/Plugins/Classification/Cluster_classification.h b/Polyhedron/demo/Polyhedron/Plugins/Classification/Cluster_classification.h index 090827a4c89..df0d0ceca21 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Classification/Cluster_classification.h +++ b/Polyhedron/demo/Polyhedron/Plugins/Classification/Cluster_classification.h @@ -22,7 +22,7 @@ class Cluster_classification : public Item_classification_base public: typedef Kernel::Point_3 Point_3; typedef Kernel::Vector_3 Vector_3; - + typedef Point_set::Point_map Point_map; typedef Point_set::Vector_map Vector_map; @@ -50,11 +50,11 @@ class Cluster_classification : public Item_classification_base { return std::make_pair (point_set->point(idx), (*cluster_id)[idx]); } - + }; public: - + Cluster_classification(Scene_points_with_normal_item* points); ~Cluster_classification(); @@ -82,7 +82,7 @@ class Cluster_classification : public Item_classification_base double dx = bb.xmax() - bb.xmin(); double dy = bb.ymax() - bb.ymin(); double dz = bb.zmax() - bb.zmin(); - + dx *= 10.; dy *= 10.; dz *= 10.; @@ -93,7 +93,7 @@ class Cluster_classification : public Item_classification_base void compute_features (std::size_t nb_scales, float voxel_size); void add_remaining_point_set_properties_as_features(Feature_set& feature_set); - + void select_random_region(); void add_cluster_features () @@ -108,7 +108,7 @@ class Cluster_classification : public Item_classification_base m_features.template add (m_clusters, *m_eigen, 0); m_features.template add (m_clusters, *m_eigen, 1); m_features.template add (m_clusters, *m_eigen, 2); - + // m_features.template add (m_clusters, *m_eigen); // m_features.template add (m_clusters, *m_eigen); // m_features.template add (m_clusters, *m_eigen); @@ -119,7 +119,7 @@ class Cluster_classification : public Item_classification_base // m_features.template add (m_clusters, *m_eigen); // m_features.template add > (m_clusters, *m_eigen); } - + template bool try_adding_simple_feature (Feature_set& feature_set, const std::string& name) { @@ -133,7 +133,7 @@ class Cluster_classification : public Item_classification_base return okay; } - + void add_selection_to_training_set (std::size_t label) { for (Point_set::const_iterator it = m_points->point_set()->first_selected(); @@ -206,7 +206,7 @@ class Cluster_classification : public Item_classification_base { Scene_points_with_normal_item* points_item = new Scene_points_with_normal_item; - + points_item->setName (QString("%1 (%2)").arg(name).arg(m_labels[label]->name().c_str())); points_item->setColor (m_label_colors[label]); for (Point_set::const_iterator it = m_points->point_set()->begin(); @@ -247,7 +247,7 @@ class Cluster_classification : public Item_classification_base } } - + QColor add_new_label (const char* name) { QColor out = Item_classification_base::add_new_label (name); @@ -258,14 +258,14 @@ class Cluster_classification : public Item_classification_base void remove_label (std::size_t position) { Item_classification_base::remove_label (position); - + for (std::size_t i = 0; i < m_clusters.size(); ++ i) { if (m_clusters[i].training() == int(position)) m_clusters[i].training() = -1; else if (m_clusters[i].training() > int(position)) m_clusters[i].training() --; - + if (m_clusters[i].label() == int(position)) m_clusters[i].label() = -1; else if (m_clusters[i].label() > int(position)) @@ -274,7 +274,7 @@ class Cluster_classification : public Item_classification_base update_comments_of_point_set_item(); } - + void fill_display_combo_box (QComboBox* cb, QComboBox* cb1) const { cb->addItem ("Clusters"); @@ -291,10 +291,10 @@ class Cluster_classification : public Item_classification_base void update_comments_of_point_set_item() { std::string& comments = m_points->comments(); - + // Remove previously registered labels from comments std::string new_comment; - + std::istringstream stream (comments); std::string line; while (getline(stream, line)) @@ -315,7 +315,7 @@ class Cluster_classification : public Item_classification_base comments += oss.str(); } } - + template bool run (int method, const Classifier& classifier, std::size_t subdivisions, double smoothing) @@ -347,14 +347,14 @@ class Cluster_classification : public Item_classification_base m_clusters[i].label() = indices[i]; ground_truth[i] = m_clusters[i].training(); } - + if (m_index_color == 1 || m_index_color == 2) change_color (m_index_color); std::cerr << "Precision, recall, F1 scores and IoU:" << std::endl; - + CGAL::Classification::Evaluation eval (m_labels, ground_truth, indices); - + for (std::size_t i = 0; i < m_labels.size(); ++ i) { std::cerr << " * " << m_labels[i]->name() << ": " @@ -383,15 +383,15 @@ class Cluster_classification : public Item_classification_base Point_set::Property_map m_cluster_id; Point_set::Property_map m_training; Point_set::Property_map m_classif; - + std::vector > m_label_probabilities; - + int m_index_color; boost::shared_ptr m_eigen; bool m_input_is_las; - + }; // end class Cluster_classification diff --git a/Polyhedron/demo/Polyhedron/Plugins/Classification/Point_set_item_classification.cpp b/Polyhedron/demo/Polyhedron/Plugins/Classification/Point_set_item_classification.cpp index feb5779e208..1f92b21b7e3 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Classification/Point_set_item_classification.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Classification/Point_set_item_classification.cpp @@ -48,7 +48,7 @@ Point_set_item_classification::Point_set_item_classification(Scene_points_with_n bool classif_found = false; boost::tie (m_classif, classif_found) = m_points->point_set()->add_property_map("label", -1); - training_found = !training_found; // add_property_map returns false if + training_found = !training_found; // add_property_map returns false if classif_found = !classif_found; // property was already there bool las_found = false; @@ -73,11 +73,11 @@ Point_set_item_classification::Point_set_item_classification(Scene_points_with_n training_found = true; } } - + if (training_found || classif_found) { std::vector used_indices; - + for (Point_set::const_iterator it = m_points->point_set()->begin(); it != m_points->point_set()->first_selected(); ++ it) { @@ -140,7 +140,7 @@ Point_set_item_classification::Point_set_item_classification(Scene_points_with_n } } } - + std::map label_names; if (las_found) // Use LAS standard { @@ -183,7 +183,7 @@ Point_set_item_classification::Point_set_item_classification(Scene_points_with_n } } } - + for (std::size_t i = 0; i < used_indices.size(); ++ i) { if (used_indices[i] == -1) @@ -214,7 +214,7 @@ Point_set_item_classification::Point_set_item_classification(Scene_points_with_n for (std::size_t i = 0; i < m_labels.size(); ++ i) m_label_colors.push_back (this->get_new_label_color (m_labels[i]->name())); } - + update_comments_of_point_set_item(); m_sowf = new Sum_of_weighted_features (m_labels, m_features); @@ -251,7 +251,7 @@ Point_set_item_classification::~Point_set_item_classification() { Point_set::Property_map las_classif = m_points->point_set()->add_property_map("classification", 0).first; - + std::vector label_indices; unsigned char custom = 19; @@ -302,14 +302,14 @@ Point_set_item_classification::~Point_set_item_classification() unsigned char lc = 1; // unclassified in LAS standard if (c != -1) lc = label_indices[std::size_t(c)]; - + las_classif[*it] = lc; int t = m_training[*it]; unsigned char lt = 1; // unclassified in LAS standard if (t != -1) lt = label_indices[std::size_t(t)]; - + m_training[*it] = int(lt); } @@ -359,19 +359,19 @@ void Point_set_item_classification::change_color (int index, float* vmin, float* m_index_color = index; int index_color = real_index_color(); - + // Colors static Color_ramp ramp; ramp.build_rainbow(); reset_indices(); - + if (index_color == -1) // item color m_points->point_set()->remove_colors(); else { if (!m_points->point_set()->has_colors()) m_points->point_set()->add_colors(); - + if (index_color == 0) // real colors { @@ -386,7 +386,7 @@ void Point_set_item_classification::change_color (int index, float* vmin, float* { QColor color (0, 0, 0); std::size_t c = m_classif[*it]; - + if (c != std::size_t(-1)) color = m_label_colors[c]; @@ -401,10 +401,10 @@ void Point_set_item_classification::change_color (int index, float* vmin, float* QColor color (0, 0, 0); int c = m_training[*it]; int c2 = m_classif[*it]; - + if (c != -1) color = m_label_colors[std::size_t(c)]; - + float div = 1; if (c != c2) div = 2; @@ -443,7 +443,7 @@ void Point_set_item_classification::change_color (int index, float* vmin, float* return; } Feature_handle feature = m_features[corrected_index]; - + float min = std::numeric_limits::max(); float max = -std::numeric_limits::max(); @@ -471,7 +471,7 @@ void Point_set_item_classification::change_color (int index, float* vmin, float* float v = (feature->value(*it) - min) / (max - min); if (v < 0.f) v = 0.f; if (v > 1.f) v = 1.f; - + m_points->point_set()->set_color(*it, ramp.r(v) * 255, ramp.g(v) * 255, ramp.b(v) * 255); } @@ -483,7 +483,7 @@ void Point_set_item_classification::change_color (int index, float* vmin, float* } } } - + for (Point_set::const_iterator it = m_points->point_set()->first_selected(); it != m_points->point_set()->end(); ++ it) m_points->point_set()->set_color(*it, 255, 0, 0); @@ -492,7 +492,7 @@ void Point_set_item_classification::change_color (int index, float* vmin, float* int Point_set_item_classification::real_index_color() const { int out = m_index_color; - + if (out == 0 && m_color == Point_set::Property_map()) out = -1; return out; @@ -518,7 +518,7 @@ void Point_set_item_classification::compute_features (std::size_t nb_scales, flo delete m_generator; reset_indices(); - + std::cerr << "Computing features with " << nb_scales << " scale(s) and "; if (voxel_size == -1) std::cerr << "automatic voxel size" << std::endl; @@ -531,9 +531,9 @@ void Point_set_item_classification::compute_features (std::size_t nb_scales, flo bool normals = m_points->point_set()->has_normal_map(); if (normals) normal_map = m_points->point_set()->normal_map(); - + bool colors = (m_color != Point_set::Property_map()); - + Point_set::Property_map echo_map; bool echo; boost::tie (echo_map, echo) = m_points->point_set()->template property_map("echo"); @@ -544,7 +544,7 @@ void Point_set_item_classification::compute_features (std::size_t nb_scales, flo CGAL::Real_timer t; t.start(); - + #ifdef CGAL_LINKED_WITH_TBB m_features.begin_parallel_additions(); #endif @@ -556,7 +556,7 @@ void Point_set_item_classification::compute_features (std::size_t nb_scales, flo m_generator->generate_color_based_features (m_features, m_color); if (echo) m_generator->generate_echo_based_features (m_features, echo_map); - + #ifdef CGAL_LINKED_WITH_TBB m_features.end_parallel_additions(); #endif @@ -629,7 +629,7 @@ void Point_set_item_classification::select_random_region() current_idx ++; else unselected.push_back (*it); - + } else { @@ -645,7 +645,7 @@ void Point_set_item_classification::select_random_region() else unselected.push_back (*it); } - + for (std::size_t i = 0; i < unselected.size(); ++ i) *(m_points->point_set()->begin() + i) = unselected[i]; for (std::size_t i = 0; i < selected.size(); ++ i) @@ -659,7 +659,7 @@ void Point_set_item_classification::select_random_region() void Point_set_item_classification::add_remaining_point_set_properties_as_features() { const std::vector& prop = m_points->point_set()->base().properties(); - + for (std::size_t i = 0; i < prop.size(); ++ i) { if (prop[i] == "index" || @@ -708,13 +708,13 @@ void Point_set_item_classification::train(int classifier, const QMultipleInputDi m_label_probabilities.resize (m_labels.size()); for (std::size_t i = 0; i < m_label_probabilities.size(); ++ i) m_label_probabilities[i].resize (m_points->point_set()->size(), -1); - + std::vector training (m_points->point_set()->size(), -1); std::vector indices (m_points->point_set()->size(), -1); std::vector nb_label (m_labels.size(), 0); std::size_t nb_total = 0; - + for (Point_set::const_iterator it = m_points->point_set()->begin(); it != m_points->point_set()->first_selected(); ++ it) { @@ -796,24 +796,24 @@ void Point_set_item_classification::train(int classifier, const QMultipleInputDi while (iss >> s) hidden_layers.push_back (std::size_t(s)); } - + m_neural_network->train (training, dialog.get("restart")->isChecked(), dialog.get("trials")->value(), dialog.get("learning_rate")->value(), dialog.get("batch_size")->value(), hidden_layers); - + CGAL::Classification::classify (*(m_points->point_set()), m_labels, *m_neural_network, indices, m_label_probabilities); #endif } - + for (Point_set::const_iterator it = m_points->point_set()->begin(); it != m_points->point_set()->first_selected(); ++ it) m_classif[*it] = indices[*it]; - + if (m_index_color == 1 || m_index_color == 2) change_color (m_index_color); } @@ -862,7 +862,7 @@ bool Point_set_item_classification::run (int method, int classifier, run (method, *m_neural_network, subdivisions, smoothing); #endif } - + return true; } diff --git a/Polyhedron/demo/Polyhedron/Plugins/Classification/Point_set_item_classification.h b/Polyhedron/demo/Polyhedron/Plugins/Classification/Point_set_item_classification.h index 3eb2b503a4c..075c9b812fb 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Classification/Point_set_item_classification.h +++ b/Polyhedron/demo/Polyhedron/Plugins/Classification/Point_set_item_classification.h @@ -24,12 +24,12 @@ class Point_set_item_classification : public Item_classification_base public: typedef Kernel::Point_3 Point_3; typedef Kernel::Vector_3 Vector_3; - + typedef Point_set::Point_map Point_map; typedef Point_set::Vector_map Vector_map; typedef CGAL::Classification::Point_set_feature_generator Generator; - + struct Cluster { std::vector inliers; @@ -40,13 +40,13 @@ class Point_set_item_classification : public Item_classification_base std::size_t size() const { return inliers.size(); } const Point_set::Index& operator[] (std::size_t i) const { return inliers[i]; } }; - + struct Cluster_neighborhood { Point_set* point_set; Point_set::Property_map cluster_id; std::vector* clusters; - + Cluster_neighborhood (Point_set* point_set, std::vector& clusters) : point_set (point_set) @@ -54,7 +54,7 @@ class Point_set_item_classification : public Item_classification_base { cluster_id = point_set->property_map("shape").first; } - + template OutputIterator operator() (const Point_set::Index& idx, OutputIterator output) const @@ -71,9 +71,9 @@ class Point_set_item_classification : public Item_classification_base return output; } }; - + public: - + Point_set_item_classification(Scene_points_with_normal_item* points); ~Point_set_item_classification(); @@ -101,7 +101,7 @@ class Point_set_item_classification : public Item_classification_base double dx = bb.xmax() - bb.xmin(); double dy = bb.ymax() - bb.ymin(); double dz = bb.zmax() - bb.zmin(); - + dx *= 10.; dy *= 10.; dz *= 10.; @@ -122,7 +122,7 @@ class Point_set_item_classification : public Item_classification_base float vmax = -std::numeric_limits::max(); float vmean = 0.f; std::size_t nb = 0; - + for (Point_set::const_iterator it = m_points->point_set()->begin_or_selection_begin(); it != m_points->point_set()->end(); ++ it) { @@ -138,9 +138,9 @@ class Point_set_item_classification : public Item_classification_base return oss.str(); } - + void add_remaining_point_set_properties_as_features(); - + void select_random_region(); template @@ -160,7 +160,7 @@ class Point_set_item_classification : public Item_classification_base return okay; } - + void add_selection_to_training_set (std::size_t label) { for (Point_set::const_iterator it = m_points->point_set()->first_selected(); @@ -222,7 +222,7 @@ class Point_set_item_classification : public Item_classification_base { Scene_points_with_normal_item* points_item = new Scene_points_with_normal_item; - + points_item->setName (QString("%1 (%2)").arg(name).arg(m_labels[label]->name().c_str())); points_item->setColor (m_label_colors[label]); for (Point_set::const_iterator it = m_points->point_set()->begin(); @@ -255,7 +255,7 @@ class Point_set_item_classification : public Item_classification_base points_item[c]->point_set()->insert (m_points->point_set()->point(*it)); } } - + QColor add_new_label (const char* name) { QColor out = Item_classification_base::add_new_label (name); @@ -274,7 +274,7 @@ class Point_set_item_classification : public Item_classification_base m_training[*it] = -1; else if (m_training[*it] > int(position)) m_training[*it] --; - + if (m_classif[*it] == int(position)) m_classif[*it] = -1; else if (m_classif[*it] > int(position)) @@ -282,7 +282,7 @@ class Point_set_item_classification : public Item_classification_base } update_comments_of_point_set_item(); } - + int real_index_color() const; void reset_indices(); void backup_existing_colors_and_add_new(); @@ -293,10 +293,10 @@ class Point_set_item_classification : public Item_classification_base void update_comments_of_point_set_item() { std::string& comments = m_points->comments(); - + // Remove previously registered labels from comments std::string new_comment; - + std::istringstream stream (comments); std::string line; while (getline(stream, line)) @@ -317,7 +317,7 @@ class Point_set_item_classification : public Item_classification_base comments += oss.str(); } } - + template bool run (int method, const Classifier& classifier, std::size_t subdivisions, double smoothing) @@ -328,7 +328,7 @@ class Point_set_item_classification : public Item_classification_base m_label_probabilities.resize (m_labels.size()); for (std::size_t i = 0; i < m_label_probabilities.size(); ++ i) m_label_probabilities[i].resize (m_points->point_set()->size(), -1); - + if (method == 0) CGAL::Classification::classify (*(m_points->point_set()), m_labels, classifier, @@ -366,14 +366,14 @@ class Point_set_item_classification : public Item_classification_base m_classif[*it] = indices[*it]; ground_truth[*it] = m_training[*it]; } - + if (m_index_color == 1 || m_index_color == 2) change_color (m_index_color); std::cerr << "Precision, recall, F1 scores and IoU:" << std::endl; - + CGAL::Classification::Evaluation eval (m_labels, ground_truth, indices); - + for (std::size_t i = 0; i < m_labels.size(); ++ i) { std::cerr << " * " << m_labels[i]->name() << ": " @@ -405,11 +405,11 @@ class Point_set_item_classification : public Item_classification_base Point_set::Property_map m_classif; Generator* m_generator; - + int m_index_color; bool m_input_is_las; - + }; // end class Point_set_item_classification diff --git a/Polyhedron/demo/Polyhedron/Plugins/Classification/Surface_mesh_item_classification.cpp b/Polyhedron/demo/Polyhedron/Plugins/Classification/Surface_mesh_item_classification.cpp index 2c032b631f9..f2f8f4f2c32 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Classification/Surface_mesh_item_classification.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Classification/Surface_mesh_item_classification.cpp @@ -28,10 +28,10 @@ Surface_mesh_item_classification::Surface_mesh_item_classification(Scene_surface m_labels.add("vegetation"); m_labels.add("roof"); m_labels.add("facade"); - + for (std::size_t i = 0; i < m_labels.size(); ++ i) m_label_colors.push_back (this->get_new_label_color (m_labels[i]->name())); - + m_sowf = new Sum_of_weighted_features (m_labels, m_features); m_ethz = NULL; #ifdef CGAL_LINKED_WITH_OPENCV @@ -106,7 +106,7 @@ void Surface_mesh_item_classification::change_color (int index, float* vmin, flo { QColor color (128, 128, 128); std::size_t c = m_classif[fd]; - + if (c != std::size_t(-1)) color = m_label_colors[c]; @@ -120,10 +120,10 @@ void Surface_mesh_item_classification::change_color (int index, float* vmin, flo QColor color (128, 128, 128); std::size_t c = m_training[fd]; std::size_t c2 = m_classif[fd]; - + if (c != std::size_t(-1)) color = m_label_colors[c]; - + float div = 1; if (c != c2) div = 2; @@ -166,12 +166,12 @@ void Surface_mesh_item_classification::change_color (int index, float* vmin, flo std::cerr << "Error: trying to access feature " << corrected_index << " out of " << m_features.size() << std::endl; return; } - + Feature_handle feature = m_features[corrected_index]; float min = std::numeric_limits::max(); float max = -std::numeric_limits::max(); - + if (vmin != NULL && vmax != NULL && *vmin != std::numeric_limits::infinity() && *vmax != std::numeric_limits::infinity()) @@ -189,18 +189,18 @@ void Surface_mesh_item_classification::change_color (int index, float* vmin, flo min = feature->value(fd); } } - + for(face_descriptor fd : faces(*(m_mesh->polyhedron()))) { float v = (feature->value(fd) - min) / (max - min); if (v < 0.f) v = 0.f; if (v > 1.f) v = 1.f; - + m_color[fd] = CGAL::Color((unsigned char)(ramp.r(v) * 255), (unsigned char)(ramp.g(v) * 255), (unsigned char)(ramp.b(v) * 255)); } - + if (vmin != NULL && vmax != NULL) { *vmin = min; @@ -217,16 +217,16 @@ void Surface_mesh_item_classification::compute_features (std::size_t nb_scales, std::cerr << "automatic voxel size" << std::endl; else std::cerr << "voxel size = " << voxel_size << std::endl; - + m_features.clear(); if (m_generator != NULL) delete m_generator; Face_center_map fc_map (m_mesh->polyhedron()); - + m_generator = new Generator (*(m_mesh->polyhedron()), fc_map, nb_scales, voxel_size); - + #ifdef CGAL_LINKED_WITH_TBB m_features.begin_parallel_additions(); #endif @@ -237,7 +237,7 @@ void Surface_mesh_item_classification::compute_features (std::size_t nb_scales, #ifdef CGAL_LINKED_WITH_TBB m_features.end_parallel_additions(); #endif - + delete m_sowf; m_sowf = new Sum_of_weighted_features (m_labels, m_features); if (m_ethz != NULL) @@ -280,7 +280,7 @@ void Surface_mesh_item_classification::train (int classifier, const QMultipleInp std::vector nb_label (m_labels.size(), 0); std::size_t nb_total = 0; - + for(face_descriptor fd : faces(*(m_mesh->polyhedron()))) { training[fd] = m_training[fd]; @@ -290,12 +290,12 @@ void Surface_mesh_item_classification::train (int classifier, const QMultipleInp ++ nb_total; } } - + std::cerr << nb_total << " face(s) used for training (" << 100. * (nb_total / double(m_mesh->polyhedron()->faces().size())) << "% of the total):" << std::endl; for (std::size_t i = 0; i < m_labels.size(); ++ i) std::cerr << " * " << m_labels[i]->name() << ": " << nb_label[i] << " face(s)" << std::endl; - + if (classifier == 0) { m_sowf->train(training, dialog.get("trials")->value()); @@ -362,14 +362,14 @@ void Surface_mesh_item_classification::train (int classifier, const QMultipleInp while (iss >> s) hidden_layers.push_back (std::size_t(s)); } - + m_neural_network->train (training, dialog.get("restart")->isChecked(), dialog.get("trials")->value(), dialog.get("learning_rate")->value(), dialog.get("batch_size")->value(), hidden_layers); - + CGAL::Classification::classify (m_mesh->polyhedron()->faces(), m_labels, *m_neural_network, indices, m_label_probabilities); @@ -425,6 +425,6 @@ bool Surface_mesh_item_classification::run (int method, int classifier, run (method, *m_neural_network, subdivisions, smoothing); #endif } - + return true; } diff --git a/Polyhedron/demo/Polyhedron/Plugins/Classification/Surface_mesh_item_classification.h b/Polyhedron/demo/Polyhedron/Plugins/Classification/Surface_mesh_item_classification.h index 0fcc827b04a..2b4692217c6 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Classification/Surface_mesh_item_classification.h +++ b/Polyhedron/demo/Polyhedron/Plugins/Classification/Surface_mesh_item_classification.h @@ -37,7 +37,7 @@ public: typedef CGAL::Classification::Mesh_feature_generator Generator; public: - + Surface_mesh_item_classification(Scene_surface_mesh_item* mesh); ~Surface_mesh_item_classification(); @@ -47,12 +47,12 @@ public: void erase_item() { m_mesh = NULL; } void compute_features (std::size_t nb_scales, float voxel_size); - + void add_selection_to_training_set (std::size_t label) { if (m_selection == NULL) return; - + for (Selection::iterator it = m_selection->selected_facets.begin(); it != m_selection->selected_facets.end(); ++ it) { @@ -72,7 +72,7 @@ public: if (m_index_color == 1 || m_index_color == 2) change_color (m_index_color); } - + void reset_training_set_of_selection () { for (Selection::iterator it = m_selection->selected_facets.begin(); @@ -82,11 +82,11 @@ public: m_classif[*it] = -1; } m_selection->clear_all(); - + if (m_index_color == 1 || m_index_color == 2) change_color (m_index_color); } - + void reset_training_sets() { for(face_descriptor fd : faces(*(m_mesh->polyhedron()))) @@ -103,12 +103,12 @@ public: { if (m_selection == NULL) return; - + for (Selection::iterator it = m_selection->selected_facets.begin(); it != m_selection->selected_facets.end(); ++ it) m_training[*it] = m_classif[*it]; m_selection->clear_all(); - + if (m_index_color == 1 || m_index_color == 2) change_color (m_index_color); } @@ -144,7 +144,7 @@ protected: { std::vector indices(m_mesh->polyhedron()->faces().size(), -1); Face_center_map fc_map (m_mesh->polyhedron()); - + if (method == 0) CGAL::Classification::classify (m_mesh->polyhedron()->faces(), m_labels, classifier, @@ -157,28 +157,28 @@ protected: else if (method == 2) { // Fix: need bbox of face - + CGAL::Classification::classify_with_graphcut (m_mesh->polyhedron()->faces(), Face_descriptor_with_bbox_map(m_mesh->polyhedron()), m_labels, classifier, m_generator->neighborhood().n_ring_neighbor_query(1), smoothing, subdivisions, indices); } - + std::vector ground_truth(num_faces(*(m_mesh->polyhedron())), std::size_t(-1)); for(face_descriptor fd : faces(*(m_mesh->polyhedron()))) { m_classif[fd] = indices[fd]; ground_truth[fd] = m_training[fd]; } - + if (m_index_color == 1 || m_index_color == 2) change_color (m_index_color); std::cerr << "Precision, recall, F1 scores and IoU:" << std::endl; - + CGAL::Classification::Evaluation eval (m_labels, ground_truth, indices); - + for (std::size_t i = 0; i < m_labels.size(); ++ i) { std::cerr << " * " << m_labels[i]->name() << ": " @@ -195,7 +195,7 @@ protected: return true; } - + Scene_surface_mesh_item* m_mesh; Scene_polyhedron_selection_item* m_selection; Mesh::Property_map m_training; diff --git a/Polyhedron/demo/Polyhedron/Plugins/Convex_hull/Convex_hull_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Convex_hull/Convex_hull_plugin.cpp index b973eeae32f..582d8926fdb 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Convex_hull/Convex_hull_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Convex_hull/Convex_hull_plugin.cpp @@ -15,7 +15,7 @@ #include #include using namespace CGAL::Three; -class Polyhedron_demo_convex_hull_plugin : +class Polyhedron_demo_convex_hull_plugin : public QObject, public Polyhedron_demo_plugin_interface { @@ -38,7 +38,7 @@ public: QList actions()const {return _actions;} bool applicable(QAction*) const { - return + return qobject_cast(scene->item(scene->mainSelectionIndex())) || qobject_cast(scene->item(scene->mainSelectionIndex())) || qobject_cast(scene->item(scene->mainSelectionIndex())) || @@ -59,21 +59,21 @@ void Polyhedron_demo_convex_hull_plugin::on_actionConvexHull_triggered() const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); Scene_points_with_normal_item* pts_item = qobject_cast(scene->item(index)); - - Scene_polylines_item* lines_item = + + Scene_polylines_item* lines_item = qobject_cast(scene->item(index)); - - Scene_polyhedron_selection_item* selection_item = + + Scene_polyhedron_selection_item* selection_item = qobject_cast(scene->item(index)); - Scene_surface_mesh_item* sm_item = + Scene_surface_mesh_item* sm_item = qobject_cast(scene->item(index)); if( pts_item || lines_item || selection_item || sm_item) { // wait cursor QApplication::setOverrideCursor(Qt::WaitCursor); - + QElapsedTimer time; time.start(); std::cout << "Convex hull..."; @@ -90,7 +90,7 @@ void Polyhedron_demo_convex_hull_plugin::on_actionConvexHull_triggered() SMesh* pMesh = sm_item->polyhedron(); CGAL::convex_hull_3(*pMesh, *pConvex_hull); - + } else{ if (pts_item) @@ -109,7 +109,7 @@ void Polyhedron_demo_convex_hull_plugin::on_actionConvexHull_triggered() for(std::list >::const_iterator it = lines_item->polylines.begin(); it != lines_item->polylines.end(); ++it) std::copy(it->begin(), it->end(),std::back_inserter( all_points ) ); - + CGAL::convex_hull_3(all_points.begin(),all_points.end(),*pConvex_hull); } } diff --git a/Polyhedron/demo/Polyhedron/Plugins/Display/Display_property_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Display/Display_property_plugin.cpp index df09bc33f2d..27f909449a6 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Display/Display_property_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Display/Display_property_plugin.cpp @@ -41,8 +41,8 @@ class Scene_heat_item : public CGAL::Three::Scene_item_rendering_helper { Q_OBJECT - -public: + +public: Scene_heat_item(Scene_surface_mesh_item* item) :sm(item->face_graph()), parent(item) { @@ -59,13 +59,13 @@ public: double dir_y, double dir_z) Q_DECL_OVERRIDE { - parent->select( orig_x, orig_y, orig_z, + parent->select( orig_x, orig_y, orig_z, dir_x, dir_y, dir_z); } - + void initializeBuffers(CGAL::Three::Viewer_interface *viewer) const Q_DECL_OVERRIDE { - getTriangleContainer(0)->initializeBuffers(viewer); + getTriangleContainer(0)->initializeBuffers(viewer); getTriangleContainer(0)->setIdxSize(nb_idx); verts.resize(0); normals .resize(0); @@ -76,7 +76,7 @@ public: verts.shrink_to_fit(); normals.shrink_to_fit(); } - + void draw(CGAL::Three::Viewer_interface *viewer) const Q_DECL_OVERRIDE { if(!visible()) @@ -94,7 +94,7 @@ public: computeElements(); initializeBuffers(viewer); } - + getTriangleContainer(0)->setAlpha(1.0f); getTriangleContainer(0)->draw(viewer, false); } @@ -102,7 +102,7 @@ public: { SMesh::Property_map pprop = sm->points(); CGAL::Bbox_3 bbox ; - + for(vertex_descriptor vd :vertices(*sm)) { bbox = bbox + pprop[vd].bbox(); @@ -122,7 +122,7 @@ public: virtual bool supportsRenderingMode(RenderingMode m) const Q_DECL_OVERRIDE { return m==Gouraud; } virtual void invalidateOpenGLBuffers() Q_DECL_OVERRIDE { - + setBuffersFilled(false); compute_bbox(); getTriangleContainer(0)->reset_vbos(NOT_INSTANCED); @@ -133,11 +133,11 @@ public: { const CGAL::qglviewer::Vec v_offset = static_cast(CGAL::QGLViewer::QGLViewerPool().first())->offset(); EPICK::Vector_3 offset = EPICK::Vector_3(v_offset.x, v_offset.y, v_offset.z); - + EPICK::Point_3 p0,p1,p2; SMesh::Halfedge_around_face_circulator he(halfedge(fd, *sm), *sm); SMesh::Halfedge_around_face_circulator he_end = he; - + while(next(*he, *sm) != prev(*he_end, *sm)) { ++he; @@ -158,14 +158,14 @@ public: { //Computes the normal of the facet EPICK::Vector_3 normal = get(*fnormals, fd); - + //check if normal contains NaN values if (normal.x() != normal.x() || normal.y() != normal.y() || normal.z() != normal.z()) { qDebug()<<"Warning : normal is not valid. Facet not displayed"; return; } - + typedef FacetTriangulator::vertex_descriptor> FT; const CGAL::qglviewer::Vec off = static_cast(CGAL::QGLViewer::QGLViewerPool().first())->offset(); EPICK::Vector_3 offset(off.x,off.y,off.z); @@ -186,7 +186,7 @@ public: idx.push_back((*im)[triangulation.v2v[ffit->vertex(2)]]); } } - + void computeElements() const Q_DECL_OVERRIDE { typedef EPICK::Point_3 Point; @@ -205,7 +205,7 @@ public: SMesh::Property_map vcolors = sm->property_map("v:color").first; SMesh::Property_map vdist= - sm->property_map("v:dist").first; + sm->property_map("v:dist").first; typedef CGAL::Buffer_for_vao CPF; verts.clear(); normals.clear(); @@ -213,7 +213,7 @@ public: colors.clear(); boost::property_map< SMesh, boost::vertex_index_t >::type im = get(boost::vertex_index, *sm); - + idx.reserve(num_faces(*sm) * 3); for(face_descriptor fd : faces(*sm)) { @@ -232,7 +232,7 @@ public: facet_points.push_back(positions[target(hd, *sm)]); } bool is_convex = CPF::is_facet_convex(facet_points, fnormals[fd]); - + if(is_convex && is_quad(halfedge(fd,*sm),*sm) ) { halfedge_descriptor hd = halfedge(fd,*sm); @@ -240,12 +240,12 @@ public: idx.push_back(source(hd, *sm)); idx.push_back(source(next(hd, *sm), *sm)); idx.push_back(source(next(next(hd, *sm), *sm), *sm)); - + //2nd half idx.push_back(source(hd, *sm)); idx.push_back(source(next(next(hd, *sm), *sm), *sm)); idx.push_back(source(prev(hd, *sm), *sm)); - } + } else if(is_convex) { triangulate_convex_facet(fd, &im); @@ -262,8 +262,8 @@ public: colors.push_back((float)c.red()/255); colors.push_back((float)c.green()/255); colors.push_back((float)c.blue()/255); - - + + Point p = positions[vd] + offset; CPF::add_point_in_buffer(p, verts); EPICK::Vector_3 n = vnormals[vd]; @@ -275,7 +275,7 @@ public: static_cast(idx.size()*sizeof(unsigned int))); getTriangleContainer(0)->allocate(Tri::Smooth_vertices, verts.data(), static_cast(num_vertices(*sm)*3*sizeof(float))); - + getTriangleContainer(0)->allocate(Tri::Smooth_normals, normals.data(), static_cast(num_vertices(*sm)*3*sizeof(float))); getTriangleContainer(0)->allocate(Tri::VColors, colors.data(), @@ -286,7 +286,7 @@ public: setBuffersFilled(true); QApplication::restoreOverrideCursor(); } - + bool isEmpty() const Q_DECL_OVERRIDE {return false;} SMesh *face_graph() { return sm;} Scene_surface_mesh_item* getParent() { return parent; } @@ -329,7 +329,7 @@ class DisplayPropertyPlugin : typedef CGAL::Heat_method_3::Surface_mesh_geodesic_distances_3 Heat_method_idt; typedef CGAL::dynamic_vertex_property_t Vertex_source_tag; typedef boost::property_map::type Vertex_source_map; - + public: bool applicable(QAction*) const Q_DECL_OVERRIDE @@ -413,7 +413,7 @@ public: { return; } - + rm = minColor.redF(); gm = minColor.greenF(); bm = minColor.blueF(); @@ -456,7 +456,7 @@ private Q_SLOTS: { if(dock_widget->isVisible()) { dock_widget->hide(); } else{ - replaceRamp(); + replaceRamp(); dock_widget->show(); dock_widget->raise(); } } @@ -501,11 +501,11 @@ private Q_SLOTS: this, [item](){ bool does_exist; SMesh::Property_map pmap; - boost::tie(pmap, does_exist) = + boost::tie(pmap, does_exist) = item->face_graph()->property_map("f:jacobian"); if(does_exist) item->face_graph()->remove_property_map(pmap); - boost::tie(pmap, does_exist) = + boost::tie(pmap, does_exist) = item->face_graph()->property_map("f:angle"); if(does_exist) item->face_graph()->remove_property_map(pmap); @@ -637,7 +637,7 @@ private Q_SLOTS: dock_widget->maxBox->setValue(jacobian_max[item].first); return true; } - + void displayAngles(Scene_surface_mesh_item* item) { SMesh& smesh = *item->face_graph(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/IO/CMakeLists.txt index c4487f3b768..c5c5f52ccd8 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/IO/CMakeLists.txt @@ -64,11 +64,11 @@ if(has_cxx_rvalues LESS 0 OR has_cxx_variadic LESS 0) message(STATUS "NOTICE : LAS/PLY IO examples require a C++11 compiler and will not be compiled.") else() set(needed_cxx_features cxx_rvalue_references cxx_variadic_templates) - + polyhedron_demo_plugin(ply_plugin PLY_io_plugin KEYWORDS IO PointSetProcessing Classification PMP) target_link_libraries(ply_plugin PUBLIC scene_points_with_normal_item scene_polygon_soup_item scene_surface_mesh_item scene_textured_item) target_compile_features(ply_plugin PRIVATE ${needed_cxx_features}) - + if (LASLIB_FOUND) polyhedron_demo_plugin(las_plugin LAS_io_plugin KEYWORDS IO PointSetProcessing Classification) target_link_libraries(las_plugin PUBLIC scene_points_with_normal_item) diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/Nef_io_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/IO/Nef_io_plugin.cpp index 22b2ed695d4..ed9658065f7 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/Nef_io_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/IO/Nef_io_plugin.cpp @@ -46,7 +46,7 @@ load(QFileInfo fileinfo, bool& ok, bool add_to_scene) { ok = false; return QList(); } - + // Open file std::ifstream in(fileinfo.filePath().toUtf8()); if(!in) { @@ -54,7 +54,7 @@ load(QFileInfo fileinfo, bool& ok, bool add_to_scene) { ok = false; return QList(); } - + // Try to read .nef3 in a polyhedron Scene_nef_polyhedron_item* item = new Scene_nef_polyhedron_item(); item->setName(fileinfo.baseName()); @@ -89,7 +89,7 @@ bool Polyhedron_demo_io_nef_plugin::save(QFileInfo fileinfo,QList(item); if(!nef_item) diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/PLY_io_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/IO/PLY_io_plugin.cpp index 75c2e1d9845..ed588be57f0 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/PLY_io_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/IO/PLY_io_plugin.cpp @@ -24,9 +24,9 @@ class Polyhedron_demo_ply_plugin : public: bool isDefaultLoader(const CGAL::Three::Scene_item *item) const override - { - if(qobject_cast(item)) - return true; + { + if(qobject_cast(item)) + return true; return false; } QString name() const override{ return "ply_plugin"; } @@ -60,7 +60,7 @@ load(QFileInfo fileinfo, bool& ok, bool add_to_scene) { ok = false; return QList(); } - + // Test if input is mesh or point set bool input_is_mesh = false; std::string line; @@ -95,7 +95,7 @@ load(QFileInfo fileinfo, bool& ok, bool add_to_scene) { // First try mesh SMesh *surface_mesh = new SMesh(); std::string comments; - + if (CGAL::read_ply (in, *surface_mesh, comments)) { Scene_surface_mesh_item* sm_item = new Scene_surface_mesh_item(surface_mesh); @@ -185,13 +185,13 @@ save(QFileInfo fileinfo,QList& items) if (!ok) return false; - + std::ofstream out(fileinfo.filePath().toUtf8().data(), std::ios::binary); if (choice == tr("Binary")) CGAL::set_binary_mode(out); else out.precision (std::numeric_limits::digits10 + 2); - + // This plugin supports point sets const Scene_points_with_normal_item* point_set_item = qobject_cast(item); @@ -227,7 +227,7 @@ save(QFileInfo fileinfo,QList& items) items.pop_front(); return res; } - + // This plugin supports textured surface meshes const Scene_textured_surface_mesh_item* stm_item = qobject_cast(item); diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/Polylines_io_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/IO/Polylines_io_plugin.cpp index d9fe0b44e0d..cdfac0608e5 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/Polylines_io_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/IO/Polylines_io_plugin.cpp @@ -75,7 +75,7 @@ public: return QList()<(item)) return true; @@ -129,7 +129,7 @@ load(QFileInfo fileinfo, bool& ok, bool add_to_scene){ CGAL::Three::Three::scene()->addItem(item); return QList()< > polylines; QStringList polylines_metadata; diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/VTK_io_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/IO/VTK_io_plugin.cpp index 362709853c6..85df5328597 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/VTK_io_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/IO/VTK_io_plugin.cpp @@ -71,7 +71,7 @@ #include typedef Scene_surface_mesh_item Scene_facegraph_item; typedef Scene_facegraph_item::Face_graph FaceGraph; -typedef boost::property_traits::type>::value_type Point; @@ -298,8 +298,8 @@ public: return (qobject_cast(item) || qobject_cast(item)); } - - + + bool save(QFileInfo fileinfo,QList& items) { Scene_item* item = items.front(); @@ -311,7 +311,7 @@ public: const Scene_facegraph_item* poly_item = qobject_cast(item); - + if (poly_item) { if (extension != "vtp") @@ -342,11 +342,11 @@ public: qobject_cast(item); if(!c3t3_item || extension != "vtu") return false; - + std::ofstream os(output_filename.data()); os << std::setprecision(16); const C3t3& c3t3 = c3t3_item->c3t3(); - + CGAL::output_to_vtu(os, c3t3); } items.pop_front(); @@ -391,7 +391,7 @@ public: CGAL::Three::Three::scene()->addItem(item); return QList()< data; vtkSmartPointer obs = vtkSmartPointer::New(); @@ -478,7 +478,7 @@ public: { group = new Scene_group_item(fileinfo.baseName()); } - + if(is_polygon_mesh) { FaceGraph* poly = new FaceGraph(); @@ -500,7 +500,7 @@ public: } } } - + if (is_c3t3) { typedef boost::array Facet; // 3 = id @@ -548,7 +548,7 @@ public: } } CGAL::build_triangulation(c3t3_item->c3t3().triangulation(), points, finite_cells, border_facets); - + for( C3t3::Triangulation::Finite_cells_iterator cit = c3t3_item->c3t3().triangulation().finite_cells_begin(); cit != c3t3_item->c3t3().triangulation().finite_cells_end(); @@ -564,7 +564,7 @@ public: } } } - + //if there is no facet in the complex, we add the border facets. if(c3t3_item->c3t3().number_of_facets_in_complex() == 0) { @@ -574,10 +574,10 @@ public: ++fit) { typedef C3t3::Triangulation::Cell_handle Cell_handle; - + Cell_handle c = fit->first; Cell_handle nc = c->neighbor(fit->second); - + // By definition, Subdomain_index() is supposed to be the id of the exterior if(c->subdomain_index() != C3t3::Triangulation::Cell::Subdomain_index() && nc->subdomain_index() == C3t3::Triangulation::Cell::Subdomain_index()) @@ -603,7 +603,7 @@ public: return QList()< > segments; @@ -625,14 +625,14 @@ public: return QList()<addItem(group); return QList()<(item)) - return true; + { + if(qobject_cast(item)) + return true; return false; } QString name() const override{ return "lcc_plugin"; } - QString nameFilters() const override{ return + QString nameFilters() const override{ return "OFF files (*.off);;" "3-map files (*.3map)"; } - + QString saveNameFilters() const override{ - return - "3-map files (*.3map)"; + return + "3-map files (*.3map)"; } - + bool canLoad(QFileInfo) const override{ return true; } QList load(QFileInfo fileinfo, bool& ok, bool add_to_scene=true) override{ // Open file @@ -42,7 +42,7 @@ public: ok = false; return QList(); } - + Scene_lcc_item::LCC lcc; QString ext = fileinfo.suffix(); bool res = true; @@ -65,13 +65,13 @@ public: ok = true; return QList()<& )override{ return false; } - + }; diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_2/Mesh_2_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_2/Mesh_2_plugin.cpp index c746fdd3752..4361cd11e7c 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_2/Mesh_2_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_2/Mesh_2_plugin.cpp @@ -346,7 +346,7 @@ private: constant_coordinate); scene->addItem(poly_item); poly_item->invalidateOpenGLBuffers(); - + std::cout << "ok (" << time.elapsed() << " ms)" << std::endl; // default cursor QApplication::restoreOverrideCursor(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/C3t3_io_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/C3t3_io_plugin.cpp index 21a0d5c6207..4a85cb13b7e 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/C3t3_io_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/C3t3_io_plugin.cpp @@ -75,7 +75,7 @@ Polyhedron_demo_c3t3_binary_io_plugin::load( return QList(); } Scene_c3t3_item* item = new Scene_c3t3_item(); - + if(fileinfo.size() == 0) { CGAL::Three::Three::warning( tr("The file you are trying to load is empty.")); @@ -321,10 +321,10 @@ operator>>( std::istream& is, Fake_CDT_3_vertex_base& v) } else { // if(s != '.') { - // std::cerr << "v.point()=" << v.point() << std::endl; - // std::cerr << "s=" << s << " (" << (int)s - // << "), just before position " - // << is.tellg() << " !\n"; + // std::cerr << "v.point()=" << v.point() << std::endl; + // std::cerr << "s=" << s << " (" << (int)s + // << "), just before position " + // << is.tellg() << " !\n"; // } CGAL_assertion(s == '.' || s== 'F'); v.steiner = false; @@ -384,7 +384,7 @@ operator>>( std::istream& is, Fake_CDT_3_cell_base& c) { std::cerr << "\n"; std::cerr << "s=" << s << " (" << (int)s << "), just before position " - << is.tellg() << " !\n"; } + << is.tellg() << " !\n"; } CGAL_assertion(s == '.'); c._restoring[c.to_edge_index(li, lj)] = false; } @@ -486,7 +486,7 @@ try_load_a_cdt_3(std::istream& is, C3t3& c3t3) } if (s != "CGAL" || !(is >> s) || - s != "c3t3") + s != "c3t3") { return false; } diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/C3t3_rib_exporter_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/C3t3_rib_exporter_plugin.cpp index 89b8a92ecc3..7e11d62f6a8 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/C3t3_rib_exporter_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/C3t3_rib_exporter_plugin.cpp @@ -42,7 +42,7 @@ class C3t3_rib_exporter_plugin : public: C3t3_rib_exporter_plugin(); virtual ~C3t3_rib_exporter_plugin() {} - + void init(QMainWindow* mainWindow, Scene_interface* scene_interface, Messages_interface*); QList actions() const { @@ -51,12 +51,12 @@ public: bool applicable(QAction*)const{ Scene_c3t3_item* item = qobject_cast(scene->item(scene->mainSelectionIndex())); return item && item->is_valid();} - + public Q_SLOTS: void create_rib(); void height_changed(int i); void width_changed(int i); - + private: typedef Tr::Bare_point Bare_point; typedef Tr::Weighted_point Weighted_point; @@ -65,12 +65,12 @@ private: typedef Geom_traits::Plane_3 Plane; typedef Geom_traits::FT FT; typedef Geom_traits::Aff_transformation_3 Aff_transformation_3; - + typedef CGAL::qglviewer::Vec qglVec; - + enum Rib_exporter_mode { CUT=0, MESH, TRIANGULATION }; - - struct Rib_exporter_parameters + + struct Rib_exporter_parameters { // Materials double sphere_radius; @@ -81,88 +81,88 @@ private: double ambientIntensity; bool shadowOn; double shadowIntensity; - + // Picture int width; int height; Rib_exporter_mode mode; bool is_preview; }; - + private: void update_mask(); - + bool get_parameters_from_dialog(); - + QStringList nameFilters() const; - bool save(const Scene_c3t3_item&, const QFileInfo& fileinfo); + bool save(const Scene_c3t3_item&, const QFileInfo& fileinfo); void init_maps(const C3t3& c3t3, const QColor& color); void init_point_radius(const C3t3& c3t3); void init_parameters(); - + Bare_point camera_coordinates(const Bare_point& p); void fill_points_and_edges_map(const C3t3& c3t3); - + void add_edge(const Bare_point& p, const Bare_point& q, const QColor& color); void add_vertex(const Bare_point& p, const QColor& color); - + void write_header(const std::string& filename, std::ofstream& out); - + void write_lights(std::ofstream& out); void write_turn_background_light(bool turn_on, std::ofstream& out); - + void write_facets(const C3t3& c3t3, std::ofstream& out); void write_facets(const C3t3& c3t3, const Plane& plane, std::ofstream& out); void write_surface_cells(const C3t3& c3t3, const Plane& plane, std::ofstream& out); void write_cells_intersecting_a_plane(const C3t3& c3t3, const Plane& plane, std::ofstream& out); void write_cells_on_the_positive_side_of_a_plane(const C3t3& c3t3, const Plane& plane, std::ofstream& out); - + void write_triangle(const Bare_point& p, const Bare_point& q, const Bare_point& r, const QColor& color, const QColor& edge_color, std::ofstream& out); void write_tetrahedron (const Bare_point& p, const Bare_point& q, const Bare_point& r, const Bare_point& s, const QColor& color, const QColor& edge_color, std::ofstream& out); - + void write_point(const Bare_point& p, std::ofstream& out); void write_point_sphere(const Bare_point& p, std::ofstream& out); - + void write_edge_cylinder(const Bare_point& p, const Bare_point& q, std::ofstream& out); - + // Writes data which has been stored during triangle drawing void write_edges_flat(std::ofstream& out); void write_edges_volumic(std::ofstream& out); void write_vertices_volumic(std::ofstream& out); - + void write_color(const QColor& color, bool use_transparency, std::ofstream& out); void write_opacity(const double alpha, std::ofstream& out); - + // Background void write_background(const QColor& color, std::ofstream& out); - + private: QAction* actionCreateRib; - + // Viewer - + typedef std::map Surface_map; typedef std::map Subdomain_map; - + Surface_map surface_map_; Subdomain_map subdomain_map_; - + typedef std::map,QColor> Edge_map; typedef std::map Vertex_map; - + Edge_map edges_; Vertex_map vertices_; - + double zmax_; double diag_; - + // Cache data to avoid writing too much lines in rib file QColor prev_color_; double prev_alpha_; const Scene_c3t3_item* prev_c3t3_; - + Rib_exporter_parameters parameters_; }; @@ -176,7 +176,7 @@ C3t3_rib_exporter_plugin() , prev_alpha_(1) , prev_c3t3_(NULL) { - + } @@ -186,7 +186,7 @@ init(QMainWindow* mainWindow, Scene_interface* scene_interface, Messages_interfa { this->scene = scene_interface; this->mw = mainWindow; - + actionCreateRib = new QAction("Export C3t3 to RIB", mw); if( NULL != actionCreateRib ) { @@ -205,18 +205,18 @@ C3t3_rib_exporter_plugin::create_rib() std::cerr << "Can't find viewer" << std::endl; return; } - + // Get Scene_c3t3_item Scene_interface::Item_id index = scene->mainSelectionIndex(); - + Scene_c3t3_item* c3t3_item = qobject_cast(scene->item(index)); - + if ( NULL == c3t3_item ) { return; } - + // Init data //if ( c3t3_item != prev_c3t3_ ) // Commented because it was causing problems // when changing the color of the c3t3 @@ -224,40 +224,40 @@ C3t3_rib_exporter_plugin::create_rib() init_maps(c3t3_item->c3t3(), c3t3_item->color()); init_point_radius(c3t3_item->c3t3()); init_parameters(); - + prev_c3t3_ = c3t3_item; } - + // Get parameters from user dialog if ( !get_parameters_from_dialog() ) - { + { QBitmap bitmap; bitmap.clear(); Three::activeViewer()->setMask(bitmap); return; } - + // Disable Mask QBitmap bitmap; bitmap.clear(); Three::activeViewer()->setMask(bitmap); - + // Save dialog QStringList filters; filters << nameFilters(); filters << tr("All files (*)"); - + QString filename = QFileDialog::getSaveFileName(mw, tr("Save to File..."), QString(), filters.join(";;")); - + QFileInfo fileinfo(filename); - + // Save rib file save(*c3t3_item,fileinfo); - + std::cout << "Rib file created successfully" << std::endl; } @@ -284,7 +284,7 @@ C3t3_rib_exporter_plugin:: update_mask() { double ratio = double(parameters_.width) / double(parameters_.height); - + if ( NULL == Three::activeViewer() ) { std::cerr << "Can't find viewer..." << std::endl; @@ -312,11 +312,11 @@ get_parameters_from_dialog() connect(ui.buttonBox, SIGNAL(rejected()), &dialog, SLOT(reject())); connect(ui.resWidth, SIGNAL(valueChanged(int)), this, SLOT(width_changed(int))); connect(ui.resHeight, SIGNAL(valueChanged(int)), this, SLOT(height_changed(int))); - + // ----------------------------------- // Set data // ----------------------------------- - + // Materials ui.sphereRadius->setValue(parameters_.sphere_radius); ui.cylinderRadius->setValue(parameters_.cylinder_radius); @@ -326,54 +326,54 @@ get_parameters_from_dialog() ui.ambientIntensity->setValue(parameters_.ambientIntensity); ui.isShadowOn->setChecked(parameters_.shadowOn); ui.shadowIntensity->setValue(parameters_.shadowIntensity); - + // Picture QStringList mode_list; mode_list << "Export Cut (draws current cut view)" << "Export Mesh (draws all surface facets)" << "Export Triangulation (draws all points and edges)"; - + ui.exportMode->insertItems(0,mode_list); - + ui.resWidth->setValue(parameters_.width); ui.resHeight->setValue(parameters_.height); ui.exportMode->setCurrentIndex(static_cast(parameters_.mode)); ui.isPreview->setChecked(parameters_.is_preview); - + // Update mask update_mask(); - + // ----------------------------------- // Get data // ----------------------------------- int i = dialog.exec(); if(i == QDialog::Rejected) return false; - + // Materials parameters_.sphere_radius = ui.sphereRadius->value(); parameters_.cylinder_radius = ui.cylinderRadius->value(); - + // Lights parameters_.ambientOn = ui.isAmbientOn->isChecked(); parameters_.ambientIntensity = ui.ambientIntensity->value(); parameters_.shadowOn = ui.isShadowOn->isChecked(); parameters_.shadowIntensity = ui.shadowIntensity->value(); - + // Picture parameters_.width = ui.resWidth->value(); parameters_.height = ui.resHeight->value(); parameters_.mode = static_cast(ui.exportMode->currentIndex()); parameters_.is_preview = ui.isPreview->isChecked(); - + return true; } - + QStringList C3t3_rib_exporter_plugin::nameFilters() const -{ +{ return QStringList() << "RenderMan file (*.rib)"; } @@ -385,52 +385,52 @@ save(const Scene_c3t3_item& c3t3_item, const QFileInfo& fileInfo) QString path = fileInfo.absoluteFilePath(); std::ofstream rib_file (qPrintable(path)); rib_file.precision(8); - + // Header QString basename = fileInfo.baseName(); write_header(qPrintable(basename), rib_file); - + // Lights write_lights(rib_file); - + // Triangles switch ( parameters_.mode ) { case CUT: rib_file << "Surface \"plastic\" \"Ka\" 0.65 \"Kd\" 0.85 \"Ks\" 0.25 \"roughness\" 0.1" << std::endl; write_facets(c3t3_item.c3t3(), c3t3_item.plane(), rib_file); - + rib_file << "Surface \"plastic\" \"Ka\" 0.65 \"Kd\" 0.65 \"Ks\" 0.35 \"roughness\" 0.2" << std::endl; //write_cells_intersecting_a_plane(c3t3_item.c3t3(), c3t3_item.plane(), rib_file); write_cells_on_the_positive_side_of_a_plane(c3t3_item.c3t3(), c3t3_item.plane(), rib_file); break; - + case MESH: rib_file << "Surface \"plastic\" \"Ka\" 0.65 \"Kd\" 0.85 \"Ks\" 0.25 \"roughness\" 0.1" << std::endl; //write_facets(c3t3_item.c3t3(), rib_file); write_surface_cells(c3t3_item.c3t3(), c3t3_item.plane(), rib_file); break; - + case TRIANGULATION: fill_points_and_edges_map(c3t3_item.c3t3()); break; - + default: std::cerr << "Unexpected mode found" << std::endl; return false; break; } - + // Edges and vertices rib_file << "Surface \"plastic\" \"Ka\" 0.65 \"Kd\" 0.85 \"Ks\" 0.25 \"roughness\" 0.1" << std::endl; write_edges_volumic(rib_file); write_vertices_volumic(rib_file); - + // Background write_background(QColor(255,255,255), rib_file); - + rib_file << "WorldEnd" << std::endl; - + return true; } @@ -441,23 +441,23 @@ C3t3_rib_exporter_plugin::init_maps(const C3t3& c3t3, const QColor& color) subdomain_map_.clear(); edges_.clear(); vertices_.clear(); - + // Fill maps with 0 as value for ( C3t3::Facets_in_complex_iterator fit = c3t3.facets_in_complex_begin(), fend = c3t3.facets_in_complex_end() ; fit != fend ; ++fit ) { surface_map_.insert(std::make_pair(c3t3.surface_patch_index(*fit),QColor(0,0,0))); } - + for ( C3t3::Cells_in_complex_iterator cit = c3t3.cells_in_complex_begin(), cend = c3t3.cells_in_complex_end() ; cit != cend ; ++cit ) { subdomain_map_.insert(std::make_pair(c3t3.subdomain_index(cit),QColor(0,0,0))); } - + // Fill value of maps size_t nb_colors = subdomain_map_.size(); // + surface_map_.size(); - + // Starting hue double c = color.hueF(); int i = 0; @@ -476,13 +476,13 @@ C3t3_rib_exporter_plugin:: init_point_radius(const C3t3& c3t3) { const CGAL::Bbox_3 bbox = c3t3.bbox(); - + const double xdelta = bbox.xmax() - bbox.xmin(); const double ydelta = bbox.ymax() - bbox.ymin(); const double zdelta = bbox.zmax() - bbox.zmin(); - + diag_ = std::sqrt(xdelta*xdelta + ydelta*ydelta + zdelta*zdelta); - + parameters_.sphere_radius = diag_ * 0.0015; parameters_.cylinder_radius = diag_ * 0.00065; } @@ -497,7 +497,7 @@ init_parameters() parameters_.ambientIntensity = 0.20; parameters_.shadowOn = true; parameters_.shadowIntensity = 0.85; - + // Picture parameters_.width = 800; parameters_.height = 800; @@ -512,10 +512,10 @@ camera_coordinates(const Bare_point& p) { qglVec p_vec ( p.x(), p.y(), p.z() ); qglVec p_cam = Three::activeViewer()->camera()->cameraCoordinatesOf(p_vec); - + // Store maximal depth zmax_ = (std::max)(zmax_, double(-p_cam[2])); - + return Bare_point(p_cam[0],p_cam[1],p_cam[2]); } @@ -534,16 +534,16 @@ fill_points_and_edges_map(const C3t3& c3t3) const Bare_point& p2 = wp2p(it->vertex(1)->point()); const Bare_point& p3 = wp2p(it->vertex(2)->point()); const Bare_point& p4 = wp2p(it->vertex(3)->point()); - + const QColor& edge_color = subdomain_map_[c3t3.subdomain_index(it)]; - + add_edge(p1,p2,edge_color); add_edge(p1,p3,edge_color); add_edge(p1,p4,edge_color); add_edge(p2,p3,edge_color); add_edge(p2,p4,edge_color); add_edge(p3,p4,edge_color); - + add_vertex(p1,edge_color); add_vertex(p2,edge_color); add_vertex(p3,edge_color); @@ -558,11 +558,11 @@ add_edge(const Bare_point& p, const Bare_point& q, const QColor& color) { if ( p < q ) { - edges_.insert(std::make_pair(std::make_pair(p,q),color)); + edges_.insert(std::make_pair(std::make_pair(p,q),color)); } else { - edges_.insert(std::make_pair(std::make_pair(q,p),color)); + edges_.insert(std::make_pair(std::make_pair(q,p),color)); } } @@ -571,7 +571,7 @@ void C3t3_rib_exporter_plugin:: add_vertex(const Bare_point& p, const QColor& color) { - vertices_.insert(std::make_pair(p,color)); + vertices_.insert(std::make_pair(p,color)); } @@ -581,15 +581,15 @@ write_header(const std::string& filename, std::ofstream& out) { out << "Option \"limits\" \"numthreads\" [16]" << std::endl << "Option \"searchpath\" \"shader\" \".:./shaders:%PIXIE_SHADERS%:%PIXIEHOME%/shaders\"" << std::endl; - + if ( ! parameters_.is_preview ) { out << "Attribute \"visibility\" \"specular\" 1" << std::endl << "Attribute \"visibility\" \"transmission\" 1" << std::endl << std::endl; } - + out << "Display \""<< filename << ".tif\" \"file\" \"rgb\"" << std::endl; - + if ( ! parameters_.is_preview ) { out << "Format " << parameters_.width << " " << parameters_.height << " 1" << std::endl; @@ -597,25 +597,25 @@ write_header(const std::string& filename, std::ofstream& out) else { double ratio = double(parameters_.height) / double(parameters_.width); - + int width = (ratio < 1.) ? 300 : int(300. / ratio); int height = (ratio < 1.) ? int(ratio * 300.) : 300; - + out << "Format " << width << " " << height << " 1" << std::endl; } - - + + if ( parameters_.width > parameters_.height ) { double ratio = double(parameters_.height) / double(parameters_.width); - out << "ScreenWindow -1 1 " << -ratio << " " << ratio << std::endl; + out << "ScreenWindow -1 1 " << -ratio << " " << ratio << std::endl; } else if ( parameters_.height > parameters_.width ) { double ratio = double(parameters_.width) / double(parameters_.height); - out << "ScreenWindow " << -ratio << " " << ratio << " -1 1" << std::endl; + out << "ScreenWindow " << -ratio << " " << ratio << " -1 1" << std::endl; } - + out << "Projection \"perspective\" \"fov\" 45" << std::endl << "PixelSamples 4 4" << std::endl << "PixelFilter \"catmull-rom\" 3 3" << std::endl @@ -634,7 +634,7 @@ write_lights(std::ofstream& out) // ShadowLight out << "LightSource \"shadowdistant\" 1 \"from\" [0 0 0] \"to\" [0 0 1]" << " \"shadowname\" \"raytrace\" \"intensity\" " << parameters_.shadowIntensity << std::endl; - + // Ambient light out << "LightSource \"ambientlight\" 2 \"intensity\" " << parameters_.ambientIntensity << std::endl; } @@ -643,7 +643,7 @@ write_lights(std::ofstream& out) out << "LightSource \"distantLight\" 1 \"from\" [0 0 0] \"to\" [0 0 1]" << " \"intensity\" 0.85" << std::endl; } - + // Background light out << "LightSource \"ambientlight\" 99 \"intensity\" 1" << std::endl; write_turn_background_light(false,out); @@ -681,14 +681,14 @@ write_facets(const C3t3& c3t3, std::ofstream& out) { const C3t3::Cell_handle& c = it->first; const int& k = it->second; - + const Bare_point& p1 = wp2p(c->vertex((k+1)&3)->point()); const Bare_point& p2 = wp2p(c->vertex((k+2)&3)->point()); const Bare_point& p3 = wp2p(c->vertex((k+3)&3)->point()); - + QColor color = c3t3.is_in_complex(c) ? subdomain_map_[c3t3.subdomain_index(c)] : subdomain_map_[c3t3.subdomain_index(c->neighbor(k))]; - + write_triangle(p1, p2, p3, color, color.darker(125), out ); } } @@ -708,7 +708,7 @@ write_facets(const C3t3& c3t3, const Plane& plane, std::ofstream& out) { const C3t3::Cell_handle& c = it->first; const int& k = it->second; - + const Bare_point& p1 = wp2p(c->vertex((k+1)&3)->point()); const Bare_point& p2 = wp2p(c->vertex((k+2)&3)->point()); const Bare_point& p3 = wp2p(c->vertex((k+3)&3)->point()); @@ -716,13 +716,13 @@ write_facets(const C3t3& c3t3, const Plane& plane, std::ofstream& out) const Side s1 = plane.oriented_side(p1); const Side s2 = plane.oriented_side(p2); const Side s3 = plane.oriented_side(p3); - - if( s1 == CGAL::ON_NEGATIVE_SIDE && s2 == CGAL::ON_NEGATIVE_SIDE + + if( s1 == CGAL::ON_NEGATIVE_SIDE && s2 == CGAL::ON_NEGATIVE_SIDE && s3 == CGAL::ON_NEGATIVE_SIDE ) { QColor color = c3t3.is_in_complex(c) ? subdomain_map_[c3t3.subdomain_index(c)] : subdomain_map_[c3t3.subdomain_index(c->neighbor(k))]; - + write_triangle(p1, p2, p3, color, color.darker(125), out ); } } @@ -752,16 +752,16 @@ write_surface_cells(const C3t3& c3t3, const Plane& /* plane */, std::ofstream& o last_2D_vertex_index = i; } } - + //const int TRANSPARENCY_ALPHA_VALUE = 100; CGAL::Bbox_3 bbox = c3t3.bbox(); - float relPos = (c->weighted_circumcenter().x() - bbox.xmin()) + float relPos = (c->weighted_circumcenter().x() - bbox.xmin()) / (bbox.xmax() - bbox.xmin()); - float TRANSPARENCY_ALPHA_VALUE = - 1.f - - (relPos < 0.25f ? - 0.0f : - (relPos > 0.75f ? + float TRANSPARENCY_ALPHA_VALUE = + 1.f - + (relPos < 0.25f ? + 0.0f : + (relPos > 0.75f ? 1.0f : (relPos - 0.25f)*1.0f/0.5f ) @@ -775,7 +775,7 @@ write_surface_cells(const C3t3& c3t3, const Plane& /* plane */, std::ofstream& o QColor basecolor = subdomain_map_[c3t3.subdomain_index(c)]; QColor facecolor = basecolor.darker(150); QColor edgecolor = facecolor.darker(150); - + for (int i = 0 ; i < 4 ; ++i) { if (c3t3.in_dimension(c->vertex((i+1)%4)) == 2 @@ -796,14 +796,14 @@ write_surface_cells(const C3t3& c3t3, const Plane& /* plane */, std::ofstream& o } }*/ - + // SURFACE CELLS ARE TRANSPARENT if (num_2D_vertices >= 2) { QColor basecolor = subdomain_map_[c3t3.subdomain_index(c)]; QColor facecolor = basecolor.darker(150); QColor edgecolor = facecolor.darker(150); - + /* typedef Kernel::Oriented_side Side; @@ -812,7 +812,7 @@ write_surface_cells(const C3t3& c3t3, const Plane& /* plane */, std::ofstream& o const Side s1 = plane.oriented_side(wp2p(c->vertex(1)->point())); const Side s2 = plane.oriented_side(wp2p(c->vertex(2)->point())); const Side s3 = plane.oriented_side(wp2p(c->vertex(3)->point())); - if( s0 == CGAL::ON_NEGATIVE_SIDE && s1 == CGAL::ON_NEGATIVE_SIDE + if( s0 == CGAL::ON_NEGATIVE_SIDE && s1 == CGAL::ON_NEGATIVE_SIDE && s2 == CGAL::ON_NEGATIVE_SIDE && s3 == CGAL::ON_NEGATIVE_SIDE ) { edgecolor.setAlpha(TRANSPARENCY_ALPHA_VALUE); @@ -821,9 +821,9 @@ write_surface_cells(const C3t3& c3t3, const Plane& /* plane */, std::ofstream& o { edgecolor.setAlpha(255); }*/ - + edgecolor.setAlphaF(TRANSPARENCY_ALPHA_VALUE); - + for (int i = 0 ; i < 4 ; ++i) { write_triangle(wp2p(c->vertex((i+1)%4)->point()), @@ -837,7 +837,7 @@ write_surface_cells(const C3t3& c3t3, const Plane& /* plane */, std::ofstream& o QColor basecolor = subdomain_map_[c3t3.subdomain_index(c)]; QColor facecolor = basecolor.darker(150); QColor edgecolor = facecolor.darker(150); - + for (int i = 0 ; i < 4 ; ++i) { if (i == last_2D_vertex_index) @@ -875,12 +875,12 @@ write_cells_intersecting_a_plane(const C3t3& c3t3, const Plane& plane, std::ofst const Bare_point& p2 = wp2p(it->vertex(1)->point()); const Bare_point& p3 = wp2p(it->vertex(2)->point()); const Bare_point& p4 = wp2p(it->vertex(3)->point()); - + const Side s1 = plane.oriented_side(p1); const Side s2 = plane.oriented_side(p2); const Side s3 = plane.oriented_side(p3); const Side s4 = plane.oriented_side(p4); - + if( s1 == CGAL::ON_ORIENTED_BOUNDARY || s2 == CGAL::ON_ORIENTED_BOUNDARY || s3 == CGAL::ON_ORIENTED_BOUNDARY || s4 == CGAL::ON_ORIENTED_BOUNDARY || s2 != s1 || s3 != s1 || s4 != s1 ) @@ -890,17 +890,17 @@ write_cells_intersecting_a_plane(const C3t3& c3t3, const Plane& plane, std::ofst QColor edgecolor = facecolor.darker(150); edgecolor.setAlpha(20); - + // Don't write facet twice if ( s1 != CGAL::ON_NEGATIVE_SIDE || s2 != CGAL::ON_NEGATIVE_SIDE || s3 != CGAL::ON_NEGATIVE_SIDE ) write_triangle(p1, p2, p3, facecolor, edgecolor, out ); - + if ( s1 != CGAL::ON_NEGATIVE_SIDE || s2 != CGAL::ON_NEGATIVE_SIDE || s4 != CGAL::ON_NEGATIVE_SIDE ) write_triangle(p1, p2, p4, facecolor, edgecolor, out ); - + if ( s1 != CGAL::ON_NEGATIVE_SIDE || s3 != CGAL::ON_NEGATIVE_SIDE || s4 != CGAL::ON_NEGATIVE_SIDE ) write_triangle(p1, p3, p4, facecolor, edgecolor, out ); - + if ( s2 != CGAL::ON_NEGATIVE_SIDE || s3 != CGAL::ON_NEGATIVE_SIDE || s4 != CGAL::ON_NEGATIVE_SIDE ) write_triangle(p2, p3, p4, facecolor, edgecolor, out ); } @@ -923,12 +923,12 @@ write_cells_on_the_positive_side_of_a_plane(const C3t3& c3t3, const Plane& plane const Bare_point& p2 = wp2p(it->vertex(1)->point()); const Bare_point& p3 = wp2p(it->vertex(2)->point()); const Bare_point& p4 = wp2p(it->vertex(3)->point()); - + const Side s1 = plane.oriented_side(p1); const Side s2 = plane.oriented_side(p2); const Side s3 = plane.oriented_side(p3); const Side s4 = plane.oriented_side(p4); - + if( ( s1 == CGAL::ON_POSITIVE_SIDE || s2 == CGAL::ON_POSITIVE_SIDE || s3 == CGAL::ON_POSITIVE_SIDE || s4 == CGAL::ON_POSITIVE_SIDE ) /*&& @@ -943,17 +943,17 @@ write_cells_on_the_positive_side_of_a_plane(const C3t3& c3t3, const Plane& plane QColor edgecolor = facecolor.darker(150); edgecolor.setAlpha(10); - + // Don't write facet twice if ( s1 != CGAL::ON_NEGATIVE_SIDE || s2 != CGAL::ON_NEGATIVE_SIDE || s3 != CGAL::ON_NEGATIVE_SIDE ) write_triangle(p1, p2, p3, facecolor, edgecolor, out ); - + if ( s1 != CGAL::ON_NEGATIVE_SIDE || s2 != CGAL::ON_NEGATIVE_SIDE || s4 != CGAL::ON_NEGATIVE_SIDE ) write_triangle(p1, p2, p4, facecolor, edgecolor, out ); - + if ( s1 != CGAL::ON_NEGATIVE_SIDE || s3 != CGAL::ON_NEGATIVE_SIDE || s4 != CGAL::ON_NEGATIVE_SIDE ) write_triangle(p1, p3, p4, facecolor, edgecolor, out ); - + if ( s2 != CGAL::ON_NEGATIVE_SIDE || s3 != CGAL::ON_NEGATIVE_SIDE || s4 != CGAL::ON_NEGATIVE_SIDE ) write_triangle(p2, p3, p4, facecolor, edgecolor, out ); } @@ -968,14 +968,14 @@ write_triangle (const Bare_point& p, const Bare_point& q, const Bare_point& r, { // Color write_color(color, true, out); - + // Triangle out << "Polygon \"P\" ["; write_point(p,out); write_point(q,out); write_point(r,out); out << "]" << std::endl; - + // Edges (will be drawn later on) add_edge(p,q,edge_color); add_edge(p,r,edge_color); @@ -994,7 +994,7 @@ write_tetrahedron (const Bare_point& p, const Bare_point& q, const Bare_point& r { // Color write_color(color, true, out); - + // Triangle out << "Polygon \"P\" ["; write_point(p,out); @@ -1002,7 +1002,7 @@ write_tetrahedron (const Bare_point& p, const Bare_point& q, const Bare_point& r write_point(r,out); write_point(s,out); out << "]" << std::endl; - + // Edges (will be drawn later on) add_edge(p,q,edge_color); add_edge(p,r,edge_color); @@ -1024,7 +1024,7 @@ write_point (const Bare_point& p, std::ofstream& out) { // Transform point in camera coordinates const Bare_point& p_cam = camera_coordinates(p); - + // Write it out << " " << -p_cam.x() << " " << -p_cam.y() << " " << -p_cam.z() << " "; } @@ -1036,12 +1036,12 @@ write_point_sphere(const Bare_point& p, std::ofstream& out) { // Transform point in camera coordinates const Bare_point& p_cam = camera_coordinates(p); - + // radius const double& r = parameters_.sphere_radius; - + out << "Translate " << -p_cam.x() << " " << -p_cam.y() << " " << -p_cam.z() << std::endl; - + // Sphere radius zmin zmax thetamax out << "Sphere " << r << " " << -r << " " << r << " 360" << std::endl; out << "Identity" << std::endl; @@ -1055,50 +1055,50 @@ write_edge_cylinder(const Bare_point& p, const Bare_point& q, std::ofstream& out // Transform point in camera coordinates const Bare_point& p_cam = camera_coordinates(p); const Bare_point& q_cam = camera_coordinates(q); - + double pq = CGAL::to_double(CGAL::sqrt(CGAL::squared_distance(p_cam,q_cam))); - + Aff_transformation_3 t (CGAL::Translation(), Vector_3(p_cam,CGAL::ORIGIN)); const Bare_point& q_cam_t = q_cam.transform(t); - + Vector_3 Oq (CGAL::ORIGIN,q_cam_t); Vector_3 Oz (FT(0),FT(0),FT(1)); - + Vector_3 r_axis = CGAL::cross_product(Oq,Oz); double cos_angle = CGAL::to_double((Oq*Oz)/CGAL::sqrt(Oq.squared_length())); double angle = std::acos(cos_angle) * 180. / CGAL_PI; - + // radius const double& r = parameters_.cylinder_radius; - + out << "Translate " << -p_cam.x() << " " << -p_cam.y() << " " << -p_cam.z() << std::endl; - out << "Rotate " << (angle+180.) << " " << -r_axis.x() << " " << -r_axis.y() << " " << -r_axis.z() << std::endl; - + out << "Rotate " << (angle+180.) << " " << -r_axis.x() << " " << -r_axis.y() << " " << -r_axis.z() << std::endl; + // Cylinder radius zmin zmax thetamax out << "Cylinder " << r << " 0 " << pq << " 360" << std::endl; out << "Identity" << std::endl; } -void +void C3t3_rib_exporter_plugin:: write_edges_flat(std::ofstream& out) { // Lights write_turn_background_light(true,out); - + out << "Surface \"constant\"" << std::endl; write_opacity(CGAL_RIB_NON_TRANSPARENT_MATERIAL_ALPHA, out); - + // Translation out << "Translate 0 0 -0.1" << std::endl; - + for ( Edge_map::iterator it = edges_.begin(), end = edges_.end() ; it != end ; ++it ) { // Color write_color(it->second, true, out); - + // Edge out << "Curves \"linear\" [2] \"nonperiodic\" \"P\" ["; write_point(it->first.first,out); @@ -1108,13 +1108,13 @@ write_edges_flat(std::ofstream& out) } -void +void C3t3_rib_exporter_plugin:: write_edges_volumic(std::ofstream& out) { // Material write_opacity(CGAL_RIB_NON_TRANSPARENT_MATERIAL_ALPHA, out); - + for ( Edge_map::iterator it = edges_.begin(), end = edges_.end() ; it != end ; ++it ) { @@ -1125,13 +1125,13 @@ write_edges_volumic(std::ofstream& out) } } -void +void C3t3_rib_exporter_plugin:: write_vertices_volumic(std::ofstream& out) { // Material write_opacity(CGAL_RIB_NON_TRANSPARENT_MATERIAL_ALPHA, out); - + for ( Vertex_map::iterator it = vertices_.begin(), end = vertices_.end() ; it != end ; ++it ) { @@ -1143,26 +1143,26 @@ write_vertices_volumic(std::ofstream& out) } -void +void C3t3_rib_exporter_plugin:: write_color(const QColor& color, bool use_transparency, std::ofstream& out) { if ( prev_color_ == color ) - { + { return; } - + // Cache data prev_color_ = color; - + // Write opacity data if (use_transparency) { write_opacity(color.alphaF(),out); } - + // Write color data - out << "Color [ " << color.redF() << " " << color.greenF() << " " + out << "Color [ " << color.redF() << " " << color.greenF() << " " << color.blueF() << " ]" << std::endl; } @@ -1175,27 +1175,27 @@ write_opacity(const double alpha, std::ofstream& out) { return; } - + // Cache data prev_alpha_ = alpha; - + // Write opacity data out << "Opacity " << alpha << " " << alpha << " " << alpha << std::endl; } -void +void C3t3_rib_exporter_plugin:: write_background(const QColor& color, std::ofstream& out) { write_turn_background_light(false,out); - + out << "Surface \"constant\"" << std::endl; write_color(color,false,out); - + double corner = zmax_ * 2.; double depth_pos = zmax_ * 1.6; - + out << "Polygon \"P\" ["; out << " " << -corner << " " << -corner << " " << depth_pos << " "; out << " " << corner << " " << -corner << " " << depth_pos << " "; diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt index 7dd9fbd4fce..a2af303f16c 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt @@ -53,7 +53,7 @@ target_link_libraries(mesh_3_optimization_plugin PUBLIC scene_c3t3_item scene_su # Use Eigen find_package(Eigen3 3.1.0 REQUIRED) #(3.1.0 or greater) - + if (EIGEN3_FOUND) CGAL_target_use_Eigen(mesh_3_optimization_plugin) else() #eigen diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp index d9b4fff0ef8..2e03a6886ed 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp @@ -75,7 +75,7 @@ // 0..1 and min_max is the range it came from. struct IntConverter { std::pair min_max; - + int operator()(float f) { float s = f * float((min_max.second - min_max.first)); //approximate instead of just floor. @@ -726,7 +726,7 @@ private: viewer->installEventFilter(y_item); viewer->installEventFilter(z_item); } - + connect(x_item, SIGNAL(selected(CGAL::Three::Scene_item*)), this, SLOT(select_plane(CGAL::Three::Scene_item*))); connect(y_item, SIGNAL(selected(CGAL::Three::Scene_item*)), this, SLOT(select_plane(CGAL::Three::Scene_item*))); connect(z_item, SIGNAL(selected(CGAL::Three::Scene_item*)), this, SLOT(select_plane(CGAL::Three::Scene_item*))); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Optimization_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Optimization_plugin.cpp index d069d109672..869e1a6acf3 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Optimization_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Optimization_plugin.cpp @@ -87,7 +87,7 @@ public: Mesh_3_optimization_plugin(); virtual void init(QMainWindow*, Scene_interface*, Messages_interface*); inline virtual QList actions() const; - + bool applicable(QAction* a) const { Scene_c3t3_item* item = qobject_cast(scene->item(scene->mainSelectionIndex())); @@ -113,16 +113,16 @@ public Q_SLOTS: #ifndef CGAL_MESH_3_DEMO_DISABLE_EXUDER void exude(); #endif - + void optimization_done(Optimizer_thread* t); void status_report(QString s); - + private: Scene_c3t3_item* get_c3t3_item() const; - + void treat_result(Scene_c3t3_item& source_item, Scene_c3t3_item& result_item, const QString& name) const; - + void launch_thread(Optimizer_thread* thread, const QString& msg); private: @@ -132,7 +132,7 @@ private: QAction* actionExude; Messages_interface* msg; QMessageBox* message_box_; - + Scene_c3t3_item* source_item_; Scene_interface *scene; QMainWindow* mw; @@ -152,7 +152,7 @@ Mesh_3_optimization_plugin() { } -void +void Mesh_3_optimization_plugin:: init(QMainWindow* mainWindow, Scene_interface* scene_interface, @@ -160,7 +160,7 @@ init(QMainWindow* mainWindow, { this->scene = scene_interface; this->mw = mainWindow; - + // Create menu items #ifndef CGAL_MESH_3_DEMO_DISABLE_ODT actionOdt = new QAction(tr("odt_optimize_mesh_3"), mw); @@ -170,7 +170,7 @@ init(QMainWindow* mainWindow, connect(actionOdt, SIGNAL(triggered()), this, SLOT(odt())); } #endif - + #ifndef CGAL_MESH_3_DEMO_DISABLE_LLOYD actionLloyd = new QAction(tr("lloyd_optimize_mesh_3"), mw); if( NULL != actionLloyd ) @@ -179,7 +179,7 @@ init(QMainWindow* mainWindow, connect(actionLloyd, SIGNAL(triggered()), this, SLOT(lloyd())); } #endif - + #ifndef CGAL_MESH_3_DEMO_DISABLE_PERTURBER actionPerturb = new QAction(tr("perturb_mesh_3"), mw); if( NULL != actionPerturb ) @@ -188,7 +188,7 @@ init(QMainWindow* mainWindow, connect(actionPerturb, SIGNAL(triggered()), this, SLOT(perturb())); } #endif - + #ifndef CGAL_MESH_3_DEMO_DISABLE_EXUDER actionExude =new QAction(tr("exude_mesh_3"), mw); if( NULL != actionExude ) @@ -197,16 +197,16 @@ init(QMainWindow* mainWindow, connect(actionExude, SIGNAL(triggered()), this, SLOT(exude())); } #endif - + msg = msg_interface; } inline -QList +QList Mesh_3_optimization_plugin::actions() const { - return QList() << actionOdt << actionLloyd + return QList() << actionOdt << actionLloyd << actionPerturb << actionExude; } @@ -237,45 +237,45 @@ Mesh_3_optimization_plugin::odt() &dialog, SLOT(accept())); connect(ui.buttonBox, SIGNAL(rejected()), &dialog, SLOT(reject())); - + connect(ui.noTimeLimit, SIGNAL(toggled(bool)), ui.maxTime, SLOT(setDisabled(bool))); - + ui.objectName->setText(item->name()); namespace cgpd = CGAL::parameters::default_values; ui.convergenceRatio->setValue(cgpd::odt_convergence_ratio); ui.freezeRatio->setValue(cgpd::odt_freeze_ratio); - + int i = dialog.exec(); if(i == QDialog::Rejected) return; - + // 0 means parameter is not considered const double max_time = ui.noTimeLimit->isChecked() ? 0 : ui.maxTime->value(); const int max_iteration_nb = static_cast(ui.maxIterationNb->value()); const double convergence = ui.convergenceRatio->value(); const double freeze = ui.freezeRatio->value(); const bool create_new_item = ui.createNewItem->isChecked(); - + // ----------------------------------- // Launch optimization // ----------------------------------- QApplication::setOverrideCursor(Qt::WaitCursor); - + Optimizer_thread* opt_thread = cgal_code_odt_mesh_3(*item, max_time, convergence, freeze, max_iteration_nb, create_new_item); - + if ( NULL == opt_thread ) { QApplication::restoreOverrideCursor(); return; } - + source_item_ = item; launch_thread(opt_thread, "Odt iterations are running..."); QApplication::restoreOverrideCursor(); @@ -300,25 +300,25 @@ Mesh_3_optimization_plugin::lloyd() ui.setupUi(&dialog); dialog.setWindowFlags(Qt::Dialog|Qt::CustomizeWindowHint|Qt::WindowCloseButtonHint); dialog.setWindowTitle(tr("Lloyd-smoothing parameters")); - + connect(ui.buttonBox, SIGNAL(accepted()), &dialog, SLOT(accept())); connect(ui.buttonBox, SIGNAL(rejected()), &dialog, SLOT(reject())); - + connect(ui.noTimeLimit, SIGNAL(toggled(bool)), ui.maxTime, SLOT(setDisabled(bool))); - + ui.objectName->setText(item->name()); - + namespace cgpd = CGAL::parameters::default_values; ui.convergenceRatio->setValue(cgpd::lloyd_convergence_ratio); ui.freezeRatio->setValue(cgpd::lloyd_freeze_ratio); - + int i = dialog.exec(); if(i == QDialog::Rejected) return; - + // 0 means parameter is not considered const double max_time = ui.noTimeLimit->isChecked() ? 0 : ui.maxTime->value(); const int max_iteration_nb = static_cast(ui.maxIterationNb->value()); @@ -330,7 +330,7 @@ Mesh_3_optimization_plugin::lloyd() // Launch optimization // ----------------------------------- QApplication::setOverrideCursor(Qt::WaitCursor); - + Optimizer_thread* opt_thread = cgal_code_lloyd_mesh_3(*item, max_time, convergence, @@ -358,7 +358,7 @@ Mesh_3_optimization_plugin::perturb() // ----------------------------------- Scene_c3t3_item* item = get_c3t3_item(); if ( NULL == item ) { return; } - + // ----------------------------------- // Dialog box // ----------------------------------- @@ -368,46 +368,46 @@ Mesh_3_optimization_plugin::perturb() ui.sliverBound->setRange(0,180); dialog.setWindowFlags(Qt::Dialog|Qt::CustomizeWindowHint|Qt::WindowCloseButtonHint); dialog.setWindowTitle(tr("Sliver perturbation parameters")); - + connect(ui.buttonBox, SIGNAL(accepted()), &dialog, SLOT(accept())); connect(ui.buttonBox, SIGNAL(rejected()), &dialog, SLOT(reject())); - + connect(ui.noTimeLimit, SIGNAL(toggled(bool)), ui.maxTime, SLOT(setDisabled(bool))); - + connect(ui.noBound, SIGNAL(toggled(bool)), ui.sliverBound, SLOT(setDisabled(bool))); - + ui.objectName->setText(item->name()); - + int i = dialog.exec(); if(i == QDialog::Rejected) return; - + // 0 means parameter is not considered const double max_time = ui.noTimeLimit->isChecked() ? 0 : ui.maxTime->value(); const double sliver_bound = ui.noBound->isChecked() ? 0 : ui.sliverBound->value(); const bool create_new_item = ui.createNewItem->isChecked(); - + // ----------------------------------- // Launch optimization // ----------------------------------- QApplication::setOverrideCursor(Qt::WaitCursor); - + Optimizer_thread* opt_thread = cgal_code_perturb_mesh_3(*item, max_time, sliver_bound, create_new_item); - + if ( NULL == opt_thread ) { QApplication::restoreOverrideCursor(); return; } - + source_item_ = item; launch_thread(opt_thread, "Sliver perturbation is running..."); QApplication::restoreOverrideCursor(); @@ -424,7 +424,7 @@ Mesh_3_optimization_plugin::exude() // ----------------------------------- Scene_c3t3_item* item = get_c3t3_item(); if ( NULL == item ) { return; } - + // ----------------------------------- // Dialog box // ----------------------------------- @@ -433,35 +433,35 @@ Mesh_3_optimization_plugin::exude() ui.setupUi(&dialog); dialog.setWindowFlags(Qt::Dialog|Qt::CustomizeWindowHint|Qt::WindowCloseButtonHint); dialog.setWindowTitle(tr("Sliver exudation parameters")); - + connect(ui.buttonBox, SIGNAL(accepted()), &dialog, SLOT(accept())); connect(ui.buttonBox, SIGNAL(rejected()), &dialog, SLOT(reject())); - + connect(ui.noTimeLimit, SIGNAL(toggled(bool)), ui.maxTime, SLOT(setDisabled(bool))); - + connect(ui.noBound, SIGNAL(toggled(bool)), ui.sliverBound, SLOT(setDisabled(bool))); - + ui.objectName->setText(item->name()); ui.sliverBound->setValue(25.); - + int i = dialog.exec(); if(i == QDialog::Rejected) return; - + // 0 means parameter is not considered const double max_time = ui.noTimeLimit->isChecked() ? 0 : ui.maxTime->value(); const double sliver_bound = ui.noBound->isChecked() ? 0 : ui.sliverBound->value(); const bool create_new_item = ui.createNewItem->isChecked(); - + // ----------------------------------- // Launch optimization // ----------------------------------- QApplication::setOverrideCursor(Qt::WaitCursor); - + Optimizer_thread* opt_thread = cgal_code_exude_mesh_3(*item, max_time, sliver_bound, @@ -472,7 +472,7 @@ Mesh_3_optimization_plugin::exude() QApplication::restoreOverrideCursor(); return; } - + source_item_ = item; launch_thread(opt_thread, "Sliver exudation is running..."); QApplication::restoreOverrideCursor(); @@ -493,14 +493,14 @@ get_c3t3_item() const tr("Selected object is not a mesh... optimization can't be performed")); return NULL; } - + if ( NULL == item->data_item() ) { QMessageBox::critical(mw,tr(""), tr("Can't perturb: data object has been destroyed !")); return NULL; } - + return item; } @@ -514,9 +514,9 @@ treat_result(Scene_c3t3_item& source_item, { result_item.setName(tr("%1 [%2]").arg(source_item.name()) .arg(name)); - + result_item.c3t3_changed(); - + // If a new item has been created if ( &source_item != &result_item) { @@ -524,23 +524,23 @@ treat_result(Scene_c3t3_item& source_item, result_item.setPosition((bbox.xmin() + bbox.xmax())/2.f, (bbox.ymin() + bbox.ymax())/2.f, (bbox.zmin() + bbox.zmax())/2.f); - + result_item.setColor(QColor(59,74,226)); result_item.setRenderingMode(source_item.renderingMode()); result_item.set_data_item(source_item.data_item()); source_item.setVisible(false); - + const Scene_interface::Item_id index = scene->mainSelectionIndex(); scene->itemChanged(index); - + Scene_interface::Item_id new_item_id = scene->addItem(&result_item); scene->setSelectedItem(new_item_id); } else { result_item.update_histogram(); - + const Scene_interface::Item_id index = scene->mainSelectionIndex(); scene->itemChanged(index); } @@ -553,7 +553,7 @@ optimization_done(Optimizer_thread* thread) { CGAL::Mesh_optimization_return_code return_code = thread->return_code(); QString name = thread->optimizer_name(); - + // Print message in console QString str = QString("%1 of \"%2\" done in %3s
" "End reason: '%4'
") @@ -561,14 +561,14 @@ optimization_done(Optimizer_thread* thread) .arg(source_item_->name()) .arg(thread->time()) .arg(translate(return_code)); - + Q_FOREACH( QString param, thread->parameters_log() ) { str.append(QString("( %1 )
").arg(param)); } - + CGAL::Three::Three::information(qPrintable(str)); - + // Treat new c3t3 item Scene_c3t3_item* result_item = thread->item(); treat_result( *source_item_, *result_item, name); @@ -592,25 +592,25 @@ launch_thread(Optimizer_thread* opt_thread, const QString& window_text) window_text, QMessageBox::Cancel, mw); - + message_box_->setDefaultButton(QMessageBox::Cancel); QAbstractButton* cancelButton = message_box_->button(QMessageBox::Cancel); cancelButton->setText(tr("Stop")); - + QObject::connect(cancelButton, SIGNAL(clicked()), opt_thread, SLOT(stop())); - + message_box_->show(); - + // ----------------------------------- // Connect main thread to optimization thread and launch optimizer // ----------------------------------- QObject::connect(opt_thread, SIGNAL(done(Optimizer_thread*)), this, SLOT(optimization_done(Optimizer_thread*))); - + QObject::connect(opt_thread, SIGNAL(status_report(QString)), this, SLOT(status_report(QString))); - + opt_thread->start(); } @@ -621,7 +621,7 @@ Mesh_3_optimization_plugin:: status_report(QString str) { if ( NULL == message_box_ ) { return; } - + message_box_->setInformativeText(str); } @@ -639,7 +639,7 @@ translate(CGAL::Mesh_optimization_return_code rc) case CGAL::MAX_ITERATION_NUMBER_REACHED: return QString("Max iteration number reached"); case CGAL::ALL_VERTICES_FROZEN: return QString("All vertices have been frozen"); } - + return QString("ERROR"); } diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/PMP/CMakeLists.txt index 3dc0a808de7..f5380d67133 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/CMakeLists.txt @@ -28,7 +28,7 @@ if(EIGEN3_FOUND) polyhedron_demo_plugin(hole_filling_polyline_plugin Hole_filling_polyline_plugin ) target_link_libraries(hole_filling_polyline_plugin PUBLIC scene_surface_mesh_item scene_polylines_item) CGAL_target_use_Eigen(hole_filling_polyline_plugin) - + qt5_wrap_ui( Mean_curvature_flow_skeleton_pluginUI_FILES Mean_curvature_flow_skeleton_plugin.ui) polyhedron_demo_plugin(mean_curvature_flow_skeleton_plugin Mean_curvature_flow_skeleton_plugin ${Mean_curvature_flow_skeleton_pluginUI_FILES}) target_link_libraries(mean_curvature_flow_skeleton_plugin @@ -49,7 +49,7 @@ if(EIGEN3_FOUND) target_compile_definitions( smoothing_plugin PRIVATE CGAL_PMP_USE_CERES_SOLVER ) target_link_libraries(smoothing_plugin PUBLIC ceres) endif() - + CGAL_target_use_Eigen(extrude_plugin) else() message(STATUS "NOTICE: The hole filling and fairing plugins require Eigen 3.2 (or higher) and will not be available.") diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Distance_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Distance_plugin.cpp index 6c9347d72d7..587e34051c9 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Distance_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Distance_plugin.cpp @@ -99,7 +99,7 @@ public: } getTriangleContainer(0)->draw(viewer, false); } - + void drawEdges(Viewer_interface* viewer) const { getEdgeContainer(0)->setColor(QColor(Qt::black)); @@ -168,11 +168,11 @@ private: normals.resize(0); colors.resize(0); - typedef Kernel::Vector_3 Vector; + typedef Kernel::Vector_3 Vector; typedef boost::graph_traits::face_descriptor face_descriptor; typedef boost::graph_traits::vertex_descriptor vertex_descriptor; - typedef boost::property_map::type VPmap; + typedef boost::property_map::type VPmap; VPmap vpmap = get(CGAL::vertex_point,*poly); //facets @@ -190,7 +190,7 @@ private: for(boost::graph_traits::face_descriptor f : faces(*poly)) { Vector nf = get(nf_pmap, f); typedef FacetTriangulator::vertex_descriptor> FT; - + //compute distance with other polyhedron //sample facet std::vector sampled_points; @@ -277,8 +277,8 @@ private: //edges { //Lines - typedef Kernel::Point_3 Point; - typedef boost::graph_traits::edge_descriptor edge_descriptor; + typedef Kernel::Point_3 Point; + typedef boost::graph_traits::edge_descriptor edge_descriptor; for(edge_descriptor he : edges(*poly)){ const Point& a = get(vpmap,target(he,*poly)); @@ -295,10 +295,10 @@ private: } } } - + Tc* tc = getTriangleContainer(0); Ec* ec = getEdgeContainer(0); - + tc->allocate( Tc::Flat_vertices, m_vertices.data(), @@ -319,7 +319,7 @@ private: setBuffersFilled(true); QApplication::restoreOverrideCursor(); } - + void initializeBuffers(Viewer_interface *viewer)const { Tc* tc = getTriangleContainer(0); diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp index 9d9f937cbe1..f8b9817b0fc 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp @@ -80,7 +80,7 @@ struct Bot double d; PMAP pmap; NMAP nmap; - + }; template void operator()(const T& v1, VD v2) const { @@ -127,19 +127,19 @@ public : polylines(polylines), graph(graph), transfo(transfo){} - + ~ParamItem() { delete component; } - + QRectF boundingRect() const { return bounding_rect; } - + void set_transfo(EPICK::Aff_transformation_2 t){ transfo = t;} - + void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) { QPen pen; @@ -152,12 +152,12 @@ public : painter->setBrush(brush); SMesh::Property_map u; SMesh::Property_map v; - + u = graph->add_property_map ("h:u", 0.0f).first; v = graph->add_property_map ("h:v", 0.0f).first; - + for( Component::iterator fi = component->begin(); fi != component->end(); @@ -173,7 +173,7 @@ public : points[2] = QPointF(get(u, h), -get(v, h)); painter->drawPolygon(points,3); } - + pen.setColor(Qt::red); pen.setWidth(0); painter->setPen(pen); @@ -190,13 +190,13 @@ public : painter->drawPolyline(points.data(), static_cast(points.size())); } } - + private: QString texMesh_name; QRectF bounding_rect; Component* component; const std::vector >& polylines; - + SMesh* graph; EPICK::Aff_transformation_2 transfo; }; @@ -208,7 +208,7 @@ public: :CGAL::Qt::GraphicsViewNavigation(), prev_pos(QPoint(0,0)) { } - + protected: bool eventFilter(QObject *obj, QEvent *ev) { @@ -231,14 +231,14 @@ protected: { qreal dir[2] = {v->mapToScene(me->pos()).x() - prev_pos.x(), v->mapToScene(me->pos()).y() - prev_pos.y()}; - + v->translate(dir[0],dir[1]); v->update(); } prev_pos = v->mapToScene(me->pos()); break; } - + case QEvent::MouseButtonPress: { is_dragging = true; break; @@ -260,7 +260,7 @@ protected: v->update(); break; } - + case QEvent::MouseButtonDblClick: { v->fitInView(v->scene()->itemsBoundingRect(), Qt::KeepAspectRatio); break; @@ -295,7 +295,7 @@ class Q_DECL_EXPORT Engrave_text_plugin : Q_OBJECT Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") - + private: typedef CGAL::Surface_mesh_shortest_path_traits SP_traits; typedef CGAL::Surface_mesh_shortest_path Surface_mesh_shortest_path; @@ -305,7 +305,7 @@ private: typedef CGAL::AABB_tree Tree; typedef EPICK::Point_3 Point_3; Messages_interface* messages; - + public : ~Engrave_text_plugin() { @@ -319,7 +319,7 @@ public : this->scene = Three::scene(); this->mw = Three::mainWindow(); messages = m; - + //action QAction* actionFitText= new QAction("Fit Text", mw); connect(actionFitText, SIGNAL(triggered()), @@ -337,13 +337,13 @@ public : this, &Engrave_text_plugin::generateTextItem); connect(dock_widget->letter_checkBox, &QCheckBox::toggled, this, &Engrave_text_plugin::generateTextItem); - + //items visu_item = nullptr; sel_item = nullptr; textMesh = nullptr; sm = nullptr; - + //transfo angle = 0.0; scalX=1.0; @@ -369,45 +369,45 @@ public : scene->setSelectedItem(scene->item_id(sel_item)); visualize(); }); - + connect(dock_widget->bot_slider, &QSlider::valueChanged, this, [this](){ if(textMesh) generateTextItem(); }); - + connect(dock_widget->top_slider, &QSlider::valueChanged, this, [this](){ if(textMesh) generateTextItem(); }); - + connect(dock_widget->reset_button, &QPushButton::clicked, this, [this](){ cleanup(); }); - + connect(dock_widget->t_up_pushButton, &QPushButton::clicked, this, [this](){ translation += EPICK::Vector_2(0,0.005); scene->setSelectedItem(scene->item_id(sel_item)); visualize(); }); - + connect(dock_widget->t_down_pushButton, &QPushButton::clicked, this, [this](){ translation -= EPICK::Vector_2(0,0.005); scene->setSelectedItem(scene->item_id(sel_item)); visualize(); }); - + connect(dock_widget->t_right_pushButton, &QPushButton::clicked, this, [this](){ translation += EPICK::Vector_2(0.005,0); scene->setSelectedItem(scene->item_id(sel_item)); visualize(); }); - + connect(dock_widget->t_left_pushButton, &QPushButton::clicked, this, [this](){ translation -= EPICK::Vector_2(0.005,0); @@ -443,7 +443,7 @@ public Q_SLOTS: { dock_widget->setVisible(!dock_widget->isVisible()); } - + void visualize() { if(!sel_item) sel_item = @@ -464,7 +464,7 @@ public Q_SLOTS: if(visu_item) scene->erase(scene->item_id(visu_item)); visu_item = nullptr; - + if(!sm) { sm = new SMesh(); @@ -473,22 +473,22 @@ public Q_SLOTS: CGAL::Polygon_mesh_processing::longest_border(*sm).first; SMesh::Property_map uv_map = sm->add_property_map("v:uv").first; - + // Parameterized bool pmap boost::unordered_set vs; SMP::internal::Bool_property_map< boost::unordered_set > vpm(vs); - + // Parameterizer SMP::ARAP_parameterizer_3 parameterizer; - - SMP::Error_code status = parameterizer.parameterize(*sm, hd, uv_map, + + SMP::Error_code status = parameterizer.parameterize(*sm, hd, uv_map, get(boost::vertex_index, *sm), vpm); if(status != SMP::OK) { std::cout << "Encountered a problem: " << status << std::endl; cleanup(); return ; } - + std::cout << "Parameterized with ARAP (SM) computed." << std::endl; xmin = std::numeric_limits::max(); xmax = std::numeric_limits::min(); @@ -504,27 +504,27 @@ public Q_SLOTS: xmax = uv_map[v][0]; if(uv_map[v][0] < xmin) xmin = uv_map[v][0]; - + if(uv_map[v][1] > ymax) ymax = uv_map[v][1]; if(uv_map[v][1] < ymin) ymin = uv_map[v][1]; } - + CGAL::linear_least_squares_fitting_2( uv_map.begin(), uv_map.end(), bf_line, CGAL::Dimension_tag<0>()); - + EPICK::Vector_2 A(bf_line.to_vector()), - B(EPICK::Point_2(0,0), - EPICK::Point_2(1,0)); + B(EPICK::Point_2(0,0), + EPICK::Point_2(1,0)); if (A.x()<0) A=-A; angle = std::acos(A.x()/CGAL::sqrt(A.squared_length())); if ( A.y()<0 ) angle+=3*CGAL_PI/2.; if (angle>2*CGAL_PI) angle-=2*CGAL_PI; - + locked = true; dock_widget->rot_slider->setSliderPosition(angle*180.0/CGAL_PI); locked = false; @@ -538,7 +538,7 @@ public Q_SLOTS: polylines.clear(); float pxmin(8000),pxmax(-8000), pymin(8000), pymax(-8000); - + Q_FOREACH(QPolygonF poly, polys){ Q_FOREACH(QPointF pf, poly) { @@ -563,16 +563,16 @@ public Q_SLOTS: )); } } - + // build AABB-tree for face location queries Tree aabb_tree(faces(*sm).first, faces(*sm).second, *sm, uv_map_3); - + visu_item = new Scene_polylines_item; - - + + // compute 3D coordinates transfo = - EPICK::Aff_transformation_2(CGAL::TRANSLATION, + EPICK::Aff_transformation_2(CGAL::TRANSLATION, EPICK::Vector_2((xmax-xmin)/2+xmin, (ymax-ymin)/2+ymin)+ translation) * EPICK::Aff_transformation_2(CGAL::ROTATION,sin(angle), cos(angle)) @@ -586,7 +586,7 @@ public Q_SLOTS: for(const EPICK::Point_2& p : polyline) { EPICK::Point_2 p_2 = transfo.transform(p); - + Face_location loc = Surface_mesh_shortest_path::locate( Point_3(p_2.x(), p_2.y(), 0), aabb_tree, *sm, uv_map_3); @@ -599,7 +599,7 @@ public Q_SLOTS: scene->addItem(visu_item); dock_widget->engraveButton->setEnabled(true); dock_widget->text_meshButton->setEnabled(true); - + if(graphics_scene->items().empty()) { Component* component = new Component(); @@ -629,7 +629,7 @@ public Q_SLOTS: put(umap, *it, static_cast(u)); put(vmap, *it, static_cast(v)); } - + //ParamItem does not take ownership of text_mesh_bottom ParamItem *param_item= new ParamItem(component, polylines, transfo, sm, QRectF(QPointF(xmin, -ymax), QPointF(xmax, -ymin))); @@ -645,7 +645,7 @@ public Q_SLOTS: } // dock_widget->visualizeButton->setEnabled(false); } - + void create_text_mesh(SMesh& text_mesh) { if(!visu_item) @@ -691,7 +691,7 @@ public Q_SLOTS: bbox += CGAL::bbox_2(points.begin(), points.end(), EPICK()); } mark_nested_domains(cdt); - + SMesh text_mesh_bottom; cdt2_to_face_graph(cdt, text_mesh_bottom); @@ -700,17 +700,17 @@ public Q_SLOTS: NPMAP vnormals = text_mesh_bottom.add_property_map("v:normal").first; - + if(!dock_widget->letter_checkBox->isChecked()) { CGAL::Polygon_mesh_processing::compute_vertex_normals(text_mesh_bottom, vnormals); } else{ - // \todo Computing normals before the final + // \todo Computing normals before the final // mesh would be better. - + //foreach CC - SMesh::Property_map fcmap = + SMesh::Property_map fcmap = text_mesh_bottom.add_property_map("f:cc", 0).first; std::size_t nb_cc = PMP::connected_components(text_mesh_bottom, fcmap); @@ -718,7 +718,7 @@ public Q_SLOTS: { //compute the average normal for the cc give it to every vertex EPICK::Vector_3 normal(0,0,0); - CGAL::Face_filtered_graph fmesh(text_mesh_bottom, + CGAL::Face_filtered_graph fmesh(text_mesh_bottom, static_cast(cc), fcmap); for(vertex_descriptor vd : vertices(fmesh)) @@ -734,34 +734,34 @@ public Q_SLOTS: } Bot bot(vnormals, dock_widget->bot_slider->value()/100000.0, get(CGAL::vertex_point, text_mesh)); - Top top(vnormals, get(CGAL::vertex_point, text_mesh), + Top top(vnormals, get(CGAL::vertex_point, text_mesh), dock_widget->top_slider->value()/100000.0); PMP::extrude_mesh(text_mesh_bottom, text_mesh, bot, top); } - + void engrave() { QApplication::setOverrideCursor(Qt::WaitCursor); SMesh text_mesh_complete; create_text_mesh(text_mesh_complete); - + if (PMP::does_self_intersect(text_mesh_complete)) { QApplication::restoreOverrideCursor(); CGAL::Three::Three::information("Error: text mesh self-intersects!"); return; } - + SMesh result; CGAL::copy_face_graph(*sel_item->polyhedron(), result); bool OK = PMP::corefine_and_compute_difference(result, text_mesh_complete, result); - + if (!OK) { QApplication::restoreOverrideCursor(); CGAL::Three::Three::information("Error: the output mesh is not manifold!"); return; } - + CGAL::Polygon_mesh_processing::triangulate_faces(result); Scene_surface_mesh_item* result_item = new Scene_surface_mesh_item( result); @@ -777,11 +777,11 @@ public Q_SLOTS: dock_widget->text_meshButton->setEnabled(false); dock_widget->visualizeButton->setEnabled(true); } - + void generateTextItem() { QApplication::setOverrideCursor(Qt::WaitCursor); - + if(textMesh) { textMesh->face_graph()->clear(); @@ -801,12 +801,12 @@ public Q_SLOTS: } QApplication::restoreOverrideCursor(); } - + void closure()Q_DECL_OVERRIDE { dock_widget->hide(); } - + private: template void @@ -836,8 +836,8 @@ private: } } } - - + + template void mark_nested_domains(CDT& cdt) @@ -857,15 +857,15 @@ private: } } } - + template void cdt2_to_face_graph(const CDT& cdt, TriangleMesh& tm) { - + Tree aabb_tree(faces(*sm).first, faces(*sm).second, *sm, uv_map_3); typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; - + typedef std::map Map; Map descriptors; for (typename CDT::Finite_faces_iterator fit=cdt.finite_faces_begin(), @@ -890,11 +890,11 @@ private: } vds[i]=it->second; } - + CGAL::Euler::add_face(vds, tm); } } - + void cleanup() { dock_widget->scalX_slider->setValue(1000); @@ -919,7 +919,7 @@ private: visu_item = nullptr; } } - + QList _actions; EngraveWidget* dock_widget; Scene_polylines_item* visu_item; diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Fairing_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Fairing_plugin.cpp index 862305a886e..93c130d4854 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Fairing_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Fairing_plugin.cpp @@ -39,9 +39,9 @@ class Polyhedron_demo_fairing_plugin : Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "fairing_plugin.json") public: - bool applicable(QAction*) const { + bool applicable(QAction*) const { return qobject_cast(scene->item(scene->mainSelectionIndex())) - || qobject_cast(scene->item(scene->mainSelectionIndex())); + || qobject_cast(scene->item(scene->mainSelectionIndex())); } void print_message(QString message) { CGAL::Three::Three::information(message);} QList actions() const { return QList() << actionFairing; } @@ -69,8 +69,8 @@ public: dock_widget->setWindowTitle(tr( "Fairing " )); - - connect(ui_widget.Fair_button, SIGNAL(clicked()), this, SLOT(on_Fair_button_clicked())); + + connect(ui_widget.Fair_button, SIGNAL(clicked()), this, SLOT(on_Fair_button_clicked())); connect(ui_widget.Refine_button, SIGNAL(clicked()), this, SLOT(on_Refine_button_clicked())); } virtual void closure() diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Hole_filling_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Hole_filling_plugin.cpp index bc1b95091c2..8e20942414e 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Hole_filling_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Hole_filling_plugin.cpp @@ -125,7 +125,7 @@ public: return (m == Wireframe); } void drawEdges(CGAL::Three::Viewer_interface* viewer) const { - + for(Polyline_data_list::const_iterator it = polyline_data_list.begin(); it != polyline_data_list.end(); ++it) { if(it == active_hole) { it->polyline->setWidth(7); } else { it->polyline->setWidth(3); } @@ -218,7 +218,7 @@ private: } clear(); - + Face_graph& poly = *poly_item->polyhedron(); boost::unordered_set visited; @@ -301,7 +301,7 @@ private: selected_holes.clear(); active_hole = polyline_data_list.end(); } - + Polyline_data_list::const_iterator active_hole; Mouse_keyboard_state state; public: @@ -451,7 +451,7 @@ void Polyhedron_demo_hole_filling_plugin::init(QMainWindow* mainWindow, dock_widget->setWindowTitle(tr( "Hole Filling" )); - + connect(ui_widget.Fill_from_selection_button, SIGNAL(clicked()), this, SLOT(on_Fill_from_selection_button())); connect(ui_widget.Visualize_holes_button, SIGNAL(clicked()), this, SLOT(on_Visualize_holes_button())); connect(ui_widget.Fill_selected_holes_button, SIGNAL(clicked()), this, SLOT(on_Fill_selected_holes_button())); diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp index 2049f788572..c00c1fee0d3 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp @@ -383,9 +383,9 @@ public Q_SLOTS: { QApplication::restoreOverrideCursor(); //If facets are selected, splitting edges will add facets that won't be selected, and it will mess up the rest. - //If there is only edges, it will work fine because new edges are dealt with in the code, so we can directly + //If there is only edges, it will work fine because new edges are dealt with in the code, so we can directly //split and continue. - // Possibility todo: check if the barycenter of a new face is inside an old selected face to + // Possibility todo: check if the barycenter of a new face is inside an old selected face to //select it again. if(!selection_item->selected_facets.empty()) { @@ -398,7 +398,7 @@ public Q_SLOTS: else if(QMessageBox::question(mw, tr("Error"), tr("Isotropic remeshing : protect_constraints cannot be set to" " true with constraints larger than 4/3 * target_edge_length." - " Do you wish to split the constrained edges ?")) != + " Do you wish to split the constrained edges ?")) != QMessageBox::Yes) { return; @@ -460,7 +460,7 @@ public Q_SLOTS: .vertex_is_constrained_map(selection_item->constrained_vertices_pmap())); } } - + SMesh mesh_ = *selection_item->polyhedron(); std::vector are_edges_removed; are_edges_removed.resize(mesh_.number_of_edges()+mesh_.number_of_removed_edges()); @@ -472,11 +472,11 @@ public Q_SLOTS: if(!are_edges_removed[i]) are_edges_constrained[i] = get(selection_item->constrained_edges_pmap(), SMesh::Edge_index(static_cast(i))); } - - + + int i0, i1, nE(mesh_.number_of_edges()+mesh_.number_of_removed_edges()); - + //get constrained values in order. if (nE > 0) { @@ -487,7 +487,7 @@ public Q_SLOTS: while (!are_edges_removed[i0] && i0 < i1) ++i0; while ( are_edges_removed[i1] && i0 < i1) --i1; if (i0 >= i1) break; - + // swap std::swap(are_edges_constrained[i0], are_edges_constrained[i1]); std::swap(are_edges_removed[i0], are_edges_removed[i1]); @@ -506,7 +506,7 @@ public Q_SLOTS: { selection_item->polyhedron_item()->setItemIsMulticolor(false); } - + selection_item->polyhedron_item()->polyhedron()->collect_garbage(); //fix constrained_edges_map for(int i=0; i< nE; ++i) @@ -515,7 +515,7 @@ public Q_SLOTS: pmap = selection_item->constrained_edges_pmap(); put(pmap, SMesh::Edge_index(i), are_edges_constrained[i]); } - + selection_item->poly_item_changed(); selection_item->clear(); selection_item->changed_with_poly_item(); @@ -564,7 +564,7 @@ public Q_SLOTS: if (preserve_duplicates) { detect_and_split_duplicates(poly_items, edges_to_protect_map, target_length); - + } Scene_polyhedron_selection_item::Is_constrained_map ecm(&edges_to_protect); for(edge_descriptor e : edges(pmesh)) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Mean_curvature_flow_skeleton_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Mean_curvature_flow_skeleton_plugin.cpp index ec78f541cf3..e47d749b43d 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Mean_curvature_flow_skeleton_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Mean_curvature_flow_skeleton_plugin.cpp @@ -61,27 +61,27 @@ struct Polyline_visitor { typedef std::vector Polyline; typedef std::vector Polyline_of_ids; - + std::list& polylines; Skeleton& skeleton; - + Polyline_visitor(std::list& lines, Skeleton& skeleton) : polylines(lines), skeleton(skeleton) {} - + void start_new_polyline() { Polyline V; polylines.push_back(V); } - + void add_node(boost::graph_traits::vertex_descriptor vd) { Polyline& polyline = polylines.back(); polyline.push_back(skeleton[vd].point); } - + void end_polyline(){} }; @@ -102,7 +102,7 @@ public: { delete ui; } - + void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface*) { this->mw = mainWindow; @@ -235,7 +235,7 @@ public: // the algorithm is only applicable on a mesh // that has only one connected component - + boost::unordered_map::face_descriptor,int> cc(num_faces(*pMesh)); std::size_t num_component = PMP::connected_components(*pMesh, boost::make_assoc_property_map(cc)); @@ -365,12 +365,12 @@ void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionSegment() // init the polyhedron simplex indices CGAL::set_halfedgeds_items_id(*item->input_triangle_mesh); - boost::property_map::type + boost::property_map::type vimap = get(boost::vertex_index, *item->input_triangle_mesh); //for each input vertex compute its distance to the skeleton std::vector distances(num_vertices(*item->input_triangle_mesh)); - + Face_graph *smesh = item->input_triangle_mesh; boost::property_map::type vpm @@ -423,7 +423,7 @@ void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionSegment() if(segment > nb_segment) nb_segment = segment + 1; put(fpim, fd, segment); - + } item_segmentation->setItemIsMulticolor(true); item_segmentation->computeItemColorVectorAutomatically(true); @@ -652,7 +652,7 @@ if(!contracted_item) ps->insert(point); } ps->select_all(); - + if (item->fixedPointsItemIndex == -1) { item->fixedPointsItemIndex = scene->addItem(fixedPointsItem); @@ -824,7 +824,7 @@ void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionConverge() ps->insert(point); } ps->select_all(); - + if (item->fixedPointsItemIndex == -1) { item->fixedPointsItemIndex = scene->addItem(fixedPointsItem); diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Repair_polyhedron_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Repair_polyhedron_plugin.cpp index 92da2e43934..d99c18ce2d9 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Repair_polyhedron_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Repair_polyhedron_plugin.cpp @@ -261,7 +261,7 @@ void Polyhedron_demo_repair_polyhedron_plugin::on_actionAutorefineAndRMSelfInter if (poly_item) { try{ - bool solved = + bool solved = CGAL::Polygon_mesh_processing::experimental:: autorefine_and_remove_self_intersections(*poly_item->polyhedron()); if (!solved) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Selection_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Selection_plugin.cpp index be80490894e..2fda0097ea5 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Selection_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Selection_plugin.cpp @@ -79,14 +79,14 @@ class Polyhedron_demo_selection_plugin : public: QString nameFilters() const override { return "Selection files(*.selection.txt)"; } QString name() const override { return "selection_sm_plugin"; } - + bool canLoad(QFileInfo) const override { Scene_item * item = CGAL::Three::Three::scene()->item( CGAL::Three::Three::scene()->mainSelectionIndex()); Scene_facegraph_item* fg_item = qobject_cast(item); if(fg_item) return true; - Scene_polyhedron_selection_item* sel_item = + Scene_polyhedron_selection_item* sel_item = qobject_cast(item); if (sel_item) return true; @@ -126,7 +126,7 @@ public: items.pop_front(); return res; } - + bool isDefaultLoader(const Scene_item* item) const override{ if(qobject_cast(item)) return true; @@ -192,8 +192,8 @@ public: connect(ui_widget.Inverse_selection_button, SIGNAL(clicked()), this, SLOT(on_Inverse_selection_button_clicked())); connect(ui_widget.Select_isolated_components_button, SIGNAL(clicked()), this, SLOT(on_Select_isolated_components_button_clicked())); connect(ui_widget.Get_minimum_button, SIGNAL(clicked()), this, SLOT(on_Get_minimum_button_clicked())); - connect(ui_widget.Create_selection_item_button, SIGNAL(clicked()), this, SLOT(on_Create_selection_item_button_clicked())); - connect(ui_widget.Selection_type_combo_box, SIGNAL(currentIndexChanged(int)), + connect(ui_widget.Create_selection_item_button, SIGNAL(clicked()), this, SLOT(on_Create_selection_item_button_clicked())); + connect(ui_widget.Selection_type_combo_box, SIGNAL(currentIndexChanged(int)), this, SLOT(on_Selection_type_combo_box_changed(int))); connect(ui_widget.lassoCheckBox, &QCheckBox::toggled, this, &Polyhedron_demo_selection_plugin::on_LassoCheckBox_changed); @@ -208,12 +208,12 @@ public: ui_widget.Add_to_selection_button->hide(); ui_widget.Select_all_NTButton->hide(); QObject* scene = dynamic_cast(scene_interface); - if(scene) { + if(scene) { connect(scene, SIGNAL(itemAboutToBeDestroyed(CGAL::Three::Scene_item*)), this, SLOT(item_about_to_be_destroyed(CGAL::Three::Scene_item*))); connect(scene, SIGNAL(newItem(int)), this, SLOT(new_item_created(int))); connect(scene, SIGNAL(selectionChanged(int)), this, SLOT(filter_operations())); - } - + } + //Fill operations combo box. operations_strings = { "Create Point Set from Selected Vertices" , @@ -225,9 +225,9 @@ public: "Convert from Edge Selection to Facets Selection" , "Convert from Edge Selection to Point Selection" , "Convert from Facet Selection to Boundary Edge Selection", - "Convert from Facet Selection to Point Selection" + "Convert from Facet Selection to Point Selection" }; - + operations_map[operations_strings[0]] = 0; operations_map[operations_strings[1]] = 1; operations_map[operations_strings[2]] = 2; @@ -374,11 +374,11 @@ public Q_SLOTS: Scene_polyhedron_selection_item* selection_item = getSelectedItem(); if(!selection_item) { print_message("Error: there is no selected polyhedron selection item!"); - return; + return; } if(ui_widget.tabWidget->currentIndex() == 0) selection_item->clear(); - else //case current tab is Components, then active simplices are edges. + else //case current tab is Components, then active simplices are edges. { selection_item->selected_edges.clear(); selection_item->invalidateOpenGLBuffers(); @@ -413,7 +413,7 @@ public Q_SLOTS: selection_item = onTheFlyItem(); if(!selection_item) { print_message("Error: there is no selected polyhedron selection item!"); - return; + return; } boost::optional minimum = @@ -429,7 +429,7 @@ public Q_SLOTS: selection_item = onTheFlyItem(); if(!selection_item) { print_message("Error: there is no selected polyhedron selection item!"); - return; + return; } boost::optional minimum = selection_item->get_minimum_isolated_component(); if(minimum) { @@ -439,13 +439,13 @@ public Q_SLOTS: } // Create selection item for selected polyhedron item void on_Create_selection_item_button_clicked() { - + Scene_face_graph_item* poly_item = qobject_cast(scene->item(scene->mainSelectionIndex())); if(!poly_item) { print_message("Error: there is no selected " "Surface_mesh " "item!"); - return; + return; } if(selection_item_map.find(poly_item) != selection_item_map.end()) return; @@ -516,7 +516,7 @@ public Q_SLOTS: } filter_operations(); } - + void on_Insertion_radio_button_toggled(bool toggle){ for(Selection_item_map::iterator it = selection_item_map.begin(); it != selection_item_map.end(); ++it) { it->second->set_is_insert(toggle); @@ -579,7 +579,7 @@ public Q_SLOTS: std::map p2vd; std::map::iterator it_find; bool insert_OK; - + Face_graph * poly = selection_item->polyhedron(); VPmap vpm = get(CGAL::vertex_point,*poly); for(Scene_polyhedron_selection_item::Selection_set_edge::iterator begin = selection_item->selected_edges.begin(); @@ -940,7 +940,7 @@ public Q_SLOTS: Scene_polyhedron_selection_item* selection_item = getSelectedItem(); if(!selection_item) { print_message("Error: there is no selected polyhedron selection item!"); - return; + return; } int steps = ui_widget.Expand_reduce_spin_box->value(); @@ -950,7 +950,7 @@ public Q_SLOTS: // To handle empty selection items coming from loader void new_item_created(int item_id) { typedef Scene_polyhedron_selection_item::Active_handle Active_handle; - Scene_polyhedron_selection_item* selection_item = + Scene_polyhedron_selection_item* selection_item = qobject_cast(scene->item(item_id)); if(!selection_item) { return; } @@ -1009,7 +1009,7 @@ public Q_SLOTS: // connect(selection_item,SIGNAL(simplicesSelected(CGAL::Three::Scene_item*)), scene_ptr, SLOT(setSelectedItem(CGAL::Three::Scene_item*))); connect(selection_item,SIGNAL(isCurrentlySelected(Scene_facegraph_item_k_ring_selection*)), this, SLOT(isCurrentlySelected(Scene_facegraph_item_k_ring_selection*))); on_LassoCheckBox_changed(ui_widget.lassoCheckBox->isChecked()); - + if(!from_plugin){ ui_widget.selectionOrEuler->setCurrentIndex(0); } @@ -1047,23 +1047,23 @@ public Q_SLOTS: } void filter_operations() { - Scene_polyhedron_selection_item* selection_item = + Scene_polyhedron_selection_item* selection_item = qobject_cast(scene->item( scene->mainSelectionIndex())); - if (!selection_item) + if (!selection_item) return; QString current_op = ui_widget.operationsBox->currentText(); ui_widget.operationsBox->clear(); - - bool has_v(!selection_item->selected_vertices.empty() || - ui_widget.Selection_type_combo_box->currentIndex() == 0), - has_e(!selection_item->selected_edges.empty()|| - ui_widget.Selection_type_combo_box->currentIndex() == 2|| - ui_widget.Selection_type_combo_box->currentIndex() == 4), - has_f(!selection_item->selected_facets.empty()|| - ui_widget.Selection_type_combo_box->currentIndex() == 1|| + + bool has_v(!selection_item->selected_vertices.empty() || + ui_widget.Selection_type_combo_box->currentIndex() == 0), + has_e(!selection_item->selected_edges.empty()|| + ui_widget.Selection_type_combo_box->currentIndex() == 2|| + ui_widget.Selection_type_combo_box->currentIndex() == 4), + has_f(!selection_item->selected_facets.empty()|| + ui_widget.Selection_type_combo_box->currentIndex() == 1|| ui_widget.Selection_type_combo_box->currentIndex() == 3); - + if(has_v) { ui_widget.operationsBox->addItem(operations_strings[0]); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_average_spacing_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_average_spacing_plugin.cpp index 037c7b5123d..dc5999db9a6 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_average_spacing_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_average_spacing_plugin.cpp @@ -53,7 +53,7 @@ class Polyhedron_demo_point_set_average_spacing_plugin : private: QAction* actionAverageSpacing; - + public: void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface*) { scene = scene_interface; @@ -67,7 +67,7 @@ public: QList actions() const { return QList() << actionAverageSpacing; } - + //! Applicable if the currently selected item is a //! points_with_normal_item. bool applicable(QAction*) const { @@ -104,9 +104,9 @@ void Polyhedron_demo_point_set_average_spacing_plugin::on_actionAverageSpacing_t 1000, // max 1, // step &ok); - if(!ok) + if(!ok) return; - + QApplication::setOverrideCursor(Qt::BusyCursor); QApplication::processEvents(); CGAL::Real_timer task_timer; task_timer.start(); @@ -115,15 +115,15 @@ void Polyhedron_demo_point_set_average_spacing_plugin::on_actionAverageSpacing_t // Computes average spacing Compute_average_spacing_functor functor (points, nb_neighbors); run_with_qprogressdialog (functor, "Computing average spacing...", mw); - + double average_spacing = *functor.result; // Print result Kernel::Sphere_3 bsphere = points->bounding_sphere(); double radius = std::sqrt(bsphere.squared_radius()); std::size_t memory = CGAL::Memory_sizer().virtual_size(); - std::cerr << "Average spacing = " << average_spacing - << " = " << average_spacing/radius << " * point set radius (" + std::cerr << "Average spacing = " << average_spacing + << " = " << average_spacing/radius << " * point set radius (" << task_timer.time() << " seconds, " << (memory>>20) << " Mb allocated)" << std::endl; diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_bilateral_smoothing_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_bilateral_smoothing_plugin.cpp index 2da04eef9d3..e2db8cc98b4 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_bilateral_smoothing_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_bilateral_smoothing_plugin.cpp @@ -56,7 +56,7 @@ class Polyhedron_demo_point_set_bilateral_smoothing_plugin : Q_OBJECT Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") - + QAction* actionBilateralSmoothing; public: @@ -124,9 +124,9 @@ void Polyhedron_demo_point_set_bilateral_smoothing_plugin::on_actionBilateralSmo return; std::cerr << "Bilateral smoothing using " - << dialog.iterations () << " iteration(s), neighborhood size of " - << dialog.neighborhood_size () << " and sharpness angle of " - << dialog.sharpness_angle () << "... "; + << dialog.iterations () << " iteration(s), neighborhood size of " + << dialog.neighborhood_size () << " and sharpness angle of " + << dialog.sharpness_angle () << "... "; QApplication::setOverrideCursor(Qt::BusyCursor); CGAL::Timer task_timer; task_timer.start(); @@ -145,11 +145,11 @@ void Polyhedron_demo_point_set_bilateral_smoothing_plugin::on_actionBilateralSmo if (std::isnan(error)) // NaN return means algorithm was interrupted break; } - + std::size_t memory = CGAL::Memory_sizer().virtual_size(); std::cerr << task_timer.time() << " seconds, " - << (memory>>20) << " Mb allocated)" - << std::endl; + << (memory>>20) << " Mb allocated)" + << std::endl; // Updates scene item->invalidateOpenGLBuffers(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_normal_estimation_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_normal_estimation_plugin.cpp index d9cb4ee90d5..b4050ae9e92 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_normal_estimation_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_normal_estimation_plugin.cpp @@ -75,7 +75,7 @@ struct Vector_to_pmap typedef Point_set::Index key_type; typedef bool value_type; typedef value_type reference; - + std::vector* vec; Vector_to_pmap (std::vector* vec = NULL) : vec (vec) { } @@ -184,7 +184,7 @@ void Polyhedron_demo_point_set_normal_estimation_plugin::on_actionNormalInversio Point_set* points = item->point_set(); if(points == NULL) return; - + for(Point_set::iterator it = points->begin_or_selection_begin(); it != points->end(); ++it){ points->normal(*it) = -1 * points->normal(*it); } @@ -213,7 +213,7 @@ void Polyhedron_demo_point_set_normal_estimation_plugin::on_actionNormalEstimati Point_set_demo_normal_estimation_dialog dialog; if(!dialog.exec()) return; - + QApplication::setOverrideCursor(Qt::BusyCursor); QApplication::processEvents(); @@ -322,10 +322,10 @@ void Polyhedron_demo_point_set_normal_estimation_plugin::on_actionNormalOrientat orient_selection = dialog.add ("Orient selection"); orient_selection->setChecked(false); } - + if(!dialog.exec()) return; - + QApplication::setOverrideCursor(Qt::BusyCursor); QApplication::processEvents(); @@ -346,7 +346,7 @@ void Polyhedron_demo_point_set_normal_estimation_plugin::on_actionNormalOrientat for (Point_set::iterator it = points->first_selected(); it != points->end(); ++ it) constrained_map[*it] = true; - + first_unoriented_point = CGAL::mst_orient_normals(*points, std::size_t(neighborhood->value()), diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_outliers_removal_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_outliers_removal_plugin.cpp index 62e27951f45..f5a217a91c9 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_outliers_removal_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_outliers_removal_plugin.cpp @@ -39,7 +39,7 @@ struct Outlier_removal_functor void operator()() { // Computes outliers - *result = + *result = CGAL::remove_outliers(*points, nb_neighbors, points->parameters(). @@ -70,7 +70,7 @@ public: actionOutlierRemoval->setObjectName("actionOutlierRemoval"); autoConnectActions(); } - + //! Applicate for Point_sets with normals. bool applicable(QAction*) const { return qobject_cast(scene->item(scene->mainSelectionIndex())); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_selection_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_selection_plugin.cpp index 64fb5826792..7c81fbd6e23 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_selection_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_selection_plugin.cpp @@ -45,10 +45,10 @@ #include #include #include -#include +#include #endif // CGAL_LINKED_WITH_TBB -// Class for visualizing selection +// Class for visualizing selection // provides mouse selection functionality using namespace CGAL::Three; @@ -74,14 +74,14 @@ class Q_DECL_EXPORT Scene_point_set_selection_visualizer typedef std::vector Polyline_2; typedef std::vector Polylines; typedef Scene_item::Bbox Bbox; - + bool rectangle; std::vector contour_2d; Polylines* polyline; Scene_item::Bbox point_set_bbox; CGAL::Bbox_2 domain_rectangle; Polygon_2 domain_freeform; - + public: Scene_point_set_selection_visualizer(bool rectangle, const Bbox& point_set_bbox) @@ -122,17 +122,17 @@ public: Polyline_2& poly() const { return polyline->front(); } - + bool update_polyline () const { if (contour_2d.size() < 2 || (!(poly().empty()) && contour_2d.back () == poly().back())) return false; - + if (rectangle) { - poly().clear(); - + poly().clear(); + poly().push_back ( Point_2 (domain_rectangle.xmin(), domain_rectangle.ymin())); poly().push_back ( Point_2 (domain_rectangle.xmax(), @@ -148,26 +148,26 @@ public: else { if (!(poly().empty()) && contour_2d.back () == poly().back()) - return false; + return false; - poly().clear(); + poly().clear(); - for (unsigned int i = 0; i < contour_2d.size (); ++ i) + for (unsigned int i = 0; i < contour_2d.size (); ++ i) poly().push_back (contour_2d[i]); } return true; } - + void sample_mouse_path(QImage& image) { CGAL::QGLViewer* viewer = getActiveViewer(); const QPoint& p = viewer->mapFromGlobal(QCursor::pos()); - + if (rectangle && contour_2d.size () == 2) { - contour_2d[1] = Point_2 (p.x (), p.y ()); - domain_rectangle = CGAL::bbox_2 (contour_2d.begin (), contour_2d.end ()); + contour_2d[1] = Point_2 (p.x (), p.y ()); + domain_rectangle = CGAL::bbox_2 (contour_2d.begin (), contour_2d.end ()); } else contour_2d.push_back (Point_2 (p.x (), p.y ())); @@ -182,7 +182,7 @@ public: void apply_path() { update_polyline (); - domain_rectangle = CGAL::bbox_2 (contour_2d.begin (), contour_2d.end ()); + domain_rectangle = CGAL::bbox_2 (contour_2d.begin (), contour_2d.end ()); if (!rectangle) domain_freeform = Polygon_2 (contour_2d.begin (), contour_2d.end ()); } @@ -190,12 +190,12 @@ public: bool is_selected (CGAL::qglviewer::Vec& p) { if (domain_rectangle.xmin () < p.x && - p.x < domain_rectangle.xmax () && - domain_rectangle.ymin () < p.y && - p.y < domain_rectangle.ymax ()) + p.x < domain_rectangle.xmax () && + domain_rectangle.ymin () < p.y && + p.y < domain_rectangle.ymax ()) { - if (rectangle) - return true; + if (rectangle) + return true; /* * domain_freeform.has_on_bounded_side() requires the polygon to be simple, which is never the case. * However, it works very well even if the polygon is not simple, so we use this instead to avoid @@ -225,9 +225,9 @@ class Selection_test { QVector4D* clipbox; const Ui::PointSetSelection& ui_widget; - + public: - + Selection_test(Point_set* point_set, bool* selected, CGAL::qglviewer::Camera* camera, @@ -301,7 +301,7 @@ public: selected[idx] = (already_selected && !now_selected); } } - + bool is_inside_clipbox (const Kernel::Point_3& p) const { if(!static_cast(CGAL::QGLViewer::QGLViewerPool().first())->isClipping()) @@ -316,7 +316,7 @@ public: clipbox[4][0]*x+clipbox[4][1]*y+clipbox[4][2]*z+clipbox[4][3]>0 || clipbox[5][0]*x+clipbox[5][1]*y+clipbox[5][2]*z+clipbox[5][3]>0); } - + }; @@ -333,7 +333,7 @@ class Neighborhood Scene_points_with_normal_item* points_item; boost::shared_ptr tree; - + public: Neighborhood () : points_item (NULL) @@ -350,7 +350,7 @@ public: if (this->points_item != points_item) { this->points_item = points_item; - + tree = boost::make_shared (points_item->point_set()->begin(), points_item->point_set()->end(), Tree::Splitter(), @@ -366,7 +366,7 @@ public: return; Distance tr_dist(points_item->point_set()->point_map()); - + std::vector selected_bitmap (points_item->point_set()->size(), false); for (Point_set::iterator it = points_item->point_set()->first_selected(); @@ -394,7 +394,7 @@ public: points_item->invertSelection(); expand(); points_item->invertSelection(); - + points_item->invalidateOpenGLBuffers(); points_item->itemChanged(); } @@ -405,16 +405,16 @@ public: double cos_threshold = std::cos (CGAL_PI * normal_threshold / 180.); Distance tr_dist(points_item->point_set()->point_map()); - + std::set index_container; std::vector index_container_former_ring; std::set index_container_current_ring; - - int conti = 0; //for accelerate least_square fitting + + int conti = 0; //for accelerate least_square fitting std::vector init_points; init_points.reserve (6); - + Neighbor_search search(*tree, query, 6, 0, true, tr_dist); for (Neighbor_search::iterator nit = search.begin(); nit != search.end(); ++ nit) { @@ -428,12 +428,12 @@ public: init_points.end(), optimal_plane, CGAL::Dimension_tag<0>()); - + Kernel::Vector_3 plane_normal = optimal_plane.orthogonal_vector(); plane_normal = plane_normal / std::sqrt(plane_normal * plane_normal); std::vector neighbors; - + bool propagation = false; do { @@ -449,11 +449,11 @@ public: Sphere fs (points_item->point_set()->point(point_index), cluster_epsilon, 0, tree->traits()); tree->search (std::back_inserter (neighbors), fs); - + for (std::size_t nb = 0; nb < neighbors.size(); ++ nb) { Point_set::Index neighbor_index = neighbors[nb]; - + if (index_container.find(neighbor_index) != index_container.end()) continue; @@ -470,7 +470,7 @@ public: if (std::fabs (normal * plane_normal) < cos_threshold) continue; } - + index_container.insert (neighbor_index); propagation = true; index_container_current_ring.insert(neighbor_index); @@ -490,7 +490,7 @@ public: conti++; if (index_container.size() < 5) continue; - + if ((conti < 10) || (conti<50 && conti % 10 == 0) || (conti>50 && conti % 500 == 0)) { std::list listp; @@ -513,7 +513,7 @@ public: std::vector unselected, selected; for(Point_set::iterator it = points_item->point_set()->begin (); - it != points_item->point_set()->end(); ++ it) + it != points_item->point_set()->end(); ++ it) if (index_container.find (*it) != index_container.end()) selected.push_back (*it); else @@ -526,12 +526,12 @@ public: if (selected.empty ()) { - points_item->point_set()->unselect_all(); + points_item->point_set()->unselect_all(); } else { - points_item->point_set()->set_first_selected - (points_item->point_set()->begin() + unselected.size()); + points_item->point_set()->set_first_selected + (points_item->point_set()->begin() + unselected.size()); } points_item->invalidateOpenGLBuffers(); points_item->itemChanged(); @@ -548,7 +548,7 @@ class Polyhedron_demo_point_set_selection_plugin : Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") public: - bool applicable(QAction*) const { + bool applicable(QAction*) const { return qobject_cast(scene->item(scene->mainSelectionIndex())); } void print_message(QString message) { CGAL::Three::Three::information(message); } @@ -572,7 +572,7 @@ public: addDockWidget(dock_widget); connect(ui_widget.region, SIGNAL(toggled(bool)), this, SLOT(set_region_parameters(bool))); - + // Fill actions of menu ui_widget.menu->setMenu (new QMenu("Point Set Selection Menu", ui_widget.menu)); QAction* select_all = ui_widget.menu->menu()->addAction ("Select all points"); @@ -591,7 +591,7 @@ public: connect(add_box, SIGNAL(triggered()), this, SLOT(select_points())); add_box->setEnabled(false); - connect(ui_widget.box, SIGNAL(toggled(bool)), + connect(ui_widget.box, SIGNAL(toggled(bool)), this, SLOT(on_box_toggled(bool))); connect(ui_widget.helpButton, &QAbstractButton::clicked, [this](){ @@ -605,7 +605,7 @@ public: edit_box = NULL; shift_pressing = false; ctrl_pressing = false; - + Q_FOREACH(CGAL::QGLViewer* viewer, CGAL::QGLViewer::QGLViewerPool()) { viewer->installEventFilter(this); @@ -627,13 +627,13 @@ protected: static QImage background; if (dock_widget->isHidden() || !(dock_widget->isActiveWindow()) || ui_widget.box->isChecked()) return false; - + Scene_points_with_normal_item* point_set_item = qobject_cast(scene->item(scene->mainSelectionIndex())); if(!point_set_item) { - return false; + return false; } - + if(event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease) { QKeyEvent *keyEvent = static_cast(event); @@ -649,11 +649,11 @@ protected: if(shift_pressing && event->type() == QEvent::MouseButtonPress) { background = static_cast(*CGAL::QGLViewer::QGLViewerPool().begin())->grabFramebuffer(); - QMouseEvent *mouseEvent = static_cast(event); + QMouseEvent *mouseEvent = static_cast(event); Viewer_interface* viewer = getActiveViewer(); background = viewer->grabFramebuffer(); - // Start selection - if (mouseEvent->button() == Qt::LeftButton) + // Start selection + if (mouseEvent->button() == Qt::LeftButton) { // Region growing if (ui_widget.region->isChecked()) @@ -662,7 +662,7 @@ protected: bool found = false; QPoint pixel(mouseEvent->pos().x(), viewer->camera()->screenHeight() - 1 - mouseEvent->pos().y()); - + CGAL::qglviewer::Vec point = viewer->camera()->pointUnderPixel(mouseEvent->pos(), found); if(!found) @@ -672,22 +672,22 @@ protected: } const CGAL::qglviewer::Vec offset = Three::mainViewer()->offset(); point = point - offset; - + neighborhood.point_set (point_set_item).grow_region (Kernel::Point_3 (point.x, point.y, point.z), rg_epsilon, rg_cluster_epsilon, rg_normal_threshold); - + QApplication::restoreOverrideCursor(); return true; } // Start standard selection else if (!visualizer) { - QApplication::setOverrideCursor(Qt::CrossCursor); + QApplication::setOverrideCursor(Qt::CrossCursor); CGAL::QGLViewer* viewer = getActiveViewer(); if (viewer->camera()->frame()->isSpinning()) viewer->camera()->frame()->stopSpinning(); - + visualizer = new Selection_visualizer(ui_widget.rectangle->isChecked(), point_set_item->bbox()); @@ -695,13 +695,13 @@ protected: return true; } } - // Cancel selection - else if (mouseEvent->button() == Qt::RightButton && visualizer) - { - visualizer = NULL; - QApplication::restoreOverrideCursor(); + // Cancel selection + else if (mouseEvent->button() == Qt::RightButton && visualizer) + { + visualizer = NULL; + QApplication::restoreOverrideCursor(); return true; - } + } } // Expand/reduce selection else if (shift_pressing && event->type() == QEvent::Wheel) @@ -718,18 +718,18 @@ protected: // End selection else if (event->type() == QEvent::MouseButtonRelease && visualizer) { - visualizer->apply_path(); - select_points(); - visualizer = NULL; - QApplication::restoreOverrideCursor(); + visualizer->apply_path(); + select_points(); + visualizer = NULL; + QApplication::restoreOverrideCursor(); getActiveViewer()->set2DSelectionMode(false); - return true; + return true; } // Update selection else if (event->type() == QEvent::MouseMove && visualizer) { visualizer->sample_mouse_path(background); - return true; + return true; } //Position request else if(ctrl_pressing && event->type() == QEvent::MouseButtonPress) @@ -755,7 +755,7 @@ protected: const CGAL::qglviewer::Vec offset = Three::mainViewer()->offset(); point = point - offset; - + Neighbor_search search(tree, Point(point.x, point.y, point.z), 1); Point res = search.begin()->first; CGAL::Three::Three::information(QString("Selected point : (%1, %2, %3)").arg(res.x()).arg(res.y()).arg(res.z())); @@ -765,13 +765,13 @@ protected: protected Q_SLOTS: - + void connectNewViewer(QObject* o) { if(edit_box) o->installEventFilter(edit_box); o->installEventFilter(this); - + } void select_points() @@ -779,15 +779,15 @@ protected Q_SLOTS: Scene_points_with_normal_item* point_set_item = getSelectedItem(); if(!point_set_item) { - print_message("Error: no point set selected!"); - return; + print_message("Error: no point set selected!"); + return; } Point_set* points = point_set_item->point_set(); if (ui_widget.new_selection->isChecked()) points->unselect_all(); - + const CGAL::qglviewer::Vec offset = Three::mainViewer()->offset(); CGAL::QGLViewer* viewer = getActiveViewer(); @@ -811,7 +811,7 @@ protected Q_SLOTS: (std::partition (points->begin(), points->end(), [&] (const Point_set::Index& idx) -> bool { return !selected_bitmap[idx]; })); - + point_set_item->invalidateOpenGLBuffers(); point_set_item->itemChanged(); } @@ -826,7 +826,7 @@ protected Q_SLOTS: if (rg_epsilon < 0.) rg_epsilon = (std::max)(0.00001, 0.005 * scene->len_diagonal()); epsilon->setValue(rg_epsilon); - + DoubleEdit* cluster_epsilon = dialog.add ("Cluster epsilon: "); if (rg_cluster_epsilon < 0.) rg_cluster_epsilon = (std::max)(0.00001, 0.03 * scene->len_diagonal()); @@ -836,7 +836,7 @@ protected Q_SLOTS: normal_threshold->setRange (0, 90); normal_threshold->setSuffix (QString("°")); normal_threshold->setValue (rg_normal_threshold); - + if (dialog.exec()) { rg_epsilon = epsilon->value(); @@ -844,35 +844,35 @@ protected Q_SLOTS: rg_normal_threshold = normal_threshold->value(); } } - + public Q_SLOTS: - void selection_action() { + void selection_action() { dock_widget->show(); dock_widget->raise(); } - + // Select all void on_Select_all_button_clicked() { Scene_points_with_normal_item* point_set_item = getSelectedItem(); if(!point_set_item) { - print_message("Error: no point set selected!"); - return; + print_message("Error: no point set selected!"); + return; } QApplication::setOverrideCursor(Qt::WaitCursor); point_set_item->selectAll(); QApplication::restoreOverrideCursor(); } - + // Clear selection void on_Clear_button_clicked() { Scene_points_with_normal_item* point_set_item = qobject_cast(scene->item(scene->mainSelectionIndex())); if(!point_set_item) { print_message("Error: no point set selected!"); - return; + return; } QApplication::setOverrideCursor(Qt::WaitCursor); point_set_item->resetSelection(); @@ -884,7 +884,7 @@ public Q_SLOTS: = qobject_cast(scene->item(scene->mainSelectionIndex())); if(!point_set_item) { print_message("Error: no point set selected!"); - return; + return; } QApplication::setOverrideCursor(Qt::WaitCursor); point_set_item->deleteSelection(); @@ -896,7 +896,7 @@ public Q_SLOTS: = qobject_cast(scene->item(scene->mainSelectionIndex())); if(!point_set_item) { print_message("Error: no point set selected!"); - return; + return; } QApplication::setOverrideCursor(Qt::WaitCursor); point_set_item->invertSelection(); @@ -908,7 +908,7 @@ public Q_SLOTS: = qobject_cast(scene->item(scene->mainSelectionIndex())); if(!point_set_item) { print_message("Error: no point set selected!"); - return; + return; } if(point_set_item->isSelectionEmpty ()) { print_message("Error: there is no selected point in point set item!"); @@ -920,11 +920,11 @@ public Q_SLOTS: new_item->point_set()->check_colors(); new_item->setName(QString("%1 (selected points)").arg(point_set_item->name())); - + new_item->setColor(point_set_item->color()); new_item->setRenderingMode(point_set_item->renderingMode()); new_item->setVisible(point_set_item->visible()); - + std::cerr << point_set_item->point_set()->info() << std::endl; std::cerr << new_item->point_set()->info() << std::endl; @@ -982,7 +982,7 @@ private: QDockWidget* dock_widget; QAction* add_box; - + Ui::PointSetSelection ui_widget; Selection_visualizer* visualizer; Neighborhood neighborhood; diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.cpp index d9497aba999..a4218856893 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.cpp @@ -46,7 +46,7 @@ struct Detect_shapes_functor { Shape_detection& shape_detection; typename Shape_detection::Parameters& op; - + Detect_shapes_functor (Shape_detection& shape_detection, typename Shape_detection::Parameters& op) : shape_detection (shape_detection), op (op) @@ -93,10 +93,10 @@ public: double normal_tolerance() const { return m_normal_tolerance_field->value(); } double search_probability() const { return m_probability_field->value(); } double gridCellSize() const { return 1.0; } - bool detect_plane() const { return planeCB->isChecked(); } - bool detect_sphere() const { return sphereCB->isChecked(); } - bool detect_cylinder() const { return cylinderCB->isChecked(); } - bool detect_torus() const { return torusCB->isChecked(); } + bool detect_plane() const { return planeCB->isChecked(); } + bool detect_sphere() const { return sphereCB->isChecked(); } + bool detect_cylinder() const { return cylinderCB->isChecked(); } + bool detect_torus() const { return torusCB->isChecked(); } bool detect_cone() const { return coneCB->isChecked(); } bool add_property() const { return m_add_property->isChecked(); } bool generate_colored_point_set() const { return m_one_colored_point_set->isChecked(); } @@ -120,12 +120,12 @@ class Polyhedron_demo_point_set_shape_detection_plugin : QAction* actionDetect; QAction* actionEstimateParameters; QAction* actionDetectShapesSM; - + typedef Point_set_3::Point_map PointPMap; typedef Point_set_3::Vector_map NormalPMap; typedef CGAL::Shape_detection::Efficient_RANSAC_traits Traits; - + public: void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface*) { scene = scene_interface; @@ -140,12 +140,12 @@ public: } bool applicable(QAction* action) const { - + Scene_points_with_normal_item* item = qobject_cast(scene->item(scene->mainSelectionIndex())); Scene_surface_mesh_item* sm_item = qobject_cast(scene->item(scene->mainSelectionIndex())); - + if (action->objectName() == "actionDetectShapesSM") { if (sm_item) return true; @@ -163,7 +163,7 @@ public: void on_actionDetect_triggered(); void on_actionEstimateParameters_triggered(); void on_actionDetectShapesSM_triggered(); - + private: typedef Kernel::Plane_3 Plane_3; @@ -184,9 +184,9 @@ private: using Face_range = typename SMesh::Face_range; - using Neighbor_query = + using Neighbor_query = CGAL::Shape_detection::Polygon_mesh::One_ring_neighbor_query; - using Region_type = + using Region_type = CGAL::Shape_detection::Polygon_mesh::Least_squares_plane_fit_region; using Vertex_to_point_map = typename Region_type::Vertex_to_point_map; @@ -198,29 +198,29 @@ private: const Face_range face_range = faces(mesh); // Set parameters. - const double max_distance_to_plane = + const double max_distance_to_plane = dialog.epsilon(); - const double max_accepted_angle = + const double max_accepted_angle = (std::acos(dialog.normal_tolerance()) * 180.0) / CGAL_PI; - const std::size_t min_region_size = + const std::size_t min_region_size = dialog.min_points(); // Region growing. Neighbor_query neighbor_query(mesh); const Vertex_to_point_map vertex_to_point_map(get(CGAL::vertex_point, mesh)); Region_type region_type( - mesh, - max_distance_to_plane, max_accepted_angle, min_region_size, + mesh, + max_distance_to_plane, max_accepted_angle, min_region_size, vertex_to_point_map); - + Region_growing region_growing( face_range, neighbor_query, region_type); std::vector< std::vector > regions; region_growing.detect(std::back_inserter(regions)); - std::cerr << "* " << regions.size() << - " regions have been found" + std::cerr << "* " << regions.size() << + " regions have been found" << std::endl; // Output result as a new colored item. @@ -239,7 +239,7 @@ private: for (std::size_t i = 0; i < regions.size(); ++i) { for (const std::size_t idx : regions[i]) { const auto fit = fr.begin() + idx; - fg.property_map("f:patch_id").first[*fit] = + fg.property_map("f:patch_id").first[*fit] = static_cast(i); } CGAL::Random rnd(static_cast(i)); @@ -260,29 +260,29 @@ private: using Point_map = typename Point_set::Point_map; using Normal_map = typename Point_set::Vector_map; - using Neighbor_query = + using Neighbor_query = CGAL::Shape_detection::Point_set::Sphere_neighbor_query; - using Region_type = + using Region_type = CGAL::Shape_detection::Point_set::Least_squares_plane_fit_region; - using Region_growing = + using Region_growing = CGAL::Shape_detection::Region_growing; // Set parameters. - const double search_sphere_radius = + const double search_sphere_radius = dialog.cluster_epsilon(); - const double max_distance_to_plane = + const double max_distance_to_plane = dialog.epsilon(); - const double max_accepted_angle = + const double max_accepted_angle = (std::acos(dialog.normal_tolerance()) * 180.0) / CGAL_PI; - const std::size_t min_region_size = + const std::size_t min_region_size = dialog.min_points(); // Get a point set. CGAL::Random rand(static_cast(time(0))); Point_set* points = item->point_set(); - + scene->setSelectedItem(-1); - Scene_points_with_normal_item *colored_item = + Scene_points_with_normal_item *colored_item = new Scene_points_with_normal_item; colored_item->setName(QString("%1 (region growing)").arg(item->name())); @@ -295,7 +295,7 @@ private: scene->addItem(colored_item); } std::string& comments = item->comments(); - + Point_set::Property_map shape_id; if (dialog.add_property()) { bool added = false; @@ -307,13 +307,13 @@ private: // Remove previously detected shapes from comments. std::string new_comment; - + std::istringstream stream(comments); std::string line; while (getline(stream, line)) { std::string tag; - std::stringstream iss(line); - + std::stringstream iss(line); + if (iss >> tag && tag == "shape") continue; new_comment += line + "\n"; @@ -325,12 +325,12 @@ private: // Region growing set up. Neighbor_query neighbor_query( - *points, - search_sphere_radius, + *points, + search_sphere_radius, points->point_map()); - + Region_type region_type( - *points, + *points, max_distance_to_plane, max_accepted_angle, min_region_size, points->point_map(), points->normal_map()); @@ -343,15 +343,15 @@ private: groups[0] = new Scene_group_item("Planes"); groups[0]->setRenderingMode(Points); } - + // The actual shape detection. CGAL::Real_timer t; t.start(); std::vector< std::vector > regions; region_growing.detect(std::back_inserter(regions)); t.stop(); - - std::cout << regions.size() << + + std::cout << regions.size() << " shapes found in " << t.time() << " second(s)" << std::endl; std::vector planes; @@ -359,7 +359,7 @@ private: *points, points->point_map(), regions, planes); if (dialog.regularize()) { - + std::cerr << "Regularization of planes... " << std::endl; CGAL::regularize_planes( *points, @@ -368,13 +368,13 @@ private: CGAL::Identity_property_map(), CGAL::Shape_detection::RG::Point_to_shape_index_map(*points, regions), true, true, true, true, - max_accepted_angle, + max_accepted_angle, max_distance_to_plane); std::cerr << "done" << std::endl; } std::map color_map; - + int index = 0; for (const auto& plane : planes) { @@ -384,15 +384,15 @@ private: oss << " plane " << plane << std::endl; comments += oss.str(); } - Scene_points_with_normal_item *point_item = + Scene_points_with_normal_item *point_item = new Scene_points_with_normal_item; - + for (const std::size_t idx : regions[index]) { point_item->point_set()->insert(points->point(*(points->begin() + idx))); if (dialog.add_property()) shape_id[*(points->begin() + idx)] = index; } - + unsigned char r, g, b; r = static_cast(64 + rand.get_int(0, 192)); g = static_cast(64 + rand.get_int(0, 192)); @@ -409,12 +409,12 @@ private: } colored_item->invalidateOpenGLBuffers(); } - - // Providing a useful name consisting of the order of detection, + + // Providing a useful name consisting of the order of detection, // name of type and number of inliers. std::stringstream ss; ss << item->name().toStdString() << "_plane_"; - + Vector_3 plane_normal = plane.orthogonal_vector(); const double normal_length = CGAL::sqrt(plane_normal.squared_length()); CGAL_precondition(normal_length > 0.0); @@ -422,7 +422,7 @@ private: Kernel::Point_3 ref = CGAL::ORIGIN + plane_normal; if (color_map.find(ref) == color_map.end()) { - + ref = CGAL::ORIGIN + (-1.0) * plane_normal; if (color_map.find(ref) == color_map.end()) color_map[ref] = point_item->color(); @@ -434,14 +434,14 @@ private: if (dialog.generate_colored_point_set()) { for (std::size_t i = 0; i < nb_colored_pts; ++i) { colored_item->point_set()->set_color( - *(colored_item->point_set()->end() - 1 - i), + *(colored_item->point_set()->end() - 1 - i), color_map[ref].red(), color_map[ref].green(), color_map[ref].blue()); } } ss << "(" << ref << ")_"; - + if (dialog.generate_alpha()) { // If plane, build alpha shape Scene_surface_mesh_item* sm_item = NULL; @@ -452,7 +452,7 @@ private: build_alpha_shape( *(point_item->point_set()), rg_plane, sm_item, search_sphere_radius); - + if (sm_item){ sm_item->setColor(point_item->color ()); sm_item->setName(QString("%1%2_alpha_shape").arg(QString::fromStdString(ss.str())) @@ -476,7 +476,7 @@ private: point_item->point_set()->add_normal_map(); // Set normals for point_item to the plane's normal. - for (auto it = point_item->point_set()->begin(); + for (auto it = point_item->point_set()->begin(); it != point_item->point_set()->end(); ++it) point_item->point_set()->normal(*it) = plane_normal; @@ -495,7 +495,7 @@ private: if (dialog.generate_structured()) { std::cerr << "Structuring point set... "; - + Scene_points_with_normal_item *pts_full = new Scene_points_with_normal_item; pts_full->point_set()->add_normal_map(); @@ -507,7 +507,7 @@ private: points->parameters(). plane_map(CGAL::Identity_property_map()). plane_index_map(CGAL::Shape_detection::RG::Point_to_shape_index_map(*points, regions))); - + if (pts_full->point_set()->empty()) delete pts_full; else { @@ -520,7 +520,7 @@ private: } std::cerr << "done" << std::endl; } - + // Updates scene. scene->itemChanged(index); QApplication::restoreOverrideCursor(); @@ -541,16 +541,16 @@ private: op.min_points = dialog.min_points(); // Only extract shapes with a minimum number of points. op.epsilon = dialog.epsilon(); // maximum euclidean distance between point and shape. op.cluster_epsilon = dialog.cluster_epsilon(); // maximum euclidean distance between points to be clustered. - op.normal_threshold = dialog.normal_tolerance(); // normal_threshold < dot(surface_normal, point_normal); + op.normal_threshold = dialog.normal_tolerance(); // normal_threshold < dot(surface_normal, point_normal); CGAL::Random rand(static_cast(time(0))); // Gets point set Point_set* points = item->point_set(); Scene_points_with_normal_item::Bbox bb = item->bbox(); - + double diam = CGAL::sqrt((bb.xmax()-bb.xmin())*(bb.xmax()-bb.xmin()) + (bb.ymax()-bb.ymin())*(bb.ymax()-bb.ymin()) + (bb.zmax()-bb.zmin())*(bb.zmax()-bb.zmin())); - + scene->setSelectedItem(-1); Scene_points_with_normal_item *colored_item = new Scene_points_with_normal_item; @@ -565,7 +565,7 @@ private: } std::string& comments = item->comments(); - + Point_set::Property_map shape_id; if (dialog.add_property()) { @@ -579,7 +579,7 @@ private: // Remove previously detected shapes from comments std::string new_comment; - + std::istringstream stream (comments); std::string line; while (getline(stream, line)) @@ -593,7 +593,7 @@ private: comments = new_comment; comments += "shape -1 no assigned shape\n"; } - + QApplication::setOverrideCursor(Qt::BusyCursor); Ransac ransac; @@ -634,7 +634,7 @@ private: Detect_shapes_functor functor (ransac, op); run_with_qprogressdialog (functor, "Detecting shapes...", mw); t.stop(); - + std::cout << ransac.shapes().size() << " shapes found in " << t.time() << " second(s)" << std::endl; @@ -649,12 +649,12 @@ private: CGAL::Shape_detection::Point_to_shape_index_map(*points, planes), true, true, true, true, 180 * std::acos (op.normal_threshold) / CGAL_PI, op.epsilon); - + std::cerr << "done" << std::endl; } std::map color_map; - + int index = 0; for(boost::shared_ptr shape : ransac.shapes()) { @@ -690,16 +690,16 @@ private: comments += oss.str(); } - + Scene_points_with_normal_item *point_item = new Scene_points_with_normal_item; - + for(std::size_t i : shape->indices_of_assigned_points()) { point_item->point_set()->insert(points->point(*(points->begin()+i))); if (dialog.add_property()) shape_id[*(points->begin()+i)] = index; } - + unsigned char r, g, b; r = static_cast(64 + rand.get_int(0, 192)); @@ -719,11 +719,11 @@ private: } colored_item->invalidateOpenGLBuffers(); } - + // Providing a useful name consisting of the order of detection, name of type and number of inliers std::stringstream ss; if (dynamic_cast *>(shape.get())){ - CGAL::Shape_detection::Cylinder * cyl + CGAL::Shape_detection::Cylinder * cyl = dynamic_cast *>(shape.get()); ss << item->name().toStdString() << "_cylinder_" << cyl->radius() << "_"; } @@ -733,7 +733,7 @@ private: boost::shared_ptr > pshape = boost::dynamic_pointer_cast > (shape); - + Kernel::Point_3 ref = CGAL::ORIGIN + pshape->plane_normal (); if (color_map.find (ref) == color_map.end ()) @@ -758,7 +758,7 @@ private: } ss << "(" << ref << ")_"; - + if (dialog.generate_alpha ()) { // If plane, build alpha shape @@ -768,7 +768,7 @@ private: build_alpha_shape (*(point_item->point_set()), pshape, sm_item, dialog.cluster_epsilon()); - + if(sm_item){ sm_item->setColor(point_item->color ()); sm_item->setName(QString("%1%2_alpha_shape").arg(QString::fromStdString(ss.str())) @@ -790,7 +790,7 @@ private: ss << item->name().toStdString() << "_sphere_"; ss << shape->indices_of_assigned_points().size(); - //names[i] = ss.str( + //names[i] = ss.str( point_item->setName(QString::fromStdString(ss.str())); point_item->setRenderingMode(item->renderingMode()); @@ -813,7 +813,7 @@ private: if(scene->item_id(groups[0]) == -1) scene->addItem(groups[0]); - + point_item->invalidateOpenGLBuffers(); scene->changeGroup(point_item, groups[0]); } @@ -848,10 +848,10 @@ private: if (dialog.generate_structured ()) { std::cerr << "Structuring point set... "; - + Scene_points_with_normal_item *pts_full = new Scene_points_with_normal_item; pts_full->point_set()->add_normal_map(); - + typename Ransac::Plane_range planes = ransac.planes(); CGAL::structure_point_set (*points, planes, @@ -860,7 +860,7 @@ private: points->parameters(). plane_map(CGAL::Shape_detection::Plane_map()). plane_index_map(CGAL::Shape_detection::Point_to_shape_index_map(*points, planes))); - + if (pts_full->point_set ()->empty ()) delete pts_full; else @@ -874,7 +874,7 @@ private: } std::cerr << "done" << std::endl; } - + // Updates scene scene->itemChanged(index); @@ -882,7 +882,7 @@ private: item->setVisible(false); } - + Kernel::Point_2 to_2d (const Point_3& centroid, const Vector_3& base1, const Vector_3& base2, @@ -969,7 +969,7 @@ void Polyhedron_demo_point_set_shape_detection_plugin::on_actionDetect_triggered Point_set_demo_point_set_shape_detection_dialog dialog; if(!dialog.exec()) return; - + QApplication::setOverrideCursor(Qt::WaitCursor); if (dialog.region_growing()) { @@ -1008,11 +1008,11 @@ void Polyhedron_demo_point_set_shape_detection_plugin::build_alpha_shape projections.push_back (plane->to_2d (points.point(*it))); Alpha_shape_2 ashape (projections.begin (), projections.end (), epsilon); - + std::map map_v2i; Scene_polygon_soup_item *soup_item = new Scene_polygon_soup_item; - + soup_item->init_polygon_soup(points.size(), ashape.number_of_faces ()); std::size_t current_index = 0; @@ -1046,9 +1046,9 @@ void Polyhedron_demo_point_set_shape_detection_plugin::build_alpha_shape std::cerr << "POLYGON SOUP EMPTY" << std::endl; for (std::size_t i = 0; i < projections.size (); ++ i) std::cerr << projections[i] << std::endl; - + } - + delete soup_item; } @@ -1075,7 +1075,7 @@ void Polyhedron_demo_point_set_shape_detection_plugin::on_actionEstimateParamete tr("Selection is empty.\nTo estimate parameters, please select a planar section.")); return; } - + QApplication::setOverrideCursor(Qt::WaitCursor); typedef CGAL::Search_traits_3 SearchTraits_3; @@ -1127,10 +1127,10 @@ void Polyhedron_demo_point_set_shape_detection_plugin::on_actionEstimateParamete std::sort (epsilon.begin(), epsilon.end()); std::sort (dispersion.begin(), dispersion.end()); std::sort (cluster_epsilon.begin(), cluster_epsilon.end()); - + QApplication::restoreOverrideCursor(); - + QMessageBox::information(NULL, tr("Estimated Parameters"), tr("Epsilon = [%1 ; %2 ; %3 ; %4 ; %5]\nNormal Tolerance = [%6 ; %7 ; %8 ; %9 ; %10]\nMinimum Number of Points = %11\nConnectivity Epsilon = [%12 ; %13 ; %14 ; %15 ; %16]") diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_simplification_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_simplification_plugin.cpp index 6bd189a6b2c..d75c2c67a12 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_simplification_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_simplification_plugin.cpp @@ -148,7 +148,7 @@ class Point_set_demo_point_set_simplification_dialog : public QDialog, private U double maximumSurfaceVariation() const { return m_maximumSurfaceVariation->value(); } public Q_SLOTS: - + void on_Random_toggled (bool toggled) { m_randomSimplificationPercentage->setEnabled (toggled); @@ -221,23 +221,23 @@ void Polyhedron_demo_point_set_simplification_plugin::on_actionSimplify_triggere Grid_simplify_functor functor (points, dialog.gridCellSize() * average_spacing); run_with_qprogressdialog (functor, "Grid simplyfing...", mw); - + // Computes points to remove by Grid Clustering first_point_to_remove = *functor.result; - + } else { std::cerr << "Point set hierarchy simplification (cluster size = " << dialog.maximumClusterSize() - << ", maximum variation = " << dialog.maximumSurfaceVariation() << ")...\n"; + << ", maximum variation = " << dialog.maximumSurfaceVariation() << ")...\n"; // Computes points to remove by Hierarchy Hierarchy_simplify_functor functor (points, dialog.maximumClusterSize(), dialog.maximumSurfaceVariation()); run_with_qprogressdialog (functor, "Hierarchy simplyfing...", mw); - + first_point_to_remove = *functor.result; - + } std::size_t nb_points_to_remove = std::distance(first_point_to_remove, points->end()); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_smoothing_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_smoothing_plugin.cpp index ac883acf29f..84f4b902a8b 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_smoothing_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_smoothing_plugin.cpp @@ -60,7 +60,7 @@ public: return QList() << actionJetSmoothing; } - bool applicable(QAction*) const { + bool applicable(QAction*) const { return qobject_cast(scene->item(scene->mainSelectionIndex())); } diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_upsampling_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_upsampling_plugin.cpp index b7d64382b03..973199a343a 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_upsampling_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_upsampling_plugin.cpp @@ -29,7 +29,7 @@ class Polyhedron_demo_point_set_upsampling_plugin : Q_OBJECT Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") - + QAction* actionEdgeAwareUpsampling; Messages_interface* message_interface; public: @@ -57,7 +57,7 @@ public Q_SLOTS: class Point_set_demo_point_set_upsampling_dialog : public QDialog, private Ui::PointSetUpsamplingDialog { - + Q_OBJECT public: Point_set_demo_point_set_upsampling_dialog(QWidget * /*parent*/ = 0) @@ -86,11 +86,11 @@ void Polyhedron_demo_point_set_upsampling_plugin::on_actionEdgeAwareUpsampling_t if(item) { if (!(item->has_normals ())) - { + { CGAL::Three::Three::error("Error: upsampling algorithm requires point set with normals."); - return; - } - + return; + } + // Gets point set Point_set* points = item->point_set(); if(points == NULL) @@ -99,15 +99,15 @@ void Polyhedron_demo_point_set_upsampling_plugin::on_actionEdgeAwareUpsampling_t // Gets options Point_set_demo_point_set_upsampling_dialog dialog; if(!dialog.exec()) - return; + return; unsigned int output_size = static_cast(dialog.output_size () - * points->size ()); + * points->size ()); std::cerr << "Edge aware upsampling (sharpness angle = " - << dialog.sharpness_angle () << ", edge sensitivity = " - << dialog.edge_sensitivity () << ", neighborhood radius = " - << dialog.neighborhood_radius () << " * average spacing, output size = " - << output_size << "...\n"; + << dialog.sharpness_angle () << ", edge sensitivity = " + << dialog.edge_sensitivity () << ", neighborhood radius = " + << dialog.neighborhood_radius () << " * average spacing, output size = " + << output_size << "...\n"; QApplication::setOverrideCursor(Qt::WaitCursor); @@ -115,29 +115,29 @@ void Polyhedron_demo_point_set_upsampling_plugin::on_actionEdgeAwareUpsampling_t // Computes average spacing double average_spacing = CGAL::compute_average_spacing(*points, 6); - + std::size_t nb_selected = points->nb_selected_points(); - + std::vector > new_points; CGAL::edge_aware_upsample_point_set(points->all_or_selection_if_not_empty(), - std::back_inserter(new_points), + std::back_inserter(new_points), points->parameters(). sharpness_angle (dialog.sharpness_angle()). edge_sensitivity (dialog.edge_sensitivity()). neighbor_radius (dialog.neighborhood_radius() * average_spacing). number_of_output_points (output_size)); nb_selected += new_points.size(); - + for (unsigned int i = 0; i < new_points.size (); ++ i) - points->insert (new_points[i].first, new_points[i].second); + points->insert (new_points[i].first, new_points[i].second); if (nb_selected != new_points.size()) points->set_first_selected (points->end() - nb_selected); - + std::size_t memory = CGAL::Memory_sizer().virtual_size(); std::cerr << task_timer.time() << " seconds, " - << (memory>>20) << " Mb allocated)" - << std::endl; + << (memory>>20) << " Mb allocated)" + << std::endl; // Updates scene item->invalidateOpenGLBuffers(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_wlop_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_wlop_plugin.cpp index f9ab5c60215..d85a5ddef4c 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_wlop_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_wlop_plugin.cpp @@ -49,7 +49,7 @@ struct Wlop_functor double select_percentage; double neighbor_radius; Scene_points_with_normal_item* new_item; - + Wlop_functor (Point_set* points, double select_percentage, double neighbor_radius, Scene_points_with_normal_item* new_item) : points (points), select_percentage (select_percentage) @@ -77,7 +77,7 @@ class Polyhedron_demo_point_set_wlop_plugin : Q_OBJECT Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") - + QAction* actionSimplifyAndRegularize; public: @@ -140,8 +140,8 @@ void Polyhedron_demo_point_set_wlop_plugin::on_actionSimplifyAndRegularize_trigg CGAL::Timer task_timer; task_timer.start(); std::cerr << "Point cloud simplification and regularization by WLOP (" - << dialog.retainedPercentage () << "% retained points, neighborhood radius = " - << dialog.neighborhoodRadius() <<" * average spacing)...\n"; + << dialog.retainedPercentage () << "% retained points, neighborhood radius = " + << dialog.neighborhoodRadius() <<" * average spacing)...\n"; // Computes average spacing Compute_average_spacing_functor functor_as (points, 6); @@ -161,10 +161,10 @@ void Polyhedron_demo_point_set_wlop_plugin::on_actionSimplifyAndRegularize_trigg std::size_t memory = CGAL::Memory_sizer().virtual_size(); std::cerr << "Simplification and regularization: " - << new_item->point_set ()->size () << " point(s) created (" - << task_timer.time() << " seconds, " - << (memory>>20) << " Mb allocated)" - << std::endl; + << new_item->point_set ()->size () << " point(s) created (" + << task_timer.time() << " seconds, " + << (memory>>20) << " Mb allocated)" + << std::endl; QApplication::restoreOverrideCursor(); } diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Register_point_sets_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Register_point_sets_plugin.cpp index e399d256c7d..4deb013ba62 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Register_point_sets_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Register_point_sets_plugin.cpp @@ -43,7 +43,7 @@ public: QWidget* /*parent*/ = 0) { setupUi(this); - + for (std::size_t i = 0; i < items.size(); ++ i) { QRadioButton* button = new QRadioButton(items[i]->name().toStdString().c_str(), this); @@ -103,7 +103,7 @@ class Polyhedron_demo_register_point_sets_plugin : private: QAction* actionRegisterPointSets; - + public: void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface*) { scene = scene_interface; @@ -116,7 +116,7 @@ public: QList actions() const { return QList() << actionRegisterPointSets; } - + bool applicable(QAction*) const { return get_point_set_items().size() >= 2; } @@ -132,7 +132,7 @@ public: if(item && item->point_set()->has_normal_map()) items.push_back (item); } - + return items; } @@ -158,7 +158,7 @@ void Polyhedron_demo_register_point_sets_plugin::on_actionRegisterPointSets_trig { if (i == ref) continue; - + std::cerr << "Registering " << items[i]->name().toStdString() << " with " << items[ref]->name().toStdString() << std::endl; Point_set& ps1 = *(items[ref]->point_set()); @@ -179,7 +179,7 @@ void Polyhedron_demo_register_point_sets_plugin::on_actionRegisterPointSets_trig .overlap(dialog.overlap()), CGAL::parameters::point_map(ps2.point_map()) .normal_map(ps2.normal_map())); - + std::size_t memory = CGAL::Memory_sizer().virtual_size(); std::cerr << " -> Registration score = " << score << " (" << task_timer.time() << " seconds, " @@ -193,7 +193,7 @@ void Polyhedron_demo_register_point_sets_plugin::on_actionRegisterPointSets_trig std::cerr << "* Fine registration: " << std::endl; std::istringstream ss (dialog.pointmatcher_config()); - + CGAL::Timer task_timer; task_timer.start(); if (CGAL::pointmatcher::register_point_sets(ps1, ps2, CGAL::parameters::point_map(ps1.point_map()) @@ -204,7 +204,7 @@ void Polyhedron_demo_register_point_sets_plugin::on_actionRegisterPointSets_trig std::cerr << " -> Success"; else std::cerr << " -> Failure"; - + std::size_t memory = CGAL::Memory_sizer().virtual_size(); std::cerr << " (" << task_timer.time() << " seconds, " @@ -212,9 +212,9 @@ void Polyhedron_demo_register_point_sets_plugin::on_actionRegisterPointSets_trig << std::endl; } #endif - + } - + for (std::size_t i = 0; i < items.size(); ++ i) { items[i]->invalidateOpenGLBuffers(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_poisson_impl.cpp b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_poisson_impl.cpp index 4979471b987..56b882dd652 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_poisson_impl.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_poisson_impl.cpp @@ -39,9 +39,9 @@ private: typedef typename Triangulation::Cell_handle Cell_handle; typedef typename Triangulation::Finite_cells_iterator Finite_cells_iterator; - + const Triangulation& m_tr; - + public: Marching_tets (const Triangulation& tr) : m_tr (tr) { } @@ -54,7 +54,7 @@ public: std::size_t nb_points = 0; std::map map_p2i; - + for (Finite_cells_iterator cit = m_tr.finite_cells_begin(); cit != m_tr.finite_cells_end(); ++ cit) { @@ -125,17 +125,17 @@ private: } } } - + bool extract_level_set_points(Cell_handle cell, const FT value, std::vector& points, Vector_3& direction) const { Point_3 point; if(level_set(cell, value, 0, 1, point, direction)) points.push_back(point); - if(level_set(cell, value, 0, 2, point, direction)) points.push_back(point); - if(level_set(cell, value, 0, 3, point, direction)) points.push_back(point); - if(level_set(cell, value, 1, 2, point, direction)) points.push_back(point); - if(level_set(cell, value, 1, 3, point, direction)) points.push_back(point); - if(level_set(cell, value, 2, 3, point, direction)) points.push_back(point); - return points.size() != 0; + if(level_set(cell, value, 0, 2, point, direction)) points.push_back(point); + if(level_set(cell, value, 0, 3, point, direction)) points.push_back(point); + if(level_set(cell, value, 1, 2, point, direction)) points.push_back(point); + if(level_set(cell, value, 1, 3, point, direction)) points.push_back(point); + if(level_set(cell, value, 2, 3, point, direction)) points.push_back(point); + return points.size() != 0; } bool level_set(Cell_handle cell, const FT value, const int i1, const int i2, Point_3& p, Vector_3& direction) const @@ -213,18 +213,18 @@ SMesh* poisson_reconstruct(Point_set& points, // Computes implicit function //*************************************** - + std::cerr << "Computes Poisson implicit function " << "using " << (conjugate_gradient ? "Conjugate Gradient" : "Simplicial LDLT") << "..." << std::endl; - - + + // 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. Poisson_reconstruction_function function(points.begin_or_selection_begin(), points.end(), points.point_map(), points.normal_map()); - bool ok = false; + bool ok = false; if(conjugate_gradient) { CGAL::Eigen_solver_traits::EigenType> > solver; @@ -251,10 +251,10 @@ SMesh* poisson_reconstruct(Point_set& points, task_timer.reset(); SMesh* mesh = new SMesh; - + if (marching_tets) { - + std::cerr << "Marching tetrahedra..." << std::endl; std::vector vertices; @@ -344,7 +344,7 @@ SMesh* poisson_reconstruct(Point_set& points, // Prints total reconstruction duration std::cerr << "Total reconstruction (implicit function + meshing): " << reconstruction_timer.time() << " seconds\n"; } - + //*************************************** // Computes reconstruction error //*************************************** @@ -358,17 +358,17 @@ SMesh* poisson_reconstruct(Point_set& points, double avg_distance = 0; std::set::face_descriptor> faces_to_keep; - + for (Point_set::const_iterator p=points.begin_or_selection_begin(); p!=points.end(); p++) { typename AABB_traits::Point_and_primitive_id pap = tree.closest_point_and_primitive (points.point (*p)); double distance = std::sqrt(CGAL::squared_distance (pap.first, points.point(*p))); - + max_distance = (std::max)(max_distance, distance); avg_distance += distance; typename boost::graph_traits::face_descriptor f = pap.second; - faces_to_keep.insert (f); + faces_to_keep.insert (f); } avg_distance /= double(points.size()); @@ -380,7 +380,7 @@ SMesh* poisson_reconstruct(Point_set& points, { typename boost::graph_traits::face_iterator it = faces(*mesh).begin (); while (it != faces(*mesh).end ()) - { + { typename boost::graph_traits::face_iterator current = it ++; if (faces_to_keep.find (*current) == faces_to_keep.end ()) @@ -388,7 +388,7 @@ SMesh* poisson_reconstruct(Point_set& points, CGAL::Euler::remove_face(halfedge (*current, *mesh), *mesh); } - } + } } return mesh; diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_scale_space_impl.cpp b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_scale_space_impl.cpp index 7f15fb61174..8a1718682f2 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_scale_space_impl.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_scale_space_impl.cpp @@ -23,7 +23,7 @@ typedef CGAL::Scale_space_reconstruction_3::Weighted_PCA_smoother ScaleS void scale_space (const Point_set& points, std::vector& items, - bool jet_smoother, + bool jet_smoother, unsigned int iterations, unsigned int neighbors, unsigned int fitting, unsigned int monge, unsigned int neighborhood_size, unsigned int samples, @@ -47,7 +47,7 @@ void scale_space (const Point_set& points, ScaleSpaceWPS smoother(neighborhood_size, samples); reconstruct.increase_scale(iterations, smoother); squared_radius = smoother.squared_radius(); - + } if (advancing_front_mesher) @@ -72,7 +72,7 @@ void scale_space (const Point_set& points, std::map map_i2i; std::size_t current_index = 0; - + for (ScaleSpace::Facet_iterator it = reconstruct.facets_begin(); it != reconstruct.facets_end(); ++ it) { @@ -83,7 +83,7 @@ void scale_space (const Point_set& points, map_i2i.insert (std::make_pair ((*it)[ind], current_index ++)); Point_3 p = points.point(*(points.begin_or_selection_begin() + (*it)[ind])); new_item->new_vertex (p.x (), p.y (), p.z ()); - + if (generate_smooth) { p = *(reconstruct.points_begin() + (*it)[ind]); @@ -98,7 +98,7 @@ void scale_space (const Point_set& points, smooth_item->new_triangle( map_i2i[(*it)[0]], map_i2i[(*it)[1]], map_i2i[(*it)[2]] ); - + } items.push_back(new_item); @@ -129,7 +129,7 @@ void scale_space (const Point_set& points, std::map map_i2i; unsigned int current_index = 0; - + for (ScaleSpaceASM::Facet_iterator it = mesher.shell_begin (sh); it != mesher.shell_end (sh); ++ it) { @@ -140,7 +140,7 @@ void scale_space (const Point_set& points, map_i2i.insert (std::make_pair ((*it)[ind], current_index ++)); Point_3 p = points.point(*(points.begin_or_selection_begin() + (*it)[ind])); new_item->new_vertex (p.x (), p.y (), p.z ()); - + if (generate_smooth) { p = *(reconstruct.points_begin() + (*it)[ind]); @@ -155,7 +155,7 @@ void scale_space (const Point_set& points, smooth_item->new_triangle( map_i2i[(*it)[0]], map_i2i[(*it)[1]], map_i2i[(*it)[2]] ); - + } items.push_back (new_item); @@ -196,7 +196,7 @@ void scale_space (const Point_set& points, map_i2i.insert (std::make_pair ((*it)[ind], current_index ++)); Point_3 p = points.point(*(points.begin_or_selection_begin() + (*it)[ind])); new_item->new_vertex (p.x (), p.y (), p.z ()); - + if (generate_smooth) { p = *(reconstruct.points_begin() + (*it)[ind]); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/CMakeLists.txt index 99c7d6e618b..d56331772af 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/CMakeLists.txt @@ -6,9 +6,9 @@ endif() if(EIGEN3_FOUND) find_package(CGAL COMPONENTS Core) - + include(${CGAL_USE_FILE}) - + qt5_wrap_ui(parameterizationUI_FILES Parameterization_widget.ui OTE_dialog.ui) polyhedron_demo_plugin(parameterization_plugin Parameterization_plugin ${parameterizationUI_FILES}) target_link_libraries(parameterization_plugin PUBLIC scene_surface_mesh_item scene_textured_item scene_selection_item) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_plane_detection_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_plane_detection_plugin.cpp index c2a0a1c3d94..4e29d3aa423 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_plane_detection_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_plane_detection_plugin.cpp @@ -26,7 +26,7 @@ namespace PMP = CGAL::Polygon_mesh_processing; using namespace CGAL::Three; -class Polyhedron_demo_mesh_plane_detection_plugin : +class Polyhedron_demo_mesh_plane_detection_plugin : public QObject, public Polyhedron_demo_plugin_helper { @@ -41,10 +41,10 @@ class Polyhedron_demo_mesh_plane_detection_plugin : } bool applicable(QAction*) const { - return + return qobject_cast(scene->item(scene->mainSelectionIndex())); - } - + } + void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface*) { this->scene = scene_interface; this->mw = mainWindow; @@ -62,10 +62,10 @@ class Polyhedron_demo_mesh_plane_detection_plugin : virtual void closure() { } - - template + + template void colorize_segmentation(Scene_surface_mesh_item* item, SegmentPropertyMap& segment_ids, std::vector& color_vector); - + void check_and_set_ids(SMesh *sm); public Q_SLOTS: @@ -81,14 +81,14 @@ private: OutputIterator output) { typedef SMesh::size_type size_type; - + std::cerr << "Detecting planes with:" << std::endl << " * Area min = " << area_min << std::endl << " * Min cos angle = " << angle_max << std::endl; std::vector label_region(mesh.number_of_faces(), 0); int class_index = 0; - + for (typename SMesh::Face_iterator f = mesh.faces_begin(); f != mesh.faces_end(); ++f) { if (label_region[*f] != 0) @@ -96,13 +96,13 @@ private: class_index++; label_region[*f] = class_index; double area = PMP::face_area (*f, mesh, PMP::parameters::geom_traits(EPICK())); - + //characteristics of the seed EPICK::Vector_3 normal_seed = PMP::compute_face_normal (*f, mesh, PMP::parameters::geom_traits(EPICK())); EPICK::Point_3 pt_seed = mesh.point(target(halfedge(*f, mesh), mesh)); EPICK::Plane_3 optimal_plane(pt_seed, normal_seed); // Kernel::Plane_3 optimal_plane = f->plane(); - + //initialization containers std::vector index_container (1,*f); std::vector index_container_former_ring (1, *f); @@ -124,7 +124,7 @@ private: { if (is_border(*circ, mesh)) continue; - + typename SMesh::Face_index neighbor = mesh.face(opposite(*circ, mesh)); size_type neighbor_index = neighbor; @@ -144,7 +144,7 @@ private: } while (++ circ != start); } - + //update containers index_container_former_ring.clear(); for (std::list::iterator it = index_container_current_ring.begin(); @@ -180,8 +180,8 @@ void Polyhedron_demo_mesh_plane_detection_plugin::itemAboutToBeDestroyed(CGAL::T void Polyhedron_demo_mesh_plane_detection_plugin::on_actionPlaneDetection_triggered() { const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); - - Scene_surface_mesh_item* poly_item = + + Scene_surface_mesh_item* poly_item = qobject_cast(scene->item(index)); if (poly_item) @@ -211,15 +211,15 @@ void Polyhedron_demo_mesh_plane_detection_plugin::on_actionPlaneDetection_trigge //poly_item->set_color_vector_read_only(true); colorize_segmentation (poly_item, indices, poly_item->color_vector()); - - std::cerr << "ok (" << time.elapsed() << " ms, " + + std::cerr << "ok (" << time.elapsed() << " ms, " << pmesh.number_of_halfedges() / 2 << " edges)" << std::endl; poly_item->invalidateOpenGLBuffers(); scene->itemChanged(index); QApplication::restoreOverrideCursor(); } - + } template @@ -233,15 +233,15 @@ void Polyhedron_demo_mesh_plane_detection_plugin::colorize_segmentation( SMesh* sm = item->face_graph(); color_vector.clear(); std::size_t max_segment = 0; - for(SMesh::Face_iterator facet_it = sm->faces_begin(); - facet_it != sm->faces_end(); ++facet_it) + for(SMesh::Face_iterator facet_it = sm->faces_begin(); + facet_it != sm->faces_end(); ++facet_it) { std::size_t segment_id = segment_ids[static_cast(*facet_it)]; sm->property_map("f:patch_id").first[*facet_it] = static_cast(segment_id); - max_segment = (std::max)(max_segment, segment_id); + max_segment = (std::max)(max_segment, segment_id); } color_vector.push_back(QColor(0, 0, 0)); - for(std::size_t i = 1; i <= max_segment; ++i) + for(std::size_t i = 1; i <= max_segment; ++i) color_vector.push_back (QColor (CGAL::get_default_random().get_int (41, 255), CGAL::get_default_random().get_int (35, 238), CGAL::get_default_random().get_int (35, 255))); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_segmentation_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_segmentation_plugin.cpp index 336d233b693..b00e6ee000c 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_segmentation_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_segmentation_plugin.cpp @@ -246,7 +246,7 @@ void Polyhedron_demo_mesh_segmentation_plugin::on_SDF_button_clicked() template void Polyhedron_demo_mesh_segmentation_plugin::apply_Partition_button_clicked(FacegraphItem* item) { - + typedef typename FacegraphItem::Face_graph Facegraph; QApplication::setOverrideCursor(Qt::WaitCursor); @@ -293,9 +293,9 @@ void Polyhedron_demo_mesh_segmentation_plugin::apply_Partition_button_clicked(Fa FaceGraph_with_id_to_vector_property_map sdf_pmap(&pair->second, fidmap); sdf_values(*(pair->first->face_graph()), sdf_pmap, cone_angle, number_of_rays); } - - - + + + std::vector internal_segment_map(num_faces(*pair->first->face_graph())); FaceGraph_with_id_to_vector_property_map segment_pmap(&internal_segment_map, fidmap); FaceGraph_with_id_to_vector_property_map sdf_pmap(&pair->second, fidmap); @@ -303,7 +303,7 @@ void Polyhedron_demo_mesh_segmentation_plugin::apply_Partition_button_clicked(Fa if(!isClosed) { bool has_sdf_values = false; - for(typename boost::graph_traits::face_descriptor f : + for(typename boost::graph_traits::face_descriptor f : faces(*pair->first->face_graph())) { if(sdf_pmap[f] != -1 diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_simplification_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_simplification_plugin.cpp index 29d9759b73b..0847c806af8 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_simplification_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_simplification_plugin.cpp @@ -26,7 +26,7 @@ class Custom_stop_predicate bool m_and; CGAL::Surface_mesh_simplification::Count_stop_predicate m_count_stop; CGAL::Surface_mesh_simplification::Edge_length_stop_predicate m_length_stop; - + public: Custom_stop_predicate (bool use_and, std::size_t nb_edges, double edge_length) @@ -40,7 +40,7 @@ public: template bool operator() (const double& current_cost, const Profile& edge_profile, - std::size_t initial_count, std::size_t current_count) const + std::size_t initial_count, std::size_t current_count) const { if (m_and) return (m_count_stop(current_cost, edge_profile, initial_count, current_count) @@ -54,7 +54,7 @@ public: using namespace CGAL::Three; -class Polyhedron_demo_mesh_simplification_plugin : +class Polyhedron_demo_mesh_simplification_plugin : public QObject, public Polyhedron_demo_plugin_interface { @@ -81,7 +81,7 @@ public: _actions <(scene->item(scene->mainSelectionIndex())) || qobject_cast(scene->item(scene->mainSelectionIndex())); } @@ -97,7 +97,7 @@ private : void Polyhedron_demo_mesh_simplification_plugin::on_actionSimplify_triggered() { const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); - + Scene_facegraph_item* poly_item = qobject_cast(scene->item(index)); @@ -126,7 +126,7 @@ void Polyhedron_demo_mesh_simplification_plugin::on_actionSimplify_triggered() double diago_length = CGAL::sqrt((bbox.xmax()-bbox.xmin())*(bbox.xmax()-bbox.xmin()) + (bbox.ymax()-bbox.ymin())*(bbox.ymax()-bbox.ymin()) + (bbox.zmax()-bbox.zmin())*(bbox.zmax()-bbox.zmin())); - + ui.m_nb_edges->setValue ((int)(num_halfedges(pmesh) / 4)); ui.m_nb_edges->setMaximum ((int)(num_halfedges(pmesh))); ui.m_edge_length->setValue (diago_length * 0.05); @@ -160,7 +160,7 @@ void Polyhedron_demo_mesh_simplification_plugin::on_actionSimplify_triggered() Scene_polyhedron_selection_item::Is_constrained_map > placement (selection_item->constrained_edges_pmap()); - + CGAL::Surface_mesh_simplification::edge_collapse (pmesh, stop, CGAL::parameters::edge_is_constrained_map(selection_item->constrained_edges_pmap()) @@ -171,13 +171,13 @@ void Polyhedron_demo_mesh_simplification_plugin::on_actionSimplify_triggered() CGAL::Surface_mesh_simplification::Bounded_normal_change_placement > placement; - + CGAL::Surface_mesh_simplification::edge_collapse (pmesh, stop, CGAL::parameters::vertex_index_map(get(boost::vertex_index, pmesh)).get_placement(placement)); } - - std::cout << "ok (" << time.elapsed() << " ms, " + + std::cout << "ok (" << time.elapsed() << " ms, " << num_halfedges(pmesh) / 2 << " edges)" << std::endl; // update scene diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Offset_meshing_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Offset_meshing_plugin.cpp index ef5b585b890..827cdaff258 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Offset_meshing_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Offset_meshing_plugin.cpp @@ -11,7 +11,7 @@ #include #include #include "Scene_surface_mesh_item.h" -#include "Scene_polygon_soup_item.h" +#include "Scene_polygon_soup_item.h" #include #include #include @@ -199,7 +199,7 @@ public: return m_offset_distance - distance; } -}; // end class Polygon_soup_offset_function +}; // end class Polygon_soup_offset_function } //end of CGAL namespace @@ -317,7 +317,7 @@ SMesh* cgal_off_meshing(QWidget*, { CGAL::Polygon_mesh_processing::reverse_face_orientations(*pRemesh); } - + return pRemesh; } else @@ -326,7 +326,7 @@ SMesh* cgal_off_meshing(QWidget*, struct Mesher_thread:public QThread{ Q_OBJECT - + private: SMesh* sMesh; Scene_polygon_soup_item* soup_item; @@ -503,7 +503,7 @@ void Polyhedron_demo_offset_meshing_plugin::offset_meshing() approx, tag_index); connect(worker, &QThread::finished, worker, &QObject::deleteLater); - connect(worker, &Mesher_thread::resultReady, this, + connect(worker, &Mesher_thread::resultReady, this, [item, angle, sizing, approx, offset_value, index] (SMesh *new_mesh){ QApplication::restoreOverrideCursor(); @@ -523,7 +523,7 @@ void Polyhedron_demo_offset_meshing_plugin::offset_meshing() item->setVisible(false); CGAL::Three::Three::scene()->itemChanged(index); QApplication::restoreOverrideCursor(); - + }); QMessageBox* message_box = new QMessageBox(QMessageBox::NoIcon, "Meshing", @@ -543,7 +543,7 @@ void Polyhedron_demo_offset_meshing_plugin::offset_meshing() connect(worker, &Mesher_thread::finished, message_box, &QMessageBox::close); message_box->open(); - + QApplication::setOverrideCursor(Qt::BusyCursor); worker->start(); } diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/VSA_wrapper.h b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/VSA_wrapper.h index c876ba84680..644e9fc1501 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/VSA_wrapper.h +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/VSA_wrapper.h @@ -138,7 +138,7 @@ public: // generate proxy colors m_proxy_colors.clear(); m_proxy_colors.reserve(number_of_proxies()); - + for (std::size_t i = 0; i < number_of_proxies(); ++i) { m_proxy_colors.push_back(generate_random_color()); } diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Edit_polyhedron_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Edit_polyhedron_plugin.cpp index 8d15fb0cbde..52c08656eec 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Edit_polyhedron_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Edit_polyhedron_plugin.cpp @@ -17,7 +17,7 @@ typedef Scene_surface_mesh_item Scene_facegraph_item; using namespace CGAL::Three; -class Polyhedron_demo_edit_polyhedron_plugin : +class Polyhedron_demo_edit_polyhedron_plugin : public QObject, public Polyhedron_demo_plugin_helper { @@ -26,7 +26,7 @@ class Polyhedron_demo_edit_polyhedron_plugin : Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") public: - Polyhedron_demo_edit_polyhedron_plugin() + Polyhedron_demo_edit_polyhedron_plugin() : Polyhedron_demo_plugin_helper(), dock_widget(NULL) { } ~Polyhedron_demo_edit_polyhedron_plugin() @@ -50,12 +50,12 @@ public Q_SLOTS: void on_PrevCtrlVertPushButton_clicked(); void on_NextCtrlVertPushButton_clicked(); void on_SelectAllVerticesPushButton_clicked(); - void on_DeleteCtrlVertPushButton_clicked(); + void on_DeleteCtrlVertPushButton_clicked(); void on_ApplyAndClosePushButton_clicked(); void on_DiscardChangesPushButton_clicked(); void on_ClearROIPushButton_clicked(); void on_ShowROICheckBox_stateChanged(int state); - void on_ShowAsSphereCheckBox_stateChanged(int state); + void on_ShowAsSphereCheckBox_stateChanged(int state); void on_ActivatePivotingCheckBox_stateChanged(int state); void on_ActivateFixedPlaneCheckBox_stateChanged(int state); void on_OverwritePushButton_clicked(); @@ -89,7 +89,7 @@ private: QList Polyhedron_demo_edit_polyhedron_plugin::actions() const { return QList() << actionDeformation; } -bool Polyhedron_demo_edit_polyhedron_plugin::applicable(QAction*) const { +bool Polyhedron_demo_edit_polyhedron_plugin::applicable(QAction*) const { Q_FOREACH(CGAL::Three::Scene_interface::Item_id i, scene->selectionIndices()) { if(qobject_cast(scene->item(i))) @@ -130,7 +130,7 @@ void Polyhedron_demo_edit_polyhedron_plugin::init(QMainWindow* mainWindow, CGAL: , mw); dock_widget->setVisible(false); // do not show at the beginning - ui_widget.setupUi(dock_widget); + ui_widget.setupUi(dock_widget); dock_widget->setWindowTitle(tr( "Surface Mesh Deformation" )); @@ -146,7 +146,7 @@ void Polyhedron_demo_edit_polyhedron_plugin::init(QMainWindow* mainWindow, CGAL: connect(ui_widget.DiscardChangesPushButton, SIGNAL(clicked()), this, SLOT(on_DiscardChangesPushButton_clicked())); connect(ui_widget.ClearROIPushButton, SIGNAL(clicked()), this, SLOT(on_ClearROIPushButton_clicked())); connect(ui_widget.ShowROICheckBox, SIGNAL(stateChanged(int)), this, SLOT(on_ShowROICheckBox_stateChanged(int))); - connect(ui_widget.ShowAsSphereCheckBox, SIGNAL(stateChanged(int)), this, SLOT(on_ShowAsSphereCheckBox_stateChanged(int))); + connect(ui_widget.ShowAsSphereCheckBox, SIGNAL(stateChanged(int)), this, SLOT(on_ShowAsSphereCheckBox_stateChanged(int))); connect(ui_widget.ActivateFixedPlaneCheckBox, SIGNAL(stateChanged(int)), this, SLOT(on_ActivateFixedPlaneCheckBox_stateChanged(int))); connect(ui_widget.ActivatePivotingCheckBox, SIGNAL(stateChanged(int)), this, SLOT(on_ActivatePivotingCheckBox_stateChanged(int))); connect(ui_widget.OverwritePushButton, SIGNAL(clicked()), this, SLOT(on_OverwritePushButton_clicked())); @@ -165,7 +165,7 @@ void Polyhedron_demo_edit_polyhedron_plugin::init(QMainWindow* mainWindow, CGAL: } void Polyhedron_demo_edit_polyhedron_plugin::on_actionDeformation_triggered() -{ +{ // dock widget should be constructed in init() if(dock_widget->isVisible()) { dock_widget->hide(); } else { dock_widget->show(); dock_widget->raise();} @@ -175,7 +175,7 @@ void Polyhedron_demo_edit_polyhedron_plugin::on_actionDeformation_triggered() // what they do is simply transmitting required 'action' to selected scene_edit_polyhedron_item object void Polyhedron_demo_edit_polyhedron_plugin::on_AddCtrlVertPushButton_clicked() { - + int item_id = scene->selectionIndices().front(); Scene_edit_polyhedron_item* edit_item = qobject_cast(scene->item(item_id)); if(!edit_item) return; // the selected item is not of the right type @@ -253,8 +253,8 @@ void Polyhedron_demo_edit_polyhedron_plugin::on_ShowROICheckBox_stateChanged(int { Scene_edit_polyhedron_item* edit_item = qobject_cast(scene->item(i)); if(!edit_item) { continue; } - scene->itemChanged(edit_item); // just for redraw - } + scene->itemChanged(edit_item); // just for redraw + } } void Polyhedron_demo_edit_polyhedron_plugin::on_ShowAsSphereCheckBox_stateChanged(int state) { @@ -266,8 +266,8 @@ void Polyhedron_demo_edit_polyhedron_plugin::on_ShowAsSphereCheckBox_stateChange edit_item->ShowAsSphere(false); else edit_item->ShowAsSphere(true); - scene->itemChanged(edit_item); // just for redraw - } + scene->itemChanged(edit_item); // just for redraw + } } void Polyhedron_demo_edit_polyhedron_plugin::on_ActivatePivotingCheckBox_stateChanged(int state) { @@ -275,14 +275,14 @@ void Polyhedron_demo_edit_polyhedron_plugin::on_ActivatePivotingCheckBox_stateCh { Scene_edit_polyhedron_item* edit_item = qobject_cast(scene->item(i)); if(!edit_item) { continue; } - + if(state == Qt::Checked) { edit_item->pivoting_begin(); } else { edit_item->pivoting_end(); } - scene->itemChanged(edit_item); + scene->itemChanged(edit_item); } } void Polyhedron_demo_edit_polyhedron_plugin::on_ActivateFixedPlaneCheckBox_stateChanged(int) @@ -309,7 +309,7 @@ void Polyhedron_demo_edit_polyhedron_plugin::on_Select_isolated_components_butto Scene_edit_polyhedron_item* edit_item = qobject_cast(scene->item(item_id)); if(!edit_item) return; // the selected item is not of the right type - boost::optional minimum = + boost::optional minimum = edit_item->select_isolated_components(ui_widget.Threshold_size_spin_box->value()); if(minimum) { ui_widget.Threshold_size_spin_box->setValue((int) *minimum); @@ -331,27 +331,27 @@ void Polyhedron_demo_edit_polyhedron_plugin::on_SaveROIPushButton_clicked() { int item_id = scene->selectionIndices().front(); Scene_edit_polyhedron_item* edit_item = qobject_cast(scene->item(item_id)); - if(!edit_item) return; + if(!edit_item) return; - QString fileName = QFileDialog::getSaveFileName(mw, "Save", + QString fileName = QFileDialog::getSaveFileName(mw, "Save", "roi.txt", "Text (*.txt)"); if(fileName.isNull()) { return; } - edit_item->save_roi(fileName.toLocal8Bit().data()); + edit_item->save_roi(fileName.toLocal8Bit().data()); } void Polyhedron_demo_edit_polyhedron_plugin::on_ReadROIPushButton_clicked() { int item_id = scene->selectionIndices().front(); Scene_edit_polyhedron_item* edit_item = qobject_cast(scene->item(item_id)); - if(!edit_item) return; + if(!edit_item) return; - QString fileName = QFileDialog::getOpenFileName(mw, "Read", + QString fileName = QFileDialog::getOpenFileName(mw, "Read", "roi.txt", "Text (*.txt)"); if(fileName.isNull()) { return; } edit_item->read_roi(fileName.toLocal8Bit().data()); edit_item->invalidateOpenGLBuffers(); - scene->itemChanged(edit_item); + scene->itemChanged(edit_item); } @@ -426,7 +426,7 @@ void Polyhedron_demo_edit_polyhedron_plugin::dock_widget_visibility_changed(bool void Polyhedron_demo_edit_polyhedron_plugin::on_ROIRadioButton_toggled(bool value) { - int k_ring = value ? ui_widget.BrushSpinBoxRoi->value() : + int k_ring = value ? ui_widget.BrushSpinBoxRoi->value() : ui_widget.BrushSpinBoxCtrlVert->value(); for(CGAL::Three::Scene_interface::Item_id i = 0, end = scene->numberOfEntries(); i < end; ++i) { diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp index 495d2b73342..48d85e15612 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp @@ -169,7 +169,7 @@ struct Facegraph_selector } ////ctrl_groups///// - + Ctrl_vertices_sm_group_data_list::iterator& get_active_group(SMesh*) { return d->sm_active_group; @@ -192,7 +192,7 @@ struct Facegraph_selector return d->sm_ctrl_vertex_frame_map; } - + Ctrl_vertices_sm_group_data_list::iterator& get_active_group(SMesh*, Scene_edit_polyhedron_item_priv* d)const { return d->sm_active_group; @@ -364,7 +364,7 @@ void Scene_edit_polyhedron_item_priv::compute_normals_and_vertices(Mesh* mesh) } } - + for(typename std::list >::const_iterator hgb_data = fs.get_ctrl_vertex_frame_map(mesh).begin(); hgb_data != fs.get_ctrl_vertex_frame_map(mesh).end(); ++hgb_data) { if(hgb_data->frame == Three::mainViewer()->manipulatedFrame()) @@ -427,7 +427,7 @@ void Scene_edit_polyhedron_item::deform() { if(!is_there_any_ctrl_vertices()) { return; } - + d->deform(d->sm_item->polyhedron()); d->sm_item->invalidate_aabb_tree(); Q_EMIT itemChanged(); @@ -1046,9 +1046,9 @@ void Scene_edit_polyhedron_item::draw_ROI_and_control_vertices(CGAL::Three::View viewer->setGlPointSize(5); //Draw the points if(d->ui_widget->ShowROICheckBox->isChecked()) { - + if(!d->ui_widget->ShowAsSphereCheckBox->isChecked() || !viewer->isExtensionFound()) { - + Pc* pc = getPointContainer(Priv::Roi_points); pc->setColor(QColor(0,255,0)); pc->draw(viewer, true); @@ -1066,7 +1066,7 @@ void Scene_edit_polyhedron_item::draw_ROI_and_control_vertices(CGAL::Three::View Scene_group_item::draw(viewer); } } - + if(!d->ui_widget->ShowAsSphereCheckBox->isChecked() || !viewer->isExtensionFound()) { Pc* pc = getPointContainer(Priv::Control_points); pc->draw(viewer, false); @@ -1088,17 +1088,17 @@ void Scene_edit_polyhedron_item_priv::compute_bbox(const CGAL::Three::Scene_inte pos_bbox[3]=bb.xmax(); pos_bbox[4]=bb.ymin(); pos_bbox[5]=bb.zmin(); pos_bbox[6]=bb.xmin(); pos_bbox[7]=bb.ymin(); pos_bbox[8]=bb.zmin(); pos_bbox[9]=bb.xmin(); pos_bbox[10]=bb.ymax(); pos_bbox[11]=bb.zmin(); - + pos_bbox[12]=bb.xmin(); pos_bbox[13]=bb.ymin(); pos_bbox[14]=bb.zmin(); pos_bbox[15]=bb.xmin(); pos_bbox[16]=bb.ymin(); pos_bbox[17]=bb.zmax(); pos_bbox[18]= bb.xmax(); pos_bbox[19]=bb.ymin(); pos_bbox[20]=bb.zmin(); pos_bbox[21]= bb.xmax(); pos_bbox[22]=bb.ymax(); pos_bbox[23]=bb.zmin(); - + pos_bbox[24]= bb.xmax(); pos_bbox[25]=bb.ymin(); pos_bbox[26]=bb.zmin(); pos_bbox[27]= bb.xmax(); pos_bbox[28]=bb.ymin(); pos_bbox[29]=bb.zmax(); pos_bbox[30]=bb.xmin(); pos_bbox[31]=bb.ymax(); pos_bbox[32]=bb.zmin(); pos_bbox[33]=bb.xmax(); pos_bbox[34]=bb.ymax(); pos_bbox[35]=bb.zmin(); - + pos_bbox[36]=bb.xmin(); pos_bbox[37]=bb.ymax(); pos_bbox[38]=bb.zmin(); pos_bbox[39]=bb.xmin(); pos_bbox[40]=bb.ymax(); pos_bbox[41]=bb.zmax(); pos_bbox[42]=bb.xmin(); pos_bbox[43]=bb.ymin(); pos_bbox[44]=bb.zmax(); @@ -1113,7 +1113,7 @@ void Scene_edit_polyhedron_item_priv::compute_bbox(const CGAL::Three::Scene_inte pos_bbox[63]=bb.xmax(); pos_bbox[64]=bb.ymin(); pos_bbox[65]=bb.zmax(); pos_bbox[66]=bb.xmax(); pos_bbox[67]=bb.ymax(); pos_bbox[68]=bb.zmax(); pos_bbox[69]=bb.xmax(); pos_bbox[70]=bb.ymax(); pos_bbox[71]=bb.zmin(); - + } void Scene_edit_polyhedron_item::invalidateOpenGLBuffers() @@ -1163,7 +1163,7 @@ QString Scene_edit_polyhedron_item::toolTip() const { if(!d->sm_item->polyhedron()) return QString(); - + return QObject::tr("

Surface Mesh %1 (mode: %5, color: %6)

" "

Number of vertices: %2
" "Number of edges: %3
" @@ -1247,7 +1247,7 @@ bool Scene_edit_polyhedron_item::keyPressEvent(QKeyEvent* e) void Scene_edit_polyhedron_item::update_frame_plane() { - + for(Ctrl_vertices_sm_group_data_list::iterator hgb_data = d->sm_ctrl_vertex_frame_map.begin(); hgb_data != d->sm_ctrl_vertex_frame_map.end(); ++hgb_data) { @@ -1418,7 +1418,7 @@ void Scene_edit_polyhedron_item::create_ctrl_vertices_group() Control_vertices_data hgd(d->deform_sm_mesh, new_frame); d->sm_ctrl_vertex_frame_map.push_back(hgd); hgd.refresh(surface_mesh()); - + d->sm_active_group = --d->sm_ctrl_vertex_frame_map.end(); invalidateOpenGLBuffers(); @@ -1545,7 +1545,7 @@ void Scene_edit_polyhedron_item::save_roi(const char* file_name) const // save control vertices out << d->sm_ctrl_vertex_frame_map.size() << std::endl; // control vertices count for(Ctrl_vertices_sm_group_data_list::const_iterator hgb = d->sm_ctrl_vertex_frame_map.begin(); hgb != d->sm_ctrl_vertex_frame_map.end(); ++hgb) { - + out << hgb->ctrl_vertices_group.size() << std::endl; for(std::vector::const_iterator hb = hgb->ctrl_vertices_group.begin(); hb != hgb->ctrl_vertices_group.end(); ++hb) { @@ -1652,7 +1652,7 @@ bool Scene_edit_polyhedron_item::is_there_any_ctrl_vertices() { Ctrl_vertices_sm_group_data_list::iterator hgb, hge; if(!is_there_any_ctrl_vertices_group(hgb, hge)) { return false; } // there isn't any group of control vertices - + for(; hgb != hge; ++hgb) // check inside groups of control vertices { if(!hgb->ctrl_vertices_group.empty()) { return true; } @@ -1740,7 +1740,7 @@ void Scene_edit_polyhedron_item::update_normals() { d->normals[id*3] = n.x(); d->normals[id*3+1] = n.y(); d->normals[id*3+2] = n.z(); - + } } @@ -1802,16 +1802,16 @@ void Scene_edit_polyhedron_item::computeElements() const vertices_ptr->data(), static_cast(vertices_ptr->size()*sizeof(float))); tc->allocate( - Tc::Smooth_normals, + Tc::Smooth_normals, d->normals.data(), static_cast(d->normals.size()*sizeof(float))); tc->allocate( - Tc::Vertex_indices, + Tc::Vertex_indices, d->tris.data(), static_cast(d->tris.size()*sizeof(float))); } //vao for the ROI points - { + { Pc* pc = getPointContainer(Priv::Roi_points); pc->allocate( Pc::Vertices, @@ -1837,7 +1837,7 @@ void Scene_edit_polyhedron_item::computeElements() const ec->allocate(Ec::Vertices, d->pos_bbox.data(), static_cast(d->pos_bbox.size()*sizeof(float))); - + d->nb_bbox = d->pos_bbox.size(); } //vao for the control points @@ -1846,12 +1846,12 @@ void Scene_edit_polyhedron_item::computeElements() const pc->allocate(Pc::Vertices, d->control_points.data(), static_cast(d->control_points.size()*sizeof(float))); - + pc->allocate(Pc::Colors, d->control_color.data(), static_cast(d->control_color.size()*sizeof(float))); - - + + d->nb_control = d->control_points.size(); } //vao for the axis @@ -1865,11 +1865,11 @@ void Scene_edit_polyhedron_item::computeElements() const d->color_lines.data(), static_cast(d->color_lines.size()*sizeof(float))); d->nb_axis = d->pos_axis.size(); - + } //vao for the frame plane { - + Tc* tc = getTriangleContainer(Priv::Frame_plane); tc->allocate(Tc::Smooth_vertices, d->pos_frame_plane.data(), @@ -1890,7 +1890,7 @@ void Scene_edit_polyhedron_item::initializeBuffers(Viewer_interface *v) const getEdgeContainer(Priv::BBox)->initializeBuffers(v); getPointContainer(Priv::Roi_points)->initializeBuffers(v); getPointContainer(Priv::Control_points)->initializeBuffers(v); - + getTriangleContainer(Priv::Facets)->setIdxSize(d->tris.size()); getTriangleContainer(Priv::Frame_plane)->setIdxSize(d->plane_idx.size()); getEdgeContainer(Priv::Edges)->setIdxSize(d->_edges.size()); @@ -1898,7 +1898,7 @@ void Scene_edit_polyhedron_item::initializeBuffers(Viewer_interface *v) const getEdgeContainer(Priv::BBox)->setFlatDataSize(d->nb_bbox); getPointContainer(Priv::Roi_points)->setFlatDataSize(d->nb_ROI); getPointContainer(Priv::Control_points)->setFlatDataSize(d->nb_control); - + d->pos_axis.resize(0); d->pos_axis.shrink_to_fit(); d->color_lines.resize(0); diff --git a/Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp b/Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp index 0b98891d35c..16b82dd2ef4 100644 --- a/Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp @@ -71,7 +71,7 @@ public : delete alphaSlider; } void compute_bbox() const Q_DECL_OVERRIDE{} - + void gl_initialization(Vi* viewer) { if(!isInit(viewer)) @@ -105,7 +105,7 @@ public : { getTriangleContainer(0)->reset_vbos(ALL); getEdgeContainer(0)->reset_vbos(ALL); - + getTriangleContainer(0)->allocate(Tc::Flat_vertices, vertices->data(), static_cast(vertices->size()*sizeof(float))); getTriangleContainer(0)->allocate(Tc::Flat_normals, normals->data(), @@ -131,7 +131,7 @@ public : getEdgeContainer(0)->setFlatDataSize(edges->size()); } } - + //Displays the item void draw(CGAL::Three::Viewer_interface* viewer) const Q_DECL_OVERRIDE { @@ -165,7 +165,7 @@ public : getEdgeContainer(0)->setPlane(cp); getEdgeContainer(0)->setColor(QColor(Qt::black)); getEdgeContainer(0)->draw(viewer, true); - + } void setFast(bool b) @@ -240,10 +240,10 @@ public : QMenu* contextMenu() Q_DECL_OVERRIDE { QMenu* menu = Scene_item::contextMenu(); - + const char* prop_name = "Menu modified by Scene_surface_mesh_item."; bool menuChanged = menu->property(prop_name).toBool(); - + if(!menuChanged) { menu->addSeparator(); QMenu *container = new QMenu(tr("Alpha value")); @@ -255,7 +255,7 @@ public : setAlpha(alphaSlider->value()); redraw(); }); - + container->addAction(sliderAction); menu->addMenu(container); setProperty("menu_changed", true); @@ -267,10 +267,10 @@ public : { return m_alpha ; } - + void setAlpha(int a) Q_DECL_OVERRIDE { - m_alpha = a / 255.0f; + m_alpha = a / 255.0f; redraw(); } private: @@ -521,14 +521,14 @@ void Scene_c3t3_item::common_constructor(bool is_surface) c3t3_changed(); setRenderingMode(FlatPlusEdges); create_flat_and_wire_sphere(1.0f,d->s_vertex,d->s_normals, d->ws_vertex); - + d->is_surface = is_surface; d->is_grid_shown = !is_surface; d->show_tetrahedra = !is_surface; d->last_intersection = !d->show_tetrahedra; - + setTriangleContainer(C3t3_faces, new Tc(Vi::PROGRAM_C3T3, false)); - + setEdgeContainer(CNC, new Ec(Vi::PROGRAM_NO_SELECTION, false)); setEdgeContainer(Grid_edges, new Ec(Vi::PROGRAM_NO_SELECTION, false)); setEdgeContainer(C3t3_edges, new Ec(Vi::PROGRAM_C3T3_EDGES, false)); @@ -549,7 +549,7 @@ Scene_c3t3_item::Scene_c3t3_item(const C3t3& c3t3, bool is_surface) : Scene_group_item("unnamed") , d(new Scene_c3t3_item_priv(c3t3, this)) { - d->reset_cut_plane(); + d->reset_cut_plane(); common_constructor(is_surface); } @@ -948,7 +948,7 @@ void Scene_c3t3_item::draw(CGAL::Three::Viewer_interface* viewer) const { d->intersection->setFast(false); else d->intersection->setFast(true); - + if(!d->frame->isManipulated() && !d->areInterBufFilled(viewer)) { //initGL @@ -964,7 +964,7 @@ void Scene_c3t3_item::draw(CGAL::Three::Viewer_interface* viewer) const { } if(d->is_grid_shown) { - //viewer->makeCurrent(); //messes with the depthPeeling + //viewer->makeCurrent(); //messes with the depthPeeling getEdgeContainer(Grid_edges)->setColor(QColor(Qt::black)); QMatrix4x4 f_mat; for (int i = 0; i<16; i++) @@ -1009,13 +1009,13 @@ void Scene_c3t3_item::drawEdges(CGAL::Three::Viewer_interface* viewer) const { getEdgeContainer(Grid_edges)->setFrameMatrix(f_mat); getEdgeContainer(Grid_edges)->draw(viewer, true); } - + QVector4D cp(this->plane().a(),this->plane().b(),this->plane().c(),this->plane().d()); getEdgeContainer(C3t3_edges)->setPlane(cp); getEdgeContainer(C3t3_edges)->setIsSurface(d->is_surface); getEdgeContainer(C3t3_edges)->setColor(QColor(Qt::black)); getEdgeContainer(C3t3_edges)->draw(viewer, true); - + if(d->show_tetrahedra){ if(!d->frame->isManipulated()) d->intersection->setFast(false); @@ -1058,14 +1058,14 @@ void Scene_c3t3_item::drawPoints(CGAL::Three::Viewer_interface * viewer) const computeElements(); initializeBuffers(viewer); } - - + + QVector4D cp(this->plane().a(),this->plane().b(),this->plane().c(),this->plane().d()); getPointContainer(C3t3_points)->setPlane(cp); getPointContainer(C3t3_points)->setIsSurface(d->is_surface); getPointContainer(C3t3_points)->setColor(this->color()); getPointContainer(C3t3_points)->draw(viewer, true); - + if(d->is_grid_shown) { getEdgeContainer(Grid_edges)->setColor(QColor(Qt::black)); @@ -1214,7 +1214,7 @@ QMenu* Scene_c3t3_item::contextMenu() bool menuChanged = menu->property(prop_name).toBool(); if (!menuChanged) { - + QMenu *container = new QMenu(tr("Alpha value")); container->menuAction()->setProperty("is_groupable", true); QWidgetAction *sliderAction = new QWidgetAction(0); @@ -1229,7 +1229,7 @@ QMenu* Scene_c3t3_item::contextMenu() ); container->addAction(sliderAction); menu->addMenu(container); - + container = new QMenu(tr("Tetrahedra's Shrink Factor")); sliderAction = new QWidgetAction(0); connect(d->tet_Slider, &QSlider::valueChanged, this, &Scene_c3t3_item::itemChanged); @@ -1273,7 +1273,7 @@ QMenu* Scene_c3t3_item::contextMenu() connect(actionShowGrid, SIGNAL(toggled(bool)), this, SLOT(show_grid(bool))); - + menu->setProperty(prop_name, true); } return menu; @@ -1287,8 +1287,8 @@ void Scene_c3t3_item_priv::initializeBuffers(CGAL::Three::Viewer_interface *view item->getTriangleContainer(Scene_c3t3_item::C3t3_faces)->initializeBuffers(viewer); item->getTriangleContainer(Scene_c3t3_item::C3t3_faces)->setFlatDataSize( positions_poly_size); - - + + positions_poly.clear(); positions_poly.shrink_to_fit(); normals.clear(); @@ -1310,7 +1310,7 @@ void Scene_c3t3_item_priv::initializeBuffers(CGAL::Three::Viewer_interface *view item->getPointContainer(Scene_c3t3_item::C3t3_points)->initializeBuffers(viewer); item->getPointContainer(Scene_c3t3_item::C3t3_points)->setFlatDataSize( positions_lines_size); - + positions_lines.clear(); positions_lines.shrink_to_fit(); } @@ -1380,7 +1380,7 @@ void Scene_c3t3_item_priv::computeIntersections(CGAL::Three::Viewer_interface* v positions_barycenter.clear(); const Geom_traits::Plane_3& plane = item->plane(offset); tree.all_intersected_primitives(plane, - boost::make_function_output_iterator(ComputeIntersection(*this))); + boost::make_function_output_iterator(ComputeIntersection(*this))); intersection->gl_initialization(viewer); } @@ -1440,13 +1440,13 @@ void Scene_c3t3_item_priv::computeSpheres() tr_vertices.push_back(*vit); spheres->add_sphere(Geom_traits::Sphere_3(center, radius),s_id++, CGAL::Color(UC(c.red()), UC(c.green()), UC(c.blue()))); - + } spheres->invalidateOpenGLBuffers(); } void Scene_c3t3_item_priv::computeElements() -{ +{ if(!alphaSlider) { alphaSlider = new QSlider(::Qt::Horizontal); @@ -1454,7 +1454,7 @@ void Scene_c3t3_item_priv::computeElements() alphaSlider->setMaximum(255); alphaSlider->setValue(255); } - + positions_poly.clear(); positions_grid.clear(); normals.clear(); @@ -1615,7 +1615,7 @@ void Scene_c3t3_item::show_spheres(bool b) QString msg = QString("Vertex's index : %1; Vertex's in dimension: %2.").arg(d->tr_vertices[id].index()).arg(d->tr_vertices[id].in_dimension()); CGAL::Three::Three::information(msg); CGAL::Three::Three::mainViewer()->displayMessage(msg, 5000); - + }); d->spheres->setName("Protecting spheres"); d->spheres->setRenderingMode(Gouraud); @@ -1998,7 +1998,7 @@ void Scene_c3t3_item::invalidateOpenGLBuffers() getEdgeContainer(CNC)->reset_vbos(ALL); getEdgeContainer(Grid_edges)->reset_vbos(ALL); getPointContainer(C3t3_points)->reset_vbos(ALL); - + Q_FOREACH(CGAL::QGLViewer* v, CGAL::QGLViewer::QGLViewerPool()) { CGAL::Three::Viewer_interface* viewer = static_cast(v); @@ -2077,52 +2077,52 @@ void Scene_c3t3_item::computeElements()const { QApplication::setOverrideCursor(Qt::WaitCursor); const_cast(this)->d->computeElements(); - + getTriangleContainer(C3t3_faces)->allocate( Tc::Flat_vertices, d->positions_poly.data(), static_cast(d->positions_poly.size()*sizeof(float))); - + getTriangleContainer(C3t3_faces)->allocate( Tc::Flat_normals, d->normals.data(), static_cast(d->normals.size()*sizeof(float))); - - + + getTriangleContainer(C3t3_faces)->allocate( Tc::FColors, d->f_colors.data(), static_cast(d->f_colors.size()*sizeof(float))); - + getTriangleContainer(C3t3_faces)->allocate( Tc::Facet_centers, d->positions_barycenter.data(), static_cast(d->positions_barycenter.size()*sizeof(float))); - + d->positions_poly_size = d->positions_poly.size(); - + getEdgeContainer(C3t3_edges)->allocate( Ec::Vertices, d->positions_lines.data(), static_cast(d->positions_lines.size()*sizeof(float))); d->positions_lines_size = d->positions_lines.size(); - + getEdgeContainer(CNC)->allocate( Ec::Vertices, d->positions_lines_not_in_complex.data(), static_cast(d->positions_lines_not_in_complex.size()*sizeof(float))); - + d->positions_lines_not_in_complex_size = d->positions_lines_not_in_complex.size(); - + getEdgeContainer(Grid_edges)->allocate( Ec::Vertices, d->positions_grid.data(), static_cast(d->positions_grid.size()*sizeof(float))); - + getPointContainer(C3t3_points)->allocate( Pc::Vertices, d->positions_lines.data(), static_cast(d->positions_lines.size()*sizeof(float))); - + setBuffersFilled(true); QApplication::restoreOverrideCursor(); } diff --git a/Polyhedron/demo/Polyhedron/Scene_item_rendering_helper.cpp b/Polyhedron/demo/Polyhedron/Scene_item_rendering_helper.cpp index bffe5e847b5..8edcfda6d3e 100644 --- a/Polyhedron/demo/Polyhedron/Scene_item_rendering_helper.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_item_rendering_helper.cpp @@ -169,10 +169,10 @@ Scene_item::Bbox Scene_item_rendering_helper::bbox() const { return priv->_bbox; } -bool Scene_item_rendering_helper::isInit(CGAL::Three::Viewer_interface* viewer)const -{ +bool Scene_item_rendering_helper::isInit(CGAL::Three::Viewer_interface* viewer)const +{ if(priv->isinit.find(viewer) != priv->isinit.end()) - return priv->isinit[viewer]; + return priv->isinit[viewer]; return false; } diff --git a/Polyhedron/demo/Polyhedron/Scene_polygon_soup_item.cpp b/Polyhedron/demo/Polyhedron/Scene_polygon_soup_item.cpp index f7dd9a977c0..dfe4f2898f5 100644 --- a/Polyhedron/demo/Polyhedron/Scene_polygon_soup_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_polygon_soup_item.cpp @@ -14,7 +14,7 @@ #include #include -#include +#include #include #include @@ -91,7 +91,7 @@ struct Scene_polygon_soup_item_priv{ Edges = 0, NM_edges }; - + Polygon_soup* soup; bool oriented; mutable std::vector positions_poly; @@ -106,7 +106,7 @@ struct Scene_polygon_soup_item_priv{ bool is_triangle, is_quad, stats_computed; double minl, maxl, meanl, midl, mini, maxi, ave; std::size_t nb_null_edges, nb_degen_faces; - + Scene_polygon_soup_item* item; }; @@ -122,7 +122,7 @@ Scene_polygon_soup_item_priv::triangulate_polygon(Polygons_iterator pit, int pol { const CGAL::qglviewer::Vec off = static_cast(CGAL::QGLViewer::QGLViewerPool().first())->offset(); EPICK::Vector_3 offset(off.x,off.y,off.z); - + //Computes the normal of the facet Traits::Vector_3 normal = CGAL::NULL_VECTOR; @@ -137,7 +137,7 @@ Scene_polygon_soup_item_priv::triangulate_polygon(Polygons_iterator pit, int pol } if (normal == CGAL::NULL_VECTOR) // No normal could be computed, return return; - + typedef FacetTriangulator FT; std::size_t it = 0; @@ -312,7 +312,7 @@ Scene_polygon_soup_item_priv::compute_normals_and_vertices() const{ positions_nm_lines.push_back(b.y()+offset.y); positions_nm_lines.push_back(b.z()+offset.z); } - + } @@ -335,7 +335,7 @@ Scene_polygon_soup_item::~Scene_polygon_soup_item() delete d; } -Scene_polygon_soup_item* +Scene_polygon_soup_item* Scene_polygon_soup_item::clone() const { Scene_polygon_soup_item* new_soup = new Scene_polygon_soup_item(); new_soup->d->soup = d->soup->clone(); @@ -417,7 +417,7 @@ void Scene_polygon_soup_item::inside_out() invalidateOpenGLBuffers(); } -bool +bool Scene_polygon_soup_item::orient() { @@ -455,7 +455,7 @@ Scene_polygon_soup_item::orient() } -bool +bool Scene_polygon_soup_item::save(std::ostream& out) const { @@ -504,7 +504,7 @@ Scene_polygon_soup_item::exportAsSurfaceMesh(SMesh *out_surface_mesh) } return false; } -QString +QString Scene_polygon_soup_item::toolTip() const { @@ -540,10 +540,10 @@ Scene_polygon_soup_item::draw(CGAL::Three::Viewer_interface* viewer) const { computeElements(); initializeBuffers(viewer); } - + if(renderingMode() == Flat || renderingMode() == FlatPlusEdges) { - + if(d->soup->fcolors.empty()) getTriangleContainer(Priv::Flat_facets)->setColor(this->color()); getTriangleContainer(Priv::Flat_facets)->draw(viewer, d->soup->fcolors.empty()); @@ -558,7 +558,7 @@ Scene_polygon_soup_item::draw(CGAL::Three::Viewer_interface* viewer) const { void Scene_polygon_soup_item::drawPoints(CGAL::Three::Viewer_interface* viewer) const { - + if(d->soup == 0) return; if(!isInit(viewer)) initGL(viewer); @@ -637,7 +637,7 @@ void Scene_polygon_soup_item::compute_bbox() const { bbox.xmax(),bbox.ymax(),bbox.zmax())); } -void +void Scene_polygon_soup_item::new_vertex(const double& x, const double& y, const double& z) @@ -645,8 +645,8 @@ Scene_polygon_soup_item::new_vertex(const double& x, d->soup->points.push_back(Point_3(x, y, z)); } - -void + +void Scene_polygon_soup_item::new_triangle(const std::size_t i, const std::size_t j, const std::size_t k) @@ -692,7 +692,7 @@ void Scene_polygon_soup_item::load(const std::vector& points, const std:: d->soup->fcolors.reserve (fcolors.size()); std::copy (fcolors.begin(), fcolors.end(), std::back_inserter (d->soup->fcolors)); - + d->soup->vcolors.reserve (vcolors.size()); std::copy (vcolors.begin(), vcolors.end(), std::back_inserter (d->soup->vcolors)); } @@ -730,7 +730,7 @@ void Scene_polygon_soup_item::itemAboutToBeDestroyed(Scene_item *item) } } -const Polygon_soup::Edges& +const Polygon_soup::Edges& Scene_polygon_soup_item::non_manifold_edges() const { return d->soup->non_manifold_edges; @@ -740,19 +740,19 @@ void Scene_polygon_soup_item::initializeBuffers(Viewer_interface *v) const { getTriangleContainer(Priv::Flat_facets)->initializeBuffers(v); getTriangleContainer(Priv::Flat_facets)->setFlatDataSize(d->nb_polys); - + getTriangleContainer(Priv::Smooth_facets)->initializeBuffers(v); getTriangleContainer(Priv::Smooth_facets)->setFlatDataSize(d->nb_polys); - + getEdgeContainer(Priv::Edges)->initializeBuffers(v); getEdgeContainer(Priv::Edges)->setFlatDataSize(d->nb_lines); - + getEdgeContainer(Priv::NM_edges)->initializeBuffers(v); getEdgeContainer(Priv::NM_edges)->setFlatDataSize(d->nb_nm_edges); - + getPointContainer(0)->initializeBuffers(v); getPointContainer(0)->setFlatDataSize(d->nb_lines); - + d->normals.resize(0); d->positions_poly.resize(0); d->normals.shrink_to_fit(); @@ -766,15 +766,15 @@ void Scene_polygon_soup_item::initializeBuffers(Viewer_interface *v) const } void Scene_polygon_soup_item::computeElements() const -{ +{ QApplication::setOverrideCursor(Qt::WaitCursor); d->compute_normals_and_vertices(); - + getTriangleContainer(Priv::Flat_facets)->allocate( Tc::Flat_vertices, d->positions_poly.data(), static_cast(d->positions_poly.size()*sizeof(float))); - + getTriangleContainer(Priv::Flat_facets)->allocate( Tc::Flat_normals, d->normals.data(), @@ -790,12 +790,12 @@ void Scene_polygon_soup_item::computeElements() const Tc::Flat_vertices, d->positions_poly.data(), static_cast(d->positions_poly.size()*sizeof(float))); - + getTriangleContainer(Priv::Smooth_facets)->allocate( Tc::Flat_normals, d->normals.data(), static_cast(d->normals.size()*sizeof(float))); - + if(!d->v_colors.empty()) { getTriangleContainer(Priv::Smooth_facets)->allocate( @@ -803,28 +803,28 @@ void Scene_polygon_soup_item::computeElements() const d->v_colors.data(), static_cast(d->v_colors.size()*sizeof(float))); } - + d->nb_polys = d->positions_poly.size(); - + getEdgeContainer(Priv::Edges)->allocate( Ec::Vertices, d->positions_lines.data(), static_cast(d->positions_lines.size()*sizeof(float))); - + getPointContainer(0)->allocate( Pc::Vertices, d->positions_lines.data(), static_cast(d->positions_lines.size()*sizeof(float))); - - + + getEdgeContainer(Priv::NM_edges)->allocate( Ec::Vertices, d->positions_nm_lines.data(), static_cast(d->positions_nm_lines.size()*sizeof(float))); - + d->nb_nm_edges = d->positions_nm_lines.size(); d->nb_lines = d->positions_lines.size(); - + setBuffersFilled(true); QApplication::restoreOverrideCursor(); } @@ -856,19 +856,19 @@ CGAL::Three::Scene_item::Header_data Scene_polygon_soup_item::header() const //titles data.titles.append(QString("#Points")); - + data.titles.append(QString("#Polygons")); data.titles.append(QString("Pure Triangle")); data.titles.append(QString("Pure Quad")); data.titles.append(QString("#Degenerate Polygons")); - + data.titles.append(QString("#Edges")); data.titles.append(QString("Minimum Length")); data.titles.append(QString("Maximum Length")); data.titles.append(QString("Median Length")); data.titles.append(QString("Mean Length")); data.titles.append(QString("#Degenerate Edges")); - + data.titles.append(QString("Minimum")); data.titles.append(QString("Maximum")); data.titles.append(QString("Average")); @@ -879,7 +879,7 @@ QString Scene_polygon_soup_item::computeStats(int type) { if(!d->stats_computed) d->compute_stats(); - + switch(type) { case NB_VERTICES: @@ -888,7 +888,7 @@ QString Scene_polygon_soup_item::computeStats(int type) return QString::number(d->soup->polygons.size()); case NB_EDGES: return QString::number(d->nb_lines/6); - + case NB_DEGENERATED_FACES: { if(d->is_triangle) @@ -898,7 +898,7 @@ QString Scene_polygon_soup_item::computeStats(int type) else return QString("n/a"); } - + case MIN_LENGTH: return QString::number(d->minl); case MAX_LENGTH: @@ -909,14 +909,14 @@ QString Scene_polygon_soup_item::computeStats(int type) return QString::number(d->meanl); case NB_NULL_LENGTH: return QString::number(d->nb_null_edges); - + case MIN_ANGLE: return QString::number(d->mini); case MAX_ANGLE: return QString::number(d->maxi); case MEAN_ANGLE: return QString::number(d->ave); - + case IS_PURE_TRIANGLE: if(d->is_triangle) return QString("yes"); @@ -959,8 +959,8 @@ Scene_polygon_soup_item_priv::compute_stats() accumulator_set< double, features< tag::min, tag::max, tag::mean > > angles_acc; double rad_to_deg = 180. / CGAL_PI; - - + + for(auto poly : soup->polygons) { if(poly.size() != 3) @@ -972,7 +972,7 @@ Scene_polygon_soup_item_priv::compute_stats() Polygon_soup::Point_3 a(soup->points[poly[i]]), b(soup->points[poly[(i+1)%poly.size()]]), c(soup->points[poly[(i+2)%poly.size()]]); - if (a == b) + if (a == b) ++nb_null_edges; edges_acc(CGAL::sqrt(CGAL::squared_distance(a, b))); typename Traits::Vector_3 ba(b, a); @@ -992,6 +992,6 @@ Scene_polygon_soup_item_priv::compute_stats() mini = extract_result< tag::min >(angles_acc); maxi = extract_result< tag::max >(angles_acc); ave = extract_result< tag::mean >(angles_acc); - + stats_computed = true; } diff --git a/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.cpp b/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.cpp index 342349af861..faae911f852 100644 --- a/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.cpp @@ -62,10 +62,10 @@ public: :undo_(std::forward (undo)), item(item) {} - + void undo() override { - undo_(); + undo_(); item->compute_normal_maps(); item->polyhedron_item()->invalidateOpenGLBuffers(); item->invalidateOpenGLBuffers(); @@ -80,16 +80,16 @@ struct Scene_polyhedron_selection_item_priv{ typedef Scene_facegraph_item_k_ring_selection::Active_handle Active_handle; typedef boost::unordered_set Selection_set_vertex; - typedef boost::unordered_set Selection_set_facet; - typedef boost::unordered_set Selection_set_edge; struct vertex_on_path { fg_vertex_descriptor vertex; bool is_constrained; }; - + Scene_polyhedron_selection_item_priv(Scene_polyhedron_selection_item* parent): item(parent) @@ -105,7 +105,7 @@ struct Scene_polyhedron_selection_item_priv{ void compute_any_elements(std::vector &p_facets, std::vector &p_lines, std::vector &p_points, std::vector &p_normals, - const Selection_set_vertex& p_sel_vertex, + const Selection_set_vertex& p_sel_vertex, const Selection_set_facet &p_sel_facet, const Selection_set_edge &p_sel_edges) const; void compute_temp_elements() const; @@ -151,7 +151,7 @@ struct Scene_polyhedron_selection_item_priv{ const Face_graph* polyhedron()const { return poly; } bool canAddFace(fg_halfedge_descriptor hc, Scene_polyhedron_selection_item::fg_halfedge_descriptor t); - bool canAddFaceAndVertex(Scene_polyhedron_selection_item::fg_halfedge_descriptor hc, + bool canAddFaceAndVertex(Scene_polyhedron_selection_item::fg_halfedge_descriptor hc, Scene_polyhedron_selection_item::fg_halfedge_descriptor t); mutable std::vector positions_facets; @@ -213,7 +213,7 @@ void Scene_polyhedron_selection_item_priv::initializeBuffers(CGAL::Three::Viewer item->getEdgeContainer(Edges)->setFlatDataSize(nb_lines); item->getPointContainer(Points)->initializeBuffers(viewer); item->getPointContainer(Points)->setFlatDataSize(nb_points); - + positions_facets.resize(0); positions_facets.shrink_to_fit(); @@ -247,7 +247,7 @@ void Scene_polyhedron_selection_item_priv::initialize_temp_buffers(CGAL::Three:: std::vector(positions_temp_points).swap(positions_temp_points); positions_fixed_points.resize(0); std::vector(positions_fixed_points).swap(positions_fixed_points); - + } void Scene_polyhedron_selection_item_priv::initialize_HL_buffers(CGAL::Three::Viewer_interface *viewer)const @@ -271,9 +271,9 @@ void push_back_xyz(const TypeWithXYZ& t, typedef EPICK Traits; //Make sure all the facets are triangles -typedef Traits::Point_3 Point_3; -typedef Traits::Point_3 Point; -typedef Traits::Vector_3 Vector; +typedef Traits::Point_3 Point_3; +typedef Traits::Point_3 Point; +typedef Traits::Vector_3 Vector; void Scene_polyhedron_selection_item_priv::triangulate_facet(fg_face_descriptor fit,const Vector normal, @@ -281,7 +281,7 @@ Scene_polyhedron_selection_item_priv::triangulate_facet(fg_face_descriptor fit,c { const CGAL::qglviewer::Vec off = Three::mainViewer()->offset(); EPICK::Vector_3 offset(off.x,off.y,off.z); - + typedef FacetTriangulator FT; FT triangulation(fit,normal,poly, offset); //iterates on the internal faces to add the vertices to the positions @@ -425,27 +425,27 @@ void Scene_polyhedron_selection_item_priv::computeElements()const QApplication::setOverrideCursor(Qt::WaitCursor); compute_any_elements(positions_facets, positions_lines, positions_points, normals, item->selected_vertices, item->selected_facets, item->selected_edges); - + item->getTriangleContainer(Facets)->allocate( Tc::Flat_vertices, positions_facets.data(), static_cast(positions_facets.size()*sizeof(float))); - + item->getTriangleContainer(Facets)->allocate( Tc::Flat_normals, normals.data(), static_cast(normals.size()*sizeof(float))); - + item->getPointContainer(Points)->allocate( Pc::Vertices, positions_points.data(), static_cast(positions_points.size()*sizeof(float))); - + item->getEdgeContainer(Edges)->allocate( Ec::Vertices, positions_lines.data(), static_cast(positions_lines.size()*sizeof(float))); - + nb_facets = positions_facets.size(); nb_lines = positions_lines.size(); nb_points = positions_points.size(); @@ -490,7 +490,7 @@ void Scene_polyhedron_selection_item_priv::compute_temp_elements()const i++; } } - + item->getTriangleContainer(Temp_facets)->allocate( Tc::Flat_vertices, positions_temp_facets.data(), @@ -499,7 +499,7 @@ void Scene_polyhedron_selection_item_priv::compute_temp_elements()const Tc::Flat_normals, temp_normals.data(), static_cast(temp_normals.size()*sizeof(float))); - + item->getEdgeContainer(Temp_edges)->allocate( Ec::Vertices, positions_temp_lines.data(), @@ -508,7 +508,7 @@ void Scene_polyhedron_selection_item_priv::compute_temp_elements()const Pc::Vertices, positions_temp_points.data(), static_cast(positions_temp_points.size()*sizeof(float))); - + item->getPointContainer(Fixed_points)->allocate( Pc::Vertices, positions_fixed_points.data(), @@ -518,7 +518,7 @@ item->getPointContainer(Fixed_points)->allocate( Pc::Colors, color_fixed_points.data(), static_cast(color_fixed_points.size()*sizeof(float))); - + nb_temp_facets = positions_temp_facets.size(); nb_temp_lines = positions_temp_lines.size(); nb_temp_points = positions_temp_points.size(); @@ -539,17 +539,17 @@ void Scene_polyhedron_selection_item_priv::compute_HL_elements()const Tc::Flat_normals, HL_normals.data(), static_cast(HL_normals.size()*sizeof(float))); - + item->getEdgeContainer(HL_edges)->allocate( Ec::Vertices, positions_HL_lines.data(), static_cast(positions_HL_lines.size()*sizeof(float))); - + item->getPointContainer(HL_points)->allocate( Pc::Vertices, positions_HL_points.data(), static_cast(positions_HL_points.size()*sizeof(float))); - + QApplication::restoreOverrideCursor(); } @@ -570,20 +570,20 @@ void Scene_polyhedron_selection_item::draw(CGAL::Three::Viewer_interface* viewer computeElements(); initializeBuffers(viewer); } - + viewer->glGetFloatv(GL_POLYGON_OFFSET_FACTOR, &offset_factor); viewer->glGetFloatv(GL_POLYGON_OFFSET_UNITS, &offset_units); viewer->glPolygonOffset(0.9f, 0.9f); - + getTriangleContainer(Priv::HL_facets)->setColor(QColor(255,153,51)); getTriangleContainer(Priv::HL_facets)->draw(viewer, true); - + getTriangleContainer(Priv::Temp_facets)->setColor(QColor(0,255,0)); getTriangleContainer(Priv::Temp_facets)->draw(viewer, true); - + getTriangleContainer(Priv::Facets)->setColor(this->color()); getTriangleContainer(Priv::Facets)->draw(viewer, true); - + viewer->glEnable(GL_POLYGON_OFFSET_LINE); viewer->glPolygonOffset(0.3f, 0.3f); drawEdges(viewer); @@ -594,7 +594,7 @@ void Scene_polyhedron_selection_item::draw(CGAL::Three::Viewer_interface* viewer void Scene_polyhedron_selection_item::drawEdges(CGAL::Three::Viewer_interface* viewer) const { - + if(!isInit(viewer)) initGL(viewer); if ( getBuffersFilled() && @@ -608,15 +608,15 @@ void Scene_polyhedron_selection_item::drawEdges(CGAL::Three::Viewer_interface* v computeElements(); initializeBuffers(viewer); } - + QVector2D vp(viewer->width(), viewer->height()); if(viewer->isOpenGL_4_3()) { - + getEdgeContainer(Priv::HL_edges)->setViewport(vp); getEdgeContainer(Priv::HL_edges)->setWidth(3.0f); } - + getEdgeContainer(Priv::HL_edges)->setColor(QColor(255,153,51)); getEdgeContainer(Priv::HL_edges)->draw(viewer, true); if(viewer->isOpenGL_4_3()) @@ -624,7 +624,7 @@ void Scene_polyhedron_selection_item::drawEdges(CGAL::Three::Viewer_interface* v getEdgeContainer(Priv::Temp_edges)->setViewport(vp); getEdgeContainer(Priv::Temp_edges)->setWidth(3.0f); } - + getEdgeContainer(Priv::Temp_edges)->setColor(QColor(0,200,0)); getEdgeContainer(Priv::Temp_edges)->draw(viewer, true); if(viewer->isOpenGL_4_3()) @@ -640,9 +640,9 @@ void Scene_polyhedron_selection_item::drawEdges(CGAL::Three::Viewer_interface* v void Scene_polyhedron_selection_item::drawPoints(CGAL::Three::Viewer_interface* viewer) const { - + viewer->setGlPointSize(5.0f); - + if(!d->are_HL_buffers_filled) { d->compute_HL_elements(); @@ -657,7 +657,7 @@ void Scene_polyhedron_selection_item::drawPoints(CGAL::Three::Viewer_interface* (std::min)(color().blue()+color().red(), 255), (std::min)(color().green()+color().red(), 255))); getPointContainer(Priv::Points)->draw(viewer, true); - + viewer->setGlPointSize(1.f); } @@ -989,11 +989,11 @@ bool Scene_polyhedron_selection_item::treat_selection(const std::setstack.clear(); d->stack.push(new EulerOperation( [new_h, p, mesh, vpm](){ - + halfedge_descriptor h = CGAL::Euler::add_center_vertex( new_h, *mesh); put(vpm, target(h,*mesh), p); - + }, this)); compute_normal_maps(); polyhedron_item()->invalidateOpenGLBuffers(); @@ -1095,7 +1095,7 @@ bool Scene_polyhedron_selection_item:: treat_selection(const std::setinvalidateOpenGLBuffers(); @@ -1172,8 +1172,8 @@ bool Scene_polyhedron_selection_item:: treat_selection(const std::setoriginal_sel_mode = static_cast(0); d->operation_mode = -1; - + d->nb_facets = 0; d->nb_points = 0; d->nb_lines = 0; @@ -1798,15 +1798,15 @@ void Scene_polyhedron_selection_item::common_constructor() d->ready_to_move = false; do_process = true; setProperty("no_picking", true); - - setPointContainer(3, + + setPointContainer(3, new Pc(Vi::PROGRAM_NO_SELECTION, false)); for(int i=2; i>=0; --i) { setTriangleContainer(i, new Tc(Vi::PROGRAM_WITH_LIGHT, false)); setEdgeContainer(i, - new Ec(Three::mainViewer()->isOpenGL_4_3() + new Ec(Three::mainViewer()->isOpenGL_4_3() ? Vi::PROGRAM_SOLID_WIREFRAME : Vi::PROGRAM_NO_SELECTION, false)); @@ -1830,7 +1830,7 @@ Scene_polyhedron_selection_item::Scene_polyhedron_selection_item(Scene_face_grap sf.remove(rx); if(!sf.isEmpty()) setProperty("defaultSaveDir", sf); - + init(poly_item, mw); invalidateOpenGLBuffers(); compute_normal_maps(); @@ -1876,14 +1876,14 @@ void Scene_polyhedron_selection_item::invalidateOpenGLBuffers() { setBuffersFilled(false); getTriangleContainer(Priv::Facets)->reset_vbos(ALL); getTriangleContainer(Priv::Temp_facets)->reset_vbos(ALL); - + getEdgeContainer(Priv::Edges)->reset_vbos(ALL); getEdgeContainer(Priv::Temp_edges)->reset_vbos(ALL); - + getPointContainer(Priv::Points)->reset_vbos(ALL); getPointContainer(Priv::Temp_points)->reset_vbos(ALL); getPointContainer(Priv::Fixed_points)->reset_vbos(ALL); - + Q_FOREACH(CGAL::QGLViewer* v, CGAL::QGLViewer::QGLViewerPool()) { CGAL::Three::Viewer_interface* viewer = @@ -2282,7 +2282,7 @@ void Scene_polyhedron_selection_item::select_boundary() redraw(); } -QString +QString Scene_polyhedron_selection_item::toolTip() const { if(!poly_item || !poly_item->polyhedron()) @@ -2394,7 +2394,7 @@ QString Scene_polyhedron_selection_item::computeStats(int type) faces_aspect_ratio(d->poly, selected_facets,min_altitude, min_ar, max_ar, mean_ar); } } - + switch(type) { case NB_VERTICES: @@ -2420,7 +2420,7 @@ QString Scene_polyhedron_selection_item::computeStats(int type) } case NB_FACETS: return QString::number(selected_facets.size()); - + case NB_CONNECTED_COMPOS: { // Extract the part n°0 of the partition into a new, independent mesh @@ -2429,10 +2429,10 @@ QString Scene_polyhedron_selection_item::computeStats(int type) boost::vector_property_map::type> fccmap(get(boost::face_index, *d->filtered_graph)); - + return QString::number(CGAL::Polygon_mesh_processing::connected_components(*d->filtered_graph, fccmap)); } - + case NB_BORDER_EDGES: { int i=0; @@ -2444,7 +2444,7 @@ QString Scene_polyhedron_selection_item::computeStats(int type) } return QString::number(i); } - + case NB_EDGES:{ std::set total_edges; for(auto e : selected_edges) @@ -2460,11 +2460,11 @@ QString Scene_polyhedron_selection_item::computeStats(int type) } return QString::number(total_edges.size()); } - + case VOLUME: return QString("n/a"); break; - + case GENUS: return QString("n/a"); break; @@ -2490,13 +2490,13 @@ QString Scene_polyhedron_selection_item::computeStats(int type) else return QString("n/a"); } - + case SELFINTER: { if(selected_facets.size() == 0) return QString("n/a"); if(is_triangle_mesh(*d->poly)){ - bool self_intersect + bool self_intersect = CGAL::Polygon_mesh_processing::does_self_intersect(*(d->poly)); if (self_intersect) return QString("Yes"); @@ -2515,7 +2515,7 @@ QString Scene_polyhedron_selection_item::computeStats(int type) return QString::number(meanl); case NB_NULL_LENGTH: return QString::number(number_of_null_length_edges); - + case MIN_ANGLE: return QString::number(mini); case MAX_ANGLE: @@ -2526,7 +2526,7 @@ QString Scene_polyhedron_selection_item::computeStats(int type) { return QString("n/a"); } - + case MIN_AREA: return QString::number(min_area); case MAX_AREA: @@ -2562,7 +2562,7 @@ QString Scene_polyhedron_selection_item::computeStats(int type) else return QString("no"); } - + }//end switch return QString(); } diff --git a/Polyhedron/demo/Polyhedron/Scene_polylines_item.cpp b/Polyhedron/demo/Polyhedron/Scene_polylines_item.cpp index 8802aeec8e1..b6c191bfd18 100644 --- a/Polyhedron/demo/Polyhedron/Scene_polylines_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_polylines_item.cpp @@ -78,12 +78,12 @@ Scene_polylines_item_private::initializeBuffers(CGAL::Three::Viewer_interface *v lineWidth[1] = 10; } line_Slider->setMaximum(lineWidth[1]); - + item->getEdgeContainer(0)->initializeBuffers(viewer); item->getEdgeContainer(0)->setFlatDataSize(nb_lines); item->getPointContainer(0)->initializeBuffers(viewer); - item->getPointContainer(0)->setFlatDataSize(nb_lines); - + item->getPointContainer(0)->setFlatDataSize(nb_lines); + positions_lines.clear(); positions_lines.shrink_to_fit(); } @@ -105,9 +105,9 @@ Scene_polylines_item_private::computeElements() const if(it->empty()) continue; if(it->front() == it->back()) nb_vertices += it->size() - 1; - else + else nb_vertices += it->size(); - + for(size_t i = 0, end = it->size()-1; i < end; ++i) { @@ -144,14 +144,14 @@ Scene_polylines_item_private::computeElements() const if(!computed_stats) mean_length = mean/double(nb_edges); computed_stats = true; - + item->getEdgeContainer(0)->allocate( Ec::Vertices, positions_lines.data(), static_cast(positions_lines.size()*sizeof(float))); item->getPointContainer(0)->allocate( Pc::Vertices, positions_lines.data(), static_cast(positions_lines.size()*sizeof(float))); - + item->setBuffersFilled(true); nb_lines = positions_lines.size(); QApplication::restoreOverrideCursor(); @@ -270,20 +270,20 @@ Scene_polylines_item_private::computeSpheres() QApplication::restoreOverrideCursor(); } -Scene_polylines_item::Scene_polylines_item() +Scene_polylines_item::Scene_polylines_item() :CGAL::Three::Scene_group_item("unnamed") ,d(new Scene_polylines_item_private(this)) { setRenderingMode(FlatPlusEdges); d->nb_lines = 0; d->spheres = NULL; - setEdgeContainer(0, + setEdgeContainer(0, new Ec(Three::mainViewer()->isOpenGL_4_3() ? Vi::PROGRAM_SOLID_WIREFRAME : Vi::PROGRAM_NO_SELECTION , false)); - setPointContainer(0, + setPointContainer(0, new Pc(Vi::PROGRAM_NO_SELECTION, false)); - + } Scene_polylines_item::~Scene_polylines_item() @@ -334,7 +334,7 @@ Scene_item::Bbox Scene_polylines_item::bbox() const { return Scene_item_rendering_helper::bbox(); } -Scene_polylines_item* +Scene_polylines_item* Scene_polylines_item::clone() const { Scene_polylines_item* item = new Scene_polylines_item; item->polylines = polylines; @@ -406,11 +406,11 @@ Scene_polylines_item::draw(CGAL::Three::Viewer_interface* viewer) const { } // Wireframe OpenGL drawing -void +void Scene_polylines_item::drawEdges(CGAL::Three::Viewer_interface* viewer) const { if(!visible()) return; - + if(renderingMode() == Wireframe || renderingMode() == FlatPlusEdges) { @@ -430,7 +430,7 @@ Scene_polylines_item::drawEdges(CGAL::Three::Viewer_interface* viewer) const { if(viewer->isOpenGL_4_3()) { QVector2D vp(viewer->width(), viewer->height()); - + getEdgeContainer(0)->setViewport(vp); getEdgeContainer(0)->setWidth(GLfloat(d->line_Slider->value())); } @@ -443,7 +443,7 @@ Scene_polylines_item::drawEdges(CGAL::Three::Viewer_interface* viewer) const { } } -void +void Scene_polylines_item::drawPoints(CGAL::Three::Viewer_interface* viewer) const { if(!visible()) return; @@ -465,7 +465,7 @@ Scene_polylines_item::drawPoints(CGAL::Three::Viewer_interface* viewer) const { computeElements(); initializeBuffers(viewer); } - + getPointContainer(0)->setColor(this->color()); getPointContainer(0)->draw(viewer, true); viewer->setGlPointSize(point_size); @@ -476,7 +476,7 @@ Scene_polylines_item::drawPoints(CGAL::Three::Viewer_interface* viewer) const { } } -QMenu* Scene_polylines_item::contextMenu() +QMenu* Scene_polylines_item::contextMenu() { const char* prop_name = "Menu modified by Scene_polylines_item."; @@ -509,7 +509,7 @@ QMenu* Scene_polylines_item::contextMenu() menu->setProperty(prop_name, true); container->menuAction()->setProperty("is_groupable", true); - QAction* actionCreatePointSet = + QAction* actionCreatePointSet = menu->addAction(tr("Create Point Set from Polyline")); actionCreatePointSet->setObjectName("actionCreatePointSet"); connect(actionCreatePointSet, &QAction::triggered, @@ -574,7 +574,7 @@ void Scene_polylines_item::change_corner_radii(double r) { } d->spheres->invalidateOpenGLBuffers(); d->computeSpheres(); - + } else if(r>0 && d->spheres) { @@ -779,7 +779,7 @@ void Scene_polylines_item::computeElements() const void Scene_polylines_item::point_set_from_polyline() { - Scene_points_with_normal_item* new_ps_item + Scene_points_with_normal_item* new_ps_item = new Scene_points_with_normal_item(); for(auto it = polylines.begin(); it != polylines.end(); diff --git a/Polyhedron/demo/Polyhedron/Scene_spheres_item.cpp b/Polyhedron/demo/Polyhedron/Scene_spheres_item.cpp index c26dfd45bec..26f3ccfd620 100644 --- a/Polyhedron/demo/Polyhedron/Scene_spheres_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_spheres_item.cpp @@ -71,12 +71,12 @@ void Scene_spheres_item_priv::pick(int& id) const { if(!pickable) return; - + if(id >= static_cast(spheres.size())) { id = -1; } - + int offset = 0; float color[4]; for(std::size_t i=0; ihas_plane) { QVector4D cp(d->plane.a(),d->plane.b(),d->plane.c(),d->plane.d()); getEdgeContainer(0)->setPlane(cp); } getEdgeContainer(0)->draw(viewer, false); - + } void Scene_spheres_item::add_sphere(const Sphere &sphere, std::size_t index, CGAL::Color color) { @@ -259,7 +259,7 @@ void Scene_spheres_item::add_sphere(const Sphere &sphere, std::size_t index, CG float b = B/255.0; d->picking_colors.push_back(r); d->picking_colors.push_back(g); - d->picking_colors.push_back(b); + d->picking_colors.push_back(b); } d->edges_colors.push_back((float)color.red()/255); d->edges_colors.push_back((float)color.green()/255); @@ -322,16 +322,16 @@ void Scene_spheres_item::computeElements() const { getTriangleContainer(0)->allocate(Tc::Flat_vertices, d->vertices.data(), static_cast(d->vertices.size()*sizeof(float))); - + getTriangleContainer(0)->allocate(Tc::Flat_normals, d->normals.data(), static_cast(d->normals.size()*sizeof(float))); if(d->pickable) getTriangleContainer(1)->allocate(Tc::Flat_vertices, d->vertices.data(), static_cast(d->vertices.size()*sizeof(float))); - + d->nb_vertices = d->vertices.size(); - + } getTriangleContainer(0)->allocate(Tc::FColors, d->colors.data(), static_cast(d->colors.size()*sizeof(float))); @@ -354,22 +354,22 @@ void Scene_spheres_item::computeElements() const { getEdgeContainer(0)->allocate(Ec::Vertices, d->edges.data(), static_cast(d->edges.size()*sizeof(float))); - - getEdgeContainer(0)->allocate(Ec::Normals, d->normals.data(), + + getEdgeContainer(0)->allocate(Ec::Normals, d->normals.data(), static_cast(d->normals.size()*sizeof(float))); d->model_sphere_is_up = true; d->nb_edges = d->edges.size(); } getEdgeContainer(0)->allocate(Ec::Colors, d->edges_colors.data(), static_cast(d->edges_colors.size()*sizeof(float))); - + getEdgeContainer(0)->allocate(Ec::Radius, d->radius.data(), static_cast(d->radius.size()*sizeof(float))); - + getEdgeContainer(0)->allocate(Ec::Centers, d->centers.data(), static_cast(d->centers.size()*sizeof(float))); d->nb_centers = d->centers.size(); - + } void Scene_spheres_item::gl_initialization(Vi* viewer) diff --git a/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.cpp b/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.cpp index 65ecb788392..19e7013495b 100644 --- a/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.cpp @@ -152,7 +152,7 @@ struct Scene_surface_mesh_item_priv{ true)); item->setPointContainer(0, new Point_container(VI::PROGRAM_WITHOUT_LIGHT, false)); - + has_feature_edges = false; invalidate_stats(); vertices_displayed = false; @@ -194,7 +194,7 @@ struct Scene_surface_mesh_item_priv{ void* get_aabb_tree(); QList triangulate_primitive(face_descriptor fit, EPICK::Vector_3 normal); - + //! \brief triangulate_facet Triangulates a facet. //! \param fd a face_descriptor of the facet that needs to be triangulated. //! \param fnormals a property_map containing the normals of the mesh. @@ -311,7 +311,7 @@ void Scene_surface_mesh_item::standard_constructor(SMesh* sm) d->textFItems = new TextListItem(this); are_buffers_filled = false; invalidate(ALL); - + } Scene_surface_mesh_item::Scene_surface_mesh_item(SMesh* sm) { @@ -394,39 +394,39 @@ void Scene_surface_mesh_item_priv::compute_elements(Scene_item_rendering_helper: v_colors.clear(); idx_data_.clear(); idx_data_.shrink_to_fit(); - + SMesh::Property_map vnormals = smesh_->add_property_map("v:normal").first; - + SMesh::Property_map fnormals = smesh_->add_property_map("f:normal").first; CGAL::Polygon_mesh_processing::compute_face_normals(*smesh_,fnormals); - + typedef boost::graph_traits::face_descriptor face_descriptor; CGAL::Polygon_mesh_processing::compute_vertex_normals(*smesh_,vnormals); - + const CGAL::qglviewer::Vec o = static_cast(CGAL::QGLViewer::QGLViewerPool().first())->offset(); EPICK::Vector_3 offset(o.x, o.y, o.z); - + SMesh::Property_map positions = smesh_->points(); - + SMesh::Property_map vcolors = smesh_->property_map("v:color").first; - + SMesh::Property_map fcolors = smesh_->property_map("f:color").first; - + boost::property_map< SMesh, boost::vertex_index_t >::type im = get(boost::vertex_index, *smesh_); - + idx_data_.reserve(num_faces(*smesh_) * 3); - + typedef CGAL::Buffer_for_vao CPF; typedef boost::graph_traits::face_descriptor face_descriptor; typedef boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef boost::graph_traits::edge_descriptor edge_descriptor; - + if(name.testFlag(Scene_item_rendering_helper::GEOMETRY)) { for(face_descriptor fd : faces(*smesh_)) @@ -446,7 +446,7 @@ void Scene_surface_mesh_item_priv::compute_elements(Scene_item_rendering_helper: facet_points.push_back(positions[target(hd, *smesh_)]); } bool is_convex = CPF::is_facet_convex(facet_points, fnormals[fd]); - + if(is_convex && is_quad(halfedge(fd,*smesh_),*smesh_) ) { halfedge_descriptor hd = halfedge(fd,*smesh_); @@ -454,12 +454,12 @@ void Scene_surface_mesh_item_priv::compute_elements(Scene_item_rendering_helper: idx_data_.push_back(source(hd, *smesh_)); idx_data_.push_back(source(next(hd, *smesh_), *smesh_)); idx_data_.push_back(source(next(next(hd, *smesh_), *smesh_), *smesh_)); - + //2nd half idx_data_.push_back(source(hd, *smesh_)); idx_data_.push_back(source(next(next(hd, *smesh_), *smesh_), *smesh_)); idx_data_.push_back(source(prev(hd, *smesh_), *smesh_)); - } + } else if(is_convex) { triangulate_convex_facet(fd, &fnormals, 0, &im, name, true); @@ -471,10 +471,10 @@ void Scene_surface_mesh_item_priv::compute_elements(Scene_item_rendering_helper: } } } - + if(name.testFlag(Scene_item_rendering_helper::COLORS)) { - + has_fpatch_id = smesh_->property_map("f:patch_id").second; has_fcolors = smesh_->property_map("f:color").second; has_vcolors = smesh_->property_map("v:color").second; @@ -497,19 +497,19 @@ void Scene_surface_mesh_item_priv::compute_elements(Scene_item_rendering_helper: } idx_edge_data_.shrink_to_fit(); } - + if(name.testFlag(Scene_item_rendering_helper::COLORS) && has_fpatch_id){ initialize_colors(); } - - + + //compute the Flat data - + flat_vertices.clear(); flat_normals.clear(); f_colors.clear(); - + for(face_descriptor fd : faces(*smesh_)) { if(is_triangle(halfedge(fd,*smesh_),*smesh_)) @@ -532,7 +532,7 @@ void Scene_surface_mesh_item_priv::compute_elements(Scene_item_rendering_helper: { //The sharp features detection produces patch ids >=1, this //is meant to insure the wanted id is in the range [min,max] - QColor c = item->color_vector()[fpatch_id_map[fd] - min_patch_id]; + QColor c = item->color_vector()[fpatch_id_map[fd] - min_patch_id]; CGAL::Color color(c.red(),c.green(),c.blue()); CPF::add_color_in_buffer(color, f_colors); } @@ -561,7 +561,7 @@ void Scene_surface_mesh_item_priv::compute_elements(Scene_item_rendering_helper: CGAL::Color *c; if(has_fpatch_id) { - QColor color = item->color_vector()[fpatch_id_map[fd] - min_patch_id]; + QColor color = item->color_vector()[fpatch_id_map[fd] - min_patch_id]; c = new CGAL::Color(color.red(),color.green(),color.blue()); } else if(has_fcolors) @@ -569,13 +569,13 @@ void Scene_surface_mesh_item_priv::compute_elements(Scene_item_rendering_helper: else c = 0; addFlatData(p,n,c, name); - + hd = next(halfedge(fd, *smesh_),*smesh_); addFlatData(positions[source(hd, *smesh_)] ,fnormals[fd] ,c ,name); - + hd = next(next(halfedge(fd, *smesh_),*smesh_), *smesh_); addFlatData(positions[source(hd, *smesh_)] ,fnormals[fd] @@ -587,13 +587,13 @@ void Scene_surface_mesh_item_priv::compute_elements(Scene_item_rendering_helper: ,fnormals[fd] ,c ,name); - + hd = next(next(halfedge(fd, *smesh_),*smesh_), *smesh_); addFlatData(positions[source(hd, *smesh_)] ,fnormals[fd] ,c ,name); - + hd = prev(halfedge(fd, *smesh_), *smesh_); addFlatData(positions[source(hd, *smesh_)] ,fnormals[fd] @@ -612,7 +612,7 @@ void Scene_surface_mesh_item_priv::compute_elements(Scene_item_rendering_helper: } } } - + if(has_vcolors && name.testFlag(Scene_item_rendering_helper::COLORS)) { for(vertex_descriptor vd : vertices(*smesh_)) @@ -623,7 +623,7 @@ void Scene_surface_mesh_item_priv::compute_elements(Scene_item_rendering_helper: v_colors.push_back((float)c.blue()/255); } } - + if(floated && (name.testFlag(Scene_item_rendering_helper::GEOMETRY)|| name.testFlag(Scene_item_rendering_helper::NORMALS))) { @@ -647,7 +647,7 @@ void Scene_surface_mesh_item_priv::compute_elements(Scene_item_rendering_helper: idx_feature_edge_data_size = idx_feature_edge_data_.size(); idx_data_size = idx_data_.size(); flat_vertices_size = flat_vertices.size(); - + item->getPointContainer(0)->allocate(Pt::Vertices, smooth_vertices.data(), static_cast(num_vertices(*smesh_)*3*sizeof(cgal_gl_data))); item->getEdgeContainer(0)->allocate(Ed::Indices, idx_edge_data_.data(), @@ -689,7 +689,7 @@ void Scene_surface_mesh_item_priv::compute_elements(Scene_item_rendering_helper: else item->getTriangleContainer(0)->allocate(Tri::VColors, 0, 0); } - + QApplication::restoreOverrideCursor(); } @@ -720,7 +720,7 @@ void Scene_surface_mesh_item_priv::initializeBuffers(CGAL::Three::Viewer_interfa item->getEdgeContainer(1)->initializeBuffers(viewer); item->getEdgeContainer(0)->initializeBuffers(viewer); item->getPointContainer(0)->initializeBuffers(viewer); - + ////Clean-up item->getPointContainer(0)->setFlatDataSize(vertices(*smesh_).size()*3); item->getTriangleContainer(1)->setFlatDataSize(flat_vertices_size); @@ -758,8 +758,8 @@ void Scene_surface_mesh_item::draw(CGAL::Three::Viewer_interface *viewer) const d->initializeBuffers(viewer); setBuffersInit(viewer, true); } - - + + if(renderingMode() == Gouraud || renderingMode() == GouraudPlusEdges) { @@ -873,7 +873,7 @@ void Scene_surface_mesh_item_priv::triangulate_convex_facet(face_descriptor fd, Point p0,p1,p2; SMesh::Halfedge_around_face_circulator he(halfedge(fd, *smesh_), *smesh_); SMesh::Halfedge_around_face_circulator he_end = he; - + while(next(*he, *smesh_) != prev(*he_end, *smesh_)) { ++he; @@ -888,7 +888,7 @@ void Scene_surface_mesh_item_priv::triangulate_convex_facet(face_descriptor fd, CGAL::Color* color; if(has_fpatch_id) { - QColor c = item->color_vector()[fpatch_id_map[fd] - min_patch_id]; + QColor c = item->color_vector()[fpatch_id_map[fd] - min_patch_id]; color = new CGAL::Color(c.red(),c.green(),c.blue()); } else if(has_fcolors) @@ -903,7 +903,7 @@ void Scene_surface_mesh_item_priv::triangulate_convex_facet(face_descriptor fd, (*fnormals)[fd], color, name); - + addFlatData(p2, (*fnormals)[fd], color, @@ -927,7 +927,7 @@ Scene_surface_mesh_item_priv::triangulate_facet(face_descriptor fd, Scene_item_rendering_helper::Gl_data_names name, bool index) const { - + //Computes the normal of the facet EPICK::Vector_3 normal = get(*fnormals, fd); if(normal == CGAL::NULL_VECTOR) @@ -947,7 +947,7 @@ Scene_surface_mesh_item_priv::triangulate_facet(face_descriptor fd, } next_ =next(next_, *smesh_); }while(next_ != start); - + if (normal == CGAL::NULL_VECTOR) // No normal could be computed, return { qDebug()<<"Warning : normal is not valid. Facet not displayed"; @@ -960,7 +960,7 @@ Scene_surface_mesh_item_priv::triangulate_facet(face_descriptor fd, qDebug()<<"Warning : normal is not valid. Facet not displayed"; return; } - + typedef FacetTriangulator::vertex_descriptor> FT; const CGAL::qglviewer::Vec off = static_cast(CGAL::QGLViewer::QGLViewerPool().first())->offset(); EPICK::Vector_3 offset(off.x,off.y,off.z); @@ -980,14 +980,14 @@ Scene_surface_mesh_item_priv::triangulate_facet(face_descriptor fd, CGAL::Color* color; if(has_fpatch_id) { - QColor c= item->color_vector()[fpatch_id_map[fd] - min_patch_id]; + QColor c= item->color_vector()[fpatch_id_map[fd] - min_patch_id]; color = new CGAL::Color(c.red(),c.green(),c.blue()); } else if(has_fcolors) color = &(*fcolors)[fd]; else color = 0; - + addFlatData(ffit->vertex(0)->point()-offset, (*fnormals)[fd], color, @@ -996,7 +996,7 @@ Scene_surface_mesh_item_priv::triangulate_facet(face_descriptor fd, (*fnormals)[fd], color, name); - + addFlatData(ffit->vertex(2)->point()-offset, (*fnormals)[fd], color, @@ -1014,7 +1014,7 @@ Scene_surface_mesh_item_priv::triangulate_facet(face_descriptor fd, idx_data_.push_back((*im)[triangulation.v2v[ffit->vertex(2)]]); } } - + } } void delete_aabb_tree(Scene_surface_mesh_item* item) @@ -1117,7 +1117,7 @@ void* Scene_surface_mesh_item_priv::get_aabb_tree() for(face_descriptor f : faces(*sm)) { //if face is degenerate, skip it - if (CGAL::is_triangle(halfedge(f, *sm), *sm) + if (CGAL::is_triangle(halfedge(f, *sm), *sm) && CGAL::Polygon_mesh_processing::is_degenerate_triangle_face(f, *sm)) continue; //if face not triangle, triangulate corresponding primitive before adding it to the tree @@ -1292,7 +1292,7 @@ void Scene_surface_mesh_item::invalidate(Gl_data_names name) setBuffersInit(viewer, false); viewer->update(); } - + getTriangleContainer(1)->reset_vbos(name); getTriangleContainer(0)->reset_vbos(name); getEdgeContainer(1)->reset_vbos(name); @@ -1799,7 +1799,7 @@ void Scene_surface_mesh_item::zoomToPosition(const QPoint &point, CGAL::Three::V bool found = false; CGAL::qglviewer::Vec point_under = viewer->camera()->pointUnderPixel(point,found); EPICK::Point_3 ray_origin; - CGAL::qglviewer::Vec dir; + CGAL::qglviewer::Vec dir; if(viewer->camera()->type() == CGAL::qglviewer::Camera::PERSPECTIVE) { ray_origin = EPICK::Point_3(viewer->camera()->position().x - offset.x, @@ -1810,7 +1810,7 @@ void Scene_surface_mesh_item::zoomToPosition(const QPoint &point, CGAL::Three::V else { dir = viewer->camera()->viewDirection(); - ray_origin = EPICK::Point_3(point_under.x - dir.x, + ray_origin = EPICK::Point_3(point_under.x - dir.x, point_under.y - dir.y, point_under.z - dir.z); } @@ -1985,8 +1985,8 @@ QMenu* Scene_surface_mesh_item::contextMenu() actionZoomToId->setObjectName("actionZoomToId"); connect(actionZoomToId, &QAction::triggered, this, &Scene_surface_mesh_item::zoomToId); - - + + setProperty("menu_changed", true); menu->setProperty(prop_name, true); } @@ -2112,7 +2112,7 @@ bool Scene_surface_mesh_item::testDisplayId(double x, double y, double z, CGAL:: EPICK::Point_3 src(x - offset.x, y - offset.y, z - offset.z); - + CGAL::qglviewer::Camera* cam = viewer->camera(); EPICK::Point_3 dest( cam->position().x - offset.x, cam->position().y - offset.y, @@ -2302,7 +2302,7 @@ void Scene_surface_mesh_item::computeElements()const const_cast(this)->itemChanged(); } -void +void Scene_surface_mesh_item::initializeBuffers(CGAL::Three::Viewer_interface* viewer)const { const_cast(this)->//temporary, until the drawing pipeline is not const anymore. diff --git a/Polyhedron/demo/Polyhedron/Use_ssh.cpp b/Polyhedron/demo/Polyhedron/Use_ssh.cpp index e78be078c19..8acc1801b8e 100644 --- a/Polyhedron/demo/Polyhedron/Use_ssh.cpp +++ b/Polyhedron/demo/Polyhedron/Use_ssh.cpp @@ -5,7 +5,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Maxime Gimeno @@ -75,7 +75,7 @@ bool establish_ssh_session(ssh_session &session, ssh_options_set( session, SSH_OPTIONS_PORT, &port ); ssh_options_set( session, SSH_OPTIONS_USER, user ); ssh_options_set( session, SSH_OPTIONS_HOST, server); - + ssh_connect(session); #if LIBSSH_VERSION_MAJOR <1 && LIBSSH_VERSION_MINOR < 8 if( ssh_is_server_known(session) != SSH_SERVER_KNOWN_OK ) @@ -112,7 +112,7 @@ bool establish_ssh_session(ssh_session &session, else break; } - + if(!test_result(res)) { ssh_disconnect(session); diff --git a/Polyhedron/demo/Polyhedron/Viewer.cpp b/Polyhedron/demo/Polyhedron/Viewer.cpp index ec6f374323c..dbb3e5855e0 100644 --- a/Polyhedron/demo/Polyhedron/Viewer.cpp +++ b/Polyhedron/demo/Polyhedron/Viewer.cpp @@ -60,7 +60,7 @@ public: //Back and Front Colors QColor front_color; QColor back_color; - + // M e s s a g e s QString message; bool _displayMessage; @@ -130,7 +130,7 @@ class LightingDialog : public Ui::LightingDialog { Q_OBJECT -public: +public: QColor ambient, diffuse, specular; LightingDialog(Viewer_impl* d) { @@ -138,35 +138,35 @@ public: position_lineEdit->setText(QString("%1,%2,%3") .arg(d->position.x()) .arg(d->position.y()) - .arg(d->position.z())); + .arg(d->position.z())); QPalette palette; - ambient=QColor(255*d->ambient.x(), - 255*d->ambient.y(), + ambient=QColor(255*d->ambient.x(), + 255*d->ambient.y(), 255*d->ambient.z()); palette.setColor(QPalette::Button,ambient); ambientButton->setPalette(palette); ambientButton->setStyle(QStyleFactory::create("Fusion")); - - diffuse=QColor(255*d->diffuse.x(), - 255*d->diffuse.y(), + + diffuse=QColor(255*d->diffuse.x(), + 255*d->diffuse.y(), 255*d->diffuse.z()); palette.setColor(QPalette::Button,diffuse); diffuseButton->setPalette(palette); diffuseButton->setStyle(QStyleFactory::create("Fusion")); - - specular=QColor(255*d->specular.x(), - 255*d->specular.y(), + + specular=QColor(255*d->specular.x(), + 255*d->specular.y(), 255*d->specular.z()); palette.setColor(QPalette::Button,specular); specularButton->setPalette(palette); specularButton->setStyle(QStyleFactory::create("Fusion")); spec_powrSlider->setValue(static_cast(d->spec_power)); - + connect(&ambient_dial, &QColorDialog::currentColorChanged, this, &LightingDialog::ambient_changed ); connect(&diffuse_dial, &QColorDialog::currentColorChanged, this, &LightingDialog::diffuse_changed ); connect(&spec_dial, &QColorDialog::currentColorChanged, this, &LightingDialog::specular_changed); - - connect(ambientButton, &QPushButton::clicked, + + connect(ambientButton, &QPushButton::clicked, [this](){ ambient_dial.setCurrentColor(ambient); ambient_dial.exec(); @@ -175,7 +175,7 @@ public: palette.setColor(QPalette::Button, ambient); ambientButton->setPalette(palette); }); - connect(diffuseButton, &QPushButton::clicked, + connect(diffuseButton, &QPushButton::clicked, [this](){ diffuse_dial.setCurrentColor(diffuse); diffuse_dial.exec(); @@ -184,7 +184,7 @@ public: palette.setColor(QPalette::Button, diffuse); diffuseButton->setPalette(palette); }); - connect(specularButton, &QPushButton::clicked, + connect(specularButton, &QPushButton::clicked, [this](){ spec_dial.setCurrentColor(specular); spec_dial.exec(); @@ -193,7 +193,7 @@ public: palette.setColor(QPalette::Button, specular); specularButton->setPalette(palette); }); - + //D e f a u l t - S e t t i n g s connect(buttonBox->button(QDialogButtonBox::StandardButton::RestoreDefaults), &QPushButton::clicked, [this](){ @@ -215,12 +215,12 @@ private Q_SLOTS: void diffuse_changed() { diffuse = diffuse_dial.currentColor(); - s_diffuse_changed(); + s_diffuse_changed(); } void ambient_changed() { ambient = ambient_dial.currentColor(); - s_ambient_changed(); + s_ambient_changed(); } void specular_changed() { @@ -237,7 +237,7 @@ private: QColorDialog spec_dial; }; -std::vector Viewer_impl::shader_programs = +std::vector Viewer_impl::shader_programs = std::vector(Viewer::NB_OF_PROGRAMS); void Viewer::doBindings() { @@ -248,19 +248,19 @@ void Viewer::doBindings() cam_pos.split(",").at(1).toFloat(), cam_pos.split(",").at(2).toFloat(), 1.0f); - + QString ambient = viewer_settings.value("ambient", QString("0.4,0.4,0.4")).toString(); d->ambient = QVector4D(ambient.split(",").at(0).toFloat(), ambient.split(",").at(1).toFloat(), ambient.split(",").at(2).toFloat(), 1.0f); - + QString diffuse = viewer_settings.value("diffuse", QString("1.0,1.0,1.0")).toString(); d->diffuse = QVector4D(diffuse.split(",").at(0).toFloat(), diffuse.split(",").at(1).toFloat(), diffuse.split(",").at(2).toFloat(), 1.0f); - + QString specular = viewer_settings.value("specular", QString("0.0,0.0,0.0")).toString(); d->specular = QVector4D(specular.split(",").at(0).toFloat(), specular.split(",").at(1).toFloat(), @@ -292,7 +292,7 @@ void Viewer::doBindings() d->textRenderer = new TextRenderer(); d->is_2d_selection_mode = false; d->is_connected = false; - + connect( d->textRenderer, SIGNAL(sendMessage(QString,int)), this, SLOT(printMessage(QString,int)) ); connect(&d->messageTimer, SIGNAL(timeout()), SLOT(hideMessage())); @@ -425,7 +425,7 @@ void Viewer::setScene(CGAL::Three::Scene_draw_interface* scene) bool Viewer::antiAliasing() const { - return d->antialiasing; + return d->antialiasing; } void Viewer::setAntiAliasing(bool b) @@ -463,7 +463,7 @@ bool Viewer::inFastDrawing() const } void Viewer::draw() -{ +{ glEnable(GL_DEPTH_TEST); d->draw_aux(false, this); } @@ -517,7 +517,7 @@ void Viewer::init() setBackgroundColor(bc); d->vao.create(); d->buffer.create(); - + //setting the program used for the distance if(!is_linked) { @@ -612,7 +612,7 @@ void Viewer::mousePressEvent(QMouseEvent* event) { makeCurrent(); if(event->button() == Qt::RightButton && - event->modifiers().testFlag(Qt::ShiftModifier)) + event->modifiers().testFlag(Qt::ShiftModifier)) { select(event->pos()); requestContextMenu(event->globalPos()); @@ -644,7 +644,7 @@ void Viewer::mousePressEvent(QMouseEvent* event) } void Viewer::mouseDoubleClickEvent(QMouseEvent* event) { - makeCurrent(); + makeCurrent(); CGAL::QGLViewer::mouseDoubleClickEvent(event); } @@ -896,7 +896,7 @@ QString CGAL::Three::Viewer_interface::dumpFrame(const CGAL::qglviewer::Frame& f bool Viewer::moveCameraToCoordinates(QString s, float animation_duration) { CGAL::qglviewer::Frame new_frame; if(readFrame(s, new_frame)) { - camera()->interpolateTo(new_frame, animation_duration); + camera()->interpolateTo(new_frame, animation_duration); return true; } else @@ -930,7 +930,7 @@ void Viewer::attribBuffers(int program_name) const { this->camera()->getModelViewProjectionMatrix(d_mat); for (int i=0; i<16; ++i) mvp_mat.data()[i] = GLfloat(d_mat[i]); - + QOpenGLShaderProgram* program = getShaderProgram(program_name); program->bind(); program->setUniformValue("point_size", getGlPointSize()); @@ -963,20 +963,20 @@ void Viewer::attribBuffers(int program_name) const { case PROGRAM_NO_SELECTION: case PROGRAM_HEAT_INTENSITY: program->setUniformValue("alpha", 1.0f); //overriden in item draw() if necessary - default: + default: break; } switch(program_name) { case PROGRAM_SPHERES: case PROGRAM_DARK_SPHERES: - case PROGRAM_WITH_LIGHT: - case PROGRAM_OLD_FLAT: + case PROGRAM_WITH_LIGHT: + case PROGRAM_OLD_FLAT: program->setUniformValue("f_matrix",f_mat); - default: + default: break; } - + switch(program_name) { case PROGRAM_WITH_LIGHT: @@ -1075,7 +1075,7 @@ void Viewer::drawVisualHints() glEnable(GL_DEPTH_TEST); } else - { + { QOpenGLShaderProgram* program = getShaderProgram(PROGRAM_SOLID_WIREFRAME); program->bind(); QVector2D vp(width(), height()); @@ -1092,7 +1092,7 @@ void Viewer::drawVisualHints() glDrawArrays(GL_LINES, 0, static_cast(2)); d->vao.release(); program->release(); - + program = getShaderProgram(PROGRAM_NO_SELECTION); program->bind(); program->setAttributeValue("colors", QColor(Qt::black)); @@ -1130,7 +1130,7 @@ void Viewer::drawVisualHints() d->textRenderer->addText(message_text); } d->textRenderer->draw(this); - + if (d->_displayMessage) d->textRenderer->removeText(message_text); delete message_text; @@ -1196,9 +1196,9 @@ QOpenGLShaderProgram* Viewer::getShaderProgram(int name) const { case PROGRAM_C3T3: { - QOpenGLShaderProgram* program = isOpenGL_4_3() + QOpenGLShaderProgram* program = isOpenGL_4_3() ? declare_program(name, ":/cgal/Polyhedron_3/resources/shader_c3t3.vert" , ":/cgal/Polyhedron_3/resources/shader_c3t3.frag") - : declare_program(name, ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_c3t3.vert" , + : declare_program(name, ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_c3t3.vert" , ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_c3t3.frag"); program->setProperty("hasLight", true); program->setProperty("hasNormals", true); @@ -1210,9 +1210,9 @@ QOpenGLShaderProgram* Viewer::getShaderProgram(int name) const } case PROGRAM_C3T3_EDGES: { - QOpenGLShaderProgram* program = isOpenGL_4_3() + QOpenGLShaderProgram* program = isOpenGL_4_3() ? declare_program(name, ":/cgal/Polyhedron_3/resources/shader_c3t3_edges.vert" , ":/cgal/Polyhedron_3/resources/shader_c3t3_edges.frag") - : declare_program(name, ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_c3t3_edges.vert" , + : declare_program(name, ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_c3t3_edges.vert" , ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_c3t3_edges.frag"); program->setProperty("hasCutPlane", true); program->setProperty("hasSurfaceMode", true); @@ -1220,9 +1220,9 @@ QOpenGLShaderProgram* Viewer::getShaderProgram(int name) const } case PROGRAM_WITH_LIGHT: { - QOpenGLShaderProgram* program = isOpenGL_4_3() + QOpenGLShaderProgram* program = isOpenGL_4_3() ? declare_program(name, ":/cgal/Polyhedron_3/resources/shader_with_light.vert" , ":/cgal/Polyhedron_3/resources/shader_with_light.frag") - : declare_program(name, ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_with_light.vert" , + : declare_program(name, ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_with_light.vert" , ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_with_light.frag"); program->setProperty("hasLight", true); program->setProperty("hasNormals", true); @@ -1232,9 +1232,9 @@ QOpenGLShaderProgram* Viewer::getShaderProgram(int name) const } case PROGRAM_HEAT_INTENSITY: { - QOpenGLShaderProgram* program = isOpenGL_4_3() + QOpenGLShaderProgram* program = isOpenGL_4_3() ? declare_program(name, ":/cgal/Polyhedron_3/resources/heat_intensity_shader.vert" , ":/cgal/Polyhedron_3/resources/heat_intensity_shader.frag") - : declare_program(name, ":/cgal/Polyhedron_3/resources/compatibility_shaders/heat_intensity_shader.vert" , + : declare_program(name, ":/cgal/Polyhedron_3/resources/compatibility_shaders/heat_intensity_shader.vert" , ":/cgal/Polyhedron_3/resources/compatibility_shaders/heat_intensity_shader.frag"); program->setProperty("hasLight", true); program->setProperty("hasNormals", true); @@ -1244,18 +1244,18 @@ QOpenGLShaderProgram* Viewer::getShaderProgram(int name) const } case PROGRAM_WITHOUT_LIGHT: { - QOpenGLShaderProgram* program = isOpenGL_4_3() + QOpenGLShaderProgram* program = isOpenGL_4_3() ? declare_program(name, ":/cgal/Polyhedron_3/resources/shader_without_light.vert" , ":/cgal/Polyhedron_3/resources/shader_without_light.frag") - : declare_program(name, ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_without_light.vert" , + : declare_program(name, ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_without_light.vert" , ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_without_light.frag"); program->setProperty("hasFMatrix", true); return program; } case PROGRAM_NO_SELECTION: { - QOpenGLShaderProgram* program = isOpenGL_4_3() + QOpenGLShaderProgram* program = isOpenGL_4_3() ? declare_program(name, ":/cgal/Polyhedron_3/resources/shader_without_light.vert" , ":/cgal/Polyhedron_3/resources/shader_no_light_no_selection.frag") - : declare_program(name, ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_without_light.vert" , + : declare_program(name, ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_without_light.vert" , ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_no_light_no_selection.frag"); program->setProperty("hasFMatrix", true); program->setProperty("hasTransparency", true); @@ -1263,7 +1263,7 @@ QOpenGLShaderProgram* Viewer::getShaderProgram(int name) const } case PROGRAM_WITH_TEXTURE: { - QOpenGLShaderProgram* program = isOpenGL_4_3() + QOpenGLShaderProgram* program = isOpenGL_4_3() ? declare_program(name, ":/cgal/Polyhedron_3/resources/shader_with_texture.vert" , ":/cgal/Polyhedron_3/resources/shader_with_texture.frag") : declare_program(name, ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_with_texture.vert" , ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_with_texture.frag"); @@ -1275,7 +1275,7 @@ QOpenGLShaderProgram* Viewer::getShaderProgram(int name) const } case PROGRAM_PLANE_TWO_FACES: { - QOpenGLShaderProgram* program = isOpenGL_4_3() + QOpenGLShaderProgram* program = isOpenGL_4_3() ?declare_program(name, ":/cgal/Polyhedron_3/resources/shader_without_light.vert" , ":/cgal/Polyhedron_3/resources/shader_plane_two_faces.frag") : declare_program(name, ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_without_light.vert" , ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_plane_two_faces.frag"); @@ -1286,9 +1286,9 @@ QOpenGLShaderProgram* Viewer::getShaderProgram(int name) const } case PROGRAM_WITH_TEXTURED_EDGES: { - QOpenGLShaderProgram* program = isOpenGL_4_3() + QOpenGLShaderProgram* program = isOpenGL_4_3() ? declare_program(name, ":/cgal/Polyhedron_3/resources/shader_with_textured_edges.vert" , ":/cgal/Polyhedron_3/resources/shader_with_textured_edges.frag") - : declare_program(name, ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_with_textured_edges.vert" , + : declare_program(name, ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_with_textured_edges.vert" , ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_with_textured_edges.frag"); program->setProperty("hasFMatrix", true); program->setProperty("hasTexture", true); @@ -1296,11 +1296,11 @@ QOpenGLShaderProgram* Viewer::getShaderProgram(int name) const } case PROGRAM_INSTANCED: { - QOpenGLShaderProgram* program = isOpenGL_4_3() + QOpenGLShaderProgram* program = isOpenGL_4_3() ? declare_program(name, ":/cgal/Polyhedron_3/resources/shader_instanced.vert" , ":/cgal/Polyhedron_3/resources/shader_with_light.frag") : declare_program(name, ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_instanced.vert" , ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_with_light.frag"); - + program->setProperty("hasLight", true); program->setProperty("hasNormals", true); program->setProperty("isInstanced", true); @@ -1308,7 +1308,7 @@ QOpenGLShaderProgram* Viewer::getShaderProgram(int name) const } case PROGRAM_INSTANCED_WIRE: { - QOpenGLShaderProgram* program = isOpenGL_4_3() + QOpenGLShaderProgram* program = isOpenGL_4_3() ? declare_program(name, ":/cgal/Polyhedron_3/resources/shader_instanced.vert" , ":/cgal/Polyhedron_3/resources/shader_without_light.frag") : declare_program(name, ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_instanced.vert" , ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_without_light.frag"); @@ -1320,9 +1320,9 @@ QOpenGLShaderProgram* Viewer::getShaderProgram(int name) const } case PROGRAM_CUTPLANE_SPHERES: { - QOpenGLShaderProgram* program = isOpenGL_4_3() + QOpenGLShaderProgram* program = isOpenGL_4_3() ? declare_program(name, ":/cgal/Polyhedron_3/resources/shader_c3t3_spheres.vert" , ":/cgal/Polyhedron_3/resources/shader_c3t3.frag") - : declare_program(name, ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_c3t3_spheres.vert" , + : declare_program(name, ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_c3t3_spheres.vert" , ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_c3t3.frag"); program->setProperty("hasLight", true); program->setProperty("hasNormals", true); @@ -1334,7 +1334,7 @@ QOpenGLShaderProgram* Viewer::getShaderProgram(int name) const } case PROGRAM_SPHERES: { - QOpenGLShaderProgram* program = isOpenGL_4_3() + QOpenGLShaderProgram* program = isOpenGL_4_3() ?declare_program(name, ":/cgal/Polyhedron_3/resources/shader_spheres.vert" , ":/cgal/Polyhedron_3/resources/shader_with_light.frag") : declare_program(name, ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_spheres.vert" , ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_with_light.frag"); @@ -1349,7 +1349,7 @@ QOpenGLShaderProgram* Viewer::getShaderProgram(int name) const } case PROGRAM_DARK_SPHERES: { - QOpenGLShaderProgram* program = isOpenGL_4_3() + QOpenGLShaderProgram* program = isOpenGL_4_3() ?declare_program(name, ":/cgal/Polyhedron_3/resources/shader_dark_spheres.vert" , ":/cgal/Polyhedron_3/resources/shader_no_light_no_selection.frag") : declare_program(name, ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_dark_spheres.vert" , ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_no_light_no_selection.frag"); @@ -1373,9 +1373,9 @@ QOpenGLShaderProgram* Viewer::getShaderProgram(int name) const } case PROGRAM_OLD_FLAT: { - QOpenGLShaderProgram* program = isOpenGL_4_3() + QOpenGLShaderProgram* program = isOpenGL_4_3() ? declare_program(name, ":/cgal/Polyhedron_3/resources/shader_with_light.vert", ":/cgal/Polyhedron_3/resources/shader_old_flat.frag") - : declare_program(name, + : declare_program(name, ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_with_light.vert", ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_old_flat.frag"); program->setProperty("hasLight", true); @@ -1390,7 +1390,7 @@ QOpenGLShaderProgram* Viewer::getShaderProgram(int name) const return 0; } QOpenGLShaderProgram* program = declare_program(name, - ":/cgal/Polyhedron_3/resources/solid_wireframe_shader.vert", + ":/cgal/Polyhedron_3/resources/solid_wireframe_shader.vert", ":/cgal/Polyhedron_3/resources/solid_wireframe_shader.frag"); program->setProperty("hasViewport", true); program->setProperty("hasWidth", true); @@ -1543,7 +1543,7 @@ void Viewer_impl::showDistance(QPoint pixel) v.resize(6); v[0] = float(APoint.x); v[1] = float(APoint.y); v[2] = float(APoint.z); v[3] = float(BPoint.x); v[4] = float(BPoint.y); v[5] = float(BPoint.z); - + vao.bind(); buffer.bind(); buffer.allocate(v.data(),6*sizeof(float)); @@ -1551,7 +1551,7 @@ void Viewer_impl::showDistance(QPoint pixel) rendering_program_dist.setAttributeBuffer("vertex",GL_FLOAT,0,3); buffer.release(); vao.release(); - + distance_is_displayed = true; double dist = std::sqrt((BPoint.x-APoint.x)*(BPoint.x-APoint.x) + (BPoint.y-APoint.y)*(BPoint.y-APoint.y) + (BPoint.z-APoint.z)*(BPoint.z-APoint.z)); QFont font; @@ -1755,7 +1755,7 @@ void Viewer::messageLogged(QOpenGLDebugMessage msg) void Viewer::setLighting() { - + //save current settings; float prev_spec = d->spec_power; QVector4D prev_pos = d->position; @@ -1801,38 +1801,38 @@ void Viewer::setLighting() d->position = QVector4D(coords[0], coords[1], coords[2], 1.0f); update(); }); - + //set ambient connect(dialog, &LightingDialog::s_ambient_changed, [this, dialog](){ - d->ambient=QVector4D(dialog->ambient.redF(), - dialog->ambient.greenF(), - dialog->ambient.blueF(), + d->ambient=QVector4D(dialog->ambient.redF(), + dialog->ambient.greenF(), + dialog->ambient.blueF(), 1.0f); update(); }); - + //set diffuse connect(dialog, &LightingDialog::s_diffuse_changed, [this, dialog](){ - d->diffuse=QVector4D(dialog->diffuse.redF(), - dialog->diffuse.greenF(), - dialog->diffuse.blueF(), + d->diffuse=QVector4D(dialog->diffuse.redF(), + dialog->diffuse.greenF(), + dialog->diffuse.blueF(), 1.0f); update(); }); //set specular connect(dialog, &LightingDialog::s_specular_changed, [this, dialog](){ - d->specular=QVector4D(dialog->specular.redF() , - dialog->specular.greenF(), - dialog->specular.blueF() , + d->specular=QVector4D(dialog->specular.redF() , + dialog->specular.greenF(), + dialog->specular.blueF() , 1.0f); update(); - + }); - + //reset default connect(dialog->buttonBox->button(QDialogButtonBox::StandardButton::RestoreDefaults), &QPushButton::clicked, [this](){ @@ -1840,9 +1840,9 @@ void Viewer::setLighting() d->ambient=QVector4D(77.0/255,77.0/255,77.0/255, 1.0); d->diffuse=QVector4D(204.0/255,204.0/255,204.0/255,1.0); d->specular=QVector4D(0,0,0,1.0); - d->spec_power = 51; + d->spec_power = 51; update(); - + }); if(!dialog->exec()) { diff --git a/Polyhedron/demo/Polyhedron/Viewer.h b/Polyhedron/demo/Polyhedron/Viewer.h index f4fdf522abe..0d5bd3541df 100644 --- a/Polyhedron/demo/Polyhedron/Viewer.h +++ b/Polyhedron/demo/Polyhedron/Viewer.h @@ -81,7 +81,7 @@ public: const char* v_shader, const char* f_shader)const; QPainter* getPainter()Q_DECL_OVERRIDE; - + TextRenderer* textRenderer() Q_DECL_OVERRIDE; void enableClippingBox(QVector4D box[]) Q_DECL_OVERRIDE; @@ -112,7 +112,7 @@ public Q_SLOTS: //! @returns a QString containing the position and orientation of the camera. QString dumpCameraCoordinates() Q_DECL_OVERRIDE; //!Moves the camera to the new coordinates (position and orientation) through an animation. - bool moveCameraToCoordinates(QString, + bool moveCameraToCoordinates(QString, float animation_duration = 0.5f) Q_DECL_OVERRIDE; //!Makes the Viewer display a message void printMessage(QString message, int ms_delay ); diff --git a/Polyhedron/demo/Polyhedron/include/CGAL/IO/read_surf_trianglemesh.h b/Polyhedron/demo/Polyhedron/include/CGAL/IO/read_surf_trianglemesh.h index b0cb0595853..27c6e1ac406 100644 --- a/Polyhedron/demo/Polyhedron/include/CGAL/IO/read_surf_trianglemesh.h +++ b/Polyhedron/demo/Polyhedron/include/CGAL/IO/read_surf_trianglemesh.h @@ -275,7 +275,7 @@ bool read_surf(std::istream& input, std::vector& output, std::cout << "\rOrientation of patch #" << (i + 1) << " done"; if(!no_duplicates) //collect duplicates - { + { for (std::size_t i = nbp_init; i < points.size(); ++i) *out++ = points[i]; std::cout << " (non manifold -> " diff --git a/Polyhedron/demo/Polyhedron/include/run_with_qprogressdialog.h b/Polyhedron/demo/Polyhedron/include/run_with_qprogressdialog.h index 3faa3173db4..47f5f9670df 100644 --- a/Polyhedron/demo/Polyhedron/include/run_with_qprogressdialog.h +++ b/Polyhedron/demo/Polyhedron/include/run_with_qprogressdialog.h @@ -12,7 +12,7 @@ typedef CGAL::Parallel_if_available_tag Concurrency_tag; class Signal_callback { private: - + CGAL::Real_timer timer; double t_start; mutable double t_latest; @@ -40,9 +40,9 @@ public: { if (!state) return false; - + *latest_adv = advancement; - + // Avoid calling time() at every single iteration, which could // impact performances very badly ++ nb; @@ -56,11 +56,11 @@ public: signaler->emit_signal (int (100. * advancement)); t_latest = t; - + if (signaler->is_canceled) *state = false; } - + return *state; } @@ -74,7 +74,7 @@ protected: public: Signal_callback* callback() { return m_callback.get(); } - + Functor_with_signal_callback() : m_callback (new Signal_callback(true)) { } @@ -101,9 +101,9 @@ void run_with_qprogressdialog (Functor& functor, 0, 100, mainWindow); progress.setMinimumDuration(0); - + Signal_callback* signal_callback = functor.callback(); - + QEventLoop::connect (signal_callback->signaler.get(), SIGNAL(progressChanged(int)), &progress, SLOT(setValue(int))); QEventLoop::connect (&progress, SIGNAL(canceled()), @@ -120,7 +120,7 @@ void run_with_qprogressdialog (Functor& functor, CGAL::cpp11::sleep_for (0.1); QApplication::processEvents (); } - + thread.join(); } else @@ -129,7 +129,7 @@ void run_with_qprogressdialog (Functor& functor, progress.setWindowModality(Qt::WindowModal); functor(); } - + mainWindow->setEnabled(true); } diff --git a/Polyhedron_IO/include/CGAL/IO/OFF_reader.h b/Polyhedron_IO/include/CGAL/IO/OFF_reader.h index e7ce22456f7..fa0e49c2158 100644 --- a/Polyhedron_IO/include/CGAL/IO/OFF_reader.h +++ b/Polyhedron_IO/include/CGAL/IO/OFF_reader.h @@ -106,7 +106,7 @@ namespace CGAL { vcolors[i] = scanner.get_color_from_line(iss); } } - + if(!in) return false; } diff --git a/Polyhedron_IO/include/CGAL/IO/Polyhedron_iostream.h b/Polyhedron_IO/include/CGAL/IO/Polyhedron_iostream.h index 91e967e995b..00cf390acf5 100644 --- a/Polyhedron_IO/include/CGAL/IO/Polyhedron_iostream.h +++ b/Polyhedron_IO/include/CGAL/IO/Polyhedron_iostream.h @@ -6,7 +6,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Lutz Kettner @@ -59,7 +59,7 @@ template < class Traits, template < class T, class I, class A> class HDS, class Alloc, class NamedParameters> -bool +bool read_off(std::istream& in, Polyhedron_3& P, NamedParameters np) { @@ -88,9 +88,9 @@ template < class Traits, class Items, template < class T, class I, class A> class HDS, class Alloc> -bool +bool read_off(std::istream& in, - Polyhedron_3& P) + Polyhedron_3& P) { return read_off(in, P, parameters::all_default()); } diff --git a/Polyhedron_IO/include/CGAL/IO/STL_reader.h b/Polyhedron_IO/include/CGAL/IO/STL_reader.h index 78925b113e8..86b26c0dd8a 100644 --- a/Polyhedron_IO/include/CGAL/IO/STL_reader.h +++ b/Polyhedron_IO/include/CGAL/IO/STL_reader.h @@ -17,7 +17,7 @@ #include -#include +#include #include #include diff --git a/Principal_component_analysis/demo/Principal_component_analysis/CMakeLists.txt b/Principal_component_analysis/demo/Principal_component_analysis/CMakeLists.txt index af76de02587..d8e2d1c3387 100644 --- a/Principal_component_analysis/demo/Principal_component_analysis/CMakeLists.txt +++ b/Principal_component_analysis/demo/Principal_component_analysis/CMakeLists.txt @@ -67,7 +67,7 @@ else (CGAL_Qt5_FOUND AND Qt5_FOUND ) set(PCA_MISSING_DEPS "Qt5, ${PCA_MISSING_DEPS}") endif() - + message(STATUS "NOTICE: This demo requires ${PCA_MISSING_DEPS} and will not be compiled.") endif (CGAL_Qt5_FOUND AND Qt5_FOUND ) diff --git a/Principal_component_analysis/examples/Principal_component_analysis/CMakeLists.txt b/Principal_component_analysis/examples/Principal_component_analysis/CMakeLists.txt index ae1c1e63325..acdc5826865 100644 --- a/Principal_component_analysis/examples/Principal_component_analysis/CMakeLists.txt +++ b/Principal_component_analysis/examples/Principal_component_analysis/CMakeLists.txt @@ -24,8 +24,8 @@ if ( CGAL_FOUND ) endforeach() else() - + message(STATUS "This program requires the CGAL library, and will not be compiled.") - + endif() diff --git a/Principal_component_analysis/test/Principal_component_analysis/CMakeLists.txt b/Principal_component_analysis/test/Principal_component_analysis/CMakeLists.txt index 994d7529744..02d5f28a0ac 100644 --- a/Principal_component_analysis/test/Principal_component_analysis/CMakeLists.txt +++ b/Principal_component_analysis/test/Principal_component_analysis/CMakeLists.txt @@ -24,8 +24,8 @@ if ( CGAL_FOUND ) endforeach() else() - + message(STATUS "This program requires the CGAL library, and will not be compiled.") - + endif() diff --git a/Property_map/include/CGAL/Dynamic_property_map.h b/Property_map/include/CGAL/Dynamic_property_map.h index 2300b4b5efe..19a7e438d3d 100644 --- a/Property_map/include/CGAL/Dynamic_property_map.h +++ b/Property_map/include/CGAL/Dynamic_property_map.h @@ -62,7 +62,7 @@ struct Dynamic_property_map { (*(m.map_))[k] = v; } - + const V& default_value() const { return default_value_; @@ -74,7 +74,7 @@ struct Dynamic_property_map { V default_value_; }; - + template struct Dynamic_property_map_deleter { M& mesh; @@ -103,22 +103,22 @@ struct Dynamic { Dynamic() : map_() {} - + Dynamic(const Mesh& mesh, PM* pm) : map_(pm, Deleter(mesh)) {} - + friend reference get(const Dynamic& m, const key_type& k) { return get(*(m.map_), k); } - + friend void put(const Dynamic& m, const key_type& k, const value_type& v) { put(*(m.map_), k, v); } - + boost::shared_ptr map_; }; diff --git a/Ridges_3/examples/Ridges_3/CMakeLists.txt b/Ridges_3/examples/Ridges_3/CMakeLists.txt index 09a60dbb011..9392ccb1b48 100644 --- a/Ridges_3/examples/Ridges_3/CMakeLists.txt +++ b/Ridges_3/examples/Ridges_3/CMakeLists.txt @@ -11,7 +11,7 @@ if ( CGAL_FOUND ) # use either Eigen find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater) if (EIGEN3_FOUND) - + # Link with Boost.ProgramOptions (optional) find_package(Boost QUIET COMPONENTS program_options) if(TARGET Boost::program_options) @@ -33,7 +33,7 @@ if ( CGAL_FOUND ) CGAL_target_use_Eigen(Ridges_Umbilics_SM) create_single_source_cgal_program( Ridges_Umbilics_LCC.cpp) CGAL_target_use_Eigen(Ridges_Umbilics_LCC) - + else() message(STATUS "NOTICE: This program requires Eigen 3.1 (or greater) and will not be compiled.") @@ -41,7 +41,7 @@ if ( CGAL_FOUND ) endif() else() - + message(STATUS "NOTICE: This program requires the CGAL library, and will not be compiled.") - + endif() diff --git a/Ridges_3/include/CGAL/Umbilics.h b/Ridges_3/include/CGAL/Umbilics.h index 973184e60ab..d10ecd1a1e5 100644 --- a/Ridges_3/include/CGAL/Umbilics.h +++ b/Ridges_3/include/CGAL/Umbilics.h @@ -39,11 +39,11 @@ class Umbilic public: typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; - + //constructor Umbilic(const TriangleMesh& P, const vertex_descriptor v_init, - const std::list contour_init); + const std::list contour_init); //access fct vertex_descriptor vertex() const { return v;} @@ -65,17 +65,17 @@ template Umbilic:: Umbilic(const TriangleMesh& P, const vertex_descriptor v_init, - const std::list contour_init) + const std::list contour_init) : P(P), v(v_init), contour(contour_init) -{} +{} template -std::ostream& +std::ostream& operator<<(std::ostream& out_stream, const Umbilic& umbilic) { typedef typename boost::property_map::const_type VPM; - VPM vpm = get(vertex_point, umbilic.mesh()); + VPM vpm = get(vertex_point, umbilic.mesh()); out_stream << "Umbilic at location (" << get(vpm, umbilic.vertex()) << ") of type "; switch (umbilic.umbilic_type()) { @@ -97,7 +97,7 @@ operator<<(std::ostream& out_stream, const Umbilic& umbilic) template < class TriangleMesh, class VertexFTMap, class VertexVectorMap > class Umbilic_approximation { - + typedef typename boost::property_map::const_type VPM; typedef typename boost::property_traits::value_type Point_3; typedef typename Kernel_traits::Kernel Kernel; @@ -118,11 +118,11 @@ class Umbilic_approximation typedef CGAL::Umbilic Umbilic; //constructor : sets propertymaps and the poly_neighbors - Umbilic_approximation(const TriangleMesh& P, - const VertexFTMap& vertex2k1_pm, - const VertexFTMap& vertex2k2_pm, - const VertexVectorMap& vertex2d1_pm, - const VertexVectorMap& vertex2d2_pm); + Umbilic_approximation(const TriangleMesh& P, + const VertexFTMap& vertex2k1_pm, + const VertexFTMap& vertex2k2_pm, + const VertexVectorMap& vertex2d1_pm, + const VertexVectorMap& vertex2d2_pm); //identify umbilics as vertices minimizing the function k1-k2 on //their patch and for which the index is not 0. We avoid //potential umbilics whose contours touch the border. @@ -131,7 +131,7 @@ class Umbilic_approximation protected: const TriangleMesh& P; - + typedef T_PolyhedralSurf_neighbors Poly_neighbors; boost::shared_ptr poly_neighbors; @@ -155,12 +155,12 @@ class Umbilic_approximation template < class TriangleMesh, class VertexFTMap, class VertexVectorMap > Umbilic_approximation< TriangleMesh, VertexFTMap, VertexVectorMap >:: -Umbilic_approximation(const TriangleMesh& p, - const VertexFTMap& vertex2k1_pm, - const VertexFTMap& vertex2k2_pm, - const VertexVectorMap& vertex2d1_pm, - const VertexVectorMap& vertex2d2_pm) - : P(p), k1(vertex2k1_pm), k2(vertex2k2_pm), +Umbilic_approximation(const TriangleMesh& p, + const VertexFTMap& vertex2k1_pm, + const VertexFTMap& vertex2k2_pm, + const VertexVectorMap& vertex2d1_pm, + const VertexVectorMap& vertex2d2_pm) + : P(p), k1(vertex2k1_pm), k2(vertex2k2_pm), d1(vertex2d1_pm), d2(vertex2d2_pm) { CGAL_precondition(is_triangle_mesh(P)); @@ -175,11 +175,11 @@ OutputIterator Umbilic_approximation< TriangleMesh, VertexFTMap, VertexVectorMap compute(OutputIterator umbilics_it, FT size) { CGAL_precondition( size >= 1 ); - + std::vector vces; std::list contour; FT umbilicEstimatorVertex, umbilicEstimatorNeigh; - + bool is_umbilic = true; //MAIN loop on P vertices @@ -194,8 +194,8 @@ compute(OutputIterator umbilics_it, FT size) is_umbilic = true; //the size of neighbourhood is (size * OneRingSize) poly_neighbors->compute_neighbors(vh, vces, contour, size); - - + + // avoid umbilics whose contours touch the border (Note may not be // desirable?) typename std::list::const_iterator itb_cont = contour.begin(), @@ -203,20 +203,20 @@ compute(OutputIterator umbilics_it, FT size) for (; itb_cont != ite_cont; itb_cont++) if ( is_border(*itb_cont, P) ) {is_umbilic = false; continue;} if (is_umbilic == false) continue; - + //is v an umbilic? - //a priori is_umbilic = true, and it switches to false as soon as a + //a priori is_umbilic = true, and it switches to false as soon as a // neigh vertex has a lower umbilicEstimator value typename std::vector::const_iterator itbv = vces.begin(), itev = vces.end(); itbv++; for (; itbv != itev; itbv++) - { umbilicEstimatorNeigh = cgal_abs( get(k1,*itbv) - get(k2,*itbv) ); - if ( umbilicEstimatorNeigh < umbilicEstimatorVertex ) - {is_umbilic = false; break;} + { umbilicEstimatorNeigh = cgal_abs( get(k1,*itbv) - get(k2,*itbv) ); + if ( umbilicEstimatorNeigh < umbilicEstimatorVertex ) + {is_umbilic = false; break;} } if (is_umbilic == false) continue; - + //v is an umbilic (wrt the min of k1-k2), compute the index. If //the index is not 0 then we have actually an umbilic which is output Umbilic* cur_umbilic = new Umbilic(P, vh, contour); @@ -256,7 +256,7 @@ compute_type(Umbilic& umb) normal = CGAL::cross_product(get(d1,v), get(d2,v)); } while (itb != (itlast)); - + //angle (v_last, v_0) v = target(*umb.contour_list().begin(), P); dirnext = get(d1,v); @@ -277,25 +277,25 @@ compute_type(Umbilic& umb) //Global function -template < class TriangleMesh, +template < class TriangleMesh, class VertexFTMap, class VertexVectorMap, class OutputIterator> OutputIterator compute_umbilics(const TriangleMesh &P, - const VertexFTMap& vertex2k1_pm, + const VertexFTMap& vertex2k1_pm, const VertexFTMap& vertex2k2_pm, - const VertexVectorMap& vertex2d1_pm, + const VertexVectorMap& vertex2d1_pm, const VertexVectorMap& vertex2d2_pm, - OutputIterator it, + OutputIterator it, double size) { - typedef Umbilic_approximation < TriangleMesh, + typedef Umbilic_approximation < TriangleMesh, VertexFTMap, VertexVectorMap > Umbilic_approximation; - - Umbilic_approximation umbilic_approximation(P, - vertex2k1_pm, vertex2k2_pm, - vertex2d1_pm, vertex2d2_pm); - return umbilic_approximation.compute(it, size); + + Umbilic_approximation umbilic_approximation(P, + vertex2k1_pm, vertex2k2_pm, + vertex2d1_pm, vertex2d2_pm); + return umbilic_approximation.compute(it, size); } diff --git a/Ridges_3/test/Ridges_3/CMakeLists.txt b/Ridges_3/test/Ridges_3/CMakeLists.txt index 122000c9c68..139ca8dfb10 100644 --- a/Ridges_3/test/Ridges_3/CMakeLists.txt +++ b/Ridges_3/test/Ridges_3/CMakeLists.txt @@ -17,14 +17,14 @@ if ( CGAL_FOUND ) create_single_source_cgal_program( "ridge_test.cpp" ) CGAL_target_use_Eigen(ridge_test) else() - + message(STATUS "NOTICE: This program requires Eigen 3.1 (or greater) and will not be compiled.") endif() else() - + message(STATUS "NOTICE: This program requires the CGAL library, and will not be compiled.") - + endif() diff --git a/STL_Extension/doc/STL_Extension/CGAL/tags.h b/STL_Extension/doc/STL_Extension/CGAL/tags.h index 9a54c36a4fe..7a085e194be 100644 --- a/STL_Extension/doc/STL_Extension/CGAL/tags.h +++ b/STL_Extension/doc/STL_Extension/CGAL/tags.h @@ -4,24 +4,24 @@ namespace CGAL { /*! \ingroup PkgSTLExtensionUtilities -Depending on `bool value` the class `Boolean_tag` indicates that -something is `true` or `false` respectively. +Depending on `bool value` the class `Boolean_tag` indicates that +something is `true` or `false` respectively. -\sa `CGAL::Tag_true` -\sa `CGAL::Tag_false` +\sa `CGAL::Tag_true` +\sa `CGAL::Tag_false` */ template< typename bool value > struct Boolean_tag { -/// \name Constants -/// @{ +/// \name Constants +/// @{ /*! -*/ -static const bool value; +*/ +static const bool value; -/// @} +/// @} }; /* end Boolean_tag */ } /* end namespace CGAL */ @@ -31,12 +31,12 @@ namespace CGAL { /*! \ingroup PkgSTLExtensionUtilities -The typedef `Tag_false` is `Boolean_tag`. -It is used to indicate, for example, -that a certain feature is not available in a class. +The typedef `Tag_false` is `Boolean_tag`. +It is used to indicate, for example, +that a certain feature is not available in a class. -\sa `CGAL::Boolean_tag` -\sa `CGAL::Tag_true` +\sa `CGAL::Boolean_tag` +\sa `CGAL::Tag_true` */ typedef CGAL::Boolean_tag Tag_false; @@ -44,12 +44,12 @@ typedef CGAL::Boolean_tag Tag_false; /*! \ingroup PkgSTLExtensionUtilities -The typedef `Tag_true` is `Boolean_tag`. -It is used to indicate, for example, -that a certain feature is available in a class. +The typedef `Tag_true` is `Boolean_tag`. +It is used to indicate, for example, +that a certain feature is available in a class. -\sa `CGAL::Boolean_tag` -\sa `CGAL::Tag_false` +\sa `CGAL::Boolean_tag` +\sa `CGAL::Tag_false` */ typedef CGAL::Boolean_tag Tag_true; @@ -60,11 +60,11 @@ typedef CGAL::Boolean_tag Tag_true; Class indicating the absence of a functor. \cgalModels `DefaultConstructible` -\sa `AlgebraicStructureTraits` -\sa `RealEmbeddableTraits` +\sa `AlgebraicStructureTraits` +\sa `RealEmbeddableTraits` */ struct Null_functor { - + }; /*! @@ -91,11 +91,11 @@ struct Parallel_if_available_tag {}; /*! \ingroup PkgSTLExtensionUtilities -General tag indicating that non of any other possible tags is valid. +General tag indicating that non of any other possible tags is valid. \cgalModels `DefaultConstructible` -\sa `AlgebraicStructureTraits` +\sa `AlgebraicStructureTraits` */ struct Null_tag { diff --git a/STL_Extension/include/CGAL/Container_helper.h b/STL_Extension/include/CGAL/Container_helper.h index eac612ad718..c4a5bc97965 100644 --- a/STL_Extension/include/CGAL/Container_helper.h +++ b/STL_Extension/include/CGAL/Container_helper.h @@ -5,7 +5,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Andreas Fabri diff --git a/STL_Extension/include/CGAL/Handle.h b/STL_Extension/include/CGAL/Handle.h index 7e725eb67dc..af5297ae2e5 100644 --- a/STL_Extension/include/CGAL/Handle.h +++ b/STL_Extension/include/CGAL/Handle.h @@ -1,16 +1,16 @@ -// Copyright (c) 1999 +// Copyright (c) 1999 // Utrecht University (The Netherlands), // ETH Zurich (Switzerland), // INRIA Sophia-Antipolis (France), // Max-Planck-Institute Saarbruecken (Germany), -// and Tel-Aviv University (Israel). All rights reserved. +// and Tel-Aviv University (Israel). All rights reserved. // // This file is part of CGAL (www.cgal.org) // // $URL$ // $Id$ // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Sylvain Pion @@ -36,11 +36,11 @@ class Rep class Handle { public: - + typedef std::ptrdiff_t Id_type ; - + Handle() noexcept - : PTR(static_cast(0)) {} + : PTR(static_cast(0)) {} // FIXME: if the precondition throws in a noexcept function, the program terminates Handle(const Handle& x) noexcept @@ -53,8 +53,8 @@ class Handle ~Handle() { - if ( PTR && (--PTR->count == 0)) - delete PTR; + if ( PTR && (--PTR->count == 0)) + delete PTR; } Handle& @@ -63,7 +63,7 @@ class Handle CGAL_precondition( x.PTR != static_cast(0) ); x.PTR->count++; if ( PTR && (--PTR->count == 0)) - delete PTR; + delete PTR; PTR = x.PTR; return *this; } diff --git a/STL_Extension/include/CGAL/Handle_for.h b/STL_Extension/include/CGAL/Handle_for.h index b283f469003..537096b6e73 100644 --- a/STL_Extension/include/CGAL/Handle_for.h +++ b/STL_Extension/include/CGAL/Handle_for.h @@ -1,19 +1,19 @@ -// Copyright (c) 1999,2001,2003 +// Copyright (c) 1999,2001,2003 // Utrecht University (The Netherlands), // ETH Zurich (Switzerland), // INRIA Sophia-Antipolis (France), // Max-Planck-Institute Saarbruecken (Germany), -// and Tel-Aviv University (Israel). All rights reserved. +// and Tel-Aviv University (Israel). All rights reserved. // // This file is part of CGAL (www.cgal.org) // // $URL$ // $Id$ // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Stefan Schirra, Sylvain Pion - + #ifndef CGAL_HANDLE_FOR_H #define CGAL_HANDLE_FOR_H @@ -54,7 +54,7 @@ class Handle_for public: typedef T element_type; - + typedef std::ptrdiff_t Id_type ; Handle_for() @@ -105,7 +105,7 @@ public: Handle_for(const Handle_for& h) noexcept : ptr_(h.ptr_) { - CGAL_assume (ptr_->count > 0); + CGAL_assume (ptr_->count > 0); ++(ptr_->count); } @@ -165,7 +165,7 @@ public: } Id_type id() const noexcept { return Ptr() - static_cast(0); } - + bool identical(const Handle_for& h) const noexcept { return Ptr() == h.Ptr(); } @@ -190,19 +190,19 @@ public: bool is_shared() const noexcept { - return ptr_->count > 1; + return ptr_->count > 1; } bool unique() const noexcept { - return !is_shared(); + return !is_shared(); } long use_count() const noexcept { - return ptr_->count; + return ptr_->count; } void diff --git a/STL_Extension/include/CGAL/exceptions.h b/STL_Extension/include/CGAL/exceptions.h index ddd047d395a..a828503e7b3 100644 --- a/STL_Extension/include/CGAL/exceptions.h +++ b/STL_Extension/include/CGAL/exceptions.h @@ -7,7 +7,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Lutz Kettner, Sylvain Pion @@ -25,7 +25,7 @@ # pragma warning(push) # pragma warning(disable: 4003) #endif -#include +#include #if defined(BOOST_MSVC) # pragma warning(pop) #endif @@ -41,8 +41,8 @@ namespace CGAL { \brief \#include for pre- and postconditions, assertions, warnings, and error handler. - \c CGAL/basic.h provides macros for pre- and postconditions, assertions, - warnings, and errors that are active by default. There are variants + \c CGAL/basic.h provides macros for pre- and postconditions, assertions, + warnings, and errors that are active by default. There are variants for expensive checks that are inactive by default. A failed precondition, postcondition or assertion is a fatal error @@ -50,7 +50,7 @@ namespace CGAL { the program continues to run. Both can be changed with the respective \c error_behavior or \c warning_behavior, or with the corresponding \c error_handler or \c warning_handler. - + However, if the checks are disabled with corresponding preprocessor symbols or \c NDEBUG, none of this error handling will happen and the program execution continues with potentially @@ -60,8 +60,8 @@ namespace CGAL { the production version of the program, keeping in mind that they should not cost too much runtime overhead, maybe 10%. - \see \c CGAL_test for checks that cannot be disabled and - \c CGAL_error_msg for an unconditional error message that cannot + \see \c CGAL_test for checks that cannot be disabled and + \c CGAL_error_msg for an unconditional error message that cannot be disabled with macros. */ @@ -107,7 +107,7 @@ public: //! source code filename where the failure was detected. std::string filename() const { return m_file; } - + //! line number in source code file where the failure was detected. int line_number() const { return m_line; } diff --git a/STL_Extension/include/CGAL/tags.h b/STL_Extension/include/CGAL/tags.h index 8feef206784..c1f9c8ab130 100644 --- a/STL_Extension/include/CGAL/tags.h +++ b/STL_Extension/include/CGAL/tags.h @@ -1,19 +1,19 @@ -// Copyright (c) 1999 +// Copyright (c) 1999 // Utrecht University (The Netherlands), // ETH Zurich (Switzerland), // INRIA Sophia-Antipolis (France), // Max-Planck-Institute Saarbruecken (Germany), -// and Tel-Aviv University (Israel). All rights reserved. +// and Tel-Aviv University (Israel). All rights reserved. // // This file is part of CGAL (www.cgal.org) // // $URL$ // $Id$ // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Stefan Schirra - + #ifndef CGAL_TAGS_H #define CGAL_TAGS_H @@ -41,7 +41,7 @@ using Boolean_tag = std::integral_constant; */ typedef Boolean_tag Tag_true; -typedef Boolean_tag Tag_false; +typedef Boolean_tag Tag_false; // the function check_tag is deprecated since CGAL 3.3 inline bool check_tag( Tag_true) {return true;} @@ -51,7 +51,7 @@ struct Null_tag {}; struct Null_functor { typedef Null_tag result_type; - typedef Null_tag second_argument_type; + typedef Null_tag second_argument_type; }; // For concurrency diff --git a/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/CMakeLists.txt b/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/CMakeLists.txt index 7dd3f858f13..e1bfb24bc41 100644 --- a/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/CMakeLists.txt +++ b/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/CMakeLists.txt @@ -10,7 +10,7 @@ if ( CGAL_FOUND ) option(ACTIVATE_CONCURRENCY "Enable concurrency" ON) - + if( ACTIVATE_CONCURRENCY ) find_package( TBB ) if( NOT TBB_FOUND ) @@ -38,7 +38,7 @@ if ( CGAL_FOUND ) message( STATUS "NOTICE: The example needs Eigen 3.1 (or greater) and will not be compiled." ) endif() else() - + message( STATUS "This program requires the CGAL library, and will not be compiled." ) - + endif() diff --git a/Scale_space_reconstruction_3/include/CGAL/Scale_space_reconstruction_3/Jet_smoother.h b/Scale_space_reconstruction_3/include/CGAL/Scale_space_reconstruction_3/Jet_smoother.h index f881e8f23e4..cf34380ca1b 100644 --- a/Scale_space_reconstruction_3/include/CGAL/Scale_space_reconstruction_3/Jet_smoother.h +++ b/Scale_space_reconstruction_3/include/CGAL/Scale_space_reconstruction_3/Jet_smoother.h @@ -26,12 +26,12 @@ namespace CGAL namespace Scale_space_reconstruction_3 { - + /** \ingroup PkgScaleSpaceReconstruction3Classes * * %Smoother for scale space reconstruction based on * `CGAL::jet_smooth_point_set()`. - * + * * \cgalModels CGAL::Scale_space_reconstruction_3::Smoother * * \tparam Geom_traits geometric traits class. It must be a @@ -82,7 +82,7 @@ public: CGAL::jet_smooth_point_set (points, m_k, CGAL::parameters::degree_fitting(m_degree_fitting).degree_monge(m_degree_monge)); } - + }; diff --git a/Scale_space_reconstruction_3/include/CGAL/Scale_space_reconstruction_3/Weighted_PCA_smoother.h b/Scale_space_reconstruction_3/include/CGAL/Scale_space_reconstruction_3/Weighted_PCA_smoother.h index 50cc72b4c9c..ee7c4eb18d5 100644 --- a/Scale_space_reconstruction_3/include/CGAL/Scale_space_reconstruction_3/Weighted_PCA_smoother.h +++ b/Scale_space_reconstruction_3/include/CGAL/Scale_space_reconstruction_3/Weighted_PCA_smoother.h @@ -35,12 +35,12 @@ namespace CGAL namespace Scale_space_reconstruction_3 { - + /** \ingroup PkgScaleSpaceReconstruction3Classes * * %Smoother for scale space reconstruction based on a principal * component analysis weighted by the local density of points. - * + * * \cgalModels CGAL::Scale_space_reconstruction_3::Smoother * * \tparam Geom_traits geometric traits class. It must be a @@ -74,12 +74,12 @@ public: typedef typename Geom_traits::Point_3 Point; ///< defines the point typ.e typedef typename Geom_traits::Vector_3 Vector; ///< defines the vector type. private: - + typedef boost::tuple Point_and_size_t; typedef std::vector CountVec; typedef std::vector Pointset; - + typedef Search_traits_3 Traits_base; typedef CGAL::Search_traits_adapter, @@ -125,7 +125,7 @@ public: { _tree.clear(); _points.clear(); - + std::size_t i = 0; std::size_t size = std::size_t(end - begin); _tree.reserve(size); @@ -141,16 +141,16 @@ public: if (_squared_radius == -1) estimate_neighborhood_squared_radius(); - + // Collect the number of neighbors of each point. // This can be done concurrently. CountVec neighbors (_tree.size(), 0); try_parallel (ComputeNN (_points, _tree, _squared_radius, neighbors), 0, _tree.size()); - + // Compute the transformed point locations. // This can be done concurrently. try_parallel (AdvanceSS (_tree, neighbors, _points), 0, _tree.size()); - + i = 0; for (InputIterator it = begin; it != end; ++ it) *it = _points[i ++]; @@ -208,21 +208,21 @@ private: for (std::size_t i = begin; i < end; ++i) func(i); } - + struct Inc { unsigned int * i; - + Inc(unsigned int& i) : i(&i) {} - + template void operator()(const T&) const { ++(*i); } - + }; // Compute the number of neighbors of a point that lie within a fixed radius. @@ -240,7 +240,7 @@ private: ComputeNN(const Pointset& points, const Search_tree& tree, const FT& sq_radius, CountVec& nn) : _pts(points), _tree(tree), _sq_rd(sqrt(sq_radius)), _nn(nn) {} - + #ifdef CGAL_LINKED_WITH_TBB void operator()( const tbb::blocked_range< std::size_t >& range ) const { for( std::size_t i = range.begin(); i != range.end(); ++i ) @@ -264,11 +264,11 @@ private: const Search_tree& _tree; const CountVec& _nn; Pointset& _pts; - + public: AdvanceSS(const Search_tree& tree, const CountVec& nn, Pointset& points) : _tree(tree), _nn(nn),_pts(points) {} - + #ifdef CGAL_LINKED_WITH_TBB void operator()( const tbb::blocked_range< std::size_t >& range ) const { for( std::size_t i = range.begin(); i != range.end(); ++i ) @@ -300,7 +300,7 @@ private: Vector v (CGAL::ORIGIN, boost::get<0>(nit->first)); barycenter = barycenter + ((1.0 / _nn[boost::get<1>(nit->first)]) / weight_sum) * v; } - + std::array covariance = {{ 0., 0., 0., 0., 0., 0. }}; column = 0; // Compute covariance matrix of Weighted PCA @@ -335,7 +335,7 @@ private: _pts[i] = barycenter + b2p - ((norm * b2p) * norm); } }; // class AdvanceSS - + }; diff --git a/Shape_detection/benchmark/Shape_detection/CMakeLists.txt b/Shape_detection/benchmark/Shape_detection/CMakeLists.txt index 4bcb6bc9978..e89abfcbdf8 100644 --- a/Shape_detection/benchmark/Shape_detection/CMakeLists.txt +++ b/Shape_detection/benchmark/Shape_detection/CMakeLists.txt @@ -24,6 +24,6 @@ if(CGAL_FOUND) endif() else() - message(WARNING + message(WARNING "This program requires the CGAL library, and will not be compiled.") endif() diff --git a/Shape_detection/examples/Shape_detection/CMakeLists.txt b/Shape_detection/examples/Shape_detection/CMakeLists.txt index f8869233fbd..be7c4667d6d 100644 --- a/Shape_detection/examples/Shape_detection/CMakeLists.txt +++ b/Shape_detection/examples/Shape_detection/CMakeLists.txt @@ -33,7 +33,7 @@ if(CGAL_FOUND) create_single_source_cgal_program( "shape_detection_basic_deprecated.cpp") - + foreach(target efficient_RANSAC_basic efficient_RANSAC_with_callback @@ -45,7 +45,7 @@ if(CGAL_FOUND) shape_detection_basic_deprecated) CGAL_target_use_Eigen(${target}) endforeach() - + endif() create_single_source_cgal_program( @@ -56,6 +56,6 @@ if(CGAL_FOUND) "efficient_RANSAC_with_point_access.cpp") else() - message(WARNING + message(WARNING "This program requires the CGAL library, and will not be compiled.") endif() diff --git a/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/K_neighbor_query.h b/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/K_neighbor_query.h index 7010fab2e1f..55b10c9caf8 100644 --- a/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/K_neighbor_query.h +++ b/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/K_neighbor_query.h @@ -42,26 +42,26 @@ namespace Point_set { /*! \ingroup PkgShapeDetectionRGOnPoints - \brief K nearest neighbors search in a set of `Kernel::Point_2` or + \brief K nearest neighbors search in a set of `Kernel::Point_2` or `Kernel::Point_3`. This class returns the K nearest neighbors of a query point in a point set. - \tparam GeomTraits + \tparam GeomTraits must be a model of `Kernel`. - \tparam InputRange + \tparam InputRange must be a model of `ConstRange` whose iterator type is `RandomAccessIterator`. - \tparam PointMap - must be an `LvaluePropertyMap` whose key type is the value type of the input + \tparam PointMap + must be an `LvaluePropertyMap` whose key type is the value type of the input range and value type is `Kernel::Point_2` or `Kernel::Point_3`. \cgalModels `NeighborQuery` */ template< - typename GeomTraits, - typename InputRange, + typename GeomTraits, + typename InputRange, typename PointMap> class K_neighbor_query { @@ -73,38 +73,38 @@ namespace Point_set { using Point_map = PointMap; using Point = typename Point_map::value_type; - - using Index_to_point_map = + + using Index_to_point_map = internal::Item_property_map; using Search_base = typename std::conditional< - std::is_same::value, - CGAL::Search_traits_2, + std::is_same::value, + CGAL::Search_traits_2, CGAL::Search_traits_3 >::type; - using Search_traits = + using Search_traits = CGAL::Search_traits_adapter; - using Distance = + using Distance = CGAL::Distance_adapter< - std::size_t, - Index_to_point_map, + std::size_t, + Index_to_point_map, CGAL::Euclidean_distance >; - using Splitter = + using Splitter = CGAL::Sliding_midpoint; - using Search_tree = + using Search_tree = CGAL::Kd_tree; - using Neighbor_search = + using Neighbor_search = CGAL::Orthogonal_k_neighbor_search< - Search_traits, - Distance, - Splitter, + Search_traits, + Distance, + Splitter, Search_tree>; - using Tree = + using Tree = typename Neighbor_search::Tree; /// \endcond @@ -114,22 +114,22 @@ namespace Point_set { /*! \brief initializes a Kd-tree with input points. - \param input_range + \param input_range an instance of `InputRange` with 2D or 3D points - \param k + \param k the number of returned neighbors per each query point. %Default is 12. \param point_map - an instance of `PointMap` that maps an item from `input_range` + an instance of `PointMap` that maps an item from `input_range` to `Kernel::Point_2` or to `Kernel::Point_3` \pre `input_range.size() > 0` \pre `k > 0` */ K_neighbor_query( - const InputRange& input_range, - const std::size_t k = 12, + const InputRange& input_range, + const std::size_t k = 12, const PointMap point_map = PointMap()) : m_input_range(input_range), m_number_of_neighbors(k), @@ -140,7 +140,7 @@ namespace Point_set { boost::counting_iterator(0), boost::counting_iterator(m_input_range.size()), Splitter(), - Search_traits(m_index_to_point_map)) { + Search_traits(m_index_to_point_map)) { CGAL_precondition(input_range.size() > 0); CGAL_precondition(k > 0); @@ -151,12 +151,12 @@ namespace Point_set { /// @} /// \name Access - /// @{ + /// @{ /*! \brief implements `NeighborQuery::operator()()`. - This operator finds indices of the `k` closest points to the point with + This operator finds indices of the `k` closest points to the point with the index `query_index` using a Kd-tree. These indices are returned in `neighbors`. \param query_index @@ -168,18 +168,18 @@ namespace Point_set { \pre `query_index >= 0 && query_index < input_range.size()` */ void operator()( - const std::size_t query_index, + const std::size_t query_index, std::vector& neighbors) const { CGAL_precondition(query_index >= 0); CGAL_precondition(query_index < m_input_range.size()); Neighbor_search neighbor_search( - m_tree, - get(m_index_to_point_map, query_index), - static_cast(m_number_of_neighbors), - 0, - true, + m_tree, + get(m_index_to_point_map, query_index), + static_cast(m_number_of_neighbors), + 0, + true, m_distance); neighbors.clear(); @@ -193,7 +193,7 @@ namespace Point_set { // Fields. const Input_range& m_input_range; - + const std::size_t m_number_of_neighbors; const Point_map m_point_map; diff --git a/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Sphere_neighbor_query.h b/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Sphere_neighbor_query.h index fc19f59b53a..7405171ff0b 100644 --- a/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Sphere_neighbor_query.h +++ b/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Sphere_neighbor_query.h @@ -42,32 +42,32 @@ namespace Point_set { /*! \ingroup PkgShapeDetectionRGOnPoints - \brief Fuzzy sphere neighbors search in a set of `Kernel::Point_2` + \brief Fuzzy sphere neighbors search in a set of `Kernel::Point_2` or `Kernel::Point_3`. This class returns all neighbors of a query point, which fall in a sphere of the fixed radius centered at this point. - \tparam GeomTraits + \tparam GeomTraits must be a model of `Kernel`. - \tparam InputRange + \tparam InputRange must be a model of `ConstRange` whose iterator type is `RandomAccessIterator`. - \tparam PointMap - must be an `LvaluePropertyMap` whose key type is the value type of the input + \tparam PointMap + must be an `LvaluePropertyMap` whose key type is the value type of the input range and value type is `Kernel::Point_2` or `Kernel::Point_3`. \cgalModels `NeighborQuery` */ template< - typename GeomTraits, - typename InputRange, + typename GeomTraits, + typename InputRange, typename PointMap> class Sphere_neighbor_query { public: - + /// \name Types /// @{ @@ -83,27 +83,27 @@ namespace Point_set { typedef typename GeomTraits::FT FT; /// \cond SKIP_IN_MANUAL - using Index_to_point_map = + using Index_to_point_map = internal::Item_property_map; using Search_base = typename std::conditional< - std::is_same::value, - CGAL::Search_traits_2, + std::is_same::value, + CGAL::Search_traits_2, CGAL::Search_traits_3 >::type; - - using Search_traits = + + using Search_traits = CGAL::Search_traits_adapter; - - using Splitter = + + using Splitter = CGAL::Sliding_midpoint; - - using Fuzzy_sphere + + using Fuzzy_sphere = CGAL::Fuzzy_sphere; - - using Tree + + using Tree = CGAL::Kd_tree; /// \endcond - + /// @} /// \name Initialization @@ -112,23 +112,23 @@ namespace Point_set { /*! \brief initializes a Kd-tree with input points. - \param input_range + \param input_range an instance of `InputRange` with 2D or 3D points - \param sphere_radius - the fixed radius of the fuzzy sphere used for searching neighbors + \param sphere_radius + the fixed radius of the fuzzy sphere used for searching neighbors of a query point. %Default is 1. \param point_map - an instance of `PointMap` that maps an item from `input_range` + an instance of `PointMap` that maps an item from `input_range` to `Kernel::Point_2` or to `Kernel::Point_3` \pre `input_range.size() > 0` \pre `sphere_radius > 0` */ Sphere_neighbor_query( - const InputRange& input_range, - const FT sphere_radius = FT(1), + const InputRange& input_range, + const FT sphere_radius = FT(1), const PointMap point_map = PointMap()) : m_input_range(input_range), m_sphere_radius(sphere_radius), @@ -138,7 +138,7 @@ namespace Point_set { boost::counting_iterator(0), boost::counting_iterator(m_input_range.size()), Splitter(), - Search_traits(m_index_to_point_map)) { + Search_traits(m_index_to_point_map)) { CGAL_precondition(input_range.size() > 0); CGAL_precondition(sphere_radius > FT(0)); @@ -149,7 +149,7 @@ namespace Point_set { /// @} /// \name Access - /// @{ + /// @{ /*! \brief implements `NeighborQuery::operator()()`. @@ -167,18 +167,18 @@ namespace Point_set { \pre `query_index >= 0 && query_index < input_range.size()` */ void operator()( - const std::size_t query_index, + const std::size_t query_index, std::vector& neighbors) const { - + CGAL_precondition(query_index >= 0); CGAL_precondition(query_index < m_input_range.size()); - + const std::size_t sphere_center = query_index; - + const Fuzzy_sphere sphere( - sphere_center, - m_sphere_radius, - FT(0), + sphere_center, + m_sphere_radius, + FT(0), m_tree.traits()); neighbors.clear(); @@ -191,7 +191,7 @@ namespace Point_set { // Fields. const Input_range& m_input_range; - + const FT m_sphere_radius; const Point_map m_point_map; diff --git a/Shape_detection/test/Shape_detection/CMakeLists.txt b/Shape_detection/test/Shape_detection/CMakeLists.txt index d8f7c9c9ba0..2effc7dd265 100644 --- a/Shape_detection/test/Shape_detection/CMakeLists.txt +++ b/Shape_detection/test/Shape_detection/CMakeLists.txt @@ -45,7 +45,7 @@ if(CGAL_FOUND) test_region_growing_on_degenerated_mesh) CGAL_target_use_Eigen(${target}) endforeach() - + endif() create_single_source_cgal_program( @@ -79,6 +79,6 @@ if(CGAL_FOUND) "test_efficient_RANSAC_regularization.cpp") else() - message(WARNING + message(WARNING "This program requires the CGAL library, and will not be compiled.") endif() diff --git a/Solver_interface/examples/Solver_interface/CMakeLists.txt b/Solver_interface/examples/Solver_interface/CMakeLists.txt index 13ad3314c8e..fbbea89f568 100644 --- a/Solver_interface/examples/Solver_interface/CMakeLists.txt +++ b/Solver_interface/examples/Solver_interface/CMakeLists.txt @@ -36,7 +36,7 @@ if ( CGAL_FOUND ) find_package( GLPK QUIET) if (GLPK_FOUND) - + CGAL_target_use_GLPK(mixed_integer_program) message("GLPK found and used") @@ -50,8 +50,8 @@ if ( CGAL_FOUND ) endif() else() - + message(STATUS "NOTICE: This program requires the CGAL library, and will not be compiled.") - + endif() diff --git a/Spatial_searching/benchmark/Spatial_searching/CMakeLists.txt b/Spatial_searching/benchmark/Spatial_searching/CMakeLists.txt index adb47481272..010a9bc992f 100644 --- a/Spatial_searching/benchmark/Spatial_searching/CMakeLists.txt +++ b/Spatial_searching/benchmark/Spatial_searching/CMakeLists.txt @@ -49,8 +49,8 @@ find_package(Eigen3 3.1.91) #(requires 3.2.0 or greater) endforeach() else() - + message(STATUS "This program requires the CGAL library, and will not be compiled.") - + endif() diff --git a/Spatial_searching/doc/Spatial_searching/CGAL/Euclidean_distance.h b/Spatial_searching/doc/Spatial_searching/CGAL/Euclidean_distance.h index 6f57a8454f4..720ddf07410 100644 --- a/Spatial_searching/doc/Spatial_searching/CGAL/Euclidean_distance.h +++ b/Spatial_searching/doc/Spatial_searching/CGAL/Euclidean_distance.h @@ -3,24 +3,24 @@ namespace CGAL { /*! \ingroup DistanceClasses -The class `Euclidean_distance` provides an implementation of the concept `OrthogonalDistance`, with the -Euclidean distance (\f$ l_2\f$ metric). -To optimize distance computations squared distances are used. +The class `Euclidean_distance` provides an implementation of the concept `OrthogonalDistance`, with the +Euclidean distance (\f$ l_2\f$ metric). +To optimize distance computations squared distances are used. -\tparam Traits must be a model of the concept -`SearchTraits`, for example `Search_traits_2 >`. +\tparam Traits must be a model of the concept +`SearchTraits`, for example `Search_traits_2 >`. \cgalModels `OrthogonalDistance` -\sa `OrthogonalDistance` -\sa `CGAL::Weighted_Minkowski_distance` +\sa `OrthogonalDistance` +\sa `CGAL::Weighted_Minkowski_distance` */ template< typename Traits > class Euclidean_distance { public: -/// \name Types +/// \name Types /// @{ /*! @@ -30,42 +30,42 @@ typedef Traits::Dimension D; /*! -Number type. -*/ -typedef Traits::FT FT; +Number type. +*/ +typedef Traits::FT FT; /*! -Point type. -*/ -typedef Traits::Point_d Point_d; +Point type. +*/ +typedef Traits::Point_d Point_d; /*! -Query item type. -*/ -typedef Point_d Query_item; +Query item type. +*/ +typedef Point_d Query_item; -/// @} +/// @} -/// \name Creation +/// \name Creation /// @{ /*! -%Default constructor. -*/ -Euclidean_distance(Traits t=Traits()); +%Default constructor. +*/ +Euclidean_distance(Traits t=Traits()); -/// @} +/// @} -/// \name Operations +/// \name Operations /// @{ /*! -Returns the squared Euclidean distance between `q` and `p`. -*/ -FT transformed_distance(Query_item q, Point_d p) const; +Returns the squared Euclidean distance between `q` and `p`. +*/ +FT transformed_distance(Query_item q, Point_d p) const; /*! -Returns the transformed distance between `q` and the point whose Cartesian +Returns the transformed distance between `q` and the point whose Cartesian coordinates are contained in the range [`begin`, `end`). */ template @@ -74,8 +74,8 @@ FT transformed_distance_from_coordinates( /*! Returns the transformed distance between `q` and the point whose Cartesian -coordinates are contained in the range [`begin`, `end`), or any value -\f$ \geq \f$ `stop_if_geq_to_this` if the transformed distance is +coordinates are contained in the range [`begin`, `end`), or any value +\f$ \geq \f$ `stop_if_geq_to_this` if the transformed distance is \f$ \geq \f$ `stop_if_geq_to_this`. */ template @@ -83,46 +83,46 @@ FT interruptible_transformed_distance( Query_item q, Coord_iterator begin, Coord_iterator end, FT stop_if_geq_to_this) const; /*! -Returns the squared Euclidean distance between `q` and -the point on the boundary of `r` closest to `q`. -*/ -FT min_distance_to_rectangle(Query_item q, Kd_tree_rectangle r) const; +Returns the squared Euclidean distance between `q` and +the point on the boundary of `r` closest to `q`. +*/ +FT min_distance_to_rectangle(Query_item q, Kd_tree_rectangle r) const; /*! -Returns the squared Euclidean distance between `q` and -the point on the boundary of `r` closest to `q`. Stores -the distances in each dimension in `dists`. -*/ -FT min_distance_to_rectangle(Query_item q, Kd_tree_rectangle r, vector& dists); +Returns the squared Euclidean distance between `q` and +the point on the boundary of `r` closest to `q`. Stores +the distances in each dimension in `dists`. +*/ +FT min_distance_to_rectangle(Query_item q, Kd_tree_rectangle r, vector& dists); /*! -Returns the squared Euclidean distance, where \f$ d\f$ denotes the distance between `q` and -the point on the boundary of `r` farthest to `q`. -*/ -FT max_distance_to_rectangle(Query_item q, Kd_tree_rectangle r) const; +Returns the squared Euclidean distance, where \f$ d\f$ denotes the distance between `q` and +the point on the boundary of `r` farthest to `q`. +*/ +FT max_distance_to_rectangle(Query_item q, Kd_tree_rectangle r) const; /*! -Returns the squared Euclidean distance, where \f$ d\f$ denotes the distance between `q` and -the point on the boundary of `r` farthest to `q`. Stores the distances in +Returns the squared Euclidean distance, where \f$ d\f$ denotes the distance between `q` and +the point on the boundary of `r` farthest to `q`. Stores the distances in each dimension in `dists`. -*/ -FT max_distance_to_rectangle(Query_item q, Kd_tree_rectangle r, vector& dists); +*/ +FT max_distance_to_rectangle(Query_item q, Kd_tree_rectangle r, vector& dists); /*! -Updates the squared `dist` incrementally -and returns the updated squared distance. -*/ -FT new_distance(FT dist, FT old_off, FT new_off, int cutting_dimension) const; +Updates the squared `dist` incrementally +and returns the updated squared distance. +*/ +FT new_distance(FT dist, FT old_off, FT new_off, int cutting_dimension) const; /*! -Returns \f$ d^2\f$. -*/ -FT transformed_distance(FT d) const; +Returns \f$ d^2\f$. +*/ +FT transformed_distance(FT d) const; /*! -Returns \f$ d^{1/2}\f$. -*/ -FT inverse_of_transformed_distance(FT d) const; +Returns \f$ d^{1/2}\f$. +*/ +FT inverse_of_transformed_distance(FT d) const; /// @} diff --git a/Spatial_searching/doc/Spatial_searching/CGAL/Fuzzy_iso_box.h b/Spatial_searching/doc/Spatial_searching/CGAL/Fuzzy_iso_box.h index 90f40892091..298c72cf667 100644 --- a/Spatial_searching/doc/Spatial_searching/CGAL/Fuzzy_iso_box.h +++ b/Spatial_searching/doc/Spatial_searching/CGAL/Fuzzy_iso_box.h @@ -74,7 +74,7 @@ Test whether the fuzzy iso box contains `p`. bool contains(Point_d p) const; /*! -Test whether the fuzzy iso box contains the point whose Cartesian +Test whether the fuzzy iso box contains the point whose Cartesian coordinates are contained in the range [`begin`, `end`). */ template diff --git a/Spatial_searching/doc/Spatial_searching/CGAL/Incremental_neighbor_search.h b/Spatial_searching/doc/Spatial_searching/CGAL/Incremental_neighbor_search.h index 3273f5b39ca..731782460bf 100644 --- a/Spatial_searching/doc/Spatial_searching/CGAL/Incremental_neighbor_search.h +++ b/Spatial_searching/doc/Spatial_searching/CGAL/Incremental_neighbor_search.h @@ -3,105 +3,105 @@ namespace CGAL { /*! \ingroup SearchClasses -The class `Incremental_neighbor_search` implements incremental nearest and furthest neighbor searching -on a tree. The tree may have extended or unextended nodes. +The class `Incremental_neighbor_search` implements incremental nearest and furthest neighbor searching +on a tree. The tree may have extended or unextended nodes. -\tparam Traits must be a model of the concept `SearchTraits`, -for example `Search_traits_2 >`. +\tparam Traits must be a model of the concept `SearchTraits`, +for example `Search_traits_2 >`. -\tparam GeneralDistance must be a model of the -concept `GeneralDistance`. If `Traits` is -`Search_traits_adapter` -the default type is `Distance_adapter >`, -and `Euclidean_distance` otherwise. +\tparam GeneralDistance must be a model of the +concept `GeneralDistance`. If `Traits` is +`Search_traits_adapter` +the default type is `Distance_adapter >`, +and `Euclidean_distance` otherwise. -\tparam Splitter must be a model of the concept `Splitter`. -The default type is `Sliding_midpoint`. +\tparam Splitter must be a model of the concept `Splitter`. +The default type is `Sliding_midpoint`. -\tparam SpatialTree must be a model of the concept `SpatialTree`. -The default type is `Kd_tree`. The -third template argument `Tag_false` makes that the tree is built with unextended nodes. +\tparam SpatialTree must be a model of the concept `SpatialTree`. +The default type is `Kd_tree`. The +third template argument `Tag_false` makes that the tree is built with unextended nodes. -\sa `CGAL::Orthogonal_incremental_neighbor_search` +\sa `CGAL::Orthogonal_incremental_neighbor_search` */ template< typename Traits, typename GeneralDistance, typename Splitter, typename SpatialTree > class Incremental_neighbor_search { public: -/// \name Types +/// \name Types /// @{ /*! -Point type. -*/ -typedef Traits::Point_d Point_d; +Point type. +*/ +typedef Traits::Point_d Point_d; /*! -Number type. -*/ -typedef Traits::NT NT; +Number type. +*/ +typedef Traits::NT NT; /*! -Distance type. -*/ -typedef GeneralDistance Distance; +Distance type. +*/ +typedef GeneralDistance Distance; /*! -Pair of point and transformed distance. -*/ -typedef std::pair Point_with_transformed_distance; +Pair of point and transformed distance. +*/ +typedef std::pair Point_with_transformed_distance; /*! -const input iterator with value type `Point_with_transformed_distance` -for enumerating approximate neighbors. -*/ -typedef unspecified_type iterator; +const input iterator with value type `Point_with_transformed_distance` +for enumerating approximate neighbors. +*/ +typedef unspecified_type iterator; /*! -Query item type. -*/ -GeneralDistance::Query_item Query_item; +Query item type. +*/ +GeneralDistance::Query_item Query_item; /*! -The tree type. -*/ -SpatialTree Tree; +The tree type. +*/ +SpatialTree Tree; -/// @} +/// @} -/// \name Creation +/// \name Creation /// @{ /*! -Constructor for incremental neighbor searching of the query item `q` -in the points stored `tree` using a distance `d` and approximation factor `eps`. -*/ -Incremental_neighbor_search(Tree& tree, QueryItem q, NT eps=NT(0.0), -bool search_nearest=true, GeneralDistance d=GeneralDistance()); +Constructor for incremental neighbor searching of the query item `q` +in the points stored `tree` using a distance `d` and approximation factor `eps`. +*/ +Incremental_neighbor_search(Tree& tree, QueryItem q, NT eps=NT(0.0), +bool search_nearest=true, GeneralDistance d=GeneralDistance()); -/// @} +/// @} -/// \name Operations +/// \name Operations /// @{ /*! -Returns a const iterator to the approximate nearest or furthest neighbor. -*/ -iterator begin() const; +Returns a const iterator to the approximate nearest or furthest neighbor. +*/ +iterator begin() const; /*! -Returns the appropriate past-the-end const iterator. -*/ -iterator end() const; +Returns the appropriate past-the-end const iterator. +*/ +iterator end() const; /*! Inserts statistics of the search process into the output stream `s`. -*/ -std::ostream& statistics(std::ostream& s); +*/ +std::ostream& statistics(std::ostream& s); /// @} diff --git a/Spatial_searching/doc/Spatial_searching/CGAL/K_neighbor_search.h b/Spatial_searching/doc/Spatial_searching/CGAL/K_neighbor_search.h index 8f21698a2e2..109e32d6187 100644 --- a/Spatial_searching/doc/Spatial_searching/CGAL/K_neighbor_search.h +++ b/Spatial_searching/doc/Spatial_searching/CGAL/K_neighbor_search.h @@ -3,106 +3,106 @@ namespace CGAL { /*! \ingroup SearchClasses -The class `K_neighbor_search` implements approximate `k`-nearest and `k`-furthest neighbor searching -using standard search on a tree using a general distance class. The tree may be built with -extended or unextended nodes. +The class `K_neighbor_search` implements approximate `k`-nearest and `k`-furthest neighbor searching +using standard search on a tree using a general distance class. The tree may be built with +extended or unextended nodes. -\tparam Traits must be an implementation of the concept `SearchTraits`, -for example `Simple_cartesian`. +\tparam Traits must be an implementation of the concept `SearchTraits`, +for example `Simple_cartesian`. -\tparam GeneralDistance must be a model of the +\tparam GeneralDistance must be a model of the concept `GeneralDistance`. If `Traits` is -`Search_traits_adapter` -the default type is `Distance_adapter >`, +`Search_traits_adapter` +the default type is `Distance_adapter >`, and `Euclidean_distance` otherwise. \tparam Splitter must be a model of the concept `Splitter`. The default type is `Sliding_midpoint`. -\tparam SpatialTree must be an implementation of the concept `SpatialTree`. +\tparam SpatialTree must be an implementation of the concept `SpatialTree`. The default type is `Kd_tree`. The third -template argument `Tag_false` makes that the tree is built with unextended nodes. +template argument `Tag_false` makes that the tree is built with unextended nodes. -\sa `CGAL::Orthogonal_k_neighbor_search` +\sa `CGAL::Orthogonal_k_neighbor_search` */ template< typename Traits, typename GeneralDistance, typename Splitter, typename SpatialTree > class K_neighbor_search { public: -/// \name Types +/// \name Types /// @{ /*! -Point type. -*/ -typedef Traits::Point_d Point_d; +Point type. +*/ +typedef Traits::Point_d Point_d; /*! -Number type. -*/ -typedef Traits::FT FT; +Number type. +*/ +typedef Traits::FT FT; /*! -Distance type. -*/ -typedef GeneralDistance Distance; +Distance type. +*/ +typedef GeneralDistance Distance; /*! -Pair of point and transformed distance. -*/ -typedef std::pair Point_with_transformed_distance; +Pair of point and transformed distance. +*/ +typedef std::pair Point_with_transformed_distance; /*! -Bidirectional const iterator with value type `Point_with_distance` -for enumerating approximate neighbors. -*/ -typedef unspecified_type iterator; +Bidirectional const iterator with value type `Point_with_distance` +for enumerating approximate neighbors. +*/ +typedef unspecified_type iterator; /*! -Query item type. -*/ -typedef GeneralDistance::Query_item Query_item; +Query item type. +*/ +typedef GeneralDistance::Query_item Query_item; /*! -The tree type. -*/ -typedef SpatialTree Tree; +The tree type. +*/ +typedef SpatialTree Tree; -/// @} +/// @} -/// \name Creation +/// \name Creation /// @{ /*! -Constructor for searching approximately `k` neighbors of the query item `q` -in the points stored in `tree` using -distance class `d` and approximation factor `eps`. `sorted` indicates -if the computed sequence of `k`-nearest neighbors needs to be sorted. -*/ -K_neighbor_search(const Tree& tree, Query_item q, unsigned int k=1, FT eps=FT(0.0), -bool search_nearest=true, GeneralDistance d=GeneralDistance(),bool sorted=true); +Constructor for searching approximately `k` neighbors of the query item `q` +in the points stored in `tree` using +distance class `d` and approximation factor `eps`. `sorted` indicates +if the computed sequence of `k`-nearest neighbors needs to be sorted. +*/ +K_neighbor_search(const Tree& tree, Query_item q, unsigned int k=1, FT eps=FT(0.0), +bool search_nearest=true, GeneralDistance d=GeneralDistance(),bool sorted=true); -/// @} +/// @} -/// \name Operations +/// \name Operations /// @{ /*! -Returns a const iterator to the approximate nearest or furthest neighbor. -*/ -iterator begin() const; +Returns a const iterator to the approximate nearest or furthest neighbor. +*/ +iterator begin() const; /*! -Returns the appropriate past-the-end const iterator. -*/ -iterator end() const; +Returns the appropriate past-the-end const iterator. +*/ +iterator end() const; /*! Inserts statistics of the search process into the output stream `s`. -*/ -std::ostream& statistics(std::ostream& s); +*/ +std::ostream& statistics(std::ostream& s); /// @} diff --git a/Spatial_searching/doc/Spatial_searching/CGAL/Kd_tree.h b/Spatial_searching/doc/Spatial_searching/CGAL/Kd_tree.h index 9a86c03e7fe..92149e9fd1f 100644 --- a/Spatial_searching/doc/Spatial_searching/CGAL/Kd_tree.h +++ b/Spatial_searching/doc/Spatial_searching/CGAL/Kd_tree.h @@ -23,8 +23,8 @@ in a dynamically allocated array (e.g., `Epick_d` with dynamic dimension) — we says "to a lesser extent" because the points are re-created by the kd-tree in a cache-friendly order after its construction, so the coordinates are more likely to be stored in a near-optimal order on the -heap. When EnablePointsCache` is set to `Tag_true`, the points -coordinates will be cached in an optimal way. This will +heap. When EnablePointsCache` is set to `Tag_true`, the points +coordinates will be cached in an optimal way. This will increase memory consumption but provide better search performance. See also the `GeneralDistance` and `FuzzyQueryItem` concepts for additional requirements when using such a cache. @@ -109,7 +109,7 @@ template Kd_tree(InputIterator first, InputIterator beyond /*! The constructor does not build the internal data structure, and it -is also not updated after calls to `insert()`. +is also not updated after calls to `insert()`. The method `build()` is called implicitly at the first call to a query or removal member function. You can call `build()` explicitly to ensure that the next call to diff --git a/Spatial_searching/doc/Spatial_searching/CGAL/Orthogonal_incremental_neighbor_search.h b/Spatial_searching/doc/Spatial_searching/CGAL/Orthogonal_incremental_neighbor_search.h index 86a6d31438e..83b7bed8e26 100644 --- a/Spatial_searching/doc/Spatial_searching/CGAL/Orthogonal_incremental_neighbor_search.h +++ b/Spatial_searching/doc/Spatial_searching/CGAL/Orthogonal_incremental_neighbor_search.h @@ -3,105 +3,105 @@ namespace CGAL { /*! \ingroup SearchClasses -The class `Orthogonal_incremental_neighbor_search` implements incremental nearest and furthest neighbor searching on a tree. +The class `Orthogonal_incremental_neighbor_search` implements incremental nearest and furthest neighbor searching on a tree. -\tparam Traits must be a model of the concept `SearchTraits`, -for example `Search_traits_2 >`. +\tparam Traits must be a model of the concept `SearchTraits`, +for example `Search_traits_2 >`. -\tparam OrthogonalDistance must be a model of the -concept `OrthogonalDistance`. If `Traits` is -`Search_traits_adapter` -the default type is `Distance_adapter >`, -and `Euclidean_distance` otherwise. +\tparam OrthogonalDistance must be a model of the +concept `OrthogonalDistance`. If `Traits` is +`Search_traits_adapter` +the default type is `Distance_adapter >`, +and `Euclidean_distance` otherwise. -\tparam Splitter must be a model of the concept `Splitter`. -The default type is `Sliding_midpoint`. +\tparam Splitter must be a model of the concept `Splitter`. +The default type is `Sliding_midpoint`. -\tparam SpatialTree must be a model of the concept `SpatialTree`. +\tparam SpatialTree must be a model of the concept `SpatialTree`. The default type is `Kd_tree`. The third -template argument must be `Tag_true` because orthogonal search needs extended -kd tree nodes. +template argument must be `Tag_true` because orthogonal search needs extended +kd tree nodes. -\sa `CGAL::Incremental_neighbor_search` +\sa `CGAL::Incremental_neighbor_search` */ template< typename Traits, typename OrthogonalDistance, typename Splitter, typename SpatialTree > class Orthogonal_incremental_neighbor_search { public: -/// \name Types +/// \name Types /// @{ /*! -Point type. -*/ -typedef Traits::Point_d Point_d; +Point type. +*/ +typedef Traits::Point_d Point_d; /*! -Number type. -*/ -typedef Traits::FT FT; +Number type. +*/ +typedef Traits::FT FT; /*! -Distance type. -*/ -typedef OrthogonalDistance Distance; +Distance type. +*/ +typedef OrthogonalDistance Distance; /*! -Query item. -*/ -typedef OrthogonalDistance::Query_item Query_item; +Query item. +*/ +typedef OrthogonalDistance::Query_item Query_item; /*! -Pair of point and transformed distance. -*/ -typedef std::pair Point_with_transformed_distance; +Pair of point and transformed distance. +*/ +typedef std::pair Point_with_transformed_distance; /*! -const input iterator with value type `Point_with_transformed_distance` -for enumerating approximate neighbors. -*/ -typedef unspecified_type iterator; +const input iterator with value type `Point_with_transformed_distance` +for enumerating approximate neighbors. +*/ +typedef unspecified_type iterator; /*! -The tree type. -*/ -typedef SpatialTree Tree; +The tree type. +*/ +typedef SpatialTree Tree; -/// @} +/// @} -/// \name Creation +/// \name Creation /// @{ /*! -Constructor for incremental neighbor searching of the query item `query` -in the points stored `tree` using a distance `d` and approximation factor `eps`. -*/ -Orthogonal_incremental_neighbor_search(SpatialTree& tree, Query_item query, FT eps=FT(0.0), -bool search_nearest=true, -OrthogonalDistance d=OrthogonalDistance()); +Constructor for incremental neighbor searching of the query item `query` +in the points stored `tree` using a distance `d` and approximation factor `eps`. +*/ +Orthogonal_incremental_neighbor_search(SpatialTree& tree, Query_item query, FT eps=FT(0.0), +bool search_nearest=true, +OrthogonalDistance d=OrthogonalDistance()); -/// @} +/// @} -/// \name Operations +/// \name Operations /// @{ /*! -Returns a const iterator to the approximate nearest or furthest neighbor. -*/ -iterator begin() const; +Returns a const iterator to the approximate nearest or furthest neighbor. +*/ +iterator begin() const; /*! -Returns the appropriate past-the-end const iterator. -*/ -iterator end() const; +Returns the appropriate past-the-end const iterator. +*/ +iterator end() const; /*! -Inserts statistics of the search process into the output stream `s`. +Inserts statistics of the search process into the output stream `s`. -*/ -std::ostream& statistics(std::ostream& s) const; +*/ +std::ostream& statistics(std::ostream& s) const; /// @} diff --git a/Spatial_searching/doc/Spatial_searching/CGAL/Orthogonal_k_neighbor_search.h b/Spatial_searching/doc/Spatial_searching/CGAL/Orthogonal_k_neighbor_search.h index 0c6cd01b711..9246a0587ef 100644 --- a/Spatial_searching/doc/Spatial_searching/CGAL/Orthogonal_k_neighbor_search.h +++ b/Spatial_searching/doc/Spatial_searching/CGAL/Orthogonal_k_neighbor_search.h @@ -3,102 +3,102 @@ namespace CGAL { /*! \ingroup SearchClasses -The class `Orthogonal_k_neighbor_search` implements approximate`k`-nearest and -`k`-furthest neighbor searching on a tree -using an orthogonal distance class. +The class `Orthogonal_k_neighbor_search` implements approximate`k`-nearest and +`k`-furthest neighbor searching on a tree +using an orthogonal distance class. -\tparam Traits must be a model of the concept `SearchTraits`, -for example `Search_traits_2 >`. +\tparam Traits must be a model of the concept `SearchTraits`, +for example `Search_traits_2 >`. \tparam OrthogonalDistance must be a model of the -concept `OrthogonalDistance`. If `Traits` is -`Search_traits_adapter` -the default type is `Distance_adapter >`, +concept `OrthogonalDistance`. If `Traits` is +`Search_traits_adapter` +the default type is `Distance_adapter >`, and `Euclidean_distance` otherwise. -\tparam Splitter must be a model of the concept `Splitter`. -The default type is `Sliding_midpoint`. +\tparam Splitter must be a model of the concept `Splitter`. +The default type is `Sliding_midpoint`. -\tparam SpatialTree must be a model of the concept `SpatialTree`. +\tparam SpatialTree must be a model of the concept `SpatialTree`. The default type is `Kd_tree`. The third -template argument must be `Tag_true` because orthogonal search needs extended -kd tree nodes. +template argument must be `Tag_true` because orthogonal search needs extended +kd tree nodes. -\sa `CGAL::K_neighbor_search` +\sa `CGAL::K_neighbor_search` */ template< typename Traits, typename OrthogonalDistance, typename Splitter, typename SpatialTree > class Orthogonal_k_neighbor_search { public: -/// \name Types +/// \name Types /// @{ /*! -Point type. -*/ -typedef Traits::Point_d Point_d; +Point type. +*/ +typedef Traits::Point_d Point_d; /*! -Number type. -*/ -typedef Traits::FT FT; +Number type. +*/ +typedef Traits::FT FT; /*! -Distance type. -*/ -typedef OrthogonalDistance Distance; +Distance type. +*/ +typedef OrthogonalDistance Distance; /*! -Query item. -*/ -typedef GeneralDistance::Query_item Query_item; +Query item. +*/ +typedef GeneralDistance::Query_item Query_item; /*! -Pair of point and transformed distance. -*/ -typedef std::pair Point_with_transformed_distance; +Pair of point and transformed distance. +*/ +typedef std::pair Point_with_transformed_distance; /*! -Bidirectional const iterator with value type `Point_with_transformed_distance` -for enumerating approximate neighbors. -*/ -typedef unspecified_type iterator; +Bidirectional const iterator with value type `Point_with_transformed_distance` +for enumerating approximate neighbors. +*/ +typedef unspecified_type iterator; /*! -The tree type. -*/ -typedef SpatialTree Tree; +The tree type. +*/ +typedef SpatialTree Tree; -/// @} +/// @} -/// \name Operations +/// \name Operations /// @{ /*! -Constructor for searching approximately `k` neighbors of the query item `query` -in the points stored in `tree` using -distance `d` and approximation factor `eps`. `sorted` indicates -if the computed sequence of `k`-nearest neighbors needs to be sorted. -*/ -Orthogonal_k_neighbor_search(SpatialTree tree, Query_item query, unsigned int k=1, FT eps=FT(0.0), -bool search_nearest=true, -OrthogonalDistance d=OrthogonalDistance(),bool sorted=true); +Constructor for searching approximately `k` neighbors of the query item `query` +in the points stored in `tree` using +distance `d` and approximation factor `eps`. `sorted` indicates +if the computed sequence of `k`-nearest neighbors needs to be sorted. +*/ +Orthogonal_k_neighbor_search(SpatialTree tree, Query_item query, unsigned int k=1, FT eps=FT(0.0), +bool search_nearest=true, +OrthogonalDistance d=OrthogonalDistance(),bool sorted=true); /*! -Returns a const iterator to the approximate nearest or furthest neighbor. -*/ -iterator begin() const; +Returns a const iterator to the approximate nearest or furthest neighbor. +*/ +iterator begin() const; /*! -Returns the appropriate past-the-end const iterator. -*/ -iterator end() const; +Returns the appropriate past-the-end const iterator. +*/ +iterator end() const; /*! -Inserts statistics of the search process into the output stream `s`. -*/ -std::ostream& statistics(std::ostream& s); +Inserts statistics of the search process into the output stream `s`. +*/ +std::ostream& statistics(std::ostream& s); /// @} diff --git a/Spatial_searching/doc/Spatial_searching/Concepts/FuzzyQueryItem.h b/Spatial_searching/doc/Spatial_searching/Concepts/FuzzyQueryItem.h index de33e1e8140..8f6be35e2b1 100644 --- a/Spatial_searching/doc/Spatial_searching/Concepts/FuzzyQueryItem.h +++ b/Spatial_searching/doc/Spatial_searching/Concepts/FuzzyQueryItem.h @@ -2,17 +2,17 @@ \ingroup PkgSpatialSearchingDConcepts \cgalConcept -The concept `FuzzyQueryItem` describes the requirements for fuzzy `d`-dimensional spatial objects. +The concept `FuzzyQueryItem` describes the requirements for fuzzy `d`-dimensional spatial objects. \cgalHasModel `CGAL::Fuzzy_sphere` -\cgalHasModel `CGAL::Fuzzy_iso_box` +\cgalHasModel `CGAL::Fuzzy_iso_box` */ class FuzzyQueryItem { public: -/// \name Types +/// \name Types /// @{ /*! @@ -21,24 +21,24 @@ Dimension Tag. typedef unspecified_type D; /*! -represents a `d`-dimensional point. -*/ -typedef unspecified_type Point_d; +represents a `d`-dimensional point. +*/ +typedef unspecified_type Point_d; /*! -Number type. -*/ -typedef unspecified_type FT; +Number type. +*/ +typedef unspecified_type FT; -/// @} +/// @} -/// \name Operations +/// \name Operations /// @{ /*! -Test whether the query item contains `p`. -*/ -bool contains(Point_d p) const; +Test whether the query item contains `p`. +*/ +bool contains(Point_d p) const; /*! Optional: must be defined when used with a `Kd_tree` where `EnablePointsCache` @@ -50,16 +50,16 @@ template bool contains_point_given_as_coordinates(Coord_iterator begin, Coord_iterator end) const; /*! -Test whether the inner approximation of the spatial object intersects a rectangle -associated with a node of a tree. -*/ -bool inner_range_intersects(const Kd_tree_rectangle& rectangle) const; +Test whether the inner approximation of the spatial object intersects a rectangle +associated with a node of a tree. +*/ +bool inner_range_intersects(const Kd_tree_rectangle& rectangle) const; /*! -Test whether the outer approximation of the spatial object encloses the rectangle -associated with a node of a tree. -*/ -bool outer_range_contains(const Kd_tree_rectangle& rectangle) const; +Test whether the outer approximation of the spatial object encloses the rectangle +associated with a node of a tree. +*/ +bool outer_range_contains(const Kd_tree_rectangle& rectangle) const; /// @} diff --git a/Spatial_searching/doc/Spatial_searching/Concepts/GeneralDistance.h b/Spatial_searching/doc/Spatial_searching/Concepts/GeneralDistance.h index 647f719e25a..fd72ee75e07 100644 --- a/Spatial_searching/doc/Spatial_searching/Concepts/GeneralDistance.h +++ b/Spatial_searching/doc/Spatial_searching/Concepts/GeneralDistance.h @@ -2,13 +2,13 @@ \ingroup PkgSpatialSearchingDConcepts \cgalConcept -Requirements of a distance class defining a distance between a query item -denoting a spatial object and a point. -To optimize distance computations transformed distances are used, -e.g., for a Euclidean distance the transformed distance is the squared -Euclidean distance. +Requirements of a distance class defining a distance between a query item +denoting a spatial object and a point. +To optimize distance computations transformed distances are used, +e.g., for a Euclidean distance the transformed distance is the squared +Euclidean distance. -\cgalHasModel `CGAL::Manhattan_distance_iso_box_point` +\cgalHasModel `CGAL::Manhattan_distance_iso_box_point` \cgalHasModel `CGAL::Euclidean_distance_sphere_point` */ @@ -16,7 +16,7 @@ Euclidean distance. class GeneralDistance { public: -/// \name Types +/// \name Types /// @{ /*! @@ -25,29 +25,29 @@ Dimension Tag. typedef unspecified_type D; /*! -Number type. -*/ -typedef unspecified_type FT; +Number type. +*/ +typedef unspecified_type FT; /*! -Point type. -*/ -typedef unspecified_type Point_d; +Point type. +*/ +typedef unspecified_type Point_d; /*! -Query item type. -*/ -typedef unspecified_type Query_item; +Query item type. +*/ +typedef unspecified_type Query_item; -/// @} +/// @} -/// \name Operations +/// \name Operations /// @{ /*! -Returns the transformed distance between `q` and `r`. -*/ -FT transformed_distance(Query_item q, Point_d r); +Returns the transformed distance between `q` and `r`. +*/ +FT transformed_distance(Query_item q, Point_d r); /*! Optional: must be defined when used with a `Kd_tree` where `EnablePointsCache` @@ -78,26 +78,26 @@ FT interruptible_transformed_distance( Query_item q, Coord_iterator begin, Coord_iterator end, FT stop_if_geq_to_this) const; /*! -Returns the transformed distance between `q` and -the point on the boundary of `r` closest to `q`. -*/ -FT min_distance_to_rectangle(Query_item q, Kd_tree_rectangle r) const; +Returns the transformed distance between `q` and +the point on the boundary of `r` closest to `q`. +*/ +FT min_distance_to_rectangle(Query_item q, Kd_tree_rectangle r) const; /*! -Returns the transformed distance between `q` and -the point on the boundary of `r` furthest to `q`. -*/ -FT max_distance_to_rectangle(Query_item q, Kd_tree_rectangle r) const; +Returns the transformed distance between `q` and +the point on the boundary of `r` furthest to `q`. +*/ +FT max_distance_to_rectangle(Query_item q, Kd_tree_rectangle r) const; /*! -Returns the transformed distance. -*/ -FT transformed_distance(FT d) const; +Returns the transformed distance. +*/ +FT transformed_distance(FT d) const; /*! -Returns the inverse of the transformed distance. -*/ -FT inverse_of_transformed_distance(FT d) const; +Returns the inverse of the transformed distance. +*/ +FT inverse_of_transformed_distance(FT d) const; /// @} diff --git a/Spatial_searching/examples/Spatial_searching/CMakeLists.txt b/Spatial_searching/examples/Spatial_searching/CMakeLists.txt index f60f06a9bc6..a7e3bdd7983 100644 --- a/Spatial_searching/examples/Spatial_searching/CMakeLists.txt +++ b/Spatial_searching/examples/Spatial_searching/CMakeLists.txt @@ -13,10 +13,10 @@ find_package( CGAL QUIET COMPONENTS ) if ( NOT CGAL_FOUND ) message(STATUS "This project requires the CGAL library, and will not be compiled.") - return() + return() endif() - + find_package(Eigen3 3.1.91) #(requires 3.2.0 or greater) if (MSVC) diff --git a/Spatial_searching/examples/Spatial_searching/Distance.h b/Spatial_searching/examples/Spatial_searching/Distance.h index 147ffc6e7ff..3e57374778b 100644 --- a/Spatial_searching/examples/Spatial_searching/Distance.h +++ b/Spatial_searching/examples/Spatial_searching/Distance.h @@ -12,7 +12,7 @@ struct Distance { } double min_distance_to_rectangle(const Point& p, - const CGAL::Kd_tree_rectangle& b) const { + const CGAL::Kd_tree_rectangle& b) const { double distance(0.0), h = p.x(); if (h < b.min_coord(0)) distance += (b.min_coord(0)-h)*(b.min_coord(0)-h); if (h > b.max_coord(0)) distance += (h-b.max_coord(0))*(h-b.max_coord(0)); @@ -26,7 +26,7 @@ struct Distance { } double min_distance_to_rectangle(const Point& p, - const CGAL::Kd_tree_rectangle& b,std::vector& dists){ + const CGAL::Kd_tree_rectangle& b,std::vector& dists){ double distance(0.0), h = p.x(); if (h < b.min_coord(0)){ dists[0] = (b.min_coord(0)-h); @@ -59,7 +59,7 @@ struct Distance { double max_distance_to_rectangle(const Point& p, - const CGAL::Kd_tree_rectangle& b) const { + const CGAL::Kd_tree_rectangle& b) const { double h = p.x(); double d0 = (h >= (b.min_coord(0)+b.max_coord(0))/2.0) ? @@ -75,12 +75,12 @@ struct Distance { } double max_distance_to_rectangle(const Point& p, - const CGAL::Kd_tree_rectangle& b,std::vector& dists){ + const CGAL::Kd_tree_rectangle& b,std::vector& dists){ double h = p.x(); dists[0] = (h >= (b.min_coord(0)+b.max_coord(0))/2.0) ? (h-b.min_coord(0)) : (b.max_coord(0)-h); - + h=p.y(); dists[1] = (h >= (b.min_coord(1)+b.max_coord(1))/2.0) ? (h-b.min_coord(1)) : (b.max_coord(1)-h); @@ -91,7 +91,7 @@ struct Distance { } double new_distance(double& dist, double old_off, double new_off, - int /* cutting_dimension */) const { + int /* cutting_dimension */) const { return dist + new_off*new_off - old_off*old_off; } diff --git a/Spatial_searching/include/CGAL/Euclidean_distance.h b/Spatial_searching/include/CGAL/Euclidean_distance.h index 161d5b2dd55..c10be1a806c 100644 --- a/Spatial_searching/include/CGAL/Euclidean_distance.h +++ b/Spatial_searching/include/CGAL/Euclidean_distance.h @@ -6,7 +6,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Hans Tangelder () // Clement Jamin (clement.jamin.pro@gmail.com) @@ -29,7 +29,7 @@ namespace CGAL { template class Euclidean_distance; - + namespace internal{ template struct Spatial_searching_default_distance{ @@ -39,9 +39,9 @@ namespace CGAL { template class Euclidean_distance { - + SearchTraits traits; - + public: typedef typename SearchTraits::FT FT; @@ -49,7 +49,7 @@ namespace CGAL { typedef Point_d Query_item; typedef typename internal::Get_dimension_tag::Dimension D; - + // default constructor Euclidean_distance(const SearchTraits& traits_=SearchTraits()):traits(traits_) {} @@ -118,8 +118,8 @@ namespace CGAL { // During the computation, if the partially-computed distance `pcd` gets greater or equal // to `stop_if_geq_to_this`, the computation is stopped and `pcd` is returned template - inline FT interruptible_transformed_distance(const Query_item& q, - Coord_iterator it_coord_begin, Coord_iterator /*unused*/, + inline FT interruptible_transformed_distance(const Query_item& q, + Coord_iterator it_coord_begin, Coord_iterator /*unused*/, FT stop_if_geq_to_this) const { FT distance = FT(0); @@ -129,7 +129,7 @@ namespace CGAL { { // Every 4 coordinates, the current partially-computed distance // is compared to stop_if_geq_to_this - // Note: the concept SearchTraits specifies that Cartesian_const_iterator_d + // Note: the concept SearchTraits specifies that Cartesian_const_iterator_d // must be a random-access iterator typename SearchTraits::Cartesian_const_iterator_d qe_minus_5 = qe; std::advance(qe, -5); diff --git a/Spatial_searching/include/CGAL/Fuzzy_iso_box.h b/Spatial_searching/include/CGAL/Fuzzy_iso_box.h index 35ddda7649d..ed127946993 100644 --- a/Spatial_searching/include/CGAL/Fuzzy_iso_box.h +++ b/Spatial_searching/include/CGAL/Fuzzy_iso_box.h @@ -36,18 +36,18 @@ namespace CGAL { struct Is_from_point_from_adapter_traits{ typedef boost::false_type type; }; - - + + template struct Is_from_point_from_adapter_traits,Point>{ typedef typename boost::is_same type; }; } //namespace internal - + template class Fuzzy_iso_box{ SearchTraits traits; - + public: typedef typename SearchTraits::Point_d Point_d; @@ -61,8 +61,8 @@ namespace CGAL { private: - typename boost::remove_cv< - typename boost::remove_reference< typename Construct_min_vertex_d::result_type >::type + typename boost::remove_cv< + typename boost::remove_reference< typename Construct_min_vertex_d::result_type >::type >::type min, max; Cartesian_const_iterator_d min_begin, max_begin; FT eps; @@ -85,7 +85,7 @@ namespace CGAL { min_begin = construct_it(min); max_begin = construct_it(max); } - + public: // default constructor @@ -98,7 +98,7 @@ namespace CGAL { CGAL_precondition(epsilon >= 0); construct(p,q); } - + //additional constructor if SearchTraits = Search_traits_adapter template Fuzzy_iso_box(const Point& p,const Point&q,FT epsilon=FT(0),const SearchTraits& traits_=SearchTraits(), @@ -122,10 +122,10 @@ namespace CGAL { template bool contains_point_given_as_coordinates(Coord_iterator it_coord_begin, Coord_iterator /*unused*/) const { - Construct_cartesian_const_iterator_d construct_it=traits.construct_cartesian_const_iterator_d_object(); - Cartesian_const_iterator_d minit= min_begin, maxit = max_begin; - for (unsigned int i = 0; i < dim; ++i, ++it_coord_begin, ++minit, ++maxit) { - if ( ((*it_coord_begin) < (*minit)) || ((*it_coord_begin) > (*maxit)) ) + Construct_cartesian_const_iterator_d construct_it=traits.construct_cartesian_const_iterator_d_object(); + Cartesian_const_iterator_d minit= min_begin, maxit = max_begin; + for (unsigned int i = 0; i < dim; ++i, ++it_coord_begin, ++minit, ++maxit) { + if ( ((*it_coord_begin) < (*minit)) || ((*it_coord_begin) > (*maxit)) ) return false; } return true; diff --git a/Spatial_searching/include/CGAL/Incremental_neighbor_search.h b/Spatial_searching/include/CGAL/Incremental_neighbor_search.h index a4e6608caa8..785fbab2305 100644 --- a/Spatial_searching/include/CGAL/Incremental_neighbor_search.h +++ b/Spatial_searching/include/CGAL/Incremental_neighbor_search.h @@ -6,7 +6,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Hans Tangelder () // Clement Jamin (clement.jamin.pro@gmail.com) @@ -30,11 +30,11 @@ namespace CGAL { - template ::type, class Splitter_ = Sliding_midpoint, class Tree_=Kd_tree > - class Incremental_neighbor_search { + class Incremental_neighbor_search { public: @@ -63,20 +63,20 @@ namespace CGAL { :the_box(Nb), the_node(N) {} - Node_box* - box() + Node_box* + box() { - return the_box; + return the_box; } - Node_const_handle - node() + Node_const_handle + node() { - return the_node; + return the_node; } }; - - + + typedef std::pair Point_with_transformed_distance; typedef std::pair Cell_with_distance; @@ -90,7 +90,7 @@ namespace CGAL { const Tree& m_tree; Query_item m_query; Distance m_dist; - FT m_Eps; + FT m_Eps; bool m_search_nearest; public: @@ -100,25 +100,25 @@ namespace CGAL { // constructor Incremental_neighbor_search(const Tree& tree, const Query_item& q, - FT Eps=FT(0.0), bool search_nearest=true, - const Distance& tr=Distance()): + FT Eps=FT(0.0), bool search_nearest=true, + const Distance& tr=Distance()): m_tree(tree),m_query(q),m_dist(tr),m_Eps(Eps),m_search_nearest(search_nearest) {} - iterator + iterator begin() const { return iterator(m_tree,m_query,m_dist,m_Eps,m_search_nearest); } - iterator + iterator end() const { return iterator(); } - std::ostream& - statistics(std::ostream& s) + std::ostream& + statistics(std::ostream& s) { begin()->statistics(s); return s; @@ -132,7 +132,7 @@ namespace CGAL { Object_wrapper(const T& t):object(t){} const T& operator* () const { return object; } const T* operator-> () const { return &object; } - }; + }; class iterator { @@ -146,36 +146,36 @@ namespace CGAL { typedef std::size_t size_type; typedef std::ptrdiff_t difference_type; typedef int distance_type; - - + + class Iterator_implementation; Iterator_implementation *ptr; // default constructor - iterator() - : ptr(0) + iterator() + : ptr(0) {} - int - the_number_of_items_visited() + int + the_number_of_items_visited() { return ptr->number_of_items_visited; } // constructor - iterator(const Tree& tree, const Query_item& q, const Distance& tr, FT eps, - bool search_nearest) + iterator(const Tree& tree, const Query_item& q, const Distance& tr, FT eps, + bool search_nearest) : ptr(new Iterator_implementation(tree, q, tr, eps, search_nearest)) {} - + // copy constructor iterator(const iterator& Iter) - : ptr(Iter.ptr) + : ptr(Iter.ptr) { - if (ptr != 0) ptr->reference_count++; + if (ptr != 0) ptr->reference_count++; } - + iterator& operator=(const iterator& Iter) { if (ptr!=Iter.ptr){ @@ -186,23 +186,23 @@ namespace CGAL { if (ptr != 0) ptr->reference_count++; } return *this; - } - - const Point_with_transformed_distance& + } + + const Point_with_transformed_distance& operator* () const { - return *(*ptr); + return *(*ptr); } // -> operator const Point_with_transformed_distance* - operator-> () const + operator-> () const { - return &*(*ptr); - } - + return &*(*ptr); + } + // prefix operator - iterator& operator++() + iterator& operator++() { ++(*ptr); return *this; @@ -210,229 +210,229 @@ namespace CGAL { // postfix operator Object_wrapper - operator++(int) + operator++(int) { - return (*ptr)++; + return (*ptr)++; } - bool - operator==(const iterator& It) const + bool + operator==(const iterator& It) const { - if ( ((ptr == 0) || - ptr->Item_PriorityQueue.empty()) && - ((It.ptr == 0) || - It.ptr->Item_PriorityQueue.empty()) - ) - return true; + if ( ((ptr == 0) || + ptr->Item_PriorityQueue.empty()) && + ((It.ptr == 0) || + It.ptr->Item_PriorityQueue.empty()) + ) + return true; // else return (ptr == It.ptr); } - bool + bool operator!=(const iterator& It) const { return !(*this == It); } - std::ostream& - statistics (std::ostream& s) + std::ostream& + statistics (std::ostream& s) { - ptr->statistics(s); + ptr->statistics(s); return s; } - ~iterator() + ~iterator() { if (ptr != 0) { - ptr->reference_count--; - if (ptr->reference_count==0) { - delete ptr; - ptr = 0; - } + ptr->reference_count--; + if (ptr->reference_count==0) { + delete ptr; + ptr = 0; + } } } - + class Iterator_implementation { private: - FT multiplication_factor; + FT multiplication_factor; - Query_item query_point; + Query_item query_point; - FT distance_to_root; + FT distance_to_root; - bool search_nearest_neighbour; + bool search_nearest_neighbour; - FT rd; + FT rd; internal::Distance_helper m_distance_helper; int m_dim; Tree const& m_tree; - class Priority_higher { - - public: + class Priority_higher { - bool search_nearest; + public: - Priority_higher(bool search_the_nearest_neighbour) - : search_nearest(search_the_nearest_neighbour) - {} + bool search_nearest; - //highest priority is smallest distance - bool operator() (Cell_with_distance* n1, Cell_with_distance* n2) const - { - return (search_nearest)? (n1->second > n2->second) : (n2->second > n1->second); - } - }; + Priority_higher(bool search_the_nearest_neighbour) + : search_nearest(search_the_nearest_neighbour) + {} + + //highest priority is smallest distance + bool operator() (Cell_with_distance* n1, Cell_with_distance* n2) const + { + return (search_nearest)? (n1->second > n2->second) : (n2->second > n1->second); + } + }; - class Distance_smaller { + class Distance_smaller { - public: + public: - bool search_nearest; + bool search_nearest; - Distance_smaller(bool search_the_nearest_neighbour) - :search_nearest(search_the_nearest_neighbour) - {} + Distance_smaller(bool search_the_nearest_neighbour) + :search_nearest(search_the_nearest_neighbour) + {} - //highest priority is smallest distance - bool - operator() (Point_with_transformed_distance* p1, Point_with_transformed_distance* p2) const - { - return (search_nearest) ? (p1->second > p2->second) : (p2->second > p1->second); - } - }; + //highest priority is smallest distance + bool + operator() (Point_with_transformed_distance* p1, Point_with_transformed_distance* p2) const + { + return (search_nearest) ? (p1->second > p2->second) : (p2->second > p1->second); + } + }; - std::priority_queue PriorityQueue; + std::priority_queue PriorityQueue; public: - std::priority_queue Item_PriorityQueue; - + std::priority_queue Item_PriorityQueue; - Distance distance; + + Distance distance; public: - int reference_count; + int reference_count; - int number_of_internal_nodes_visited; - int number_of_leaf_nodes_visited; - int number_of_items_visited; - int number_of_neighbours_computed; + int number_of_internal_nodes_visited; + int number_of_leaf_nodes_visited; + int number_of_items_visited; + int number_of_neighbours_computed; - // constructor - Iterator_implementation(const Tree& tree, const Query_item& q,const Distance& tr, - FT Eps, bool search_nearest) - : query_point(q), search_nearest_neighbour(search_nearest), + // constructor + Iterator_implementation(const Tree& tree, const Query_item& q,const Distance& tr, + FT Eps, bool search_nearest) + : query_point(q), search_nearest_neighbour(search_nearest), m_distance_helper(tr, tree.traits()), m_tree(tree), - PriorityQueue(Priority_higher(search_nearest)), - Item_PriorityQueue(Distance_smaller(search_nearest)), - distance(tr), reference_count(1), number_of_internal_nodes_visited(0), - number_of_leaf_nodes_visited(0), number_of_items_visited(0), - number_of_neighbours_computed(0) - { + PriorityQueue(Priority_higher(search_nearest)), + Item_PriorityQueue(Distance_smaller(search_nearest)), + distance(tr), reference_count(1), number_of_internal_nodes_visited(0), + number_of_leaf_nodes_visited(0), number_of_items_visited(0), + number_of_neighbours_computed(0) + { if (tree.empty()) return; typename SearchTraits::Construct_cartesian_const_iterator_d construct_it = m_tree.traits().construct_cartesian_const_iterator_d_object(); m_dim = static_cast(std::distance(construct_it(q), construct_it(q, 0))); - multiplication_factor= distance.transformed_distance(FT(1)+Eps); + multiplication_factor= distance.transformed_distance(FT(1)+Eps); - Node_box *bounding_box = new Node_box((tree.bounding_box())); + Node_box *bounding_box = new Node_box((tree.bounding_box())); - if (search_nearest) distance_to_root= - distance.min_distance_to_rectangle(q,*bounding_box); - else distance_to_root= - distance.max_distance_to_rectangle(q,*bounding_box); + if (search_nearest) distance_to_root= + distance.min_distance_to_rectangle(q,*bounding_box); + else distance_to_root= + distance.max_distance_to_rectangle(q,*bounding_box); - - Cell *Root_Cell = new Cell(bounding_box,tree.root()); - Cell_with_distance *The_Root = - new Cell_with_distance(Root_Cell,distance_to_root); - PriorityQueue.push(The_Root); + Cell *Root_Cell = new Cell(bounding_box,tree.root()); + Cell_with_distance *The_Root = + new Cell_with_distance(Root_Cell,distance_to_root); - // rd is the distance of the top of the priority queue to q - rd=The_Root->second; - Compute_the_next_nearest_neighbour(); - } + PriorityQueue.push(The_Root); - // * operator - const Point_with_transformed_distance& - operator* () const - { - return *(Item_PriorityQueue.top()); - } + // rd is the distance of the top of the priority queue to q + rd=The_Root->second; + Compute_the_next_nearest_neighbour(); + } - // prefix operator - Iterator_implementation& - operator++() - { - Delete_the_current_item_top(); - Compute_the_next_nearest_neighbour(); - return *this; - } + // * operator + const Point_with_transformed_distance& + operator* () const + { + return *(Item_PriorityQueue.top()); + } + + // prefix operator + Iterator_implementation& + operator++() + { + Delete_the_current_item_top(); + Compute_the_next_nearest_neighbour(); + return *this; + } // postfix operator Object_wrapper - operator++(int) + operator++(int) { Object_wrapper result( *(Item_PriorityQueue.top()) ); ++*this; return result; - } + } - // Print statistics of the general priority search process. - std::ostream& - statistics (std::ostream& s) const - { - s << "General priority search statistics:" << std::endl; - s << "Number of internal nodes visited:" << - number_of_internal_nodes_visited << std::endl; - s << "Number of leaf nodes visited:" << - number_of_leaf_nodes_visited << std::endl; - s << "Number of points visited:" << - number_of_items_visited << std::endl; - s << "Number of neighbours computed:" << - number_of_neighbours_computed << std::endl; - return s; - } + // Print statistics of the general priority search process. + std::ostream& + statistics (std::ostream& s) const + { + s << "General priority search statistics:" << std::endl; + s << "Number of internal nodes visited:" << + number_of_internal_nodes_visited << std::endl; + s << "Number of leaf nodes visited:" << + number_of_leaf_nodes_visited << std::endl; + s << "Number of points visited:" << + number_of_items_visited << std::endl; + s << "Number of neighbours computed:" << + number_of_neighbours_computed << std::endl; + return s; + } - //destructor - ~Iterator_implementation() - { - while (! PriorityQueue.empty()) { - Cell_with_distance* The_top=PriorityQueue.top(); - PriorityQueue.pop(); - delete The_top->first->box(); - delete The_top->first; - delete The_top; - } - while (! Item_PriorityQueue.empty()) { - Point_with_transformed_distance* The_top=Item_PriorityQueue.top(); - Item_PriorityQueue.pop(); - delete The_top; - } - } + //destructor + ~Iterator_implementation() + { + while (! PriorityQueue.empty()) { + Cell_with_distance* The_top=PriorityQueue.top(); + PriorityQueue.pop(); + delete The_top->first->box(); + delete The_top->first; + delete The_top; + } + while (! Item_PriorityQueue.empty()) { + Point_with_transformed_distance* The_top=Item_PriorityQueue.top(); + Item_PriorityQueue.pop(); + delete The_top; + } + } private: - void - Delete_the_current_item_top() - { - Point_with_transformed_distance* The_item_top=Item_PriorityQueue.top(); - Item_PriorityQueue.pop(); - delete The_item_top; - } + void + Delete_the_current_item_top() + { + Point_with_transformed_distance* The_item_top=Item_PriorityQueue.top(); + Item_PriorityQueue.pop(); + delete The_item_top; + } // With cache @@ -509,101 +509,101 @@ namespace CGAL { return next_neighbour_found; } - void - Compute_the_next_nearest_neighbour() - { - // compute the next item - bool next_neighbour_found=false; - if (!(Item_PriorityQueue.empty())) { - if (search_nearest_neighbour) - next_neighbour_found = - (multiplication_factor*rd > Item_PriorityQueue.top()->second); - else - next_neighbour_found = - (rd < multiplication_factor*Item_PriorityQueue.top()->second); - } - while ((!next_neighbour_found) && (!PriorityQueue.empty())) { - - Cell_with_distance* The_node_top = PriorityQueue.top(); - Node_const_handle N = The_node_top->first->node(); - Node_box* B = The_node_top->first->box(); - PriorityQueue.pop(); - delete The_node_top->first; - delete The_node_top; + void + Compute_the_next_nearest_neighbour() + { + // compute the next item + bool next_neighbour_found=false; + if (!(Item_PriorityQueue.empty())) { + if (search_nearest_neighbour) + next_neighbour_found = + (multiplication_factor*rd > Item_PriorityQueue.top()->second); + else + next_neighbour_found = + (rd < multiplication_factor*Item_PriorityQueue.top()->second); + } + while ((!next_neighbour_found) && (!PriorityQueue.empty())) { - while (!(N->is_leaf())) { + Cell_with_distance* The_node_top = PriorityQueue.top(); + Node_const_handle N = The_node_top->first->node(); + Node_box* B = The_node_top->first->box(); + PriorityQueue.pop(); + delete The_node_top->first; + delete The_node_top; + + while (!(N->is_leaf())) { typename Tree::Internal_node_const_handle node = static_cast(N); - number_of_internal_nodes_visited++; - int new_cut_dim = node->cutting_dimension(); - FT new_cut_val = node->cutting_value(); - - Node_box* lower_box = new Node_box(*B); - Node_box* upper_box = new Node_box(*B); - lower_box->split(*upper_box,new_cut_dim, new_cut_val); - delete B; - if (search_nearest_neighbour) { - FT distance_to_box_lower = - distance.min_distance_to_rectangle(query_point, *lower_box); - FT distance_to_box_upper = - distance.min_distance_to_rectangle(query_point, *upper_box); - if (distance_to_box_lower <= distance_to_box_upper) { + number_of_internal_nodes_visited++; + int new_cut_dim = node->cutting_dimension(); + FT new_cut_val = node->cutting_value(); - Cell* C_upper = new Cell(upper_box, node->upper()); - Cell_with_distance *Upper_Child = - new Cell_with_distance(C_upper,distance_to_box_upper); - PriorityQueue.push(Upper_Child); - N=node->lower(); - B=lower_box; - } else { - Cell* C_lower = new Cell(lower_box, node->lower()); - Cell_with_distance *Lower_Child = - new Cell_with_distance(C_lower,distance_to_box_lower); - PriorityQueue.push(Lower_Child); - N=node->upper(); - B=upper_box; - } - } - else { // search furthest - FT distance_to_box_lower = - distance.max_distance_to_rectangle(query_point, *lower_box); - FT distance_to_box_upper = - distance.max_distance_to_rectangle(query_point, *upper_box); - if (distance_to_box_lower >= distance_to_box_upper) { - Cell* C_upper = new Cell(upper_box, node->upper()); - Cell_with_distance *Upper_Child = - new Cell_with_distance(C_upper,distance_to_box_upper); - PriorityQueue.push(Upper_Child); - N=node->lower(); - B=lower_box; - } - else { - Cell* C_lower = new Cell(lower_box, node->lower()); - Cell_with_distance *Lower_Child = - new Cell_with_distance(C_lower,distance_to_box_lower); - PriorityQueue.push(Lower_Child); - N=node->upper(); - B=upper_box; - } - } - } - delete B; + Node_box* lower_box = new Node_box(*B); + Node_box* upper_box = new Node_box(*B); + lower_box->split(*upper_box,new_cut_dim, new_cut_val); + delete B; + if (search_nearest_neighbour) { + FT distance_to_box_lower = + distance.min_distance_to_rectangle(query_point, *lower_box); + FT distance_to_box_upper = + distance.min_distance_to_rectangle(query_point, *upper_box); + if (distance_to_box_lower <= distance_to_box_upper) { + + Cell* C_upper = new Cell(upper_box, node->upper()); + Cell_with_distance *Upper_Child = + new Cell_with_distance(C_upper,distance_to_box_upper); + PriorityQueue.push(Upper_Child); + N=node->lower(); + B=lower_box; + } else { + Cell* C_lower = new Cell(lower_box, node->lower()); + Cell_with_distance *Lower_Child = + new Cell_with_distance(C_lower,distance_to_box_lower); + PriorityQueue.push(Lower_Child); + N=node->upper(); + B=upper_box; + } + } + else { // search furthest + FT distance_to_box_lower = + distance.max_distance_to_rectangle(query_point, *lower_box); + FT distance_to_box_upper = + distance.max_distance_to_rectangle(query_point, *upper_box); + if (distance_to_box_lower >= distance_to_box_upper) { + Cell* C_upper = new Cell(upper_box, node->upper()); + Cell_with_distance *Upper_Child = + new Cell_with_distance(C_upper,distance_to_box_upper); + PriorityQueue.push(Upper_Child); + N=node->lower(); + B=lower_box; + } + else { + Cell* C_lower = new Cell(lower_box, node->lower()); + Cell_with_distance *Lower_Child = + new Cell_with_distance(C_lower,distance_to_box_lower); + PriorityQueue.push(Lower_Child); + N=node->upper(); + B=upper_box; + } + } + } + delete B; // N is a leaf typename Tree::Leaf_node_const_handle node = static_cast(N); - number_of_leaf_nodes_visited++; - if (node->size() > 0) { + number_of_leaf_nodes_visited++; + if (node->size() > 0) { typename internal::Has_points_cache::type::value>::type dummy; next_neighbour_found = search_in_leaf(node, dummy, !search_nearest_neighbour); - } - } // next_neighbour_found or priority queue is empty - // in the latter case also the item priority queue is empty - - } + } + } // next_neighbour_found or priority queue is empty + // in the latter case also the item priority queue is empty + + } }; // class Iterator_implementation }; // class iterator - }; // class + }; // class } // namespace CGAL diff --git a/Spatial_searching/include/CGAL/K_neighbor_search.h b/Spatial_searching/include/CGAL/K_neighbor_search.h index acf2953804c..aaa8c4ef6d7 100644 --- a/Spatial_searching/include/CGAL/K_neighbor_search.h +++ b/Spatial_searching/include/CGAL/K_neighbor_search.h @@ -6,7 +6,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Hans Tangelder (), // Clement Jamin (clement.jamin.pro@gmail.com) @@ -26,10 +26,10 @@ namespace CGAL { - template + template class K_neighbor_search; -template ::type, class Splitter= Sliding_midpoint , class Tree= Kd_tree > @@ -37,12 +37,12 @@ class K_neighbor_search: public internal::K_neighbor_search Base; typedef typename Tree::Point_d Point; - + public: - typedef typename Base::FT FT; + typedef typename Base::FT FT; typedef typename internal::Get_dimension_tag::Dimension D; - K_neighbor_search(const Tree& tree, const typename Base::Query_item& q, + K_neighbor_search(const Tree& tree, const typename Base::Query_item& q, unsigned int k=1, FT Eps=FT(0.0), bool Search_nearest=true, const Distance& d=Distance(),bool sorted=true) : Base(q,k,Eps,Search_nearest,d), m_distance_helper(this->distance_instance, tree.traits()), @@ -54,15 +54,15 @@ public: if (sorted) this->queue.sort(); }; -private: - typedef typename Base::Node_const_handle Node_const_handle; +private: + typedef typename Base::Node_const_handle Node_const_handle; using Base::branch; internal::Distance_helper m_distance_helper; Tree const& m_tree; - void - compute_neighbors_general(typename Base::Node_const_handle N, const Kd_tree_rectangle& r) + void + compute_neighbors_general(typename Base::Node_const_handle N, const Kd_tree_rectangle& r) { if (!(N->is_leaf())) { typename Tree::Internal_node_const_handle node = @@ -80,46 +80,46 @@ private: FT distance_to_lower_half; FT distance_to_upper_half; - if (this->search_nearest) { + if (this->search_nearest) { - distance_to_lower_half = - this->distance_instance. min_distance_to_rectangle(this->query_object, + distance_to_lower_half = + this->distance_instance. min_distance_to_rectangle(this->query_object, r_lower); - - distance_to_upper_half = - this->distance_instance.min_distance_to_rectangle(this->query_object, + + distance_to_upper_half = + this->distance_instance.min_distance_to_rectangle(this->query_object, r_upper); - - } + + } else - { + { - distance_to_lower_half = - this->distance_instance.max_distance_to_rectangle(this->query_object, + distance_to_lower_half = + this->distance_instance.max_distance_to_rectangle(this->query_object, r_lower); - distance_to_upper_half = - this->distance_instance.max_distance_to_rectangle(this->query_object, + distance_to_upper_half = + this->distance_instance.max_distance_to_rectangle(this->query_object, r_upper); } - if ( (( this->search_nearest) && - (distance_to_lower_half < distance_to_upper_half)) + if ( (( this->search_nearest) && + (distance_to_lower_half < distance_to_upper_half)) || - ((!this->search_nearest) && - (distance_to_lower_half >= + ((!this->search_nearest) && + (distance_to_lower_half >= distance_to_upper_half)) ) { compute_neighbors_general(node->lower(), r_lower); - if (branch(distance_to_upper_half)) + if (branch(distance_to_upper_half)) compute_neighbors_general (node->upper(), r_upper); - } + } else - { compute_neighbors_general(node->upper(), r_upper); - if (branch(distance_to_lower_half)) - compute_neighbors_general (node->lower(), + { compute_neighbors_general(node->upper(), r_upper); + if (branch(distance_to_lower_half)) + compute_neighbors_general (node->lower(), r_lower); } @@ -133,7 +133,7 @@ private: if (node->size() > 0) { typename internal::Has_points_cache::type::value>::type dummy; - if (this->search_nearest) + if (this->search_nearest) search_nearest_in_leaf(node, dummy); else search_furthest_in_leaf(node, dummy); @@ -248,7 +248,7 @@ private: } } -}; // class +}; // class } // namespace CGAL diff --git a/Spatial_searching/include/CGAL/Kd_tree.h b/Spatial_searching/include/CGAL/Kd_tree.h index cdc17b4632a..4694c885a95 100644 --- a/Spatial_searching/include/CGAL/Kd_tree.h +++ b/Spatial_searching/include/CGAL/Kd_tree.h @@ -135,7 +135,7 @@ private: leaf_nodes.push_back(node); Leaf_node_handle nh = &leaf_nodes.back(); - + return nh; } @@ -204,8 +204,8 @@ private: nh->upper_ch = create_leaf_node(c); } - - + + return nh; } @@ -236,7 +236,7 @@ private: nh->upper_ch = create_leaf_node(c); } - + return nh; } @@ -251,7 +251,7 @@ public: template Kd_tree(InputIterator first, InputIterator beyond, - Splitter s = Splitter(),const SearchTraits traits=SearchTraits()) + Splitter s = Splitter(),const SearchTraits traits=SearchTraits()) : traits_(traits),split(s), built_(false), removed_(false) { pts.insert(pts.end(), first, beyond); @@ -430,11 +430,11 @@ private: Internal_node_handle newparent = static_cast(node); // FIXME: This should be if(xcutting_dimension()] <= newparent->cutting_value()) { - if (remove_(p, parent, islower, newparent, true, newparent->lower(), equal_to_p)) - return true; + if (remove_(p, parent, islower, newparent, true, newparent->lower(), equal_to_p)) + return true; } //if (traits().construct_cartesian_const_iterator_d_object()(p)[newparent->cutting_dimension()] >= newparent->cutting_value()) - return remove_(p, parent, islower, newparent, false, newparent->upper(), equal_to_p); + return remove_(p, parent, islower, newparent, false, newparent->upper(), equal_to_p); } @@ -446,8 +446,8 @@ private: if (pi == lnode->end()) return false; iterator lasti = lnode->end() - 1; if (pi != lasti) { - // Hack to get a non-const iterator - std::iter_swap(pts.begin()+(pi-pts.begin()), pts.begin()+(lasti-pts.begin())); + // Hack to get a non-const iterator + std::iter_swap(pts.begin()+(pi-pts.begin()), pts.begin()+(lasti-pts.begin())); } lnode->drop_last_point(); } else if (!equal_to_p(*lnode->begin())) { @@ -456,9 +456,9 @@ private: } else if (grandparent) { Node_handle brother = islower ? parent->upper() : parent->lower(); if (parent_islower) - grandparent->set_lower(brother); + grandparent->set_lower(brother); else - grandparent->set_upper(brother); + grandparent->set_upper(brother); } else if (parent) { tree_root = islower ? parent->upper() : parent->lower(); } else { @@ -488,7 +488,7 @@ public: if(! pts.empty()){ if(! is_built()){ - const_build(); + const_build(); } Kd_tree_rectangle b(*bbox); return tree_root->search(it,q,b,begin(),cache_begin(),dim_); @@ -504,7 +504,7 @@ public: if(! pts.empty()){ if(! is_built()){ - const_build(); + const_build(); } Kd_tree_rectangle b(*bbox); return tree_root->search_any_point(q,b,begin(),cache_begin(),dim_); @@ -549,7 +549,7 @@ public: { if(! pts.empty()){ if(! is_built()){ - const_build(); + const_build(); } root()->print(); }else{ diff --git a/Spatial_searching/include/CGAL/Kd_tree_node.h b/Spatial_searching/include/CGAL/Kd_tree_node.h index a80c06ca6e1..270a95b9e91 100644 --- a/Spatial_searching/include/CGAL/Kd_tree_node.h +++ b/Spatial_searching/include/CGAL/Kd_tree_node.h @@ -6,7 +6,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Authors : Hans Tangelder () @@ -27,7 +27,7 @@ namespace CGAL { CGAL_GENERATE_MEMBER_DETECTOR(contains_point_given_as_coordinates); - template + template class Kd_tree; template < class TreeTraits, class Splitter, class UseExtendedNode, class EnablePointsCache > @@ -53,7 +53,7 @@ namespace CGAL { bool leaf; - public : + public : Kd_tree_node(bool leaf_) :leaf(leaf_){} @@ -61,18 +61,18 @@ namespace CGAL { return leaf; } - std::size_t + std::size_t num_items() const { if (is_leaf()){ - Leaf_node_const_handle node = + Leaf_node_const_handle node = static_cast(this); return node->size(); } else { - Internal_node_const_handle node = + Internal_node_const_handle node = static_cast(this); - return node->lower()->num_items() + node->upper()->num_items(); + return node->lower()->num_items() + node->upper()->num_items(); } } @@ -81,48 +81,48 @@ namespace CGAL { { if (is_leaf()) return 1; else { - Internal_node_const_handle node = + Internal_node_const_handle node = static_cast(this); - return node->lower()->num_nodes() + node->upper()->num_nodes(); + return node->lower()->num_nodes() + node->upper()->num_nodes(); } } - int + int depth(const int current_max_depth) const { if (is_leaf()){ - return current_max_depth; + return current_max_depth; } else { - Internal_node_const_handle node = + Internal_node_const_handle node = static_cast(this); - return - (std::max)( node->lower()->depth(current_max_depth + 1), - node->upper()->depth(current_max_depth + 1)); + return + (std::max)( node->lower()->depth(current_max_depth + 1), + node->upper()->depth(current_max_depth + 1)); } } - int + int depth() const { - return depth(1); + return depth(1); } template - OutputIterator + OutputIterator tree_items(OutputIterator it) const { if (is_leaf()) { - Leaf_node_const_handle node = + Leaf_node_const_handle node = static_cast(this); - if (node->size()>0) - for (iterator i=node->begin(); i != node->end(); i++) - {*it=*i; ++it;} - } + if (node->size()>0) + for (iterator i=node->begin(); i != node->end(); i++) + {*it=*i; ++it;} + } else { - Internal_node_const_handle node = + Internal_node_const_handle node = static_cast(this); - it=node->lower()->tree_items(it); - it=node->upper()->tree_items(it); + it=node->lower()->tree_items(it); + it=node->upper()->tree_items(it); } return it; } @@ -134,14 +134,14 @@ namespace CGAL { if (is_leaf()) { Leaf_node_const_handle node = static_cast(this); - if (node->size()>0){ + if (node->size()>0){ return boost::make_optional(*(node->begin())); } - } + } else { Internal_node_const_handle node = static_cast(this); - result = node->lower()->any_tree_item(); + result = node->lower()->any_tree_item(); if(! result){ result = node->upper()->any_tree_item(); } @@ -150,52 +150,52 @@ namespace CGAL { } - void + void indent(int d) const { for(int i = 0; i < d; i++){ - std::cout << " "; + std::cout << " "; } } - void - print(int d = 0) const + void + print(int d = 0) const { if (is_leaf()) { - Leaf_node_const_handle node = + Leaf_node_const_handle node = static_cast(this); - indent(d); - std::cout << "leaf" << std::endl; - if (node->size()>0) - for (iterator i=node->begin(); i != node->end(); i++) - {indent(d);std::cout << *i << std::endl;} + indent(d); + std::cout << "leaf" << std::endl; + if (node->size()>0) + for (iterator i=node->begin(); i != node->end(); i++) + {indent(d);std::cout << *i << std::endl;} } else { - Internal_node_const_handle node = + Internal_node_const_handle node = static_cast(this); - indent(d); - std::cout << "lower tree" << std::endl; - node->lower()->print(d+1); - indent(d); - std::cout << "separator: dim = " << node->cutting_dimension() << " val = " << node->cutting_value() << std::endl; - indent(d); - std::cout << "upper tree" << std::endl; - node->upper()->print(d+1); + indent(d); + std::cout << "lower tree" << std::endl; + node->lower()->print(d+1); + indent(d); + std::cout << "separator: dim = " << node->cutting_dimension() << " val = " << node->cutting_value() << std::endl; + indent(d); + std::cout << "upper tree" << std::endl; + node->upper()->print(d+1); } } template - OutputIterator + OutputIterator search(OutputIterator it, const FuzzyQueryItem& q, - Kd_tree_rectangle& b, + Kd_tree_rectangle& b, typename Kdt::const_iterator tree_points_begin, typename std::vector::const_iterator cache_begin, int dim) const { - if (is_leaf()) { - Leaf_node_const_handle node = + if (is_leaf()) { + Leaf_node_const_handle node = static_cast(this); if (node->size() > 0) { @@ -204,61 +204,61 @@ namespace CGAL { } } else { - Internal_node_const_handle node = + Internal_node_const_handle node = static_cast(this); - // after splitting b denotes the lower part of b - Kd_tree_rectangle b_upper(b); - node->split_bbox(b, b_upper); + // after splitting b denotes the lower part of b + Kd_tree_rectangle b_upper(b); + node->split_bbox(b, b_upper); - if (q.outer_range_contains(b)) - it=node->lower()->tree_items(it); - else - if (q.inner_range_intersects(b)) - it=node->lower()->search(it,q,b,tree_points_begin,cache_begin,dim); - if (q.outer_range_contains(b_upper)) - it=node->upper()->tree_items(it); - else - if (q.inner_range_intersects(b_upper)) - it=node->upper()->search(it,q,b_upper,tree_points_begin,cache_begin,dim); + if (q.outer_range_contains(b)) + it=node->lower()->tree_items(it); + else + if (q.inner_range_intersects(b)) + it=node->lower()->search(it,q,b,tree_points_begin,cache_begin,dim); + if (q.outer_range_contains(b_upper)) + it=node->upper()->tree_items(it); + else + if (q.inner_range_intersects(b_upper)) + it=node->upper()->search(it,q,b_upper,tree_points_begin,cache_begin,dim); }; - return it; + return it; } template boost::optional search_any_point(const FuzzyQueryItem& q, - Kd_tree_rectangle& b, + Kd_tree_rectangle& b, typename Kdt::const_iterator tree_points_begin, typename std::vector::const_iterator cache_begin, int dim) const { boost::optional result = boost::none; - if (is_leaf()) { - Leaf_node_const_handle node = + if (is_leaf()) { + Leaf_node_const_handle node = static_cast(this); - if (node->size()>0) + if (node->size()>0) { typename internal::Has_points_cache::type::value>::type dummy; result = search_any_point_in_leaf(node, q, tree_points_begin, cache_begin, dim, dummy); } } else { - Internal_node_const_handle node = + Internal_node_const_handle node = static_cast(this); - // after splitting b denotes the lower part of b - Kd_tree_rectangle b_upper(b); - node->split_bbox(b, b_upper); + // after splitting b denotes the lower part of b + Kd_tree_rectangle b_upper(b); + node->split_bbox(b, b_upper); - if (q.inner_range_intersects(b)) { - result = node->lower()->search_any_point(q,b,tree_points_begin,cache_begin,dim); - if(result) - return result; - } - if (q.inner_range_intersects(b_upper)) - result = node->upper()->search_any_point(q,b_upper,tree_points_begin,cache_begin,dim); + if (q.inner_range_intersects(b)) { + result = node->lower()->search_any_point(q,b,tree_points_begin,cache_begin,dim); + if(result) + return result; + } + if (q.inner_range_intersects(b_upper)) + result = node->upper()->search_any_point(q,b_upper,tree_points_begin,cache_begin,dim); } - return result; + return result; } private: @@ -289,12 +289,12 @@ namespace CGAL { // With cache template OutputIterator search_in_leaf( - Leaf_node_const_handle node, + Leaf_node_const_handle node, const FuzzyQueryItem &q, typename Kdt::const_iterator tree_points_begin, typename std::vector::const_iterator cache_begin, int dim, - OutputIterator oit, + OutputIterator oit, Tag_true /*has_points_cache*/) const { typename Kdt::iterator it_node_point = node->begin(), it_node_point_end = node->end(); @@ -330,7 +330,7 @@ namespace CGAL { // With cache template boost::optional search_any_point_in_leaf( - Leaf_node_const_handle node, + Leaf_node_const_handle node, const FuzzyQueryItem &q, typename Kdt::const_iterator tree_points_begin, typename std::vector::const_iterator cache_begin, @@ -376,60 +376,60 @@ namespace CGAL { }; - template < class TreeTraits, class Splitter, class UseExtendedNode, class EnablePointsCache > + template < class TreeTraits, class Splitter, class UseExtendedNode, class EnablePointsCache > class Kd_tree_leaf_node : public Kd_tree_node< TreeTraits, Splitter, UseExtendedNode, EnablePointsCache >{ friend class Kd_tree; - + typedef typename Kd_tree::iterator iterator; typedef Kd_tree_node< TreeTraits, Splitter, UseExtendedNode, EnablePointsCache> Base; typedef typename TreeTraits::Point_d Point_d; private: - + // private variables for leaf nodes boost::int32_t n; // denotes number of items in a leaf node iterator data; // iterator to data in leaf node - + public: - + // default constructor - Kd_tree_leaf_node() + Kd_tree_leaf_node() {} - Kd_tree_leaf_node(bool leaf_ ) + Kd_tree_leaf_node(bool leaf_ ) : Base(leaf_) {} - Kd_tree_leaf_node(bool leaf_,unsigned int n_ ) + Kd_tree_leaf_node(bool leaf_,unsigned int n_ ) : Base(leaf_), n(n_) {} // members for all nodes - + // members for leaf nodes only - inline - unsigned int - size() const - { + inline + unsigned int + size() const + { return n; } - - inline + + inline iterator - begin() const + begin() const { return data; } - inline - iterator - end() const + inline + iterator + end() const { return data + n; } - + inline void drop_last_point() @@ -441,7 +441,7 @@ namespace CGAL { - template < class TreeTraits, class Splitter, class UseExtendedNode, class EnablePointsCache> + template < class TreeTraits, class Splitter, class UseExtendedNode, class EnablePointsCache> class Kd_tree_internal_node : public Kd_tree_node< TreeTraits, Splitter, UseExtendedNode, EnablePointsCache >{ friend class Kd_tree; @@ -457,7 +457,7 @@ namespace CGAL { typedef typename Kdt::D D; private: - + // private variables for internal nodes boost::int32_t cut_dim; FT cut_val; @@ -470,48 +470,48 @@ namespace CGAL { FT lower_low_val; FT lower_high_val; - + public: // default constructor - Kd_tree_internal_node() + Kd_tree_internal_node() {} - Kd_tree_internal_node(bool leaf_) + Kd_tree_internal_node(bool leaf_) : Base(leaf_) {} - - + + // members for internal node and extended internal node - inline - Node_const_handle - lower() const + inline + Node_const_handle + lower() const { - return lower_ch; + return lower_ch; } - inline - Node_const_handle - upper() const + inline + Node_const_handle + upper() const { - return upper_ch; + return upper_ch; } - inline - Node_handle + inline + Node_handle lower() { - return lower_ch; + return lower_ch; } - inline - Node_handle + inline + Node_handle upper() { - return upper_ch; + return upper_ch; } - + inline void set_lower(Node_handle nh) @@ -533,23 +533,23 @@ namespace CGAL { cut_dim = sep.cutting_dimension(); cut_val = sep.cutting_value(); } - - inline - FT - cutting_value() const + + inline + FT + cutting_value() const { return cut_val; } - - inline - int - cutting_dimension() const + + inline + int + cutting_dimension() const { return cut_dim; } // members for extended internal node only - inline + inline FT upper_low_value() const { @@ -577,8 +577,8 @@ namespace CGAL { return lower_high_val; } - /*Separator& - separator() + /*Separator& + separator() { return Separator(cutting_dimension,cutting_value); }*/ @@ -592,11 +592,11 @@ namespace CGAL { };//internal node template < class TreeTraits, class Splitter, class EnablePointsCache> - class Kd_tree_internal_node + class Kd_tree_internal_node : public Kd_tree_node< TreeTraits, Splitter, Tag_false, EnablePointsCache > { friend class Kd_tree; - + typedef Kd_tree Kdt; typedef Kd_tree_node< TreeTraits, Splitter, Tag_false, EnablePointsCache> Base; @@ -608,54 +608,54 @@ namespace CGAL { typedef typename Kdt::D D; private: - + // private variables for internal nodes boost::uint8_t cut_dim; FT cut_val; Node_handle lower_ch, upper_ch; - + public: // default constructor - Kd_tree_internal_node() + Kd_tree_internal_node() {} - Kd_tree_internal_node(bool leaf_) + Kd_tree_internal_node(bool leaf_) : Base(leaf_) {} - - + + // members for internal node and extended internal node - inline - Node_const_handle - lower() const + inline + Node_const_handle + lower() const { - return lower_ch; + return lower_ch; } - inline - Node_const_handle - upper() const + inline + Node_const_handle + upper() const { - return upper_ch; + return upper_ch; } - inline - Node_handle + inline + Node_handle lower() { - return lower_ch; + return lower_ch; } - inline - Node_handle + inline + Node_handle upper() { - return upper_ch; + return upper_ch; } - + inline void set_lower(Node_handle nh) @@ -678,23 +678,23 @@ namespace CGAL { cut_dim = static_cast(sep.cutting_dimension()); cut_val = sep.cutting_value(); } - - inline - FT - cutting_value() const + + inline + FT + cutting_value() const { return cut_val; } - - inline - int - cutting_dimension() const + + inline + int + cutting_dimension() const { return cut_dim; } - /* Separator& - separator() + /* Separator& + separator() { return Separator(cutting_dimension,cutting_value); }*/ diff --git a/Spatial_searching/include/CGAL/Orthogonal_incremental_neighbor_search.h b/Spatial_searching/include/CGAL/Orthogonal_incremental_neighbor_search.h index 6710af8c3d7..fbd97d783cf 100644 --- a/Spatial_searching/include/CGAL/Orthogonal_incremental_neighbor_search.h +++ b/Spatial_searching/include/CGAL/Orthogonal_incremental_neighbor_search.h @@ -6,7 +6,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Hans Tangelder () // Clement Jamin (clement.jamin.pro@gmail.com) @@ -30,7 +30,7 @@ namespace CGAL { - template ::type, class Splitter_ = Sliding_midpoint, class Tree_= Kd_tree > @@ -53,7 +53,7 @@ namespace CGAL { template struct Object_wrapper - { + { T object; Object_wrapper(const T& t):object(t){} const T& operator* () const { return object; } @@ -72,12 +72,12 @@ namespace CGAL { private: typedef std::vector Distance_vector; - + Distance_vector dists; Distance orthogonal_distance_instance; internal::Distance_helper m_distance_helper; - + FT multiplication_factor; Query_item query_point; @@ -96,15 +96,15 @@ namespace CGAL { bool search_nearest; - Priority_higher(bool search_the_nearest_neighbour) - : search_nearest(search_the_nearest_neighbour) - {} + Priority_higher(bool search_the_nearest_neighbour) + : search_nearest(search_the_nearest_neighbour) + {} //highest priority is smallest distance - bool - operator() (Node_with_distance* n1, Node_with_distance* n2) const - { - return (search_nearest) ? (std::get<1>(*n1) > std::get<1>(*n2)) : (std::get<1>(*n2) > std::get<1>(*n1)); + bool + operator() (Node_with_distance* n1, Node_with_distance* n2) const + { + return (search_nearest) ? (std::get<1>(*n1) > std::get<1>(*n2)) : (std::get<1>(*n2) > std::get<1>(*n1)); } }; @@ -114,46 +114,46 @@ namespace CGAL { bool search_nearest; - Distance_smaller(bool search_the_nearest_neighbour) - : search_nearest(search_the_nearest_neighbour) - {} + Distance_smaller(bool search_the_nearest_neighbour) + : search_nearest(search_the_nearest_neighbour) + {} //highest priority is smallest distance bool operator() (Point_with_transformed_distance* p1, Point_with_transformed_distance* p2) const - { - return (search_nearest) ? (p1->second > p2->second) : (p2->second > p1->second); + { + return (search_nearest) ? (p1->second > p2->second) : (p2->second > p1->second); } }; std::priority_queue PriorityQueue; + Priority_higher> PriorityQueue; public: std::priority_queue Item_PriorityQueue; + Distance_smaller> Item_PriorityQueue; public: int reference_count; - + // constructor Iterator_implementation(const Tree& tree,const Query_item& q, const Distance& tr, - FT Eps=FT(0.0), bool search_nearest=true) - : traits(tree.traits()),number_of_neighbours_computed(0), number_of_internal_nodes_visited(0), - number_of_leaf_nodes_visited(0), number_of_items_visited(0), - orthogonal_distance_instance(tr), + FT Eps=FT(0.0), bool search_nearest=true) + : traits(tree.traits()),number_of_neighbours_computed(0), number_of_internal_nodes_visited(0), + number_of_leaf_nodes_visited(0), number_of_items_visited(0), + orthogonal_distance_instance(tr), m_distance_helper(orthogonal_distance_instance, traits), - multiplication_factor(orthogonal_distance_instance.transformed_distance(FT(1.0)+Eps)), - query_point(q), search_nearest_neighbour(search_nearest), + multiplication_factor(orthogonal_distance_instance.transformed_distance(FT(1.0)+Eps)), + query_point(q), search_nearest_neighbour(search_nearest), m_tree(tree), - PriorityQueue(Priority_higher(search_nearest)), Item_PriorityQueue(Distance_smaller(search_nearest)), - reference_count(1) - - + PriorityQueue(Priority_higher(search_nearest)), Item_PriorityQueue(Distance_smaller(search_nearest)), + reference_count(1) + + { if (m_tree.empty()) return; @@ -164,12 +164,12 @@ namespace CGAL { for(int i=0 ; i - operator++(int) + operator++(int) { Object_wrapper result( *(Item_PriorityQueue.top()) ); ++*this; @@ -221,41 +221,41 @@ namespace CGAL { } // Print statistics of the general priority search process. - std::ostream& + std::ostream& statistics (std::ostream& s) const { - s << "Orthogonal priority search statistics:" - << std::endl; - s << "Number of internal nodes visited:" - << number_of_internal_nodes_visited << std::endl; - s << "Number of leaf nodes visited:" - << number_of_leaf_nodes_visited << std::endl; - s << "Number of items visited:" - << number_of_items_visited << std::endl; - s << "Number of neighbours computed:" - << number_of_neighbours_computed << std::endl; + s << "Orthogonal priority search statistics:" + << std::endl; + s << "Number of internal nodes visited:" + << number_of_internal_nodes_visited << std::endl; + s << "Number of leaf nodes visited:" + << number_of_leaf_nodes_visited << std::endl; + s << "Number of items visited:" + << number_of_items_visited << std::endl; + s << "Number of neighbours computed:" + << number_of_neighbours_computed << std::endl; return s; } //destructor - ~Iterator_implementation() + ~Iterator_implementation() { - while (!PriorityQueue.empty()) { - Node_with_distance* The_top=PriorityQueue.top(); - PriorityQueue.pop(); - delete The_top; - } - while (!Item_PriorityQueue.empty()) { - Point_with_transformed_distance* The_top=Item_PriorityQueue.top(); - Item_PriorityQueue.pop(); - delete The_top; + while (!PriorityQueue.empty()) { + Node_with_distance* The_top=PriorityQueue.top(); + PriorityQueue.pop(); + delete The_top; + } + while (!Item_PriorityQueue.empty()) { + Point_with_transformed_distance* The_top=Item_PriorityQueue.top(); + Item_PriorityQueue.pop(); + delete The_top; } } private: - void - Delete_the_current_item_top() + void + Delete_the_current_item_top() { Point_with_transformed_distance* The_item_top=Item_PriorityQueue.top(); Item_PriorityQueue.pop(); @@ -308,93 +308,93 @@ namespace CGAL { { typename Tree::iterator it_node_point = node->begin(), it_node_point_end = node->end(); - for (; it_node_point != it_node_point_end; ++it_node_point) + for (; it_node_point != it_node_point_end; ++it_node_point) { - number_of_items_visited++; - FT distance_to_query_point= + number_of_items_visited++; + FT distance_to_query_point= orthogonal_distance_instance.transformed_distance(query_point, *it_node_point); - Point_with_transformed_distance *NN_Candidate = - new Point_with_transformed_distance(*it_node_point, distance_to_query_point); - Item_PriorityQueue.push(NN_Candidate); - } - // old top of PriorityQueue has been processed, - // hence update rd + Point_with_transformed_distance *NN_Candidate = + new Point_with_transformed_distance(*it_node_point, distance_to_query_point); + Item_PriorityQueue.push(NN_Candidate); + } + // old top of PriorityQueue has been processed, + // hence update rd bool next_neighbour_found; - if (!(PriorityQueue.empty())) + if (!(PriorityQueue.empty())) { - rd = CGAL::cpp11::get<1>(*PriorityQueue.top()); + rd = CGAL::cpp11::get<1>(*PriorityQueue.top()); next_neighbour_found = (search_furthest ? multiplication_factor*rd < Item_PriorityQueue.top()->second : multiplication_factor*rd > Item_PriorityQueue.top()->second); - } - else // priority queue empty => last neighbour found - { - next_neighbour_found=true; - } + } + else // priority queue empty => last neighbour found + { + next_neighbour_found=true; + } - number_of_neighbours_computed++; + number_of_neighbours_computed++; return next_neighbour_found; } - void - Compute_the_next_nearest_neighbour() + void + Compute_the_next_nearest_neighbour() { // compute the next item bool next_neighbour_found=false; if (!(Item_PriorityQueue.empty())) { - next_neighbour_found= - (multiplication_factor*rd > Item_PriorityQueue.top()->second); + next_neighbour_found= + (multiplication_factor*rd > Item_PriorityQueue.top()->second); } - typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=traits.construct_cartesian_const_iterator_d_object(); - typename SearchTraits::Cartesian_const_iterator_d query_point_it = construct_it(query_point); + typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=traits.construct_cartesian_const_iterator_d_object(); + typename SearchTraits::Cartesian_const_iterator_d query_point_it = construct_it(query_point); // otherwise browse the tree further while ((!next_neighbour_found) && (!PriorityQueue.empty())) { - Node_with_distance* The_node_top=PriorityQueue.top(); - Node_const_handle N= std::get<0>(*The_node_top); + Node_with_distance* The_node_top=PriorityQueue.top(); + Node_const_handle N= std::get<0>(*The_node_top); dists = std::get<2>(*The_node_top); - PriorityQueue.pop(); - delete The_node_top; - FT copy_rd=rd; - while (!(N->is_leaf())) { // compute new distance + PriorityQueue.pop(); + delete The_node_top; + FT copy_rd=rd; + while (!(N->is_leaf())) { // compute new distance typename Tree::Internal_node_const_handle node = static_cast(N); - number_of_internal_nodes_visited++; - int new_cut_dim=node->cutting_dimension(); - FT new_rd,dst = dists[new_cut_dim]; - FT val = *(query_point_it + new_cut_dim); + number_of_internal_nodes_visited++; + int new_cut_dim=node->cutting_dimension(); + FT new_rd,dst = dists[new_cut_dim]; + FT val = *(query_point_it + new_cut_dim); FT diff1 = val - node->upper_low_value(); FT diff2 = val - node->lower_high_value(); - if (diff1 + diff2 < FT(0.0)) { + if (diff1 + diff2 < FT(0.0)) { new_rd= - orthogonal_distance_instance.new_distance(copy_rd,dst,diff1,new_cut_dim); - - CGAL_assertion(new_rd >= copy_rd); + orthogonal_distance_instance.new_distance(copy_rd,dst,diff1,new_cut_dim); + + CGAL_assertion(new_rd >= copy_rd); dists[new_cut_dim] = diff1; Node_with_distance *Upper_Child = - new Node_with_distance(node->upper(), new_rd, dists); - PriorityQueue.push(Upper_Child); + new Node_with_distance(node->upper(), new_rd, dists); + PriorityQueue.push(Upper_Child); dists[new_cut_dim] = dst; - N=node->lower(); + N=node->lower(); - } - else { // compute new distance - new_rd=orthogonal_distance_instance.new_distance(copy_rd,dst,diff2,new_cut_dim); - CGAL_assertion(new_rd >= copy_rd); + } + else { // compute new distance + new_rd=orthogonal_distance_instance.new_distance(copy_rd,dst,diff2,new_cut_dim); + CGAL_assertion(new_rd >= copy_rd); dists[new_cut_dim] = diff2; - Node_with_distance *Lower_Child = - new Node_with_distance(node->lower(), new_rd, dists); - PriorityQueue.push(Lower_Child); + Node_with_distance *Lower_Child = + new Node_with_distance(node->lower(), new_rd, dists); + PriorityQueue.push(Lower_Child); dists[new_cut_dim] = dst; - N=node->upper(); - } - } - // n is a leaf + N=node->upper(); + } + } + // n is a leaf typename Tree::Leaf_node_const_handle node = static_cast(N); - number_of_leaf_nodes_visited++; + number_of_leaf_nodes_visited++; if (node->size() > 0) { typename internal::Has_points_cache::type::value>::type dummy; next_neighbour_found = search_in_leaf(node, dummy, false); @@ -404,62 +404,62 @@ namespace CGAL { } - void - Compute_the_next_furthest_neighbour() + void + Compute_the_next_furthest_neighbour() { // compute the next item bool next_neighbour_found=false; if (!(Item_PriorityQueue.empty())) { - next_neighbour_found= - (rd < multiplication_factor*Item_PriorityQueue.top()->second); + next_neighbour_found= + (rd < multiplication_factor*Item_PriorityQueue.top()->second); } - typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=traits.construct_cartesian_const_iterator_d_object(); - typename SearchTraits::Cartesian_const_iterator_d query_point_it = construct_it(query_point); + typename SearchTraits::Construct_cartesian_const_iterator_d construct_it=traits.construct_cartesian_const_iterator_d_object(); + typename SearchTraits::Cartesian_const_iterator_d query_point_it = construct_it(query_point); // otherwise browse the tree further while ((!next_neighbour_found) && (!PriorityQueue.empty())) { - Node_with_distance* The_node_top=PriorityQueue.top(); - Node_const_handle N= std::get<0>(*The_node_top); + Node_with_distance* The_node_top=PriorityQueue.top(); + Node_const_handle N= std::get<0>(*The_node_top); dists = std::get<2>(*The_node_top); - PriorityQueue.pop(); - delete The_node_top; - FT copy_rd=rd; - while (!(N->is_leaf())) { // compute new distance + PriorityQueue.pop(); + delete The_node_top; + FT copy_rd=rd; + while (!(N->is_leaf())) { // compute new distance typename Tree::Internal_node_const_handle node = static_cast(N); - number_of_internal_nodes_visited++; - int new_cut_dim=node->cutting_dimension(); - FT new_rd,dst = dists[new_cut_dim]; - FT val = *(query_point_it + new_cut_dim); + number_of_internal_nodes_visited++; + int new_cut_dim=node->cutting_dimension(); + FT new_rd,dst = dists[new_cut_dim]; + FT val = *(query_point_it + new_cut_dim); FT diff1 = val - node->upper_low_value(); FT diff2 = val - node->lower_high_value(); - if (diff1 + diff2 < FT(0.0)) { + if (diff1 + diff2 < FT(0.0)) { diff1 = val - node->upper_high_value(); new_rd= - orthogonal_distance_instance.new_distance(copy_rd,dst,diff1,new_cut_dim); - Node_with_distance *Lower_Child = - new Node_with_distance(node->lower(), copy_rd, dists); - PriorityQueue.push(Lower_Child); - N=node->upper(); + orthogonal_distance_instance.new_distance(copy_rd,dst,diff1,new_cut_dim); + Node_with_distance *Lower_Child = + new Node_with_distance(node->lower(), copy_rd, dists); + PriorityQueue.push(Lower_Child); + N=node->upper(); dists[new_cut_dim] = diff1; - copy_rd=new_rd; + copy_rd=new_rd; - } - else { // compute new distance + } + else { // compute new distance diff2 = val - node->lower_low_value(); - new_rd=orthogonal_distance_instance.new_distance(copy_rd,dst,diff2,new_cut_dim); - Node_with_distance *Upper_Child = - new Node_with_distance(node->upper(), copy_rd, dists); - PriorityQueue.push(Upper_Child); - N=node->lower(); + new_rd=orthogonal_distance_instance.new_distance(copy_rd,dst,diff2,new_cut_dim); + Node_with_distance *Upper_Child = + new Node_with_distance(node->upper(), copy_rd, dists); + PriorityQueue.push(Upper_Child); + N=node->lower(); dists[new_cut_dim] = diff2; - copy_rd=new_rd; - } - } - // n is a leaf + copy_rd=new_rd; + } + } + // n is a leaf typename Tree::Leaf_node_const_handle node = static_cast(N); - number_of_leaf_nodes_visited++; - if (node->size() > 0) { + number_of_leaf_nodes_visited++; + if (node->size() > 0) { typename internal::Has_points_cache::type::value>::type dummy; next_neighbour_found = search_in_leaf(node, dummy, true); } @@ -467,40 +467,40 @@ namespace CGAL { // in the latter case also the item priority quee is empty } }; // class Iterator_implementaion - - + + public: class iterator; typedef iterator const_iterator; // constructor - Orthogonal_incremental_neighbor_search(const Tree& tree, - const Query_item& q, FT Eps = FT(0.0), - bool search_nearest=true, const Distance& tr=Distance()) + Orthogonal_incremental_neighbor_search(const Tree& tree, + const Query_item& q, FT Eps = FT(0.0), + bool search_nearest=true, const Distance& tr=Distance()) : m_tree(tree),m_query(q),m_dist(tr),m_Eps(Eps),m_search_nearest(search_nearest) {} - iterator + iterator begin() const { return iterator(m_tree,m_query,m_dist,m_Eps,m_search_nearest); } - iterator + iterator end() const { return iterator(); } - std::ostream& - statistics(std::ostream& s) + std::ostream& + statistics(std::ostream& s) { begin()->statistics(s); return s; @@ -528,24 +528,24 @@ namespace CGAL { public: // default constructor - iterator() + iterator() : Ptr_implementation(0) {} - int - the_number_of_items_visited() + int + the_number_of_items_visited() { return Ptr_implementation->number_of_items_visited; } // constructor - iterator(const Tree& tree,const Query_item& q, const Distance& tr=Distance(), FT eps=FT(0.0), - bool search_nearest=true) - : Ptr_implementation(new Iterator_implementation(tree, q, tr, eps, search_nearest)) - {} + iterator(const Tree& tree,const Query_item& q, const Distance& tr=Distance(), FT eps=FT(0.0), + bool search_nearest=true) + : Ptr_implementation(new Iterator_implementation(tree, q, tr, eps, search_nearest)) + {} // copy constructor - iterator(const iterator& Iter) + iterator(const iterator& Iter) { Ptr_implementation = Iter.Ptr_implementation; if (Ptr_implementation != 0) Ptr_implementation->reference_count++; @@ -561,25 +561,25 @@ namespace CGAL { if (Ptr_implementation != 0) Ptr_implementation->reference_count++; } return *this; - } - - - const Point_with_transformed_distance& - operator* () const - { - return *(*Ptr_implementation); } - + + + const Point_with_transformed_distance& + operator* () const + { + return *(*Ptr_implementation); + } + // -> operator const Point_with_transformed_distance* - operator-> () const + operator-> () const { - return &*(*Ptr_implementation); + return &*(*Ptr_implementation); } // prefix operator - iterator& - operator++() + iterator& + operator++() { ++(*Ptr_implementation); return *this; @@ -587,47 +587,47 @@ namespace CGAL { // postfix operator Object_wrapper - operator++(int) + operator++(int) { - return (*Ptr_implementation)++; + return (*Ptr_implementation)++; } - bool - operator==(const iterator& It) const + bool + operator==(const iterator& It) const { if ( - ((Ptr_implementation == 0) || - Ptr_implementation->Item_PriorityQueue.empty()) && - ((It.Ptr_implementation == 0) || - It.Ptr_implementation->Item_PriorityQueue.empty()) - ) - return true; + ((Ptr_implementation == 0) || + Ptr_implementation->Item_PriorityQueue.empty()) && + ((It.Ptr_implementation == 0) || + It.Ptr_implementation->Item_PriorityQueue.empty()) + ) + return true; // else return (Ptr_implementation == It.Ptr_implementation); } - bool - operator!=(const iterator& It) const + bool + operator!=(const iterator& It) const { return !(*this == It); } - std::ostream& - statistics (std::ostream& s) + std::ostream& + statistics (std::ostream& s) { - Ptr_implementation->statistics(s); + Ptr_implementation->statistics(s); return s; } - ~iterator() + ~iterator() { if (Ptr_implementation != 0) { - Ptr_implementation->reference_count--; - if (Ptr_implementation->reference_count==0) { - delete Ptr_implementation; - Ptr_implementation = 0; - } + Ptr_implementation->reference_count--; + if (Ptr_implementation->reference_count==0) { + delete Ptr_implementation; + Ptr_implementation = 0; + } } } @@ -638,17 +638,17 @@ namespace CGAL { const Tree& m_tree; Query_item m_query; Distance m_dist; - FT m_Eps; + FT m_Eps; bool m_search_nearest; - }; // class + }; // class template - void swap (typename Orthogonal_incremental_neighbor_search::iterator& x, - typename Orthogonal_incremental_neighbor_search::iterator& y) + void swap (typename Orthogonal_incremental_neighbor_search::iterator& x, + typename Orthogonal_incremental_neighbor_search::iterator& y) { - typename Orthogonal_incremental_neighbor_search::iterator::Iterator_implementation *tmp = x.Ptr_implementation; x.Ptr_implementation = y.Ptr_implementation; diff --git a/Spatial_searching/include/CGAL/Orthogonal_k_neighbor_search.h b/Spatial_searching/include/CGAL/Orthogonal_k_neighbor_search.h index 5d5ea80f62e..0249e2065b9 100644 --- a/Spatial_searching/include/CGAL/Orthogonal_k_neighbor_search.h +++ b/Spatial_searching/include/CGAL/Orthogonal_k_neighbor_search.h @@ -6,7 +6,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Gael Guennebaud (gael.guennebaud@inria.fr), // Hans Tangelder (), @@ -26,7 +26,7 @@ namespace CGAL { -template ::type, class Splitter= Sliding_midpoint , class Tree= Kd_tree > @@ -40,7 +40,7 @@ public: private: typename SearchTraits::Cartesian_const_iterator_d query_object_it; - + internal::Distance_helper m_distance_helper; std::vector dists; int m_dim; @@ -48,9 +48,9 @@ private: public: - Orthogonal_k_neighbor_search(const Tree& tree, const typename Base::Query_item& q, + Orthogonal_k_neighbor_search(const Tree& tree, const typename Base::Query_item& q, unsigned int k=1, FT Eps=FT(0.0), bool Search_nearest=true, const Distance& d=Distance(),bool sorted=true) - : Base(q,k,Eps,Search_nearest,d), + : Base(q,k,Eps,Search_nearest,d), m_distance_helper(this->distance_instance, tree.traits()), m_tree(tree) { @@ -66,7 +66,7 @@ public: dists[i]=0; FT distance_to_root; - if (this->search_nearest){ + if (this->search_nearest){ distance_to_root = this->distance_instance.min_distance_to_rectangle(q, tree.bounding_box(),dists); compute_nearest_neighbors_orthogonally(tree.root(), distance_to_root); } @@ -88,7 +88,7 @@ private: for (; !this->queue.full() && it_node_point != it_node_point_end; ++it_node_point) { this->number_of_items_visited++; - + FT distance_to_query_object = m_distance_helper.transformed_distance_from_coordinates( this->query_object, *it_node_point, cache_point_begin, cache_point_begin + m_dim); @@ -196,7 +196,7 @@ private: } dists[new_cut_dim] = dst; } - } + } // With cache void search_furthest_in_leaf(typename Tree::Leaf_node_const_handle node, Tag_true) @@ -237,7 +237,7 @@ private: if (N->is_leaf()) { // n is a leaf - typename Tree::Leaf_node_const_handle node = + typename Tree::Leaf_node_const_handle node = static_cast(N); this->number_of_leaf_nodes_visited++; if (node->size() > 0) @@ -248,7 +248,7 @@ private: } else { - typename Tree::Internal_node_const_handle node = + typename Tree::Internal_node_const_handle node = static_cast(N); this->number_of_internal_nodes_visited++; int new_cut_dim=node->cutting_dimension(); @@ -257,7 +257,7 @@ private: FT val = *(query_object_it + new_cut_dim); FT diff1 = val - node->lower_high_value(); FT diff2 = val - node->upper_low_value(); - if ( (diff1 + diff2 >= FT(0.0)) ) + if ( (diff1 + diff2 >= FT(0.0)) ) { new_off = node->upper_low_value()+node->upper_high_value() > val*2? val - node->upper_high_value(): @@ -277,13 +277,13 @@ private: FT dst=dists[new_cut_dim]; FT new_rd = this->distance_instance.new_distance(rd,dst,new_off,new_cut_dim); dists[new_cut_dim]=new_off; - if (this->branch_furthest(new_rd)) + if (this->branch_furthest(new_rd)) compute_furthest_neighbors_orthogonally(otherChild, new_rd); dists[new_cut_dim]=dst; } } - -}; // class + +}; // class } // namespace CGAL diff --git a/Spatial_searching/include/CGAL/Search_traits_adapter.h b/Spatial_searching/include/CGAL/Search_traits_adapter.h index d7ac0549565..9d17b72dc20 100644 --- a/Spatial_searching/include/CGAL/Search_traits_adapter.h +++ b/Spatial_searching/include/CGAL/Search_traits_adapter.h @@ -6,7 +6,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Sebastien Loriot @@ -30,13 +30,13 @@ namespace CGAL{ using ::get; - + template class Search_traits_adapter; - + template class Distance_adapter; - + namespace internal{ BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(Has_typedef_Iso_box_d,Iso_box_d,false) @@ -55,7 +55,7 @@ struct Get_iso_box_d { typedef typename T::Iso_box_d type; }; - + template struct Spatial_searching_default_distance< ::CGAL::Search_traits_adapter >{ typedef ::CGAL::Distance_adapter }; } //namespace internal - - + + template class Search_traits_adapter : public Base_traits{ PointPropertyMap ppmap; @@ -78,21 +78,21 @@ public: const Base_traits& base=Base_traits() ):Base_traits(base),ppmap(ppmap_){} - + typedef Point_with_info Point_d; typedef typename Base_traits::FT FT; typedef typename Base_traits::Dimension Dimension; - + // Default if point map is lvalue: use Construct_cartesian_const_iterator_d struct Construct_cartesian_const_iterator_d_lvalue: public Base_traits::Construct_cartesian_const_iterator_d{ PointPropertyMap ppmap; typedef typename Base_traits::Construct_cartesian_const_iterator_d Base; - + Construct_cartesian_const_iterator_d_lvalue (const typename Base_traits::Construct_cartesian_const_iterator_d& base, const PointPropertyMap& ppmap_) :Base_traits::Construct_cartesian_const_iterator_d(base), ppmap(ppmap_){} - + typename Base_traits::Cartesian_const_iterator_d operator()(const Point_with_info& p) const { return Base::operator() (get(ppmap,p)); } @@ -100,9 +100,9 @@ public: { return Base::operator() (get(ppmap,p),0); } // These 2 additional operators forward the call to Base_traits. - // This is needed because of an undocumented requirement of - // Orthogonal_k_neighbor_search and Orthogonal_incremental_neighbor_search: - // Traits::Construct_cartesian_const_iterator should be callable + // This is needed because of an undocumented requirement of + // Orthogonal_k_neighbor_search and Orthogonal_incremental_neighbor_search: + // Traits::Construct_cartesian_const_iterator should be callable // on the query point type. If the query point type is the same as // Point_with_info, we disable it. @@ -122,7 +122,7 @@ public: ) const { return Base::operator() (p,0); } }; - + // If point map is not lvalue, use this work-around that stores a // Point object in a shared pointer to avoid iterating on a temp // object @@ -136,7 +136,7 @@ public: typename std::iterator_traits::value_type, std::random_access_iterator_tag > Facade; - + typedef typename std::iterator_traits::value_type Dereference_type; typedef typename boost::property_traits::value_type @@ -146,13 +146,13 @@ public: std::size_t idx; public: - + No_lvalue_iterator() : point(NULL), idx(0) { } No_lvalue_iterator(const Point& point) : point(new Point(point)), idx(0) { } No_lvalue_iterator(const Point& point, int) : point(new Point(point)), idx(Base::Dimension::value) { } - + private: - + friend class boost::iterator_core_access; void increment() { @@ -164,7 +164,7 @@ public: --idx; CGAL_assertion(point != boost::shared_ptr()); } - + void advance(std::ptrdiff_t n) { idx += n; @@ -174,7 +174,7 @@ public: std::ptrdiff_t distance_to(const No_lvalue_iterator& other) const { return other.idx - this->idx; - + } bool equal(const No_lvalue_iterator& other) const { @@ -191,11 +191,11 @@ public: struct Construct_cartesian_const_iterator_d_no_lvalue { typedef No_lvalue_iterator result_type; PointPropertyMap ppmap; - + Construct_cartesian_const_iterator_d_no_lvalue (const typename Base_traits::Construct_cartesian_const_iterator_d&, const PointPropertyMap& ppmap_) : ppmap(ppmap_) { } - + No_lvalue_iterator operator()(const Point_with_info& p) const { return No_lvalue_iterator(get(ppmap, p)); } @@ -203,9 +203,9 @@ public: { return No_lvalue_iterator(get(ppmap, p),0); } // These 2 additional operators forward the call to Base_traits. - // This is needed because of an undocumented requirement of - // Orthogonal_k_neighbor_search and Orthogonal_incremental_neighbor_search: - // Traits::Construct_cartesian_const_iterator should be callable + // This is needed because of an undocumented requirement of + // Orthogonal_k_neighbor_search and Orthogonal_incremental_neighbor_search: + // Traits::Construct_cartesian_const_iterator should be callable // on the query point type. If the query point type is the same as // Point_with_info, we disable it. @@ -242,7 +242,7 @@ public: Construct_cartesian_const_iterator_d_lvalue, Construct_cartesian_const_iterator_d_no_lvalue>::type Construct_cartesian_const_iterator_d; - + struct Construct_iso_box_d: public Base::Construct_iso_box_d{ PointPropertyMap ppmap; typedef typename Base_traits::FT FT; // needed for VC++, because otherwise it is taken from the private typedef of the base class @@ -256,9 +256,9 @@ public: return Base_functor::operator() (get(ppmap,p),get(ppmap,q)); } }; - + const PointPropertyMap& point_property_map() const {return ppmap;} - + Construct_cartesian_const_iterator_d construct_cartesian_const_iterator_d_object() const { return Construct_cartesian_const_iterator_d( Base::construct_cartesian_const_iterator_d_object(), @@ -271,7 +271,7 @@ class Distance_adapter : public Base_distance { PointPropertyMap ppmap; public: - + Distance_adapter( const PointPropertyMap& ppmap_=PointPropertyMap(), const Base_distance& distance=Base_distance() ):Base_distance(distance),ppmap(ppmap_){} @@ -282,7 +282,7 @@ public: typedef Point_with_info Point_d; typedef typename Base_distance::Query_item Query_item; - const PointPropertyMap& point_property_map() const {return ppmap;} + const PointPropertyMap& point_property_map() const {return ppmap;} FT transformed_distance(const Query_item& p1, const Point_with_info& p2) const { @@ -305,12 +305,12 @@ public: FT max_distance_to_rectangle(const Query_item& p,const CGAL::Kd_tree_rectangle& b) const { return Base_distance::max_distance_to_rectangle(p,b); - } + } template FT max_distance_to_rectangle(const Query_item& p,const CGAL::Kd_tree_rectangle& b,std::vector& dists) const { return Base_distance::max_distance_to_rectangle(p,b,dists); - } + } }; }//namespace CGAL diff --git a/Spatial_searching/include/CGAL/internal/Search_helpers.h b/Spatial_searching/include/CGAL/internal/Search_helpers.h index d63b2deedb7..3f22036e33c 100644 --- a/Spatial_searching/include/CGAL/internal/Search_helpers.h +++ b/Spatial_searching/include/CGAL/internal/Search_helpers.h @@ -6,7 +6,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Clement Jamin (clement.jamin.pro@gmail.com) diff --git a/Spatial_searching/test/Spatial_searching/Distance.h b/Spatial_searching/test/Spatial_searching/Distance.h index f8c02b846e5..8d69237bf2a 100644 --- a/Spatial_searching/test/Spatial_searching/Distance.h +++ b/Spatial_searching/test/Spatial_searching/Distance.h @@ -12,7 +12,7 @@ struct Distance { template double min_distance_to_rectangle(const Point& p, - const CGAL::Kd_tree_rectangle& b) const { + const CGAL::Kd_tree_rectangle& b) const { double distance(0.0), h = p.x(); if (h < b.min_coord(0)) distance += (b.min_coord(0)-h)*(b.min_coord(0)-h); if (h > b.max_coord(0)) distance += (h-b.max_coord(0))*(h-b.max_coord(0)); @@ -27,7 +27,7 @@ struct Distance { template double min_distance_to_rectangle(const Point& p, - const CGAL::Kd_tree_rectangle& b,std::vector& dists) const { + const CGAL::Kd_tree_rectangle& b,std::vector& dists) const { double distance(0.0), h = p.x(); if (h < b.min_coord(0)){ dists[0] = (b.min_coord(0)-h); @@ -57,15 +57,15 @@ struct Distance { } return distance; } - + template double max_distance_to_rectangle(const Point& p, - const CGAL::Kd_tree_rectangle& b) const { + const CGAL::Kd_tree_rectangle& b) const { double h = p.x(); double d0 = (h >= (b.min_coord(0)+b.max_coord(0))/2.0) ? (h-b.min_coord(0))*(h-b.min_coord(0)) : (b.max_coord(0)-h)*(b.max_coord(0)-h); - + h=p.y(); double d1 = (h >= (b.min_coord(1)+b.max_coord(1))/2.0) ? (h-b.min_coord(1))*(h-b.min_coord(1)) : (b.max_coord(1)-h)*(b.max_coord(1)-h); @@ -77,12 +77,12 @@ struct Distance { template double max_distance_to_rectangle(const Point& p, - const CGAL::Kd_tree_rectangle& b,std::vector& dists) const { + const CGAL::Kd_tree_rectangle& b,std::vector& dists) const { double h = p.x(); dists[0] = (h >= (b.min_coord(0)+b.max_coord(0))/2.0) ? (h-b.min_coord(0)) : (b.max_coord(0)-h); - + h=p.y(); dists[1] = (h >= (b.min_coord(1)+b.max_coord(1))/2.0) ? (h-b.min_coord(1)) : (b.max_coord(1)-h); @@ -91,14 +91,14 @@ struct Distance { (h-b.min_coord(2)) : (b.max_coord(2)-h); return dists[0] * dists[0] + dists[1] * dists[1] + dists[2] * dists[2]; } - + double new_distance(double& dist, double old_off, double new_off, - int /*cutting_dimension*/) const { + int /*cutting_dimension*/) const { return dist + new_off*new_off - old_off*old_off; } - + double transformed_distance(double d) const { return d*d; } - + double inverse_of_transformed_distance(double d) const { return std::sqrt(d); } - + }; // end of struct Distance diff --git a/Spatial_sorting/doc/Spatial_sorting/CGAL/Hilbert_policy_tags.h b/Spatial_sorting/doc/Spatial_sorting/CGAL/Hilbert_policy_tags.h index 45293faa567..fcad7194a58 100644 --- a/Spatial_sorting/doc/Spatial_sorting/CGAL/Hilbert_policy_tags.h +++ b/Spatial_sorting/doc/Spatial_sorting/CGAL/Hilbert_policy_tags.h @@ -40,8 +40,8 @@ struct Middle { }; /*! \ingroup PkgSpatialSortingUtils -`Hilbert_policy` is a policy class which can be used to parameterize a strategy policy -in order to specify the strategy for spatial sorting. +`Hilbert_policy` is a policy class which can be used to parameterize a strategy policy +in order to specify the strategy for spatial sorting. `Hilbert_policy` or `Hilbert_policy` can be passed as parameter to `hilbert_sort()` to choose the sorting policy. @@ -50,10 +50,10 @@ can be passed as parameter to `hilbert_sort()` to choose the sorting policy. \cgalModels `DefaultConstructible` \cgalModels `CopyConstructible` -\sa `Median` -\sa `Middle` -\sa `Hilbert_sort_median_policy` -\sa `Hilbert_sort_middle_policy` +\sa `Median` +\sa `Middle` +\sa `Hilbert_sort_median_policy` +\sa `Hilbert_sort_middle_policy` */ template< typename Tag > struct Hilbert_policy { }; @@ -61,14 +61,14 @@ struct Hilbert_policy { }; /*! \ingroup PkgSpatialSortingUtils -A typedef to `Hilbert_policy`. +A typedef to `Hilbert_policy`. */ typedef Hilbert_policy Hilbert_sort_median_policy; /*! \ingroup PkgSpatialSortingUtils -A typedef to `Hilbert_policy`. +A typedef to `Hilbert_policy`. */ typedef Hilbert_policy Hilbert_sort_middle_policy; diff --git a/Spatial_sorting/doc/Spatial_sorting/CGAL/Hilbert_sort_2.h b/Spatial_sorting/doc/Spatial_sorting/CGAL/Hilbert_sort_2.h index 65cab7f099c..a8de51a2033 100644 --- a/Spatial_sorting/doc/Spatial_sorting/CGAL/Hilbert_sort_2.h +++ b/Spatial_sorting/doc/Spatial_sorting/CGAL/Hilbert_sort_2.h @@ -3,12 +3,12 @@ namespace CGAL { /*! \ingroup PkgSpatialSortingFunctionObjects -The function object `Hilbert_sort_2` sorts iterator ranges of -`Traits::Point_2` along a Hilbert curve by recursively subdividing +The function object `Hilbert_sort_2` sorts iterator ranges of +`Traits::Point_2` along a Hilbert curve by recursively subdividing at the median or the middle, depending on the `PolicyTag` (see Section \ref sechilbert_sorting for more information on the policies). -\tparam Traits must be a model of the concept `SpatialSortingTraits_2`. +\tparam Traits must be a model of the concept `SpatialSortingTraits_2`. \tparam PolicyTag is used to specify the strategy policy. Possible values are \link CGAL::Hilbert_sort_median_policy `Hilbert_sort_median_policy` \endlink @@ -23,23 +23,23 @@ Parallel sorting is available only when the median strategy policy (the default class Hilbert_sort_2 { public: -/// \name Creation +/// \name Creation /// @{ /*! -constructs an instance with `traits` as traits class instance. -*/ -Hilbert_sort_2(const Traits &traits = Traits()); +constructs an instance with `traits` as traits class instance. +*/ +Hilbert_sort_2(const Traits &traits = Traits()); -/// @} +/// @} -/// \name Operations +/// \name Operations /// @{ /*! -It sorts the range `[begin, end)`. +It sorts the range `[begin, end)`. \tparam InputPointIterator must be a model of `RandomAccessIterator` with value type `Traits::Point_2`. -*/ +*/ template void operator() (InputPointIterator begin, InputPointIterator end) const; diff --git a/Spatial_sorting/doc/Spatial_sorting/CGAL/Hilbert_sort_3.h b/Spatial_sorting/doc/Spatial_sorting/CGAL/Hilbert_sort_3.h index 4e2f4028dff..0f4a3a7e583 100644 --- a/Spatial_sorting/doc/Spatial_sorting/CGAL/Hilbert_sort_3.h +++ b/Spatial_sorting/doc/Spatial_sorting/CGAL/Hilbert_sort_3.h @@ -3,12 +3,12 @@ namespace CGAL { /*! \ingroup PkgSpatialSortingFunctionObjects -The function object `Hilbert_sort_3` sorts iterator ranges of -`Traits::Point_3` along a Hilbert curve by recursively subdividing at the median +The function object `Hilbert_sort_3` sorts iterator ranges of +`Traits::Point_3` along a Hilbert curve by recursively subdividing at the median or the middle, depending on the `PolicyTag`(see Section \ref sechilbert_sorting for more information on the policies). -\tparam Traits must be a model of the concept `SpatialSortingTraits_3`. +\tparam Traits must be a model of the concept `SpatialSortingTraits_3`. \tparam PolicyTag is used to specify the strategy policy. Possible values are \link CGAL::Hilbert_sort_median_policy `Hilbert_sort_median_policy` \endlink @@ -23,23 +23,23 @@ template< typename Traits, typename PolicyTag, typename ConcurrencyTag = Sequent class Hilbert_sort_3 { public: -/// \name Creation +/// \name Creation /// @{ /*! -constructs an instance with `traits` as traits class instance. -*/ -Hilbert_sort_3(const Traits &traits = Traits()); +constructs an instance with `traits` as traits class instance. +*/ +Hilbert_sort_3(const Traits &traits = Traits()); -/// @} +/// @} -/// \name Operations +/// \name Operations /// @{ /*! -It sorts the range `[begin, end)`. +It sorts the range `[begin, end)`. \tparam InputPointIterator must be a model of `RandomAccessIterator` with value type `Traits::Point_3`. -*/ +*/ template void operator() (InputPointIterator begin, InputPointIterator end) const; diff --git a/Spatial_sorting/doc/Spatial_sorting/CGAL/Hilbert_sort_d.h b/Spatial_sorting/doc/Spatial_sorting/CGAL/Hilbert_sort_d.h index 5e5b5b11e24..0e0fbc33e26 100644 --- a/Spatial_sorting/doc/Spatial_sorting/CGAL/Hilbert_sort_d.h +++ b/Spatial_sorting/doc/Spatial_sorting/CGAL/Hilbert_sort_d.h @@ -3,11 +3,11 @@ namespace CGAL { /*! \ingroup PkgSpatialSortingFunctionObjects -The function object `Hilbert_sort_d` sorts iterator ranges of -`Traits::Point_d` along a Hilbert curve by recursively subdividing at the median -or the middle depending on the `PolicyTag`. +The function object `Hilbert_sort_d` sorts iterator ranges of +`Traits::Point_d` along a Hilbert curve by recursively subdividing at the median +or the middle depending on the `PolicyTag`. -\tparam Traits must be a model for `SpatialSortingTraits_d`. +\tparam Traits must be a model for `SpatialSortingTraits_d`. \tparam PolicyTag is used to specify the strategy policy. Possible values are \link CGAL::Hilbert_sort_median_policy `Hilbert_sort_median_policy` \endlink @@ -18,23 +18,23 @@ template< typename Traits, typename PolicyTag > class Hilbert_sort_d { public: -/// \name Creation +/// \name Creation /// @{ /*! -constructs an instance with `traits` as traits class instance. -*/ -Hilbert_sort_d(const Traits &traits = Traits()); +constructs an instance with `traits` as traits class instance. +*/ +Hilbert_sort_d(const Traits &traits = Traits()); -/// @} +/// @} -/// \name Operations +/// \name Operations /// @{ /*! -It sorts the range `[begin, end)`. +It sorts the range `[begin, end)`. \tparam InputPointIterator must be a model of `RandomAccessIterator` with value type `Traits::Point_d`. -*/ +*/ template void operator() (InputPointIterator begin, InputPointIterator end) const; diff --git a/Spatial_sorting/doc/Spatial_sorting/CGAL/Hilbert_sort_on_sphere_3.h b/Spatial_sorting/doc/Spatial_sorting/CGAL/Hilbert_sort_on_sphere_3.h index cfc2b40d19d..3217d7ce0b0 100644 --- a/Spatial_sorting/doc/Spatial_sorting/CGAL/Hilbert_sort_on_sphere_3.h +++ b/Spatial_sorting/doc/Spatial_sorting/CGAL/Hilbert_sort_on_sphere_3.h @@ -3,14 +3,14 @@ namespace CGAL { /*! \ingroup PkgSpatialSortingFunctionObjects -The function object `Hilbert_sort_on_sphere_3` sorts iterator ranges of +The function object `Hilbert_sort_on_sphere_3` sorts iterator ranges of `Traits::Point_3` along a Hilbert curve on a given sphere. Actually, it approximates a Hilbert curve on that sphere by a Hilbert curve on a certain cube. For each face of that cube, it calls an appropriate version of `Hilbert_sort_2` which sorts a subset of the iterator range. `Hilbert_sort_2` in each face is called with the median or the middle policy depending on the `PolicyTag`. The input points are supposed to be close to the input sphere. If input points are not close to the input sphere, this function still works, but it might not be a good sorting function. -\tparam Traits must be a model for `SpatialSortingTraits_3`. +\tparam Traits must be a model for `SpatialSortingTraits_3`. \tparam PolicyTag is used to specify the strategy policy. Possible values are \link CGAL::Hilbert_sort_median_policy `Hilbert_sort_median_policy` \endlink @@ -21,28 +21,28 @@ template< typename Traits, typename PolicyTag > class Hilbert_sort_on_sphere_3 { public: -/// \name Creation +/// \name Creation /// @{ /*! constructs an instance with `traits` as traits class instance, `sq_r` as the squared_radius of the given sphere, and `p` as the center of the given sphere. \pre The value of \f$sq\_r\f$ should be greater than 0. -*/ -Hilbert_sort_on_sphere_3(const Traits &traits = Traits(), - double sq_r = 1.0, - const Traits::Point_3 &p = Traits::Point_3(0,0,0)); +*/ +Hilbert_sort_on_sphere_3(const Traits &traits = Traits(), + double sq_r = 1.0, + const Traits::Point_3 &p = Traits::Point_3(0,0,0)); -/// @} +/// @} -/// \name Operations +/// \name Operations /// @{ /*! -It sorts the range `[begin, end)` along a hilbert curve on the sphere centered at `p` with squared radius `sq_r`; -these arguments are passed in the construction of the object `Hilbert_sort_on_sphere_3`. +It sorts the range `[begin, end)` along a hilbert curve on the sphere centered at `p` with squared radius `sq_r`; +these arguments are passed in the construction of the object `Hilbert_sort_on_sphere_3`. \tparam InputPointIterator must be a model of `RandomAccessIterator` with value type `Traits::Point_3`. -*/ +*/ template void operator() (InputPointIterator begin, InputPointIterator end) const; diff --git a/Spatial_sorting/doc/Spatial_sorting/CGAL/Multiscale_sort.h b/Spatial_sorting/doc/Spatial_sorting/CGAL/Multiscale_sort.h index 59ed9a347ce..e6f85f14238 100644 --- a/Spatial_sorting/doc/Spatial_sorting/CGAL/Multiscale_sort.h +++ b/Spatial_sorting/doc/Spatial_sorting/CGAL/Multiscale_sort.h @@ -3,30 +3,30 @@ namespace CGAL { /*! \ingroup PkgSpatialSortingFunctionObjects -The class `Multiscale_sort` represents a sorting algorithm adaptor. -Given a range of `n` points: -

    -
  1. it applies `Sort` on the last `(1 - ratio) * n` points, -
  2. it recurses on the first `ratio * n` points, -stopping when there are less than `threshold` points. -
+The class `Multiscale_sort` represents a sorting algorithm adaptor. +Given a range of `n` points: +
    +
  1. it applies `Sort` on the last `(1 - ratio) * n` points, +
  2. it recurses on the first `ratio * n` points, +stopping when there are less than `threshold` points. +
*/ template< typename Sort > class Multiscale_sort { public: -/// \name Creation +/// \name Creation /// @{ /*! -constructs an instance with `traits` as traits class instance. -*/ -Multiscale_sort (const Sort &sort = Sort(), std::ptrdiff_t threshold = 1, double ratio = 0.5); +constructs an instance with `traits` as traits class instance. +*/ +Multiscale_sort (const Sort &sort = Sort(), std::ptrdiff_t threshold = 1, double ratio = 0.5); -/// @} +/// @} -/// \name Operations +/// \name Operations /// @{ /*! diff --git a/Spatial_sorting/doc/Spatial_sorting/CGAL/Spatial_sort_traits_adapter_3.h b/Spatial_sorting/doc/Spatial_sorting/CGAL/Spatial_sort_traits_adapter_3.h index 8e4e0e5c419..242620de70d 100644 --- a/Spatial_sorting/doc/Spatial_sorting/CGAL/Spatial_sort_traits_adapter_3.h +++ b/Spatial_sorting/doc/Spatial_sorting/CGAL/Spatial_sort_traits_adapter_3.h @@ -3,13 +3,13 @@ namespace CGAL { /*! \ingroup PkgSpatialSortingTraits -Given a property map associating a key to a point, the class `Spatial_sort_traits_adapter_3` induces a spatial -reorder of the keys instead of the points, the comparisons being done on the associated points. -In other words, the traits provides to a spatial sort algorithm a point type which is a key, -while the actual point type is `Base_traits::Point_3`. +Given a property map associating a key to a point, the class `Spatial_sort_traits_adapter_3` induces a spatial +reorder of the keys instead of the points, the comparisons being done on the associated points. +In other words, the traits provides to a spatial sort algorithm a point type which is a key, +while the actual point type is `Base_traits::Point_3`. -\tparam Base_traits must be a model for `SpatialSortingTraits_3`. +\tparam Base_traits must be a model for `SpatialSortingTraits_3`. \tparam PointPropertyMap must be a model of `ReadablePropertyMap` with value type `Base_traits::Point_3`. @@ -20,7 +20,7 @@ template< typename Base_traits, typename PointPropertyMap > class Spatial_sort_traits_adapter_3 : public Base_traits { public: -/// \name Types +/// \name Types /// @{ /*! @@ -28,30 +28,30 @@ public: */ typedef boost::property_traits::key_type Point_3; -/// @} +/// @} -/// \name Creation +/// \name Creation /// @{ /*! -*/ -Spatial_sort_traits_adapter_3(Base_traits base=Base_traits()); +*/ +Spatial_sort_traits_adapter_3(Base_traits base=Base_traits()); /*! -*/ -Spatial_sort_traits_adapter_3(const PointPropertyMap& ppmap,Base_traits base=Base_traits()); +*/ +Spatial_sort_traits_adapter_3(const PointPropertyMap& ppmap,Base_traits base=Base_traits()); -/// @} +/// @} -/// \name Operations +/// \name Operations /// @{ /*! -Returns a const reference to the point property map. -*/ -const PointPropertyMap& point_property_map() const; +Returns a const reference to the point property map. +*/ +const PointPropertyMap& point_property_map() const; /// @} diff --git a/Spatial_sorting/doc/Spatial_sorting/CGAL/Spatial_sort_traits_adapter_d.h b/Spatial_sorting/doc/Spatial_sorting/CGAL/Spatial_sort_traits_adapter_d.h index d3ef4083476..ca5479c2c38 100644 --- a/Spatial_sorting/doc/Spatial_sorting/CGAL/Spatial_sort_traits_adapter_d.h +++ b/Spatial_sorting/doc/Spatial_sorting/CGAL/Spatial_sort_traits_adapter_d.h @@ -3,13 +3,13 @@ namespace CGAL { /*! \ingroup PkgSpatialSortingTraits -Given a property map associating a key to a point, the class `Spatial_sort_traits_adapter_d` induces a spatial -reorder of the keys instead of the points, the comparisons being done on the associated points. -In other words, the traits provides to a spatial sort algorithm a point type which is a key, -while the actual point type is `Base_traits::Point_d`. +Given a property map associating a key to a point, the class `Spatial_sort_traits_adapter_d` induces a spatial +reorder of the keys instead of the points, the comparisons being done on the associated points. +In other words, the traits provides to a spatial sort algorithm a point type which is a key, +while the actual point type is `Base_traits::Point_d`. -\tparam Base_traits must be a model for `SpatialSortingTraits_d`. +\tparam Base_traits must be a model for `SpatialSortingTraits_d`. \tparam PointPropertyMap must be a model of `ReadablePropertyMap` with value type `Base_traits::Point_d`. @@ -20,38 +20,38 @@ template< typename Base_traits, typename PointPropertyMap > class Spatial_sort_traits_adapter_d : public Base_traits { public: -/// \name Types +/// \name Types /// @{ /*! -*/ +*/ typedef boost::property_traits::key_type Point_d; -/// @} +/// @} -/// \name Creation +/// \name Creation /// @{ /*! -*/ -Spatial_sort_traits_adapter_d(Base_traits base=Base_traits()); +*/ +Spatial_sort_traits_adapter_d(Base_traits base=Base_traits()); /*! -*/ -Spatial_sort_traits_adapter_d(const PointPropertyMap& ppmap,Base_traits base=Base_traits()); +*/ +Spatial_sort_traits_adapter_d(const PointPropertyMap& ppmap,Base_traits base=Base_traits()); -/// @} +/// @} -/// \name Operations +/// \name Operations /// @{ /*! -Returns a const reference to the point property map. -*/ -const PointPropertyMap& point_property_map() const; +Returns a const reference to the point property map. +*/ +const PointPropertyMap& point_property_map() const; /// @} diff --git a/Spatial_sorting/doc/Spatial_sorting/CGAL/hilbert_sort.h b/Spatial_sorting/doc/Spatial_sorting/CGAL/hilbert_sort.h index 56611e6687d..de58f52f90f 100644 --- a/Spatial_sorting/doc/Spatial_sorting/CGAL/hilbert_sort.h +++ b/Spatial_sorting/doc/Spatial_sorting/CGAL/hilbert_sort.h @@ -3,10 +3,10 @@ namespace CGAL { /*! \ingroup PkgSpatialSortingFunctions -The function `hilbert_sort()` sorts an iterator range of points -along a Hilbert curve. +The function `hilbert_sort()` sorts an iterator range of points +along a Hilbert curve. -It sorts the range `[begin, end)` in place. +It sorts the range `[begin, end)` in place. \tparam ConcurrencyTag enables sequential versus parallel algorithm. Possible values are `Sequential_tag`, `Parallel_tag`, and `Parallel_if_available_tag`. @@ -16,11 +16,11 @@ Parallel sorting is available only when the median strategy policy (the default \tparam InputPointIterator must be a model of `RandomAccessIterator` and `std::iterator_traits::%value_type` must be convertible to -`Traits::Point_2`, `Traits::Point_3`, or `Traits::Point_d`. +`Traits::Point_2`, `Traits::Point_3`, or `Traits::Point_d`. -\tparam Traits must be a model for concept `SpatialSortingTraits_2`, -`SpatialSortingTraits_3`, or `SpatialSortingTraits_d`. -The default traits class `Default_traits` is the kernel in which the type +\tparam Traits must be a model for concept `SpatialSortingTraits_2`, +`SpatialSortingTraits_3`, or `SpatialSortingTraits_d`. +The default traits class `Default_traits` is the kernel in which the type `std::iterator_traits::%value_type` is defined. \tparam PolicyTag is used to specify the strategy policy. @@ -29,11 +29,11 @@ Possible values are \link CGAL::Hilbert_sort_median_policy `Hilbert_sort_median_ \cgalHeading{Implementation} -Creates an instance of -`Hilbert_sort_2`, -`Hilbert_sort_3`, or -`Hilbert_sort_d` -and calls its `operator()`. +Creates an instance of +`Hilbert_sort_2`, +`Hilbert_sort_3`, or +`Hilbert_sort_d` +and calls its `operator()`. */ template diff --git a/Spatial_sorting/doc/Spatial_sorting/CGAL/hilbert_sort_on_sphere.h b/Spatial_sorting/doc/Spatial_sorting/CGAL/hilbert_sort_on_sphere.h index bdcb1c47f24..dcb154ac7e3 100644 --- a/Spatial_sorting/doc/Spatial_sorting/CGAL/hilbert_sort_on_sphere.h +++ b/Spatial_sorting/doc/Spatial_sorting/CGAL/hilbert_sort_on_sphere.h @@ -4,16 +4,16 @@ namespace CGAL { \ingroup PkgSpatialSortingFunctions The function `hilbert_sort_on_sphere()` sorts an iterator range of points that are supposed to be close to a given sphere -along a Hilbert curve on that same sphere. +along a Hilbert curve on that same sphere. If input points are not close to the input sphere, this function still works, but it might not be a good sorting function. -It sorts the range `[begin, end)` in place. +It sorts the range `[begin, end)` in place. \tparam InputPointIterator must be a model of `RandomAccessIterator` and `std::iterator_traits::%value_type` must be convertible to `Traits::Point_3`. \tparam Traits must be a model for concept `SpatialSortingTraits_3`. -The default traits class `Default_traits` is the kernel in which the type +The default traits class `Default_traits` is the kernel in which the type `std::iterator_traits::%value_type` is defined. \tparam PolicyTag is used to specify the strategy policy. @@ -29,7 +29,7 @@ The default center of the sphere is the origin (0,0,0). \cgalHeading{Implementation} Creates an instance of `Hilbert_sort_on_sphere`, -and calls its `operator()`. +and calls its `operator()`. */ template diff --git a/Spatial_sorting/doc/Spatial_sorting/CGAL/spatial_sort.h b/Spatial_sorting/doc/Spatial_sorting/CGAL/spatial_sort.h index 38e37c16894..94a7d540fdc 100644 --- a/Spatial_sorting/doc/Spatial_sorting/CGAL/spatial_sort.h +++ b/Spatial_sorting/doc/Spatial_sorting/CGAL/spatial_sort.h @@ -3,12 +3,12 @@ namespace CGAL { /*! \ingroup PkgSpatialSortingFunctions -The function `spatial_sort()` sorts an iterator range of points in a way that -improves space locality. Two points close in the order will be close -geometrically, and two points close geometrically will have a high probability -of being close in the order. +The function `spatial_sort()` sorts an iterator range of points in a way that +improves space locality. Two points close in the order will be close +geometrically, and two points close geometrically will have a high probability +of being close in the order. -It sorts the range `[begin, end)` in place. +It sorts the range `[begin, end)` in place. \tparam ConcurrencyTag enables sequential versus parallel algorithm. Possible values are `Sequential_tag`, `Parallel_tag`, and `Parallel_if_available_tag`. @@ -20,32 +20,32 @@ Parallel sorting is available only when the median strategy policy (the default `std::iterator_traits::%value_type` must be convertible to `Traits::Point_2`, `Traits::Point_3`, or `Traits::Point_d`. -\tparam Traits must be a model for concept `SpatialSortingTraits_2`, -`SpatialSortingTraits_3`, or `SpatialSortingTraits_d`. -The default traits class `Default_traits` is the kernel in which the type +\tparam Traits must be a model for concept `SpatialSortingTraits_2`, +`SpatialSortingTraits_3`, or `SpatialSortingTraits_d`. +The default traits class `Default_traits` is the kernel in which the type `std::iterator_traits::%value_type` is defined. \tparam PolicyTag is used to specify the strategy policy. Possible values are \link CGAL::Hilbert_sort_median_policy `Hilbert_sort_median_policy` \endlink (the default policy) or \link CGAL::Hilbert_sort_middle_policy `Hilbert_sort_middle_policy` \endlink. -The default values for the thresholds and the ratio depend on the dimension. +The default values for the thresholds and the ratio depend on the dimension. \cgalHeading{Implementation} -Creates an instance of `Multiscale_sort` -where `Hilbert_sort` is an Hilbert sorting object, -and calls its `operator()`. +Creates an instance of `Multiscale_sort` +where `Hilbert_sort` is an Hilbert sorting object, +and calls its `operator()`. -The `threshold_hilbert` is the minimal size of a point set to be -subdivided recursively during Hilbert sorting, otherwise random order is used. -The `threshold_multiscale` value is the minimal size for a sample to -call Hilbert sort, otherwise random order is used. -The `ratio` value is used to split the original set in two subsets, -spatial sort is applied on the first subset of size -`ratio` -times the original size of the set, Hilbert sort is applied on the -second subset. +The `threshold_hilbert` is the minimal size of a point set to be +subdivided recursively during Hilbert sorting, otherwise random order is used. +The `threshold_multiscale` value is the minimal size for a sample to +call Hilbert sort, otherwise random order is used. +The `ratio` value is used to split the original set in two subsets, +spatial sort is applied on the first subset of size +`ratio` +times the original size of the set, Hilbert sort is applied on the +second subset. */ template diff --git a/Spatial_sorting/doc/Spatial_sorting/CGAL/spatial_sort_on_sphere.h b/Spatial_sorting/doc/Spatial_sorting/CGAL/spatial_sort_on_sphere.h index bb673d663cb..52b605a02f5 100644 --- a/Spatial_sorting/doc/Spatial_sorting/CGAL/spatial_sort_on_sphere.h +++ b/Spatial_sorting/doc/Spatial_sorting/CGAL/spatial_sort_on_sphere.h @@ -3,14 +3,14 @@ namespace CGAL { /*! \ingroup PkgSpatialSortingFunctions -The function `spatial_sort_on_sphere()` sorts an iterator range of points in a way that -improves space locality with respect to the intrinsic metric on the sphere given as input. -Two points close in the order will be close -on the sphere, and two points close on the sphere will have a high probability +The function `spatial_sort_on_sphere()` sorts an iterator range of points in a way that +improves space locality with respect to the intrinsic metric on the sphere given as input. +Two points close in the order will be close +on the sphere, and two points close on the sphere will have a high probability of being close in the order. The input points are supposed to be close to the input sphere. If input points are not close to the input sphere, this function still works, but it might not be a good sorting function. -It sorts the range `[begin, end)` in place. +It sorts the range `[begin, end)` in place. The input sphere is given by a squared radius and a center, parameter `sqr_radius` and parameter `center` respectively. The default squared radius of the sphere is 1.0. @@ -32,19 +32,19 @@ Possible values are \link CGAL::Hilbert_sort_median_policy `Hilbert_sort_median_ \cgalHeading{Implementation} -Creates an instance of `Multiscale_sort` -where `Hilbert_sort_on_sphere_3` is an Hilbert sorting on the sphere object, -and calls its `operator()`. +Creates an instance of `Multiscale_sort` +where `Hilbert_sort_on_sphere_3` is an Hilbert sorting on the sphere object, +and calls its `operator()`. -The `threshold_hilbert` is the minimal size of a point set to be -subdivided recursively during Hilbert sorting, otherwise random order is used. -The `threshold_multiscale` value is the minimal size for a sample to -call the `Hilbert_sort_on_sphere_3` functor, otherwise random order is used. -The `ratio` value is used to split the original set in two subsets, -spatial sort is applied on the first subset of size -`ratio` -times the original size of the set, `Hilbert_sort_on_sphere_3` functor is applied on the -second subset. +The `threshold_hilbert` is the minimal size of a point set to be +subdivided recursively during Hilbert sorting, otherwise random order is used. +The `threshold_multiscale` value is the minimal size for a sample to +call the `Hilbert_sort_on_sphere_3` functor, otherwise random order is used. +The `ratio` value is used to split the original set in two subsets, +spatial sort is applied on the first subset of size +`ratio` +times the original size of the set, `Hilbert_sort_on_sphere_3` functor is applied on the +second subset. */ template diff --git a/Spatial_sorting/doc/Spatial_sorting/Spatial_sorting.txt b/Spatial_sorting/doc/Spatial_sorting/Spatial_sorting.txt index cd4815c648f..a97ef3ead18 100644 --- a/Spatial_sorting/doc/Spatial_sorting/Spatial_sorting.txt +++ b/Spatial_sorting/doc/Spatial_sorting/Spatial_sorting.txt @@ -1,7 +1,7 @@ namespace CGAL { /*! -\mainpage User Manual +\mainpage User Manual \anchor Chapter_Spatial_Sorting \anchor chapspatial_sorting \cgalAutoToc @@ -15,7 +15,7 @@ speed is dependent on the order of insertion. This package provides sorting algorithms that may considerably improve running times of such algorithms. -The rationale is to sort objects along a space-filling curve +The rationale is to sort objects along a space-filling curve so that two objects close geometrically will be close in the insertion order with high probability. That way, parts of a data structure that will be looked at during @@ -27,7 +27,7 @@ speed ups in other algorithm using these data structures. Some algorithms have a good complexity under randomized hypotheses which contradicts the idea of sorting the input using any sorting criterion. -In such a case, it is possible to introduce just a bit of randomness +In such a case, it is possible to introduce just a bit of randomness to be able to combine the good randomized complexity and the good effects of locality \cgalCite{acr-icb-03}. @@ -35,18 +35,18 @@ The predicates used by this package are comparisons between coordinates, thus there is no robustness issue involved here, for example to choose the arithmetic of the kernel. -\section sechilbert_sorting Hilbert Sorting +\section sechilbert_sorting Hilbert Sorting In 2D, one can construct a space filling curve, that is a mapping \f$ f\f$ of \f$ [0,1]\f$ -to the unit square \f$ [0,1]^2\f$, such that \f$ f(0)=(0,0)\f$ and \f$ f(1)=(1,0)\f$ +to the unit square \f$ [0,1]^2\f$, such that \f$ f(0)=(0,0)\f$ and \f$ f(1)=(1,0)\f$ in the following way: the unit square is subdivided in four such that
-\f$ f([0,\frac{1}{4}])=[0,\frac{1}{2}]^2\f$, +\f$ f([0,\frac{1}{4}])=[0,\frac{1}{2}]^2\f$, \f$ f([\frac{1}{4},\frac{1}{2}])=[0,\frac{1}{2}]\times[\frac{1}{2},1]\f$, \f$ f([\frac{1}{2},\frac{3}{4}])=[\frac{1}{2},1]^2\f$, -and +and \f$ f([\frac{3}{4},1])=[\frac{1}{2},1]\times[0,\frac{1}{2}].\f$ \f$ f(\frac{1}{4})=(0,\frac{1}{2})\f$ @@ -63,7 +63,7 @@ Hilbert mapping \cgalFigureEnd Now given a set of 2D points, they can be sorted in the order they have on such -a space filling curve. Note that at each step, we split a square exactly at its center; we call this +a space filling curve. Note that at each step, we split a square exactly at its center; we call this subdivision policy: middle policy (see \cgalFigureRef{Spatial_sorting_fig_Hilbert_middle}). \cgalFigureBegin{Spatial_sorting_fig_Hilbert_middle,Hilbert-middle.png} @@ -74,7 +74,7 @@ If instead of subdividing the square in a fixed way at its center, as above, we subdivide it by splitting at the median point (in \f$ x\f$ or \f$ y\f$ directions alternating), we construct a 2-d tree adapted to the point set. This tree can be visited in a -similar manner and we get also a suitable ordering of the points; we call this +similar manner and we get also a suitable ordering of the points; we call this subdivision policy: median policy (see \cgalFigureRef{Spatial_sorting_fig_Hilbert_median}). \cgalFigureBegin{Spatial_sorting_fig_Hilbert_median,Hilbert-median.png} @@ -84,7 +84,7 @@ Hilbert sort with median policy The middle policy is easier to analyze, and is interesting in practice for well distributed set of points in small dimension (if the number of points is really larger than \f$ 2^d\f$). -The median policy should be preferred for high dimension or if +The median policy should be preferred for high dimension or if the point set distribution is not regular (or unknown). Since the median policy cannot be much worse than the middle policy, while the converse can happen, the median policy is the @@ -97,12 +97,12 @@ in the middle and the median policies. We also consider space filling curves on a given sphere. The method is described for the unit sphere below; it works on any sphere by an affine transformation. The points to be sorted are supposed to be close to the sphere. - + Actually, we approximate a space filling curve on -the unit sphere by a space filling curve on a cube (with facets at \f$x, y, z = \pm 1/\sqrt{3}\f$). +the unit sphere by a space filling curve on a cube (with facets at \f$x, y, z = \pm 1/\sqrt{3}\f$). Roughly speaking, we split the original set of points in six subsets corresponding to the six facets of the cube. The subset corresponding to a facet \f$f\f$ is the set of points that lie in the half-space defined by the supporting plane of \f$f\f$ that does not contain the origin. And then we basically use the 2D Hilbert sort with its corresponding policy, as explained above for the projection of the points in each subset on its corresponding facet of the cube. The axes orientation on each facet is chosen so that the space filling curve covers the whole cube without any jump; see \cgalFigureRef{Spatial_sorting_fig_Faces_orientations}. A point can lie in more than one such half-plane, so, we give a priority for each facet of the cube. The priority order is: -first, the facet of the cube at \f$x = 1/\sqrt{3}\f$; second, the facet of the cube at \f$y = 1/\sqrt{3}\f$; third, the facet of the cube at \f$ x = -1/\sqrt{3}\f$; fourth, the facet of the cube at \f$ z = 1/\sqrt{3}\f$; fifth, the facet of the cube at \f$ y = -1/\sqrt{3}\f$; and, sixth, the facet of the cube at \f$ z = -1/\sqrt{3}\f$. +first, the facet of the cube at \f$x = 1/\sqrt{3}\f$; second, the facet of the cube at \f$y = 1/\sqrt{3}\f$; third, the facet of the cube at \f$ x = -1/\sqrt{3}\f$; fourth, the facet of the cube at \f$ z = 1/\sqrt{3}\f$; fifth, the facet of the cube at \f$ y = -1/\sqrt{3}\f$; and, sixth, the facet of the cube at \f$ z = -1/\sqrt{3}\f$. If points are not close to the sphere, they are still sorted the same way, however there is no guarantee that such an order is good anymore. @@ -131,7 +131,7 @@ This other example illustrates the use of the two different policies \cgalExample{Spatial_sorting/hilbert_policies.cpp} -\section secspatial_sorting Spatial Sorting +\section secspatial_sorting Spatial Sorting Hilbert sort cannot be used directly before feeding a randomized algorithm. Thus, the trick is to organize the point set in random buckets of increasing @@ -150,7 +150,7 @@ The following example shows that, on particular input, spatial sort runs much faster than a bad order or than Hilbert sort (below results with release mode compilation on a 1.8GHz processor). \code{.sh} -$ ./small_example_delaunay_2 +$ ./small_example_delaunay_2 10000 points on a parabola Delaunay without spatial sort... done in 6.33443 seconds. Delaunay with median hilbert sort... done in 0.822975 seconds. @@ -183,7 +183,7 @@ If you want to sort something else than just points, for example a sequence of tuples containing a point, or a sequence of indices in a vector of points, you need another level of indirection. We provide the spatial sorting traits class adapters which are templated by -another spatial sorting traits class, and a +another spatial sorting traits class, and a property map. which allows to obtain a point from whatever you want to sort. @@ -192,19 +192,19 @@ The following examples illustrate the usage of these traits class adapters. \subsection secsort_any_type_2 Sorting Using Pairs of Points and Integers -In this example program, the sorted sequence of points is retrieved +In this example program, the sorted sequence of points is retrieved using a vector of pairs of points and integers. \cgalExample{Spatial_sorting/sp_sort_using_property_map_2.cpp} \subsection Spatial_sortingSortingUsingIndicesofPoints Sorting Using Indices of Points -In this example program, the sorted sequence of points is retrieved +In this example program, the sorted sequence of points is retrieved using the indices of the points in a vector of points. \cgalExample{Spatial_sorting/sp_sort_using_property_map_3.cpp} \subsection Spatial_sortingSortingUsingIndicesofPairs Sorting Using Indices of Pairs of Points and Integers -In this example program, the sorted sequence of points is retrieved +In this example program, the sorted sequence of points is retrieved using the indices of the points in a vector of pairs of points and integers. \cgalExample{Spatial_sorting/sp_sort_using_property_map_d.cpp} @@ -232,6 +232,6 @@ Pedro Machado Manhaes de Castro and Olivier Devillers added Hilbert sorting on t Andreas Fabri added a parallel version of Hilbert and spatial sorting. -*/ +*/ } /* namespace CGAL */ diff --git a/Spatial_sorting/examples/Spatial_sorting/CMakeLists.txt b/Spatial_sorting/examples/Spatial_sorting/CMakeLists.txt index 0cd2ea143b2..f865c8028c2 100644 --- a/Spatial_sorting/examples/Spatial_sorting/CMakeLists.txt +++ b/Spatial_sorting/examples/Spatial_sorting/CMakeLists.txt @@ -19,10 +19,10 @@ if ( CGAL_FOUND ) if( TBB_FOUND ) include( CGAL_target_use_TBB ) CGAL_target_use_TBB( parallel_spatial_sort_3 ) - endif() + endif() else() - + message(STATUS "This program requires the CGAL library, and will not be compiled.") - + endif() diff --git a/Spatial_sorting/include/CGAL/Hilbert_sort_d.h b/Spatial_sorting/include/CGAL/Hilbert_sort_d.h index b213c26f73d..f57a51c3a7b 100644 --- a/Spatial_sorting/include/CGAL/Hilbert_sort_d.h +++ b/Spatial_sorting/include/CGAL/Hilbert_sort_d.h @@ -21,7 +21,7 @@ namespace CGAL { template class Hilbert_sort_d; -template +template class Hilbert_sort_d : public Hilbert_sort_median_d { diff --git a/Spatial_sorting/include/CGAL/Multiscale_sort.h b/Spatial_sorting/include/CGAL/Multiscale_sort.h index 79e711000af..b2cec8900ac 100644 --- a/Spatial_sorting/include/CGAL/Multiscale_sort.h +++ b/Spatial_sorting/include/CGAL/Multiscale_sort.h @@ -22,28 +22,28 @@ namespace CGAL { template class Multiscale_sort { - Sort _sort; - std::ptrdiff_t _threshold; - double _ratio; + Sort _sort; + std::ptrdiff_t _threshold; + double _ratio; public: - Multiscale_sort (const Sort &sort = Sort(), std::ptrdiff_t threshold = 1, double ratio = 0.5) - : _sort (sort), _threshold (threshold), _ratio (ratio) - { - CGAL_precondition (0. <= ratio && ratio <= 1.); - } + Multiscale_sort (const Sort &sort = Sort(), std::ptrdiff_t threshold = 1, double ratio = 0.5) + : _sort (sort), _threshold (threshold), _ratio (ratio) + { + CGAL_precondition (0. <= ratio && ratio <= 1.); + } - template - void operator() (RandomAccessIterator begin, RandomAccessIterator end) const - { - typedef typename std::iterator_traits::difference_type difference_type; - RandomAccessIterator middle = begin; - if (end - begin >= _threshold) { - middle = begin + difference_type (double(end - begin) * _ratio); - this->operator() (begin, middle); - } - _sort (middle, end); + template + void operator() (RandomAccessIterator begin, RandomAccessIterator end) const + { + typedef typename std::iterator_traits::difference_type difference_type; + RandomAccessIterator middle = begin; + if (end - begin >= _threshold) { + middle = begin + difference_type (double(end - begin) * _ratio); + this->operator() (begin, middle); } + _sort (middle, end); + } }; } // namespace CGAL diff --git a/Spatial_sorting/include/CGAL/hilbert_sort.h b/Spatial_sorting/include/CGAL/hilbert_sort.h index 3fbf0961720..97973dd4058 100644 --- a/Spatial_sorting/include/CGAL/hilbert_sort.h +++ b/Spatial_sorting/include/CGAL/hilbert_sort.h @@ -96,7 +96,7 @@ void hilbert_sort (RandomAccessIterator begin, RandomAccessIterator end, { typedef std::iterator_traits ITraits; typedef typename ITraits::value_type value_type; - + internal::hilbert_sort(begin, end, k, Hilbert_sort_median_policy(), static_cast (0)); } diff --git a/Spatial_sorting/test/Spatial_sorting/CMakeLists.txt b/Spatial_sorting/test/Spatial_sorting/CMakeLists.txt index e7261976569..8213186a4b0 100644 --- a/Spatial_sorting/test/Spatial_sorting/CMakeLists.txt +++ b/Spatial_sorting/test/Spatial_sorting/CMakeLists.txt @@ -19,8 +19,8 @@ if ( CGAL_FOUND ) endif( TBB_FOUND ) else() - + message(STATUS "This program requires the CGAL library, and will not be compiled.") - + endif() diff --git a/Spatial_sorting/test/Spatial_sorting/test_multiscale.cpp b/Spatial_sorting/test/Spatial_sorting/test_multiscale.cpp index aeb5e59b53a..d7fb06bf717 100644 --- a/Spatial_sorting/test/Spatial_sorting/test_multiscale.cpp +++ b/Spatial_sorting/test/Spatial_sorting/test_multiscale.cpp @@ -31,160 +31,160 @@ typedef Kd::Point_d Point; int main () { const int nb_points_2 = 50000, nb_points_3 = 50000, nb_points_d=50000; - CGAL::Random random (42); + CGAL::Random random (42); - std::cout << "Testing Multiscale sort." << std::endl; + std::cout << "Testing Multiscale sort." << std::endl; - { - std::cout << "Testing 2D: Generating points... " << std::flush; + { + std::cout << "Testing 2D: Generating points... " << std::flush; - std::vector v; - v.reserve (nb_points_2); + std::vector v; + v.reserve (nb_points_2); - CGAL::Random_points_in_square_2 gen (1.0, random); + CGAL::Random_points_in_square_2 gen (1.0, random); - for (int i = 0; i < nb_points_2; ++i) - v.push_back (*gen++); + for (int i = 0; i < nb_points_2; ++i) + v.push_back (*gen++); - std::cout << "done." << std::endl; + std::cout << "done." << std::endl; - std::vector v2 (v); + std::vector v2 (v); - std::cout << " Sorting points... " << std::flush; + std::cout << " Sorting points... " << std::flush; - CGAL::spatial_sort (v.begin(), v.end()); + CGAL::spatial_sort (v.begin(), v.end()); - std::cout << "done." << std::endl; + std::cout << "done." << std::endl; - std::cout << " Checking... " << std::flush; + std::cout << " Checking... " << std::flush; - std::sort (v.begin(), v.end(), K().less_xy_2_object()); - std::sort (v2.begin(), v2.end(), K().less_xy_2_object()); - assert(v == v2); + std::sort (v.begin(), v.end(), K().less_xy_2_object()); + std::sort (v2.begin(), v2.end(), K().less_xy_2_object()); + assert(v == v2); - std::cout << "no points lost." << std::endl; - } + std::cout << "no points lost." << std::endl; + } - { - std::cout << "Testing 3D: Generating points... " << std::flush; + { + std::cout << "Testing 3D: Generating points... " << std::flush; - std::vector v; - v.reserve (nb_points_3); + std::vector v; + v.reserve (nb_points_3); - CGAL::Random_points_in_cube_3 gen (1.0, random); + CGAL::Random_points_in_cube_3 gen (1.0, random); - for (int i = 0; i < nb_points_3; ++i) - v.push_back (*gen++); + for (int i = 0; i < nb_points_3; ++i) + v.push_back (*gen++); - std::cout << "done." << std::endl; + std::cout << "done." << std::endl; - std::vector v2 (v); + std::vector v2 (v); - std::cout << " Sorting points... " << std::flush; + std::cout << " Sorting points... " << std::flush; - CGAL::spatial_sort (v.begin(), v.end()); + CGAL::spatial_sort (v.begin(), v.end()); - std::cout << "done." << std::endl; + std::cout << "done." << std::endl; - std::cout << " Checking... " << std::flush; + std::cout << " Checking... " << std::flush; - std::sort (v.begin(), v.end(), K().less_xyz_3_object()); - std::sort (v2.begin(), v2.end(), K().less_xyz_3_object()); - assert(v == v2); + std::sort (v.begin(), v.end(), K().less_xyz_3_object()); + std::sort (v2.begin(), v2.end(), K().less_xyz_3_object()); + assert(v == v2); - std::cout << "no points lost." << std::endl; - } + std::cout << "no points lost." << std::endl; + } - { - std::cout << "Testing Spherical: Generating points... " << std::flush; + { + std::cout << "Testing Spherical: Generating points... " << std::flush; - std::vector v; - v.reserve (nb_points_3); + std::vector v; + v.reserve (nb_points_3); - CGAL::Random_points_on_sphere_3 gen (1.0, random); + CGAL::Random_points_on_sphere_3 gen (1.0, random); - for (int i = 0; i < nb_points_3; ++i) - v.push_back (*gen++); + for (int i = 0; i < nb_points_3; ++i) + v.push_back (*gen++); - std::cout << "done." << std::endl; + std::cout << "done." << std::endl; - std::vector v2 (v); + std::vector v2 (v); - std::cout << " Sorting points... " << std::flush; + std::cout << " Sorting points... " << std::flush; - CGAL::spatial_sort_on_sphere (v.begin(), v.end()); + CGAL::spatial_sort_on_sphere (v.begin(), v.end()); - std::cout << "done." << std::endl; + std::cout << "done." << std::endl; - std::cout << " Checking... " << std::flush; + std::cout << " Checking... " << std::flush; - std::sort (v.begin(), v.end(), K().less_xyz_3_object()); - std::sort (v2.begin(), v2.end(), K().less_xyz_3_object()); - assert(v == v2); + std::sort (v.begin(), v.end(), K().less_xyz_3_object()); + std::sort (v2.begin(), v2.end(), K().less_xyz_3_object()); + assert(v == v2); - std::cout << "no points lost." << std::endl; - } + std::cout << "no points lost." << std::endl; + } - { - std::cout << "Testing Spherical + given sphere: Generating points... " << std::flush; + { + std::cout << "Testing Spherical + given sphere: Generating points... " << std::flush; - std::vector v; - v.reserve (nb_points_3); + std::vector v; + v.reserve (nb_points_3); - CGAL::Random_points_on_sphere_3 gen (3.0, random); + CGAL::Random_points_on_sphere_3 gen (3.0, random); - for (int i = 0; i < nb_points_3; ++i) - v.push_back (*gen++ + Vector_3(10,10,3)); + for (int i = 0; i < nb_points_3; ++i) + v.push_back (*gen++ + Vector_3(10,10,3)); - std::cout << "done." << std::endl; + std::cout << "done." << std::endl; - std::vector v2 (v); + std::vector v2 (v); - std::cout << " Sorting points... " << std::flush; + std::cout << " Sorting points... " << std::flush; - CGAL::spatial_sort_on_sphere (v.begin(), v.end(), 9, Point_3(10,10,3)); + CGAL::spatial_sort_on_sphere (v.begin(), v.end(), 9, Point_3(10,10,3)); - std::cout << "done." << std::endl; + std::cout << "done." << std::endl; - std::cout << " Checking... " << std::flush; + std::cout << " Checking... " << std::flush; - std::sort (v.begin(), v.end(), K().less_xyz_3_object()); - std::sort (v2.begin(), v2.end(), K().less_xyz_3_object()); - assert(v == v2); + std::sort (v.begin(), v.end(), K().less_xyz_3_object()); + std::sort (v2.begin(), v2.end(), K().less_xyz_3_object()); + assert(v == v2); - std::cout << "no points lost." << std::endl; - } + std::cout << "no points lost." << std::endl; + } - { - int dim=5; - std::cout << "Testing "< v; - v.reserve (nb_points_d); + std::vector v; + v.reserve (nb_points_d); - CGAL::Random_points_in_cube_d gen (dim, 1.0, random); + CGAL::Random_points_in_cube_d gen (dim, 1.0, random); - for (int i = 0; i < nb_points_d; ++i) - v.push_back (*gen++); + for (int i = 0; i < nb_points_d; ++i) + v.push_back (*gen++); - std::cout << "done." << std::endl; + std::cout << "done." << std::endl; - std::vector v2 (v); + std::vector v2 (v); - std::cout << " Sorting points... " << std::flush; + std::cout << " Sorting points... " << std::flush; - CGAL::spatial_sort (v.begin(), v.end()); + CGAL::spatial_sort (v.begin(), v.end()); - std::cout << "done." << std::endl; + std::cout << "done." << std::endl; - std::cout << " Checking... " << std::flush; + std::cout << " Checking... " << std::flush; - std::sort (v.begin(), v.end(), Kd().less_lexicographically_d_object()); - std::sort (v2.begin(), v2.end(),Kd().less_lexicographically_d_object()); - assert(v == v2); + std::sort (v.begin(), v.end(), Kd().less_lexicographically_d_object()); + std::sort (v2.begin(), v2.end(),Kd().less_lexicographically_d_object()); + assert(v == v2); - std::cout << "no points lost." << std::endl; - } + std::cout << "no points lost." << std::endl; + } - return 0; + return 0; } diff --git a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_2_impl.h b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_2_impl.h index 413b9a9e5af..4c36e45d474 100644 --- a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_2_impl.h +++ b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_2_impl.h @@ -53,16 +53,16 @@ Straight_skeleton_builder_2::Straight_skeleton_builder_2 ( boost::optio } template -typename Straight_skeleton_builder_2::Halfedge_handle +typename Straight_skeleton_builder_2::Halfedge_handle Straight_skeleton_builder_2::validate( Halfedge_handle aH ) const { if ( !handle_assigned(aH) ) throw std::runtime_error("Incomplete straight skeleton"); return aH ; } - + template -typename Straight_skeleton_builder_2::Vertex_handle +typename Straight_skeleton_builder_2::Vertex_handle Straight_skeleton_builder_2::validate( Vertex_handle aH ) const { if ( !handle_assigned(aH) ) @@ -78,7 +78,7 @@ void Straight_skeleton_builder_2::InsertEventInPQ( EventPtr aEvent ) } template -typename Straight_skeleton_builder_2::EventPtr +typename Straight_skeleton_builder_2::EventPtr Straight_skeleton_builder_2::PopEventFromPQ() { EventPtr rR = mPQ.top(); mPQ.pop(); @@ -93,24 +93,24 @@ typename Straight_skeleton_builder_2::EventPtr Straight_skeleton_builder_2::FindEdgeEvent( Vertex_handle aLNode, Vertex_handle aRNode, Triedge const& aPrevEventTriedge ) { EventPtr rResult ; - + Triedge lTriedge = GetVertexTriedge(aLNode) & GetVertexTriedge(aRNode) ; - + if ( lTriedge.is_valid() && lTriedge != aPrevEventTriedge ) { Trisegment_2_ptr lTrisegment = CreateTrisegment(lTriedge,aLNode,aRNode); - + if ( ExistEvent(lTrisegment) ) { Comparison_result lLNodeD = CompareEvents(lTrisegment,aLNode) ; Comparison_result lRNodeD = CompareEvents(lTrisegment,aRNode) ; - + if ( lLNodeD != SMALLER && lRNodeD != SMALLER ) { rResult = EventPtr( new EdgeEvent( lTriedge, lTrisegment, aLNode, aRNode ) ) ; mVisitor.on_edge_event_created(aLNode, aRNode) ; - + CGAL_STSKEL_DEBUG_CODE( SetEventTimeAndPoint(*rResult) ); } else @@ -124,55 +124,55 @@ Straight_skeleton_builder_2::FindEdgeEvent( Vertex_handle aLNode, Verte template -typename Straight_skeleton_builder_2::EventPtr +typename Straight_skeleton_builder_2::EventPtr Straight_skeleton_builder_2::IsPseudoSplitEvent( EventPtr const& aEvent, Vertex_handle_pair aOpp, Site const& aSite ) { EventPtr rPseudoSplitEvent ; - + if ( aSite != INSIDE ) { SplitEvent& lEvent = dynamic_cast(*aEvent) ; - + Triedge const& lEventTriedge = lEvent.triedge(); Trisegment_2_ptr const& lEventTrisegment = lEvent.trisegment(); Vertex_handle lSeedN = lEvent.seed0(); - + Vertex_handle lOppL = aOpp.first ; Vertex_handle lOppR = aOpp.second ; - + if ( aSite == AT_SOURCE ) { - Halfedge_handle lOppPrevBorder = GetVertexTriedge(lOppL).e0() ; - + Halfedge_handle lOppPrevBorder = GetVertexTriedge(lOppL).e0() ; + if ( lEventTriedge.e0() != lOppPrevBorder && lEventTriedge.e1() != lOppPrevBorder ) { rPseudoSplitEvent = EventPtr( new PseudoSplitEvent(lEventTriedge,lEventTrisegment,lOppL,lSeedN,true) ) ; - + CGAL_STSKEL_BUILDER_TRACE(1,"Pseudo-split-event found against N" << lOppL->id() ) ; - + mVisitor.on_pseudo_split_event_created(lOppL,lSeedN) ; } } - else // aSite == AT_TARGET + else // aSite == AT_TARGET { Vertex_handle lOppNextN = GetNextInLAV(lOppR) ; - - Halfedge_handle lOppNextBorder = GetVertexTriedge(lOppNextN).e0() ; - + + Halfedge_handle lOppNextBorder = GetVertexTriedge(lOppNextN).e0() ; + if ( lEventTriedge.e0() != lOppNextBorder && lEventTriedge.e1() != lOppNextBorder ) { - rPseudoSplitEvent = EventPtr( new PseudoSplitEvent(lEventTriedge, lEventTrisegment, lSeedN, lOppR,false) ) ; - + rPseudoSplitEvent = EventPtr( new PseudoSplitEvent(lEventTriedge, lEventTrisegment, lSeedN, lOppR,false) ) ; + CGAL_STSKEL_BUILDER_TRACE(1,"Pseudo-split-event found against N" << lOppR->id() ) ; - + mVisitor.on_pseudo_split_event_created(lSeedN,lOppR) ; } } } - + if ( rPseudoSplitEvent ) rPseudoSplitEvent->SetTimeAndPoint(aEvent->time(),aEvent->point()); - + return rPseudoSplitEvent ; } @@ -191,18 +191,18 @@ void Straight_skeleton_builder_2::CollectSplitEvent( Vertex_handle aNod if ( IsOppositeEdgeFacingTheSplitSeed(aNode,aTriedge.e2()) ) { Trisegment_2_ptr lTrisegment = CreateTrisegment(aTriedge,aNode); - + if ( lTrisegment->collinearity() != TRISEGMENT_COLLINEARITY_02 && ExistEvent(lTrisegment) ) { if ( CompareEvents(lTrisegment,aNode) != SMALLER ) { EventPtr lEvent = EventPtr( new SplitEvent (aTriedge,lTrisegment,aNode) ) ; - + mVisitor.on_split_event_created(aNode) ; - + CGAL_STSKEL_DEBUG_CODE( SetEventTimeAndPoint(*lEvent) ) ; - - AddSplitEvent(aNode,lEvent); + + AddSplitEvent(aNode,lEvent); } } } @@ -214,10 +214,10 @@ void Straight_skeleton_builder_2::CollectSplitEvents( Vertex_handle aNo { // lLBorder and lRBorder are the consecutive contour edges forming the reflex wavefront. Triedge const& lTriedge = GetVertexTriedge(aNode); - + Halfedge_handle lLBorder = lTriedge.e0(); Halfedge_handle lRBorder = lTriedge.e1(); - + CGAL_STSKEL_BUILDER_TRACE(3 ,"Finding SplitEvent for N" << aNode->id() << " LBorder: E" << lLBorder->id() << " RBorder: E" << lRBorder->id() @@ -230,7 +230,7 @@ void Straight_skeleton_builder_2::CollectSplitEvents( Vertex_handle aNo if ( lOpposite != lLBorder && lOpposite != lRBorder ) { Triedge lEventTriedge(lLBorder, lRBorder, lOpposite); - + if ( lEventTriedge != aPrevEventTriedge ) { CollectSplitEvent(aNode, lEventTriedge ) ; @@ -245,13 +245,13 @@ void Straight_skeleton_builder_2::CollectSplitEvents( Vertex_handle aNo template void Straight_skeleton_builder_2::CollectNewEvents( Vertex_handle aNode, Triedge const& aPrevEventTriedge ) { - // A Straight Skeleton is the trace of the 'grassfire propagation' that corresponds to the inward move of all the vertices + // A Straight Skeleton is the trace of the 'grassfire propagation' that corresponds to the inward move of all the vertices // of a polygon along their angular bisectors. // Since vertices are the common endpoints of contour edges, the propagation corresponds to contour edges moving inward, // shrinking and expanding as neccesasry to keep the vertices along the angular bisectors. // At each instant in time the current location of vertices (and edges) describe the current 'Offset polygon' // (with at time zero corresponds to the input polygon). - // + // // An 'edge wavefront' is a moving contour edge. // A 'vertex wavefront' is the wavefront of two consecutive edge wavefronts (sharing a moving vertex). // @@ -271,13 +271,13 @@ void Straight_skeleton_builder_2::CollectNewEvents( Vertex_handle aNode // wavefront (edgea,edgeb) collides with (edgec,edged), the two resulting polygons will contain (edgea,edgec) and (edgeb,edged). // Furthermore, one of the new vertices can be a reflex vertex generating a reflex wavefront which can further produce more split or // vertex events (or edge events of course) - // + // // Each vertex wavefront (reflex or not) results in one and only one event from a set of possible events. // It can result in a edge event against the vertex wavefronts emerging from the adjacent vertices (in the current polygon, not - // in the input polygon); or it can result in a split event (or vertex event) against any other wavefront in the rest of + // in the input polygon); or it can result in a split event (or vertex event) against any other wavefront in the rest of // current polygon. - + // Adjacent vertices in the current polygon containing aNode (called LAV) Vertex_handle lPrev = GetPrevInLAV(aNode) ; Vertex_handle lNext = GetNextInLAV(aNode) ; @@ -290,23 +290,23 @@ void Straight_skeleton_builder_2::CollectNewEvents( Vertex_handle aNode if ( IsReflex(aNode) ) CollectSplitEvents(aNode, aPrevEventTriedge) ; - + EventPtr lLEdgeEvent = FindEdgeEvent( lPrev , aNode, aPrevEventTriedge ) ; EventPtr lREdgeEvent = FindEdgeEvent( aNode , lNext, aPrevEventTriedge ) ; bool lAcceptL = !!lLEdgeEvent ; bool lAcceptR = !!lREdgeEvent ; - + if ( lAcceptL ) InsertEventInPQ(lLEdgeEvent); - + if ( lAcceptR ) InsertEventInPQ(lREdgeEvent); } // Handles the special case of two simultaneous edge events, that is, two edges // collapsing along the line/point were they meet at the same time. -// This ocurrs when the bisector emerging from vertex 'aA' is defined by the same pair of +// This ocurrs when the bisector emerging from vertex 'aA' is defined by the same pair of // contour edges as the bisector emerging from vertex 'aB' (but in opposite order). // template @@ -325,7 +325,7 @@ void Straight_skeleton_builder_2::HandleSimultaneousEdgeEvent( Vertex_h Vertex_handle lIAV = lIA->vertex() ; Vertex_handle lOBV = lOB->vertex() ; // Vertex_handle lIBV = lIB->vertex() ; - + CGAL_STSKEL_BUILDER_TRACE ( 2 , "OA: B" << lOA->id() << '\n' << "IA: B" << lIA->id() << '\n' @@ -362,46 +362,46 @@ void Straight_skeleton_builder_2::HandleSimultaneousEdgeEvent( Vertex_h CGAL_STSKEL_BUILDER_TRACE ( 1, "B" << lOA->id() << " and B" << lIA->id() << " erased." ) ; mDanglingBisectors.push_back(lOA); - + // // The code above corrects the links for vertices aA/aB to the erased halfedges lOA and lIA. // However, any of these vertices (aA/aB) maybe one of the twin vertices of a split event. // If that's the case, the erased halfedge maybe be linked to a 'couple' of those vertices. // This situation is corrected below: - + if ( !lOAV->has_infinite_time() && lOAV != aA && lOAV != aB ) { Link(lOAV,lIB); - - CGAL_STSKEL_BUILDER_TRACE ( 1, "N" << lOAV->id() << " has B" << lOA->id() - << " as it's halfedge. Replacing it with B" << lIB->id() + + CGAL_STSKEL_BUILDER_TRACE ( 1, "N" << lOAV->id() << " has B" << lOA->id() + << " as it's halfedge. Replacing it with B" << lIB->id() ) ; } if ( !lIAV->has_infinite_time() && lIAV != aA && lIAV != aB ) { Link(lIAV,lOB); - - CGAL_STSKEL_BUILDER_TRACE ( 1, "N" << lIAV->id() << " has B" << lIA->id() - << " as it's halfedge. Replacing it with B" << lOB->id() + + CGAL_STSKEL_BUILDER_TRACE ( 1, "N" << lIAV->id() << " has B" << lIA->id() + << " as it's halfedge. Replacing it with B" << lOB->id() ) ; } - + CGAL_STSKEL_BUILDER_TRACE ( 2, "N" << aA->id() << " halfedge: B" << aA->halfedge()->id() ) ; CGAL_STSKEL_BUILDER_TRACE ( 2, "N" << aB->id() << " halfedge: B" << aB->halfedge()->id() ) ; SetBisectorSlope(aA,aB); CGAL_assertion( aA->primary_bisector() == lIB ) ; - + CGAL_STSKEL_BUILDER_TRACE ( 1, "Wavefront: E" << lIB->defining_contour_edge()->id() << " and E" << lIB->opposite()->defining_contour_edge()->id() << " anhiliated each other." ) ; - + if ( lOAV->has_infinite_time() ) { CGAL_STSKEL_BUILDER_TRACE ( 2, "Ficticius N" << lOAV->id() << " erased." ) ; EraseNode(lOAV); } - + if ( lOBV->has_infinite_time() ) { CGAL_STSKEL_BUILDER_TRACE ( 2, "Ficticius N" << lOBV->id() << " erased." ) ; @@ -449,7 +449,7 @@ template void Straight_skeleton_builder_2::CreateInitialEvents() { Triedge const cNull_triedge ; - + CGAL_STSKEL_BUILDER_TRACE(0, "Creating initial events..."); for ( Vertex_iterator v = mSSkel->vertices_begin(); v != mSSkel->vertices_end(); ++ v ) { @@ -472,7 +472,7 @@ void Straight_skeleton_builder_2::CreateContourBisectors() Vertex_handle lPrev = GetPrevInLAV(v) ; Vertex_handle lNext = GetNextInLAV(v) ; - Orientation lOrientation = CGAL::orientation(lPrev->point(),v->point(),lNext->point()); + Orientation lOrientation = CGAL::orientation(lPrev->point(),v->point(),lNext->point()); if ( lOrientation == COLLINEAR ) { SetIsDegenerate(v); @@ -503,27 +503,27 @@ void Straight_skeleton_builder_2::CreateContourBisectors() << " (Out)\n B" << lIBisector->id() << " (In)" ) ; } - + for( Face_iterator fit = mSSkel->SSkel::Base::faces_begin(); fit != mSSkel->SSkel::Base::faces_end(); ++fit) { Halfedge_handle lBorder = fit->halfedge(); Halfedge_handle lLBisector = lBorder->prev(); Halfedge_handle lRBisector = lBorder->next(); - + Vertex_handle lInfNode = mSSkel->SSkel::Base::vertices_push_back( Vertex( mVertexID++ ) ) ; InitVertexData(lInfNode); CGAL_assertion(lInfNode->has_null_point()); lRBisector->HBase_base::set_next( lLBisector ); lLBisector->HBase_base::set_prev( lRBisector ); - + lRBisector->HBase_base::set_vertex(lInfNode); - + lInfNode->VBase::set_halfedge(lRBisector); - + SetBisectorSlope(lRBisector,POSITIVE); SetBisectorSlope(lLBisector,NEGATIVE); - + CGAL_STSKEL_BUILDER_TRACE(3 ,"Closing face of E" << lBorder->id() << " with a ficticious vertex. B" << lRBisector->id() @@ -550,14 +550,14 @@ Straight_skeleton_builder_2::ConstructEdgeEventNode( EdgeEvent& aEvent Vertex_handle lLSeed = aEvent.seed0() ; Vertex_handle lRSeed = aEvent.seed1() ; - + Vertex_handle lNewNode = mSSkel->SSkel::Base::vertices_push_back( Vertex( mVertexID++, aEvent.point(), aEvent.time(), false, false) ) ; InitVertexData(lNewNode); mGLAV.push_back(lNewNode); - + SetTrisegment(lNewNode,aEvent.trisegment()); - + CGAL_STSKEL_BUILDER_TRACE ( 3 , "LSeed: N" << lLSeed->id() << " processed\n" @@ -582,7 +582,7 @@ Straight_skeleton_builder_2::ConstructEdgeEventNode( EdgeEvent& aEvent << 'N' << lLSeed->id() << " removed from LAV\n" << 'N' << lRSeed->id() << " removed from LAV\n" ); - + return lNewNode ; } @@ -594,44 +594,44 @@ Straight_skeleton_builder_2::LookupOnSLAV ( Halfedge_handle aBorder, Ev Vertex_handle_pair rResult ; CGAL_STSKEL_DEBUG_CODE( bool lFound = false ; ) - + // Vertex_handle lSeed = aEvent->seed0(); - + CGAL_STSKEL_BUILDER_TRACE ( 3, "Looking up for E" << aBorder->id() << ". P=" << aEvent->point() ) ; - + for ( typename std::list::const_iterator vi = mGLAV.begin(); vi != mGLAV.end(); ++ vi ) { Vertex_handle v = *vi; - + Triedge const& lTriedge = GetVertexTriedge(v); - + Vertex_handle lPrevN = GetPrevInLAV(v); Vertex_handle lNextN = GetNextInLAV(v); - + if ( lTriedge.e0() == aBorder ) { - Halfedge_handle lPrevBorder = GetEdgeEndingAt(lPrevN) ; - Halfedge_handle lNextBorder = GetEdgeEndingAt(lNextN) ; - + Halfedge_handle lPrevBorder = GetEdgeEndingAt(lPrevN) ; + Halfedge_handle lNextBorder = GetEdgeEndingAt(lNextN) ; + CGAL_STSKEL_DEBUG_CODE( lFound = true ; ) CGAL_STSKEL_BUILDER_TRACE ( 3 , "Subedge found in SLAV: N" << lPrevN->id() << "->N" << v->id() << " (E" << lPrevBorder->id() << "->E" << aBorder->id() << "->E" << lNextBorder->id() << ")" ) ; - + Oriented_side lLSide = EventPointOrientedSide(*aEvent, lPrevBorder, aBorder , lPrevN, false ) ; Oriented_side lRSide = EventPointOrientedSide(*aEvent, aBorder , lNextBorder, v , true ) ; - + if ( lLSide != ON_POSITIVE_SIDE && lRSide != ON_NEGATIVE_SIDE ) { - if ( lLSide != ON_ORIENTED_BOUNDARY || lRSide != ON_ORIENTED_BOUNDARY ) + if ( lLSide != ON_ORIENTED_BOUNDARY || lRSide != ON_ORIENTED_BOUNDARY ) { rSite = ( lLSide == ON_ORIENTED_BOUNDARY ? AT_SOURCE : ( lRSide == ON_ORIENTED_BOUNDARY ? AT_TARGET : INSIDE ) ) ; - + rResult = std::make_pair(lPrevN,v) ; - - CGAL_STSKEL_BUILDER_TRACE ( 3, "Split point found at the " + + CGAL_STSKEL_BUILDER_TRACE ( 3, "Split point found at the " << ( rSite == AT_SOURCE ? "SOURCE vertex" : ( rSite == AT_TARGET ? "TARGET vertex" : "strict inside" ) ) << " of the offset edge." ) ; @@ -641,10 +641,10 @@ Straight_skeleton_builder_2::LookupOnSLAV ( Halfedge_handle aBorder, Ev { CGAL_STSKEL_BUILDER_TRACE ( 3, "Opposite edge collapsed to a point" ) ; } - } + } } } - + #ifdef CGAL_STRAIGHT_SKELETON_ENABLE_TRACE if ( !handle_assigned(rResult.first) ) { @@ -653,10 +653,10 @@ Straight_skeleton_builder_2::LookupOnSLAV ( Halfedge_handle aBorder, Ev CGAL_STSKEL_BUILDER_TRACE(1,"Split event is no longer valid. Opposite edge vanished."); } else - { + { CGAL_STSKEL_BUILDER_TRACE(1,"Split event is no longer valid. Point not inside the opposite edge offset zone."); } - } + } #endif return rResult ; @@ -676,7 +676,7 @@ Straight_skeleton_builder_2::ConstructSplitEventNodes( SplitEvent& aEve Vertex_handle lNewNodeA = mSSkel->SSkel::Base::vertices_push_back( Vertex( mVertexID++, aEvent.point(), aEvent.time(), true, false ) ) ; Vertex_handle lNewNodeB = mSSkel->SSkel::Base::vertices_push_back( Vertex( mVertexID++, aEvent.point(), aEvent.time(), true, false ) ) ; - + InitVertexData(lNewNodeA); InitVertexData(lNewNodeB); SetTrisegment(lNewNodeA,aEvent.trisegment()); @@ -684,11 +684,11 @@ Straight_skeleton_builder_2::ConstructSplitEventNodes( SplitEvent& aEve mGLAV.push_back(lNewNodeA); mGLAV.push_back(lNewNodeB); - + Vertex_handle lSeed = aEvent.seed0() ; - + CGAL_STSKEL_BUILDER_TRACE ( 3, "Seed: N" << lSeed->id() << " processed" ) ; - + SetIsProcessed(lSeed) ; mGLAV.remove(lSeed); @@ -734,12 +734,12 @@ Straight_skeleton_builder_2::ConstructPseudoSplitEventNodes( PseudoSpli mGLAV.push_back(lNewNodeA); mGLAV.push_back(lNewNodeB); - + InitVertexData(lNewNodeA); InitVertexData(lNewNodeB); SetTrisegment(lNewNodeA,aEvent.trisegment()); SetTrisegment(lNewNodeB,aEvent.trisegment()); - + CGAL_STSKEL_BUILDER_TRACE ( 3 @@ -747,7 +747,7 @@ Straight_skeleton_builder_2::ConstructPseudoSplitEventNodes( PseudoSpli << "RSeed: N" << lRSeed->id() << " processed" ) ; - + SetIsProcessed(lLSeed) ; SetIsProcessed(lRSeed) ; mGLAV.remove(lLSeed); @@ -776,7 +776,7 @@ Straight_skeleton_builder_2::ConstructPseudoSplitEventNodes( PseudoSpli << 'N' << lRSeed->id() << " removed from LAV" ); - + rResult = std::make_pair(lNewNodeA,lNewNodeB); mSplitNodes.push_back(rResult); @@ -794,49 +794,49 @@ template bool Straight_skeleton_builder_2::IsValidEdgeEvent( EdgeEvent const& aEvent ) { bool rResult = false ; - + Vertex_handle lLSeed = aEvent.seed0() ; Vertex_handle lRSeed = aEvent.seed1() ; - + Vertex_handle lPrevLSeed = GetPrevInLAV(lLSeed) ; Vertex_handle lNextRSeed = GetNextInLAV(lRSeed) ; - + if ( lPrevLSeed != lNextRSeed ) { Halfedge_handle lPrevE0 = GetEdgeEndingAt(lPrevLSeed) ; Halfedge_handle lE0 = aEvent.triedge().e0() ; Halfedge_handle lE2 = aEvent.triedge().e2() ; Halfedge_handle lNextE2 = GetEdgeStartingAt(lNextRSeed) ; - + CGAL_STSKEL_BUILDER_TRACE(3, "PrevLSeed=N" << lPrevLSeed->id() << " PrevE0=E" << lPrevE0->id() ) ; CGAL_STSKEL_BUILDER_TRACE(3, "NextRSeed=N" << lNextRSeed->id() << " NextE2=E" << lNextE2->id() ) ; - + Oriented_side lLSide = EventPointOrientedSide(aEvent, lPrevE0, lE0 , lPrevLSeed, false ) ; Oriented_side lRSide = EventPointOrientedSide(aEvent, lE2 , lNextE2, lNextRSeed, true ) ; - + bool lLSideOK = ( lLSide != ON_POSITIVE_SIDE ) ; bool lRSideOK = ( lRSide != ON_NEGATIVE_SIDE ) ; - + CGAL_STSKEL_BUILDER_TRACE_IF( !lLSideOK ,3 ,"Invalid edge event: " << aEvent.triedge() << " NewNode is before E" << lE0->id() << " source N" << lPrevLSeed->id() ) ; - + CGAL_STSKEL_BUILDER_TRACE_IF( !lRSideOK ,3 ,"Invalid edge event: " << aEvent.triedge() << " NewNode is past E" << lE2->id() - << " target N" << lNextRSeed->id() + << " target N" << lNextRSeed->id() ) ; - - rResult = lLSideOK && lRSideOK ; + + rResult = lLSideOK && lRSideOK ; } else { // Triangle collapse. No need to test explicitely. rResult = true ; } - return rResult ; + return rResult ; } template @@ -850,17 +850,17 @@ void Straight_skeleton_builder_2::HandleEdgeEvent( EventPtr aEvent ) Vertex_handle lRSeed = lEvent.seed1() ; Vertex_handle lNewNode = ConstructEdgeEventNode(lEvent); - + Halfedge_handle lLOBisector = lLSeed->primary_bisector() ; Halfedge_handle lROBisector = lRSeed->primary_bisector() ; Halfedge_handle lLIBisector = lLOBisector->opposite(); Halfedge_handle lRIBisector = lROBisector->opposite(); - + Vertex_handle lRIFicNode = lROBisector->vertex() ; Vertex_handle lLOFicNode = lLOBisector->vertex() ; - + CrossLink(lLOBisector,lNewNode); - + Link(lROBisector,lNewNode); CrossLinkFwd(lROBisector,lLIBisector) ; @@ -868,64 +868,64 @@ void Straight_skeleton_builder_2::HandleEdgeEvent( EventPtr aEvent ) Halfedge_handle lDefiningBorderA = lNewNode->halfedge()->defining_contour_edge(); Halfedge_handle lDefiningBorderB = lNewNode->halfedge()->opposite()->prev()->opposite()->defining_contour_edge(); Halfedge_handle lDefiningBorderC = lNewNode->halfedge()->opposite()->prev()->defining_contour_edge(); - + lNewNode->VBase::set_event_triedge( lEvent.triedge() ) ; - + Triedge lTri(lDefiningBorderA,lDefiningBorderB,lDefiningBorderC); - + SetVertexTriedge( lNewNode, lTri ) ; - + SetBisectorSlope(lLSeed,lNewNode); SetBisectorSlope(lRSeed,lNewNode); - + CGAL_STSKEL_BUILDER_TRACE( 1, "E" << lRSeed->halfedge()->defining_contour_edge()->id() << " collapsed." ); CGAL_STSKEL_BUILDER_TRACE( 3, "Ficticious node along collapsed face is N" << lRIFicNode->id() << " between B" << lROBisector->id() << " and B" << lLIBisector->id() ) ; - + if ( lLOFicNode->has_infinite_time() ) { CGAL_STSKEL_BUILDER_TRACE(3,"Creating new Edge Event's Bisector"); - + Halfedge_handle lNOBisector = mSSkel->SSkel::Base::edges_push_back ( Halfedge(mEdgeID),Halfedge(mEdgeID+1) ); - + Halfedge_handle lNIBisector = lNOBisector->opposite(); mEdgeID += 2 ; - + CrossLinkFwd(lNOBisector , lLOBisector->next()); CrossLinkFwd(lRIBisector->prev(), lNIBisector ); CrossLink(lNOBisector,lLOFicNode); - + SetBisectorSlope(lNOBisector,POSITIVE); SetBisectorSlope(lNIBisector,NEGATIVE); - + CrossLinkFwd(lNIBisector, lRIBisector); CrossLinkFwd(lLOBisector, lNOBisector); - + Link(lNOBisector,lLOBisector->face()); Link(lNIBisector,lRIBisector->face()); - + Link(lNIBisector,lNewNode); - + CGAL_STSKEL_BUILDER_TRACE( 2, newn2str("",lNewNode,lTri) ) ; CGAL_STSKEL_BUILDER_TRACE( 2, newb2str("O",lNOBisector) ) ; CGAL_STSKEL_BUILDER_TRACE( 2, newb2str("I",lNIBisector) ) ; - + CGAL_STSKEL_BUILDER_TRACE ( 2, "Ficticius N" << lRIFicNode->id() << " erased." ) ; EraseNode(lRIFicNode); - + SetupNewNode(lNewNode) ; - + UpdatePQ(lNewNode, lEvent.triedge()); - + mVisitor.on_edge_event_processed(lLSeed,lRSeed,lNewNode) ; } else { - CGAL_STSKEL_BUILDER_TRACE( 2, newn2str("",lNewNode,lTri) + CGAL_STSKEL_BUILDER_TRACE( 2, newn2str("",lNewNode,lTri) << ".\nThis is a multiple node (A node with these defining edges already exist in the LAV)" ); } - + CGAL_STSKEL_BUILDER_TRACE( 1, "Wavefront: " << wavefront2str(lNewNode) ); } } @@ -944,75 +944,75 @@ void Straight_skeleton_builder_2::HandleSplitEvent( EventPtr aEvent, Ve if ( IsValidSplitEvent(lEvent) ) { Vertex_handle lSeed = lEvent.seed0(); - + Vertex_handle lOppL = aOpp.first ; Vertex_handle lOppR = aOpp.second ; - + Halfedge_handle lOppIBisector_L = lOppL->primary_bisector()->opposite(); Halfedge_handle lOppOBisector_R = lOppR->primary_bisector(); - + Vertex_handle lOppFicNode = lOppOBisector_R->vertex() ; (void)lOppFicNode; // variable may be unused - + CGAL_assertion(lOppOBisector_R->next() == lOppIBisector_L ) ; CGAL_assertion(lOppIBisector_L->prev() == lOppOBisector_R ) ; CGAL_assertion(lOppFicNode->has_infinite_time()); - - + + CGAL_STSKEL_BUILDER_TRACE(2,"Splitted face: N" << lOppR->id() << "->B" << lOppOBisector_R->id() << "->N" << lOppFicNode->id() << "->B" << lOppIBisector_L->id() << "->N" << lOppL->id() - ) ; - + ) ; + CGAL_STSKEL_BUILDER_TRACE(2,"Ficticious node for right half of opposite edge: N" << lOppFicNode->id() ) ; - + Halfedge_handle lOppBorder = lEvent.triedge().e2() ; - + Vertex_handle lNewNode_L, lNewNode_R ; boost::tie(lNewNode_L,lNewNode_R) = ConstructSplitEventNodes(lEvent,lOppR); - + // Triedge lTriedge = aEvent->triedge(); - + // Halfedge_handle lReflexLBorder = lTriedge.e0(); // Halfedge_handle lReflexRBorder = lTriedge.e1(); - + Halfedge_handle lNOBisector_L = mSSkel->SSkel::Base::edges_push_back ( Halfedge(mEdgeID ),Halfedge(mEdgeID+1) ); Halfedge_handle lNOBisector_R = mSSkel->SSkel::Base::edges_push_back ( Halfedge(mEdgeID+2),Halfedge(mEdgeID+3) ); Halfedge_handle lNIBisector_L = lNOBisector_L->opposite(); Halfedge_handle lNIBisector_R = lNOBisector_R->opposite(); - + mEdgeID += 4 ; - + Halfedge_handle lXOBisector = lSeed->primary_bisector() ; Halfedge_handle lXIBisector = lXOBisector->opposite(); - + Halfedge_handle lXONextBisector = lXOBisector->next(); Halfedge_handle lXIPrevBisector = lXIBisector->prev(); - + Vertex_handle lXOFicNode = lXOBisector->vertex() ; CGAL_assertion(lXOFicNode->has_infinite_time()); - + CGAL_STSKEL_BUILDER_TRACE(2,"Ficticious node for left reflex face: N" << lXOFicNode->id() ) ; CGAL_STSKEL_BUILDER_TRACE(2,"Ficticious node for right reflex face: N" << lXIPrevBisector->vertex()->id() ) ; - + Link(lNewNode_L,lXOBisector); Link(lNewNode_R,lNIBisector_L) ; - + Link(lXOBisector,lNewNode_L); - + Link(lNOBisector_L,lXOBisector->face()); Link(lNIBisector_L,lOppBorder ->face()); Link(lNOBisector_R,lOppBorder ->face()); Link(lNIBisector_R,lXIBisector->face()); - + Link(lNIBisector_L,lNewNode_R); Link(lNIBisector_R,lNewNode_R); - + Link(lNOBisector_L,lXOFicNode); - - + + CrossLinkFwd(lXOBisector ,lNOBisector_L); CrossLinkFwd(lNOBisector_L ,lXONextBisector); CrossLinkFwd(lXIPrevBisector,lNIBisector_R); @@ -1020,37 +1020,37 @@ void Straight_skeleton_builder_2::HandleSplitEvent( EventPtr aEvent, Ve CrossLinkFwd(lOppOBisector_R,lNIBisector_L); CrossLinkFwd(lNIBisector_L ,lNOBisector_R); CrossLinkFwd(lNOBisector_R ,lOppIBisector_L); - + SetBisectorSlope(lSeed,lNewNode_L); - + Vertex_handle lNewFicNode = mSSkel->SSkel::Base::vertices_push_back( Vertex( mVertexID++ ) ) ; InitVertexData(lNewFicNode); CGAL_assertion(lNewFicNode->has_null_point()); CrossLink(lNOBisector_R,lNewFicNode); - + SetBisectorSlope(lNOBisector_L,POSITIVE); SetBisectorSlope(lNIBisector_L,NEGATIVE); SetBisectorSlope(lNOBisector_R,POSITIVE); SetBisectorSlope(lNIBisector_R,NEGATIVE); - + CGAL_STSKEL_BUILDER_TRACE(2,"(New) ficticious node for left half of opposite edge: N" << lNewFicNode->id() ) ; - + Halfedge_handle lNewNode_L_DefiningBorderA = lNewNode_L->halfedge()->defining_contour_edge(); Halfedge_handle lNewNode_L_DefiningBorderB = lNewNode_L->halfedge()->opposite()->prev()->opposite()->defining_contour_edge(); Halfedge_handle lNewNode_L_DefiningBorderC = lNewNode_L->halfedge()->opposite()->prev()->defining_contour_edge(); Halfedge_handle lNewNode_R_DefiningBorderA = lNewNode_R->halfedge()->defining_contour_edge(); Halfedge_handle lNewNode_R_DefiningBorderB = lNewNode_R->halfedge()->opposite()->prev()->opposite()->defining_contour_edge(); Halfedge_handle lNewNode_R_DefiningBorderC = lNewNode_R->halfedge()->opposite()->prev()->defining_contour_edge(); - + lNewNode_L->VBase::set_event_triedge( lEvent.triedge() ) ; lNewNode_R->VBase::set_event_triedge( lEvent.triedge() ) ; - + Triedge lTriL( lNewNode_L_DefiningBorderA,lNewNode_L_DefiningBorderB,lNewNode_L_DefiningBorderC ) ; Triedge lTriR( lNewNode_R_DefiningBorderA,lNewNode_R_DefiningBorderB,lNewNode_R_DefiningBorderC ) ; - + SetVertexTriedge( lNewNode_L, lTriL ) ; SetVertexTriedge( lNewNode_R, lTriR ) ; - + CGAL_STSKEL_BUILDER_TRACE(2, newn2str("L",lNewNode_L,lTriL) << std::endl << newn2str("R",lNewNode_R,lTriR) << std::endl << newb2str("OL",lNOBisector_L) << std::endl @@ -1058,19 +1058,19 @@ void Straight_skeleton_builder_2::HandleSplitEvent( EventPtr aEvent, Ve << newb2str("OR",lNOBisector_R) << std::endl << newb2str("IR",lNIBisector_R) ) ; - + CGAL_STSKEL_BUILDER_TRACE( 1, "Wavefronts:\n " << wavefront2str(lNewNode_L) << "\n " << wavefront2str(lNewNode_R) ); - + SetupNewNode(lNewNode_L) ; SetupNewNode(lNewNode_R) ; - + UpdatePQ(lNewNode_L, lEvent.triedge()); UpdatePQ(lNewNode_R, lEvent.triedge()); - + mVisitor.on_split_event_processed(lSeed,lNewNode_L,lNewNode_R) ; } - + } template @@ -1081,15 +1081,15 @@ void Straight_skeleton_builder_2::SetupNewNode( Vertex_handle aNode ) { Halfedge_handle lLE = GetEdgeEndingAt (aNode); Halfedge_handle lRE = GetEdgeStartingAt(aNode); - + Vector_2 lLV = CreateVector(lLE); Vector_2 lRV = CreateVector(lRE); - + Orientation lOrientation = CGAL::orientation(lLV,lRV) ; if ( lOrientation == COLLINEAR ) { SetIsDegenerate(aNode); - CGAL_STSKEL_BUILDER_TRACE(1, "COLLINEAR *NEW* vertex: N" << aNode->id() << " (E" << lLE->id() << ",E" << lRE->id() << ")" ) ; + CGAL_STSKEL_BUILDER_TRACE(1, "COLLINEAR *NEW* vertex: N" << aNode->id() << " (E" << lLE->id() << ",E" << lRE->id() << ")" ) ; } else if ( lOrientation == RIGHT_TURN ) { @@ -1104,7 +1104,7 @@ template bool counterclockwise_at_or_in_between_2( Direction const& p, Direction const& q, Direction const& r ) { typedef typename Kernel_traits::Kernel K ; - + return p == q || p == r || K().counterclockwise_in_between_2_object()(p,q,r) ; } @@ -1113,36 +1113,36 @@ bool Straight_skeleton_builder_2::IsValidPseudoSplitEvent( PseudoSplitE { Vertex_handle lSeed0 = aEvent.seed0(); Vertex_handle lSeed1 = aEvent.seed1(); - + Halfedge_handle lEL0 = GetEdgeEndingAt (lSeed0); Halfedge_handle lER0 = GetEdgeStartingAt(lSeed0); - + Halfedge_handle lEL1 = GetEdgeEndingAt (lSeed1); Halfedge_handle lER1 = GetEdgeStartingAt(lSeed1); - + Direction_2 lDL0 = - CreateDirection(lEL0); Direction_2 lDL1 = - CreateDirection(lEL1); Direction_2 lDR0 = CreateDirection(lER0); Direction_2 lDR1 = CreateDirection(lER1); - + bool lV01Degenerate = (lDL0 == lDR1) ; bool lV10Degenerate = (lDL1 == lDR0) ; - - + + CGAL_STSKEL_BUILDER_TRACE(3, "Validating pseudo-split event. Resulting re-connection: " << "\nE" << lEL0->id() << " [DL0:" << dir2str(lDL0) << "]" << "->E" << lER1->id() << " [DR1:" << dir2str(lDR1) << "]" << ( lV01Degenerate ? " (degenerate)" : "" ) << "\nE" << lEL1->id() << " [DL1:" << dir2str(lDL1) << "]" << "->E" << lER0->id() << " [DR0:" << dir2str(lDR0) << "]" << ( lV10Degenerate ? " (degenerate)" : "" ) ) ; - + bool lTangled ; - + if ( !lV01Degenerate ) { bool lEL1V_Tangled = counterclockwise_at_or_in_between_2(lDL1,lDR1,lDL0); bool lER0V_Tangled = counterclockwise_at_or_in_between_2(lDR0,lDR1,lDL0); - + lTangled = lEL1V_Tangled || lER0V_Tangled ; } else if ( !lV10Degenerate ) @@ -1156,7 +1156,7 @@ bool Straight_skeleton_builder_2::IsValidPseudoSplitEvent( PseudoSplitE { lTangled = (lDL0 == lDL1) ; } - + CGAL_STSKEL_BUILDER_TRACE_IF(lTangled, 3, "Tangled profile. Pseudo-split event is invalid"); return !lTangled ; @@ -1166,7 +1166,7 @@ template void Straight_skeleton_builder_2::HandlePseudoSplitEvent( EventPtr aEvent ) { PseudoSplitEvent& lEvent = dynamic_cast(*aEvent) ; - + if ( IsValidPseudoSplitEvent(lEvent) ) { Vertex_handle lLSeed = lEvent.seed0() ; @@ -1174,57 +1174,57 @@ void Straight_skeleton_builder_2::HandlePseudoSplitEvent( EventPtr aEve Vertex_handle lNewNode_L, lNewNode_R ; boost::tie(lNewNode_L,lNewNode_R) = ConstructPseudoSplitEventNodes(lEvent); - + Halfedge_handle lNBisector_LO = mSSkel->SSkel::Base::edges_push_back ( Halfedge(mEdgeID ),Halfedge(mEdgeID+1) ); Halfedge_handle lNBisector_RO = mSSkel->SSkel::Base::edges_push_back ( Halfedge(mEdgeID+2),Halfedge(mEdgeID+3) ); Halfedge_handle lNBisector_LI = lNBisector_LO->opposite(); Halfedge_handle lNBisector_RI = lNBisector_RO->opposite(); - + mEdgeID += 4 ; - + Halfedge_handle lSBisector_LO = lLSeed->primary_bisector() ; Halfedge_handle lSBisector_LI = lSBisector_LO->opposite(); - + Halfedge_handle lSBisector_RO = lRSeed->primary_bisector() ; Halfedge_handle lSBisector_RI = lSBisector_RO->opposite(); - + Halfedge_handle lSBisector_LO_Next = lSBisector_LO->next(); Halfedge_handle lSBisector_RO_Next = lSBisector_RO->next(); Halfedge_handle lSBisector_LI_Prev = lSBisector_LI->prev(); Halfedge_handle lSBisector_RI_Prev = lSBisector_RI->prev(); - + Vertex_handle lFicNod_SLO = lSBisector_LO->vertex(); - CGAL_assertion_code(Vertex_handle lFicNod_SLI = lSBisector_LI_Prev->vertex();) // unused + CGAL_assertion_code(Vertex_handle lFicNod_SLI = lSBisector_LI_Prev->vertex();) // unused Vertex_handle lFicNod_SRO = lSBisector_RO->vertex(); CGAL_assertion_code(Vertex_handle lFicNod_SRI = lSBisector_RI_Prev->vertex();) // unused - + CGAL_assertion( lFicNod_SLO->has_infinite_time() ) ; CGAL_assertion( lFicNod_SLI->has_infinite_time() ) ; CGAL_assertion( lFicNod_SRO->has_infinite_time() ) ; CGAL_assertion( lFicNod_SRI->has_infinite_time() ) ; - + Link(lNBisector_LO, lSBisector_LO->face()); Link(lNBisector_LI, lSBisector_RI->face()); Link(lNBisector_RO, lSBisector_RO->face()); Link(lNBisector_RI, lSBisector_LI->face()); - + CrossLink(lSBisector_LO, lNewNode_L ); CrossLink(lSBisector_RO, lNewNode_R ); - + CrossLink(lNBisector_LO, lFicNod_SLO ); CrossLink(lNBisector_RO, lFicNod_SRO ); - + SetBisectorSlope(lNBisector_LO,POSITIVE); SetBisectorSlope(lNBisector_LI,NEGATIVE); SetBisectorSlope(lNBisector_RO,POSITIVE); SetBisectorSlope(lNBisector_RI,NEGATIVE); - + Link(lNBisector_LI, lNewNode_L); Link(lNBisector_RI, lNewNode_R); Link(lNewNode_L, lSBisector_LO); Link(lNewNode_R, lSBisector_RO); - + CrossLinkFwd(lSBisector_LO,lNBisector_LO); CrossLinkFwd(lNBisector_LO,lSBisector_LO_Next); CrossLinkFwd(lSBisector_LI_Prev,lNBisector_RI); @@ -1233,26 +1233,26 @@ void Straight_skeleton_builder_2::HandlePseudoSplitEvent( EventPtr aEve CrossLinkFwd(lNBisector_LI,lSBisector_RI); CrossLinkFwd(lSBisector_RO,lNBisector_RO); CrossLinkFwd(lNBisector_RO,lSBisector_RO_Next); - + SetBisectorSlope(lLSeed,lNewNode_L); SetBisectorSlope(lRSeed,lNewNode_R); - + Halfedge_handle lNewNode_L_DefiningBorderA = lNewNode_L->halfedge()->defining_contour_edge(); Halfedge_handle lNewNode_L_DefiningBorderB = lNewNode_L->halfedge()->next()->opposite()->defining_contour_edge(); Halfedge_handle lNewNode_L_DefiningBorderC = lNewNode_L->halfedge()->opposite()->prev()->defining_contour_edge(); Halfedge_handle lNewNode_R_DefiningBorderA = lNewNode_R->halfedge()->defining_contour_edge(); Halfedge_handle lNewNode_R_DefiningBorderB = lNewNode_R->halfedge()->next()->opposite()->defining_contour_edge(); Halfedge_handle lNewNode_R_DefiningBorderC = lNewNode_R->halfedge()->opposite()->prev()->defining_contour_edge(); - + lNewNode_L->VBase::set_event_triedge( lEvent.triedge() ) ; lNewNode_R->VBase::set_event_triedge( lEvent.triedge() ) ; - + Triedge lTriL( lNewNode_L_DefiningBorderA, lNewNode_L_DefiningBorderB, lNewNode_L_DefiningBorderC ) ; Triedge lTriR( lNewNode_R_DefiningBorderA, lNewNode_R_DefiningBorderB, lNewNode_R_DefiningBorderC ) ; - + SetVertexTriedge( lNewNode_L, lTriL ) ; SetVertexTriedge( lNewNode_R, lTriR ) ; - + CGAL_STSKEL_BUILDER_TRACE(2, newn2str("L",lNewNode_L,lTriL) << std::endl << newn2str("R",lNewNode_R,lTriR) << std::endl << newb2str("OL",lNBisector_LO) << std::endl @@ -1260,35 +1260,35 @@ void Straight_skeleton_builder_2::HandlePseudoSplitEvent( EventPtr aEve << newb2str("OR",lNBisector_RO) << std::endl << newb2str("IR",lNBisector_RI) ) ; - + CGAL_STSKEL_BUILDER_TRACE( 1, "Wavefronts:\n " << wavefront2str(lNewNode_L) << "\n " << wavefront2str(lNewNode_R) ); - + SetupNewNode(lNewNode_L) ; SetupNewNode(lNewNode_R) ; - + UpdatePQ(lNewNode_L, lEvent.triedge()); UpdatePQ(lNewNode_R, lEvent.triedge()); - + mVisitor.on_pseudo_split_event_processed(lLSeed,lRSeed,lNewNode_L,lNewNode_R) ; - } + } } template void Straight_skeleton_builder_2::HandleSplitOrPseudoSplitEvent( EventPtr aEvent ) { Halfedge_handle lOppEdge = aEvent->triedge().e2() ; - + Site lSite; - + Vertex_handle_pair lOpp = LookupOnSLAV(lOppEdge,aEvent,lSite); - + if ( handle_assigned(lOpp.first) ) { EventPtr lPseudoSplitEvent = IsPseudoSplitEvent(aEvent,lOpp,lSite); if ( lPseudoSplitEvent ) HandlePseudoSplitEvent(lPseudoSplitEvent); - else HandleSplitEvent(aEvent,lOpp); - } + else HandleSplitEvent(aEvent,lOpp); + } } template @@ -1316,33 +1316,33 @@ void Straight_skeleton_builder_2::Propagate() for (;;) { InsertNextSplitEventsInPQ(); - + if ( !mPQ.empty() ) { EventPtr lEvent = PopEventFromPQ(); - - if ( lEvent->type() != Event::cEdgeEvent ) + + if ( lEvent->type() != Event::cEdgeEvent ) AllowNextSplitEvent(lEvent->seed0()); - + if ( !IsProcessed(lEvent) ) { CGAL_STSKEL_BUILDER_TRACE (1,"\nS" << mStepID << " Event: " << *lEvent ) ; - + SetEventTimeAndPoint(*lEvent) ; - + switch ( lEvent->type() ) { case Event::cEdgeEvent : HandleEdgeEvent (lEvent) ; break ; case Event::cSplitEvent : HandleSplitOrPseudoSplitEvent(lEvent) ; break ; - case Event::cPseudoSplitEvent: HandlePseudoSplitEvent (lEvent) ; break ; + case Event::cPseudoSplitEvent: HandlePseudoSplitEvent (lEvent) ; break ; } - + ++ mStepID ; } - } + } else break ; } - + mVisitor.on_propagation_finished(); } @@ -1356,7 +1356,7 @@ void Straight_skeleton_builder_2::MergeSplitNodes ( Vertex_handle_pair Halfedge_handle lIBisectorR1 = lRNode->primary_bisector()->opposite(); Halfedge_handle lIBisectorL2 = lIBisectorL1->next()->opposite(); Halfedge_handle lIBisectorR2 = lIBisectorR1->next()->opposite(); - + CGAL_STSKEL_BUILDER_TRACE(2 ,"Merging SplitNodes: (L) N" << lLNode->id() << " and (R) N" << lRNode->id() << ".\n" << " LOut: B" << lLNode->primary_bisector()->id() << '\n' @@ -1364,7 +1364,7 @@ void Straight_skeleton_builder_2::MergeSplitNodes ( Vertex_handle_pair << " LIn1: B" << lIBisectorL1->id() << '\n' << " RIn1: B" << lIBisectorR1->id() << '\n' << " LIn2: B" << lIBisectorL2->id() << '\n' - << " RIn2: B" << lIBisectorR2->id() + << " RIn2: B" << lIBisectorR2->id() ); if ( lIBisectorL1->vertex() == lRNode ) @@ -1404,13 +1404,13 @@ void TraceMultinode( char const* t, Halfedge_handle b, Halfedge_handle e ) { std::ostringstream ss ; ss << t ; - + do { ss << "B" << b->id() << " N" << b->vertex()->id() << " " ; } while ( b = b->next(), b != e ) ; - + std::string s = ss.str(); CGAL_STSKEL_BUILDER_TRACE(0, s); } @@ -1435,18 +1435,18 @@ void TraceFinalBisectors( Vertex_handle v, Halfedge_around_vertex_circulator cb do { double phi = angle_wrt_X((*c)->vertex()->point(),(*c)->opposite()->vertex()->point()); - - CGAL_STSKEL_BUILDER_TRACE(2, " N" << v->id() << " in=B" << (*c)->id() - << " E" << (*c)->defining_contour_edge()->id() - << " out=B" << (*c)->opposite()->id() - << " E" << (*c)->opposite()->defining_contour_edge()->id() + + CGAL_STSKEL_BUILDER_TRACE(2, " N" << v->id() << " in=B" << (*c)->id() + << " E" << (*c)->defining_contour_edge()->id() + << " out=B" << (*c)->opposite()->id() + << " E" << (*c)->opposite()->defining_contour_edge()->id() << " phi=" << phi ); - + ++ c ; } while( c != cb ) ; - + } #endif @@ -1454,62 +1454,62 @@ template bool ValidateFinalBisectorsAfterMerge( Vertex_handle /* v */, Halfedge_around_vertex_circulator cb ) { bool rOK = true ; - + Halfedge_around_vertex_circulator c = cb ; do { if ( (*c)->defining_contour_edge() != (*c)->prev()->defining_contour_edge() ) rOK = false ; - + ++ c ; } while( rOK && c != cb ) ; - + return rOK ; - + } template void Straight_skeleton_builder_2::RelinkBisectorsAroundMultinode( Vertex_handle const& v0, Halfedge_handle_vector& aLinks ) { CGAL_assertion( aLinks.size() > 0 ) ; - + CGAL_STSKEL_BUILDER_TRACE(4, "Relinking " << aLinks.size() << " bisectors around N" << v0->id() ) ; - + // Connect the bisectors with each other following the CCW ordering - - Halfedge_handle first_he = aLinks.front(); + + Halfedge_handle first_he = aLinks.front(); Halfedge_handle prev_he = first_he ; - + first_he->HBase_base::set_vertex(v0); - + for ( typename Halfedge_handle_vector::iterator i = std::next(aLinks.begin()), ei = aLinks.end(); i != ei ; ++ i ) { Halfedge_handle he = *i ; he->HBase_base::set_vertex(v0); - + Halfedge_handle prev_he_opp = prev_he->opposite(); - + he ->HBase_base::set_next(prev_he_opp); prev_he_opp->HBase_base::set_prev(he); CGAL_STSKEL_BUILDER_TRACE(4, "Relinking B" << he->id() << "->B" << prev_he_opp->id() ) ; - + prev_he = he ; } Halfedge_handle prev_he_opp = prev_he->opposite(); - + first_he ->HBase_base::set_next(prev_he_opp); prev_he_opp->HBase_base::set_prev(first_he); CGAL_STSKEL_BUILDER_TRACE(4, "Relinking B" << first_he->id() << "->B" << prev_he_opp->id() ) ; - - // Reset the main halfedge for v0 + + // Reset the main halfedge for v0 v0->VBase::set_halfedge(first_he) ; - + CGAL_STSKEL_DEBUG_CODE( TraceFinalBisectors(v0,v0->halfedge_around_vertex_begin()); ) CGAL_postcondition( ValidateFinalBisectorsAfterMerge(v0,v0->halfedge_around_vertex_begin()) ) ; @@ -1526,13 +1526,13 @@ void Straight_skeleton_builder_2::PreprocessMultinode( Multinode& aMN ) // Each ->next() halfedge in the profile points to a subsequent node. // The second halfedge in the pair is past-the-end (it points to the first node around the face that IS NOT part of the multinode) // - + // Halfedge_handle oend = validate(aMN.end->opposite()); - + Halfedge_handle h = aMN.begin ; - + aMN.bisectors_to_relink.push_back(h); - + // Traverse the profile collecting: // The nodes to be removed from the HDS (all but the first) // The bisectors to be removed from the HDS (each bisector pointing to the next node in the multinode) @@ -1553,19 +1553,19 @@ void Straight_skeleton_builder_2::PreprocessMultinode( Multinode& aMN ) ccw = validate(ccw->opposite()->prev()) ; if ( ccw != ccw_end ) aMN.bisectors_to_relink.push_back(ccw); - else break ; - } + else break ; + } if ( h != aMN.begin ) { aMN.nodes_to_remove.push_back(h->vertex()); } - + h = nx; } while ( h != aMN.end ) ; - + aMN.bisectors_to_relink.push_back(aMN.end->opposite()); - + CGAL_STSKEL_DEBUG_CODE( TraceMultinode("Preprocessing multinode: ", aMN.begin,aMN.end) ) ; } @@ -1574,13 +1574,13 @@ void Straight_skeleton_builder_2::PreprocessMultinode( Multinode& aMN ) // relinking the other bisectors. // template -void Straight_skeleton_builder_2::ProcessMultinode( Multinode& aMN - , Halfedge_handle_vector& rBisectorsToRemove +void Straight_skeleton_builder_2::ProcessMultinode( Multinode& aMN + , Halfedge_handle_vector& rBisectorsToRemove , Vertex_handle_vector& rNodesToRemove ) { bool lDoNotProcess = false ; - + Halfedge_handle h = aMN.begin ; do @@ -1589,11 +1589,11 @@ void Straight_skeleton_builder_2::ProcessMultinode( Multinode& lDoNotProcess = true ; } while ( h = h->next(), !lDoNotProcess && h != aMN.end ) ; - + if ( !lDoNotProcess ) { CGAL_STSKEL_DEBUG_CODE( TraceMultinode("Processing multinode: ", aMN.begin,aMN.end) ) ; - + Halfedge_handle h = aMN.begin ; do { @@ -1602,11 +1602,11 @@ void Straight_skeleton_builder_2::ProcessMultinode( Multinode& while ( h = h->next(), h != aMN.end ) ; std::copy(aMN.bisectors_to_remove.begin(), aMN.bisectors_to_remove.end(), std::back_inserter(rBisectorsToRemove)); - + for( Vertex_handle_vector_iterator vi = aMN.nodes_to_remove.begin(), evi = aMN.nodes_to_remove.end() ; vi != evi ; ++ vi ) rNodesToRemove.push_back(*vi) ; - - RelinkBisectorsAroundMultinode(aMN.v,aMN.bisectors_to_relink); + + RelinkBisectorsAroundMultinode(aMN.v,aMN.bisectors_to_relink); } } @@ -1624,15 +1624,15 @@ Straight_skeleton_builder_2::CreateMultinode( Halfedge_handle begin, Ha // // If moving edges Ei,Ej collide with moving edge Ek causing Ej to collapse, Ei and Ek becomes consecutive and a new // polygon vertex (Ei,Ek) appears in the wavefront. -// If moving edges Ei,Ej collide with moving edge Ek causing Ek to be split in two halves, L(Ek) amd R(Ek) resp, two new +// If moving edges Ei,Ej collide with moving edge Ek causing Ek to be split in two halves, L(Ek) amd R(Ek) resp, two new // polygon vertices appears in the wavefront; namely: (Ei,R(Ek)) and (L(Ek),Ej)) // If moving edge Ei,Ej collide with both Ek,El simultaneously causing the edges to cross-connect, two new vertices // (Ei,Ek) and (El,Ej) appear in the wavefront. // // In all those 3 cases, each new polygon vertex is represented in the straight skeleton as a skeleton node. // Every skeleton node is describing the coallision of at least 3 edges (called the "defining edges" of the node) -// and it has at least 3 incident bisectors, each one pairing 2 out of the total number of defining egdes. -// +// and it has at least 3 incident bisectors, each one pairing 2 out of the total number of defining egdes. +// // Any skeleton node has a degree of at least 3, but if more than 3 edges collide simultaneously, the corresponding // skeleton node has a higher degree. (the degree of the node is exactly the number of colliding edges) // @@ -1641,7 +1641,7 @@ Straight_skeleton_builder_2::CreateMultinode( Halfedge_handle begin, Ha // of the proper degree is needed. // // Two skeleton nodes are "coincident" IFF they have 2 defining edges in common and each triedge of edges collide -// at the same time and point. IOW, 2 nodes are coincident if they represent the simultaneous +// at the same time and point. IOW, 2 nodes are coincident if they represent the simultaneous // coallison of exactly 4 edges (the union of 2 triedges with 2 common elements is a set of 4). // template @@ -1666,7 +1666,7 @@ void Straight_skeleton_builder_2::MergeCoincidentNodes() // That is, the triedge of defining edges that correspond to each skeleton node around the face follow this // sequence: (Ei,Ea,Eb), (Ei,Eb,Ec), (Ei,Ec,Ed), ... // - // Any 2_ consecutive_ skeleton nodes around a face share 2 out of the 3 defining edges, which is one of the + // Any 2_ consecutive_ skeleton nodes around a face share 2 out of the 3 defining edges, which is one of the // neccesary conditions for "coincidence". Therefore, coincident nodes can only come as consecutive along a face // @@ -1701,7 +1701,7 @@ void Straight_skeleton_builder_2::MergeCoincidentNodes() if ( ! v->has_infinite_time() ) { CGAL_assertion ( v->is_skeleton() ) ; - + if ( !AreSkeletonNodesCoincident(v0,v) ) { if ( h0->next() != h ) @@ -1713,7 +1713,7 @@ void Straight_skeleton_builder_2::MergeCoincidentNodes() } h = validate(h->next()); - } + } if ( h0->next() != h ) lMultinodes.push_back( CreateMultinode(h0,h) ); @@ -1722,27 +1722,27 @@ void Straight_skeleton_builder_2::MergeCoincidentNodes() // // The merging loop removes all but one of the coincident skeleton nodes and the halfedges between them. - // But it can't physically erase those from the HDS while looping, so the nodes/bisector to erase + // But it can't physically erase those from the HDS while looping, so the nodes/bisector to erase // are collected in these sequences are erased after the merging loop. - // + // Halfedge_handle_vector lBisectorsToRemove ; Vertex_handle_vector lNodesToRemove ; for ( typename MultinodeVector::iterator it = lMultinodes.begin(), eit = lMultinodes.end() ; it != eit ; ++ it ) PreprocessMultinode(**it); - + std::sort(lMultinodes.begin(), lMultinodes.end(), MultinodeComparer()); - + for ( typename MultinodeVector::iterator it = lMultinodes.begin(), eit = lMultinodes.end() ; it != eit ; ++ it ) ProcessMultinode(**it,lBisectorsToRemove,lNodesToRemove); - + for( Halfedge_handle_vector_iterator hi = lBisectorsToRemove.begin(), ehi = lBisectorsToRemove.end() ; hi != ehi ; ++ hi ) { CGAL_STSKEL_BUILDER_TRACE(1, "B" << (*hi)->id() << " removed."); (*hi)->HBase_base::reset_id(-1); - mSSkel->SSkel::Base::edges_erase(*hi); + mSSkel->SSkel::Base::edges_erase(*hi); } - + for( Vertex_handle_vector_iterator vi = lNodesToRemove.begin(), evi = lNodesToRemove.end() ; vi != evi ; ++ vi ) EraseNode(*vi); } @@ -1753,18 +1753,18 @@ bool Straight_skeleton_builder_2::FinishUp() CGAL_STSKEL_BUILDER_TRACE(0, "\n\nFinishing up..."); mVisitor.on_cleanup_started(); - + std::for_each( mSplitNodes.begin() ,mSplitNodes.end () ,boost::bind(&Straight_skeleton_builder_2::MergeSplitNodes,this,_1) ) ; - + std::for_each( mDanglingBisectors.begin() ,mDanglingBisectors.end () ,boost::bind(&Straight_skeleton_builder_2::EraseBisector,this,_1) ) ; - - MergeCoincidentNodes(); + + MergeCoincidentNodes(); mVisitor.on_cleanup_finished(); @@ -1783,31 +1783,31 @@ template typename Straight_skeleton_builder_2::SSkelPtr Straight_skeleton_builder_2::construct_skeleton( bool aNull_if_failed ) { bool ok = false ; - + try { ok = Run() ; } - catch( std::exception const& e ) + catch( std::exception const& e ) { mVisitor.on_error ( e.what() ) ; CGAL_STSKEL_BUILDER_TRACE(0,"EXCEPTION THROWN (" << e.what() << ") during straight skeleton construction."); } - catch(...) + catch(...) { mVisitor.on_error ( "Unhandled exception" ) ; CGAL_STSKEL_BUILDER_TRACE(0,"UNHANDLED EXCEPTION during straight skeleton construction."); } - if ( !ok ) + if ( !ok ) { CGAL_STSKEL_BUILDER_TRACE(0,"Invalid result."); if ( aNull_if_failed ) - mSSkel = SSkelPtr() ; + mSSkel = SSkelPtr() ; } mVisitor.on_algorithm_finished(ok); - + return mSSkel ; } diff --git a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_traits_2_aux.h b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_traits_2_aux.h index e38aa809e1f..11e9dd4262e 100644 --- a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_traits_2_aux.h +++ b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_traits_2_aux.h @@ -31,7 +31,7 @@ #ifdef CGAL_USE_CORE -# include +# include #endif namespace CGAL { @@ -41,20 +41,20 @@ namespace CGAL_SS_i { using boost::optional ; using boost::intrusive_ptr ; -template -T const& validate ( boost::optional const& o ) -{ +template +T const& validate ( boost::optional const& o ) +{ if ( !o ) throw std::overflow_error("Arithmetic overflow"); - return *o ; + return *o ; } - -template + +template NT const& validate( NT const& n ) -{ +{ if ( !CGAL_NTS is_finite(n) ) throw std::overflow_error("Arithmetic overflow"); - return n ; + return n ; } // boost::make_optional is provided in Boost >= 1.34, but not before, so we define our own versions here. @@ -142,7 +142,7 @@ class Rational NT d() const { return mD ; } CGAL::Quotient to_quotient() const { return CGAL::Quotient(mN,mD) ; } - + NT to_nt() const { return mN / mD ; } friend std::ostream& operator << ( std::ostream& os, Rational const& rat ) @@ -162,19 +162,19 @@ class Rational // A straight skeleton event is the simultaneous coallision of 3 ore ffseted oriented straight line segments // e0*,e1*,e2* [e* denotes an _offseted_ edge]. // -// A straight skeleton event is the simultaneous coallision of 3 ore +// A straight skeleton event is the simultaneous coallision of 3 ore // // This record stores the segments corresponding to the INPUT edges (e0,e1,e2) whose offsets intersect // at the event along with their collinearity. // // If the event is a an edge-event, then e0*->e1*->e2* must be consecutive right before the event so that -// after the event e0* and e2* become consecutive. Thus, there are _offset_ vertices (e0*,e1*) and (e1*,e2*) +// after the event e0* and e2* become consecutive. Thus, there are _offset_ vertices (e0*,e1*) and (e1*,e2*) // in the offset polygon which not neccesarily exist in the original polygon. // // If the event is a split-event, e0*->e1* must be consecutive right before the event so that after the event // e0*->right(e2*) and left(e2*)->e1* become consecutive. Thus, there is an offset vertex (e0*,e1*) in the // offset polygon which not neccesarily exist in the original polygon. -// +// // The offset vertices (e0*,e1*) and (e1*,e2*) are called the left and right seeds for the event. // A seed is a contour node if the vertex is already present in the input polygon, otherwise is a skeleton node. // If a seed is a skeleton node is produced by a previous event so it is itself defined as a trisegment, thus, @@ -187,48 +187,48 @@ class Trisegment_2 : public Ref_counted_base public: typedef typename K::Segment_2 Segment_2 ; - + typedef intrusive_ptr Self_ptr ; - + public: Trisegment_2 ( Segment_2 const& aE0 , Segment_2 const& aE1 , Segment_2 const& aE2 - , Trisegment_collinearity aCollinearity - ) + , Trisegment_collinearity aCollinearity + ) { mCollinearity = aCollinearity ; - + mE[0] = aE0 ; mE[1] = aE1 ; mE[2] = aE2 ; - + switch ( mCollinearity ) { case TRISEGMENT_COLLINEARITY_01: mCSIdx=0; mNCSIdx=2; break ; - + case TRISEGMENT_COLLINEARITY_12: mCSIdx=1; mNCSIdx=0; break ; - + case TRISEGMENT_COLLINEARITY_02: mCSIdx=0; mNCSIdx=1; break ; - + case TRISEGMENT_COLLINEARITY_ALL: mCSIdx = mNCSIdx = (std::numeric_limits::max)(); break ; - + case TRISEGMENT_COLLINEARITY_NONE: mCSIdx = mNCSIdx = (std::numeric_limits::max)(); break ; } } - + static Trisegment_2 null() { return Self_ptr() ; } - + Trisegment_collinearity collinearity() const { return mCollinearity ; } Segment_2 const& e( unsigned idx ) const { CGAL_precondition(idx<3) ; return mE[idx] ; } - + Segment_2 const& e0() const { return e(0) ; } Segment_2 const& e1() const { return e(1) ; } Segment_2 const& e2() const { return e(2) ; } @@ -240,20 +240,20 @@ public: Segment_2 const& non_collinear_edge() const { return e(mNCSIdx) ; } Self_ptr child_l() const { return mChildL ; } - Self_ptr child_r() const { return mChildR ; } - + Self_ptr child_r() const { return mChildR ; } + void set_child_l( Self_ptr const& aChild ) { mChildL = aChild ; } void set_child_r( Self_ptr const& aChild ) { mChildR = aChild ; } - + enum SEED_ID { LEFT, RIGHT, UNKNOWN } ; - + // Indicates which of the seeds is collinear for a normal collinearity case. // PRECONDITION: The collinearity is normal. SEED_ID degenerate_seed_id() const { Trisegment_collinearity c = collinearity(); - - return c == TRISEGMENT_COLLINEARITY_01 ? LEFT : c == TRISEGMENT_COLLINEARITY_12 ? RIGHT : UNKNOWN ; + + return c == TRISEGMENT_COLLINEARITY_01 ? LEFT : c == TRISEGMENT_COLLINEARITY_12 ? RIGHT : UNKNOWN ; } friend std::ostream& operator << ( std::ostream& os, Trisegment_2 const& aTrisegment ) @@ -261,40 +261,40 @@ public: return os << "[" << s2str(aTrisegment.e0()) << " " << s2str(aTrisegment.e1()) << " " << s2str(aTrisegment.e2()) - << " " << trisegment_collinearity_to_string(aTrisegment.collinearity()) + << " " << trisegment_collinearity_to_string(aTrisegment.collinearity()) << "]"; } - + friend std::ostream& operator << ( std::ostream& os, Self_ptr const& aPtr ) { recursive_print(os,aPtr,0); return os ; } - + static void recursive_print ( std::ostream& os, Self_ptr const& aTriPtr, int aDepth ) { os << "\n" ; - + for ( int i = 0 ; i < aDepth ; ++ i ) os << " " ; - + if ( aTriPtr ) os << *aTriPtr ; else os << "{null}" ; - + if ( aTriPtr->child_l() ) recursive_print(os,aTriPtr->child_l(),aDepth+1); - + if ( aTriPtr->child_r() ) recursive_print(os,aTriPtr->child_r(),aDepth+1); } - + private : - + Segment_2 mE[3]; Trisegment_collinearity mCollinearity ; unsigned mCSIdx, mNCSIdx ; - + Self_ptr mChildL ; Self_ptr mChildR ; } ; @@ -305,9 +305,9 @@ struct Functor_base_2 typedef typename K::FT FT ; typedef typename K::Point_2 Point_2 ; typedef typename K::Segment_2 Segment_2 ; - + typedef CGAL_SS_i::Trisegment_2 Trisegment_2 ; - + typedef typename Trisegment_2::Self_ptr Trisegment_2_ptr ; }; @@ -331,37 +331,37 @@ struct SS_converter : Converter typedef boost::tuple Source_time_and_point_2 ; typedef boost::tuple Target_time_and_point_2 ; - + typedef boost::optional Source_opt_FT ; typedef boost::optional Target_opt_FT ; - + typedef boost::optional Source_opt_point_2 ; typedef boost::optional Target_opt_point_2 ; - + typedef boost::optional Source_opt_time_and_point_2 ; typedef boost::optional Target_opt_time_and_point_2 ; - + typedef boost::optional Source_opt_segment_2 ; typedef boost::optional Target_opt_segment_2 ; - + typedef typename Source_trisegment_2::Self_ptr Source_trisegment_2_ptr ; typedef typename Target_trisegment_2::Self_ptr Target_trisegment_2_ptr ; - - + + Target_FT cvt_n(Source_FT const& n) const { return this->Converter::operator()(n); } Target_opt_FT cvt_n(Source_opt_FT const& n) const - { - Target_opt_FT r ; - if ( n ) + { + Target_opt_FT r ; + if ( n ) r = cvt_n(*n); - return r ; + return r ; } - + Target_point_2 cvt_p(Source_point_2 const& p) const { return this->Converter::operator()(p); } Target_segment_2 cvt_s( Source_segment_2 const& e) const { return Target_segment_2(cvt_p(e.source()), cvt_p(e.target()) ) ; } - + Target_time_and_point_2 cvt_t_p( Source_time_and_point_2 const& v ) const { Source_FT t ; @@ -369,11 +369,11 @@ struct SS_converter : Converter boost::tie(t,p) = v ; return Target_time_and_point_2(cvt_n(t),cvt_p(p)); } - + Target_trisegment_2_ptr cvt_single_trisegment( Source_trisegment_2_ptr const& tri ) const { CGAL_precondition( tri!= Source_trisegment_2_ptr() ) ; - + return Target_trisegment_2_ptr ( new Target_trisegment_2(cvt_s(tri->e0()) ,cvt_s(tri->e1()) ,cvt_s(tri->e2()) @@ -381,70 +381,70 @@ struct SS_converter : Converter ) ) ; } - + Target_trisegment_2_ptr cvt_trisegment( Source_trisegment_2_ptr const& tri ) const { Target_trisegment_2_ptr res ; - + if ( tri ) { res = cvt_single_trisegment(tri) ; - + if ( tri->child_l() ) res->set_child_l( cvt_trisegment(tri->child_l()) ) ; - + if ( tri->child_r() ) res->set_child_r( cvt_trisegment(tri->child_r() ) ) ; } - + return res ; } - + bool operator()( bool v ) const { return v ; } - + Trisegment_collinearity operator()(Trisegment_collinearity c) const { return c ; } - + Oriented_side operator()(Oriented_side s) const { return s ; } - + Target_FT operator()(Source_FT const& n) const { return cvt_n(n) ; } Target_opt_FT operator()(Source_opt_FT const& n) const { return cvt_n(n) ; } - + Target_point_2 operator()( Source_point_2 const& p) const { return cvt_p(p) ; } Target_segment_2 operator()( Source_segment_2 const& s) const { return cvt_s(s); } - + Target_trisegment_2_ptr operator()( Source_trisegment_2_ptr const& tri ) const { return cvt_trisegment(tri); } - + Target_time_and_point_2 operator() ( Source_time_and_point_2 const& v ) const { return cvt_t_p(v); } - - Target_opt_point_2 operator()( Source_opt_point_2 const& p) const + + Target_opt_point_2 operator()( Source_opt_point_2 const& p) const { - if ( p ) + if ( p ) return Target_opt_point_2(cvt_p(*p)); else return Target_opt_point_2(); } - Target_opt_segment_2 operator()( Source_opt_segment_2 const& s) const + Target_opt_segment_2 operator()( Source_opt_segment_2 const& s) const { - if ( s ) + if ( s ) return Target_opt_segment_2(cvt_s(*s)); else return Target_opt_segment_2(); } - - Target_opt_time_and_point_2 operator()( Source_opt_time_and_point_2 const& v) const - { - if ( v ) + + Target_opt_time_and_point_2 operator()( Source_opt_time_and_point_2 const& v) const + { + if ( v ) return Target_opt_time_and_point_2(cvt_t_p(*v)); else return Target_opt_time_and_point_2(); } - + }; } // namespace CGAL_SS_i diff --git a/Straight_skeleton_2/include/CGAL/Unfiltered_predicate_adaptor.h b/Straight_skeleton_2/include/CGAL/Unfiltered_predicate_adaptor.h index 16f2714a06e..fcd47d6fbe3 100644 --- a/Straight_skeleton_2/include/CGAL/Unfiltered_predicate_adaptor.h +++ b/Straight_skeleton_2/include/CGAL/Unfiltered_predicate_adaptor.h @@ -1,12 +1,12 @@ // Copyright (c) 2005-2008 Fernando Luis Cacciola Carballal. -// All rights reserved. +// All rights reserved. // // This file is part of CGAL (www.cgal.org). // // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// +// // Author(s) : Sylvain Pion, Fernando Cacciola // diff --git a/Stream_support/include/CGAL/IO/read_3mf.h b/Stream_support/include/CGAL/IO/read_3mf.h index 7a6def1f2fe..66521591459 100644 --- a/Stream_support/include/CGAL/IO/read_3mf.h +++ b/Stream_support/include/CGAL/IO/read_3mf.h @@ -438,7 +438,7 @@ int read_from_3mf(const std::string& file_name, PointRanges& all_points, * \param names will contain the name of each mesh in `file_name` if any. * If the i'th mesh has no name, it will be called "Unknown Mesh" in names. * \return the number of soups read. - * + * * \attention Only versions inferior to 2.0 of lib3mf are supported. */ template diff --git a/Stream_support/test/Stream_support/test_3mf_to_sm.cpp b/Stream_support/test/Stream_support/test_3mf_to_sm.cpp index 4f4e94feb7e..1d2ce6af574 100644 --- a/Stream_support/test/Stream_support/test_3mf_to_sm.cpp +++ b/Stream_support/test/Stream_support/test_3mf_to_sm.cpp @@ -91,7 +91,7 @@ int main(int argc, char** argv) colors.clear(); vertex_id_map.clear(); i = 0; - + vpm = get(boost::vertex_point, tube); for(auto v : tube.vertices()) { diff --git a/Subdivision_method_3/include/CGAL/Subdivision_method_3/subdivision_methods_3.h b/Subdivision_method_3/include/CGAL/Subdivision_method_3/subdivision_methods_3.h index 6b70938a659..3fa1486c3be 100644 --- a/Subdivision_method_3/include/CGAL/Subdivision_method_3/subdivision_methods_3.h +++ b/Subdivision_method_3/include/CGAL/Subdivision_method_3/subdivision_methods_3.h @@ -92,7 +92,7 @@ CGAL_DEPRECATED_MSG("you are using the deprecated API of CatmullClark_subdivisio void CatmullClark_subdivision(PolygonMesh& pmesh, int step) { PQQ(pmesh, CatmullClark_mask_3(&pmesh, get(vertex_point,pmesh)), step); } -#endif +#endif #endif /*! @@ -148,7 +148,7 @@ CGAL_DEPRECATED_MSG("you are using the deprecated API of Loop_subdivision(), ple void Loop_subdivision(PolygonMesh& pmesh, int step) { PTQ(pmesh, Loop_mask_3(&pmesh, get(vertex_point,pmesh)) , step); } -#endif +#endif #endif /*! @@ -240,7 +240,7 @@ void DooSabin_subdivision(PolygonMesh& pmesh, const NamedParameters& np) { for(unsigned int i = 0; i < step; i++) internal::DQQ_1step(pmesh, vpm, mask); } - + template void DooSabin_subdivision(PolygonMesh& pmesh) { @@ -299,7 +299,7 @@ void Sqrt3_subdivision(PolygonMesh& pmesh, const NamedParameters& np) { for(unsigned int i = 0; i < step; i++) internal::Sqrt3_1step(pmesh, vpm, mask, (i%2==1)); } - + template void Sqrt3_subdivision(PolygonMesh& pmesh) { diff --git a/Surface_mesh/examples/Surface_mesh/sm_join.cpp b/Surface_mesh/examples/Surface_mesh/sm_join.cpp index 9d77f4b86b6..0114f817372 100644 --- a/Surface_mesh/examples/Surface_mesh/sm_join.cpp +++ b/Surface_mesh/examples/Surface_mesh/sm_join.cpp @@ -10,12 +10,12 @@ typedef CGAL::Surface_mesh Mesh; typedef boost::graph_traits::vertex_descriptor vertex_descriptor; -int main(int argc, char* argv[]) +int main(int argc, char* argv[]) { Mesh sm1, sm2; std::ifstream in1((argc>1)?argv[1]:"data/triangle.off"); in1 >> sm1; - + std::ifstream in2((argc>2)?argv[2]:"data/quad.off"); Mesh::Property_map name1, name2; @@ -28,11 +28,11 @@ int main(int argc, char* argv[]) sm1 += sm2; - + for(vertex_descriptor vd : vertices(sm1)){ std::cerr << vd << " " << name1[vd] < class Property_container; -/// @endcond +/// @endcond @@ -292,7 +292,7 @@ public: parrays_.back()->resize(size_); } } - + // Transfer one element with all properties // WARNING: properties must be the same in the two containers bool transfer(const Property_container& _rhs, std::size_t from, std::size_t to) @@ -327,7 +327,7 @@ public: typedef typename Ref_class::template Get_property_map::type type; }; - template + template std::pair::type, bool> get(const std::string& name, std::size_t i) const { @@ -366,7 +366,7 @@ public: // get a property by its name. returns invalid property if it does not exist. - template + template std::pair::type, bool> get(const std::string& name) const { @@ -395,7 +395,7 @@ public: // get the type of property by its name. returns typeid(void) if it does not exist. - const std::type_info& + const std::type_info& get_type(const std::string& name) const { for (std::size_t i=0; i + template bool remove(typename Get_pmap_type::type& h) { @@ -488,7 +488,7 @@ public: this->parrays_.swap (other.parrays_); std::swap(this->size_, other.size_); } - + private: std::vector parrays_; size_t size_; @@ -498,11 +498,11 @@ private: /// @endcond #ifndef DOXYGEN_RUNNING -/// /// -/// `Property_map` enables to attach properties to the simplices of a +/// +/// `Property_map` enables to attach properties to the simplices of a /// surface mesh. -/// +/// /// @tparam Key The key type of the property map. It must be a model of `Index`. /// @tparam Value The value type of the property. /// @@ -511,7 +511,7 @@ private: template class Property_map_base /// @cond CGAL_DOCUMENT_INTERNALS - : public boost::put_get_helper< + : public boost::put_get_helper< typename Property_array::reference, CRTP_derived_class> /// @endcond @@ -529,7 +529,7 @@ public: typedef typename Property_array::const_reference const_reference; typedef typename Property_array::iterator iterator; typedef typename Property_array::const_iterator const_iterator; -#else +#else /// A reference to the value type of the property. typedef unspecified_type reference; @@ -550,14 +550,14 @@ public: { parray_ = nullptr; } - /// @endcond + /// @endcond public: /// \name Accessing Properties //@{ #ifdef DOXYGEN_RUNNING /// Conversion to a Boolean. It is \c true when the property map - /// can be used, and \c false otherwise. + /// can be used, and \c false otherwise. operator bool () const; #else operator bool_type() const { diff --git a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h index 2977ea5bdcf..06d83272afd 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h @@ -52,7 +52,7 @@ namespace CGAL { #ifndef DOXYGEN_RUNNING - /// Base class for vertex, halfedge, edge, and face index. + /// Base class for vertex, halfedge, edge, and face index. /// /// \attention Note that `Index` is not a model of the concept `Handle`, /// because it cannot be dereferenced. @@ -65,7 +65,7 @@ namespace CGAL { /// Constructor. %Default construction creates an invalid index. /// We write -1, which is /// std::numeric_limits::max() - /// as `size_type` is an unsigned type. + /// as `size_type` is an unsigned type. explicit SM_Index(size_type _idx=(std::numeric_limits::max)()) : idx_(_idx) {} /// Get the underlying index of this index @@ -75,7 +75,7 @@ namespace CGAL { void reset() { idx_=(std::numeric_limits::max)(); } /// return whether the index is valid, i.e., the index is not equal to `%std::numeric_limits::max()`. - bool is_valid() const { + bool is_valid() const { size_type inf = (std::numeric_limits::max)(); return idx_ != inf; } @@ -104,7 +104,7 @@ namespace CGAL { SM_Index operator--(int) { SM_Index tmp(*this); --idx_; return tmp; } SM_Index operator+=(std::ptrdiff_t n) { idx_ = size_type(std::ptrdiff_t(idx_) + n); return *this; } - + protected: size_type idx_; }; @@ -116,8 +116,8 @@ namespace CGAL { return ret; } - - // Implementation for Surface_mesh::Vertex_index + + // Implementation for Surface_mesh::Vertex_index class SM_Vertex_index : public SM_Index { @@ -130,7 +130,7 @@ namespace CGAL { template bool operator==(const T&) const = delete; template bool operator!=(const T&) const = delete; template bool operator<(const T&) const = delete; - + /// are two indices equal? bool operator==(const SM_Vertex_index& _rhs) const { return this->idx_ == _rhs.idx_; @@ -171,7 +171,7 @@ namespace CGAL { SM_Halfedge_index() : SM_Index((std::numeric_limits::max)()) {} explicit SM_Halfedge_index(size_type _idx) : SM_Index(_idx) {} - + template bool operator==(const T&) const = delete; template bool operator!=(const T&) const = delete; template bool operator<(const T&) const = delete; @@ -206,7 +206,7 @@ namespace CGAL { SM_Face_index() : SM_Index((std::numeric_limits::max)()) {} explicit SM_Face_index(size_type _idx) : SM_Index(_idx) {} - + template bool operator==(const T&) const = delete; template bool operator!=(const T&) const = delete; template bool operator<(const T&) const = delete; @@ -259,7 +259,7 @@ namespace CGAL { // returns whether the index is valid, i.e., the index is not equal to std::numeric_limits::max(). bool is_valid() const { return halfedge_.is_valid(); } - + template bool operator==(const T&) const = delete; template bool operator!=(const T&) const = delete; template bool operator<(const T&) const = delete; @@ -314,14 +314,14 @@ namespace CGAL { /// \ingroup PkgSurface_mesh /// This class is a data structure that can be used as halfedge data structure or polyhedral /// surface. It is an alternative to the classes `HalfedgeDS` and `Polyhedron_3` - /// defined in the packages \ref PkgHalfedgeDS and \ref PkgPolyhedron. + /// defined in the packages \ref PkgHalfedgeDS and \ref PkgPolyhedron. /// The main difference is that it is indexed based and not pointer based, /// and that the mechanism for adding information to vertices, halfedges, edges, /// and faces is much simpler and done at runtime and not at compile time. /// When elements are removed, they are only marked as removed, and a garbage - /// collection function must be called to really remove them. + /// collection function must be called to really remove them. /// @tparam P The type of the \em point property of a vertex. There is no requirement on `P`, - /// besides being default constructible and assignable. + /// besides being default constructible and assignable. /// In typical use cases it will be a 2D or 3D point type. /// \cgalModels `MutableFaceGraph` and `FaceListGraph` /// @@ -465,7 +465,7 @@ public: typedef SM_Edge_index Edge_index; #endif - + ///@} private: //-------------------------------------------------- connectivity types @@ -531,7 +531,7 @@ private: //------------------------------------------------------ iterator types if(mesh_->has_garbage()) while ( mesh_->has_valid_index(hnd_) && mesh_->is_removed(hnd_)) ++hnd_; } - + void decrement() { --hnd_; @@ -543,7 +543,7 @@ private: //------------------------------------------------------ iterator types void advance(std::ptrdiff_t n) { CGAL_assertion(mesh_ != nullptr); - + if (mesh_->has_garbage()) { if (n > 0) @@ -562,7 +562,7 @@ private: //------------------------------------------------------ iterator types if (mesh_->has_garbage()) { bool forward = (other.hnd_ > hnd_); - + std::ptrdiff_t out = 0; Index_iterator it = *this; while (!it.equal(other)) @@ -584,7 +584,7 @@ private: //------------------------------------------------------ iterator types // else return std::ptrdiff_t(other.hnd_) - std::ptrdiff_t(this->hnd_); } - + bool equal(const Index_iterator& other) const { return this->hnd_ == other.hnd_; @@ -599,7 +599,7 @@ private: //------------------------------------------------------ iterator types public: /// \name Range Types /// - /// Each range `R` in this section has a nested type `R::iterator`, + /// Each range `R` in this section has a nested type `R::iterator`, /// is convertible to `std:pair`, so that one can use `boost::tie()`, /// and can be used with `BOOST_FOREACH()`, as well as with the C++11 range based for-loop. @@ -665,7 +665,7 @@ public: typedef Iterator_range Face_range; #endif -#ifndef DOXYGEN_RUNNING +#ifndef DOXYGEN_RUNNING typedef CGAL::Vertex_around_target_iterator Vertex_around_target_iterator; typedef Iterator_range Vertex_around_target_range; @@ -811,19 +811,19 @@ public: ///@} -public: +public: #ifndef DOXYGEN_RUNNING /// \name Circulator Types /// /// The following circulators enable to iterate through the elements around a face or vertex. - /// As explained in the \ref SurfaceMeshOrientation "User Manual", we can speak of a + /// As explained in the \ref SurfaceMeshOrientation "User Manual", we can speak of a /// *clockwise* or *counterclockwise* - /// traversal, by looking at the surface from the right side. + /// traversal, by looking at the surface from the right side. ///@{ - /// \brief This class circulates clockwise through all - /// one-ring neighbors of a vertex. + /// \brief This class circulates clockwise through all + /// one-ring neighbors of a vertex. /// A model of `BidirectionalCirculator` with value type `Vertex_index`. /// \sa `Halfedge_around_target_circulator`, `Face_around_target_circulator` @@ -864,7 +864,7 @@ public: /// \brief This class circulates counterclockwise through all faces around a face. /// A model of `BidirectionalCirculator` with value type `Face_index`. - /// Note that the face index is the same after `operator++`, if the neighboring faces share + /// Note that the face index is the same after `operator++`, if the neighboring faces share /// several halfedges. typedef CGAL::Face_around_face_circulator Face_around_face_circulator; @@ -887,7 +887,7 @@ public: typedef CGAL::Out_edge_iterator out_edge_iterator; typedef boost::undirected_tag directed_category; - typedef boost::disallow_parallel_edge_tag edge_parallel_category; + typedef boost::disallow_parallel_edge_tag edge_parallel_category; struct traversal_category : public virtual boost::bidirectional_graph_tag, public virtual boost::vertex_list_graph_tag, @@ -947,7 +947,7 @@ public: /// adds a new vertex, resizes vertex properties if necessary, /// and sets the \em point property to `p`. /// \note Several vertices may have the same point property. - Vertex_index add_vertex(const Point& p) + Vertex_index add_vertex(const Point& p) { Vertex_index v = add_vertex(); vpoint_[v] = p; @@ -1017,7 +1017,7 @@ public: /// if possible, adds a new face with vertices from a range with value type `Vertex_index`. /// The function adds halfedges between successive vertices if they are not yet indicent to halfedges, - /// or updates the connectivity of halfedges already in place. + /// or updates the connectivity of halfedges already in place. /// Resizes halfedge, edge, and face properties if necessary. /// \returns the face index of the added face, or `Surface_mesh::null_face()` if the face could not be added. template @@ -1028,7 +1028,7 @@ public: /// \returns the face index of the added face, or `Surface_mesh::null_face()` if the face could not be added. Face_index add_face(Vertex_index v0, Vertex_index v1, Vertex_index v2) { - boost::array + boost::array v = {{v0, v1, v2}}; return add_face(v); } @@ -1037,7 +1037,7 @@ public: /// \returns the face index of the added face, or `Surface_mesh::null_face()` if the face could not be added. Face_index add_face(Vertex_index v0, Vertex_index v1, Vertex_index v2, Vertex_index v3) { - boost::array + boost::array v = {{v0, v1, v2, v3}}; return add_face(v); } @@ -1045,8 +1045,8 @@ public: ///@} - - /// \name Low-Level Removal Functions + + /// \name Low-Level Removal Functions /// /// Although the elements are only marked as removed /// their connectivity and properties should not be used. @@ -1054,7 +1054,7 @@ public: /// \warning Functions in this group do not adjust any of /// connected elements and usually leave the surface mesh in an /// invalid state. - /// + /// /// /// @{ @@ -1101,7 +1101,7 @@ public: { return num_vertices() - number_of_removed_vertices(); } - + /// returns the number of halfedges in the mesh. size_type number_of_halfedges() const { @@ -1131,7 +1131,7 @@ public: /// removes all vertices, halfedge, edges and faces. Collects garbage and clears all properties. void clear(); - + /// reserves space for vertices, halfedges, edges, faces, and their currently /// associated properties. void reserve(size_type nvertices, @@ -1153,7 +1153,7 @@ public: eprops_.resize(nedges); fprops_.resize(nfaces); } - + bool join(const Surface_mesh& other) { // increase capacity @@ -1213,7 +1213,7 @@ public: // append the vertex free linked list of `this` to the copy of `other` vconn_[vi].halfedge_ = Halfedge_index(vertices_freelist_); // update the begin of the vertex free linked list - vertices_freelist_ = nv + other.vertices_freelist_; + vertices_freelist_ = nv + other.vertices_freelist_; } // merge face free list if(other.faces_freelist_ != inf_value){ @@ -1228,7 +1228,7 @@ public: // append the face free linked list of `this` to the copy of `other` fconn_[fi].halfedge_ = Halfedge_index(faces_freelist_); // update the begin of the face free linked list - faces_freelist_ = nf + other.faces_freelist_; + faces_freelist_ = nf + other.faces_freelist_; } // merge edge free list if(other.edges_freelist_ != inf_value){ @@ -1240,7 +1240,7 @@ public: // append the halfedge free linked list of `this` to the copy of `other` hconn_[hi].next_halfedge_ = Halfedge_index(edges_freelist_); // update the begin of the halfedge free linked list - edges_freelist_ = nh + other.edges_freelist_; + edges_freelist_ = nh + other.edges_freelist_; } // update garbage infos garbage_ = garbage_ || other.garbage_; @@ -1252,22 +1252,22 @@ public: ///@} - + /// \name Garbage Collection /// /// While removing elements only marks them as removed /// garbage collection really removes them. - /// The API in this section allows to check whether + /// The API in this section allows to check whether /// an element is removed, to get the number of /// removed elements, and to collect garbage. /// The number of elements together with the number of removed elements is /// an upperbound on the index, and is needed - /// by algorithms that temporarily store a + /// by algorithms that temporarily store a /// property in a vector of the appropriate size. /// Note however that by garbage collecting elements get new indices. /// In case you store indices in an auxiliary data structure - /// or in a property these indices are potentially no longer - /// refering to the right elements. + /// or in a property these indices are potentially no longer + /// refering to the right elements. ///@{ @@ -1333,10 +1333,10 @@ public: /// \sa `has_garbage()` /// \attention By garbage collecting elements get new indices. /// In case you store indices in an auxiliary data structure - /// or in a property these indices are potentially no longer - /// refering to the right elements. + /// or in a property these indices are potentially no longer + /// refering to the right elements. void collect_garbage(); - + //undocumented convenience fucntion that allows to get old-index->new-index information template void collect_garbage(Visitor& visitor); @@ -1371,7 +1371,7 @@ public: bool has_valid_index(Vertex_index v) const { return ((size_type)v < num_vertices()); - } + } /// returns whether the index of halfedge `h` is valid, that is within the current array bounds. bool has_valid_index(Halfedge_index h) const @@ -1391,11 +1391,11 @@ public: /// @} /// @endcond - + /// \name Validity Checks /// /// Functions in this group perform checks for structural - /// consistency of a complete surface mesh, or an individual element. + /// consistency of a complete surface mesh, or an individual element. /// They are expensive and should only be used in debug configurations. ///@{ @@ -1406,7 +1406,7 @@ public: { bool valid = true; size_type vcount = 0, hcount = 0, fcount = 0; - for(Halfedge_iterator it = halfedges_begin(); it != halfedges_end(); ++it) { + for(Halfedge_iterator it = halfedges_begin(); it != halfedges_end(); ++it) { ++hcount; valid = valid && next(*it).is_valid(); valid = valid && opposite(*it).is_valid(); @@ -1468,7 +1468,7 @@ public: for(Face_iterator it = faces_begin(); it != faces_end(); ++it) { ++fcount; } - + valid = valid && (vcount == number_of_vertices()); if(!valid && verbose){ std::cerr << "#vertices: iterated: " << vcount << " vs number_of_vertices(): " << number_of_vertices()<< std::endl; @@ -1694,7 +1694,7 @@ public: return target(opposite(h)); } - /// returns `opposite(next(h))`, that is the next halfedge \ref SurfaceMeshOrientation + /// returns `opposite(next(h))`, that is the next halfedge \ref SurfaceMeshOrientation /// "clockwise" around the target vertex of `h`. Halfedge_index next_around_target(Halfedge_index h) const { @@ -1708,7 +1708,7 @@ public: return prev(opposite(h)); } - /// returns `next(opposite(h))`, that is the next halfedge \ref SurfaceMeshOrientation + /// returns `next(opposite(h))`, that is the next halfedge \ref SurfaceMeshOrientation /// "clockwise" around the source vertex of `h`. Halfedge_index next_around_source(Halfedge_index h) const { @@ -1780,14 +1780,14 @@ public: /// if it is incident to a `null_face()`. A vertex is on a border /// if it is isolated or incident to a border halfedge. While for a halfedge and /// edge this is a constant time operation, for a vertex it means - /// to look at all incident halfedges. If algorithms operating on a + /// to look at all incident halfedges. If algorithms operating on a /// surface mesh maintain that the halfedge associated to a border vertex is - /// a border halfedge, this is a constant time operation too. - /// This section provides functions to check if an element is on a + /// a border halfedge, this is a constant time operation too. + /// This section provides functions to check if an element is on a /// border and to change the halfedge associated to a border vertex. ///@{ - /// returns whether `v` is a border vertex. + /// returns whether `v` is a border vertex. /// \cgalAdvancedBegin /// With the default value for /// `check_all_incident_halfedges` the function iteratates over the incident halfedges. @@ -1821,7 +1821,7 @@ public: } - /// returns whether `e` is a border edge, i.e., if any + /// returns whether `e` is a border edge, i.e., if any /// of its two halfedges is a border halfedge. bool is_border(Edge_index e) const { @@ -1845,7 +1845,7 @@ public: return false; } - /// applies `set_vertex_halfedge_to_border_halfedge(Vertex_index)` on all vertices + /// applies `set_vertex_halfedge_to_border_halfedge(Vertex_index)` on all vertices /// around the face associated to `h`. void set_vertex_halfedge_to_border_halfedge(Halfedge_index h) { @@ -1862,7 +1862,7 @@ public: } } - /// applies `set_vertex_halfedge_to_border_halfedge(Vertex_index)` on all vertices + /// applies `set_vertex_halfedge_to_border_halfedge(Vertex_index)` on all vertices /// of the surface mesh. void set_vertex_halfedge_to_border_halfedge() { @@ -1925,13 +1925,13 @@ private: //--------------------------------------------------- property handling }; public: - + /*! \name Property Handling A `Properties::Property_map` allows to associate properties of type `T` to a vertex, halfdge, edge, or face index type I. Properties can be added, and looked up with a string, and they can be removed at runtime. - The \em point property of type `P` is associated to the string "v:point". + The \em point property of type `P` is associated to the string "v:point". */ ///@{ @@ -1948,11 +1948,11 @@ private: //--------------------------------------------------- property handling #endif /// adds a property map named `name` with value type `T` and default `t` - /// for index type `I`. Returns the property map together with a Boolean + /// for index type `I`. Returns the property map together with a Boolean /// that is `true` if a new map was created. In case it already exists /// the existing map together with `false` is returned. - + template std::pair, bool> add_property_map(std::string name=std::string(), const T t=T()) { @@ -1963,9 +1963,9 @@ private: //--------------------------------------------------- property handling } return Property_selector(this)().template add(name, t); } - - /// returns a property map named `name` with key type `I` and value type `T`, - /// and a Boolean that is `true` if the property exists. + + /// returns a property map named `name` with key type `I` and value type `T`, + /// and a Boolean that is `true` if the property exists. /// In case it does not exist the Boolean is `false` and the behavior of /// the property map is undefined. template @@ -1988,7 +1988,7 @@ private: //--------------------------------------------------- property handling /// property identified by `name`. `typeid(void)` if `name` /// does not identify any property. /// - /// @tparam I The key type of the property. + /// @tparam I The key type of the property. template const std::type_info& property_type(const std::string& name) @@ -2022,7 +2022,7 @@ private: //--------------------------------------------------- property handling /// @cond CGAL_DOCUMENT_INTERNALS /// prints property statistics to the stream `out`. The output is human-readable but - /// not machine-friendly. + /// not machine-friendly. /// void property_stats(std::ostream& out = std::cout) const; /// @endcond @@ -2060,18 +2060,18 @@ private: //--------------------------------------------------- property handling { return Vertex_index(vertices_freelist_); } - + Face_index face_freelist() const { return Face_index(faces_freelist_); } - + Edge_index edge_freelist() const { return Edge_index(edges_freelist_>>1); } #endif - + private: //--------------------------------------------------- helper functions @@ -2113,12 +2113,12 @@ private: //------------------------------------------------------- private data */ /// \relates Surface_mesh - /// Inserts `other` into `sm`. + /// Inserts `other` into `sm`. /// Shifts the indices of vertices of `other` by `sm.number_of_vertices() + sm.number_of_removed_vertices()` /// and analoguously for halfedges, edges, and faces. - /// Copies entries of all property maps which have the same name in `sm` and `other`. + /// Copies entries of all property maps which have the same name in `sm` and `other`. /// that is, property maps which are only in `other` are ignored. - /// Also copies elements which are marked as removed, and concatenates the freelists of `sm` and `other`. + /// Also copies elements which are marked as removed, and concatenates the freelists of `sm` and `other`. template Surface_mesh

& operator+=(Surface_mesh

& sm, const Surface_mesh

& other) @@ -2129,14 +2129,14 @@ private: //------------------------------------------------------- private data /// \relates Surface_mesh - /// Inserts the surface mesh in an output stream in Ascii OFF format. + /// Inserts the surface mesh in an output stream in Ascii OFF format. /// Only the \em point property is inserted in the stream. - /// If an alternative vertex_point map is given through `np`, + /// If an alternative vertex_point map is given through `np`, /// then it will be used instead of the default one. /// \pre `operator<<(std::ostream&,const P&)` must be defined. - /// \note The `precision()` + /// \note The `precision()` /// of the output stream might not be sufficient depending on the data to be written. - + template bool write_off(std::ostream& os, const Surface_mesh

& sm, const NamedParameters& np) { typedef Surface_mesh

Mesh; @@ -2196,7 +2196,7 @@ private: //------------------------------------------------------- private data return write_off(os, sm, CGAL::parameters::all_default()); } /// \relates Surface_mesh - /// + /// /// This operator calls `write_off(std::ostream& os, const CGAL::Surface_mesh& sm)`. template std::ostream& operator<<(std::ostream& os, const Surface_mesh

& sm) @@ -2243,18 +2243,18 @@ private: //------------------------------------------------------- private data os << "comment " << line << std::endl; } } - + os << "element vertex " << sm.number_of_vertices() << std::endl; std::vector*> vprinters; internal::PLY::fill_header (os, sm, vprinters); - + os << "element face " << sm.number_of_faces() << std::endl; os << "property list uchar int vertex_indices" << std::endl; std::vector*> fprinters; internal::PLY::fill_header (os, sm, fprinters); - + std::vector*> eprinters; if (sm.template properties().size() > 1) { @@ -2285,7 +2285,7 @@ private: //------------------------------------------------------- private data } } - os << "end_header" << std::endl; + os << "end_header" << std::endl; std::vector reindex; reindex.resize (sm.num_vertices()); @@ -2304,7 +2304,7 @@ private: //------------------------------------------------------- private data } std::vector polygon; - + for(FIndex fi : sm.faces()) { // Get list of vertex indices @@ -2328,14 +2328,14 @@ private: //------------------------------------------------------- private data os.write (reinterpret_cast(&idx), sizeof(idx)); } } - + for (std::size_t i = 0; i < fprinters.size(); ++ i) { fprinters[i]->print(os, fi); if (get_mode (os) == IO::ASCII) os << " "; } - + if (get_mode (os) == IO::ASCII) os << std::endl; } @@ -2353,19 +2353,19 @@ private: //------------------------------------------------------- private data os.write (reinterpret_cast(&v0), sizeof(v0)); os.write (reinterpret_cast(&v1), sizeof(v1)); } - + for (std::size_t i = 0; i < eprinters.size(); ++ i) { eprinters[i]->print(os, ei); if (get_mode (os) == IO::ASCII) os << " "; } - + if (get_mode (os) == IO::ASCII) os << std::endl; } } - + if (!hprinters.empty()) { for(HIndex hi : sm.halfedges()) @@ -2379,19 +2379,19 @@ private: //------------------------------------------------------- private data os.write (reinterpret_cast(&source), sizeof(source)); os.write (reinterpret_cast(&target), sizeof(target)); } - + for (std::size_t i = 0; i < hprinters.size(); ++ i) { hprinters[i]->print(os, hi); if (get_mode (os) == IO::ASCII) os << " "; } - + if (get_mode (os) == IO::ASCII) os << std::endl; } } - + for (std::size_t i = 0; i < vprinters.size(); ++ i) delete vprinters[i]; for (std::size_t i = 0; i < fprinters.size(); ++ i) @@ -2400,7 +2400,7 @@ private: //------------------------------------------------------- private data delete eprinters[i]; for (std::size_t i = 0; i < hprinters.size(); ++ i) delete hprinters[i]; - + return true; } #endif @@ -2424,11 +2424,11 @@ private: //------------------------------------------------------- private data /// @endcond /// \relates Surface_mesh - /// Extracts the surface mesh from an input stream in Ascii OFF, COFF, NOFF, CNOFF + /// Extracts the surface mesh from an input stream in Ascii OFF, COFF, NOFF, CNOFF /// format and appends it to the surface mesh `sm`. /// The operator reads the point property as well as "v:normal", "v:color", and "f:color". /// Vertex texture coordinates are ignored. - /// If an alternative vertex_point map is given through `np`, + /// If an alternative vertex_point map is given through `np`, /// then it will be used instead of the default one. /// \pre `operator>>(std::istream&,const P&)` must be defined. /// \pre The data in the stream must represent a two-manifold. If this is not the case @@ -2487,17 +2487,17 @@ private: //------------------------------------------------------- private data std::istringstream iss(line); double x, y, z; iss >> iformat(x) >> iformat(y) >> iformat(z); - + Vertex_index vi = sm.add_vertex(); put(vpm, vi, P(x, y, z)); - - + + vertexmap[i] = vi; if(v_has_normals){ if(!(iss >> v)) { std::cerr<<"This doesn't seem to be a correct NOFF file. Aborting."<& sm, std::string& comments) { typedef typename Surface_mesh

::size_type size_type; - + if(!is) { std::cerr << "Error: cannot open file" << std::endl; @@ -2633,7 +2633,7 @@ private: //------------------------------------------------------- private data internal::PLY::PLY_reader reader; internal::PLY::Surface_mesh_filler

filler(sm); - + if (!(reader.init (is))) { is.setstate(std::ios::failbit); @@ -2677,7 +2677,7 @@ private: //------------------------------------------------------- private data if (is_halfedge) filler.instantiate_halfedge_properties (element); - + for (std::size_t j = 0; j < element.number_of_items(); ++ j) { for (std::size_t k = 0; k < element.number_of_properties(); ++ k) @@ -3200,14 +3200,14 @@ namespace internal{ } } // CGAL - + #ifndef DOXYGEN_RUNNING namespace std { #if defined(BOOST_MSVC) # pragma warning(push) -# pragma warning(disable:4099) // For VC10 it is class hash +# pragma warning(disable:4099) // For VC10 it is class hash #endif #ifndef CGAL_CFG_NO_STD_HASH @@ -3233,7 +3233,7 @@ namespace std { }; template <> - struct hash + struct hash : public CGAL::cpp98::unary_function { std::size_t operator()(const CGAL::SM_Face_index& i) const diff --git a/Surface_mesh_deformation/demo/Surface_mesh_deformation/CMakeLists.txt b/Surface_mesh_deformation/demo/Surface_mesh_deformation/CMakeLists.txt index 0955eda3677..b17f5995d32 100644 --- a/Surface_mesh_deformation/demo/Surface_mesh_deformation/CMakeLists.txt +++ b/Surface_mesh_deformation/demo/Surface_mesh_deformation/CMakeLists.txt @@ -24,8 +24,8 @@ if ( CGAL_FOUND ) message(STATUS "NOTICE: This program requires the Eigen library, version 3.2 or later and will not be compiled.") endif() else() - + message(STATUS "NOTICE: This program requires the CGAL library, and will not be compiled.") - + endif() diff --git a/Surface_mesh_deformation/examples/Surface_mesh_deformation/CMakeLists.txt b/Surface_mesh_deformation/examples/Surface_mesh_deformation/CMakeLists.txt index 6e6d1782ce0..ca146f90433 100644 --- a/Surface_mesh_deformation/examples/Surface_mesh_deformation/CMakeLists.txt +++ b/Surface_mesh_deformation/examples/Surface_mesh_deformation/CMakeLists.txt @@ -33,7 +33,7 @@ if ( CGAL_FOUND ) deform_mesh_for_botsch08_format_sre_arap) CGAL_target_use_Eigen(${target}) endforeach() - + find_package( OpenMesh QUIET ) if ( OpenMesh_FOUND ) include( UseOpenMesh ) @@ -48,8 +48,8 @@ if ( CGAL_FOUND ) message(STATUS "NOTICE: These examples require the Eigen library, version 3.2 or later and will not be compiled.") endif() else() - + message(STATUS "NOTICE: These exmaples require the CGAL library, and will not be compiled.") - + endif() diff --git a/Surface_mesh_deformation/test/Surface_mesh_deformation/CMakeLists.txt b/Surface_mesh_deformation/test/Surface_mesh_deformation/CMakeLists.txt index 555174ccf92..05da9a51cf7 100644 --- a/Surface_mesh_deformation/test/Surface_mesh_deformation/CMakeLists.txt +++ b/Surface_mesh_deformation/test/Surface_mesh_deformation/CMakeLists.txt @@ -33,8 +33,8 @@ if ( CGAL_FOUND ) message(STATUS "NOTICE: These tests require the Eigen library, version 3.2 or later and will not be compiled.") endif() else() - + message(STATUS "NOTICE: These tests require the CGAL library, and will not be compiled.") - + endif() diff --git a/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/CMakeLists.txt b/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/CMakeLists.txt index 3519d912b03..185aacb9503 100644 --- a/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/CMakeLists.txt +++ b/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/CMakeLists.txt @@ -62,7 +62,7 @@ if ( CGAL_FOUND ) CGAL_target_use_Eigen(simple_parameterization) create_single_source_cgal_program( "square_border_parameterizer.cpp" ) CGAL_target_use_Eigen(square_border_parameterizer) - + if(SuiteSparse_FOUND) target_link_libraries(orbifold PRIVATE ${SuiteSparse_LIBRARIES}) endif() diff --git a/Surface_mesh_segmentation/include/CGAL/internal/Surface_mesh_segmentation/SDF_calculation.h b/Surface_mesh_segmentation/include/CGAL/internal/Surface_mesh_segmentation/SDF_calculation.h index d644e22415d..efc0e3774aa 100644 --- a/Surface_mesh_segmentation/include/CGAL/internal/Surface_mesh_segmentation/SDF_calculation.h +++ b/Surface_mesh_segmentation/include/CGAL/internal/Surface_mesh_segmentation/SDF_calculation.h @@ -147,7 +147,7 @@ public: centroid_functor(traits.construct_centroid_3_object()), collinear_functor(traits.collinear_3_object()), tree(create_traits(mesh, vertex_point_map)), - use_diagonal(use_diagonal) + use_diagonal(use_diagonal) { typedef typename boost::property_traits::reference Point_ref; face_iterator it, end; @@ -318,7 +318,7 @@ public: Segment segment(center, target_point); if(traits.is_degenerate_3_object()(segment)) { - CGAL_warning_msg(false, + CGAL_warning_msg(false, "A degenerate segment is constructed. Most probable reason is using CGAL_PI as cone_angle parameter and also picking center of disk as a sample."); } @@ -374,7 +374,7 @@ private: double cone_angle, bool accept_if_acute, const Disk_samples_list& disk_samples) const { - + const Point p1 = get(vertex_point_map,target(halfedge(facet,mesh),mesh)); const Point p2 = get(vertex_point_map,target(next(halfedge(facet,mesh),mesh),mesh)); const Point p3 = get(vertex_point_map,target(prev(halfedge(facet,mesh),mesh),mesh)); diff --git a/Surface_mesh_shortest_path/doc/Surface_mesh_shortest_path/Surface_mesh_shortest_path.txt b/Surface_mesh_shortest_path/doc/Surface_mesh_shortest_path/Surface_mesh_shortest_path.txt index cbc0cf43e9b..cce82b0061f 100644 --- a/Surface_mesh_shortest_path/doc/Surface_mesh_shortest_path/Surface_mesh_shortest_path.txt +++ b/Surface_mesh_shortest_path/doc/Surface_mesh_shortest_path/Surface_mesh_shortest_path.txt @@ -43,7 +43,7 @@ of the input surface mesh. For efficiency reason, index property maps for vertices, halfedges and faces are internally used. For each simplex type the property map must provide an index between 0 and the number of simplices. We recommend to use -the class `CGAL::Surface_mesh` as model of `FaceListGraph`. +the class `CGAL::Surface_mesh` as model of `FaceListGraph`. If you use the class `CGAL::Polyhedron_3`, you should use it with the item class `CGAL::Polyhedron_items_with_id_3`, for which default property maps are provided. This item class associates to each simplex an index that provides a \f$O(1)\f$ time access to the indices. @@ -117,8 +117,8 @@ but it will be extremely slow. Indeed, in order to compute the distance along th \subsection Surface_mesh_shortest_pathSimpleExample Simple Example -The following example shows how to get the shortest path to every vertex from an arbitrary source point on a surface. -The shortest path class needs to have an index associated to each vertex, halfedge and face, which is naturally given for the class `Surface_mesh`. +The following example shows how to get the shortest path to every vertex from an arbitrary source point on a surface. +The shortest path class needs to have an index associated to each vertex, halfedge and face, which is naturally given for the class `Surface_mesh`. \cgalExample{Surface_mesh_shortest_path/shortest_paths.cpp} diff --git a/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/CMakeLists.txt b/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/CMakeLists.txt index 513007600bc..57b6d968ca5 100644 --- a/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/CMakeLists.txt +++ b/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/CMakeLists.txt @@ -18,7 +18,7 @@ if ( CGAL_FOUND ) create_single_source_cgal_program( "shortest_paths_with_id.cpp" ) create_single_source_cgal_program( "shortest_paths.cpp" ) create_single_source_cgal_program( "shortest_path_with_locate.cpp" ) - + find_package( OpenMesh QUIET ) if ( OpenMesh_FOUND ) include( UseOpenMesh ) @@ -28,8 +28,8 @@ if ( CGAL_FOUND ) message(STATUS "Examples that use OpenMesh will not be compiled.") endif() else() - + message(STATUS "This program requires the CGAL library, and will not be compiled.") - + endif() diff --git a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/edge_collapse.h b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/edge_collapse.h index 081c1d890c3..2096a04a207 100644 --- a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/edge_collapse.h +++ b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/edge_collapse.h @@ -56,12 +56,12 @@ the number of edges effectively removed. \cgalHeading{Semantics} -The simplification process continues until the `should_stop` policy returns `true` +The simplification process continues until the `should_stop` policy returns `true` or until the surface mesh cannot be simplified any further due to topological constraints. -`get_cost` and `get_placement` are the policies which control -the cost-strategy, that is, the order in which edges are collapsed -and the remaining vertex is re-positioned. +`get_cost` and `get_placement` are the policies which control +the cost-strategy, that is, the order in which edges are collapsed +and the remaining vertex is re-positioned. `visitor` is used to keep track of the simplification process. It has several member functions which are called at certain points in the simplification code. diff --git a/Surface_mesh_simplification/test/Surface_mesh_simplification/basics.h b/Surface_mesh_simplification/test/Surface_mesh_simplification/basics.h index de4a41cb2cb..703a7f4c194 100644 --- a/Surface_mesh_simplification/test/Surface_mesh_simplification/basics.h +++ b/Surface_mesh_simplification/test/Surface_mesh_simplification/basics.h @@ -14,7 +14,7 @@ #define CGAL_CHECK_EXPENSIVE //#define CGAL_SURFACE_SIMPLIFICATION_ENABLE_TRACE 4 -//#define CGAL_SURFACE_SIMPLIFICATION_ENABLE_LT_TRACE 4 +//#define CGAL_SURFACE_SIMPLIFICATION_ENABLE_LT_TRACE 4 void Surface_simplification_external_trace(std::string s) { @@ -46,7 +46,7 @@ typedef Kernel::FT FT; typedef Kernel::Vector_3 Vector; typedef Kernel::Point_3 Point; -typedef CGAL::Polyhedron_3 Surface; +typedef CGAL::Polyhedron_3 Surface; typedef Surface::Vertex Vertex; typedef Surface::Vertex_iterator Vertex_iterator; diff --git a/Surface_mesh_simplification/test/Surface_mesh_simplification/edge_collapse_topology.cpp b/Surface_mesh_simplification/test/Surface_mesh_simplification/edge_collapse_topology.cpp index 04ca3726e0c..7dd4f06abfd 100644 --- a/Surface_mesh_simplification/test/Surface_mesh_simplification/edge_collapse_topology.cpp +++ b/Surface_mesh_simplification/test/Surface_mesh_simplification/edge_collapse_topology.cpp @@ -11,11 +11,11 @@ #include typedef CGAL::Simple_cartesian Kernel; -typedef CGAL::Polyhedron_3 Surface; +typedef CGAL::Polyhedron_3 Surface; namespace SMS = CGAL::Surface_mesh_simplification; -int main(int argc, char** argv) +int main(int argc, char** argv) { if(argc!=2){ std::cerr << "Please provide only an off-file as input\n"; @@ -41,17 +41,17 @@ int main(int argc, char** argv) int r = SMS::edge_collapse (surface ,stop - ,CGAL::parameters::vertex_index_map(get(CGAL::vertex_external_index,surface)) - .halfedge_index_map (get(CGAL::halfedge_external_index ,surface)) + ,CGAL::parameters::vertex_index_map(get(CGAL::vertex_external_index,surface)) + .halfedge_index_map (get(CGAL::halfedge_external_index ,surface)) ); - std::cout << "\nFinished...\n" << r << " edges removed.\n" + std::cout << "\nFinished...\n" << r << " edges removed.\n" << (surface.size_of_halfedges()/2) << " final edges.\n"; assert(initial_count == (surface.size_of_halfedges()/2) + r); // std::ofstream os(argc > 2 ? argv[2] : "out.off"); os << surface; - return 0; + return 0; } // EOF // diff --git a/Surface_mesh_skeletonization/benchmark/Surface_mesh_skeletonization/CMakeLists.txt b/Surface_mesh_skeletonization/benchmark/Surface_mesh_skeletonization/CMakeLists.txt index 4ee6bec3cc0..0fb1f28c09d 100644 --- a/Surface_mesh_skeletonization/benchmark/Surface_mesh_skeletonization/CMakeLists.txt +++ b/Surface_mesh_skeletonization/benchmark/Surface_mesh_skeletonization/CMakeLists.txt @@ -16,7 +16,7 @@ find_package( CGAL QUIET COMPONENTS ) if ( NOT CGAL_FOUND ) message(STATUS "This project requires the CGAL library, and will not be compiled.") - return() + return() endif() @@ -27,7 +27,7 @@ if ( NOT Boost_FOUND ) message(STATUS "This project requires the Boost library, and will not be compiled.") - return() + return() endif() diff --git a/Surface_mesh_topology/benchmark/Surface_mesh_topology/path_homotopy_with_schema.cpp b/Surface_mesh_topology/benchmark/Surface_mesh_topology/path_homotopy_with_schema.cpp index 025f4fefd83..446367cf332 100644 --- a/Surface_mesh_topology/benchmark/Surface_mesh_topology/path_homotopy_with_schema.cpp +++ b/Surface_mesh_topology/benchmark/Surface_mesh_topology/path_homotopy_with_schema.cpp @@ -8,7 +8,7 @@ std::cout<<"usage: "< cst(map, true); std::cout << "Mesh " << file << std::endl; cst.compute_minimal_quadrangulation(true); - + std::cout<<"Initial map: "; map.display_characteristics(std::cout)< @@ -32,7 +32,7 @@ namespace Surface_mesh_topology { /*! returns `true` if the closed path `p` is contractible. * @pre `p` must be a closed path on `amesh`. */ - bool is_contractible(const Path_on_surface& p) const; + bool is_contractible(const Path_on_surface& p) const; }; } diff --git a/Surface_mesh_topology/doc/Surface_mesh_topology/CGAL/Path_on_surface.h b/Surface_mesh_topology/doc/Surface_mesh_topology/CGAL/Path_on_surface.h index bc14ea01857..09f3c228f11 100644 --- a/Surface_mesh_topology/doc/Surface_mesh_topology/CGAL/Path_on_surface.h +++ b/Surface_mesh_topology/doc/Surface_mesh_topology/CGAL/Path_on_surface.h @@ -3,9 +3,9 @@ namespace CGAL { namespace Surface_mesh_topology { /*! \ingroup PkgSurfaceMeshTopologyClasses - + The class `Path_on_surface` represents a walk in a mesh which is either a model of `CombinatorialMap`, a model of `GeneralizedMap` or a model of a `FaceGraph`. Each object of this class is constructed from an external mesh on which the path should lie. A path is represented as a sequence of darts or halfedges, each one representing an oriented edge in the path. The class `Path_on_surface` behaves as a container for this sequence of darts/halfedges. Elements are added in the path one at a time to the path thanks to the `push_back()` method. - + \tparam Mesh a model of `CombinatorialMap`, `GeneralizedMap` or of `FaceGraph` */ template @@ -31,17 +31,17 @@ namespace Surface_mesh_topology { /// returns the length of the path, i.e. its number of edges. std::size_t length() const; - + /// returns the ith dart of the path. /// @pre i<`length()`. halfedge_descriptor operator[] (std::size_t i) const; /// clears this path. void clear(); - + /// returns `true` iff `hd` can be added at the end of this path. bool can_be_pushed(halfedge_descriptor hd) const; - + /// adds `hd` at the end of this path. /// @pre `can_be_pushed(hd)` void push_back(halfedge_descriptor hd); @@ -62,11 +62,11 @@ namespace Surface_mesh_topology { /// adds the dart/halfedge obtained by turning `nb` times around the target vertex of the last dart/halfedge in this path, in the positive circular order. To extend with a positive 1 turn thus amounts to extend with the `next()` pointer. (A zero turn corresponds to the `opposite()` pointer.) /// @pre !`is_empty()` - void extend_positive_turn(std::size_t nb); + void extend_positive_turn(std::size_t nb); /// adds the dart/halfedge obtained by turning `nb` times around the target vertex of the last dart/halfedge in this path, in the negative circular order. To extend with a negative 1 turn thus amounts to extend with the composite pointer: `opposite(prev(opposite()))`. /// @pre !`is_empty()` - void extend_negative_turn(std::size_t nb); + void extend_negative_turn(std::size_t nb); /// returns `true` iff the dart/halfedge with label `l` can be added at the end of this path. /// @pre Mesh must be a model of `PolygonalSchema` concept. diff --git a/Surface_mesh_topology/doc/Surface_mesh_topology/CGAL/draw_face_graph_with_paths.h b/Surface_mesh_topology/doc/Surface_mesh_topology/CGAL/draw_face_graph_with_paths.h index ea0e0480c2f..740f693c5e2 100644 --- a/Surface_mesh_topology/doc/Surface_mesh_topology/CGAL/draw_face_graph_with_paths.h +++ b/Surface_mesh_topology/doc/Surface_mesh_topology/CGAL/draw_face_graph_with_paths.h @@ -1,5 +1,5 @@ namespace CGAL { - + /*! \ingroup PkgDrawFaceGraphWithPaths diff --git a/Surface_mesh_topology/doc/Surface_mesh_topology/Concepts/PolygonalSchema.h b/Surface_mesh_topology/doc/Surface_mesh_topology/Concepts/PolygonalSchema.h index 6159fca89b3..e2ddc169269 100644 --- a/Surface_mesh_topology/doc/Surface_mesh_topology/Concepts/PolygonalSchema.h +++ b/Surface_mesh_topology/doc/Surface_mesh_topology/Concepts/PolygonalSchema.h @@ -6,7 +6,7 @@ PolygonalSchema::Dart_info should be a class having a public data member std::string m_label. PolygonalSchema::dimension should be equal to 2. - + \cgalRefines GenericMap \cgalHasModel \link CGAL::Surface_mesh_topology::Polygonal_schema_with_combinatorial_map `CGAL::Surface_mesh_topology::Polygonal_schema_with_combinatorial_map`\endlink @@ -18,24 +18,24 @@ class PolygonalSchema public: /// creates an empty `PolygonalSchema` object. PolygonalSchema(); - + /// starts a new facet. void init_facet(); - + /// finishes the current facet. Returns the first dart of this facet. /// @pre A facet is under creation. Dart_handle finish_facet(); - + /// adds one edge to the current facet, given by its label `l` (any string containing no space, using minus sign for orientation). - /// Since the surface is oriented, each label can be used only twice with opposite signs. If this method is called with a label already used, with same sign, an error message is given and this label is ignored. + /// Since the surface is oriented, each label can be used only twice with opposite signs. If this method is called with a label already used, with same sign, an error message is given and this label is ignored. /// @pre A facet is under creation. void add_edge_to_facet(const std::string& l); - + /// adds the given edges to the current facet. /// `s` is a sequence of labels, separated by spaces. All the corresponding edges are added into the current facet. /// @pre A facet is under creation. void add_edges_to_facet(const std::string& s); - + /// adds directly one facet giving the sequence of labels `s` of all its edges (labels are separated by spaces). void add_facet(const std::string& s); @@ -47,7 +47,7 @@ public: /// returns true iff the facet containing `dh` is perforated. bool is_perforated(Dart_const_handle dh) const; - + /// Shortcut for is_perforated(get_dart_labeled(s)). bool is_perforated(const std::string & s) const; @@ -59,7 +59,7 @@ public: /// fills the facet containing `dh`. Returns the number of darts of the face; 0 if the facet was already filled. size_type fill_facet(Dart_handle dh); - + /// Shortcut for fill_facet(get_dart_labeled(s)). size_type fill_facet(const std::string & s); }; diff --git a/Surface_mesh_topology/doc/Surface_mesh_topology/Surface_mesh_topology.txt b/Surface_mesh_topology/doc/Surface_mesh_topology/Surface_mesh_topology.txt index 8891b136db9..7b4ba0b2379 100644 --- a/Surface_mesh_topology/doc/Surface_mesh_topology/Surface_mesh_topology.txt +++ b/Surface_mesh_topology/doc/Surface_mesh_topology/Surface_mesh_topology.txt @@ -14,7 +14,7 @@ This package provides an algorithm to test if a curve on a combinatorial surface Given a curve drawn on a surface one can ask if the curve can be continuously deformed to a point (i.e. a zero length curve). In other words, does there exist a continuous sequence of curves on the surface that starts with the input curve and ends to a point? Curves that deform to a point are said contractible. Any curve on a sphere is contractible but this is not true for all curves on a torus or on a surface with more complicated topology. The algorithms in this package are purely topological and do not assume any geometry on the input surface. In particular, the surface is not necessarily embedded in a Euclidean space. -The algorithm implemented in this package builds a data structure to efficiently answer queries of the following forms: +The algorithm implemented in this package builds a data structure to efficiently answer queries of the following forms: - Given a combinatorial surface \f$\cal{M}\f$ and a closed curve specified as a sequence of edges of \f$\cal{M}\f$, decide if the curve is contractible on \f$\cal{M}\f$, - Given a combinatorial surface \f$\cal{M}\f$ and two closed curves on \f$\cal{M}\f$, decide if the two curves are related by a continuous transformation, - Given a combinatorial surface \f$\cal{M}\f$ and two non-necessarily closed curves on \f$\cal{M}\f$, decide if the two curves are related by a continuous transformation that fixes the curve extremities. The curves should have common endpoints, otherwise the answer to the query is trivially negative. @@ -25,7 +25,7 @@ The second query asks if the curves are freely homotopic while the thir On the upper left surface the green curve is contractible. The red and blue curves share the same (green) endpoint. (Being closed, their two endpoints coincide.) Although these last two curves are not homotopic with fixed endpoints they are freely homotopic as shown by the suggested continuous transformation of the blue curve. \cgalFigureEnd -The algorithms used are based on a paper by Erickson and Whittlesey \cgalCite{ew-tcsr-13}, providing a linear time algorithm for the above homotopy tests. This is a simplified version of the linear time algorithm by Lazarus and Rivaud \cgalCite{lr-hts-12}. +The algorithms used are based on a paper by Erickson and Whittlesey \cgalCite{ew-tcsr-13}, providing a linear time algorithm for the above homotopy tests. This is a simplified version of the linear time algorithm by Lazarus and Rivaud \cgalCite{lr-hts-12}. \section SMTopology_HowToUse API Description @@ -39,7 +39,7 @@ Each curve on this surface is contained in an instance of the class `Surface_mes - Simply push the next halfedge using the \ref Surface_mesh_topology::Path_on_surface::push_back "push_back()" member function. - The user may push the index of the next halfedge instead of the halfedge itself with the member function \ref Surface_mesh_topology::Path_on_surface::push_back_by_index "push_back_by_index()". This may however be at the cost of an overhead computation mapping the index to the actual dart. - The path may be extended with the member function \ref Surface_mesh_topology::Path_on_surface::extend_positive_turn "extend_positive_turn()" by specifying the next halfedge thanks to a number of positive turns with respect to the previous dart/halfedge in the path. Calling this previous halfedge `h`, extending by a positive one turn is thus equivalent to extend the path with `next(h)`. An analogous member function \ref Surface_mesh_topology::Path_on_surface::extend_negative_turn "extend_negative_turn()" is provided for convenience. -- Finally, when the input surface is a model of `PolygonalSchema`, which is a model of `GenericMap` with labeled edges as explained in section \ref SMTopology_Schema, the user may push the label of the next halfedge instead of the halfedge itself with the member function \ref Surface_mesh_topology::Path_on_surface::push_back_by_label "push_back_by_label()". +- Finally, when the input surface is a model of `PolygonalSchema`, which is a model of `GenericMap` with labeled edges as explained in section \ref SMTopology_Schema, the user may push the label of the next halfedge instead of the halfedge itself with the member function \ref Surface_mesh_topology::Path_on_surface::push_back_by_label "push_back_by_label()". In the first two cases, the source vertex of the added dart should coincide with the target vertex of the last dart in the path. The user is responsible for ensuring this condition. The member functions \ref Surface_mesh_topology::Path_on_surface::can_be_pushed "can_be_pushed()", \ref Surface_mesh_topology::Path_on_surface::can_be_pushed_by_index "can_be_pushed_by_index()" and \ref Surface_mesh_topology::Path_on_surface::can_be_pushed_by_label "can_be_pushed_by_label()" return `true` if and only if the condition is satisfied. @@ -57,9 +57,9 @@ The class provides the following functionalities. \subsubsection SMTopology_PL_with_Boundary Polygonal Schema with Boundary As noted in the previous section \ref SMTopology_PL "Polygonal Schema", every label that appears only once in a polygonal schema corresponds to a boundary edge. The Polygonal Schema helper offers another mechanism to create surfaces with boundary. Each facet already added to a polygonal schema may be perforated to create a hole in the surface. The edges of a perforated facet thus becomes boundary edges. The reverse operation consists in filling the supposedly perforated facet. The class provides the following interface. -- \ref PolygonalSchema::perforate_facet "perforate_facet (h)" perforates the facet identified by the halfedge `h`. If `s` is the label of the oriented edge corresponding to `h`, one may equivalently call perforate_facet (s). +- \ref PolygonalSchema::perforate_facet "perforate_facet (h)" perforates the facet identified by the halfedge `h`. If `s` is the label of the oriented edge corresponding to `h`, one may equivalently call perforate_facet (s). - Similarly, \ref PolygonalSchema::fill_facet "fill_facet (h or s)" turns a facet into a plain one. -- The member functions \ref PolygonalSchema::get_dart_labeled "get_dart_labeled(s)" and \ref PolygonalSchema::get_label "get_label(h)" allow to easily pass from a halfedge to its label and vice versa. +- The member functions \ref PolygonalSchema::get_dart_labeled "get_dart_labeled(s)" and \ref PolygonalSchema::get_label "get_label(h)" allow to easily pass from a halfedge to its label and vice versa. As an example, one may perforate all the facets of a polygonal schema \f$\cal{M}\f$ to obtain a "skeleton" surface equivalent to a thickening of the graph composed of the edges of \f$\cal{M}\f$. @@ -71,7 +71,7 @@ A `Surface_mesh_topology::Curves_on_surface_topology` can be constructed with a \subsubsection SMTopology_Build Building the Internal Surface Representation A common first step in the homotopy test algorithms is to simplify the input combinatorial surface. This preprocessing step is done once and for all for a given mesh, the first time an homotopy test is called. The simplified surface is a quadrangulation, every face of which is a quadrilateral, stored in a `Surface_mesh_topology::Curves_on_surface_topology`. It has 2 vertices and \f$2g\f$ quadrilaterals where \f$g\f$ is the genus of -the input surface. This is otherwise independent of the size of input surface, +the input surface. This is otherwise independent of the size of input surface, \note The user must not modify the input surface as long as homotopy tests are performed with this `Surface_mesh_topology::Curves_on_surface_topology`. Each time a `Surface_mesh_topology::Path_on_surface` is provided for a homotopy test, it is first transformed to an equivalent path in the quadrangulation stored by the `Surface_mesh_topology::Curves_on_surface_topology`. This transformation is transparent to the user who has never access to the quadrangulation. @@ -95,7 +95,7 @@ The following example shows how to load an off file and how to create three clos \subsection SMTopology_Example_II Polygonal Schema Examples Here, we show with two examples how to create a surface from a list of faces specified by edge label sequences. -In this first example, we build a genus two torus surface from a single face, also called a polygonal schema. See left \cgalFigureRef{fig_sm_incremental-builder} for an illustration. Two closed paths are then created. The paths are freely homotopic but not homotopic with fixed endpoint. +In this first example, we build a genus two torus surface from a single face, also called a polygonal schema. See left \cgalFigureRef{fig_sm_incremental-builder} for an illustration. Two closed paths are then created. The paths are freely homotopic but not homotopic with fixed endpoint. \cgalExample{Surface_mesh_topology/path_homotopy_with_symbols.cpp} In this second example, we build a genus two torus surface from a set of three squares. See middle \cgalFigureRef{fig_sm_incremental-builder} for an illustration. The first two faces are added each with a single call to the member function `add_facet()`. The third face is build incrementally by adding its edge labels one at a time. We then create a contractible closed path. @@ -114,7 +114,7 @@ The machine used is a PC running Ubuntu 18.04 with an Intel CPU Core i7-4790 CPU The first time an homotopy test is called, we build a special quadrangulation of the surface as internal representation (as explained in Section \ref SMTopology_Theory "Implementation Details"). The complexity of this operation is linear in the number of darts of the input surface, as we can see in \cgalFigureRef{fig_sm_topology_bench1}. -For this benchmark, we computed 38 `Surface_mesh_topology::Curves_on_surface_topology` objects for different input surfaces with different number of darts (between 8,000 and 30,000,000). We show in the figure the computation time of the quadrangulation according to the number of darts of the input surface. We remind that this computation needs be done only once if you want to perform several path homotopy tests on the same surface. +For this benchmark, we computed 38 `Surface_mesh_topology::Curves_on_surface_topology` objects for different input surfaces with different number of darts (between 8,000 and 30,000,000). We show in the figure the computation time of the quadrangulation according to the number of darts of the input surface. We remind that this computation needs be done only once if you want to perform several path homotopy tests on the same surface. \cgalFigureBegin{fig_sm_topology_bench1, computation-time-reduce-surface.svg} Computation time of `Surface_mesh_topology::Curves_on_surface_topology` constructions, according to the number of darts or the input surface. @@ -124,7 +124,7 @@ For this benchmark, we computed 38 `Surface_mesh_topology::Curves_on_surface_top In this second benchmark, we use two surfaces as input (with respectively 543,652 vertices, 1,631,574 edges and 1,087,716 faces, and 55,498 vertices, 167,106 edges and 111,404 faces). We generate 100 random pairs of closed paths on each surface. The first path is generated randomly, with a lower bound for its length given by a random number between 100 and 10,000: passed the lower bound, the path is randomly extended until it returns to its origin vertex. The second path is generated from a sequence of elementary deformations of the first path, so that the two paths are homotopic. The number of elementary deformations is a random number between 100 and 10,000. -The computation time of the 200 `are_freely_homotopic()` tests are given in \cgalFigureRef{fig_sm_topology_bench2}, according to the number of darts of the two input paths. +The computation time of the 200 `are_freely_homotopic()` tests are given in \cgalFigureRef{fig_sm_topology_bench2}, according to the number of darts of the two input paths. \cgalFigureBegin{fig_sm_topology_bench2, computation-time-path-homotopy.svg} Computation time of `are_freely_homotopic()` tests, according to the number of darts or the input paths. @@ -135,19 +135,19 @@ The third benchmark is similar to the previous one, except that we use a genus 5 Computation time of `are_freely_homotopic()` tests, according to the number of darts or the input paths for random paths on the canonical reduced surface of genus five. \cgalFigureEnd -Note that the linear time implementation of the algorithms is remarkably observed in each benchmark. +Note that the linear time implementation of the algorithms is remarkably observed in each benchmark. \section SMTopology_Theory Implementation Details \subsection SMTopology_Quad_System Reducing to a Quadrangulation -A quadrangulation is a combinatorial map whose faces are quadrilaterals, i.e. have four sides. +A quadrangulation is a combinatorial map whose faces are quadrilaterals, i.e. have four sides. For efficiency of the homotopy test, the input combinatorial surface \f$\cal{M}\f$ is first turned into a quadrangulation with only two vertices. The transformation is performed as follows. -# A spanning tree of the graph composed of the vertices and edges of \f$\cal{M}\f$ is computed. See \cgalFigureRef{fig_spanning_tree}. \cgalFigureBegin{fig_spanning_tree,spanning_tree.svg} Left, a combinatorial map with three faces (red, yellow, green). Right, a spanning tree of its graph. \cgalFigureEnd - + -# The edges of the spanning are contracted. The resulting surface has the same topology as \f$\cal{M}\f$ and has a single vertex. \cgalFigureBegin{fig_contract_tree,contract_tree.svg} The contraction of a spanning tree merges all the vertices into a single vertex. @@ -172,12 +172,12 @@ This quadrangulation \f$\cal{Q}\f$ is stored in a `Surface_mesh_topology::Curves \subsection SMTopology_Canonical Canonical Form In order to test if two input curves \f$C\f$ and \f$D\f$ in \f$\cal{M}\f$ are homotopic they are first replaced by curves \f$C'\f$ and \f$D'\f$ in \f$\cal{Q}\f$ as above. Those curves are further transformed into canonical forms that only depend on their homotopy classes. The transformation to canonical form relies on three basic operations that we now describe. --# A bracket in a curve is a subsequence of edges along a row of quadrilaterals, surrounded by two edges along the end sides of the row. A bracket can be flattened by replacing the corresponding subpath with a shorter subpath going along the other long side of the row. See \cgalFigureRef{fig_bracket}. +-# A bracket in a curve is a subsequence of edges along a row of quadrilaterals, surrounded by two edges along the end sides of the row. A bracket can be flattened by replacing the corresponding subpath with a shorter subpath going along the other long side of the row. See \cgalFigureRef{fig_bracket}. \cgalFigureBegin{fig_bracket,bracket.svg} Left, a blue curve in a quadrangulation (for clarity the quadrangulation has more than two vertices). Middle, a bracket of the blue curve. Right, the bracket has been flattened. \cgalFigureEnd --# A spur in a curve is a subsequence of two opposite edges. A spur can be deleted to shorten the curve. See \cgalFigureRef{fig_spur}. +-# A spur in a curve is a subsequence of two opposite edges. A spur can be deleted to shorten the curve. See \cgalFigureRef{fig_spur}. \cgalFigureBegin{fig_spur,spur.svg} Removing a spur. \cgalFigureEnd @@ -189,7 +189,7 @@ In order to test if two input curves \f$C\f$ and \f$D\f$ in \f$\cal{M}\f$ are ho The canonical form of a curve is obtained by flattening its brackets, removing its spurs and pushing its right L-shapes to the right until the curve has no more brackets, spurs or L-shapes. This can be done in time proportional to the number of edges of the curve. Note that the above three operations preserve the homotopy class of the curve. -\subsection SMTopology_Homotopy_Test Homotopy Test +\subsection SMTopology_Homotopy_Test Homotopy Test It can be proven that the canonical form is uniquely defined and only depends on the homotopy class of the curve. Hence, the curves \f$C'\f$ and \f$D'\f$ in \f$\cal{Q}\f$ are homotopic if and only if their canonical forms are equal. Since each curve is defined as a sequence of (oriented) edges up to a cyclic permutation, we resort to the Knuth-Morris-Pratt algorithm to decide in linear time if the canonical forms are the same up to a cyclic permutation. \section Implementation History diff --git a/Surface_mesh_topology/examples/Surface_mesh_topology/basic_example_surface_mesh_topology.cpp b/Surface_mesh_topology/examples/Surface_mesh_topology/basic_example_surface_mesh_topology.cpp index 048fb5a736d..fbf26efd421 100644 --- a/Surface_mesh_topology/examples/Surface_mesh_topology/basic_example_surface_mesh_topology.cpp +++ b/Surface_mesh_topology/examples/Surface_mesh_topology/basic_example_surface_mesh_topology.cpp @@ -42,11 +42,11 @@ int main() create_path_1(p1); create_path_2(p2); create_path_3(p3); - + bool res1=cst.is_contractible(p1); std::cout<<"Path p1 (pink) "<<(res1?"IS":"IS NOT") <<" contractible."< > paths={p1, p2, p3}; CGAL::draw(lcc, paths); // Enable only if CGAL was compiled with Qt5 #endif // CGAL_USE_BASIC_VIEWER - + return EXIT_SUCCESS; } /////////////////////////////////////////////////////////////////////////////// diff --git a/Surface_mesh_topology/examples/Surface_mesh_topology/basic_example_torus.cpp b/Surface_mesh_topology/examples/Surface_mesh_topology/basic_example_torus.cpp index e8a697ccf32..6db8dfdf85f 100644 --- a/Surface_mesh_topology/examples/Surface_mesh_topology/basic_example_torus.cpp +++ b/Surface_mesh_topology/examples/Surface_mesh_topology/basic_example_torus.cpp @@ -17,7 +17,7 @@ void create_path_1(Path_on_surface& p) /////////////////////////////////////////////////////////////////////////////// void create_path_2(Path_on_surface& p) -{ +{ p.push_back_by_index(1); // Its starting dart for (int i=0; i<4; ++i) { p.extend_positive_turn(2); } // Extend the path @@ -37,11 +37,11 @@ int main() Path_on_surface p1(lcc), p2(lcc); create_path_1(p1); create_path_2(p2); - + bool res1=cst.is_contractible(p1); std::cout<<"Path p1 (pink) "<<(res1?"IS":"IS NOT") <<" contractible."< > paths={p1, p2}; CGAL::draw(lcc, paths); // Enable only if CGAL was compiled with Qt5 #endif // CGAL_USE_BASIC_VIEWER - + return EXIT_SUCCESS; } /////////////////////////////////////////////////////////////////////////////// diff --git a/Surface_mesh_topology/examples/Surface_mesh_topology/open_path_homotopy.cpp b/Surface_mesh_topology/examples/Surface_mesh_topology/open_path_homotopy.cpp index 04131741df4..7a864d45f83 100644 --- a/Surface_mesh_topology/examples/Surface_mesh_topology/open_path_homotopy.cpp +++ b/Surface_mesh_topology/examples/Surface_mesh_topology/open_path_homotopy.cpp @@ -65,7 +65,7 @@ int main() std::vector > paths={p1, p2, p3}; CGAL::draw(sm, paths); // Enable only if CGAL was compiled with Qt5 #endif // CGAL_USE_BASIC_VIEWER - + return EXIT_SUCCESS; } /////////////////////////////////////////////////////////////////////////////// diff --git a/Surface_mesh_topology/examples/Surface_mesh_topology/path_homotopy.cpp b/Surface_mesh_topology/examples/Surface_mesh_topology/path_homotopy.cpp index 805595cf533..68367231b6d 100644 --- a/Surface_mesh_topology/examples/Surface_mesh_topology/path_homotopy.cpp +++ b/Surface_mesh_topology/examples/Surface_mesh_topology/path_homotopy.cpp @@ -97,7 +97,7 @@ void process_command_line(int argc, char** argv, /////////////////////////////////////////////////////////////////////////////// int main(int argc, char** argv) { - std::string file="data/elephant.off"; + std::string file="data/elephant.off"; bool draw=false; int l1=10, l2=100; int d1=10, d2=100; @@ -117,9 +117,9 @@ int main(int argc, char** argv) std::cout<<"Initial map: "; lcc.display_characteristics(std::cout) << ", valid=" << lcc.is_valid() << std::endl; - + Curves_on_surface_topology cst(lcc, time); - + cst.compute_minimal_quadrangulation(time); std::cout<<"Reduced map: "; @@ -129,7 +129,7 @@ int main(int argc, char** argv) unsigned int nbcontractible=0; std::vector errors_seeds; unsigned int length, defo; - + for (unsigned int i=0; i(random.get_int(l1, l2+1)); defo=static_cast(random.get_int(d1, d2+1)); - + std::vector > paths; std::vector > transformed_paths; @@ -191,6 +191,6 @@ int main(int argc, char** argv) std::cout<<"Number of contractible paths: "<(nbcontractible*100)/ static_cast(N)<<"%)."< p1(ps); p1.push_back_by_label("a"); Path_on_surface p2(ps); p2.push_back_by_label("b c a -c -b"); - + Curves_on_surface_topology cst(ps); bool res1=cst.are_freely_homotopic(p1, p2); diff --git a/Surface_mesh_topology/examples/Surface_mesh_topology/path_homotopy_with_symbols_2.cpp b/Surface_mesh_topology/examples/Surface_mesh_topology/path_homotopy_with_symbols_2.cpp index 2d6fef267f5..3a01d954b87 100644 --- a/Surface_mesh_topology/examples/Surface_mesh_topology/path_homotopy_with_symbols_2.cpp +++ b/Surface_mesh_topology/examples/Surface_mesh_topology/path_homotopy_with_symbols_2.cpp @@ -21,12 +21,12 @@ int main() ps.finish_facet(); ps.perforate_facet("f"); - + std::cout<<"Number of cells of the combinatorial maps: "; ps.display_characteristics(std::cout)< p(ps); - p.push_back_by_label("a b -a e -b d"); + p.push_back_by_label("a b -a e -b d"); CGAL::Surface_mesh_topology::Curves_on_surface_topology cst(ps); bool res=cst.is_contractible(p); diff --git a/Surface_mesh_topology/examples/Surface_mesh_topology/surface_mesh_topology_with_sm_and_polyhedron.cpp b/Surface_mesh_topology/examples/Surface_mesh_topology/surface_mesh_topology_with_sm_and_polyhedron.cpp index 2b09719d41b..70c0c6d732c 100644 --- a/Surface_mesh_topology/examples/Surface_mesh_topology/surface_mesh_topology_with_sm_and_polyhedron.cpp +++ b/Surface_mesh_topology/examples/Surface_mesh_topology/surface_mesh_topology_with_sm_and_polyhedron.cpp @@ -34,7 +34,7 @@ void test(const FaceGraph& mesh) bool res1=cst.is_contractible(p1); std::cout<<"Path p1 "<<(res1?"IS":"IS NOT")<<" contractible."<are_freely_homotopic(p1, p2, display_time); } - + /// @return true iff 'p1' and 'p2' are base point freely homotopic. bool are_base_point_homotopic(const Path_on_surface& p1, const Path_on_surface& p2, diff --git a/Surface_mesh_topology/include/CGAL/Path_on_surface.h b/Surface_mesh_topology/include/CGAL/Path_on_surface.h index bc3a5131c79..bdc3c72ae55 100644 --- a/Surface_mesh_topology/include/CGAL/Path_on_surface.h +++ b/Surface_mesh_topology/include/CGAL/Path_on_surface.h @@ -78,11 +78,11 @@ public: m_is_closed(apath.m_is_closed), m_flip(apath.m_flip) {} - + void swap(Self& p2) { if (this==&p2) { return; } - + CGAL_assertion(&m_map==&(p2.m_map)); m_path.swap(p2.m_path); std::swap(m_is_closed, p2.m_is_closed); @@ -158,7 +158,7 @@ public: CGAL_assertion(i l, bool update_isclosed=true) { for (std::size_t i : l) { push_back_by_index(i, false, update_isclosed); } } - + /// @return true iff the dart labeled e can be added at the end of the path. bool can_be_pushed_by_label(const std::string& e, bool flip=false) const { @@ -325,7 +325,7 @@ public: if (dh==nullptr) { return false; } return can_be_pushed(dh, flip); } - + /// Add the dart having the given labels at the end of this path. /// Each label is a word, possibly starting by -, words are separated by spaces void push_back_by_label(const std::string& s, bool update_isclosed=true) @@ -334,10 +334,10 @@ public: for (std::string e; std::getline(iss, e, ' '); ) { Dart_const_handle dh=get_map().get_dart_labeled(e); - if (dh!=nullptr) { push_back(dh, false, update_isclosed); } + if (dh!=nullptr) { push_back(dh, false, update_isclosed); } } } - + void push_back_by_label(std::initializer_list l, bool update_isclosed=true) { @@ -446,7 +446,7 @@ public: if (get_map().template is_free<2>(dh)) { display_failed_extention("extend_straight_positive"); return; } dh=get_map().template beta<2, 1>(dh); - + push_back(dh, false, false); } @@ -472,14 +472,14 @@ public: for (unsigned int i=0; i(dh); - + if (get_map().template is_free<2>(dh)) { display_failed_extention("extend_straight_negative"); return; } dh=get_map().template beta<2, 0>(dh); - + push_back(dh, true, false); } - + if (update_isclosed) { update_is_closed(); } } @@ -505,7 +505,7 @@ public: { dh=get_map().template beta<2>(dh); } } dh=get_map().template beta<1>(dh); - + for (unsigned int i=1; i(dh)) @@ -537,7 +537,7 @@ public: { dh=get_map().template beta<2>(dh); } } dh=get_map().template beta<0>(dh); - + for (unsigned int i=1; i(dh)) @@ -567,7 +567,7 @@ public: ++index; if (index==get_map().darts().capacity()) index=0; } - + // second we take randomly one of the two darts of this edge // (potentially with the help of a flip) bool heads_or_tails=random.get_bool(); @@ -867,7 +867,7 @@ public: if (!is_closed()) { return are_same_paths_from(other, 0); } - + Self pp1=*this; pp1.simplify_flips(); Self pp2=other; @@ -1020,7 +1020,7 @@ public: pend=m_flip.back()?back():m_map.other_extremity(back()); if (pend==Map::null_handle) { m_is_closed=false; } else - { + { Dart_const_handle pbegin=m_flip[0]?m_map.other_extremity(m_path[0]):m_path[0]; m_is_closed=m_map.template belong_to_same_cell<0>(pbegin, pend); @@ -1108,7 +1108,7 @@ public: if ((get_ith_flip(i) && get_map().template is_free<2>(get_ith_dart(i))) || (get_next_flip(i) && get_map().template is_free<2>(get_next_dart(i)))) { return std::numeric_limits::max(); } - + return m_map.positive_turn(get_ith_real_dart(i), get_ith_real_dart(next_index(i))); } diff --git a/Surface_mesh_topology/include/CGAL/Polygonal_schema.h b/Surface_mesh_topology/include/CGAL/Polygonal_schema.h index 528abcce1cb..d341f47fd04 100644 --- a/Surface_mesh_topology/include/CGAL/Polygonal_schema.h +++ b/Surface_mesh_topology/include/CGAL/Polygonal_schema.h @@ -31,7 +31,7 @@ namespace CGAL { namespace Surface_mesh_topology { - namespace internal + namespace internal { /// @return opposite label of label s /// (i.e. add/remove - depending if s is positive or negative) @@ -40,7 +40,7 @@ namespace Surface_mesh_topology { CGAL_assertion(!s.empty()); if (s[0]=='-') { return s.substr(1, std::string::npos); } - + return std::string("-")+s; } @@ -52,7 +52,7 @@ namespace Surface_mesh_topology { struct Polygonal_schema_tools { typedef typename CMap::Dart_handle Dart_handle; - + static Dart_handle add_edge_to_face(CMap& cmap, const std::string& s, Dart_handle prev_dart, @@ -69,7 +69,7 @@ namespace Surface_mesh_topology { <<" This label can not be use anymore."<(prev_dart, res); } - + if (dart_opposite_label!=nullptr) { cmap.template link_beta<2>(res, dart_opposite_label); } - + return res; } - + const std::string& get_label(CMap& cmap, Dart_handle dh) const { return cmap.info(dh).m_label; } }; @@ -99,7 +99,7 @@ namespace Surface_mesh_topology { struct Polygonal_schema_tools { typedef typename GMap::Dart_handle Dart_handle; - + // In a GMap, if an edge is 2-free, only one of its two dart has one label. // Otherwise, d has one label and alpha<0,2>(d) the opposite label. static Dart_handle @@ -118,7 +118,7 @@ namespace Surface_mesh_topology { <<" This label can not be use anymore."<(dh2, dart_opposite_label); } } @@ -172,7 +172,7 @@ namespace Surface_mesh_topology { struct Combinatorial_map_tag; struct Generalized_map_tag; - + template < class BaseModel > class Polygonal_schema_base: public BaseModel { @@ -222,7 +222,7 @@ namespace Surface_mesh_topology { Dart_handle dart_same_label=get_dart_labeled(s); Dart_handle dart_opposite_label=get_dart_labeled (internal::opposite_label(s)); - + Dart_handle cur=internal::Polygonal_schema_tools:: add_edge_to_face(*this, s, prev_dart, dart_same_label, dart_opposite_label, edge_label_to_dart); @@ -248,7 +248,7 @@ namespace Surface_mesh_topology { for (std::string token; std::getline(iss, token, ' '); ) { add_edge_to_facet(token); } } - + /// add one facet, given a sequence of labels. /// @param s the sequence of labels of edges to add. void add_facet(const std::string& s) @@ -279,7 +279,7 @@ namespace Surface_mesh_topology { for (const char* e : l) { add_edge_to_facet(e); } } - + /// add a new facet, given a sequence of labels, as an initializer list. void add_facet(std::initializer_list l) { @@ -294,7 +294,7 @@ namespace Surface_mesh_topology { add_edges_to_facet(l); finish_facet(); } - + /// End of the facet. Return the first dart of this facet. Dart_handle finish_facet() { @@ -308,7 +308,7 @@ namespace Surface_mesh_topology { CGAL_assertion( first_dart!=this->null_handle && prev_dart!=this->null_handle ); this->set_next(prev_dart, first_dart); - + facet_started=false; return first_dart; } @@ -332,7 +332,7 @@ namespace Surface_mesh_topology { { if (this->is_marked(dh, mark_perforated)) { return 0; } - + return this->template mark_cell<2>(dh, mark_perforated); } @@ -408,7 +408,7 @@ namespace Surface_mesh_topology { <<" "<second)< Self; typedef Combinatorial_map_base<2, Self, Items_, Alloc_, Storage_> CMap_base; typedef Polygonal_schema_base Base; - + typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Dart_const_handle Dart_const_handle; @@ -459,7 +459,7 @@ namespace Surface_mesh_topology { amap, const Converters& converters) : Base(amap, converters) {} - + template @@ -481,7 +481,7 @@ namespace Surface_mesh_topology { Base(amap, converters, dartinfoconverter, pointconverter) {} }; - + /// Polygonal schema with generalized map. template Self; typedef Generalized_map_base<2, Self, Items_, Alloc_, Storage_> GMap_base; typedef Polygonal_schema_base Base; - + typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Dart_const_handle Dart_const_handle; @@ -520,7 +520,7 @@ namespace Surface_mesh_topology { amap, const Converters& converters) : Base(amap, converters) {} - + template @@ -542,7 +542,7 @@ namespace Surface_mesh_topology { Base(amap, converters, dartinfoconverter, pointconverter) {} }; - + /// Generate a random polygonal schema ps. /// @param nb_labels the number of labels used to generate ps. /// @param seed the seed used for random diff --git a/Surface_mesh_topology/include/CGAL/Polygonal_schema_min_items.h b/Surface_mesh_topology/include/CGAL/Polygonal_schema_min_items.h index c12daa51126..1a933f6e79e 100644 --- a/Surface_mesh_topology/include/CGAL/Polygonal_schema_min_items.h +++ b/Surface_mesh_topology/include/CGAL/Polygonal_schema_min_items.h @@ -33,7 +33,7 @@ namespace Surface_mesh_topology { { struct Info_for_darts { std::string m_label; }; - + typedef Info_for_darts Dart_info; }; }; diff --git a/Surface_mesh_topology/include/CGAL/Surface_mesh_topology/internal/Minimal_quadrangulation.h b/Surface_mesh_topology/include/CGAL/Surface_mesh_topology/internal/Minimal_quadrangulation.h index 064425a7bbe..2850e7f2554 100644 --- a/Surface_mesh_topology/include/CGAL/Surface_mesh_topology/internal/Minimal_quadrangulation.h +++ b/Surface_mesh_topology/include/CGAL/Surface_mesh_topology/internal/Minimal_quadrangulation.h @@ -963,7 +963,7 @@ protected: CGAL_assertion(get_reduced_map().is_whole_map_marked(treated)); get_reduced_map().free_mark(treated); -#ifdef NDEBUG +#ifdef NDEBUG for (typename Reduced_map::Dart_range::iterator it=get_reduced_map().darts().begin(); it!=get_reduced_map().darts().end(); ++it) @@ -1021,7 +1021,7 @@ protected: } } -#ifdef NDEBUG +#ifdef NDEBUG for (auto it=m_paths.begin(), itend=m_paths.end(); it!=itend; ++it) { if (it->second.second==nullptr) @@ -1061,7 +1061,7 @@ protected: CGAL_assertion(get_reduced_map().is_whole_map_unmarked(oldedges)); get_reduced_map().free_mark(oldedges); -#ifdef NDEBUG +#ifdef NDEBUG for (auto it=m_paths.begin(), itend=m_paths.end(); it!=itend; ++it) { CGAL_assertion(get_reduced_map().is_dart_used(it->second.first)); diff --git a/Surface_mesh_topology/include/CGAL/Surface_mesh_topology/internal/Path_generators.h b/Surface_mesh_topology/include/CGAL/Surface_mesh_topology/internal/Path_generators.h index 33b71ff423e..20cf61acd2a 100644 --- a/Surface_mesh_topology/include/CGAL/Surface_mesh_topology/internal/Path_generators.h +++ b/Surface_mesh_topology/include/CGAL/Surface_mesh_topology/internal/Path_generators.h @@ -29,35 +29,35 @@ void create_braket_positive(Path& p, std::size_t length, CGAL::Random& random, { if (p.is_empty()) { p.initialize_random_starting_dart(random, false); } - + p.extend_positive_turn(1, false); p.extend_straight_positive(length, false); p.extend_positive_turn(1, false); if (update_isclosed) { p.update_is_closed(); } } - -template + +template void create_braket_positive(Path& p, std::size_t length, bool update_isclosed=true) { CGAL::Random random; create_braket_positive(p, length, random, update_isclosed); } - -template + +template void create_braket_negative(Path& p, std::size_t length, CGAL::Random& random, bool update_isclosed=true) { if (p.is_empty()) { p.initialize_random_starting_dart(random, false); } - + p.extend_negative_turn(1, false); p.extend_straight_negative(length, false); p.extend_negative_turn(1, false); if (update_isclosed) { p.update_is_closed(); } } - -template + +template void create_braket_negative(Path& p, std::size_t length, bool update_isclosed=true) { @@ -91,7 +91,7 @@ generate_random_connected_set_of_faces(const LCC& lcc, std::size_t nb, if (lcc.is_empty()) { return NULL; } std::unordered_map border_faces; - + std::size_t index=static_cast (random.get_int(0, static_cast(lcc.darts().capacity()))); while (!lcc.darts().is_used(index)) @@ -104,14 +104,14 @@ generate_random_connected_set_of_faces(const LCC& lcc, std::size_t nb, border_faces[0]=dh1; set.insert(dh1); lcc.template mark_cell<2>(dh1, amark); - + for (std::size_t i=1; i (random.get_int (0, static_cast(border_faces.size()))); int nbborder=0; - + typename LCC::Dart_const_handle dh1_init=border_faces[facenumber]; dh1=dh1_init; do diff --git a/Surface_mesh_topology/include/CGAL/Surface_mesh_topology/internal/Path_on_surface_with_rle.h b/Surface_mesh_topology/include/CGAL/Surface_mesh_topology/internal/Path_on_surface_with_rle.h index 871fc982b55..6ebc12fd3b1 100644 --- a/Surface_mesh_topology/include/CGAL/Surface_mesh_topology/internal/Path_on_surface_with_rle.h +++ b/Surface_mesh_topology/include/CGAL/Surface_mesh_topology/internal/Path_on_surface_with_rle.h @@ -78,10 +78,10 @@ public: typedef Map_ Reduced_map; typedef Map_ Mesh; typedef typename Map_::Dart_const_handle Dart_const_handle; - + Light_MQ(const Reduced_map& m): m_map(m) {} - + const Reduced_map& get_reduced_map() const { return m_map; } @@ -90,7 +90,7 @@ public: std::size_t negative_turn(Dart_const_handle d1, Dart_const_handle d2) const { return m_map.negative_turn(d1, d2); } - + protected: const Reduced_map& m_map; }; @@ -275,7 +275,7 @@ public: Path_on_surface p2(other); return p1==p2; } - + bool operator!=(Self& other) { return !(operator==(other)); } @@ -955,7 +955,7 @@ public: advance_iterator(itend); return true; } - + /// Return true if it is the beginning of a negative bracket. /// If true, itend is updated to be the end of the bracket bool is_negative_bracket(const List_iterator& it, @@ -1026,9 +1026,9 @@ public: m_length-=2; return; } - + it2=next_iterator(it1); // it2 is the the next flat after it1 - + reduce_flat_from_end(it1, modified_flats); // decrease also m_length reduce_flat_from_beginning(it3, modified_flats); @@ -1092,7 +1092,7 @@ public: // CGAL_assertion(is_valid()); } - + /// Simplify the path by removing all brackets, if all==true (default), /// or by removing only one bracket, if all==false. /// @return true iff at least one bracket was removed @@ -1204,7 +1204,7 @@ public: return (flat_length(ittemp)>0 && positive_flat) || (flat_length(ittemp)<0 && negative_flat); } - + /// @return true iff the flat after flat 'it' can be extended by adding /// dart 'dh' to its beginning. bool is_next_flat_can_be_extended_at_beginning(const List_iterator& it, @@ -1236,7 +1236,7 @@ public: } ++m_length; } - + /// Add the given dart 'dh' after the flat 'it'. void add_dart_after(const List_iterator& it, Dart_const_handle dh, Set_of_it& modified_flats) @@ -1258,7 +1258,7 @@ public: } ++m_length; } - + /// Right push the given l-shape. void right_push_l_shape(List_iterator& it1) { @@ -1437,7 +1437,7 @@ public: if (flat_length(it1)==0) { set_end_of_flat(it1, dh2); } else { set_end_of_flat(it1, dh3); } // End of the moved flat flat_modified(it1, modified_flats); - + // 4) Move the second flat CGAL_assertion(flat_length(it2)<0); set_begin_of_flat(it2, dh4); diff --git a/Surface_mesh_topology/include/CGAL/draw_face_graph_with_paths.h b/Surface_mesh_topology/include/CGAL/draw_face_graph_with_paths.h index 2543ffaea09..63355559b65 100644 --- a/Surface_mesh_topology/include/CGAL/draw_face_graph_with_paths.h +++ b/Surface_mesh_topology/include/CGAL/draw_face_graph_with_paths.h @@ -117,7 +117,7 @@ public: } protected: - + const Point& get_point(Dart_const_handle dh) const { return CGAL::Get_traits::get_point(mesh, dh); } @@ -202,7 +202,7 @@ protected: cur=lcc.next(cur); } while(cur!=dh); - + // CGAL::Color c=m_fcolor.run(*lcc, dh); face_begin(); //c); @@ -315,7 +315,7 @@ protected: CGAL::Random random(static_cast(i)); CGAL::Color color=get_random_color(random); - + add_point(get_point((*m_paths)[i].get_ith_dart(0)), color); for (std::size_t j=0; j<(*m_paths)[i].length(); ++j) { @@ -326,7 +326,7 @@ protected: } } } - + protected: const Mesh& mesh; const typename Get_map::storage_type lcc; @@ -338,7 +338,7 @@ protected: bool m_draw_marked_darts; typename LCC::size_type m_amark; // If !=INVALID_MARK, show darts marked with this mark }; - + template void draw(const Mesh& alcc, const std::vector >& paths, diff --git a/Surface_mesh_topology/test/Surface_mesh_topology/Creation_of_test_cases_for_paths.h b/Surface_mesh_topology/test/Surface_mesh_topology/Creation_of_test_cases_for_paths.h index af0cb32a7ba..fa91e36d92c 100644 --- a/Surface_mesh_topology/test/Surface_mesh_topology/Creation_of_test_cases_for_paths.h +++ b/Surface_mesh_topology/test/Surface_mesh_topology/Creation_of_test_cases_for_paths.h @@ -393,7 +393,7 @@ void generate_path(Path& p, { p.clear(); p.push_back(p.get_map().darts().iterator_to(p.get_map().darts()[0])); - + std::vector before(v1); for (auto it=before.begin(), itend=before.end(); it!=itend; ) { @@ -406,7 +406,7 @@ void generate_path(Path& p, } Surface_mesh_topology::internal::create_braket_positive(p, 6, false); - + std::vector after(v2); for (auto it=after.begin(), itend=after.end(); it!=itend; ) { diff --git a/Surface_mesh_topology/test/Surface_mesh_topology/homotopy_big_cylinder.cpp b/Surface_mesh_topology/test/Surface_mesh_topology/homotopy_big_cylinder.cpp index 18e808ae3e4..2b9f74fea8a 100644 --- a/Surface_mesh_topology/test/Surface_mesh_topology/homotopy_big_cylinder.cpp +++ b/Surface_mesh_topology/test/Surface_mesh_topology/homotopy_big_cylinder.cpp @@ -58,7 +58,7 @@ int main() create_path_3(p3); bool res=true; - + if (cst.is_contractible(p1)) { std::cout<<"ERROR homotopy_big_cylinder test1: " @@ -90,7 +90,7 @@ int main() <& path, Transformation t, internal::Light_MQ lmq(path.get_map()); Path_on_surface prepp(path.get_map()); Path_on_surface prevp=path; - internal::Path_on_surface_with_rle >curp(lmq); + internal::Path_on_surface_with_rle >curp(lmq); std::size_t nb=0; bool modified=false; do @@ -340,7 +340,7 @@ bool test_some_random_paths_on_cube(bool draw, unsigned int testtorun) {-8,8,6,0,-10,10,-7,0,2,2,-7,10,-2,3,-9,2,2,8,-6,5,0, 8,3,2,2,10,-10,7,9,4,-10,0,10,6,-5,8,-5,6,3,6}, // pair of numbers: (turn, length of flat) {3,0,-6,4,-8,6,10,1,-6,7,-5,0,5,1,2,5,-10,10,10,6,-7,6 - ,1,10,8,5,7,4,2,7,10,7,10,0,-8,6,7,0,1,0,-2,4,-4,9,4,9,0,18}); + ,1,10,8,5,7,4,2,7,10,7,10,0,-8,6,7,0,1,0,-2,4,-4,9,4,9,0,18}); if (!unit_test(path, FULL_SIMPLIFICATION, 0, "first random path on cube", "2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2", draw, testtorun, true, false)) { res=false; } @@ -351,13 +351,13 @@ bool test_some_random_paths_on_cube(bool draw, unsigned int testtorun) "1 2 2 2 2", draw, testtorun, true, false)) { res=false; } - generate_path(path, {10,6,-4,5,-5,8,-2,2,4,9,5,3,8,4,-7,7}, // Test 19 + generate_path(path, {10,6,-4,5,-5,8,-2,2,4,9,5,3,8,4,-7,7}, // Test 19 {6,0,-7,7,8,9,3,0,-9,1,-8,2,-3,1,4,8}); if (!unit_test(path, FULL_SIMPLIFICATION, 0, "third random path on cube", "2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2", draw, testtorun, true, false)) { res=false; } - + generate_path(path, // Test 20 {-2,10,6,5,8,1,-2,10,3,8,-7,7,5,10,1,5,9,0,-5,2,-2,4,7,8,-9,9, -9,0,10,3,1,10,-4,8,5,4,-3,5,7,5,-4,7,-4,10,-8,8,2,0,2,1}, diff --git a/Surface_mesh_topology/test/Surface_mesh_topology/test_homotopy_with_polygonal_schema.cpp b/Surface_mesh_topology/test/Surface_mesh_topology/test_homotopy_with_polygonal_schema.cpp index 9ff564e6352..64e829a88a6 100644 --- a/Surface_mesh_topology/test/Surface_mesh_topology/test_homotopy_with_polygonal_schema.cpp +++ b/Surface_mesh_topology/test/Surface_mesh_topology/test_homotopy_with_polygonal_schema.cpp @@ -37,7 +37,7 @@ bool test_two_random_paths(const PS& ps, std::cout<>sm; Path_on_surface p1(sm), p2(sm); - + p1.push_back_by_index(24); p1.extend_positive_turn(1); p1.extend_negative_turn(1); @@ -100,7 +100,7 @@ int main() std::cout<<"tests_path_on_surface "<<(success?"OK":"failed") < Allocator_traits; typedef typename Allocator_traits::template rebind_alloc Event_alloc; typedef typename Allocator_traits::template rebind_alloc Subcurve_alloc; - + protected: /*! \struct * An auxiliary functor for comparing event pointers. diff --git a/TDS_2/doc/TDS_2/CGAL/Triangulation_data_structure_2.h b/TDS_2/doc/TDS_2/CGAL/Triangulation_data_structure_2.h index c547a798b4d..a5af1b6c1f0 100644 --- a/TDS_2/doc/TDS_2/CGAL/Triangulation_data_structure_2.h +++ b/TDS_2/doc/TDS_2/CGAL/Triangulation_data_structure_2.h @@ -4,15 +4,15 @@ namespace CGAL { /*! \ingroup PkgTDS2Ref -The class `Triangulation_data_structure_2` is a model -for the `TriangulationDataStructure_2` concept. -It can be used to represent an orientable 2D triangulation -embedded in a space of any dimension. +The class `Triangulation_data_structure_2` is a model +for the `TriangulationDataStructure_2` concept. +It can be used to represent an orientable 2D triangulation +embedded in a space of any dimension. -The vertices and faces are stored in two nested containers, which are -implemented using `Compact_container`. The class may offer some -flexibility for the choice of container in the future, in the form of -additional template parameters. +The vertices and faces are stored in two nested containers, which are +implemented using `Compact_container`. The class may offer some +flexibility for the choice of container in the future, in the form of +additional template parameters. \tparam VertexBase must be a model of `TriangulationDSVertexBase_2`. The default is `Triangulation_ds_vertex_base_2`. @@ -22,18 +22,18 @@ additional template parameters. \cgalHeading{Modifiers} -In addition to the modifiers required by the -`TriangulationDataStructure_2` concept, the `Triangulation_data_structure_2` class -supports also the modifiers below. Note also that the modifiers below -guarantee the combinatorial validity of the resulting data structure. +In addition to the modifiers required by the +`TriangulationDataStructure_2` concept, the `Triangulation_data_structure_2` class +supports also the modifiers below. Note also that the modifiers below +guarantee the combinatorial validity of the resulting data structure. \cgalHeading{Illustrations} -\anchor figtdssplitjoin +\anchor figtdssplitjoin \image html join_split.png "The join and split operations." \image latex join_split.png "The join and split operations." -\anchor figtdsirdeg2 +\anchor figtdsirdeg2 \image html tds-insert_degree_2.png "Insertion and removal of degree 2 vertices. " \image latex tds-insert_degree_2.png "Insertion and removal of degree 2 vertices. " */ @@ -60,7 +60,7 @@ public: /// @} -/// \name +/// \name /// \cgalAdvancedBegin /// In addition to the interface documented in the concept, /// the class offers the following types. @@ -68,18 +68,18 @@ public: /// @{ /*! -Vertex container type. -*/ -typedef Compact_container Vertex_range; +Vertex container type. +*/ +typedef Compact_container Vertex_range; /*! -Face container type. -*/ -typedef Compact_container Face_range; +Face container type. +*/ +typedef Compact_container Face_range; -/// @} +/// @} -/// \name Operations +/// \name Operations /// \cgalAdvancedBegin /// In addition to the interface documented in the concept, /// the class offers the following functions. @@ -87,90 +87,90 @@ typedef Compact_container Face_range; /// @{ /*! -Returns a reference to the container of faces. -*/ -Face_range & faces() const; +Returns a reference to the container of faces. +*/ +Face_range & faces() const; /*! -Returns a reference to the container of faces. -*/ -Face_range & faces(); +Returns a reference to the container of faces. +*/ +Face_range & faces(); /*! -Returns a reference to the container of vertices. -*/ -Vertex_range & vertices() const; +Returns a reference to the container of vertices. +*/ +Vertex_range & vertices() const; /*! -Returns a reference to the container of vertices. -*/ -Vertex_range & vertices(); +Returns a reference to the container of vertices. +*/ +Vertex_range & vertices(); -/// @} +/// @} -/// \name Modifiers +/// \name Modifiers /// @{ /*! -Joins -the vertices that are endpoints of the edge `(f,i)`, and returns -a vertex handle to common vertex (see -Fig.\ \ref figtdssplitjoin). -\pre `f` must be different from `Face_handle()` and `i` must be `0`, `1` or `2`. -*/ -Vertex_handle join_vertices(Face_handle f, int i); +Joins +the vertices that are endpoints of the edge `(f,i)`, and returns +a vertex handle to common vertex (see +Fig.\ \ref figtdssplitjoin). +\pre `f` must be different from `Face_handle()` and `i` must be `0`, `1` or `2`. +*/ +Vertex_handle join_vertices(Face_handle f, int i); /*! -Joins -the vertices that are endpoints of the edge `e`, and returns -a vertex handle to common vertex. -*/ -Vertex_handle join_vertices(Edge e); +Joins +the vertices that are endpoints of the edge `e`, and returns +a vertex handle to common vertex. +*/ +Vertex_handle join_vertices(Edge e); /*! -Joins -the vertices that are endpoints of the edge `*eit`, and returns -a vertex handle to common vertex. -*/ -Vertex_handle join_vertices(Edge_iterator eit); +Joins +the vertices that are endpoints of the edge `*eit`, and returns +a vertex handle to common vertex. +*/ +Vertex_handle join_vertices(Edge_iterator eit); /*! -Joins -the vertices that are endpoints of the edge `*ec`, and returns -a vertex handle to common vertex. -*/ -Vertex_handle join_vertices(Edges_circulator ec); +Joins +the vertices that are endpoints of the edge `*ec`, and returns +a vertex handle to common vertex. +*/ +Vertex_handle join_vertices(Edges_circulator ec); /*! -Splits the vertex `v` into two vertices `v1` and -`v2`. The common faces `f` and `g` of `v1` and -`v2` are created after (in the counter-clockwise sense) the -faces `f1` and `f2`. The 4-tuple `(v1,v2,f,g)` is -returned (see Fig. \ref figtdssplitjoin). -\pre `dimension()` must be equal to `2`, `f1` and `f2` must be different from `Face_handle()` and `v` must be a vertex of both `f1` and `f2`. -*/ -boost::tuples::tuple -split_vertex(Vertex_handle v, Face_handle f1, Face_handle -f2); +Splits the vertex `v` into two vertices `v1` and +`v2`. The common faces `f` and `g` of `v1` and +`v2` are created after (in the counter-clockwise sense) the +faces `f1` and `f2`. The 4-tuple `(v1,v2,f,g)` is +returned (see Fig. \ref figtdssplitjoin). +\pre `dimension()` must be equal to `2`, `f1` and `f2` must be different from `Face_handle()` and `v` must be a vertex of both `f1` and `f2`. +*/ +boost::tuples::tuple +split_vertex(Vertex_handle v, Face_handle f1, Face_handle +f2); /*! -Inserts -a degree two vertex and two faces adjacent to it that have two common -edges. The edge defined by the face handle `f` and the integer -`i` is duplicated. It returns a handle to the vertex created -(see Fig. \ref figtdsirdeg2). -*/ -Vertex_handle insert_degree_2(Face_handle f, int i); +Inserts +a degree two vertex and two faces adjacent to it that have two common +edges. The edge defined by the face handle `f` and the integer +`i` is duplicated. It returns a handle to the vertex created +(see Fig. \ref figtdsirdeg2). +*/ +Vertex_handle insert_degree_2(Face_handle f, int i); /*! -Removes a degree 2 -vertex and the two faces adjacent to it. The two edges of the star of -`v` that are not incident to it are collapsed -(see Fig. \ref figtdsirdeg2). -\pre The degree of `v` must be equal to 2. -*/ -void remove_degree_2(Vertex_handle v); +Removes a degree 2 +vertex and the two faces adjacent to it. The two edges of the star of +`v` that are not incident to it are collapsed +(see Fig. \ref figtdsirdeg2). +\pre The degree of `v` must be equal to 2. +*/ +void remove_degree_2(Vertex_handle v); /// @} diff --git a/TDS_2/doc/TDS_2/CGAL/Triangulation_ds_face_base_2.h b/TDS_2/doc/TDS_2/CGAL/Triangulation_ds_face_base_2.h index a506fae08b6..85fbc81a185 100644 --- a/TDS_2/doc/TDS_2/CGAL/Triangulation_ds_face_base_2.h +++ b/TDS_2/doc/TDS_2/CGAL/Triangulation_ds_face_base_2.h @@ -4,16 +4,16 @@ namespace CGAL { /*! \ingroup PkgTDS2Ref -The class `Triangulation_ds_face_base_2` is a model for the concept -`TriangulationDSFaceBase_2` to be used by -`Triangulation_data_structure_2`. +The class `Triangulation_ds_face_base_2` is a model for the concept +`TriangulationDSFaceBase_2` to be used by +`Triangulation_data_structure_2`. \cgalModels `TriangulationDSFaceBase_2` \tparam TDS should not be specified (see Section \ref TDS_2TheRebindMechanism and examples) -\sa `CGAL::Triangulation_face_base_2` -\sa `CGAL::Triangulation_ds_vertex_base_2` +\sa `CGAL::Triangulation_face_base_2` +\sa `CGAL::Triangulation_ds_vertex_base_2` */ template< typename TDS = void> diff --git a/TDS_2/doc/TDS_2/CGAL/Triangulation_ds_vertex_base_2.h b/TDS_2/doc/TDS_2/CGAL/Triangulation_ds_vertex_base_2.h index f2d8600e82f..96ce87d5e3b 100644 --- a/TDS_2/doc/TDS_2/CGAL/Triangulation_ds_vertex_base_2.h +++ b/TDS_2/doc/TDS_2/CGAL/Triangulation_ds_vertex_base_2.h @@ -4,25 +4,25 @@ namespace CGAL { /*! \ingroup PkgTDS2Ref -The class `Triangulation_ds_vertex_base_2` can be used as the base vertex -for a `Triangulation_data_structure_2`, it is a model of the concept -`TriangulationDSVertexBase_2`. +The class `Triangulation_ds_vertex_base_2` can be used as the base vertex +for a `Triangulation_data_structure_2`, it is a model of the concept +`TriangulationDSVertexBase_2`. -This base class can be used directly or can serve as a base to derive -other base classes with some additional attributes (a color for -example) tuned for a specific application. +This base class can be used directly or can serve as a base to derive +other base classes with some additional attributes (a color for +example) tuned for a specific application. -Note that if the `Triangulation_data_structure_2` -is used as a parameter of a -geometric triangulation, there are additional geometric requirements -to be fulfilled by the vertex base class, -and `Triangulation_ds_vertex_base_2` cannot be plugged in. +Note that if the `Triangulation_data_structure_2` +is used as a parameter of a +geometric triangulation, there are additional geometric requirements +to be fulfilled by the vertex base class, +and `Triangulation_ds_vertex_base_2` cannot be plugged in. \tparam TDS should not be specified (see Section \ref TDS_2TheRebindMechanism and examples) \cgalModels `TriangulationDSVertexBase_2` -\sa `CGAL::Triangulation_vertex_base_2` +\sa `CGAL::Triangulation_vertex_base_2` \sa `CGAL::Triangulation_ds_face_base_2` */ diff --git a/TDS_2/doc/TDS_2/Concepts/TriangulationDSFaceBase_2.h b/TDS_2/doc/TDS_2/Concepts/TriangulationDSFaceBase_2.h index 8ef6ea99deb..082daba0ec3 100644 --- a/TDS_2/doc/TDS_2/Concepts/TriangulationDSFaceBase_2.h +++ b/TDS_2/doc/TDS_2/Concepts/TriangulationDSFaceBase_2.h @@ -5,53 +5,53 @@ \cgalRefines `TriangulationDataStructure_2::Face` -The concept `TriangulationDSFaceBase_2` describes the requirements for +The concept `TriangulationDSFaceBase_2` describes the requirements for the face base class of a `CGAL::Triangulation_data_structure_2`. -Note that if the `CGAL::Triangulation_data_structure_2` -is plugged into a triangulation class, -the face base class may have additional geometric -requirements depending on the triangulation class. +Note that if the `CGAL::Triangulation_data_structure_2` +is plugged into a triangulation class, +the face base class may have additional geometric +requirements depending on the triangulation class. -At the base level, +At the base level, (see Sections \ref Section_2D_Triangulations_Software_Design -and \ref TDS_2D_default ), -a face stores handles -on its three vertices and on the three neighboring faces. -The vertices and neighbors are indexed 0,1 and 2. -Neighbor `i` lies opposite to vertex `i`. +and \ref TDS_2D_default ), +a face stores handles +on its three vertices and on the three neighboring faces. +The vertices and neighbors are indexed 0,1 and 2. +Neighbor `i` lies opposite to vertex `i`. -Since the `CGAL::Triangulation_data_structure_2` is the class -which defines the handle -types, the face base class has to be somehow -parameterized by the triangulation -data structure. But since the `CGAL::Triangulation_data_structure_2` -itself is parameterized by the face and vertex -base classes, there is a cycle in the definition of these classes. -In order -to break the cycle, the base classes for faces and vertices -which are plugged in to instantiate a -`CGAL::Triangulation_data_structure_2` +Since the `CGAL::Triangulation_data_structure_2` is the class +which defines the handle +types, the face base class has to be somehow +parameterized by the triangulation +data structure. But since the `CGAL::Triangulation_data_structure_2` +itself is parameterized by the face and vertex +base classes, there is a cycle in the definition of these classes. +In order +to break the cycle, the base classes for faces and vertices +which are plugged in to instantiate a +`CGAL::Triangulation_data_structure_2` use `void` as triangulation -data structure parameter. Then, -the `CGAL::Triangulation_data_structure_2` -uses a rebind mechanism (similar to the one specified in -`std::allocator`) in order to plug itself -as parameter in the face and vertex base classes. -This mechanism requires that the base class provides -a templated nested class `Rebind_TDS` that -itself provides -the subtype `Rebind_TDS::Other` -which is the rebound version of the base class. -This rebound base class is the class -that the `CGAL::Triangulation_data_structure_2` -actually uses as a base class for the class -`CGAL::Triangulation_data_structure_2::Face`. +data structure parameter. Then, +the `CGAL::Triangulation_data_structure_2` +uses a rebind mechanism (similar to the one specified in +`std::allocator`) in order to plug itself +as parameter in the face and vertex base classes. +This mechanism requires that the base class provides +a templated nested class `Rebind_TDS` that +itself provides +the subtype `Rebind_TDS::Other` +which is the rebound version of the base class. +This rebound base class is the class +that the `CGAL::Triangulation_data_structure_2` +actually uses as a base class for the class +`CGAL::Triangulation_data_structure_2::Face`. \cgalHasModel `CGAL::Triangulation_ds_face_base_2` -\sa `TriangulationDSVertexBase_2` -\sa `CGAL::Triangulation_data_structure_2` +\sa `TriangulationDSVertexBase_2` +\sa `CGAL::Triangulation_data_structure_2` */ @@ -59,60 +59,60 @@ class TriangulationDSFaceBase_2 { public: -/// \name Types +/// \name Types /// The concept `TriangulationDSFaceBase_2` has to provide the /// following types. /// @{ /*! -This template class has to define a type `Rebind_TDS::%Other` which is the -rebound face base, where the -`CGAL::Triangulation_data_structure_2` is actually plugged in. -This type `Other` will be the actual base -of the class `CGAL::Triangulation_data_structure_2::Face`. +This template class has to define a type `Rebind_TDS::%Other` which is the +rebound face base, where the +`CGAL::Triangulation_data_structure_2` is actually plugged in. +This type `Other` will be the actual base +of the class `CGAL::Triangulation_data_structure_2::Face`. \note It can be implemented using a nested template class. \sa Section \ref TDS_2TheRebindMechanism -*/ -template +*/ +template using Rebind_TDS = unspecified_type; /*! -*/ -typedef TriangulationDataStructure_2 Triangulation_data_structure; +*/ +typedef TriangulationDataStructure_2 Triangulation_data_structure; /*! -*/ -typedef TriangulationDataStructure_2::Vertex_handle Vertex_handle; +*/ +typedef TriangulationDataStructure_2::Vertex_handle Vertex_handle; /*! -*/ -typedef TriangulationDataStructure_2::Face_handle Face_handle; +*/ +typedef TriangulationDataStructure_2::Face_handle Face_handle; -/// @} +/// @} -/// \name Creation +/// \name Creation /// @{ /*! -default constructor. -*/ +default constructor. +*/ TriangulationDSFaceBase_2(); /*! -Initializes the vertices with `v0, v1, v2` and the neighbors -with `Face_handle()`. -*/ +Initializes the vertices with `v0, v1, v2` and the neighbors +with `Face_handle()`. +*/ TriangulationDSFaceBase_2(Vertex_handle v0, Vertex_handle v1, Vertex_handle v2); /*! -initializes the vertices with `v0,v1, v2` and the neighbors with -`n0, n1, n2`. -*/ +initializes the vertices with `v0,v1, v2` and the neighbors with +`n0, n1, n2`. +*/ TriangulationDSFaceBase_2(Vertex_handle v0, Vertex_handle v1, Vertex_handle v2, @@ -120,55 +120,55 @@ TriangulationDSFaceBase_2(Vertex_handle v0, Face_handle n1, Face_handle n2); -/// @} +/// @} -/// \name Access Functions +/// \name Access Functions /// @{ /*! -returns the dimension. -*/ -int dimension(); +returns the dimension. +*/ +int dimension(); -/// @} +/// @} -/// \name Orientation +/// \name Orientation /// @{ /*! -Changes the orientation of the face by exchanging `vertex(0)` -with `vertex(1)` and `neighbor(0)` with `neighbor(1)`. -*/ -void reorient(); +Changes the orientation of the face by exchanging `vertex(0)` +with `vertex(1)` and `neighbor(0)` with `neighbor(1)`. +*/ +void reorient(); /*! -performs a counterclockwise permutation of the -vertices and neighbors of the face. -*/ -void ccw_permute(); +performs a counterclockwise permutation of the +vertices and neighbors of the face. +*/ +void ccw_permute(); /*! -performs a clockwise permutation of the -vertices and neighbors of the face. -*/ -void cw_permute(); +performs a clockwise permutation of the +vertices and neighbors of the face. +*/ +void cw_permute(); -/// @} +/// @} -/// \name Checking +/// \name Checking /// @{ /*! -performs any required test on a face. +performs any required test on a face. -If `verbose` is set to `true`, messages are printed to give -a precise indication of the kind of invalidity encountered. -*/ -bool is_valid(bool verbose = false) const; +If `verbose` is set to `true`, messages are printed to give +a precise indication of the kind of invalidity encountered. +*/ +bool is_valid(bool verbose = false) const; -/// @} +/// @} -/// \name Various +/// \name Various /// These member functions are required by /// `CGAL::Triangulation_data_structure_2` because it uses /// `CGAL::Compact_container` to store its faces. See the documentation of @@ -177,13 +177,13 @@ bool is_valid(bool verbose = false) const; /*! -*/ -void * for_compact_container() const; +*/ +void * for_compact_container() const; /*! -*/ -void * & for_compact_container(); +*/ +void * & for_compact_container(); /// @} diff --git a/TDS_2/doc/TDS_2/Concepts/TriangulationDSVertexBase_2.h b/TDS_2/doc/TDS_2/Concepts/TriangulationDSVertexBase_2.h index e7915a48888..a677dbb722c 100644 --- a/TDS_2/doc/TDS_2/Concepts/TriangulationDSVertexBase_2.h +++ b/TDS_2/doc/TDS_2/Concepts/TriangulationDSVertexBase_2.h @@ -5,49 +5,49 @@ \cgalRefines `TriangulationDataStructure_2::Vertex` -The concept `TriangulationDSVertexBase_2` describes the requirements for the +The concept `TriangulationDSVertexBase_2` describes the requirements for the vertex base class of a `CGAL::Triangulation_data_structure_2`. -Note that if the `CGAL::Triangulation_data_structure_2` -is plugged into a triangulation class, -the vertex base class may have additional geometric -requirements depending on the triangulation class. +Note that if the `CGAL::Triangulation_data_structure_2` +is plugged into a triangulation class, +the vertex base class may have additional geometric +requirements depending on the triangulation class. -At the base level, -provides access to one of its incident -faces through a `Face_handle`. +At the base level, +provides access to one of its incident +faces through a `Face_handle`. -Since the `CGAL::Triangulation_data_structure_2` is the class -which defines the handle -types, the vertex base class has to be somehow -parameterized by the triangulation -data structure. But since the `CGAL::Triangulation_data_structure_2` -itself is parameterized by the face and vertex -base classes, there is a cycle in the definition of these classes. -In order -to break the cycle, the base classes for faces and vertices -which are plugged in to instantiate a -`Triangulation_data_structure_2` -use `void` as triangulation -data structure parameter. Then, -the `CGAL::Triangulation_data_structure_2` -uses a rebind mechanism (similar to the one specified in -`std::allocator`) in order to plug itself -as parameter in the face and vertex base classes. -This mechanism requires that the base class provides -a templated nested class `Rebind_TDS` that -itself provides -the subtype `Rebind_TDS::Other` -which is the rebound version of the base class. -This rebound base class is the class -that the `CGAL::Triangulation_data_structure_2` -actually uses as a base class for the class -of `CGAL::Triangulation_data_structure_2::Vertex`. +Since the `CGAL::Triangulation_data_structure_2` is the class +which defines the handle +types, the vertex base class has to be somehow +parameterized by the triangulation +data structure. But since the `CGAL::Triangulation_data_structure_2` +itself is parameterized by the face and vertex +base classes, there is a cycle in the definition of these classes. +In order +to break the cycle, the base classes for faces and vertices +which are plugged in to instantiate a +`Triangulation_data_structure_2` +use `void` as triangulation +data structure parameter. Then, +the `CGAL::Triangulation_data_structure_2` +uses a rebind mechanism (similar to the one specified in +`std::allocator`) in order to plug itself +as parameter in the face and vertex base classes. +This mechanism requires that the base class provides +a templated nested class `Rebind_TDS` that +itself provides +the subtype `Rebind_TDS::Other` +which is the rebound version of the base class. +This rebound base class is the class +that the `CGAL::Triangulation_data_structure_2` +actually uses as a base class for the class +of `CGAL::Triangulation_data_structure_2::Vertex`. \cgalHasModel `CGAL::Triangulation_ds_vertex_base_2` -\sa `TriangulationDSFaceBase_2` -\sa `CGAL::Triangulation_data_structure_2` +\sa `TriangulationDSFaceBase_2` +\sa `CGAL::Triangulation_data_structure_2` */ @@ -55,55 +55,55 @@ class TriangulationDSVertexBase_2 { public: -/// \name Types +/// \name Types /// The concept `TriangulationDSVertexBase_2` has to provide the following types. /// @{ /*! -This template class has to define a type `Rebind_TDS::%Other` which is the -rebound vertex base , where the actual -`CGAL::Triangulation_data_structure_2` is plugged in. -This type `Other` will be the actual base -of the class `CGAL::Triangulation_data_structure_2::Vertex`. +This template class has to define a type `Rebind_TDS::%Other` which is the +rebound vertex base , where the actual +`CGAL::Triangulation_data_structure_2` is plugged in. +This type `Other` will be the actual base +of the class `CGAL::Triangulation_data_structure_2::Vertex`. \note It can be implemented using a nested template class. \sa Section \ref TDS_2TheRebindMechanism -*/ -template +*/ +template using Rebind_TDS = unspecified_type; /*! -*/ -typedef TriangulationDataStructure_2 Triangulation_data_structure; +*/ +typedef TriangulationDataStructure_2 Triangulation_data_structure; /*! -*/ -typedef TriangulationDataStructure_2::Vertex_handle Vertex_handle; +*/ +typedef TriangulationDataStructure_2::Vertex_handle Vertex_handle; /*! -*/ -typedef TriangulationDataStructure_2::Face_handle Face_handle; +*/ +typedef TriangulationDataStructure_2::Face_handle Face_handle; -/// @} +/// @} -/// \name Creation +/// \name Creation /// @{ /*! -default constructor. -*/ -TriangulationDSVertexBase_2(); +default constructor. +*/ +TriangulationDSVertexBase_2(); /*! -Constructs a vertex pointing to face `f`. -*/ -TriangulationDSVertexBase_2(Face_handle f); +Constructs a vertex pointing to face `f`. +*/ +TriangulationDSVertexBase_2(Face_handle f); -/// @} +/// @} -/// \name Various +/// \name Various /// These member functions are required by /// `CGAL::Triangulation_data_structure_2` because it uses /// `CGAL::Compact_container` to store its faces. See the documentation of @@ -112,13 +112,13 @@ TriangulationDSVertexBase_2(Face_handle f); /*! -*/ -void * for_compact_container() const; +*/ +void * for_compact_container() const; /*! -*/ -void * & for_compact_container(); +*/ +void * & for_compact_container(); /// @} diff --git a/TDS_2/doc/TDS_2/Concepts/TriangulationDataStructure_2.h b/TDS_2/doc/TDS_2/Concepts/TriangulationDataStructure_2.h index bcd40c0b975..613eea9a70d 100644 --- a/TDS_2/doc/TDS_2/Concepts/TriangulationDataStructure_2.h +++ b/TDS_2/doc/TDS_2/Concepts/TriangulationDataStructure_2.h @@ -3,71 +3,71 @@ \ingroup PkgTDS2Concepts \cgalConcept -The concept `TriangulationDataStructure_2` describes the requirements for -the second template parameter of the basic triangulation class -`Triangulation_2` and of all other 2D triangulation classes. +The concept `TriangulationDataStructure_2` describes the requirements for +the second template parameter of the basic triangulation class +`Triangulation_2` and of all other 2D triangulation classes. -The concept can be seen as a container for the -faces and vertices of the triangulation. -The concept `TriangulationDataStructure_2` includes two sub-concepts -`TriangulationDataStructure_2::Vertex` and -`TriangulationDataStructure_2::Face`. +The concept can be seen as a container for the +faces and vertices of the triangulation. +The concept `TriangulationDataStructure_2` includes two sub-concepts +`TriangulationDataStructure_2::Vertex` and +`TriangulationDataStructure_2::Face`. -The `TriangulationDataStructure_2` -maintains incidence and adjacency relations -among vertices and faces. +The `TriangulationDataStructure_2` +maintains incidence and adjacency relations +among vertices and faces. -Each triangular face gives access to its three incident vertices -and to its three adjacent faces. -Each vertex gives access to one of its incident faces -and through that face to the circular list of its incident faces. +Each triangular face gives access to its three incident vertices +and to its three adjacent faces. +Each vertex gives access to one of its incident faces +and through that face to the circular list of its incident faces. -The three vertices of a face are indexed with 0, 1, and 2. -The neighbors of a face are also -indexed with 0, 1, and 2 in such a way that the neighbor indexed by `i` -is opposite to the vertex with the same index. +The three vertices of a face are indexed with 0, 1, and 2. +The neighbors of a face are also +indexed with 0, 1, and 2 in such a way that the neighbor indexed by `i` +is opposite to the vertex with the same index. -Each edge has two implicit representations : the edge -of a face `f` which is opposed to the vertex indexed `i`, -can be represented as well as an edge of the `neighbor(i)` of +Each edge has two implicit representations : the edge +of a face `f` which is opposed to the vertex indexed `i`, +can be represented as well as an edge of the `neighbor(i)` of `f`. See \cgalFigureRef{TDS_2D_Fig_neighbors1}. -The triangulation data structure -is responsible for the combinatorial integrity of the triangulation. -This means that the triangulation data structure -allows to perform some combinatorial operations -on the triangulation and guarantees the maintenance on -proper incidence and adjacency relations among the vertices -and faces. The term combinatorial operations -means that those operations are purely topological -and do not depend on the geometric embedding. -Insertion of a new vertex in a given face, or in a given edge, -suppression of a vertex of degree three, flip of two edges -are examples of combinatorial operations. +The triangulation data structure +is responsible for the combinatorial integrity of the triangulation. +This means that the triangulation data structure +allows to perform some combinatorial operations +on the triangulation and guarantees the maintenance on +proper incidence and adjacency relations among the vertices +and faces. The term combinatorial operations +means that those operations are purely topological +and do not depend on the geometric embedding. +Insertion of a new vertex in a given face, or in a given edge, +suppression of a vertex of degree three, flip of two edges +are examples of combinatorial operations. \cgalHeading{I/O} -The information output in the `iostream` is: -the dimension, the number of (finite) vertices, -the number of (finite) faces. -Then comes -for each vertex, the non combinatorial information stored in that vertex -if any. -Then comes -for each faces, the indices of its vertices and -the non combinatorial information (if any) stored in this face. -Then comes -for each face again -the indices of the neighboring faces. -The index of an item (vertex of face) -the rank of this item in the output order. -When dimension \f$ <\f$ 2, the same information is output -for faces of maximal dimension instead of faces. +The information output in the `iostream` is: +the dimension, the number of (finite) vertices, +the number of (finite) faces. +Then comes +for each vertex, the non combinatorial information stored in that vertex +if any. +Then comes +for each faces, the indices of its vertices and +the non combinatorial information (if any) stored in this face. +Then comes +for each face again +the indices of the neighboring faces. +The index of an item (vertex of face) +the rank of this item in the output order. +When dimension \f$ <\f$ 2, the same information is output +for faces of maximal dimension instead of faces. -\cgalHasModel `CGAL::Triangulation_data_structure_2` +\cgalHasModel `CGAL::Triangulation_data_structure_2` -\sa `TriangulationDataStructure_2::Face` -\sa `TriangulationDataStructure_2::Vertex` +\sa `TriangulationDataStructure_2::Face` +\sa `TriangulationDataStructure_2::Vertex` \sa `CGAL::Triangulation_2` */ @@ -75,69 +75,69 @@ for faces of maximal dimension instead of faces. class TriangulationDataStructure_2 { public: -/// \name Types +/// \name Types /// @{ /*! -Size type (unsigned integral type) -*/ -typedef unspecified_type size_type; +Size type (unsigned integral type) +*/ +typedef unspecified_type size_type; /*! -Difference type (signed integral type) -*/ -typedef unspecified_type difference_type; +Difference type (signed integral type) +*/ +typedef unspecified_type difference_type; /*! The vertex type, requirements for this type are described in concept `TriangulationDataStructure_2::Vertex`. -*/ +*/ typedef unspecified_type Vertex; /*! The face type, requirements for this type are described in concept `TriangulationDataStructure_2::Face`. -*/ +*/ typedef unspecified_type Face; /*! Handle to a vertex. \cgalModels `Handle` -*/ -typedef unspecified_type Vertex_handle; +*/ +typedef unspecified_type Vertex_handle; /*! -Handle to a face. +Handle to a face. \cgalModels `Handle` -*/ -typedef unspecified_type Face_handle; +*/ +typedef unspecified_type Face_handle; /*! -The edge type. -The `Edge(f,i)` is edge common to faces `f` and -`f.neighbor(i)`. It is also the edge joining the vertices -`vertex(cw(i))` and `vertex(ccw(i))` of `f`. -*/ -typedef std::pair Edge; +The edge type. +The `Edge(f,i)` is edge common to faces `f` and +`f.neighbor(i)`. It is also the edge joining the vertices +`vertex(cw(i))` and `vertex(ccw(i))` of `f`. +*/ +typedef std::pair Edge; /// @} /// \name Iterators and Circulators /// /// The iterators allow one to visit all the vertices, edges -/// and faces of a triangulation data structure. +/// and faces of a triangulation data structure. /// /// The circulators /// allow to visit all the edges or faces incident to a given vertex -/// and all the vertices adjacent to a given vertex. +/// and all the vertices adjacent to a given vertex. /// /// The iterators and circulators are bidirectional and non mutable, and they are /// convertible to the corresponding handles, thus they can be passed /// directly as argument to the functions expecting a handle. /// -/// A face circulator is invalidated by any modification of the face it -/// points to. An edge circulator is invalidated by any modification of -/// any of the two faces incident to the edge pointed to. A vertex -/// circulator that turns around vertex `v` and that has as value a handle -/// to vertex `w`, is invalidated by any modification of anyone of the two +/// A face circulator is invalidated by any modification of the face it +/// points to. An edge circulator is invalidated by any modification of +/// any of the two faces incident to the edge pointed to. A vertex +/// circulator that turns around vertex `v` and that has as value a handle +/// to vertex `w`, is invalidated by any modification of anyone of the two /// faces incident to `v` and `w`. /// @{ @@ -145,69 +145,69 @@ typedef std::pair Edge; /*! -*/ -typedef unspecified_type Face_iterator; +*/ +typedef unspecified_type Face_iterator; /*! -*/ -typedef unspecified_type Edge_iterator; +*/ +typedef unspecified_type Edge_iterator; /*! -*/ -typedef unspecified_type Vertex_iterator; +*/ +typedef unspecified_type Vertex_iterator; /*! -*/ -typedef unspecified_type Face_circulator; +*/ +typedef unspecified_type Face_circulator; /*! -*/ -typedef unspecified_type Edge_circulator; +*/ +typedef unspecified_type Edge_circulator; /*! -*/ -typedef unspecified_type Vertex_circulator; +*/ +typedef unspecified_type Vertex_circulator; -/// @} +/// @} -/// \name Creation +/// \name Creation /// @{ /*! -Default constructor. -*/ -TriangulationDataStructure_2(); +Default constructor. +*/ +TriangulationDataStructure_2(); /*! -Copy constructor, performing a deep copy, that is all vertices and faces are duplicated. -*/ -TriangulationDataStructure_2( const -TriangulationDataStructure_2& tds1); +Copy constructor, performing a deep copy, that is all vertices and faces are duplicated. +*/ +TriangulationDataStructure_2( const +TriangulationDataStructure_2& tds1); /*! -Assignment. All the vertices and faces of `tds1` are duplicated -in the triangulation data structure. Former faces and vertices of -the triangulation data structure , if any, are +Assignment. All the vertices and faces of `tds1` are duplicated +in the triangulation data structure. Former faces and vertices of +the triangulation data structure , if any, are deleted. -*/ -TriangulationDataStructure_2& operator=( const -TriangulationDataStructure_2& tds1); +*/ +TriangulationDataStructure_2& operator=( const +TriangulationDataStructure_2& tds1); /*! -`tds1` is copied into the triangulation data structure. +`tds1` is copied into the triangulation data structure. If `v != Vertex_handle()`, the vertex of the triangulation data structure -corresponding to `v` is returned, otherwise `Vertex_handle()` -is returned. -\pre The optional argument `v` is a vertex of `tds1`. -*/ -Vertex_handle -copy_tds(const TriangulationDataStructure_2 & tds1, -Vertex_handle v = Vertex_handle()); +corresponding to `v` is returned, otherwise `Vertex_handle()` +is returned. +\pre The optional argument `v` is a vertex of `tds1`. +*/ +Vertex_handle +copy_tds(const TriangulationDataStructure_2 & tds1, +Vertex_handle v = Vertex_handle()); /*! `tds_src` is copied into `this`. As the vertex and face types might be different @@ -221,7 +221,7 @@ otherwise `Vertex_handle()` is returned. - A model of `ConvertVertex` must provide two operator()'s that are responsible for converting the source vertex `v_src` into the target vertex: - `Vertex operator()(const TDS_src::Vertex& v_src);` This operator is used to create the vertex from `v_src`. - - `void operator()(const TDS_src::Vertex& v_src, Vertex& v_tgt);` This operator is meant to be used in case heavy data should transferred to `v_tgt`. + - `void operator()(const TDS_src::Vertex& v_src, Vertex& v_tgt);` This operator is meant to be used in case heavy data should transferred to `v_tgt`. - A model of ConvertFace must provide two operator()'s that are responsible for converting the source face `f_src` into the target face: - `Face operator()(const TDS_src::Face& f_src);` This operator is used to create the face from `f_src`. - `void operator()(const TDS_src::Face& f_src, Face& f_tgt);` This operator is meant to be used in case heavy data should transferred to `f_tgt`. @@ -232,299 +232,299 @@ template Vertex_handle tds.copy_tds(const TDS_src& tds_src, typename TDS_src::Vertex_handle v, const ConvertVertex& convert_vertex, const ConvertFace& convert_face); /*! -Swaps the triangulation data structure and `tds1`. +Swaps the triangulation data structure and `tds1`. Should be preferred to an assignment or copy constructor -when `tds1` is deleted after that. -*/ -void swap( TriangulationDataStructure_2 & tds1); +when `tds1` is deleted after that. +*/ +void swap( TriangulationDataStructure_2 & tds1); /*! -Deletes all faces and all finite vertices. -*/ -void clear(); +Deletes all faces and all finite vertices. +*/ +void clear(); -/// @} +/// @} -/// \name Access Functions +/// \name Access Functions /// @{ /*! \cgalAdvancedFunction \cgalAdvancedBegin - returns the dimension of the triangulation data structure. + returns the dimension of the triangulation data structure. \cgalAdvancedEnd -*/ -int dimension() const; +*/ +int dimension() const; /*! -returns the number of vertices in the triangulation data structure. -*/ -size_type number_of_vertices() const; +returns the number of vertices in the triangulation data structure. +*/ +size_type number_of_vertices() const; /*! -returns the number of two dimensional faces in the triangulation data structure. -*/ -size_type number_of_faces() const ; +returns the number of two dimensional faces in the triangulation data structure. +*/ +size_type number_of_faces() const ; /*! -returns the number of edges in the triangulation data structure. -*/ -size_type number_of_edges() const; +returns the number of edges in the triangulation data structure. +*/ +size_type number_of_edges() const; /*! -returns the number of full dimensional faces, -i.e.\ faces of dimension equal to the dimension -of the triangulation data structure. This is the actual -number of faces stored in the triangulation data structure. -*/ -size_type number_of_full_dim_faces() const; +returns the number of full dimensional faces, +i.e.\ faces of dimension equal to the dimension +of the triangulation data structure. This is the actual +number of faces stored in the triangulation data structure. +*/ +size_type number_of_full_dim_faces() const; -/// @} +/// @} -/// \name Setting +/// \name Setting /// @{ /*! -sets the dimension. -*/ -void set_dimension (int n); +sets the dimension. +*/ +void set_dimension (int n); -/// @} +/// @} -/// \name Queries +/// \name Queries /// @{ /*! -returns `true` if -`v` is a vertex of the triangulation data structure. -*/ -bool is_vertex(Vertex_handle v) const; +returns `true` if +`v` is a vertex of the triangulation data structure. +*/ +bool is_vertex(Vertex_handle v) const; /*! -returns `true` if `(fh,i)` is an edge of the triangulation data structure. -Returns `false` when `dimension() < 1`. -*/ -bool is_edge(Face_handle fh, int i) const; +returns `true` if `(fh,i)` is an edge of the triangulation data structure. +Returns `false` when `dimension() < 1`. +*/ +bool is_edge(Face_handle fh, int i) const; /*! -returns `true` if -`(va, vb)` is an edge of the triangulation data structure. -*/ -bool is_edge(Vertex_handle va, Vertex_handle vb) const; +returns `true` if +`(va, vb)` is an edge of the triangulation data structure. +*/ +bool is_edge(Vertex_handle va, Vertex_handle vb) const; /*! -returns `true` if -`(va, vb)` is an edge of the triangulation data structure. -In addition, if true is returned -`fr` and `i` are set such that the pair `(fr,i)` -is the description -of the ordered edge `(va, vb)`. -*/ -bool is_edge(Vertex_handle va, Vertex_handle vb, Face_handle &fr, -int &i) const; +returns `true` if +`(va, vb)` is an edge of the triangulation data structure. +In addition, if true is returned +`fr` and `i` are set such that the pair `(fr,i)` +is the description +of the ordered edge `(va, vb)`. +*/ +bool is_edge(Vertex_handle va, Vertex_handle vb, Face_handle &fr, +int &i) const; /*! -returns `true` if `fh` is a face of the triangulation data structure. -Returns `false` when `dimension() < 2`. -*/ -bool is_face(Face_handle fh) const; +returns `true` if `fh` is a face of the triangulation data structure. +Returns `false` when `dimension() < 2`. +*/ +bool is_face(Face_handle fh) const; /*! -`true` if there is a face having `v1`, `v2`, and `v3` -as vertices. -*/ -bool is_face(Vertex_handle v1, Vertex_handle v2, -Vertex_handle v3) -const; +`true` if there is a face having `v1`, `v2`, and `v3` +as vertices. +*/ +bool is_face(Vertex_handle v1, Vertex_handle v2, +Vertex_handle v3) +const; /*! -`true` if there is a face having `v1`, `v2`, and `v3` -as vertices. - In addition, if `true` is returned, `fr` is a handle -to the face with `v1`, `v2` and `v3` -as vertices. -*/ -bool is_face(Vertex_handle v1, Vertex_handle v2, Vertex_handle v3, -Face_handle &fr) const; +`true` if there is a face having `v1`, `v2`, and `v3` +as vertices. + In addition, if `true` is returned, `fr` is a handle +to the face with `v1`, `v2` and `v3` +as vertices. +*/ +bool is_face(Vertex_handle v1, Vertex_handle v2, Vertex_handle v3, +Face_handle &fr) const; -/// @} +/// @} -/// \name Traversing the Triangulation +/// \name Traversing the Triangulation /// @{ /*! visits all faces. -*/ -Face_iterator faces_begin() const; +*/ +Face_iterator faces_begin() const; /*! -*/ -Face_iterator faces_end() const; +*/ +Face_iterator faces_end() const; /*! visits all vertices. -*/ -Vertex_iterator vertices_begin() const; +*/ +Vertex_iterator vertices_begin() const; /*! -*/ -Vertex_iterator vertices_end() const; +*/ +Vertex_iterator vertices_end() const; /*! visits all edges. -*/ -Edge_iterator edges_begin() const; +*/ +Edge_iterator edges_begin() const; /*! -*/ -Edge_iterator edges_end() const; +*/ +Edge_iterator edges_end() const; /*! -\pre If the face `f` is given, it has to be incident to be a face incident to `v` and the circulator begins with the vertex `f->vertex(ccw(i))` if `i` is the index of `v` in `f`. -*/ -Vertex_circulator -incident_vertices(Vertex_handle v, Face_handle f=Face_handle()) -const; +\pre If the face `f` is given, it has to be incident to be a face incident to `v` and the circulator begins with the vertex `f->vertex(ccw(i))` if `i` is the index of `v` in `f`. +*/ +Vertex_circulator +incident_vertices(Vertex_handle v, Face_handle f=Face_handle()) +const; /*! -\pre If the face `f` is given, it has to be a face of incident to `v` and the circulator begins with the edge `(f,cw(i))` of `f` if `i` is the index of `v` in `f`. -*/ -Edge_circulator -incident_edges(Vertex_handle v, Face_handle f=Face_handle()) const; +\pre If the face `f` is given, it has to be a face of incident to `v` and the circulator begins with the edge `(f,cw(i))` of `f` if `i` is the index of `v` in `f`. +*/ +Edge_circulator +incident_edges(Vertex_handle v, Face_handle f=Face_handle()) const; /*! -\pre If the face `f` is given, it has to be a face of incident to `v` and the circulator begins with the face `f`. -*/ -Face_circulator -incident_faces(Vertex_handle v, Face_handle f=Face_handle()) const; +\pre If the face `f` is given, it has to be a face of incident to `v` and the circulator begins with the face `f`. +*/ +Face_circulator +incident_faces(Vertex_handle v, Face_handle f=Face_handle()) const; /*! -returns vertex of `f->neighbor(i)`. -*/ -Vertex_handle mirror_vertex(Face_handle f, int i) const; +returns vertex of `f->neighbor(i)`. +*/ +Vertex_handle mirror_vertex(Face_handle f, int i) const; /*! -returns the index of `f` as a neighbor of `f->neighbor(i)`. -*/ -int mirror_index(Face_handle f, int i) const; +returns the index of `f` as a neighbor of `f->neighbor(i)`. +*/ +int mirror_index(Face_handle f, int i) const; /*! -returns the same edge seen from the other adjacent face. -*/ -Edge mirror_edge(Edge e) const; +returns the same edge seen from the other adjacent face. +*/ +Edge mirror_edge(Edge e) const; -/// @} +/// @} -/// \name Modifiers +/// \name Modifiers /// @{ /*! -exchanges the edge incident to -`f` and `f->neighbor(i)` with the other -diagonal of the quadrilateral formed by `f` and `f->neighbor(i)`. +exchanges the edge incident to +`f` and `f->neighbor(i)` with the other +diagonal of the quadrilateral formed by `f` and `f->neighbor(i)`. \image html Flip.png "Flip" \image latex Flip.png "Flip" -*/ -void flip(Face_handle f, int i); +*/ +void flip(Face_handle f, int i); /*! -creates the first -vertex and returns a handle to it. -*/ -Vertex_handle insert_first(); +creates the first +vertex and returns a handle to it. +*/ +Vertex_handle insert_first(); /*! -creates the second -vertex and returns a handle to it. -*/ -Vertex_handle insert_second(); +creates the second +vertex and returns a handle to it. +*/ +Vertex_handle insert_second(); /*! -adds a -vertex `v` splitting -edge `i` of face `f`. Return a handle to `v`. -*/ -Vertex_handle insert_in_edge(Face_handle f, int i); +adds a +vertex `v` splitting +edge `i` of face `f`. Return a handle to `v`. +*/ +Vertex_handle insert_in_edge(Face_handle f, int i); /*! -adds a vertex -`v` splitting face -`f` in three. %Face `f` is modified, -two new faces are created. Return a handle to `v` -*/ -Vertex_handle insert_in_face(Face_handle f); +adds a vertex +`v` splitting face +`f` in three. %Face `f` is modified, +two new faces are created. Return a handle to `v` +*/ +Vertex_handle insert_in_face(Face_handle f); /*! -adds -a vertex `v`, increasing by one the dimension of the triangulation data structure. -%Vertex `v` and the existing vertex `w` are linked to all -the vertices of the triangulation data structure. -The Boolean `orient` decides the final orientation of all -faces. A handle to vertex `v` is returned. +adds +a vertex `v`, increasing by one the dimension of the triangulation data structure. +%Vertex `v` and the existing vertex `w` are linked to all +the vertices of the triangulation data structure. +The Boolean `orient` decides the final orientation of all +faces. A handle to vertex `v` is returned. -*/ -Vertex_handle insert_dim_up(Vertex_handle w, bool -orient=true); +*/ +Vertex_handle insert_dim_up(Vertex_handle w, bool +orient=true); /*! -removes a vertex of degree 3. Two of the incident faces are destroyed, -the third one is modified. -If parameter `f` is specified, it has to be a face incident to `v` -and will be the modified face. -\pre %Vertex `v` is a finite vertex with degree 3 and, if specified, face `f` is incident to `v`. +removes a vertex of degree 3. Two of the incident faces are destroyed, +the third one is modified. +If parameter `f` is specified, it has to be a face incident to `v` +and will be the modified face. +\pre %Vertex `v` is a finite vertex with degree 3 and, if specified, face `f` is incident to `v`. \image html Three.png "Insertion" \image latex Three.png "Insertion" -*/ -void remove_degree_3(Vertex_handle v, Face_handle f = Face_handle()); +*/ +void remove_degree_3(Vertex_handle v, Face_handle f = Face_handle()); /*! -removes the before last -vertex. -*/ -void remove_second(Vertex_handle v); +removes the before last +vertex. +*/ +void remove_second(Vertex_handle v); /*! -removes the last vertex. -*/ -void remove_first(Vertex_handle v); +removes the last vertex. +*/ +void remove_first(Vertex_handle v); /*! -removes vertex `v` incident to all other vertices -and decreases by one the dimension of the triangulation data structure. -\pre If the dimension is 2, the number of vertices is more than 3, if the dimension is 1, the number of vertices is 2. -*/ -void remove_dim_down(Vertex_handle v); +removes vertex `v` incident to all other vertices +and decreases by one the dimension of the triangulation data structure. +\pre If the dimension is 2, the number of vertices is more than 3, if the dimension is 1, the number of vertices is 2. +*/ +void remove_dim_down(Vertex_handle v); /*! must be called when the displacement of a vertex decreases the dimension of the triangulation data structure. -The link of a vertex `v` is formed by the edges disjoint from `v` -that are included in the faces incident to `v`. -When the link of `v = f->vertex(i)` contains all the other vertices -of the two-dimensional triangulation data structure (\f$ \mathbb{S}^2\f$), `dim_down()` crushes the two-dimensional -data-structure (\f$ \mathbb{S}^2\f$) onto the one-dimensional data structure (\f$ \mathbb{S}^1\f$) formed by the link of `v` +The link of a vertex `v` is formed by the edges disjoint from `v` +that are included in the faces incident to `v`. +When the link of `v = f->vertex(i)` contains all the other vertices +of the two-dimensional triangulation data structure (\f$ \mathbb{S}^2\f$), `dim_down()` crushes the two-dimensional +data-structure (\f$ \mathbb{S}^2\f$) onto the one-dimensional data structure (\f$ \mathbb{S}^1\f$) formed by the link of `v` augmented with the vertex `v` itself; this one is placed on the edge `(f, i)` -(see Figure \ref figtdsdim_down_2). -\pre `dimension()` must be equal to `2`, the degree of `f->vertex(i)` must be equal to the total number of vertices minus 1. +(see Figure \ref figtdsdim_down_2). +\pre `dimension()` must be equal to `2`, the degree of `f->vertex(i)` must be equal to the total number of vertices minus 1. \anchor figtdsdim_down_2 \image html tds-dim_down.png "From a two-dimensional data structure to a one-dimensional data structure." \image latex tds-dim_down.png "From a two-dimensional data structure to a one-dimensional data structure." */ -void dim_down(Face_handle f, int i); +void dim_down(Face_handle f, int i); -/// @} +/// @} -/// \name Advanced Modifiers -/// The following modifiers are required for convenience of the advanced user. +/// \name Advanced Modifiers +/// The following modifiers are required for convenience of the advanced user. /// They do not guarantee the combinatorial validity of the resulting triangulation data structure. /// @{ @@ -532,169 +532,169 @@ void dim_down(Face_handle f, int i); /*! creates a new vertex `v` and uses it to star a hole. - -Given a set of faces 'F' describing a simply connected hole (i.e., a topological disk), + +Given a set of faces 'F' describing a simply connected hole (i.e., a topological disk), the function deletes all the faces in `F`, creates a new vertex `v` and for each edge on -the boundary of the hole creates a new face with `v` as a vertex. The input is an iterator +the boundary of the hole creates a new face with `v` as a vertex. The input is an iterator range `[face_begin, face_end[` of `Face_handle`s over the connected faces in `F`. The handle to the new vertex `v` is returned. - + \pre `tds.dimension() = 2` and the set of faces has the topology of a disk. */ template< class FaceIt > -Vertex_handle insert_in_hole(FaceIt face_begin, FaceIt face_end); +Vertex_handle insert_in_hole(FaceIt face_begin, FaceIt face_end); /*! -same as above, except that `new_v` will be used as the new vertex, which must have been +same as above, except that `new_v` will be used as the new vertex, which must have been allocated previously, for example with `create_vertex`. */ template< class FaceIt > -void insert_in_hole(Vertex_handle new_v, FaceIt face_begin, FaceIt face_end); +void insert_in_hole(Vertex_handle new_v, FaceIt face_begin, FaceIt face_end); /*! -creates a new vertex `v` and use it to star the hole -whose boundary is described by the sequence of edges `[edge_begin, edge_end)`. Returns a handle to the vertex. -*/ -template< class EdgeIt> -Vertex_handle star_hole(EdgeIt edge_begin,EdgeIt edge_end); +creates a new vertex `v` and use it to star the hole +whose boundary is described by the sequence of edges `[edge_begin, edge_end)`. Returns a handle to the vertex. +*/ +template< class EdgeIt> +Vertex_handle star_hole(EdgeIt edge_begin,EdgeIt edge_end); /*! -same as above, except that, to build the new faces, the algorithm -first recycles faces in the sequence `[face_begin, face_end)` and create new ones when the sequence is exhausted. -*/ -template< class EdgeIt, class FaceIt> -Vertex_handle star_hole(EdgeIt edge_begin, -EdgeIt edge_end, -FaceIt face_begin, -FaceIt face_end); +same as above, except that, to build the new faces, the algorithm +first recycles faces in the sequence `[face_begin, face_end)` and create new ones when the sequence is exhausted. +*/ +template< class EdgeIt, class FaceIt> +Vertex_handle star_hole(EdgeIt edge_begin, +EdgeIt edge_end, +FaceIt face_begin, +FaceIt face_end); /*! -uses vertex v to star the hole -whose boundary is described by the sequence of edges `[edge_begin, edge_end)`. +uses vertex v to star the hole +whose boundary is described by the sequence of edges `[edge_begin, edge_end)`. -*/ -template< class EdgeIt> -void star_hole(Vertex_handle v, EdgeIt edge_begin, EdgeIt edge_end); +*/ +template< class EdgeIt> +void star_hole(Vertex_handle v, EdgeIt edge_begin, EdgeIt edge_end); /*! -same as above, recycling faces in the sequence `[face_begin, face_end)`. -*/ -template< class EdgeIt, class FaceIt> -void star_hole(Vertex_handle v, -EdgeIt edge_begin, -EdgeIt edge_end, -FaceIt face_begin, -FaceIt face_end); +same as above, recycling faces in the sequence `[face_begin, face_end)`. +*/ +template< class EdgeIt, class FaceIt> +void star_hole(Vertex_handle v, +EdgeIt edge_begin, +EdgeIt edge_end, +FaceIt face_begin, +FaceIt face_end); /*! -removes the vertex v, and store in `hole` the list of edges -on the boundary of the hole. -*/ -void make_hole(Vertex_handle v, List_edges& hole); +removes the vertex v, and store in `hole` the list of edges +on the boundary of the hole. +*/ +void make_hole(Vertex_handle v, List_edges& hole); /*! -adds a new vertex. -*/ -Vertex_handle create_vertex(); +adds a new vertex. +*/ +Vertex_handle create_vertex(); /*! -adds a face which is the neighbor `i1` of `f1`, -`i2` of `f2` and `i3` of `f3`. -*/ -Face_handle create_face(Face_handle f1, int i1, Face_handle f2, int i2, Face_handle -f3, int i3); +adds a face which is the neighbor `i1` of `f1`, +`i2` of `f2` and `i3` of `f3`. +*/ +Face_handle create_face(Face_handle f1, int i1, Face_handle f2, int i2, Face_handle +f3, int i3); /*! -adds a face which is the neighbor `i1` of `f1`, -and the neighbor `i2` of `f2`. -*/ -Face_handle create_face(Face_handle f1, int i1, Face_handle f2, int i2); +adds a face which is the neighbor `i1` of `f1`, +and the neighbor `i2` of `f2`. +*/ +Face_handle create_face(Face_handle f1, int i1, Face_handle f2, int i2); /*! -adds a face which is the neighbor `i1` of `f1`, -and has `v` as vertex. -*/ -Face_handle create_face(Face_handle f1, int i1, Vertex_handle v); +adds a face which is the neighbor `i1` of `f1`, +and has `v` as vertex. +*/ +Face_handle create_face(Face_handle f1, int i1, Vertex_handle v); /*! -adds a face with vertices `v1`, `v2` and `v3`. -*/ -Face_handle create_face(Vertex_handle v1, Vertex_handle v2, Vertex_handle v3); +adds a face with vertices `v1`, `v2` and `v3`. +*/ +Face_handle create_face(Vertex_handle v1, Vertex_handle v2, Vertex_handle v3); /*! -adds a face with vertices `v1`, `v2` and `v3`, -and neighbors `f1`, `f2`, `f3`. -*/ -Face_handle create_face(Vertex_handle v1, Vertex_handle v2, Vertex_handle v3, -Face_handle f1, Face_handle f2, Face_handle f3); +adds a face with vertices `v1`, `v2` and `v3`, +and neighbors `f1`, `f2`, `f3`. +*/ +Face_handle create_face(Vertex_handle v1, Vertex_handle v2, Vertex_handle v3, +Face_handle f1, Face_handle f2, Face_handle f3); /*! -adds a face whose vertices and neighbors are set to `Vertex_handle()` and `Face_handle()`. -*/ -Face_handle create_face(); +adds a face whose vertices and neighbors are set to `Vertex_handle()` and `Face_handle()`. +*/ +Face_handle create_face(); /*! -deletes a face. -*/ -void delete_face(Face_handle ); +deletes a face. +*/ +void delete_face(Face_handle ); /*! -deletes a vertex. -*/ -void delete_vertex(Vertex_handle ); +deletes a vertex. +*/ +void delete_vertex(Vertex_handle ); -/// @} +/// @} -/// \name Miscellaneous +/// \name Miscellaneous /// @{ /*! -returns \f$ i+1\f$ modulo 3, with\f$ 0\leq i \leq2\f$. -*/ -int ccw(int i) const; +returns \f$ i+1\f$ modulo 3, with\f$ 0\leq i \leq2\f$. +*/ +int ccw(int i) const; /*! -returns \f$ i+2\f$ modulo 3, with \f$ 0\leq i \leq2\f$. -*/ -int cw(int i) const; +returns \f$ i+2\f$ modulo 3, with \f$ 0\leq i \leq2\f$. +*/ +int cw(int i) const; /*! -checks the combinatorial validity of the -triangulation data structure: call the `is_valid()` member function for each vertex and -each face, checks the number of vertices and the Euler relation -between numbers of vertices, faces and edges. -*/ -bool is_valid(); +checks the combinatorial validity of the +triangulation data structure: call the `is_valid()` member function for each vertex and +each face, checks the number of vertices and the Euler relation +between numbers of vertices, faces and edges. +*/ +bool is_valid(); /*! -Returns the degree of `v` in the triangulation data structure. -*/ -size_type degree(Vertex_handle v) const; +Returns the degree of `v` in the triangulation data structure. +*/ +size_type degree(Vertex_handle v) const; /*! -writes the triangulation data structure into the stream `os`. -If `v` is not `Vertex_handle()`, vertex `v` -is output first or skipped if `skip_first` is true. -*/ -void file_output( ostream& os, Vertex_handle v = Vertex_handle(), bool skip_first=false); +writes the triangulation data structure into the stream `os`. +If `v` is not `Vertex_handle()`, vertex `v` +is output first or skipped if `skip_first` is true. +*/ +void file_output( ostream& os, Vertex_handle v = Vertex_handle(), bool skip_first=false); /*! -inputs the triangulation data structure from file and returns a handle to the first input vertex. -If `skip_first` is true, it is assumed that the first -vertex has been omitted when output. -*/ -Vertex_handle file_input( istream& is, bool skip_first=false); +inputs the triangulation data structure from file and returns a handle to the first input vertex. +If `skip_first` is true, it is assumed that the first +vertex has been omitted when output. +*/ +Vertex_handle file_input( istream& is, bool skip_first=false); /*! reads a combinatorial triangulation data structure from `is` and assigns it to tthe triangulation data structure. -*/ -istream& operator>> (istream& is, TriangulationDataStructure_3 & tds); +*/ +istream& operator>> (istream& is, TriangulationDataStructure_3 & tds); /*! writes `tds` into the stream `os`. -*/ -ostream& operator<< (ostream& os, const TriangulationDataStructure_3 & tds); +*/ +ostream& operator<< (ostream& os, const TriangulationDataStructure_3 & tds); /// @} @@ -706,102 +706,102 @@ ostream& operator<< (ostream& os, const TriangulationDataStructure_3 & tds); \ingroup PkgTDS2Concepts \cgalConcept -The concept `TriangulationDataStructure_2::Vertex` describes the type used by a -`TriangulationDataStructure_2` to store the vertices. +The concept `TriangulationDataStructure_2::Vertex` describes the type used by a +`TriangulationDataStructure_2` to store the vertices. -Some of the requirements listed below are of geometric nature -and are *optional* -when using the triangulation data structure class alone. -They became required when the triangulation data structure is plugged -into a triangulation. +Some of the requirements listed below are of geometric nature +and are *optional* +when using the triangulation data structure class alone. +They became required when the triangulation data structure is plugged +into a triangulation. \cgalHeading{Creation} -In order to obtain new vertices or destruct unused vertices, the user must -call the `create_vertex()` and `delete_vertex()` methods of the -triangulation data structure. +In order to obtain new vertices or destruct unused vertices, the user must +call the `create_vertex()` and `delete_vertex()` methods of the +triangulation data structure. -\cgalHasModel `CGAL::Triangulation_ds_vertex_base_2` +\cgalHasModel `CGAL::Triangulation_ds_vertex_base_2` \sa `TriangulationDSVertexBase_2` -\sa `TriangulationDataStructure_2::Face` +\sa `TriangulationDataStructure_2::Face` \sa `TriangulationDataStructure_2` */ class TriangulationDataStructure_2::Vertex { public: -/// \name Types +/// \name Types /// The class `TriangulationDataStructure_2::Vertex` defines the same /// types as the triangulation data structure except the iterators. /// @{ /*! -Optional for the triangulation data +Optional for the triangulation data structure used alone. -*/ -typedef unspecified_type Point; +*/ +typedef unspecified_type Point; -/// @} +/// @} -/// \name Access Functions +/// \name Access Functions /// @{ /*! -returns the geometric information of the vertex. -*/ -Point point() const; +returns the geometric information of the vertex. +*/ +Point point() const; /*! -returns a face of the triangulation having `*this` as a vertex. -*/ -Face_handle face() const; +returns a face of the triangulation having `*this` as a vertex. +*/ +Face_handle face() const; -/// @} +/// @} -/// \name Setting +/// \name Setting /// @{ /*! \cgalAdvancedFunction \cgalAdvancedBegin -sets the geometric information to `p`. +sets the geometric information to `p`. \cgalAdvancedEnd -*/ -void set_point(const Point& p); +*/ +void set_point(const Point& p); /*! \cgalAdvancedFunction \cgalAdvancedBegin -sets the incident face to `f`. +sets the incident face to `f`. \cgalAdvancedEnd -*/ -void set_face(Face_handle f); +*/ +void set_face(Face_handle f); -/// @} +/// @} -/// \name Checking +/// \name Checking /// @{ /*! -Checks the validity of the vertex. Must check that its incident face -has this vertex. The validity of the base vertex is also checked. +Checks the validity of the vertex. Must check that its incident face +has this vertex. The validity of the base vertex is also checked. -When `verbose` is set to `true`, messages are printed to give -a precise indication on the kind of invalidity encountered. -*/ -bool is_valid(bool verbose = false) const; +When `verbose` is set to `true`, messages are printed to give +a precise indication on the kind of invalidity encountered. +*/ +bool is_valid(bool verbose = false) const; /*! -Inputs the non-combinatorial information possibly stored in the vertex. -*/ - std::istream& operator>> (std::istream& is, TriangulationDataStructure_2::Vertex & v); +Inputs the non-combinatorial information possibly stored in the vertex. +*/ + std::istream& operator>> (std::istream& is, TriangulationDataStructure_2::Vertex & v); /*! -Outputs the non combinatorial operation possibly stored in the -vertex. -*/ - std::ostream& operator<< (std::ostream& os, const TriangulationDataStructure_2::Vertex & v); +Outputs the non combinatorial operation possibly stored in the +vertex. +*/ + std::ostream& operator<< (std::ostream& os, const TriangulationDataStructure_2::Vertex & v); /// @} @@ -812,35 +812,35 @@ vertex. \ingroup PkgTDS2Concepts \cgalConcept -The concept `TriangulationDataStructure_2::Face` describes the types used to store the faces -face class of a -`TriangulationDataStructure_2`. -A `TriangulationDataStructure_2::Face` stores three handles to its three vertices -and three handles to its three neighbors. -The vertices are indexed 0,1, and 2 in counterclockwise order. -The neighbor indexed `i` lies -opposite to vertex `i`. +The concept `TriangulationDataStructure_2::Face` describes the types used to store the faces +face class of a +`TriangulationDataStructure_2`. +A `TriangulationDataStructure_2::Face` stores three handles to its three vertices +and three handles to its three neighbors. +The vertices are indexed 0,1, and 2 in counterclockwise order. +The neighbor indexed `i` lies +opposite to vertex `i`. -In degenerate cases, -when the triangulation data structure stores a -simplicial complex of dimension `0` and `1`, -the type `TriangulationDataStructure_2::Face` is used to store the faces -of maximal dimension of the complex, i.e., a vertex in dimension `0`, an edge in dimension `1`. -Only vertices and neighbors with index `0` are set in the first case, -only vertices and neighbors with index `0` or `1` are set in the second case. +In degenerate cases, +when the triangulation data structure stores a +simplicial complex of dimension `0` and `1`, +the type `TriangulationDataStructure_2::Face` is used to store the faces +of maximal dimension of the complex, i.e., a vertex in dimension `0`, an edge in dimension `1`. +Only vertices and neighbors with index `0` are set in the first case, +only vertices and neighbors with index `0` or `1` are set in the second case. \cgalHeading{Types} -The class `TriangulationDataStructure_2::Face` defines the same types as -the triangulation data structure -except the iterators and the circulators. +The class `TriangulationDataStructure_2::Face` defines the same types as +the triangulation data structure +except the iterators and the circulators. \cgalHeading{Creation} -The methods `create_face()` and -`delete_face()` -have to be used to -define new faces and to delete no longer used faces. +The methods `create_face()` and +`delete_face()` +have to be used to +define new faces and to delete no longer used faces. \cgalHasModel `CGAL::Triangulation_ds_face_base_2` @@ -852,142 +852,142 @@ define new faces and to delete no longer used faces. class TriangulationDataStructure_2::Face { public: -/// \name Vertex Access Functions +/// \name Vertex Access Functions /// @{ /*! -returns the vertex `i` of the face. -\pre \f$ 0\leq i \leq2\f$. -*/ -Vertex_handle vertex(int i) const; +returns the vertex `i` of the face. +\pre \f$ 0\leq i \leq2\f$. +*/ +Vertex_handle vertex(int i) const; /*! -returns the index of vertex `v` in the face. \pre `v` is a vertex of the face. -*/ -int index(Vertex_handle v) const; +returns the index of vertex `v` in the face. \pre `v` is a vertex of the face. +*/ +int index(Vertex_handle v) const; /*! -returns `true` if `v` is a vertex of the face. -*/ -bool has_vertex(Vertex_handle v) const; +returns `true` if `v` is a vertex of the face. +*/ +bool has_vertex(Vertex_handle v) const; /*! -returns `true` if `v` is a vertex of the face, and -computes the index `i` of `v` in the face. -*/ -bool has_vertex(Vertex_handle v, int& i) const; +returns `true` if `v` is a vertex of the face, and +computes the index `i` of `v` in the face. +*/ +bool has_vertex(Vertex_handle v, int& i) const; -/// @} +/// @} -/// \name Neighbor Access Functions +/// \name Neighbor Access Functions /// The neighbor with index `i` is the neighbor which is opposite to /// the vertex with index `i`. /// @{ /*! -returns the neighbor `i` of the face. -\pre \f$ 0\leq i \leq2\f$. +returns the neighbor `i` of the face. +\pre \f$ 0\leq i \leq2\f$. -*/ -Face_handle neighbor(int i) const; +*/ +Face_handle neighbor(int i) const; /*! -returns the index of face `n`. -\pre `n` is a neighbor of the face. -*/ -int index(Face_handle n) const; +returns the index of face `n`. +\pre `n` is a neighbor of the face. +*/ +int index(Face_handle n) const; /*! -returns `true` if `n` is a neighbor of the face. -*/ -bool has_neighbor(Face_handle n) const; +returns `true` if `n` is a neighbor of the face. +*/ +bool has_neighbor(Face_handle n) const; /*! -returns `true` if `n` is a neighbor of the face, and -compute the index `i` of `n`. -*/ -bool has_neighbor(Face_handle n, int& i) const; +returns `true` if `n` is a neighbor of the face, and +compute the index `i` of `n`. +*/ +bool has_neighbor(Face_handle n, int& i) const; -/// @} +/// @} -/// \name Setting +/// \name Setting /// @{ /*! -sets vertex `i` to be `v`. -\pre \f$ 0\leq i \leq2\f$. +sets vertex `i` to be `v`. +\pre \f$ 0\leq i \leq2\f$. -*/ -void set_vertex(int i, Vertex_handle v); +*/ +void set_vertex(int i, Vertex_handle v); /*! -sets neighbor `i` to be `n`. -\pre \f$ 0\leq i \leq2\f$. +sets neighbor `i` to be `n`. +\pre \f$ 0\leq i \leq2\f$. -*/ -void set_neighbor(int i, Face_handle n); +*/ +void set_neighbor(int i, Face_handle n); /*! -sets the vertex handles to `Vertex_handle()`. -*/ -void set_vertices(); +sets the vertex handles to `Vertex_handle()`. +*/ +void set_vertices(); /*! -sets the vertex handles. -*/ -void set_vertices(Vertex_handle v0, Vertex_handle v1, Vertex_handle v2); +sets the vertex handles. +*/ +void set_vertices(Vertex_handle v0, Vertex_handle v1, Vertex_handle v2); /*! -sets the neighbors handles to `Face_handle()`. -*/ +sets the neighbors handles to `Face_handle()`. +*/ void set_neighbors(); /*! -sets the neighbors handles. -*/ -void set_neighbors(Face_handle n0, -Face_handle n1, -Face_handle n2); +sets the neighbors handles. +*/ +void set_neighbors(Face_handle n0, +Face_handle n1, +Face_handle n2); -/// @} +/// @} -/// \name Checking +/// \name Checking /// @{ /*! -returns `true` if the function -`is_valid()` of the base class -returns `true` and if, for each index \f$ i\f$, \f$ 0 \le i < 3\f$, -the face is a neighbor of its neighboring face `neighbor(i)` -and shares with this neighbor the vertices `cw(i)` and `ccw(i)` -in correct reverse order. -*/ -bool is_valid() const; +returns `true` if the function +`is_valid()` of the base class +returns `true` and if, for each index \f$ i\f$, \f$ 0 \le i < 3\f$, +the face is a neighbor of its neighboring face `neighbor(i)` +and shares with this neighbor the vertices `cw(i)` and `ccw(i)` +in correct reverse order. +*/ +bool is_valid() const; -/// @} +/// @} -/// \name Miscellaneous +/// \name Miscellaneous /// @{ /*! -Returns \f$ i+1\f$ modulo 3, with \f$ 0\leq i \leq2\f$. -*/ -int ccw(int i) const; +Returns \f$ i+1\f$ modulo 3, with \f$ 0\leq i \leq2\f$. +*/ +int ccw(int i) const; /*! -Returns \f$ i+2\f$ modulo 3, with \f$ 0\leq i \leq2\f$. -*/ -int cw(int i) const; +Returns \f$ i+2\f$ modulo 3, with \f$ 0\leq i \leq2\f$. +*/ +int cw(int i) const; /*! -Inputs any non combinatorial information possibly stored in the face. -*/ -std::istream& operator>> (std::istream& is, TriangulationDataStructure_2::Face & f); +Inputs any non combinatorial information possibly stored in the face. +*/ +std::istream& operator>> (std::istream& is, TriangulationDataStructure_2::Face & f); /*! -Outputs any non combinatorial information possibly stored in the face. -*/ -std::ostream& operator<< (std::ostream& os, const TriangulationDataStructure_2::Face & f); +Outputs any non combinatorial information possibly stored in the face. +*/ +std::ostream& operator<< (std::ostream& os, const TriangulationDataStructure_2::Face & f); /// @} diff --git a/TDS_3/doc/TDS_3/CGAL/Triangulation_data_structure_3.h b/TDS_3/doc/TDS_3/CGAL/Triangulation_data_structure_3.h index 22fc2c4d296..b3c8ab7da78 100644 --- a/TDS_3/doc/TDS_3/CGAL/Triangulation_data_structure_3.h +++ b/TDS_3/doc/TDS_3/CGAL/Triangulation_data_structure_3.h @@ -4,25 +4,25 @@ namespace CGAL { /*! \ingroup PkgTDS3Classes -The class `Triangulation_data_structure_3` stores a 3D-triangulation data -structure and provides the optional -geometric functionalities to be used as a parameter for a -3D-geometric triangulation (see Chapter \ref chapterTriangulation3 "3D Triangulations"). +The class `Triangulation_data_structure_3` stores a 3D-triangulation data +structure and provides the optional +geometric functionalities to be used as a parameter for a +3D-geometric triangulation (see Chapter \ref chapterTriangulation3 "3D Triangulations"). -The vertices and cells are stored in two nested containers, which are +The vertices and cells are stored in two nested containers, which are implemented using `Compact_container` (or `Concurrent_compact_container`, -see below). The class may offer some -flexibility for the choice of container in the future, in the form of -additional template parameters. +see below). The class may offer some +flexibility for the choice of container in the future, in the form of +additional template parameters. \tparam VertexBase must be a model of `TriangulationDSVertexBase_3`. The default is `Triangulation_ds_vertex_base_3`. \tparam CellBase must be a model of `TriangulationDSCellBase_3`. The default is `Triangulation_ds_cell_base_3`. \tparam ConcurrencyTag enables the use of a concurrent -container to store vertices and cells. It can be `Sequential_tag` (use of a +container to store vertices and cells. It can be `Sequential_tag` (use of a `Compact_container` to store vertices and cells) or `Parallel_tag` -(use of a `Concurrent_compact_container`). If it is +(use of a `Concurrent_compact_container`). If it is `Parallel_tag`, the following functions can be called concurrently: `create_vertex()`, `create_cell()`, `delete_vertex()`, and `delete_cell()`. `Sequential_tag` is the default value. @@ -32,10 +32,10 @@ container to store vertices and cells. It can be `Sequential_tag` (use of a The base class `Triangulation_utils_3` defines basic computations on indices of vertices and neighbors of cells. -\sa `CGAL::Triangulation_ds_vertex_base_3` -\sa `CGAL::Triangulation_ds_cell_base_3` +\sa `CGAL::Triangulation_ds_vertex_base_3` +\sa `CGAL::Triangulation_ds_cell_base_3` */ -template< typename VertexBase, +template< typename VertexBase, typename CellBase, typename ConcurrencyTag > class Triangulation_data_structure_3 @@ -43,7 +43,7 @@ class Triangulation_data_structure_3 { public: -/// \name Types +/// \name Types /// @{ typedef Triangulation_data_structure_2 Tds; @@ -61,17 +61,17 @@ typedef typename CellBase::template Rebind_TDS::Other Cell; /*! Vertex container type. If `ConcurrencyTag` is `Parallel_tag`, a `Concurrent_compact_container` is used instead of a `Compact_container`. -*/ -typedef Compact_container Vertex_range; +*/ +typedef Compact_container Vertex_range; /*! Cell container type. If `ConcurrencyTag` is `Parallel_tag`, a `Concurrent_compact_container` is used instead of a `Compact_container`. -*/ -typedef Compact_container Cell_range; -/// @} +*/ +typedef Compact_container Cell_range; +/// @} -/// \name Operations +/// \name Operations /// /// In addition to the interface documented in the concept, /// the class offers the following functions. @@ -79,24 +79,24 @@ typedef Compact_container Cell_range; /// @{ /*! -Returns a reference to the container of cells. -*/ -Cell_range & cells() const; +Returns a reference to the container of cells. +*/ +Cell_range & cells() const; /*! -Returns a reference to the container of cells. -*/ -Cell_range & cells(); +Returns a reference to the container of cells. +*/ +Cell_range & cells(); /*! -Returns a reference to the container of vertices. -*/ -Vertex_range & vertices() const; +Returns a reference to the container of vertices. +*/ +Vertex_range & vertices() const; /*! -Returns a reference to the container of vertices. -*/ -Vertex_range & vertices(); +Returns a reference to the container of vertices. +*/ +Vertex_range & vertices(); /// @} diff --git a/TDS_3/doc/TDS_3/CGAL/Triangulation_ds_cell_base_3.h b/TDS_3/doc/TDS_3/CGAL/Triangulation_ds_cell_base_3.h index 90f86670ea8..c03c936a2cf 100644 --- a/TDS_3/doc/TDS_3/CGAL/Triangulation_ds_cell_base_3.h +++ b/TDS_3/doc/TDS_3/CGAL/Triangulation_ds_cell_base_3.h @@ -5,15 +5,15 @@ namespace CGAL { \ingroup PkgTDS3Classes The class `Triangulation_ds_cell_base_3<>` is a model for the concept -`TriangulationDSCellBase_3` to be used by -`Triangulation_data_structure_3`. +`TriangulationDSCellBase_3` to be used by +`Triangulation_data_structure_3`. \cgalModels `TriangulationDSCellBase_3` \tparam TDS should not be specified (see Section \ref tds3cyclic and examples) -\sa `CGAL::Triangulation_cell_base_3` -\sa `CGAL::Triangulation_ds_vertex_base_3` +\sa `CGAL::Triangulation_cell_base_3` +\sa `CGAL::Triangulation_ds_vertex_base_3` */ template< typename TDS = void > diff --git a/TDS_3/doc/TDS_3/CGAL/Triangulation_ds_vertex_base_3.h b/TDS_3/doc/TDS_3/CGAL/Triangulation_ds_vertex_base_3.h index c54caf3952a..26ad462db9d 100644 --- a/TDS_3/doc/TDS_3/CGAL/Triangulation_ds_vertex_base_3.h +++ b/TDS_3/doc/TDS_3/CGAL/Triangulation_ds_vertex_base_3.h @@ -4,26 +4,26 @@ namespace CGAL { /*! \ingroup PkgTDS3Classes -The class `Triangulation_ds_vertex_base_3` can be used as the base vertex -for a 3D-triangulation data structure, it is a model of the concept -`TriangulationDSVertexBase_3`. +The class `Triangulation_ds_vertex_base_3` can be used as the base vertex +for a 3D-triangulation data structure, it is a model of the concept +`TriangulationDSVertexBase_3`. -Note that if the triangulation data structure is used as a parameter of a -geometric triangulation (Section \ref TDS3secdesign and -Chapter \ref chapterTriangulation3 "3D Triangulations"), then the vertex base class has to -fulfill additional geometric requirements, i.e.\ it has to be a model of the -concept `TriangulationVertexBase_3`. +Note that if the triangulation data structure is used as a parameter of a +geometric triangulation (Section \ref TDS3secdesign and +Chapter \ref chapterTriangulation3 "3D Triangulations"), then the vertex base class has to +fulfill additional geometric requirements, i.e.\ it has to be a model of the +concept `TriangulationVertexBase_3`. -This base class can be used directly or can serve as a base to derive -other base classes with some additional attributes (a color for -example) tuned for a specific application. +This base class can be used directly or can serve as a base to derive +other base classes with some additional attributes (a color for +example) tuned for a specific application. \cgalModels `TriangulationDSVertexBase_3` \tparam TDS should not be specified (see Section \ref tds3cyclic and examples) -\sa `CGAL::Triangulation_vertex_base_3` -\sa `CGAL::Triangulation_ds_cell_base_3` +\sa `CGAL::Triangulation_vertex_base_3` +\sa `CGAL::Triangulation_ds_cell_base_3` */ template< typename TDS = void > diff --git a/TDS_3/doc/TDS_3/Concepts/TriangulationDSCellBase_3.h b/TDS_3/doc/TDS_3/Concepts/TriangulationDSCellBase_3.h index 2856e1d70bd..eed775ffac6 100644 --- a/TDS_3/doc/TDS_3/Concepts/TriangulationDSCellBase_3.h +++ b/TDS_3/doc/TDS_3/Concepts/TriangulationDSCellBase_3.h @@ -13,29 +13,29 @@ is plugged into a triangulation class, the face base class may have additional geometric requirements depending on the triangulation class. -At the base level -(see the Software Design sections of the Chapters \ref Triangulation3secdesign "Triangulation" -and \ref TDS3secdesign "Triangulation Datastructure"), -a cell stores handles to its four vertices and to its four neighbor cells. -The vertices and neighbors are indexed 0, 1, 2 and 3. Neighbor `i` -lies opposite to vertex `i`. +At the base level +(see the Software Design sections of the Chapters \ref Triangulation3secdesign "Triangulation" +and \ref TDS3secdesign "Triangulation Datastructure"), +a cell stores handles to its four vertices and to its four neighbor cells. +The vertices and neighbors are indexed 0, 1, 2 and 3. Neighbor `i` +lies opposite to vertex `i`. -Since the Triangulation data structure is the class which defines the handle -types, the cell base class has to be somehow parameterized by the Triangulation -data structure. But since it is itself parameterized by the cell and vertex -base classes, there is a cycle in the definition of these classes. In order -to break the cycle, the base classes for vertex and cell which are given as -arguments for the Triangulation data structure use `void` as Triangulation -data structure parameter, and the Triangulation data structure then uses a -rebind-like mechanism (similar to the one specified in -`std::allocator`) in order to put itself as parameter to the vertex and -cell classes. The rebound base classes so obtained are the classes -which are used as base classes for the final vertex and cell classes. -More information can be found in Section \ref TDS3secdesign. +Since the Triangulation data structure is the class which defines the handle +types, the cell base class has to be somehow parameterized by the Triangulation +data structure. But since it is itself parameterized by the cell and vertex +base classes, there is a cycle in the definition of these classes. In order +to break the cycle, the base classes for vertex and cell which are given as +arguments for the Triangulation data structure use `void` as Triangulation +data structure parameter, and the Triangulation data structure then uses a +rebind-like mechanism (similar to the one specified in +`std::allocator`) in order to put itself as parameter to the vertex and +cell classes. The rebound base classes so obtained are the classes +which are used as base classes for the final vertex and cell classes. +More information can be found in Section \ref TDS3secdesign. \cgalHasModel `CGAL::Triangulation_ds_cell_base_3` -\sa `TriangulationDSVertexBase_3` +\sa `TriangulationDSVertexBase_3` \sa `CGAL::Triangulation_data_structure_3` */ @@ -44,13 +44,13 @@ class TriangulationDSCellBase_3 { public: -/// \name Types +/// \name Types /// A model of the concept `TriangulationDSCellBase_3` has to provide the following types. /// @{ /*! This template class has to define a type `Rebind_TDS::%Other` which is the -rebound cell, that is, the one whose `Triangulation_data_structure` +rebound cell, that is, the one whose `Triangulation_data_structure` will be the actually used one. `Rebind_TDS::%Other` will be the real base class of `Triangulation_data_structure_3::Cell`. \note It can be implemented using a nested template class. @@ -61,63 +61,63 @@ using Rebind_TDS = unspecified_type; /*! -*/ -typedef TriangulationDataStructure_3 Triangulation_data_structure; +*/ +typedef TriangulationDataStructure_3 Triangulation_data_structure; /*! -*/ -typedef TriangulationDataStructure_3::Vertex_handle Vertex_handle; +*/ +typedef TriangulationDataStructure_3::Vertex_handle Vertex_handle; /*! -*/ -typedef TriangulationDataStructure_3::Cell_handle Cell_handle; +*/ +typedef TriangulationDataStructure_3::Cell_handle Cell_handle; -/// @} +/// @} -/// \name Creation +/// \name Creation /// @{ /*! -Default constructor -*/ +Default constructor +*/ TriangulationDSCellBase_3(); /*! -Initializes the vertices with `v0, v1, v2, v3`. Neighbors are -initialized to the default constructed handle. -*/ +Initializes the vertices with `v0, v1, v2, v3`. Neighbors are +initialized to the default constructed handle. +*/ TriangulationDSCellBase_3( Vertex_handle v0, Vertex_handle v1, Vertex_handle v2, Vertex_handle v3); /*! -Initializes the vertices with `v0, v1, v2, v3` and the neighbors with -`n0, n1, n2, n3`. -*/ +Initializes the vertices with `v0, v1, v2, v3` and the neighbors with +`n0, n1, n2, n3`. +*/ TriangulationDSCellBase_3( Vertex_handle v0, Vertex_handle v1, Vertex_handle v2, Vertex_handle v3, Cell_handle n0, Cell_handle n1, Cell_handle n2, Cell_handle n3); -/// @} +/// @} -/// \name Checking +/// \name Checking /// @{ /*! -Performs any desired geometric test on a cell. +Performs any desired geometric test on a cell. \cgalDebugFunction \cgalDebugBegin -When `verbose` is set to `true`, messages are printed to give -a precise indication of the kind of invalidity encountered. `level` -increases the level of testing. +When `verbose` is set to `true`, messages are printed to give +a precise indication of the kind of invalidity encountered. `level` +increases the level of testing. \cgalDebugEnd -*/ -bool is_valid(bool verbose = false, int level = 0) const; +*/ +bool is_valid(bool verbose = false, int level = 0) const; -/// @} +/// @} /// \name Members for Compact_container /// \cgalAdvancedBegin @@ -130,13 +130,13 @@ bool is_valid(bool verbose = false, int level = 0) const; /*! -*/ -void * for_compact_container() const; +*/ +void * for_compact_container() const; /*! -*/ -void * & for_compact_container(); +*/ +void * & for_compact_container(); /// @} @@ -144,14 +144,14 @@ void * & for_compact_container(); /// @{ /*! -Inputs the possible non combinatorial information given by the cell. -*/ -istream& operator>> (istream& is, TriangulationDSCellBase_3 & c); +Inputs the possible non combinatorial information given by the cell. +*/ +istream& operator>> (istream& is, TriangulationDSCellBase_3 & c); /*! -Outputs the possible non combinatorial information given by the cell. -*/ -ostream& operator<< (ostream& os, const TriangulationDSCellBase_3 & c); +Outputs the possible non combinatorial information given by the cell. +*/ +ostream& operator<< (ostream& os, const TriangulationDSCellBase_3 & c); /// @} diff --git a/TDS_3/doc/TDS_3/Concepts/TriangulationDSVertexBase_3.h b/TDS_3/doc/TDS_3/Concepts/TriangulationDSVertexBase_3.h index e1d35cb88fc..14c6293b902 100644 --- a/TDS_3/doc/TDS_3/Concepts/TriangulationDSVertexBase_3.h +++ b/TDS_3/doc/TDS_3/Concepts/TriangulationDSVertexBase_3.h @@ -11,22 +11,22 @@ of a CGAL::Triangulation_data_structure_3. Note that if the `CGAL::Triangulation_data_structure_3` is plugged into a triangulation class, the vertex base class may have additional geometric requirements depending on the triangulation class. -At the bottom level of 3D-triangulations -(see Sections \ref Triangulation3secdesign and \ref TDS3secdesign), -a vertex provides access to one of its incident cells through a handle. +At the bottom level of 3D-triangulations +(see Sections \ref Triangulation3secdesign and \ref TDS3secdesign), +a vertex provides access to one of its incident cells through a handle. -Since the Triangulation data structure is the class which defines the handle -types, the vertex base class has to be somehow parameterized by the -Triangulation data structure. But since it is itself parameterized by the cell -and vertex base classes, there is a cycle in the definition of these classes. -In order to break the cycle, the base classes for vertex and cell which are -given as arguments for the Triangulation data structure use `void` as -Triangulation data structure parameter, and the Triangulation data structure -then uses a rebind-like mechanism (similar to the one specified in -`std::allocator`) in order to put itself as parameter to the vertex and -cell classes. The rebound base classes so obtained are the classes which -are used as base classes for the final vertex and cell classes. -More information can be found in Section \ref TDS3secdesign. +Since the Triangulation data structure is the class which defines the handle +types, the vertex base class has to be somehow parameterized by the +Triangulation data structure. But since it is itself parameterized by the cell +and vertex base classes, there is a cycle in the definition of these classes. +In order to break the cycle, the base classes for vertex and cell which are +given as arguments for the Triangulation data structure use `void` as +Triangulation data structure parameter, and the Triangulation data structure +then uses a rebind-like mechanism (similar to the one specified in +`std::allocator`) in order to put itself as parameter to the vertex and +cell classes. The rebound base classes so obtained are the classes which +are used as base classes for the final vertex and cell classes. +More information can be found in Section \ref TDS3secdesign. \cgalHasModel `CGAL::Triangulation_ds_vertex_base_3` @@ -39,65 +39,65 @@ class TriangulationDSVertexBase_3 { public: -/// \name Types +/// \name Types /// @{ /*! This template class has to define a type `Rebind_TDS::%Other` which is the -rebound vertex, that is, the one whose `Triangulation_data_structure` +rebound vertex, that is, the one whose `Triangulation_data_structure` will be the actually used one. `Rebind_TDS::%Other` will be the real base class of `Triangulation_data_structure_3::Vertex`. \note It can be implemented using a nested template class. \sa Section \ref tds3cyclic -*/ +*/ template -using Rebind_TDS = unspecified_type; +using Rebind_TDS = unspecified_type; /*! -*/ -typedef TriangulationDataStructure_3 Triangulation_data_structure; +*/ +typedef TriangulationDataStructure_3 Triangulation_data_structure; /*! -*/ -typedef TriangulationDataStructure_3::Vertex_handle Vertex_handle; +*/ +typedef TriangulationDataStructure_3::Vertex_handle Vertex_handle; /*! -*/ -typedef TriangulationDataStructure_3::Cell_handle Cell_handle; +*/ +typedef TriangulationDataStructure_3::Cell_handle Cell_handle; -/// @} +/// @} -/// \name Creation +/// \name Creation /// @{ /*! -Default constructor. -*/ +Default constructor. +*/ TriangulationDSVertexBase_3(); /*! -Constructs a vertex pointing to cell `c`. -*/ +Constructs a vertex pointing to cell `c`. +*/ TriangulationDSVertexBase_3(Cell_handle c); -/// @} +/// @} -/// \name Checking +/// \name Checking /// @{ /*! \cgalDebugFunction \cgalDebugBegin -Performs any desired test on a vertex. Checks that the -pointer to an incident cell is not the default constructed handle. +Performs any desired test on a vertex. Checks that the +pointer to an incident cell is not the default constructed handle. \cgalDebugEnd -*/ -bool is_valid(bool verbose=false, int level=0) const; +*/ +bool is_valid(bool verbose=false, int level=0) const; -/// @} +/// @} /// \name Members for Compact_container /// \cgalAdvancedBegin @@ -110,23 +110,23 @@ bool is_valid(bool verbose=false, int level=0) const; /*! -*/ -void * for_compact_container() const; +*/ +void * for_compact_container() const; /*! -*/ -void * & for_compact_container(); +*/ +void * & for_compact_container(); /*! -Inputs the non-combinatorial information given by the vertex. -*/ -istream& operator>> (istream& is, TriangulationDSVertexBase_3 & v); +Inputs the non-combinatorial information given by the vertex. +*/ +istream& operator>> (istream& is, TriangulationDSVertexBase_3 & v); /*! -Outputs the non-combinatorial information given by the vertex. -*/ -ostream& operator<< (ostream& os, const TriangulationDSVertexBase_3 & v); +Outputs the non-combinatorial information given by the vertex. +*/ +ostream& operator<< (ostream& os, const TriangulationDSVertexBase_3 & v); /// @} diff --git a/TDS_3/doc/TDS_3/Concepts/TriangulationDataStructure_3.h b/TDS_3/doc/TDS_3/Concepts/TriangulationDataStructure_3.h index b7ee722b903..8cdc8c934d2 100644 --- a/TDS_3/doc/TDS_3/Concepts/TriangulationDataStructure_3.h +++ b/TDS_3/doc/TDS_3/Concepts/TriangulationDataStructure_3.h @@ -3,79 +3,79 @@ \ingroup PkgTDS3Concepts \cgalConcept -3D-triangulation data structures are meant to maintain the -combinatorial information for 3D-geometric triangulations. +3D-triangulation data structures are meant to maintain the +combinatorial information for 3D-geometric triangulations. -In \cgal, a triangulation data structure is a container of cells -(\f$ 3\f$-faces) and vertices (\f$ 0\f$-faces). Following the standard -vocabulary of simplicial complexes, an \f$ i\f$-face \f$ f_i\f$ and a \f$ j\f$-face -\f$ f_j\f$ \f$ (0 \leq j < i \leq 3)\f$ are said to be incident in the -triangulation if \f$ f_j\f$ is a (sub)face of \f$ f_i\f$, and two \f$ i\f$-faces \f$ (0 -\leq i \leq 3)\f$ are said to be adjacent if they share a -common incident (sub)face. +In \cgal, a triangulation data structure is a container of cells +(\f$ 3\f$-faces) and vertices (\f$ 0\f$-faces). Following the standard +vocabulary of simplicial complexes, an \f$ i\f$-face \f$ f_i\f$ and a \f$ j\f$-face +\f$ f_j\f$ \f$ (0 \leq j < i \leq 3)\f$ are said to be incident in the +triangulation if \f$ f_j\f$ is a (sub)face of \f$ f_i\f$, and two \f$ i\f$-faces \f$ (0 +\leq i \leq 3)\f$ are said to be adjacent if they share a +common incident (sub)face. -Each cell gives -access to its four incident vertices and to its four adjacent -cells. Each vertex gives direct access to one of its incident cells, which is -sufficient to retrieve all the incident cells when needed. +Each cell gives +access to its four incident vertices and to its four adjacent +cells. Each vertex gives direct access to one of its incident cells, which is +sufficient to retrieve all the incident cells when needed. -The four vertices of a cell are indexed with 0, 1, 2 and 3. The -neighbors of a cell are also indexed with 0, 1, 2, 3 -in such a way that the neighbor indexed by \f$ i\f$ is opposite to the vertex -with the same index (see \cgalFigureRef{TDS3figrepres}). +The four vertices of a cell are indexed with 0, 1, 2 and 3. The +neighbors of a cell are also indexed with 0, 1, 2, 3 +in such a way that the neighbor indexed by \f$ i\f$ is opposite to the vertex +with the same index (see \cgalFigureRef{TDS3figrepres}). -Edges (\f$ 1\f$-faces) and facets (\f$ 2\f$-faces) are not explicitly -represented: a facet is given by a cell and an index (the facet -`i` of a cell `c` is the facet of `c` that is opposite to -the vertex of index `i`) and an edge is given by a cell and two -indices (the edge `(i,j)` of a cell `c` is the edge -whose endpoints are the vertices of indices `i` and `j` of -`c`). +Edges (\f$ 1\f$-faces) and facets (\f$ 2\f$-faces) are not explicitly +represented: a facet is given by a cell and an index (the facet +`i` of a cell `c` is the facet of `c` that is opposite to +the vertex of index `i`) and an edge is given by a cell and two +indices (the edge `(i,j)` of a cell `c` is the edge +whose endpoints are the vertices of indices `i` and `j` of +`c`). -As \cgal explicitly deals with all degenerate cases, a -3D-triangulation data structure in \cgal can handle the cases when -the dimension of the triangulation is lower than 3 -(see Section \ref TDS3secintro). +As \cgal explicitly deals with all degenerate cases, a +3D-triangulation data structure in \cgal can handle the cases when +the dimension of the triangulation is lower than 3 +(see Section \ref TDS3secintro). -Thus, a 3D-triangulation data structure can store a triangulation of a +Thus, a 3D-triangulation data structure can store a triangulation of a topological sphere \f$ S^d\f$ of \f$ \mathbb{R}^{d+1}\f$, for any \f$ d \in \{-1,0,1,2,3\}\f$.
-The second template parameter of the basic triangulation class -(see Chapter \ref chapterTriangulation3 "3D Triangulations") -`CGAL::Triangulation_3` is a triangulation data structure class. (See -Chapter \ref chapterTDS3.) +The second template parameter of the basic triangulation class +(see Chapter \ref chapterTriangulation3 "3D Triangulations") +`CGAL::Triangulation_3` is a triangulation data structure class. (See +Chapter \ref chapterTDS3.) -To ensure all the *flexibility* of the class `CGAL::Triangulation_3`, a -model of a triangulation data structure must be templated by the base vertex -and the base cell classes (see \ref TDS3secintro): -`TriangulationDataStructure_3`. -The optional functionalities related to geometry are compulsory for +To ensure all the *flexibility* of the class `CGAL::Triangulation_3`, a +model of a triangulation data structure must be templated by the base vertex +and the base cell classes (see \ref TDS3secintro): +`TriangulationDataStructure_3`. +The optional functionalities related to geometry are compulsory for this use as a template parameter of `CGAL::Triangulation_3`. -A class that satisfies the requirements for a triangulation data structure -class must provide the following types and operations. +A class that satisfies the requirements for a triangulation data structure +class must provide the following types and operations. \cgalHeading{I/O} -The information stored in the `iostream` is: -the dimension, the number of vertices, the number of cells, -the indices of the vertices of each cell, then the indices of the -neighbors of each cell, where the index corresponds to the preceding -list of cells. When dimension < 3, the same information is stored -for faces of maximal dimension instead of cells. +The information stored in the `iostream` is: +the dimension, the number of vertices, the number of cells, +the indices of the vertices of each cell, then the indices of the +neighbors of each cell, where the index corresponds to the preceding +list of cells. When dimension < 3, the same information is stored +for faces of maximal dimension instead of cells. \cgalHasModel `CGAL::Triangulation_data_structure_3` -\sa `TriangulationDataStructure_3::Vertex` -\sa `TriangulationDataStructure_3::Cell` +\sa `TriangulationDataStructure_3::Vertex` +\sa `TriangulationDataStructure_3::Cell` */ class TriangulationDataStructure_3 { public: -/// \name Types +/// \name Types /// @{ /*! @@ -94,24 +94,24 @@ typedef unspecified_type Cell; typedef unspecified_type Cell_data; /*! -Size type (unsigned integral type) -*/ -typedef unspecified_type size_type; +Size type (unsigned integral type) +*/ +typedef unspecified_type size_type; /*! -Difference type (signed integral type) -*/ -typedef unspecified_type difference_type; +Difference type (signed integral type) +*/ +typedef unspecified_type difference_type; /*! -*/ -typedef unspecified_type Vertex_handle; +*/ +typedef unspecified_type Vertex_handle; /*! -*/ -typedef unspecified_type Cell_handle; +*/ +typedef unspecified_type Cell_handle; /*! Can be `CGAL::Sequential_tag`, `CGAL::Parallel_tag`, or `Parallel_if_available_tag`. If it is @@ -123,42 +123,42 @@ typedef unspecified_type Concurrency_tag; /*! \cgalAdvancedType \cgalAdvancedBegin -This template class allows to get the type of a triangulation -data structure that only changes the vertex type. It has to define a type -`Rebind_vertex::%Other` which is a rebound triangulation data structure, that is, the +This template class allows to get the type of a triangulation +data structure that only changes the vertex type. It has to define a type +`Rebind_vertex::%Other` which is a rebound triangulation data structure, that is, the one whose `TriangulationDSVertexBase_3` will be `Vb2`. \note It can be implemented using a nested template class. \cgalAdvancedEnd -*/ -template +*/ +template using Rebind_vertex = unspecified_type; /*! \cgalAdvancedType \cgalAdvancedBegin -This template class allows to get the type of a triangulation -data structure that only changes the cell type. It has to define a type -`Rebind_cell::%Other` which is a rebound triangulation data structure, that is, the +This template class allows to get the type of a triangulation +data structure that only changes the cell type. It has to define a type +`Rebind_cell::%Other` which is a rebound triangulation data structure, that is, the one whose `TriangulationDSCellBase_3` will be `Cb2`. \note It can be implemented using a nested template class. \cgalAdvancedEnd -*/ -template +*/ +template using Rebind_cell = unspecified_type; /*! -`(c,i,j)` is the -edge of cell `c` whose vertices indices are `i` and -`j`. (See Section \ref TDS3secintro.) -*/ -typedef Triple Edge; +`(c,i,j)` is the +edge of cell `c` whose vertices indices are `i` and +`j`. (See Section \ref TDS3secintro.) +*/ +typedef Triple Edge; /*! -`(c,i)` is the facet -of `c` opposite to the vertex of index `i`. (See -Section \ref TDS3secintro.) -*/ -typedef std::pair Facet; +`(c,i)` is the facet +of `c` opposite to the vertex of index `i`. (See +Section \ref TDS3secintro.) +*/ +typedef std::pair Facet; /// @} @@ -172,23 +172,23 @@ typedef std::pair Facet; /*! -*/ -typedef unspecified_type Cell_iterator; +*/ +typedef unspecified_type Cell_iterator; /*! -*/ -typedef unspecified_type Facet_iterator; +*/ +typedef unspecified_type Facet_iterator; /*! -*/ -typedef unspecified_type Edge_iterator; +*/ +typedef unspecified_type Edge_iterator; /*! -*/ -typedef unspecified_type Vertex_iterator; +*/ +typedef unspecified_type Vertex_iterator; /// @} @@ -203,44 +203,44 @@ typedef unspecified_type Vertex_iterator; /*! -*/ -typedef unspecified_type Facet_circulator; +*/ +typedef unspecified_type Facet_circulator; /*! -*/ -typedef unspecified_type Cell_circulator; +*/ +typedef unspecified_type Cell_circulator; -/// @} +/// @} -/// \name Creation +/// \name Creation /// @{ /*! -Default constructor. -*/ -TriangulationDataStructure_3(); +Default constructor. +*/ +TriangulationDataStructure_3(); /*! -Copy constructor. All vertices and cells are duplicated. -*/ -TriangulationDataStructure_3(const TriangulationDataStructure_3 & tds1); +Copy constructor. All vertices and cells are duplicated. +*/ +TriangulationDataStructure_3(const TriangulationDataStructure_3 & tds1); /*! -Assignment operator. All vertices and cells are duplicated, and the former -data structure of `tds` is deleted. -*/ -TriangulationDataStructure_3& operator= (const TriangulationDataStructure_3 & tds1); +Assignment operator. All vertices and cells are duplicated, and the former +data structure of `tds` is deleted. +*/ +TriangulationDataStructure_3& operator= (const TriangulationDataStructure_3 & tds1); /*! -`tds1` is copied into `tds`. If `v != Vertex_handle()`, -the vertex of `tds` corresponding to `v` is returned, -otherwise `Vertex_handle()` is returned. -\pre The optional argument `v` is a vertex of `tds1`. -*/ -Vertex_handle -copy_tds(const TriangulationDataStructure_3 & tds1, -Vertex_handle v = Vertex_handle()); +`tds1` is copied into `tds`. If `v != Vertex_handle()`, +the vertex of `tds` corresponding to `v` is returned, +otherwise `Vertex_handle()` is returned. +\pre The optional argument `v` is a vertex of `tds1`. +*/ +Vertex_handle +copy_tds(const TriangulationDataStructure_3 & tds1, +Vertex_handle v = Vertex_handle()); /*! `tds_src` is copied into `this`. As the vertex and cell types might be different @@ -265,158 +265,158 @@ template Vertex_handle tds.copy_tds(const TDS_src& tds_src, typename TDS_src::Vertex_handle v, const ConvertVertex& convert_vertex, const ConvertCell& convert_cell); /*! -Swaps `tds` and `tds1`. There is no copy of cells and vertices, -thus this method runs in constant time. This method should be preferred to -`tds`=`tds1` or `tds`(`tds1`) when `tds1` is deleted after -that. -*/ -void swap(TriangulationDataStructure_3 & tds1); +Swaps `tds` and `tds1`. There is no copy of cells and vertices, +thus this method runs in constant time. This method should be preferred to +`tds`=`tds1` or `tds`(`tds1`) when `tds1` is deleted after +that. +*/ +void swap(TriangulationDataStructure_3 & tds1); /*! -Deletes all cells and vertices. `tds` is reset as a triangulation -data structure constructed by the default constructor. -*/ -void clear(); +Deletes all cells and vertices. `tds` is reset as a triangulation +data structure constructed by the default constructor. +*/ +void clear(); -/// @} +/// @} -/// \name Access Functions +/// \name Access Functions /// @{ /*! -The dimension of the triangulated topological sphere. -*/ -int dimension() const; +The dimension of the triangulated topological sphere. +*/ +int dimension() const; /*! -The number of vertices. Note that the triangulation data structure has one -more vertex than an associated geometric triangulation, if there is -one, since the infinite vertex is a standard vertex and is thus also -counted. -*/ -size_type number_of_vertices() const; +The number of vertices. Note that the triangulation data structure has one +more vertex than an associated geometric triangulation, if there is +one, since the infinite vertex is a standard vertex and is thus also +counted. +*/ +size_type number_of_vertices() const; /*! -The number of cells. Returns 0 if `tds`.`dimension()`\f$ <3\f$. -*/ -size_type number_of_cells() const; +The number of cells. Returns 0 if `tds`.`dimension()`\f$ <3\f$. +*/ +size_type number_of_cells() const; -/// @} +/// @} -/// \name Non constant-time access functions +/// \name Non constant-time access functions /// @{ /*! -The number of facets. Returns 0 if `tds`.`dimension()`\f$ <2\f$. -*/ -size_type number_of_facets() const; +The number of facets. Returns 0 if `tds`.`dimension()`\f$ <2\f$. +*/ +size_type number_of_facets() const; /*! -The number of edges. Returns 0 if `tds`.`dimension()`\f$ <1\f$. -*/ -size_type number_of_edges() const; +The number of edges. Returns 0 if `tds`.`dimension()`\f$ <1\f$. +*/ +size_type number_of_edges() const; -/// @} +/// @} -/// \name Setting +/// \name Setting /// @{ /*! \cgalAdvancedFunction \cgalAdvancedBegin -Sets the dimension to `n`. +Sets the dimension to `n`. \cgalAdvancedEnd -*/ -void set_dimension(int n); +*/ +void set_dimension(int n); -/// @} +/// @} -/// \name Queries +/// \name Queries /// @{ /*! -Tests whether `v` is a vertex of `tds`. -*/ -bool is_vertex(Vertex_handle v) const; +Tests whether `v` is a vertex of `tds`. +*/ +bool is_vertex(Vertex_handle v) const; /*! -Tests whether `(c,i,j)` is an edge of `tds`. Answers `false` when -`dimension()` \f$ <1\f$ . -\pre \f$ i,j \in\{0,1,2,3\}\f$ -*/ -bool is_edge(Cell_handle c, int i, int j) const; +Tests whether `(c,i,j)` is an edge of `tds`. Answers `false` when +`dimension()` \f$ <1\f$ . +\pre \f$ i,j \in\{0,1,2,3\}\f$ +*/ +bool is_edge(Cell_handle c, int i, int j) const; /*! -Tests whether `(u,v)` is an edge of `tds`. If the edge is found, -it computes a cell `c` having this edge and the indices `i` -and `j` of the vertices `u` and `v`, in this order. -*/ -bool is_edge(Vertex_handle u, Vertex_handle v, -Cell_handle & c, int & i, int & j) const; +Tests whether `(u,v)` is an edge of `tds`. If the edge is found, +it computes a cell `c` having this edge and the indices `i` +and `j` of the vertices `u` and `v`, in this order. +*/ +bool is_edge(Vertex_handle u, Vertex_handle v, +Cell_handle & c, int & i, int & j) const; /*! -Tests whether `(u,v)` is an edge of `tds`. -*/ -bool is_edge(Vertex_handle u, Vertex_handle v) const; +Tests whether `(u,v)` is an edge of `tds`. +*/ +bool is_edge(Vertex_handle u, Vertex_handle v) const; /*! -Tests whether `(c,i)` is a facet of `tds`. Answers `false` when -`dimension()` \f$ <2\f$ . -\pre \f$ i \in\{0,1,2,3\}\f$ -*/ -bool is_facet(Cell_handle c, int i) const; +Tests whether `(c,i)` is a facet of `tds`. Answers `false` when +`dimension()` \f$ <2\f$ . +\pre \f$ i \in\{0,1,2,3\}\f$ +*/ +bool is_facet(Cell_handle c, int i) const; /*! -Tests whether `(u,v,w)` is a facet of `tds`. If the facet is found, -it computes a cell `c` having this facet and the indices `i`, -`j` and `k` of the vertices `u`, `v` and `w`, in -this order. -*/ -bool is_facet(Vertex_handle u, Vertex_handle v, Vertex_handle w, -Cell_handle & c, int & i, int & j, int & k) const; +Tests whether `(u,v,w)` is a facet of `tds`. If the facet is found, +it computes a cell `c` having this facet and the indices `i`, +`j` and `k` of the vertices `u`, `v` and `w`, in +this order. +*/ +bool is_facet(Vertex_handle u, Vertex_handle v, Vertex_handle w, +Cell_handle & c, int & i, int & j, int & k) const; /*! -Tests whether `c` is a cell of `tds`. Answers `false` when -`dimension()` \f$ <3\f$ . -*/ -bool is_cell(Cell_handle c) const; +Tests whether `c` is a cell of `tds`. Answers `false` when +`dimension()` \f$ <3\f$ . +*/ +bool is_cell(Cell_handle c) const; /*! -Tests whether `(u,v,w,t)` is a cell of `tds`. If the cell -`c` is found, it computes the indices `i`, `j`, `k` -and `l` of the vertices `u`, `v`, `w` and `t` in -`c`, in this order. -*/ -bool is_cell(Vertex_handle u, Vertex_handle v, Vertex_handle w, Vertex_handle t, -Cell_handle & c, int & i, int & j, int & k, int & l) const; +Tests whether `(u,v,w,t)` is a cell of `tds`. If the cell +`c` is found, it computes the indices `i`, `j`, `k` +and `l` of the vertices `u`, `v`, `w` and `t` in +`c`, in this order. +*/ +bool is_cell(Vertex_handle u, Vertex_handle v, Vertex_handle w, Vertex_handle t, +Cell_handle & c, int & i, int & j, int & k, int & l) const; /// @} /// \name has_vertex -/// There is a method `has_vertex` in the cell class. The analogous methods for facets are defined here. +/// There is a method `has_vertex` in the cell class. The analogous methods for facets are defined here. /// @{ /*! -If `v` is a vertex of `f`, then `j` is the index of -`v` in the cell `f.first`, and the method returns `true`. -\pre `tds`.dimension()=3 -*/ -bool has_vertex(const Facet & f, Vertex_handle v, int & j) const; +If `v` is a vertex of `f`, then `j` is the index of +`v` in the cell `f.first`, and the method returns `true`. +\pre `tds`.dimension()=3 +*/ +bool has_vertex(const Facet & f, Vertex_handle v, int & j) const; /*! -Same for facet `(c,i)`. Computes the index `j` of `v` in -`c`. -*/ -bool has_vertex(Cell_handle c, int i, Vertex_handle v, int & j) const; +Same for facet `(c,i)`. Computes the index `j` of `v` in +`c`. +*/ +bool has_vertex(Cell_handle c, int i, Vertex_handle v, int & j) const; /*! -*/ -bool has_vertex(const Facet & f, Vertex_handle v) const; +*/ +bool has_vertex(const Facet & f, Vertex_handle v) const; /*! -Same as the first two methods, but these two methods do not return the -index of the vertex. -*/ -bool has_vertex(Cell_handle c, int i, Vertex_handle v) const; +Same as the first two methods, but these two methods do not return the +index of the vertex. +*/ +bool has_vertex(Cell_handle c, int i, Vertex_handle v) const; /// @} @@ -426,23 +426,23 @@ bool has_vertex(Cell_handle c, int i, Vertex_handle v) const; /*! -*/ -bool are_equal(const Facet & f, const Facet & g) const; +*/ +bool are_equal(const Facet & f, const Facet & g) const; /*! -*/ -bool are_equal(Cell_handle c, int i, Cell_handle n, int j) const; +*/ +bool are_equal(Cell_handle c, int i, Cell_handle n, int j) const; /*! -For these three methods: \pre `tds`.dimension()=3. -*/ -bool are_equal(const Facet & f, Cell_handle n, int j) const; +For these three methods: \pre `tds`.dimension()=3. +*/ +bool are_equal(const Facet & f, Cell_handle n, int j) const; -/// @} +/// @} /*! -\name Flips +\name Flips Two kinds of flips exist for a three-dimensional triangulation. They are reciprocal. To be flipped, an edge must be incident to three @@ -468,191 +468,191 @@ the affected cells. /*! -*/ -bool flip(Edge e); +*/ +bool flip(Edge e); /*! -Before flipping, these methods check that edge `e=(c,i,j)` is -flippable (which is quite expensive). They return `false` or -`true` according to this test. -*/ -bool flip(Cell_handle c, int i, int j); +Before flipping, these methods check that edge `e=(c,i,j)` is +flippable (which is quite expensive). They return `false` or +`true` according to this test. +*/ +bool flip(Cell_handle c, int i, int j); /*! -*/ -void flip_flippable(Edge e); +*/ +void flip_flippable(Edge e); /*! -Should be preferred to the previous methods when the edge is -known to be flippable. -\pre The edge is flippable. -*/ -void flip_flippable(Cell_handle c, int i, int j); +Should be preferred to the previous methods when the edge is +known to be flippable. +\pre The edge is flippable. +*/ +void flip_flippable(Cell_handle c, int i, int j); /*! -*/ -bool flip(Facet f); +*/ +bool flip(Facet f); /*! -Before flipping, these methods check that facet `f=(c,i)` is -flippable (which is quite expensive). They return `false` or -`true` according to this test. -*/ -bool flip(Cell_handle c, int i); +Before flipping, these methods check that facet `f=(c,i)` is +flippable (which is quite expensive). They return `false` or +`true` according to this test. +*/ +bool flip(Cell_handle c, int i); /*! -*/ -void flip_flippable(Facet f); +*/ +void flip_flippable(Facet f); /*! -Should be preferred to the previous methods when the facet is -known to be flippable. -\pre The facet is flippable. -*/ -void flip_flippable(Cell_handle c, int i); +Should be preferred to the previous methods when the facet is +known to be flippable. +\pre The facet is flippable. +*/ +void flip_flippable(Cell_handle c, int i); -/// @} +/// @} -/// \name Insertions -/// The following modifier member functions guarantee the combinatorial validity of the resulting triangulation. +/// \name Insertions +/// The following modifier member functions guarantee the combinatorial validity of the resulting triangulation. /// @{ /*! -Creates a new vertex, inserts it in cell `c` and returns its handle. -The cell `c` is split into four new cells, each of these cells being -formed by the new vertex and a facet of `c`. -\pre `tds`.`dimension()` \f$ = 3\f$ and `c` is a cell of `tds`. -*/ -Vertex_handle insert_in_cell(Cell_handle c); +Creates a new vertex, inserts it in cell `c` and returns its handle. +The cell `c` is split into four new cells, each of these cells being +formed by the new vertex and a facet of `c`. +\pre `tds`.`dimension()` \f$ = 3\f$ and `c` is a cell of `tds`. +*/ +Vertex_handle insert_in_cell(Cell_handle c); /*! -Creates a new vertex, inserts it in facet `f` and returns its handle. -In dimension 3, the two incident cells are split into 3 new cells; -in dimension 2, the facet is split into 3 facets. -\pre `tds`.`dimension()` \f$ \geq2\f$ and `f` is a facet of `tds`. -*/ -Vertex_handle insert_in_facet(const Facet & f); +Creates a new vertex, inserts it in facet `f` and returns its handle. +In dimension 3, the two incident cells are split into 3 new cells; +in dimension 2, the facet is split into 3 facets. +\pre `tds`.`dimension()` \f$ \geq2\f$ and `f` is a facet of `tds`. +*/ +Vertex_handle insert_in_facet(const Facet & f); /*! -Creates a new vertex, inserts it in facet `i` of `c` and returns its -handle. -\pre `tds`.`dimension()` \f$ \geq2\f$, \f$ i \in\{0,1,2,3\}\f$ in dimension 3, \f$ i=3\f$ in dimension 2 and `(c,i)` is a facet of `tds`. -*/ -Vertex_handle insert_in_facet(Cell_handle c, int i); +Creates a new vertex, inserts it in facet `i` of `c` and returns its +handle. +\pre `tds`.`dimension()` \f$ \geq2\f$, \f$ i \in\{0,1,2,3\}\f$ in dimension 3, \f$ i=3\f$ in dimension 2 and `(c,i)` is a facet of `tds`. +*/ +Vertex_handle insert_in_facet(Cell_handle c, int i); /*! -Creates a new vertex, inserts it in edge `e` and returns its handle. -In dimension 3, all the -incident cells are split into 2 new cells; in dimension 2, the 2 -incident facets are split into 2 new facets; in dimension 1, the edge is -split into 2 new edges. -\pre `tds`.`dimension()` \f$ \geq1\f$ and `e` is an edge of `tds`. -*/ -Vertex_handle insert_in_edge(Edge e); +Creates a new vertex, inserts it in edge `e` and returns its handle. +In dimension 3, all the +incident cells are split into 2 new cells; in dimension 2, the 2 +incident facets are split into 2 new facets; in dimension 1, the edge is +split into 2 new edges. +\pre `tds`.`dimension()` \f$ \geq1\f$ and `e` is an edge of `tds`. +*/ +Vertex_handle insert_in_edge(Edge e); /*! -Creates a new vertex, inserts it in edge \f$ (i,j)\f$ of `c` and returns its -handle. -\pre `tds`.`dimension()` \f$ \geq1\f$. \f$ i\neq j\f$, \f$ i,j \in\{0,1,2,3\}\f$ in dimension 3, \f$ i,j \in\{0,1,2\}\f$ in dimension 2, \f$ i,j \in\{0,1\}\f$ in dimension 1 and `(c,i,j)` is an edge of `tds`. -*/ -Vertex_handle insert_in_edge(Cell_handle c, int i, int j); +Creates a new vertex, inserts it in edge \f$ (i,j)\f$ of `c` and returns its +handle. +\pre `tds`.`dimension()` \f$ \geq1\f$. \f$ i\neq j\f$, \f$ i,j \in\{0,1,2,3\}\f$ in dimension 3, \f$ i,j \in\{0,1,2\}\f$ in dimension 2, \f$ i,j \in\{0,1\}\f$ in dimension 1 and `(c,i,j)` is an edge of `tds`. +*/ +Vertex_handle insert_in_edge(Cell_handle c, int i, int j); /*! -Transforms a triangulation of the sphere \f$ S^d\f$ of \f$ \mathbb{R}^{d+1}\f$ into the -triangulation of the sphere \f$ S^{d+1}\f$ of \f$ \mathbb{R}^{d+2}\f$ by adding a new vertex -`v`: -`v` is linked to all the vertices to triangulate one of the two -half-spheres of dimension \f$ (d+1)\f$. Vertex `star` is used to -triangulate the second half-sphere (when there is an associated -geometric triangulation, `star` is in fact the vertex associated with -its infinite vertex). -See Figure \ref TDS3figtopoinsert_outside_affine_hull. +Transforms a triangulation of the sphere \f$ S^d\f$ of \f$ \mathbb{R}^{d+1}\f$ into the +triangulation of the sphere \f$ S^{d+1}\f$ of \f$ \mathbb{R}^{d+2}\f$ by adding a new vertex +`v`: +`v` is linked to all the vertices to triangulate one of the two +half-spheres of dimension \f$ (d+1)\f$. Vertex `star` is used to +triangulate the second half-sphere (when there is an associated +geometric triangulation, `star` is in fact the vertex associated with +its infinite vertex). +See Figure \ref TDS3figtopoinsert_outside_affine_hull. -The numbering of the cells is such that, if `f` was a face of -maximal dimension in the initial triangulation, then `(f,v)` (in -this order) is the corresponding face in the new triangulation. -This method can be used to insert the first two vertices in an empty -triangulation. +The numbering of the cells is such that, if `f` was a face of +maximal dimension in the initial triangulation, then `(f,v)` (in +this order) is the corresponding face in the new triangulation. +This method can be used to insert the first two vertices in an empty +triangulation. -A handle to `v` is returned. -\pre `tds`.`dimension()` \f$ = d < 3\f$. When `tds`.`number_of_vertices()` \f$ >0\f$, \f$ star \neq\f$ `Vertex_handle()` and `star` is a vertex of `tds`. +A handle to `v` is returned. +\pre `tds`.`dimension()` \f$ = d < 3\f$. When `tds`.`number_of_vertices()` \f$ >0\f$, \f$ star \neq\f$ `Vertex_handle()` and `star` is a vertex of `tds`. -\anchor TDS3figtopoinsert_outside_affine_hull +\anchor TDS3figtopoinsert_outside_affine_hull \image html topo-insert_outside_affine_hull.png "insert_increase_dimension (1-dimensional case)." \image latex topo-insert_outside_affine_hull.png "insert_increase_dimension (1-dimensional case)." -*/ -Vertex_handle -insert_increase_dimension(Vertex_handle star = Vertex_handle()); +*/ +Vertex_handle +insert_increase_dimension(Vertex_handle star = Vertex_handle()); /*! -Creates a new vertex by starring a hole. It takes an iterator range -[`cell_begin`; `cell_end`[ of `Cell_handles` which specifies a set -of connected cells (resp. facets in dimension 2) describing a hole. -(`begin`, `i`) is a facet (resp. an edge) on the boundary of the hole, -that is, `begin` belongs to the set of cells (resp. facets) previously -described, and `begin->neighbor(i)` does not. Then this function deletes -all the cells (resp. facets) describing the hole, creates a new vertex -`v`, and for each facet (resp. edge) on the boundary of the hole, creates -a new cell (resp. facet) with `v` as vertex. `v` is returned. -\pre `tds`.`dimension()` \f$ \geq2\f$, the set of cells (resp. facets) is connected, and its boundary is connected. -*/ -template -Vertex_handle insert_in_hole(CellIt cell_begin, CellIt cell_end, -Cell_handle begin, int i); +Creates a new vertex by starring a hole. It takes an iterator range +[`cell_begin`; `cell_end`[ of `Cell_handles` which specifies a set +of connected cells (resp. facets in dimension 2) describing a hole. +(`begin`, `i`) is a facet (resp. an edge) on the boundary of the hole, +that is, `begin` belongs to the set of cells (resp. facets) previously +described, and `begin->neighbor(i)` does not. Then this function deletes +all the cells (resp. facets) describing the hole, creates a new vertex +`v`, and for each facet (resp. edge) on the boundary of the hole, creates +a new cell (resp. facet) with `v` as vertex. `v` is returned. +\pre `tds`.`dimension()` \f$ \geq2\f$, the set of cells (resp. facets) is connected, and its boundary is connected. +*/ +template +Vertex_handle insert_in_hole(CellIt cell_begin, CellIt cell_end, +Cell_handle begin, int i); /*! -Same as above, except that `newv` will be used as the new vertex, which -must have been allocated previously with e.g. `create_vertex`. -*/ -template -Vertex_handle insert_in_hole(CellIt cell_begin, CellIt cell_end, -Cell_handle begin, int i, Vertex_handle newv); +Same as above, except that `newv` will be used as the new vertex, which +must have been allocated previously with e.g. `create_vertex`. +*/ +template +Vertex_handle insert_in_hole(CellIt cell_begin, CellIt cell_end, +Cell_handle begin, int i, Vertex_handle newv); -/// @} +/// @} -/// \name Removal +/// \name Removal /// @{ /*! -This operation is the reciprocal of `insert_increase_dimension()`. -It transforms a triangulation of the sphere \f$ S^d\f$ of \f$ \mathbb{R}^{d+1}\f$ into the -triangulation of the sphere \f$ S^{d-1}\f$ of \f$ \mathbb{R}^{d}\f$ by removing the vertex -`v`. Delete the cells incident to `w`, keep the others. -\pre `tds`.`dimension()` \f$ = d \geq-1\f$. `tds`.`degree(v)` \f$ =\f$ `degree(w)` \f$ =\f$ `tds`.`number_of_vertices()` \f$ -1\f$. +This operation is the reciprocal of `insert_increase_dimension()`. +It transforms a triangulation of the sphere \f$ S^d\f$ of \f$ \mathbb{R}^{d+1}\f$ into the +triangulation of the sphere \f$ S^{d-1}\f$ of \f$ \mathbb{R}^{d}\f$ by removing the vertex +`v`. Delete the cells incident to `w`, keep the others. +\pre `tds`.`dimension()` \f$ = d \geq-1\f$. `tds`.`degree(v)` \f$ =\f$ `degree(w)` \f$ =\f$ `tds`.`number_of_vertices()` \f$ -1\f$. -*/ -void remove_decrease_dimension(Vertex_handle v, Vertex_handle w = v); +*/ +void remove_decrease_dimension(Vertex_handle v, Vertex_handle w = v); /*! -Removes `v`. The incident simplices of maximal dimension incident to -`v` are replaced by a single simplex of the same dimension. This -operation is exactly the reciprocal to `tds`.`insert_in_cell(v)` in -dimension 3, `tds`.`insert_in_facet(v)` in dimension 2, and -`tds`.`insert_in_edge(v)` in dimension 1. -\pre `tds`.`degree(v)` \f$ =\f$ `tds`.`dimension()+1`. +Removes `v`. The incident simplices of maximal dimension incident to +`v` are replaced by a single simplex of the same dimension. This +operation is exactly the reciprocal to `tds`.`insert_in_cell(v)` in +dimension 3, `tds`.`insert_in_facet(v)` in dimension 2, and +`tds`.`insert_in_edge(v)` in dimension 1. +\pre `tds`.`degree(v)` \f$ =\f$ `tds`.`dimension()+1`. -*/ -Cell_handle remove_from_maximal_dimension_simplex(Vertex_handle v); +*/ +Cell_handle remove_from_maximal_dimension_simplex(Vertex_handle v); -/// @} +/// @} -/// \name Dimension Manipulation +/// \name Dimension Manipulation /// The following operation, decrease_dimension, is necessary when the displacement of a vertex decreases the dimension of the triangulation. /// @{ /*! -The link of a vertex \f$ v\f$ is formed by the facets -disjoint from \f$ v\f$ that are included in the cells incident to \f$ v\f$. When the link of `v = c->vertex(i)` contains all the other vertices, `decrease_dimension` crushes the -triangulation of the sphere \f$ S^d\f$ of \f$ \mathbb{R}^{d+1}\f$ onto the -triangulation of the sphere \f$ S^{d-1}\f$ of \f$ \mathbb{R}^{d}\f$ formed by the link of `v` -augmented with the vertex `v` itself, for \f$ d\f$==2,3; this one is placed on the facet `(c, i)` -(see Fig. \ref TDS3dim_down). -\pre The dimension must be 2 or 3. The degree of `v` must be equal to the total number of vertices of the triangulation data structure minus 1. +The link of a vertex \f$ v\f$ is formed by the facets +disjoint from \f$ v\f$ that are included in the cells incident to \f$ v\f$. When the link of `v = c->vertex(i)` contains all the other vertices, `decrease_dimension` crushes the +triangulation of the sphere \f$ S^d\f$ of \f$ \mathbb{R}^{d+1}\f$ onto the +triangulation of the sphere \f$ S^{d-1}\f$ of \f$ \mathbb{R}^{d}\f$ formed by the link of `v` +augmented with the vertex `v` itself, for \f$ d\f$==2,3; this one is placed on the facet `(c, i)` +(see Fig. \ref TDS3dim_down). +\pre The dimension must be 2 or 3. The degree of `v` must be equal to the total number of vertices of the triangulation data structure minus 1. \anchor TDS3dim_down \image html tds-dim_down.png @@ -662,378 +662,378 @@ augmented with the vertex `v` itself, for \f$ d\f$==2,3; this one is placed on t structure (top: \f$ d==2\f$, bottom: \f$ d==3\f$). -*/ -void decrease_dimension(Cell_handle c, int i); +*/ +void decrease_dimension(Cell_handle c, int i); -/// @} +/// @} -/// \name Other modifiers +/// \name Other modifiers /// The following modifiers can affect the validity of the triangulation data structure. /// @{ /*! \cgalAdvancedFunction \cgalAdvancedBegin -Changes the orientation of all cells of the triangulation data structure. +Changes the orientation of all cells of the triangulation data structure. \cgalAdvancedEnd -\pre `tds`.`dimension()` \f$ \geq1\f$. -*/ -void reorient(); +\pre `tds`.`dimension()` \f$ \geq1\f$. +*/ +void reorient(); /*! \cgalAdvancedFunction \cgalAdvancedBegin -Adds a copy of the vertex `v` to the triangulation data structure. +Adds a copy of the vertex `v` to the triangulation data structure. \cgalAdvancedEnd -*/ -Vertex_handle create_vertex(const Vertex &v = Vertex()); +*/ +Vertex_handle create_vertex(const Vertex &v = Vertex()); /*! \cgalAdvancedFunction \cgalAdvancedBegin -Creates a vertex which is a copy of the one pointed to by `v` -and adds it to the triangulation data structure. +Creates a vertex which is a copy of the one pointed to by `v` +and adds it to the triangulation data structure. \cgalAdvancedEnd -*/ -Vertex_handle create_vertex(Vertex_handle v); +*/ +Vertex_handle create_vertex(Vertex_handle v); /*! \cgalAdvancedFunction \cgalAdvancedBegin -Adds a copy of the cell `c` to the triangulation data structure. +Adds a copy of the cell `c` to the triangulation data structure. \cgalAdvancedEnd -*/ -Cell_handle create_cell(const Cell &c = Cell()); +*/ +Cell_handle create_cell(const Cell &c = Cell()); /*! \cgalAdvancedFunction \cgalAdvancedBegin -Creates a cell which is a copy of the one pointed to by `c` -and adds it to the triangulation data structure. +Creates a cell which is a copy of the one pointed to by `c` +and adds it to the triangulation data structure. \cgalAdvancedEnd -*/ -Cell_handle create_cell(Cell_handle c); +*/ +Cell_handle create_cell(Cell_handle c); /*! \cgalAdvancedFunction \cgalAdvancedBegin -Creates a cell and adds it into the triangulation data -structure. Initializes the vertices of the cell, its neighbor handles +Creates a cell and adds it into the triangulation data +structure. Initializes the vertices of the cell, its neighbor handles being initialized with the default constructed handle. \cgalAdvancedEnd */ -Cell_handle create_cell(Vertex_handle v0, Vertex_handle v1, -Vertex_handle v2, Vertex_handle v3); +Cell_handle create_cell(Vertex_handle v0, Vertex_handle v1, +Vertex_handle v2, Vertex_handle v3); /*! \cgalAdvancedFunction \cgalAdvancedBegin -Creates a cell, initializes its vertices and neighbors, and adds it -into the triangulation data structure. +Creates a cell, initializes its vertices and neighbors, and adds it +into the triangulation data structure. \cgalAdvancedEnd -*/ -Cell_handle create_cell( Vertex_handle v0, Vertex_handle v1, -Vertex_handle v2, Vertex_handle v3, -Cell_handle n0, Cell_handle n1, -Cell_handle n2, Cell_handle n3); +*/ +Cell_handle create_cell( Vertex_handle v0, Vertex_handle v1, +Vertex_handle v2, Vertex_handle v3, +Cell_handle n0, Cell_handle n1, +Cell_handle n2, Cell_handle n3); /*! \cgalAdvancedFunction \cgalAdvancedBegin -Removes the vertex from the triangulation data structure. +Removes the vertex from the triangulation data structure. \cgalAdvancedEnd -\pre The vertex is a vertex of `tds`. -*/ -void delete_vertex( Vertex_handle v ); +\pre The vertex is a vertex of `tds`. +*/ +void delete_vertex( Vertex_handle v ); /*! \cgalAdvancedFunction \cgalAdvancedBegin -Removes the cell from the triangulation data structure. +Removes the cell from the triangulation data structure. \cgalAdvancedEnd \pre The cell is a cell of `tds`. -*/ -void delete_cell( Cell_handle c ); +*/ +void delete_cell( Cell_handle c ); /*! \cgalAdvancedFunction \cgalAdvancedBegin Calls `delete_vertex` over an iterator range of value type `Vertex_handle`. \cgalAdvancedEnd -*/ -template -void delete_vertices(VertexIt first, VertexIt last); +*/ +template +void delete_vertices(VertexIt first, VertexIt last); /*! \cgalAdvancedFunction \cgalAdvancedBegin -Calls `delete_cell` over an iterator range of value type `Cell_handle`. +Calls `delete_cell` over an iterator range of value type `Cell_handle`. \cgalAdvancedEnd -*/ -template -void delete_cells(CellIt first, CellIt last); +*/ +template +void delete_cells(CellIt first, CellIt last); -/// @} +/// @} -/// \name Traversing the triangulation +/// \name Traversing the triangulation /// @{ /*! -Returns `cells_end()` when `tds.dimension()` \f$ <3\f$. -*/ -Cell_iterator cells_begin() const; +Returns `cells_end()` when `tds.dimension()` \f$ <3\f$. +*/ +Cell_iterator cells_begin() const; /*! -*/ -Cell_iterator cells_end() const; +*/ +Cell_iterator cells_end() const; /*! -Low-level access to the cells, does not return `cells_end()` -when `tds.dimension()` \f$ <3\f$. -*/ -Cell_iterator raw_cells_begin() const; +Low-level access to the cells, does not return `cells_end()` +when `tds.dimension()` \f$ <3\f$. +*/ +Cell_iterator raw_cells_begin() const; /*! -*/ -Cell_iterator raw_cells_end() const; +*/ +Cell_iterator raw_cells_end() const; /*! -Returns `facets_end()` when `tds.dimension()` \f$ <2\f$. -*/ -Facet_iterator facets_begin() const; +Returns `facets_end()` when `tds.dimension()` \f$ <2\f$. +*/ +Facet_iterator facets_begin() const; /*! -*/ -Facet_iterator facets_end() const; +*/ +Facet_iterator facets_end() const; /*! -Returns `edges_end()` when `tds.dimension()` \f$ <1\f$. -*/ -Edge_iterator edges_begin() const; +Returns `edges_end()` when `tds.dimension()` \f$ <1\f$. +*/ +Edge_iterator edges_begin() const; /*! -*/ -Edge_iterator edges_end() const; +*/ +Edge_iterator edges_end() const; /*! -*/ -Vertex_iterator vertices_begin() const; +*/ +Vertex_iterator vertices_begin() const; /*! -*/ -Vertex_iterator vertices_end() const; +*/ +Vertex_iterator vertices_end() const; -/// @} +/// @} -/// \name Cell and facet circulators +/// \name Cell and facet circulators /// @{ /*! -Starts at an arbitrary cell incident to `e`. -\pre `tds.dimension()` \f$ =3\f$ -*/ -Cell_circulator incident_cells(const Edge & e) const; +Starts at an arbitrary cell incident to `e`. +\pre `tds.dimension()` \f$ =3\f$ +*/ +Cell_circulator incident_cells(const Edge & e) const; /*! -As above for edge `(i,j)` of `c`. -*/ -Cell_circulator incident_cells(Cell_handle c, int i, int j) const; +As above for edge `(i,j)` of `c`. +*/ +Cell_circulator incident_cells(Cell_handle c, int i, int j) const; /*! -Starts at cell `start`. -\pre `tds.dimension()` \f$ =3\f$ and `start` is incident to `e`. -*/ -Cell_circulator incident_cells(const Edge & e, Cell_handle start) const; +Starts at cell `start`. +\pre `tds.dimension()` \f$ =3\f$ and `start` is incident to `e`. +*/ +Cell_circulator incident_cells(const Edge & e, Cell_handle start) const; /*! -As above for edge `(i,j)` of `c`. -*/ -Cell_circulator incident_cells(Cell_handle c, int i, int j, Cell_handle start) -const; +As above for edge `(i,j)` of `c`. +*/ +Cell_circulator incident_cells(Cell_handle c, int i, int j, Cell_handle start) +const; /*! -Starts at an arbitrary facet incident to `e`. +Starts at an arbitrary facet incident to `e`. Only defined in dimension 3, though are defined also in dimension 2: there are only two facets sahring an edge in dimension 2. -\pre `tds.dimension()` \f$ =3\f$ -*/ -Facet_circulator incident_facets(Edge e) const; +\pre `tds.dimension()` \f$ =3\f$ +*/ +Facet_circulator incident_facets(Edge e) const; /*! -As above for edge `(i,j)` of `c`. +As above for edge `(i,j)` of `c`. Only defined in dimension 3, though are defined also in dimension 2: there are only two facets sahring an edge in dimension 2. -*/ -Facet_circulator incident_facets(Cell_handle c, int i, int j) const; +*/ +Facet_circulator incident_facets(Cell_handle c, int i, int j) const; /*! -Starts at facet `start`. +Starts at facet `start`. Only defined in dimension 3, though are defined also in dimension 2: there are only two facets sahring an edge in dimension 2. -\pre `start` is incident to `e`. -*/ -Facet_circulator incident_facets(Edge e, Facet start) const; +\pre `start` is incident to `e`. +*/ +Facet_circulator incident_facets(Edge e, Facet start) const; /*! -Starts at facet of index `f` in `start`. +Starts at facet of index `f` in `start`. Only defined in dimension 3, though are defined also in dimension 2: there are only two facets sahring an edge in dimension 2. -*/ -Facet_circulator incident_facets(Edge e, Cell_handle start, int f) const; +*/ +Facet_circulator incident_facets(Edge e, Cell_handle start, int f) const; /*! -As above for edge `(i,j)` of `c`. +As above for edge `(i,j)` of `c`. Only defined in dimension 3, though are defined also in dimension 2: there are only two facets sahring an edge in dimension 2. -*/ -Facet_circulator incident_facets(Cell_handle c, int i, int j, -Facet start) const; +*/ +Facet_circulator incident_facets(Cell_handle c, int i, int j, +Facet start) const; /*! -As above for edge `(i,j)` of `c` and facet `(start,f)`. +As above for edge `(i,j)` of `c` and facet `(start,f)`. Only defined in dimension 3, though are defined also in dimension 2: there are only two facets sahring an edge in dimension 2. -*/ -Facet_circulator incident_facets(Cell_handle c, int i, int j, -Cell_handle start, int f) const; +*/ +Facet_circulator incident_facets(Cell_handle c, int i, int j, +Cell_handle start, int f) const; -/// @} +/// @} /// \name Traversal of the incident cells, facets and edges, and the adjacent vertices of a given vertex /// @{ /*! -Copies the `Cell_handle`s of all cells incident to `v` to the -output iterator `cells`. -Returns the resulting output iterator. -\pre `tds.dimension()` \f$ =3\f$, `v` \f$ \neq\f$ `Vertex_handle()`, `tds.is_vertex(v)`. -*/ -template -OutputIterator -incident_cells(Vertex_handle v, OutputIterator cells) const; +Copies the `Cell_handle`s of all cells incident to `v` to the +output iterator `cells`. +Returns the resulting output iterator. +\pre `tds.dimension()` \f$ =3\f$, `v` \f$ \neq\f$ `Vertex_handle()`, `tds.is_vertex(v)`. +*/ +template +OutputIterator +incident_cells(Vertex_handle v, OutputIterator cells) const; /*! -Copies the `Facet`s incident to `v` to the output iterator -`facets`. -Returns the resulting output iterator. -\pre `tds.dimension()` \f$ >1\f$, `v` \f$ \neq\f$ `Vertex_handle()`, `tds.is_vertex(v)`. -*/ -template -OutputIterator -incident_facets(Vertex_handle v, OutputIterator facets) const; +Copies the `Facet`s incident to `v` to the output iterator +`facets`. +Returns the resulting output iterator. +\pre `tds.dimension()` \f$ >1\f$, `v` \f$ \neq\f$ `Vertex_handle()`, `tds.is_vertex(v)`. +*/ +template +OutputIterator +incident_facets(Vertex_handle v, OutputIterator facets) const; /*! -Copies all `Edge`s incident to `v` to the -output iterator `edges`. Returns the resulting output iterator. -\pre `tds.dimension()` \f$ >0\f$, `v` \f$ \neq\f$ `Vertex_handle()`, `tds.is_vertex(v)`. -*/ -template -OutputIterator -incident_edges(Vertex_handle v, OutputIterator edges) const; +Copies all `Edge`s incident to `v` to the +output iterator `edges`. Returns the resulting output iterator. +\pre `tds.dimension()` \f$ >0\f$, `v` \f$ \neq\f$ `Vertex_handle()`, `tds.is_vertex(v)`. +*/ +template +OutputIterator +incident_edges(Vertex_handle v, OutputIterator edges) const; /*! -Copies the `Vertex_handle`s of all vertices adjacent to `v` to the -output iterator `vertices`. If `tds.dimension()` \f$ <0\f$, then do -nothing. Returns the resulting output iterator. -\pre `v` \f$ \neq\f$ `Vertex_handle()`, `tds.is_vertex(v)`. -*/ -template -OutputIterator -adjacent_vertices(Vertex_handle v, OutputIterator vertices) const; +Copies the `Vertex_handle`s of all vertices adjacent to `v` to the +output iterator `vertices`. If `tds.dimension()` \f$ <0\f$, then do +nothing. Returns the resulting output iterator. +\pre `v` \f$ \neq\f$ `Vertex_handle()`, `tds.is_vertex(v)`. +*/ +template +OutputIterator +adjacent_vertices(Vertex_handle v, OutputIterator vertices) const; /*! -Returns the degree of a vertex, that is, the number of incident vertices. -\pre `v` \f$ \neq\f$ `Vertex_handle()`, `tds.is_vertex(v)`. -*/ -size_type degree(Vertex_handle v) const; +Returns the degree of a vertex, that is, the number of incident vertices. +\pre `v` \f$ \neq\f$ `Vertex_handle()`, `tds.is_vertex(v)`. +*/ +size_type degree(Vertex_handle v) const; -/// @} +/// @} -/// \name Traversal between adjacent cells +/// \name Traversal between adjacent cells /// @{ /*! -Returns the index of `c` in its \f$ i^{th}\f$ neighbor. -\pre \f$ i \in\{0, 1, 2, 3\}\f$. -*/ -int mirror_index(Cell_handle c, int i) const; +Returns the index of `c` in its \f$ i^{th}\f$ neighbor. +\pre \f$ i \in\{0, 1, 2, 3\}\f$. +*/ +int mirror_index(Cell_handle c, int i) const; /*! -Returns the vertex of the \f$ i^{th}\f$ neighbor of `c` that is opposite to -`c`. -\pre \f$ i \in\{0, 1, 2, 3\}\f$. -*/ -Vertex_handle mirror_vertex(Cell_handle c, int i) const; +Returns the vertex of the \f$ i^{th}\f$ neighbor of `c` that is opposite to +`c`. +\pre \f$ i \in\{0, 1, 2, 3\}\f$. +*/ +Vertex_handle mirror_vertex(Cell_handle c, int i) const; /*! -Returns the same facet seen from the other adjacent cell. -*/ -Facet mirror_facet(Facet f) const; +Returns the same facet seen from the other adjacent cell. +*/ +Facet mirror_facet(Facet f) const; -/// @} +/// @} -/// \name Checking +/// \name Checking /// @{ /*! \cgalDebugFunction \cgalDebugBegin -Checks the combinatorial validity of the triangulation by checking -the local validity of all its cells and vertices (see functions below). -(See Section \ref TDS3secintro.) Moreover, the Euler relation is -tested. +Checks the combinatorial validity of the triangulation by checking +the local validity of all its cells and vertices (see functions below). +(See Section \ref TDS3secintro.) Moreover, the Euler relation is +tested. -When `verbose` is set to `true`, messages are printed to give -a precise indication on the kind of invalidity encountered. +When `verbose` is set to `true`, messages are printed to give +a precise indication on the kind of invalidity encountered. \cgalDebugEnd -*/ -bool is_valid(bool verbose = false) const; +*/ +bool is_valid(bool verbose = false) const; /*! \cgalDebugFunction \cgalDebugBegin -Checks the local validity of the adjacency relations of the triangulation. -It also calls the `is_valid` member function of the vertex. -When `verbose` is set to `true`, messages are printed to give -a precise indication on the kind of invalidity encountered. +Checks the local validity of the adjacency relations of the triangulation. +It also calls the `is_valid` member function of the vertex. +When `verbose` is set to `true`, messages are printed to give +a precise indication on the kind of invalidity encountered. \cgalDebugEnd -*/ -bool is_valid(Vertex_handle v, bool verbose = false) const; +*/ +bool is_valid(Vertex_handle v, bool verbose = false) const; /*! \cgalDebugFunction \cgalDebugBegin -Checks the local validity of the adjacency relations of the triangulation. -It also calls the `is_valid` member function of the cell. -When `verbose` is set to `true`, messages are printed to give -a precise indication on the kind of invalidity encountered. +Checks the local validity of the adjacency relations of the triangulation. +It also calls the `is_valid` member function of the cell. +When `verbose` is set to `true`, messages are printed to give +a precise indication on the kind of invalidity encountered. \cgalDebugEnd -*/ -bool is_valid(Cell_handle c, bool verbose = false) const; +*/ +bool is_valid(Cell_handle c, bool verbose = false) const; /*! -Reads a combinatorial triangulation from `is` and assigns it to `tds` -*/ -istream& operator>> (istream& is, TriangulationDataStructure_3 & tds); +Reads a combinatorial triangulation from `is` and assigns it to `tds` +*/ +istream& operator>> (istream& is, TriangulationDataStructure_3 & tds); /*! -Writes `tds` into the stream `os` -*/ -ostream& operator<< (ostream& os, const TriangulationDataStructure_3 & tds); +Writes `tds` into the stream `os` +*/ +ostream& operator<< (ostream& os, const TriangulationDataStructure_3 & tds); /// @} @@ -1043,19 +1043,19 @@ ostream& operator<< (ostream& os, const TriangulationDataStructure_3 & tds); \ingroup PkgTDS3Concepts \cgalConcept -The concept `TriangulationDataStructure_3::Vertex` represents the vertex class of a 3D-triangulation -data structure. It must define -the types and operations listed in this section. Some of these -requirements are of geometric nature, they are optional -when using the triangulation data structure class alone. They become -compulsory when the triangulation data structure is used as a layer -for the geometric triangulation class. (See Section \ref TDS3secdesign.) +The concept `TriangulationDataStructure_3::Vertex` represents the vertex class of a 3D-triangulation +data structure. It must define +the types and operations listed in this section. Some of these +requirements are of geometric nature, they are optional +when using the triangulation data structure class alone. They become +compulsory when the triangulation data structure is used as a layer +for the geometric triangulation class. (See Section \ref TDS3secdesign.) \cgalHeading{Creation} -In order to obtain new vertices or destruct unused vertices, the user must -call the `create_vertex()` and `delete_vertex()` methods of the -triangulation data structure. +In order to obtain new vertices or destruct unused vertices, the user must +call the `create_vertex()` and `delete_vertex()` methods of the +triangulation data structure. \sa `TriangulationDataStructure_3::Cell` @@ -1063,7 +1063,7 @@ triangulation data structure. class TriangulationDataStructure_3::Vertex { public: -/// \name Types +/// \name Types /// The class `Vertex` defines types that are the same as some of the /// types defined by the triangulation data structure class /// `TriangulationDataStructure_3`. @@ -1071,72 +1071,72 @@ public: /*! Optional for the triangulation data structure alone. -*/ -typedef unspecified_type Point; +*/ +typedef unspecified_type Point; /*! -*/ -typedef TriangulationDataStructure_3 Triangulation_data_structure; +*/ +typedef TriangulationDataStructure_3 Triangulation_data_structure; /*! -*/ -typedef TriangulationDataStructure_3::Vertex_handle Vertex_handle; +*/ +typedef TriangulationDataStructure_3::Vertex_handle Vertex_handle; /*! -*/ -typedef TriangulationDataStructure_3::Cell_handle Cell_handle; +*/ +typedef TriangulationDataStructure_3::Cell_handle Cell_handle; -/// @} +/// @} -/// \name Access Functions +/// \name Access Functions /// @{ /*! -Returns a cell of the triangulation having `v` as vertex. -*/ -Cell_handle cell() const; +Returns a cell of the triangulation having `v` as vertex. +*/ +Cell_handle cell() const; /*! -Returns the point stored in the vertex. -Optional for the triangulation data structure alone. -*/ -Point point() const; +Returns the point stored in the vertex. +Optional for the triangulation data structure alone. +*/ +Point point() const; -/// @} +/// @} -/// \name Setting +/// \name Setting /// @{ /*! -Sets the incident cell to `c`. -*/ -void set_cell(Cell_handle c); +Sets the incident cell to `c`. +*/ +void set_cell(Cell_handle c); /*! -Sets the point to `p`. Optional for the -triangulation data structure alone. -*/ -void set_point(const Point & p); +Sets the point to `p`. Optional for the +triangulation data structure alone. +*/ +void set_point(const Point & p); -/// @} +/// @} -/// \name Checking +/// \name Checking /// @{ /*! \cgalDebugFunction \cgalDebugBegin -Checks the validity of the vertex. Must check that its incident cell -has this vertex. The validity of the base vertex is also checked. +Checks the validity of the vertex. Must check that its incident cell +has this vertex. The validity of the base vertex is also checked. -When `verbose` is set to `true`, messages are printed to give -a precise indication on the kind of invalidity encountered. +When `verbose` is set to `true`, messages are printed to give +a precise indication on the kind of invalidity encountered. \cgalDebugEnd -*/ -bool is_valid(bool verbose = false) const; +*/ +bool is_valid(bool verbose = false) const; /// @} @@ -1146,22 +1146,22 @@ bool is_valid(bool verbose = false) const; \ingroup PkgTDS3Concepts \cgalConcept -The concept `TriangulationDataStructure_3::Cell` stores -four `Vertex_handle`s to its four vertices and four `Cell_handle`s -to its four neighbors. The vertices are indexed 0, 1, 2, and 3 in consistent -order. The neighbor indexed \f$ i\f$ lies opposite to vertex `i`. +The concept `TriangulationDataStructure_3::Cell` stores +four `Vertex_handle`s to its four vertices and four `Cell_handle`s +to its four neighbors. The vertices are indexed 0, 1, 2, and 3 in consistent +order. The neighbor indexed \f$ i\f$ lies opposite to vertex `i`. -In degenerate dimensions, cells are used to store faces of maximal -dimension: in dimension 2, each cell represents only one -facet of index 3, and 3 edges \f$ (0,1)\f$, \f$ (1,2)\f$ and \f$ (2,0)\f$; in -dimension 1, each cell represents one edge \f$ (0,1)\f$. (See also -Section \ref TDS3secintro.) +In degenerate dimensions, cells are used to store faces of maximal +dimension: in dimension 2, each cell represents only one +facet of index 3, and 3 edges \f$ (0,1)\f$, \f$ (1,2)\f$ and \f$ (2,0)\f$; in +dimension 1, each cell represents one edge \f$ (0,1)\f$. (See also +Section \ref TDS3secintro.) \cgalHeading{Creation} -In order to obtain new cells or destruct unused cells, the user must call the -`create_cell()` and `delete_cell()` methods of the triangulation data -structure. +In order to obtain new cells or destruct unused cells, the user must call the +`create_cell()` and `delete_cell()` methods of the triangulation data +structure. \sa `TriangulationDataStructure_3::Vertex` \sa `TriangulationDataStructure_3::Cell_data` @@ -1171,115 +1171,115 @@ structure. class TriangulationDataStructure_3::Cell { public: -/// \name Types +/// \name Types /// @{ /*! -*/ -typedef TriangulationDataStructure_3 Triangulation_data_structure; +*/ +typedef TriangulationDataStructure_3 Triangulation_data_structure; /*! -*/ -typedef TriangulationDataStructure_3::Vertex_handle Vertex_handle; +*/ +typedef TriangulationDataStructure_3::Vertex_handle Vertex_handle; /*! -*/ -typedef TriangulationDataStructure_3::Cell_handle Cell_handle; +*/ +typedef TriangulationDataStructure_3::Cell_handle Cell_handle; /*! */ typedef TriangulationDataStructure_3::Cell_data TDS_data; -/// @} +/// @} -/// \name Access Functions +/// \name Access Functions /// @{ /*! -Returns the vertex `i` of `c`. -\pre \f$ i \in\{0, 1, 2, 3\}\f$. -*/ -Vertex_handle vertex(int i) const; +Returns the vertex `i` of `c`. +\pre \f$ i \in\{0, 1, 2, 3\}\f$. +*/ +Vertex_handle vertex(int i) const; /*! -Returns the index of vertex `v` in `c`. -\pre `v` is a vertex of `c`. -*/ -int index(Vertex_handle v) const; +Returns the index of vertex `v` in `c`. +\pre `v` is a vertex of `c`. +*/ +int index(Vertex_handle v) const; /*! -Returns `true` if `v` is a vertex of `c`. -*/ -bool has_vertex(Vertex_handle v) const; +Returns `true` if `v` is a vertex of `c`. +*/ +bool has_vertex(Vertex_handle v) const; /*! -Returns `true` if `v` is a vertex of `c`, and -computes its index `i` in `c`. -*/ -bool has_vertex(Vertex_handle v, int & i) const; +Returns `true` if `v` is a vertex of `c`, and +computes its index `i` in `c`. +*/ +bool has_vertex(Vertex_handle v, int & i) const; /*! -Returns the neighbor `i` of `c`. -\pre \f$ i \in\{0, 1, 2, 3\}\f$. -*/ -Cell_handle neighbor(int i) const; +Returns the neighbor `i` of `c`. +\pre \f$ i \in\{0, 1, 2, 3\}\f$. +*/ +Cell_handle neighbor(int i) const; /*! -Returns the index corresponding to neighboring cell `n`. -\pre `n` is a neighbor of `c`. -*/ -int index(Cell_handle n) const; +Returns the index corresponding to neighboring cell `n`. +\pre `n` is a neighbor of `c`. +*/ +int index(Cell_handle n) const; /*! -Returns `true` if `n` is a neighbor of `c`. -*/ -bool has_neighbor(Cell_handle n) const; +Returns `true` if `n` is a neighbor of `c`. +*/ +bool has_neighbor(Cell_handle n) const; /*! -Returns `true` if `n` is a neighbor of `c`, and -computes its index `i` in `c`. -*/ -bool has_neighbor(Cell_handle n, int & i) const; +Returns `true` if `n` is a neighbor of `c`, and +computes its index `i` in `c`. +*/ +bool has_neighbor(Cell_handle n, int & i) const; -/// @} +/// @} -/// \name Setting +/// \name Setting /// @{ /*! -Sets vertex `i` to `v`. -\pre \f$ i \in\{0, 1, 2, 3\}\f$. -*/ -void set_vertex(int i, Vertex_handle v); +Sets vertex `i` to `v`. +\pre \f$ i \in\{0, 1, 2, 3\}\f$. +*/ +void set_vertex(int i, Vertex_handle v); /*! -Sets the vertex pointers. -*/ -void set_vertices(Vertex_handle v0, -Vertex_handle v1, -Vertex_handle v2, -Vertex_handle v3); +Sets the vertex pointers. +*/ +void set_vertices(Vertex_handle v0, +Vertex_handle v1, +Vertex_handle v2, +Vertex_handle v3); /*! -Sets neighbor `i` to `n`. -\pre \f$ i \in\{0, 1, 2, 3\}\f$. -*/ -void set_neighbor(int i, Cell_handle n); +Sets neighbor `i` to `n`. +\pre \f$ i \in\{0, 1, 2, 3\}\f$. +*/ +void set_neighbor(int i, Cell_handle n); /*! -Sets the neighbors pointers. -*/ -void set_neighbors(Cell_handle n0, -Cell_handle n1, -Cell_handle n2, -Cell_handle n3); +Sets the neighbors pointers. +*/ +void set_neighbors(Cell_handle n0, +Cell_handle n1, +Cell_handle n2, +Cell_handle n3); -/// @} +/// @} /// \name Internal /// \cgalAdvancedBegin @@ -1301,7 +1301,7 @@ const TDS_data& tds_data() const; /// @} -/// \name Checking +/// \name Checking /// @{ /*! @@ -1309,8 +1309,8 @@ const TDS_data& tds_data() const; \cgalDebugBegin User defined local validity checking function. \cgalDebugEnd -*/ -bool is_valid(bool verbose = false, int level = 0) const; +*/ +bool is_valid(bool verbose = false, int level = 0) const; /// @} diff --git a/TDS_3/doc/TDS_3/PackageDescription.txt b/TDS_3/doc/TDS_3/PackageDescription.txt index 233f7bd329a..ee9b560977d 100644 --- a/TDS_3/doc/TDS_3/PackageDescription.txt +++ b/TDS_3/doc/TDS_3/PackageDescription.txt @@ -24,11 +24,11 @@ \cgalPkgDescriptionEnd The triangulation data structure is able to represent a -triangulation of a topological sphere \f$ S^d\f$ of \f$ \mathbb{R}^{d+1}\f$, for +triangulation of a topological sphere \f$ S^d\f$ of \f$ \mathbb{R}^{d+1}\f$, for \f$ d \in \{-1,0,1,2,3\}\f$. (See \ref TDS3secintro.) The vertex class of a 3D-triangulation data structure must define -a number of types and operations. +a number of types and operations. The requirements that are of geometric nature are required only when the triangulation data structure is used as a layer for the geometric triangulation classes. (See Section \ref TDS3secdesign.) @@ -41,7 +41,7 @@ The neighbor indexed \f$ i\f$ lies opposite to vertex `i`. In degenerate dimensions, cells are used to store faces of maximal dimension: in dimension 2, each cell represents only one facet of index 3, and 3 edges \f$ (0,1)\f$, \f$ (1,2)\f$ and \f$ (2,0)\f$; in -dimension 1, each cell represents one edge \f$ (0,1)\f$. (See +dimension 1, each cell represents one edge \f$ (0,1)\f$. (See Section \ref TDS3secintro.) \cgalClassifedRefPages diff --git a/TDS_3/doc/TDS_3/TriangulationDS_3.txt b/TDS_3/doc/TDS_3/TriangulationDS_3.txt index 557b45a4a24..2c84bad159b 100644 --- a/TDS_3/doc/TDS_3/TriangulationDS_3.txt +++ b/TDS_3/doc/TDS_3/TriangulationDS_3.txt @@ -1,7 +1,7 @@ \namespace CGAL { /*! -\mainpage User Manual +\mainpage User Manual \anchor Chapter_3D_Triangulation_Data_Structure \anchor chapterTDS3 @@ -19,7 +19,7 @@ triangulation of a set of points in \f$ \mathbb{R}^d\f$, \f$ d\leq 3\f$ is a par whole space \f$ \mathbb{R}^d\f$ into cells having \f$ d+1\f$ vertices. Some of them are infinite, they are obtained by linking an additional vertex at infinity to each facet of the convex hull of the points (see -Section \ref Triangulation3secintro). +Section \ref Triangulation3secintro). The underlying combinatorial graph of such a triangulation without boundary of \f$ \mathbb{R}^d\f$ can be seen as a triangulation of the topological sphere \f$ S^d\f$ in \f$ \mathbb{R}^{d+1}\f$. @@ -29,7 +29,7 @@ maintain the combinatorial information for 3D-geometric triangulations. The reader interested in geometric triangulations of \f$ \mathbb{R}^3\f$ is advised to read Chapter \ref chapterTriangulation3 "3D Triangulations". -\section TDS3secintro Representation +\section TDS3secintro Representation In \cgal, a 3D triangulation data structure is a container of cells (\f$ 3\f$-faces) and vertices (\f$ 0\f$-faces). @@ -46,7 +46,7 @@ cells, which is sufficient to retrieve all the incident cells when needed. The four vertices of a cell are indexed with 0, 1, 2 and 3. The -neighbors of a cell are also indexed with 0, 1, 2, 3 +neighbors of a cell are also indexed with 0, 1, 2, 3 in such a way that the neighbor indexed by \f$ i\f$ is opposite to the vertex with the same index (see \cgalFigureRef{TDS3figrepres}). @@ -72,9 +72,9 @@ Thus, a 3D-triangulation data structure can store a triangulation of a topological sphere \f$ S^d\f$ of \f$ \mathbb{R}^{d+1}\f$, for any \f$ d \in \{-1,0,1,2,3\}\f$. Let us give, for each dimension, the example corresponding to the -triangulation data structure having a minimal number of vertices, i.e.\ a +triangulation data structure having a minimal number of vertices, i.e.\ a simplex. These examples are illustrated by presenting their usual -geometric embedding. +geometric embedding.

  • dimension 3. The triangulation data structure consists of the boundary of a 4-dimensional simplex, which has 5 vertices. A @@ -114,7 +114,7 @@ combinatorially equivalent to the boundary of a 1-dimensional simplex (an edge), which consists of 2 vertices. One of them becomes infinite in the geometric embedding, and there is only one finite vertex remaining. The two vertices are adjacent. -
  • dimension -1. This dimension is a convention to represent a +
  • dimension -1. This dimension is a convention to represent a 0-dimensional simplex, that is a sole vertex, which will be geometrically embedded as an "empty" triangulation, having only one infinite vertex. @@ -140,13 +140,13 @@ dimension 1, each cell has one edge \f$ (0,1)\f$. Validity -A 3D combinatorial triangulation is said to be `locally valid` +A 3D combinatorial triangulation is said to be `locally valid` iff the following is true: (a) When a cell \f$ c\f$ has a neighbor pointer to another cell \f$ c'\f$, then reciprocally this cell \f$ c'\f$ has a neighbor pointer to \f$ c\f$, and \f$ c\f$ and \f$ c'\f$ have three vertices in common. These cells are called -adjacent. +adjacent. (b) The cells have a coherent orientation: if two cells \f$ c_1\f$ and \f$ c_2\f$ are adjacent and share a facet with vertices \f$ u,v,w\f$, then @@ -171,7 +171,7 @@ Coherent orientations of two cells (3-dimensional case). The method `Triangulation_data_structure_3::is_valid()` method checks the local validity of a given triangulation data structure. -\section TDS3secdesign Software Design +\section TDS3secdesign Software Design The 3D-triangulation data structure class of \cgal, `Triangulation_data_structure_3`, is designed to be used as a combinatorial @@ -225,7 +225,7 @@ the geometric versions typically used by the geometric layer, concepts `TriangulationCellBase_3` and `TriangulationVertexBase_3`.
-\subsection tds3cyclic Cyclic Dependency +\subsection tds3cyclic Cyclic Dependency Since adjacency relations are stored in the vertices and cells, it means that the vertex and cell base classes have to be able to store handles (an entity @@ -303,13 +303,13 @@ typedef Triangulation_vertex_base_3 Other; \subsection tds3parallel Parallel Operations -The third template parameter of `Triangulation_data_structure_3` is +The third template parameter of `Triangulation_data_structure_3` is `ConcurrencyTag`. It enables the use of a concurrent -container (`Concurrent_compact_container`) to store vertices and cells. -If it is `Parallel_tag`, then `create_vertex()`, `create_cell()`, `delete_vertex()` +container (`Concurrent_compact_container`) to store vertices and cells. +If it is `Parallel_tag`, then `create_vertex()`, `create_cell()`, `delete_vertex()` and `delete_cell()` can be called concurrently. -\section TDS3secexamples Examples +\section TDS3secexamples Examples \subsection TDS_3IncrementalConstruction Incremental Construction @@ -336,6 +336,6 @@ regarding the memory management. In 2013, Clément Jamin added the ability to create/delete vertices and cells in parallel. This feature is used by the parallel triangulation. -*/ +*/ } /* namespace CGAL */ diff --git a/TDS_3/test/TDS_3/include/CGAL/_test_cls_tds_cell.h b/TDS_3/test/TDS_3/include/CGAL/_test_cls_tds_cell.h index fb949a078fc..ac037a6b065 100644 --- a/TDS_3/test/TDS_3/include/CGAL/_test_cls_tds_cell.h +++ b/TDS_3/test/TDS_3/include/CGAL/_test_cls_tds_cell.h @@ -6,7 +6,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Rebufat Francois (Francois.Rebufat@sophia.inria.fr) diff --git a/Three/include/CGAL/Three/Viewer_interface.h b/Three/include/CGAL/Three/Viewer_interface.h index 0a4ceea06fb..8498ccb2fef 100644 --- a/Three/include/CGAL/Three/Viewer_interface.h +++ b/Three/include/CGAL/Three/Viewer_interface.h @@ -108,7 +108,7 @@ public: //! \param shared_widget the main viewer of the Application. This will share the //! context and allow synchronized rendering of multiple views. //! - Viewer_interface(QWidget* parent, QOpenGLWidget* shared_widget) + Viewer_interface(QWidget* parent, QOpenGLWidget* shared_widget) : QGLViewer(shared_widget->context(),parent){} virtual ~Viewer_interface() {} @@ -118,7 +118,7 @@ public: //! //! @returns true if the antialiasing is activated. virtual bool antiAliasing() const = 0; - + // Those two functions are defined in Viewer.cpp //! \brief Sets the position and orientation of a frame using a QString. //! \param s is usually gotten by dumpFrame() and is of the form "Px Py Pz O1 O2 O3 O4 ", with @@ -264,7 +264,7 @@ public Q_SLOTS: //! virtual void SetOrthoProjection( bool b) =0; public: - + //! Gives acces to recent openGL(4.3) features, allowing use of things like //! Geometry Shaders or Depth Textures. //! @returns a pointer to an initialized QOpenGLFunctions_4_3_Core if `isOpenGL_4_3()` is `true` @@ -277,7 +277,7 @@ public: virtual void setCurrentPass(int pass) = 0; virtual void setDepthWriting(bool writing_depth) = 0; virtual void setDepthPeelingFbo(QOpenGLFramebufferObject* fbo) = 0; - + virtual int currentPass()const = 0; virtual bool isDepthWriting()const = 0; virtual QOpenGLFramebufferObject* depthPeelingFbo() = 0; diff --git a/Triangulation/applications/Triangulation/CMakeLists.txt b/Triangulation/applications/Triangulation/CMakeLists.txt index eb9a2aee481..d185fab4fdc 100644 --- a/Triangulation/applications/Triangulation/CMakeLists.txt +++ b/Triangulation/applications/Triangulation/CMakeLists.txt @@ -10,7 +10,7 @@ find_package( CGAL QUIET COMPONENTS ) if ( NOT CGAL_FOUND ) message(STATUS "This project requires the CGAL library, and will not be compiled.") - return() + return() endif() @@ -21,11 +21,11 @@ if ( NOT Boost_FOUND ) message(STATUS "This project requires the Boost library, and will not be compiled.") - return() + return() endif() -find_package(Eigen3 3.1.0) +find_package(Eigen3 3.1.0) # include for local directory include_directories( BEFORE include ) diff --git a/Triangulation/benchmark/Triangulation/CMakeLists.txt b/Triangulation/benchmark/Triangulation/CMakeLists.txt index aa2d0cf578c..0e03f970220 100644 --- a/Triangulation/benchmark/Triangulation/CMakeLists.txt +++ b/Triangulation/benchmark/Triangulation/CMakeLists.txt @@ -13,8 +13,8 @@ if ( CGAL_FOUND ) include(${CGAL_USE_FILE}) - find_package(Eigen3 3.1.0) - if (EIGEN3_FOUND) + find_package(Eigen3 3.1.0) + if (EIGEN3_FOUND) include_directories (BEFORE "include") create_single_source_cgal_program( "delaunay.cpp" ) CGAL_target_use_Eigen(delaunay) diff --git a/Triangulation/examples/Triangulation/CMakeLists.txt b/Triangulation/examples/Triangulation/CMakeLists.txt index a528bd6a21c..7f8609612df 100644 --- a/Triangulation/examples/Triangulation/CMakeLists.txt +++ b/Triangulation/examples/Triangulation/CMakeLists.txt @@ -15,9 +15,9 @@ endif() find_package(CGAL QUIET) if ( CGAL_FOUND ) - - find_package(Eigen3 3.1.0) - if (EIGEN3_FOUND) + + find_package(Eigen3 3.1.0) + if (EIGEN3_FOUND) create_single_source_cgal_program( "barycentric_subdivision.cpp" ) create_single_source_cgal_program( "delaunay_triangulation.cpp" ) create_single_source_cgal_program( "convex_hull.cpp" ) @@ -41,8 +41,8 @@ if ( CGAL_FOUND ) endif() else() - + message(STATUS "This program requires the CGAL library, and will not be compiled.") - + endif() diff --git a/Triangulation/test/Triangulation/CMakeLists.txt b/Triangulation/test/Triangulation/CMakeLists.txt index 1a58eb9e81d..2aed902c338 100644 --- a/Triangulation/test/Triangulation/CMakeLists.txt +++ b/Triangulation/test/Triangulation/CMakeLists.txt @@ -13,9 +13,9 @@ endif() find_package(CGAL QUIET) if ( CGAL_FOUND ) - - find_package(Eigen3 3.1.0) - if (EIGEN3_FOUND) + + find_package(Eigen3 3.1.0) + if (EIGEN3_FOUND) include_directories (BEFORE "include") create_single_source_cgal_program( "test_triangulation.cpp" ) diff --git a/Triangulation_2/doc/Triangulation_2/CGAL/Constrained_Delaunay_triangulation_2.h b/Triangulation_2/doc/Triangulation_2/CGAL/Constrained_Delaunay_triangulation_2.h index 311210184b8..a66b36fa52b 100644 --- a/Triangulation_2/doc/Triangulation_2/CGAL/Constrained_Delaunay_triangulation_2.h +++ b/Triangulation_2/doc/Triangulation_2/CGAL/Constrained_Delaunay_triangulation_2.h @@ -16,20 +16,20 @@ triangulation is constrained Delaunay if the circumscribing circle of any of its triangular faces includes in its interior no vertex that is visible from the interior of the triangle. -As in the case of constrained triangulations, three different versions -of Delaunay constrained triangulations are offered -depending on whether the user wishes to handle -intersecting input constraints or not. +As in the case of constrained triangulations, three different versions +of Delaunay constrained triangulations are offered +depending on whether the user wishes to handle +intersecting input constraints or not. \tparam Traits is the geometric traits of a constrained Delaunay triangulation. -It must be a model of `DelaunayTriangulationTraits_2`, providing the `side_of_oriented_circle` test -of a Delaunay triangulation. -When intersection of input constraints are supported, -the geometric traits class -is required to provide additional function object types -to compute the intersection of two segments. -and has then to be also a model of the concept -`ConstrainedTriangulationTraits_2`. +It must be a model of `DelaunayTriangulationTraits_2`, providing the `side_of_oriented_circle` test +of a Delaunay triangulation. +When intersection of input constraints are supported, +the geometric traits class +is required to provide additional function object types +to compute the intersection of two segments. +and has then to be also a model of the concept +`ConstrainedTriangulationTraits_2`. \tparam Tds must be a model of `TriangulationDataStructure_2`or `Default`. @@ -49,83 +49,83 @@ constraints and is to be used in conjunction with an exact arithmetic type. -A constrained Delaunay triangulation is not a Delaunay -triangulation but it is a constrained triangulation. -Therefore the class `Constrained_Delaunay_triangulation_2` derives from -the class `Constrained_triangulation_2`. -Also, information about the status (constrained or not) -of the edges of the triangulation is stored -in the faces. -Thus the nested `Face` -type of a constrained triangulation offers -additional functionalities to deal with this information. -These additional functionalities -induce additional requirements on the base face class -plugged into the triangulation data structure of -a constrained Delaunay triangulation. -The base face of a constrained Delaunay triangulation -has to be a model of the concept -`ConstrainedTriangulationFaceBase_2`. +A constrained Delaunay triangulation is not a Delaunay +triangulation but it is a constrained triangulation. +Therefore the class `Constrained_Delaunay_triangulation_2` derives from +the class `Constrained_triangulation_2`. +Also, information about the status (constrained or not) +of the edges of the triangulation is stored +in the faces. +Thus the nested `Face` +type of a constrained triangulation offers +additional functionalities to deal with this information. +These additional functionalities +induce additional requirements on the base face class +plugged into the triangulation data structure of +a constrained Delaunay triangulation. +The base face of a constrained Delaunay triangulation +has to be a model of the concept +`ConstrainedTriangulationFaceBase_2`. -\cgal provides a default for the template parameters. -If `Gt` is the geometric traits -parameter, -the default for -`ConstrainedTriangulationFaceBase_2` is the class -`Constrained_triangulation_face_base_2` -and the default for the -triangulation data structure parameter is the class -`Triangulation_data_structure_2< CGAL::Triangulation_vertex_base_2, Constrained_triangulation_face_base_2 >`. +\cgal provides a default for the template parameters. +If `Gt` is the geometric traits +parameter, +the default for +`ConstrainedTriangulationFaceBase_2` is the class +`Constrained_triangulation_face_base_2` +and the default for the +triangulation data structure parameter is the class +`Triangulation_data_structure_2< CGAL::Triangulation_vertex_base_2, Constrained_triangulation_face_base_2 >`. The default intersection tag is `No_constraint_intersection_requiring_constructions_tag`. \cgalHeading{Types} -All types used in this class are inherited from the base class -`Constrained_triangulation_2`. +All types used in this class are inherited from the base class +`Constrained_triangulation_2`. -\sa `CGAL::Constrained_triangulation_2` -\sa `TriangulationDataStructure_2` -\sa `DelaunayTriangulationTraits_2` -\sa `ConstrainedTriangulationTraits_2` -\sa `ConstrainedDelaunayTriangulationTraits_2` -\sa `ConstrainedTriangulationFaceBase_2` +\sa `CGAL::Constrained_triangulation_2` +\sa `TriangulationDataStructure_2` +\sa `DelaunayTriangulationTraits_2` +\sa `ConstrainedTriangulationTraits_2` +\sa `ConstrainedDelaunayTriangulationTraits_2` +\sa `ConstrainedTriangulationFaceBase_2` */ template< typename Traits, typename Tds, typename Itag > class Constrained_Delaunay_triangulation_2 : public Constrained_triangulation_2 { public: -/// \name Creation +/// \name Creation /// @{ /*! -Introduces an empty constrained Delaunay triangulation `cdt`. -*/ -Constrained_Delaunay_triangulation_2(const Traits &t = Traits()); +Introduces an empty constrained Delaunay triangulation `cdt`. +*/ +Constrained_Delaunay_triangulation_2(const Traits &t = Traits()); /*! -Copy constructor: All faces and vertices -are duplicated and the constrained status of edges -is copied. -*/ -Constrained_Delaunay_triangulation_2(const -Constrained_Delaunay_triangulation_2& cdt1); +Copy constructor: All faces and vertices +are duplicated and the constrained status of edges +is copied. +*/ +Constrained_Delaunay_triangulation_2(const +Constrained_Delaunay_triangulation_2& cdt1); /*! Builds a constrained triangulation with constraints in the range `[first,last)` by calling `insert_constraints(first, last)`. -\tparam ConstraintIterator must be an `InputIterator` with the value type `std::pair` or `Segment`. -*/ -template Constrained_Delaunay_triangulation_2( -ConstraintIterator first, -ConstraintIterator last, -const Traits& t=Traits()); +\tparam ConstraintIterator must be an `InputIterator` with the value type `std::pair` or `Segment`. +*/ +template Constrained_Delaunay_triangulation_2( +ConstraintIterator first, +ConstraintIterator last, +const Traits& t=Traits()); -/// @} +/// @} -/// \name Insertion and Removal +/// \name Insertion and Removal /// The following member functions overwrite the corresponding members /// of the base class to include a step restoring the Delaunay /// constrained property after modification of the triangulation. @@ -133,32 +133,32 @@ const Traits& t=Traits()); /*! Inserts point `p` in the triangulation, with face -`f` as a hint for the location of `p`. -*/ -Vertex_handle insert(Point p, Face_handle f = Face_handle()); +`f` as a hint for the location of `p`. +*/ +Vertex_handle insert(Point p, Face_handle f = Face_handle()); /*! -Inserts point `p` in the triangulation at the location given by `(lt,loc,i)`. +Inserts point `p` in the triangulation at the location given by `(lt,loc,i)`. \sa `Triangulation_2::locate()` -*/ -Vertex_handle -insert(const Point& p, -Locate_type lt, -Face_handle loc, int li ); +*/ +Vertex_handle +insert(const Point& p, +Locate_type lt, +Face_handle loc, int li ); /*! -Equivalent to `insert(p)`. -*/ -Vertex_handle push_back(const Point& p); +Equivalent to `insert(p)`. +*/ +Vertex_handle push_back(const Point& p); /*! -Inserts the points in the range `[first,last)`. -Returns the number of inserted points. -\tparam PointIterator must be an `InputIterator` with the value type `Point`. -*/ -template < class PointIterator > -std::ptrdiff_t -insert(PointIterator first, PointIterator last); +Inserts the points in the range `[first,last)`. +Returns the number of inserted points. +\tparam PointIterator must be an `InputIterator` with the value type `Point`. +*/ +template < class PointIterator > +std::ptrdiff_t +insert(PointIterator first, PointIterator last); /*! inserts the points in the iterator range `[first,last)`. @@ -172,34 +172,34 @@ only one vertex is created, and one of the objects of type `Vertex::Info` will b \pre `Vertex` must be model of the concept `TriangulationVertexBaseWithInfo_2`. \tparam PointWithInfoIterator must be an `InputIterator` with the value type `std::pair`. -*/ +*/ template < class PointWithInfoIterator > std::ptrdiff_t insert(PointWithInfoIterator first, PointWithInfoIterator last); /*! -Inserts the line segment `ab` as a constraint in the triangulation. -*/ -void insert_constraint(Point a, Point b); +Inserts the line segment `ab` as a constraint in the triangulation. +*/ +void insert_constraint(Point a, Point b); /*! Inserts the line segment between the points `c.first` and `c.second` as a constraint in the triangulation. -*/ - void push_back(const std::pair& c); +*/ + void push_back(const std::pair& c); /*! -Inserts the line segment whose endpoints are the vertices `va` and -`vb` as a constraint in the triangulation. +Inserts the line segment whose endpoints are the vertices `va` and +`vb` as a constraint in the triangulation. \pre `va` != `vb`. -*/ -void insert_constraint(Vertex_handle va, Vertex_handle vb); +*/ +void insert_constraint(Vertex_handle va, Vertex_handle vb); /*! Inserts a polyline defined by the points in the range `[first,last)`. The polyline is considered as a polygon if the first and last point are equal or if `close = true`. This enables for example passing the vertex range of a `Polygon_2`. -\tparam PointIterator must be an `InputIterator` with the value type `Point`. +\tparam PointIterator must be an `InputIterator` with the value type `Point`. */ template < class PointIterator> void insert_constraint(PointIterator first, PointIterator last, bool close=false); @@ -233,24 +233,24 @@ std::size_t insert_constraints(PointIterator points_first, PointIterator points_ /*! -Removes vertex v. -\pre Vertex `v` is not incident to a constrained edge. -*/ -void remove(Vertex_handle & v); +Removes vertex v. +\pre Vertex `v` is not incident to a constrained edge. +*/ +void remove(Vertex_handle & v); /*! -Make the edges incident to vertex `v` unconstrained edges. -*/ -void remove_incident_constraints(Vertex_handle v); +Make the edges incident to vertex `v` unconstrained edges. +*/ +void remove_incident_constraints(Vertex_handle v); /*! -Make the edge `(f,i)` unconstrained. -*/ -void remove_constraint(const Face_handle & f, int i); +Make the edge `(f,i)` unconstrained. +*/ +void remove_constraint(const Face_handle & f, int i); -/// @} +/// @} -/// \name Queries +/// \name Queries /// The following template member functions query the set of faces in /// conflict with a point `p`. The notion of conflict refers here to a /// constrained Delaunay setting which means the @@ -264,93 +264,93 @@ void remove_constraint(const Face_handle & f, int i); outputs the faces and boundary edges of the conflict zone of point `p` into output iterators. -This function outputs in the container pointed to by `fit` -the faces which are in conflict with point `p`. -It outputs in the container pointed to by `eit` -the boundary of the zone in conflict with `p`. -The boundary edges -of the conflict zone are output in counterclockwise order -and each edge is described through its incident face -which is not in conflict with `p`. -The function returns in a `std::pair` the resulting output iterators. +This function outputs in the container pointed to by `fit` +the faces which are in conflict with point `p`. +It outputs in the container pointed to by `eit` +the boundary of the zone in conflict with `p`. +The boundary edges +of the conflict zone are output in counterclockwise order +and each edge is described through its incident face +which is not in conflict with `p`. +The function returns in a `std::pair` the resulting output iterators. \tparam OutItFaces is an `OutputIterator` with the value type `Face_handle`. -\tparam OutItBoundaryEdges is an `OutputIterator` with the value type `Edge`. +\tparam OutItBoundaryEdges is an `OutputIterator` with the value type `Edge`. -\pre `dimension()==2`. -*/ -template -std::pair -get_conflicts_and_boundary(const Point &p, -OutputItFaces fit, -OutputItBoundaryEdges eit, -Face_handle start) const; +\pre `dimension()==2`. +*/ +template +std::pair +get_conflicts_and_boundary(const Point &p, +OutputItFaces fit, +OutputItBoundaryEdges eit, +Face_handle start) const; /*! outputs the faces of the conflict zone of point `p` into an output iterator. -Same as `get_conflicts_and_boundary` except that only the faces in conflict with `p` -are output. The function returns the resulting output iterator. -\pre `dimension()==2`. -*/ -template -OutputItFaces -get_conflicts (const Point &p, -OutputItFaces fit, -Face_handle start) const; +Same as `get_conflicts_and_boundary` except that only the faces in conflict with `p` +are output. The function returns the resulting output iterator. +\pre `dimension()==2`. +*/ +template +OutputItFaces +get_conflicts (const Point &p, +OutputItFaces fit, +Face_handle start) const; /*! outputs the boundary edges of the conflict zone of point `p` into an output iterator. -This functions outputs in the container pointed to by `eit`, -the boundary of the zone in conflict with `p`. The boundary edges -of the conflict zone are output in counter-clockwise order -and each edge is described through the incident face -which is not in conflict with `p`. -The function returns the resulting output iterator. -\tparam OutputItBoundaryEdges is an `OutputIterator` with -the value type `Edge`. -*/ -template -OutputItBoundaryEdges -get_boundary_of_conflicts(const Point &p, -OutputItBoundaryEdges eit, -Face_handle start) const; +This functions outputs in the container pointed to by `eit`, +the boundary of the zone in conflict with `p`. The boundary edges +of the conflict zone are output in counter-clockwise order +and each edge is described through the incident face +which is not in conflict with `p`. +The function returns the resulting output iterator. +\tparam OutputItBoundaryEdges is an `OutputIterator` with +the value type `Edge`. +*/ +template +OutputItBoundaryEdges +get_boundary_of_conflicts(const Point &p, +OutputItBoundaryEdges eit, +Face_handle start) const; -/// @} +/// @} -/// \name Checking +/// \name Checking /// @{ /*! -checks if the triangulation is valid and if each constrained edge is -consistently marked constrained in its two incident faces. -*/ -bool is_valid() const; +checks if the triangulation is valid and if each constrained edge is +consistently marked constrained in its two incident faces. +*/ +bool is_valid() const; -/// @} +/// @} -/// \name Flips +/// \name Flips /// @{ /*! determines if edge `(f,i)` can be flipped. \cgalAdvancedBegin -Returns true if -edge `(f,i)` is not constrained and the circle circumscribing `f` -contains the vertex of `f->neighbor(i)` +Returns true if +edge `(f,i)` is not constrained and the circle circumscribing `f` +contains the vertex of `f->neighbor(i)` opposite to edge `(f,i)`. \cgalAdvancedEnd -*/ -bool is_flipable(Face_handle f, int i) const; +*/ +bool is_flipable(Face_handle f, int i) const; /*! \cgalAdvancedFunction \cgalAdvancedBegin -Flip `f` and `f->neighbor(i)`. +Flip `f` and `f->neighbor(i)`. \cgalAdvancedEnd -*/ -void flip(Face_handle& f, int i); +*/ +void flip(Face_handle& f, int i); /*! makes the triangulation constrained Delaunay by flipping @@ -363,8 +363,8 @@ triangulation that failed to be constrained Delaunay. (An edge is said to be constrained Delaunay if it is either constrained or locally Delaunay.) \cgalAdvancedEnd -*/ -void propagating_flip(List_edges & edges); +*/ +void propagating_flip(List_edges & edges); /// @} diff --git a/Triangulation_2/doc/Triangulation_2/CGAL/Constrained_triangulation_2.h b/Triangulation_2/doc/Triangulation_2/CGAL/Constrained_triangulation_2.h index 47f4a38c217..500f1f0ea9c 100644 --- a/Triangulation_2/doc/Triangulation_2/CGAL/Constrained_triangulation_2.h +++ b/Triangulation_2/doc/Triangulation_2/CGAL/Constrained_triangulation_2.h @@ -53,47 +53,47 @@ struct Exact_predicates_tag{}; /*! \ingroup PkgTriangulation2TriangulationClasses -A constrained triangulation is a triangulation of a set of points -which has to include among its edges +A constrained triangulation is a triangulation of a set of points +which has to include among its edges a given set of polylines joining the points. -The given polylines are -called *constraints* and the corresponding -edges in the triangulation are called *constrained edges*. +The given polylines are +called *constraints* and the corresponding +edges in the triangulation are called *constrained edges*. -The endpoints of constrained edges are of course vertices of the -triangulation. However the triangulation may include -other vertices as well. -There are three versions of constrained triangulations -
    -
  • In the basic version, the constrained triangulation -does not handle intersecting constraints, and the set of input -constraints is required to be a set of polylines that do not intersect +The endpoints of constrained edges are of course vertices of the +triangulation. However the triangulation may include +other vertices as well. +There are three versions of constrained triangulations +
      +
    • In the basic version, the constrained triangulation +does not handle intersecting constraints, and the set of input +constraints is required to be a set of polylines that do not intersect except possibly at their endpoints. An exception of type `Intersection_of_constraints_exception` is thrown upon insertion of a constraint intersecting in its interior an already inserted constraint. Any number of constrained edges may share the same endpoint. Constrained edges may be vertical or have zero length. -
    • The two other versions support intersecting input constraints. -In those versions, input constraints may consist of -intersecting, overlapping or partially -overlapping segments. -The triangulation introduces additional vertices at each point which -is a proper intersection point of two -constraints. A single constraint intersecting other -constraints will then appear as the union of several -constrained edges of the triangulation. -There are two ways to deal with intersecting constraints. -
        -
      • The first one is robust when predicates are evaluated exactly but -constructions (i. e. intersection computations) are -approximate. +
      • The two other versions support intersecting input constraints. +In those versions, input constraints may consist of +intersecting, overlapping or partially +overlapping segments. +The triangulation introduces additional vertices at each point which +is a proper intersection point of two +constraints. A single constraint intersecting other +constraints will then appear as the union of several +constrained edges of the triangulation. +There are two ways to deal with intersecting constraints. +
          +
        • The first one is robust when predicates are evaluated exactly but +constructions (i. e. intersection computations) are +approximate.
        • The second one should be used with exact arithmetic (meaning exact evaluation of predicates and exact computation of intersections.) -
        -
      +
    +
In order to retrieve the constrained edges of a constraint, or the constraints overlapping with a constrained edge, we provide the class `Constrained_triangulation_plus_2`. This class maintains @@ -105,14 +105,14 @@ as it avoids the cascading of intersection computations. \image html constraints.png \image latex constraints.png -\tparam Traits is a geometric traits class and must be a model -of the concept `TriangulationTraits_2`. -When intersection of input constraints are supported, -the geometric traits class -is required to provide additional function object types -to compute the intersection of two segments. -It has then to be a model of the concept -`ConstrainedTriangulationTraits_2`. +\tparam Traits is a geometric traits class and must be a model +of the concept `TriangulationTraits_2`. +When intersection of input constraints are supported, +the geometric traits class +is required to provide additional function object types +to compute the intersection of two segments. +It has then to be a model of the concept +`ConstrainedTriangulationTraits_2`. \tparam Tds must be a model of the concept `TriangulationDataStructure_2` or `Default`. The information about constrained edges is stored in the faces of the triangulation. Thus the nested `Face` @@ -144,36 +144,36 @@ The default intersection tag is `No_constraint_intersection_requiring_constructi \sa `CGAL::Triangulation_2` \sa `TriangulationDataStructure_2` -\sa `TriangulationTraits_2` -\sa `ConstrainedTriangulationTraits_2` -\sa `ConstrainedTriangulationFaceBase_2` +\sa `TriangulationTraits_2` +\sa `ConstrainedTriangulationTraits_2` +\sa `ConstrainedTriangulationFaceBase_2` \cgalHeading{Implementation} -The insertion of a constrained edge runs in time -proportional to the number of triangles intersected by this edge. +The insertion of a constrained edge runs in time +proportional to the number of triangles intersected by this edge. */ template< typename Traits, typename Tds, typename Itag > class Constrained_triangulation_2 : public Triangulation_2 { public: -/// \name Types +/// \name Types /// @{ -/*! +/*! \deprecated The type of constraints. -*/ -typedef std::pair Constraint; +*/ +typedef std::pair Constraint; -/*! -A bidirectional iterator to visit -all the edges `e` of the triangulation which are constrained. -The order of visit is undefined. -The value type of this iterator is `Edge`. -*/ -typedef unspecified_type Constrained_edges_iterator; +/*! +A bidirectional iterator to visit +all the edges `e` of the triangulation which are constrained. +The order of visit is undefined. +The value type of this iterator is `Edge`. +*/ +typedef unspecified_type Constrained_edges_iterator; /*! A range type to iterate over the constrained edges. @@ -181,177 +181,177 @@ A range type to iterate over the constrained edges. typedef Iterator_range Constrained_edges; /*! -The intersection tag which decides how -intersections between input constraints are dealt with. -*/ -typedef Itag Intersection_tag; +The intersection tag which decides how +intersections between input constraints are dealt with. +*/ +typedef Itag Intersection_tag; -/// @} +/// @} -/// \name Creation +/// \name Creation /// @{ /*! -%Default constructor. -*/ -Constrained_triangulation_2(); +%Default constructor. +*/ +Constrained_triangulation_2(); /*! -Copy constructor: All faces and vertices -are duplicated and the constrained status of edges -is copied. -*/ -Constrained_triangulation_2(const -Constrained_triangulation_2& ct1); +Copy constructor: All faces and vertices +are duplicated and the constrained status of edges +is copied. +*/ +Constrained_triangulation_2(const +Constrained_triangulation_2& ct1); -/// @} +/// @} -/// \name Queries +/// \name Queries /// @{ /*! -returns `true` if edge `e` is a constrained edge. -*/ -bool is_constrained(Edge e) const; +returns `true` if edge `e` is a constrained edge. +*/ +bool is_constrained(Edge e) const; /*! -returns `true` if at least one of the edges incident to vertex `v` -is constrained. -*/ -bool are_there_incident_constraints(Vertex_handle v) const; +returns `true` if at least one of the edges incident to vertex `v` +is constrained. +*/ +bool are_there_incident_constraints(Vertex_handle v) const; /*! -outputs the constrained edges incident to `v` -into the output iterator `out` and returns the resulting -output iterator. -\tparam OutputItEdges is an `OutputIterator` with `Edge` as value -type. -*/ -template -OutputItEdges incident_constraints(Vertex_handle v, -OutputItEdges out) const; +outputs the constrained edges incident to `v` +into the output iterator `out` and returns the resulting +output iterator. +\tparam OutputItEdges is an `OutputIterator` with `Edge` as value +type. +*/ +template +OutputItEdges incident_constraints(Vertex_handle v, +OutputItEdges out) const; /*! -returns an iterator that enumerates the constrained edges. +returns an iterator that enumerates the constrained edges. */ Constrained_edges_iterator constrained_edges_begin() const; /*! -returns the past-the-end iterator. -*/ +returns the past-the-end iterator. +*/ Constrained_edges_iterator constrained_edges_end() const; /*! returns a range of constrained edges. */ Constrained_edges constrained_edges() const; - -/// @} -/// \name Insertion and Removal +/// @} + +/// \name Insertion and Removal /// /// @{ /*! -inserts point `p` and restores the status (constrained or not) of all -the touched edges. If present, `f` is used as an hint -for the location of `p`. -*/ -Vertex_handle insert(Point p, Face_handle f = Face_handle() ); +inserts point `p` and restores the status (constrained or not) of all +the touched edges. If present, `f` is used as an hint +for the location of `p`. +*/ +Vertex_handle insert(Point p, Face_handle f = Face_handle() ); /*! -inserts point `p` in the triangulation at the location given by `(lt,loc,i)`. +inserts point `p` in the triangulation at the location given by `(lt,loc,i)`. \sa `Triangulation_2::locate()` -*/ -Vertex_handle -insert(const Point& p, -Locate_type& lt, -Face_handle loc, int li ); +*/ +Vertex_handle +insert(const Point& p, +Locate_type& lt, +Face_handle loc, int li ); /*! -Equivalent to `insert(p)`. -*/ -Vertex_handle push_back(const Point& p); +Equivalent to `insert(p)`. +*/ +Vertex_handle push_back(const Point& p); /*! -inserts points `a` and `b` in this order, and inserts the line segment `ab` as a -constraint. Removes the faces crossed by segment `ab` and creates new -faces instead. If a vertex `c` lies on segment `ab`, constraint `ab` is -replaced by the two constraints `ac` and `cb`. Apart from the insertion of -`a` and `b`, the algorithm runs in time proportional to the number of -removed triangles. -*/ -void insert_constraint(Point a, Point b); +inserts points `a` and `b` in this order, and inserts the line segment `ab` as a +constraint. Removes the faces crossed by segment `ab` and creates new +faces instead. If a vertex `c` lies on segment `ab`, constraint `ab` is +replaced by the two constraints `ac` and `cb`. Apart from the insertion of +`a` and `b`, the algorithm runs in time proportional to the number of +removed triangles. +*/ +void insert_constraint(Point a, Point b); /*! -Equivalent to `insert(c.first, c.second)`. -*/ - void push_back(const std::pair& c); +Equivalent to `insert(c.first, c.second)`. +*/ + void push_back(const std::pair& c); /*! -inserts the line segment `s` whose endpoints are the vertices -`va` and -`vb` as a constraint. The triangles intersected by `s` -are removed and new ones are created. -*/ -void insert_constraint(const Vertex_handle & va, const Vertex_handle & vb); +inserts the line segment `s` whose endpoints are the vertices +`va` and +`vb` as a constraint. The triangles intersected by `s` +are removed and new ones are created. +*/ +void insert_constraint(const Vertex_handle & va, const Vertex_handle & vb); /*! inserts a polyline defined by the points in the range `[first,last)`. The polyline is considered as a polygon if the first and last point are equal or if `close = true`. This enables for example passing the vertex range of a `Polygon_2`. -\tparam PointIterator must be an `InputIterator` with the value type `Point`. +\tparam PointIterator must be an `InputIterator` with the value type `Point`. */ template < class PointIterator> void insert_constraint(PointIterator first, PointIterator last, bool close=false); -/*! -removes a vertex `v`. -\pre Vertex `v` is not incident to a constrained edge. -*/ -void remove(Vertex_handle v); +/*! +removes a vertex `v`. +\pre Vertex `v` is not incident to a constrained edge. +*/ +void remove(Vertex_handle v); /*! -makes the edges incident to vertex `v` unconstrained edges. -*/ -void remove_incident_constraints(Vertex_handle v); +makes the edges incident to vertex `v` unconstrained edges. +*/ +void remove_incident_constraints(Vertex_handle v); /*! -makes edge `(f,i)` unconstrained. -*/ -void remove_constrained_edge(Face_handle f, int i); +makes edge `(f,i)` unconstrained. +*/ +void remove_constrained_edge(Face_handle f, int i); /*! checks the validity of the triangulation and the consistency of the constrained marks in edges. -*/ -bool -is_valid(bool verbose = false, int level = 0) const; +*/ +bool +is_valid(bool verbose = false, int level = 0) const; /// @} }; /* end Constrained_triangulation_2 */ /*! -writes the triangulation as for `Triangulation_2` and, for each face `f`, and integers `i=0,1,2`, -writes "C" or "N" depending whether edge -`(f,i)` is constrained or not. -\relates Constrained_triangulation_2 +writes the triangulation as for `Triangulation_2` and, for each face `f`, and integers `i=0,1,2`, +writes "C" or "N" depending whether edge +`(f,i)` is constrained or not. +\relates Constrained_triangulation_2 */ template -std::ostream & operator<<(std::ostream& os, const Constrained_triangulation_2 &ct); +std::ostream & operator<<(std::ostream& os, const Constrained_triangulation_2 &ct); /*! -reads a triangulation from stream `is` and assigns it to c`t`. Data in the stream must have the same format `operator<<` uses. -Note that `ct` is first cleared. -\relates Constrained_triangulation_2 +reads a triangulation from stream `is` and assigns it to c`t`. Data in the stream must have the same format `operator<<` uses. +Note that `ct` is first cleared. +\relates Constrained_triangulation_2 */ template -std::istream& operator>>(std::istream& is,Constrained_triangulation_2 Ct& ct); +std::istream& operator>>(std::istream& is,Constrained_triangulation_2 Ct& ct); /*! Exception used by constrained triangulations configured with the tags `No_constraint_intersection_tag` or `No_constraint_intersection_requiring_constructions_tag` diff --git a/Triangulation_2/doc/Triangulation_2/Triangulation_2.txt b/Triangulation_2/doc/Triangulation_2/Triangulation_2.txt index 9451f88be77..3c7e043b29a 100644 --- a/Triangulation_2/doc/Triangulation_2/Triangulation_2.txt +++ b/Triangulation_2/doc/Triangulation_2/Triangulation_2.txt @@ -1,7 +1,7 @@ namespace CGAL { /*! -\mainpage User Manual +\mainpage User Manual \anchor Chapter_2D_Triangulations \cgalAutoToc @@ -11,16 +11,16 @@ namespace CGAL { \image latex tr1dt1.png This chapter describes the two dimensional triangulations -of \cgal. +of \cgal. Section \ref Section_2D_Triangulations_Definitions recalls the main definitions about triangulations. Section \ref Section_2D_Triangulations_Representation discusses the way two-dimensional triangulations are represented in \cgal. Section \ref Section_2D_Triangulations_Software_Design presents the overall software -design of the 2D triangulations package. +design of the 2D triangulations package. The next sections present the different two dimensional triangulations classes -available in \cgal: +available in \cgal: basic triangulations (Section \ref Section_2D_Triangulations_Basic), Delaunay triangulations (Section \ref Section_2D_Triangulations_Delaunay), @@ -33,18 +33,18 @@ and constrained Delaunay triangulations Section \ref Section_2D_Triangulations_Constrained_Plus describes a class which implements a constrained or constrained Delaunay triangulation with -an additional data structure -to describe how the constraints are refined +an additional data structure +to describe how the constraints are refined by the edges of the triangulations. Section \ref Section_2D_Triangulations_Hierarchy describes a hierarchical data structure for fast point location queries. -At last, Section \ref Section_2D_Triangulations_Flexibility -explains how the user can benefit from the flexibility +At last, Section \ref Section_2D_Triangulations_Flexibility +explains how the user can benefit from the flexibility of \cgal triangulations using customized classes for faces and vertices. -\section Section_2D_Triangulations_Definitions Definitions +\section Section_2D_Triangulations_Definitions Definitions A two dimensional triangulation can be roughly described as a set \f$ T\f$ of triangular facets such that: @@ -52,40 +52,40 @@ of triangular facets such that: - two facets either are disjoint or share a lower dimensional face (edge or vertex). -- the set of facets in \f$ T\f$ is connected for the adjacency relation. +- the set of facets in \f$ T\f$ is connected for the adjacency relation. - the domain \f$ U_T\f$ which is the union of facets in \f$ T\f$ has no singularity. -More precisely, a triangulation can be described +More precisely, a triangulation can be described as a simplicial complex. Let us first record a few definitions. -A simplicial complex is a set \f$ T\f$ of simplices such that +A simplicial complex is a set \f$ T\f$ of simplices such that -- any face of a simplex in \f$ T\f$ is a simplex in \f$ T\f$ +- any face of a simplex in \f$ T\f$ is a simplex in \f$ T\f$ - two simplices in \f$ T\f$ either are disjoint or share a common sub-face. -The dimension \f$ d\f$ of a simplicial complex is the -maximal dimension of its simplices. +The dimension \f$ d\f$ of a simplicial complex is the +maximal dimension of its simplices. A simplicial complex \f$ T\f$ is pure if any simplex of \f$ T\f$ -is included in a simplex of \f$ T\f$ with maximal dimension. +is included in a simplex of \f$ T\f$ with maximal dimension. Two simplexes in \f$ T\f$ with maximal dimension \f$ d\f$ are said to be adjacent if they share a \f$ d-1\f$ dimensional sub-face. A simplicial complex is connected if the adjacency relation -defines a connected graph -over the set of simplices of \f$ T\f$ with maximal dimension. +defines a connected graph +over the set of simplices of \f$ T\f$ with maximal dimension. The union \f$ U_T\f$ of all simplices in \f$ T\f$ is called the domain of \f$ T\f$. -A point \f$ p\f$ in the domain of \f$ T\f$ is said to singular +A point \f$ p\f$ in the domain of \f$ T\f$ is said to singular if its surrounding in \f$ U_T\f$ is neither a topological ball nor a topological disc. -Then, a two dimensional triangulation can be described as a +Then, a two dimensional triangulation can be described as a two dimensional simplicial complex that is pure, connected and without singularity. @@ -94,14 +94,14 @@ which in turn induces an orientation on the edges incident to that facet. The orientation of two adjacent facets are said to be consistent if they induce opposite orientations on their common incident edge. -A triangulation is said to be orientable if +A triangulation is said to be orientable if the orientation of each facet can be chosen in such a way that all pairs of incident facets have consistent orientations. The data structure underlying \cgal triangulations -allows the user to represent the combinatorics of +allows the user to represent the combinatorics of any orientable two dimensional triangulations -without boundaries. +without boundaries. On top of this data structure, the 2D triangulations classes take care of the geometric embedding of the triangulation and are designed to handle planar triangulations. @@ -114,32 +114,32 @@ convex hull of their vertices. Because any planar triangulation can be completed, this is not a real restriction. For instance, a triangulation of a polygonal region can be -constructed and represented as a subset of a constrained triangulation -in which the region boundary edges have been input as +constructed and represented as a subset of a constrained triangulation +in which the region boundary edges have been input as constrained edges (see Section \ref Section_2D_Triangulations_Constrained, -\ref Section_2D_Triangulations_Constrained_Delaunay and +\ref Section_2D_Triangulations_Constrained_Delaunay and \ref Section_2D_Triangulations_Constrained_Plus). Strictly speaking, the term face should be used to design a face of any dimension, -and the two-dimensional faces of a triangulation +and the two-dimensional faces of a triangulation should be properly called facets. However, following a common usage, we hereafter often call faces, the facets of a two dimensional triangulation. -\section Section_2D_Triangulations_Representation Representation +\section Section_2D_Triangulations_Representation Representation \subsection Triangulation_2TheSetofFaces The Set of Faces -A 2D triangulation of \cgal can be viewed as a planar partition +A 2D triangulation of \cgal can be viewed as a planar partition whose bounded faces are triangular and cover -the convex hull of the set of vertices. +the convex hull of the set of vertices. The single unbounded face of this partition -is the complementary of the convex hull. +is the complementary of the convex hull. In many applications, such as Kirkpatrick's hierarchy or incremental Delaunay construction, it is convenient to -deal with only triangular faces. Therefore, +deal with only triangular faces. Therefore, a fictitious vertex, called the *infinite vertex* is added to the triangulation as well as *infinite edges* and *infinite faces* incident to it. @@ -155,7 +155,7 @@ equivalent to a two-dimensional sphere. This extends to lower dimensional triangulations arising in degenerate cases or when the triangulations as less than three vertices. -Including the infinite faces, +Including the infinite faces, a one dimensional triangulation is a ring of edges and vertices topologically equivalent to a \f$ 1\f$-sphere. @@ -185,16 +185,16 @@ saves storage space and results in faster algorithms \cgalCite{bdty-tcgal-00}. The basic elements of the representation are vertices and faces. -Each triangular face gives access to its three incident vertices -and to its three adjacent faces. +Each triangular face gives access to its three incident vertices +and to its three adjacent faces. Each vertex gives access to one of its incident faces and through that face to the circular list of its incident faces. The three vertices of a face are indexed with 0, 1 and 2 -in counterclockwise order. The neighbors of a face are also +in counterclockwise order. The neighbors of a face are also indexed with 0,1,2 in such a way that the neighbor indexed by `i` is opposite to the vertex with the same index. -See \cgalFigureRef{Triangulation_2D_Fig_neighbors1}, +See \cgalFigureRef{Triangulation_2D_Fig_neighbors1}, the functions `ccw(i)` and `cw(i)` shown on this figure compute respectively \f$ i+1\f$ and \f$ i-1\f$ modulo 3. @@ -203,21 +203,21 @@ The edges are not explicitly represented, they are only implicitly represented through the adjacency relations of two faces. Each edge has two implicit representations: the edge of a face `f` which is opposed to the vertex indexed `i`, -can be represented as well as an edge of the `neighbor(i)` of +can be represented as well as an edge of the `neighbor(i)` of `f`. \cgalFigureBegin{Triangulation_2D_Fig_neighbors1,rep_bis.png} Vertices and neighbors. \cgalFigureEnd -\section Section_2D_Triangulations_Software_Design Software Design +\section Section_2D_Triangulations_Software_Design Software Design -The triangulations classes of \cgal +The triangulations classes of \cgal provide high-level geometric functionalities such as location of a point in the triangulation, insertion, removal, or displacement of a point. They are build as a layer on top of a data structure called the triangulation data structure. -The triangulation data structure can be thought +The triangulation data structure can be thought of as a container for the faces and vertices of the triangulation. This data structure also takes care of all the combinatorial aspects of the triangulation. @@ -229,8 +229,8 @@ that the triangulation classes have two template parameters:
  • the first parameter stands for a -geometric traits class providing -the geometric primitives (points, segments and triangles) +geometric traits class providing +the geometric primitives (points, segments and triangles) of the triangulation and the elementary operations (predicate or constructions) on those objects. @@ -249,14 +249,14 @@ as a default model of triangulation data structure. The class `Triangulation_data_structure_2` has two template parameters standing for a vertex class and a face class. -\cgal defines concepts +\cgal defines concepts for these template parameters and provide default models for these concepts. The vertex and base classes are templated by the geometric traits class which enables them to obtain some knowledge of the geometric -primitives of the triangulation. +primitives of the triangulation. Those default vertex and face base classes -can be replaced by +can be replaced by user customized base classes in order, for example, to deal with additional properties attached to the vertices or faces of a triangulation. See Section \ref Section_2D_Triangulations_Flexibility @@ -272,58 +272,58 @@ forming this design. The triangulations software design. \cgalFigureEnd -The top triangulation level, responsible for the geometric -embedding of the triangulation comes in different flavors +The top triangulation level, responsible for the geometric +embedding of the triangulation comes in different flavors according to the different kind of triangulations: basic, Delaunay, regular, constrained or constrained Delaunay. Each kind of triangulations correspond to a different -class. +class. \cgalFigureRef{Triangulation_2D_Fig_derivation_tree} summarizes the derivation dependencies of \cgal 2D triangulations classes. Any 2D triangulation class is parametrized by a geometric traits class and a triangulation data structure. While a unique concept `TriangulationDataStructure_2` describes the triangulation data structure requirements -for any triangulation class, +for any triangulation class, the requirements on the geometric traits class actually depend on the triangulation class. -In general, the requirements for the vertex and face base classes +In general, the requirements for the vertex and face base classes are described by the basic concepts `TriangulationVertexBase_2` and `TriangulationFaceBase_2`. However, some triangulation classes require base classes implementing -refinements +refinements of the basic concepts. \cgalFigureBegin{Triangulation_2D_Fig_derivation_tree,derivation_tree.png} The derivation tree of 2D triangulations. \cgalFigureEnd -\section Section_2D_Triangulations_Basic Basic Triangulations +\section Section_2D_Triangulations_Basic Basic Triangulations -\subsection Subsection_2D_Triangulations_Basic_Description Description +\subsection Subsection_2D_Triangulations_Basic_Description Description The class `Triangulation_2` serves as a base class for the other 2D triangulations classes -and +and implements the user interface to a triangulation. -The vertices and faces of the triangulations are accessed through +The vertices and faces of the triangulations are accessed through `handles`, `iterators` and `circulators`. A handle is a model of the concept `Handle` which basically offers the two dereference operators `*` and `->`. A circulator is a type devoted to visit circular sequences. -Handles are used whenever the accessed element +Handles are used whenever the accessed element is not part of a sequence. Iterators and circulators are used to visit all or parts of the triangulation. The iterators and circulators are all bidirectional and non mutable. -The circulators and iterators are convertible to the -handles with the same value type, so that +The circulators and iterators are convertible to the +handles with the same value type, so that when calling a member function, any handle type argument can be replaced by an iterator or a circulator @@ -332,18 +332,18 @@ with the same value type. The triangulation class provides a function to visit the vertices and neighbors of a face in clockwise or counterclockwise order. -There are circulators -to visit the edges or faces -incident to a given vertex or the vertices +There are circulators +to visit the edges or faces +incident to a given vertex or the vertices adjacent to it. Another circulator type enables the visit of all the faces traversed by a given line. -Circulators step through infinite features as well as +Circulators step through infinite features as well as through finite ones. -The triangulation class offers -some iterators to visit all the -faces, edges or vertices and also iterators to visit +The triangulation class offers +some iterators to visit all the +faces, edges or vertices and also iterators to visit selectively the finite faces, edges or vertices. @@ -356,7 +356,7 @@ The triangulation class provides a method to locate a given point with respect to a triangulation. In particular, this method reports whether the point coincides with a vertex of the triangulation, lies on an edge, -in a face or outside of the convex hull. In case of a degenerate +in a face or outside of the convex hull. In case of a degenerate lower dimensional triangulation, the query point may also lie outside the triangulation affine hull. @@ -364,7 +364,7 @@ The triangulation class also provides methods to locate a point with respect to a given finite face of the triangulation or with respect to its circumcircle. -The faces of the triangulation and their circumcircles +The faces of the triangulation and their circumcircles have the counterclockwise orientation. The triangulation can be modified by several functions: @@ -405,7 +405,7 @@ if no optional argument is given. It takes time \f$ O(n)\f$ in the worst case for Delaunay Triangulations, but only \f$ O(\sqrt{n})\f$ on average if the vertices are distributed uniformly at random. The class `Triangulation_hierarchy_2`, -described in section \ref Section_2D_Triangulations_Hierarchy, +described in section \ref Section_2D_Triangulations_Hierarchy, implements a data structure designed to offer an alternate more efficient point location algorithm. @@ -423,7 +423,7 @@ re-triangulating the hole. Removal takes a time at most proportional to which is \f$ O(1)\f$ for a random vertex. Displacement of a vertex is done by: first, verifying if the triangulation embedding -remains planar after the displacement; if yes the vertex is directly placed at the new location; otherwise, a point is inserted at the new location +remains planar after the displacement; if yes the vertex is directly placed at the new location; otherwise, a point is inserted at the new location and the vertex at the obsolete location is removed. The face, edge, and vertex iterators on finite features @@ -431,36 +431,36 @@ are derived from their counterparts visiting all (finite and infinite) features which are themselves derived from the corresponding iterators of the triangulation data structure. -\subsection Subsubsection_2D_Triangulation_Basic_Geometric_Traits Geometric Traits +\subsection Subsubsection_2D_Triangulation_Basic_Geometric_Traits Geometric Traits -The geometric traits class of a triangulation +The geometric traits class of a triangulation is required to provide the geometric objects (points, segments and triangles) building up the triangulation together with the geometric predicates on those objects. -The required predicates are: +The required predicates are: - comparison of the `x` or `y` coordinates of two points. -- the orientation test which computes +- the orientation test which computes the order type of three given point. The concept -`TriangulationTraits_2` describes the requirements for the +`TriangulationTraits_2` describes the requirements for the geometric traits class of a triangulation. -The \cgal kernel classes +The \cgal kernel classes are models for this concept. The \cgal library also provides dedicated models -of `TriangulationTraits_2` +of `TriangulationTraits_2` using the kernel geometric objects and predicates. These classes are themselves templated with a \cgal kernel and extract the required types and predicates from the kernel. -The class `Projection_traits_xy_3` +The class `Projection_traits_xy_3` is a geometric traits class to build the triangulation of a terrain. Such a triangulation is a two-dimensional triangulation embedded in three dimensional space. The data points are three-dimensional points. -The triangulation is +The triangulation is build according to the projections of those points on the \f$ xy\f$ plane and then lifted up to the original three-dimensional data points. @@ -479,15 +479,15 @@ deal with projections on the `yz` plane and `xz`-plane, respectively. -\subsection Subsection_2D_Triangulations_Basic_Example Example of a Basic Triangulation +\subsection Subsection_2D_Triangulations_Basic_Example Example of a Basic Triangulation The following program creates a triangulation of 2D points -using the default kernel +using the default kernel `Exact_predicate_inexact_constructions_kernel` as geometric traits class and the default triangulation data structure. -The input points are read from a file +The input points are read from a file and inserted in the triangulation. -Finally points on the convex hull are written to cout. +Finally points on the convex hull are written to cout. \cgalExample{Triangulation_2/triangulation_prog1.cpp} \subsection Triangulation2Draw Draw a 2D Triangulation @@ -503,17 +503,17 @@ This function requires CGAL_Qt5, and is only available if the flag CGAL_USE_BASI Result of the run of the draw_triangulation_2 program. A window shows the 2D triangulation and allows to navigate through the scene. \cgalFigureEnd -\section Section_2D_Triangulations_Delaunay Delaunay Triangulations +\section Section_2D_Triangulations_Delaunay Delaunay Triangulations -\subsection Subsection_2D_Triangulations_Delaunay_Description Description +\subsection Subsection_2D_Triangulations_Delaunay_Description Description The class `Delaunay_triangulation_2` is designed to represent the Delaunay triangulation of a set of data points in the plane. A Delaunay triangulation fulfills -the following empty circle property +the following empty circle property (also called Delaunay property): the circumscribing -circle of any facet of the triangulation +circle of any facet of the triangulation contains no data point in its interior. For a point set with no subset of four co-circular points the Delaunay triangulation is unique, it is dual @@ -523,7 +523,7 @@ The class `Delaunay_triangulation_2` derives from the class `Triangulation_2`. The class `Delaunay_triangulation_2` -inherits the types defined by the +inherits the types defined by the basic class `Triangulation_2`. Additional types, provided by the traits class, are defined to represent the dual Voronoi diagram. @@ -536,7 +536,7 @@ to answer nearest neighbor queries and member functions to construct the elements (vertices and edges) of the dual Voronoi diagram. -Geometric Traits +Geometric Traits -------------- The geometric traits class has to be a model of the concept @@ -546,43 +546,43 @@ In particular this concept provides the `side_of_oriented_circle` predicate which, given four points `p,q,r,s` decides the position of the point \f$ s\f$ with respect to the circle -passing through \f$ p\f$, \f$ q\f$ and \f$ r\f$. +passing through \f$ p\f$, \f$ q\f$ and \f$ r\f$. The `side_of_oriented_circle` predicate actually defines the Delaunay triangulation. -Changing this predicate +Changing this predicate allows the user to build variant of Delaunay triangulations for different metrics such that \f$ L_1\f$ or \f$ L_{\infty}\f$ metric or any metric defined by a convex object. However, the user of an exotic metric -must be careful that the constructed triangulation +must be careful that the constructed triangulation has to be a triangulation of the convex hull which means that convex hull edges have to be Delaunay edges. This is granted for any smooth convex metric (like \f$ L_2\f$) and can be ensured for other metrics (like \f$ L_{\infty}\f$) by the addition to the point set of well chosen sentinel points. -The \cgal kernel classes +The \cgal kernel classes are models of the concept `DelaunayTriangulationTraits_2` for the Euclidean metric. The traits class for terrains, `Projection_traits_xy_3`, `Projection_traits_yz_3`, and -`Projection_traits_xz_3` +`Projection_traits_xz_3` are also models of `DelaunayTriangulationTraits_2` except that they do not fulfill the requirements for the duality functions and nearest vertex queries. -Implementation +Implementation -------------- The insertion of a new point in the Delaunay triangulation is performed using first the insertion member function -of the basic triangulation and second -performing a sequence of flips to restore the Delaunay property. +of the basic triangulation and second +performing a sequence of flips to restore the Delaunay property. The number of flips that have to be performed is \f$ O(d)\f$ if the new vertex has degree \f$ d\f$ in the updated Delaunay triangulation. For -points distributed uniformly at random, +points distributed uniformly at random, each insertion takes time \f$ O(1)\f$ on average, once the point has been located in the triangulation. @@ -598,9 +598,9 @@ for random points \cgalCite{d-vrtdd-09}. The displacement of a vertex \f$ v\f$ at a point \f$ p\f$ to a new location \f$ p'\f$, first checks whether the triangulation embedding remains planar or not after moving \f$ v\f$ to \f$ p'\f$. If yes, it moves \f$ v\f$ to \f$ p'\f$ and simply performs a sequence of flips -to restore the Delaunay property, which is \f$ O(d)\f$ where \f$ d\f$ is the degree of the vertex after the displacement. +to restore the Delaunay property, which is \f$ O(d)\f$ where \f$ d\f$ is the degree of the vertex after the displacement. Otherwise, the displacement is done by inserting a vertex at the new location, -and removing the obsolete vertex. +and removing the obsolete vertex. The complexity is \f$ O(n)\f$ in the worst case, but only \f$ O(1 + \delta \sqrt{n})\f$ for evenly distributed vertices in the unit square, where \f$ \delta\f$ is the Euclidean distance between the new and old locations. After having performed a point location, the @@ -608,20 +608,20 @@ nearest neighbor of a point is found in time \f$ O(n)\f$ in the worst case, but in time \f$ O(1)\f$ for vertices distributed uniformly at random and any query point. -\subsection Subsection_2D_Triangulations_Delaunay_Terrain Example: a Delaunay Terrain +\subsection Subsection_2D_Triangulations_Delaunay_Terrain Example: a Delaunay Terrain -The following code creates a Delaunay triangulation with -the usual Euclidean metric for the vertical projection of a +The following code creates a Delaunay triangulation with +the usual Euclidean metric for the vertical projection of a terrain model. The points have elevation, that is they are 3D points, but the predicates used to build the Delaunay triangulation -are computed using only the \f$ x\f$ and \f$ y\f$ coordinates +are computed using only the \f$ x\f$ and \f$ y\f$ coordinates of these points. The class `Projection_traits_xy_3` is part of the 2D and 3D Linear Geometric Kernel. \cgalExample{Triangulation_2/terrain.cpp} -\subsection Subsection_2D_Triangulations_Voronoi Example: Voronoi Diagram +\subsection Subsection_2D_Triangulations_Voronoi Example: Voronoi Diagram The following code computes the edges of Voronoi diagram of a set of data points @@ -629,9 +629,9 @@ and counts the number of finite edges and the number of rays of this diagram \cgalExample{Triangulation_2/voronoi.cpp} -\subsection Subsection_2D_Triangulations_Cropped_Voronoi Example: Print Voronoi Diagram Edges Restricted to a Rectangle +\subsection Subsection_2D_Triangulations_Cropped_Voronoi Example: Print Voronoi Diagram Edges Restricted to a Rectangle -The following code computes the Delaunay triangulation of a set of points and prints the Voronoi edges +The following code computes the Delaunay triangulation of a set of points and prints the Voronoi edges restricted to a given rectangle. \cgalFigureBegin{figurecropped_voronoi,cropped_voronoi.png} @@ -640,11 +640,11 @@ Voronoi diagram (in red) of the black points restricted to the blue rectangle. \cgalExample{Triangulation_2/print_cropped_voronoi.cpp} -\section Section_2D_Triangulations_Regular Regular Triangulations +\section Section_2D_Triangulations_Regular Regular Triangulations -\subsection Subsection_2D_Triangulations_Regular_Description Description +\subsection Subsection_2D_Triangulations_Regular_Description Description -Let \f$ { PW} = \{(p_i, w_i) | i = 1, \ldots , n \}\f$ be a set of +Let \f$ { PW} = \{(p_i, w_i) | i = 1, \ldots , n \}\f$ be a set of weighted points where each \f$ p_i\f$ is a point and each \f$ w_i\f$ is a scalar called the weight of point \f$ p_i\f$. Alternatively, each weighted point \f$ (p_i, w_i)\f$ can be regarded @@ -654,18 +654,18 @@ of \f$ p_i\f$) with center \f$ p_i\f$ and radius \f$ r_i=\sqrt{w_i}\f$. The power diagram of the set \f$ { PW}\f$ is a space partition in which each cell corresponds to a sphere \f$ (p_i, w_i)\f$ of \f$ { PW}\f$ and is the locus of points \f$ p\f$ whose power with respect to \f$ (p_i, w_i)\f$ -is less than its power with respect to any other sphere +is less than its power with respect to any other sphere in \f$ { PW}\f$. In the two-dimensional space, -the dual of this diagram is a triangulation -whose domain covers the convex hull of the set +the dual of this diagram is a triangulation +whose domain covers the convex hull of the set \f$ { P}= \{ p_i | i = 1, \ldots , n \}\f$ of center points and whose vertices form a subset of \f$ { P}\f$. Such a triangulation is called a regular triangulation. Three points \f$ p_i, p_j\f$ and \f$ p_k\f$ of \f$ { P}\f$ form a triangle in the regular triangulation of \f$ { PW}\f$ -iff there is a point \f$ p\f$ of the plane with equal +iff there is a point \f$ p\f$ of the plane with equal powers with respect to \f$ (p_i, w_i)\f$, \f$ (p_j, w_j)\f$ -and \f$ (p_k, w_k)\f$ and such that this power +and \f$ (p_k, w_k)\f$ and such that this power is less than the power of \f$ p\f$ with respect to any other sphere in \f$ { PW}\f$. @@ -673,7 +673,7 @@ Let us defined the power product of two weighted points \f$ (p_i, w_i)\f$ and \f$ (p_j, w_j)\f$ as: \f[ \Pi(p_i, w_i, p_j, w_j) = p_ip_j ^2 - w_i - w_j . \f] \f$ \Pi(p_i, w_i, p_j, 0)\f$ is simply the power of point \f$ p_j\f$ -with respect to the sphere \f$ (p_i, w_i)\f$, and two weighted points +with respect to the sphere \f$ (p_i, w_i)\f$, and two weighted points are said to be orthogonal if their power product is null. The power circle of three weighted points \f$ (p_i, w_i)\f$, \f$ (p_j, w_j)\f$ @@ -683,7 +683,7 @@ and \f$ (p_k, w_k)\f$ is defined as the unique circle and \f$ (p_k, w_k)\f$. The regular triangulation of the sets \f$ { PW}\f$ -satisfies the following regular property (which just reduces to the +satisfies the following regular property (which just reduces to the Delaunay property when all the weights are null): a triangle \f$ p_ip_jp_k\f$ is a face of the regular triangulation of \f$ { PW}\f$ iff the power product of any weighted point @@ -691,7 +691,7 @@ of \f$ { PW}\f$ iff the power product of any weighted point \f$ (p_i, w_i)\f$, \f$ (p_j, w_j)\f$ and \f$ (p_k, w_k)\f$ is positive or null. We call power test of \f$ (p_i, w_i)\f$, \f$ (p_j, w_j)\f$, \f$ (p_k, w_k)\f$, and \f$ (p_l, w_l)\f$, the predicates which amount to compute -the sign of +the sign of the power product of \f$ (p_l, w_l)\f$ with respect to the power circle of \f$ (p_i, w_i)\f$, \f$ (p_j, w_j)\f$ and \f$ (p_k, w_k)\f$. @@ -722,18 +722,18 @@ Alternatively, the regular triangulation of the weighted points set \f$ { PW}\f$ can be obtained as the projection on the two dimensional plane of the convex hull of the set of three -dimensional points +dimensional points \f$ { P'}= \{ (p_i,p_i ^2 - w_i ) | i = 1, \ldots , n \}\f$. The class `Regular_triangulation_2` is designed to maintain the regular triangulation of a set of \f$ 2d\f$ weighted points. It derives from the class `Triangulation_2`. -The functions `insert` and +The functions `insert` and `remove` are overwritten to handle weighted points and maintain the regular property. -The function `move()` is not +The function `move()` is not overwritten and thus does not preserve the regular property. The vertices of the regular triangulation of a set of weighted points \f$ {PW}\f$ correspond only to a subset @@ -745,14 +745,14 @@ triangulation. Such a point is called a hidden point. Because hidden points can reappear later on as vertices when some other point is removed, -they have to be stored somewhere. +they have to be stored somewhere. The regular triangulation store those points in special vertices, called -hidden vertices. +hidden vertices. A hidden point can reappear as vertex of the triangulation only when the two dimensional face that hides it is removed from the triangulation. To deal with this feature, each face of a regular triangulation stores a list of hidden vertices. -The points in those vertices +The points in those vertices are reinserted in the triangulation when the face is removed. @@ -764,7 +764,7 @@ the vertices and edges of the dual power diagrams. The geometric traits class of a regular triangulation must provide a weighted point type and a power test on these weighted points. -The concept +The concept `RegularTriangulationTraits_2`, is a refinement of the concept `TriangulationTraits_2`. All \cgal kernels are a model for the traits concept @@ -778,31 +778,31 @@ includes a Boolean data member to mark the hidden state of the vertex. Therefore \cgal defines the concept `RegularTriangulationVertexBase_2` which refine the concept `TriangulationVertexBase_2` -and provides a default model +and provides a default model for this concept. The face base type of a regular triangulation is required to provide a list of hidden vertices, designed to store the points hidden by the face. It has to be a model of the concept `RegularTriangulationFaceBase_2`. -\cgal provides the templated class +\cgal provides the templated class `Regular_triangulation_face_base_2` as a default base class for faces of regular triangulations. -\subsection Subsection_2D_Triangulations_Regular_Example Example: a Regular Triangulation +\subsection Subsection_2D_Triangulations_Regular_Example Example: a Regular Triangulation -The following code creates a regular triangulation +The following code creates a regular triangulation of a set of weighted points and output the number of vertices and the number of hidden vertices. \cgalExample{Triangulation_2/regular.cpp} -\section Section_2D_Triangulations_Constrained Constrained Triangulations +\section Section_2D_Triangulations_Constrained Constrained Triangulations A constrained triangulation is a triangulation of a set of points -that has to include among its edges +that has to include among its edges a given set of polylines joining the points. The -polylines are called *constraints*. The corresponding +polylines are called *constraints*. The corresponding edges are called *constrained edges*. The endpoints of constrained edges are of course vertices of the @@ -810,8 +810,8 @@ triangulation. However, the triangulation may include other vertices as well. There are three versions of constrained triangulations.
      -
    • In the basic version, the constrained triangulation -does not handle intersecting constraints, and the set of input +
    • In the basic version, the constrained triangulation +does not handle intersecting constraints, and the set of input constraints is required to be a set of segments that do not intersect, except possibly at their endpoints. Any number of constrained edges may share the same endpoint. Constrained edges may be vertical or @@ -820,7 +820,7 @@ have zero length. In those versions, input constraints may consist of intersecting, overlapping or partially overlapping segments. The triangulation introduces additional vertices at each point that -is the proper intersection point of two +is the proper intersection point of two constraints. A single constraint intersecting other constraints will then appear as several constrained edges in the triangulation. There are two ways to deal with intersecting constraints. @@ -861,10 +861,10 @@ from a list of pairs of points which represent the constraints. The class `Constrained_triangulation_2` overrides the insertion and removal of a point to take care of the -information about constrained edges. The class also allows the user +information about constrained edges. The class also allows the user online insertion of a new constraint, given as sequence of points, or the removal of a constraint. -In the current version, the function `move()` is not +In the current version, the function `move()` is not overwritten and thus does not handle vertices of constraints. In order to retrieve the constrained edges of a constraint, or @@ -880,8 +880,8 @@ as it avoids the cascading of intersection computations. The geometric traits class of a constraint triangulation has to be a model of the concept `TriangulationTraits_2`. -When intersections of input constraints are supported, -the geometric traits class has to be a model +When intersections of input constraints are supported, +the geometric traits class has to be a model of the concept `ConstrainedTriangulationTraits_2`, which refines the concept `TriangulationTraits_2` providing additional function object types @@ -889,7 +889,7 @@ to compute the intersection of two segments. \subsection Triangulation_2TheFaceBaseClassofaConstrained The Face Base Class of a Constrained Triangulation -The information about constrained edges is stored in the +The information about constrained edges is stored in the faces of the triangulation. The face base of a Constrained Triangulation has to be a model for the concept `ConstrainedTriangulationFaceBase_2` which refines the concept `TriangulationFaceBase_2`. @@ -909,7 +909,7 @@ Constrained and Constrained Delaunay triangulation: the constraining edges are t \cgalFigureEnd -\section Section_2D_Triangulations_Constrained_Delaunay Constrained Delaunay Triangulations +\section Section_2D_Triangulations_Constrained_Delaunay Constrained Delaunay Triangulations A constrained Delaunay triangulation is a triangulation with constrained edges which try to be as much Delaunay as possible. @@ -919,16 +919,16 @@ necessarily fulfill the empty circle property but they fulfill a weaker *constrained empty circle property*. To state this property, it is convenient to think of constrained -edges as blocking the view. Then, a triangulation is +edges as blocking the view. Then, a triangulation is constrained Delaunay iff the circumscribing circle -of any facet encloses +of any facet encloses no vertex visible from the interior of the facet. As in the case of constrained triangulations, three different versions of Delaunay constrained triangulations are provided. The first version handles a set of constraints which do not intersect except possibly -at the endpoints. The two other versions +at the endpoints. The two other versions handle intersecting input constraints. One of them is designed to be robust when used in conjunction with a geometric traits class @@ -942,7 +942,7 @@ The \cgal class is designed to represent constrained Delaunay triangulations. -As in the case of constrained triangulations, the third parameter +As in the case of constrained triangulations, the third parameter `Itag` is the intersection tag and serves to choose how intersecting constraints are dealt with. It can be instantiated with one of the following @@ -958,7 +958,7 @@ derives from the class `Constrained_triangulation_2`. The constrained Delaunay triangulation -has member functions to override the +has member functions to override the insertion and removal of a point or of a constraint. Each of those member functions takes care to restore @@ -967,13 +967,13 @@ property. \subsection Triangulation_2TheGeometricTraits_2 The Geometric Traits -The geometric traits class +The geometric traits class of a constrained Delaunay triangulation is required to provide the `side_of_oriented_circle` predicate as the geometric traits class of a Delaunay triangulation, and has to be a model of the concept `DelaunayTriangulationTraits_2`. When intersecting input constraints -is supported, the geometric traits class is further required +is supported, the geometric traits class is further required to provide function objects to compute constraints intersections. Then, the geometric traits class has to be at the same time a model of the concept `ConstrainedTriangulationTraits_2`. @@ -987,19 +987,19 @@ and the face base class of a constrained Delaunay triangulation has to be a model of `ConstrainedTriangulationFaceBase_2`. -\subsection Subsection_2D_Triangulations_Constrained_Delaunay_Example Example: a Constrained Delaunay Triangulation +\subsection Subsection_2D_Triangulations_Constrained_Delaunay_Example Example: a Constrained Delaunay Triangulation The following code inserts a set of intersecting constraint segments -into a triangulation +into a triangulation and counts the number of constrained edges of the resulting triangulation. \cgalExample{Triangulation_2/constrained.cpp} -\subsection Subsection_2D_Triangulations_Polygon_triangulation Example: Triangulating a Polygonal Domain +\subsection Subsection_2D_Triangulations_Polygon_triangulation Example: Triangulating a Polygonal Domain The following code inserts two nested polygons into a constrained Delaunay triangulation and counts the number of facets that -are inside the domain delimited by these polygons. Note that the following code does not work if the +are inside the domain delimited by these polygons. Note that the following code does not work if the boundaries of the polygons intersect. \cgalFigureBegin{figuretri_domain,tri_domain.png} @@ -1012,7 +1012,7 @@ Triangulation (in blue) of the domain delimited by the red polygons. The class `Constrained_triangulation_plus_2` provides a constrained triangulation with an additional data -structure +structure that keeps track of the input constraints and of their refinement in the triangulation. The class `Constrained_triangulation_plus_2` @@ -1047,7 +1047,7 @@ For a pair `(fh,i)` it is the edge of the face `*fh`, which is opposite to the ` A constrained edge `e` is an edge of a constrained triangulation `ct`, for which `ct.is_constrained(e)` returns `true`. A constraint is a polyline which is given as input (in the simplest case just a segment), and -which is split into constrained edges in the triangulation. +which is split into constrained edges in the triangulation. The type `Subconstraint` is defined as `typedef std::pair Subconstraint`. The two vertex handles must be the vertices of a constrained edge. @@ -1061,7 +1061,7 @@ and offer a `Constrained_edges_iterator`. The class `Constrained_triangulation_plus_2` additionally provides the means to - traverse all the constraints of the triangulation using an iterator of type `Constraint_iterator` the value type of which is `Constraint_id`, - obtain all constraints that induce a constrained edge or a subconstraint, -- traverse the sequence of vertices of a constraint using an iterator of type `Vertices_in_constraint_iterator`, the value type of which is `Vertex_handle` +- traverse the sequence of vertices of a constraint using an iterator of type `Vertices_in_constraint_iterator`, the value type of which is `Vertex_handle` - traverse the subconstraints in the triangulation using an iterator of type `Subconstraint_iterator`, the value type of which is `Subconstraint`. Note that the `Constrained_edges_iterator` and the `Subconstraint_iterator` are quite similar. @@ -1108,8 +1108,8 @@ define an input segment that induce `e`. The following code inserts two polyline constraints into a triangulation. Note that if the triangulation supports intersections we can have arbitrary complicated overlapping polylines. They can share -any number of edges, and a polyline may pass several times through -the same edge. +any number of edges, and a polyline may pass several times through +the same edge. @@ -1117,21 +1117,21 @@ For an edge we can further find out how many and which polyline constraints pass through it. For an edge we can obtain an iterator range with value type `Constrained_triangulation_plus_2::Context`. From a context we can obtain the `Constrained_triangulation_plus_2::Constraint_id`, and an iterator -pointing at the vertex in the polyline constraint that passes +pointing at the vertex in the polyline constraint that passes through the edge. \cgalExample{Triangulation_2/polylines_triangulation.cpp} -\section Section_2D_Triangulations_Hierarchy The Triangulation Hierarchy +\section Section_2D_Triangulations_Hierarchy The Triangulation Hierarchy The class `Triangulation_hierarchy_2` implements a triangulation augmented with a data structure to efficiently answer point location queries. -The data structure is a hierarchy +The data structure is a hierarchy of triangulations. The triangulation at the lowest level is -the original triangulation where operations and point location are to +the original triangulation where operations and point location are to be performed. Then at each succeeding level, the data structure stores a triangulation of a small random sample of the vertices @@ -1144,7 +1144,7 @@ is found through a linear walk performed from the nearest neighbor found at the preceding level. Because the number of vertices in each triangulation is only a small fraction of the number of vertices of the preceding triangulation, -the data structure remains small and achieves fast point location +the data structure remains small and achieves fast point location queries on real data. As proved in \cgalCite{d-iirdt-98}, this structure has an optimal behavior when it is built for Delaunay triangulations. @@ -1154,7 +1154,7 @@ which is to be instantiated by one of the \cgal triangulation classes. The class `Triangulation_hierarchy_2` inherits from the -triangulation type passed as template parameter `Tr`. +triangulation type passed as template parameter `Tr`. The `insert`, `move`, and `remove` member functions are overwritten to update the data structure at each operation. The locate queries are also overwritten to take advantage of the data @@ -1162,30 +1162,30 @@ structure for a fast processing. \subsection Triangulation_2TheVertexofaTriangulation The Vertex of a Triangulation Hierarchy -The base vertex class of a triangulation hierarchy +The base vertex class of a triangulation hierarchy has to be a model of the concept `TriangulationHierarchyVertexBase_2` which extends the concept `TriangulationVertexBase_2`. This extension adds -access and setting member functions -for two pointers to the corresponding vertices in the +access and setting member functions +for two pointers to the corresponding vertices in the triangulations of the next and preceding levels. \cgal provides the class `Triangulation_hierarchy_vertex_base_2` -which is a model for the concept +which is a model for the concept `TriangulationHierarchyVertexBase_2`. This class is templated by a parameter `Vb` which is to be instantiated by a model of the concept `TriangulationVertexBase_2`. The class `Triangulation_hierarchy_vertex_base_2` inherits from its template parameter `Vb`. -This design enables the usage of +This design enables the usage of either the default vertex class or a user customized vertex class with additional functionalities for `Vb`. -\subsection Subsection_2D_Triangulations_Hierarchy_Examples Examples For the Use of a Triangulation Hierarchy +\subsection Subsection_2D_Triangulations_Hierarchy_Examples Examples For the Use of a Triangulation Hierarchy The following program is an example for the standard use of a triangulation hierarchy @@ -1202,7 +1202,7 @@ a triangulation hierarchy in conjunction with a constrained triangulation with a -\section Section_2D_Triangulations_Flexibility Flexibility +\section Section_2D_Triangulations_Flexibility Flexibility \subsection Triangulation_2UsingCustomizedVerticesand Using Customized Vertices and Faces @@ -1216,7 +1216,7 @@ which the user can instantiate with his own customized classes. The most useful flexibility however comes from the fact that the triangulation data structure itself has two template -parameters to be instantiated by +parameters to be instantiated by classes for the vertices and faces of the triangulation. Using his own customized classes to instantiate these parameters, the user can easily build up a triangulation with additional @@ -1236,23 +1236,23 @@ structure, and there is a cyclic dependency on template parameter. The cyclic dependency in triangulations software design. \cgalFigureEnd -Previously, this cyclic dependency was avoided by +Previously, this cyclic dependency was avoided by using only `void*` pointers in the interface of base classes. These `void*` were converted to appropriate types at the triangulation data structure levels. This solution had some drawbacks -: mainly the user could not add in the vertices or faces of the -triangulation a functionality related to types defined by +: mainly the user could not add in the vertices or faces of the +triangulation a functionality related to types defined by the triangulation data structure, for instance a handle to a vertex, -and he was lead to use himself +and he was lead to use himself `void*` pointers). The new solution to resolve the template dependency -is based on a rebind mechanism similar to the mechanism used in the +is based on a rebind mechanism similar to the mechanism used in the standard allocator class std::allocator. The rebind mechanism -is described in Section \ref TDS_2D_default "The Default Triangulation Data Structure" +is described in Section \ref TDS_2D_default "The Default Triangulation Data Structure" of Chapter \ref Chapter_2D_Triangulation_Data_Structure "2D Triangulation Data Structure". For now, we will just notice that the design requires -the existence in the vertex and face base classes +the existence in the vertex and face base classes of a nested template class `Rebind_TDS` defining a type `Other` used by the rebinding mechanism. @@ -1263,17 +1263,17 @@ base classes parameters. \subsection Triangulation_2AddingColors Adding Colors -The first example corresponds to a case where the user wishes to add in +The first example corresponds to a case where the user wishes to add in the vertices or faces of the triangulation an additional information that does not depend on types provided -by the triangulation data structure. +by the triangulation data structure. In that case, predefined classes `Triangulation_vertex_base_with_info_2` or `Triangulation_face_base_with_info_2` can be used. Those classes have a template parameter `Info` devoted to handle additional information. -The following example shows how to add a +The following example shows how to add a `Color` in the triangulation faces. \cgalExample{Triangulation_2/colored_face.cpp} @@ -1287,8 +1287,8 @@ The second example adds a `std::string` in the vertices of a terrain. \subsection Triangulation_2AddingHandles Adding Handles This example shows how the user can still -derive and plug in his own vertex -or face class when he would like to have +derive and plug in his own vertex +or face class when he would like to have additional functionalities depending on types provided by the triangulation data structure. @@ -1300,10 +1300,10 @@ The most efficient method to insert (weighted) points in a Delaunay (or regular) triangulation is to provide an iterator range over (weighted) points to the insert function. However, an iterator range of (weighted) points does not allow the user to set different information to each vertex. -To solve this problem, in the case the vertex type of the triangulation +To solve this problem, in the case the vertex type of the triangulation is a model of the concept `TriangulationVertexBaseWithInfo_2` -(such as `Triangulation_vertex_base_with_info_2`), we provide three examples -doing the same operation: set an unsigned integer as the information +(such as `Triangulation_vertex_base_with_info_2`), we provide three examples +doing the same operation: set an unsigned integer as the information of each vertex. The value of this unsigned integer is the initial order of the corresponding point given in the range. @@ -1333,10 +1333,10 @@ is dereferenced only once per point during the insertion. The code of this package is the result of a long development process. Here follows a tentative list of people who added their stone to this package: -Jean-Daniel Boissonnat, Hervé Brönnimann, +Jean-Daniel Boissonnat, Hervé Brönnimann, Olivier Devillers, Andreas Fabri, Frédéric Fichel, Julia Flötotto, Monique Teillaud and Mariette Yvinec. -*/ +*/ } /* namespace CGAL */ diff --git a/Triangulation_2/include/CGAL/Constrained_triangulation_2.h b/Triangulation_2/include/CGAL/Constrained_triangulation_2.h index 48ab6cc3111..272aec6a330 100644 --- a/Triangulation_2/include/CGAL/Constrained_triangulation_2.h +++ b/Triangulation_2/include/CGAL/Constrained_triangulation_2.h @@ -6,7 +6,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Mariette Yvinec, Jean-Daniel Boissonnat @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include #include @@ -60,10 +60,10 @@ struct Itag { } // namespace internal -template < class Gt, +template < class Gt, class Tds_ = Default , class Itag_ = Default > -class Constrained_triangulation_2 +class Constrained_triangulation_2 : public Triangulation_2, @@ -79,7 +79,7 @@ public: typedef Triangulation_2 Triangulation; typedef Constrained_triangulation_2 Constrained_triangulation; - + typedef typename Triangulation::Edge Edge; typedef typename Triangulation::Vertex Vertex; typedef typename Triangulation::Vertex_handle Vertex_handle; @@ -184,12 +184,12 @@ public: template Constrained_triangulation_2(InputIterator it, - InputIterator last, - const Gt& gt=Gt() ) + InputIterator last, + const Gt& gt=Gt() ) : Triangulation_2(gt) { for ( ; it != last; it++) { - insert_constraint((*it).first, (*it).second); + insert_constraint((*it).first, (*it).second); } CGAL_triangulation_postcondition( is_valid() ); } @@ -218,14 +218,14 @@ public: { return Constrained_edges(constrained_edges_begin(),constrained_edges_end()); } - + // INSERTION - Vertex_handle insert(const Point& p, - Face_handle start = Face_handle() ); Vertex_handle insert(const Point& p, - Locate_type lt, - Face_handle loc, - int li ); + Face_handle start = Face_handle() ); + Vertex_handle insert(const Point& p, + Locate_type lt, + Face_handle loc, + int li ); Vertex_handle push_back(const Point& a); // template < class InputIterator > // std::ptrdiff_t insert(InputIterator first, InputIterator last); @@ -239,7 +239,7 @@ public: template void get_bounded_faces(InputIterator edge_it, InputIterator edge_pteit, - OutputIterator faces_it) const + OutputIterator faces_it) const { Edge e; Unique_hash_map visited; @@ -254,16 +254,16 @@ public: while(! st.empty()){ Face_handle fh = st.top(); st.pop(); - typename CGAL::Unique_hash_map::Data& data = visited[fh]; + typename CGAL::Unique_hash_map::Data& data = visited[fh]; if(! data) { - data = true; - *faces_it++ = fh; - for(int i = 0 ; i < 3 ; ++i){ - Face_handle n = fh->neighbor(i); - if(! visited[n]) { - st.push(n); - } - } + data = true; + *faces_it++ = fh; + for(int i = 0 ; i < 3 ; ++i){ + Face_handle n = fh->neighbor(i); + if(! visited[n]) { + st.push(n); + } + } } } @@ -289,8 +289,8 @@ public: // A version of insert_constraint, that additionally writes // the new faces in an output iterator - // We duplicate code, as to run this one with an Emptyset_iterator - // is still too much overhead + // We duplicate code, as to run this one with an Emptyset_iterator + // is still too much overhead template void insert_constraint(Vertex_handle vaa, Vertex_handle vbb, OutputIterator out) @@ -330,14 +330,14 @@ insert_constraint(Vertex_handle vaa, Vertex_handle vbb, OutputIterator out) List_edges conflict_boundary_ab, conflict_boundary_ba; bool intersection = find_intersected_faces( vaa, vbb, - intersected_faces, - conflict_boundary_ab, - conflict_boundary_ba, - vi); + intersected_faces, + conflict_boundary_ab, + conflict_boundary_ba, + vi); if ( intersection) { if (vi != vaa && vi != vbb) { - insert_constraint(vaa,vi,out); - insert_constraint(vi,vbb,out); + insert_constraint(vaa,vi,out); + insert_constraint(vi,vbb,out); } else { insert_constraint(vaa,vbb,out); @@ -364,20 +364,20 @@ insert_constraint(Vertex_handle vaa, Vertex_handle vbb, OutputIterator out) it = n; } triangulate_hole(intersected_faces, - conflict_boundary_ab, - conflict_boundary_ba); + conflict_boundary_ab, + conflict_boundary_ba); get_bounded_faces(edges.begin(), - edges.end(), - out); - + edges.end(), + out); + if (vi != vbb) { - insert_constraint(vi,vbb,out); + insert_constraint(vi,vbb,out); } return; } - + void insert_constraint(const Point& a, const Point& b); void insert_constraint(Vertex_handle va, Vertex_handle vb); void push_back(const Constraint& c); @@ -412,8 +412,8 @@ insert_constraint(Vertex_handle vaa, Vertex_handle vbb, OutputIterator out) void remove_incident_constraints(Vertex_handle v); // to be used by Constrained_triangulation_plus_2 template - OutputItFaces - remove_constrained_edge(Face_handle f, int i, OutputItFaces out) + OutputItFaces + remove_constrained_edge(Face_handle f, int i, OutputItFaces out) { remove_constrained_edge(f, i); return out; @@ -429,22 +429,22 @@ insert_constraint(Vertex_handle vaa, Vertex_handle vbb, OutputIterator out) bool are_there_incident_constraints(Vertex_handle v) const; bool is_valid(bool verbose = false, int level = 0) const; // template - // OutputItEdges incident_constraints(Vertex_handle v, + // OutputItEdges incident_constraints(Vertex_handle v, // OutputItEdges out) const; void file_output(std::ostream& os) const; protected: - virtual Vertex_handle virtual_insert(const Point& a, - Face_handle start = Face_handle()); virtual Vertex_handle virtual_insert(const Point& a, - Locate_type lt, - Face_handle loc, - int li ); + Face_handle start = Face_handle()); + virtual Vertex_handle virtual_insert(const Point& a, + Locate_type lt, + Face_handle loc, + int li ); //Vertex_handle special_insert_in_edge(const Point & a, Face_handle f, int i); - void update_constraints_incident(Vertex_handle va, - Vertex_handle c1, - Vertex_handle c2); + void update_constraints_incident(Vertex_handle va, + Vertex_handle c1, + Vertex_handle c2); void clear_constraints_incident(Vertex_handle va); void update_constraints_opposite(Vertex_handle va); void update_constraints(const List_edges &hole); @@ -480,26 +480,26 @@ private: public: // made public for Laurent to find out deleted faces -// when inserting a constraint with most probably +// when inserting a constraint with most probably // no intersection - bool find_intersected_faces(Vertex_handle va, - Vertex_handle vb, - List_faces & intersected_faces, - List_edges & list_ab, - List_edges & list_ba, - Vertex_handle& vi); + bool find_intersected_faces(Vertex_handle va, + Vertex_handle vb, + List_faces & intersected_faces, + List_edges & list_ab, + List_edges & list_ba, + Vertex_handle& vi); protected: virtual void triangulate_hole(List_faces& intersected_faces, - List_edges& conflict_boundary_ab, - List_edges& conflict_boundary_ba); - + List_edges& conflict_boundary_ab, + List_edges& conflict_boundary_ba); + void triangulate_hole(List_faces& intersected_faces, - List_edges& conflict_boundary_ab, - List_edges& conflict_boundary_ba, - List_edges& new_edges); - - void triangulate_half_hole(List_edges & list_edges, - List_edges & new_edges); + List_edges& conflict_boundary_ab, + List_edges& conflict_boundary_ba, + List_edges& new_edges); + + void triangulate_half_hole(List_edges & list_edges, + List_edges & new_edges); void remove_1D(Vertex_handle v); void remove_2D(Vertex_handle v); @@ -511,13 +511,13 @@ public: #if defined(_MSC_VER) std::ptrdiff_t insert(InputIterator first, InputIterator last, int i = 0) #else - std::ptrdiff_t insert(InputIterator first, InputIterator last) + std::ptrdiff_t insert(InputIterator first, InputIterator last) #endif { #if defined(_MSC_VER) CGAL_USE(i); -#endif - size_type n = number_of_vertices(); +#endif + size_type n = number_of_vertices(); std::vector points (first, last); CGAL::spatial_sort (points.begin(), points.end(), geom_traits()); @@ -532,26 +532,26 @@ public: //deprecated template - bool are_there_incident_constraints(Vertex_handle v, - OutputIterator out) const + bool are_there_incident_constraints(Vertex_handle v, + OutputIterator out) const { Edge_circulator ec=incident_edges(v), done(ec); bool are_there = false; if (ec == 0) return are_there; do { - if(is_constrained(*ec)) { - *out++ = *ec; - are_there = true; - } - ec++; + if(is_constrained(*ec)) { + *out++ = *ec; + are_there = true; + } + ec++; } while (ec != done); return are_there; } - + template - OutputItEdges incident_constraints(Vertex_handle v, - OutputItEdges out) const { + OutputItEdges incident_constraints(Vertex_handle v, + OutputItEdges out) const { Edge_circulator ec=incident_edges(v), done(ec); if (ec == 0) return out; do { @@ -560,33 +560,33 @@ public: } while (ec != done); return out; } - - // the following fonctions are overloaded - // to take care of constraint marks + + // the following fonctions are overloaded + // to take care of constraint marks template - Vertex_handle star_hole( const Point& p, - EdgeIt edge_begin, - EdgeIt edge_end) { + Vertex_handle star_hole( const Point& p, + EdgeIt edge_begin, + EdgeIt edge_end) { std::list empty_list; - return star_hole(p, - edge_begin, - edge_end, - empty_list.begin(), - empty_list.end()); + return star_hole(p, + edge_begin, + edge_end, + empty_list.begin(), + empty_list.end()); } template - Vertex_handle star_hole( const Point& p, - EdgeIt edge_begin, - EdgeIt edge_end, - FaceIt face_begin, - FaceIt face_end) + Vertex_handle star_hole( const Point& p, + EdgeIt edge_begin, + EdgeIt edge_end, + FaceIt face_begin, + FaceIt face_end) { - Vertex_handle v = Triangulation::star_hole(p, - edge_begin, - edge_end, - face_begin, - face_end); + Vertex_handle v = Triangulation::star_hole(p, + edge_begin, + edge_end, + face_begin, + face_end); // restore constraint status for new faces. int vindex; Face_handle fh; @@ -602,7 +602,7 @@ public: } while (++fc != done); return v; } - + }; template < class Gt, class Tds, class Itag > @@ -620,20 +620,20 @@ inline typename Constrained_triangulation_2::Vertex_handle Constrained_triangulation_2:: virtual_insert(const Point& a, - Locate_type lt, - Face_handle loc, - int li ) + Locate_type lt, + Face_handle loc, + int li ) // virtual version of insert { return insert(a,lt,loc,li); } - + template < class Gt, class Tds, class Itag > inline typename Constrained_triangulation_2::Vertex_handle Constrained_triangulation_2:: insert(const Point& a, Face_handle start) -// inserts point a +// inserts point a // in addition to what is done for non constrained triangulations // constrained edges are updated { @@ -679,8 +679,8 @@ insert(const Point& a, Locate_type lt, Face_handle loc, int li) return va; } -// template < class Gt, class Tds, class Itag > -// typename Constrained_triangulation_2::Vertex_handle +// template < class Gt, class Tds, class Itag > +// typename Constrained_triangulation_2::Vertex_handle // Constrained_triangulation_2:: // special_insert_in_edge(const Point & a, Face_handle f, int i) // // insert point p in edge(f,i) @@ -692,7 +692,7 @@ insert(const Point& a, Locate_type lt, Face_handle loc, int li) // c1 = f->vertex(cw(i)); //endpoint of edge // c2 = f->vertex(ccw(i)); //endpoint of edge // bool insert_in_constrained_edge = f->is_constrained(i); - + // va = this->_tds.insert_in_edge(f, i); // va->set_point(a); @@ -707,7 +707,7 @@ template < class Gt, class Tds, class Itag > inline void Constrained_triangulation_2:: insert_constraint(const Point& a, const Point& b) -// the algorithm first inserts a and b, +// the algorithm first inserts a and b, // and then forces the constraint [va,vb] { Vertex_handle va= virtual_insert(a); @@ -757,7 +757,7 @@ insert_constraint(Vertex_handle vaa, Vertex_handle vbb) } continue; } - + List_faces intersected_faces; List_edges conflict_boundary_ab, conflict_boundary_ba; bool intersection = find_intersected_faces( vaa, vbb, @@ -792,15 +792,15 @@ template bool Constrained_triangulation_2:: find_intersected_faces(Vertex_handle vaa, - Vertex_handle vbb, - List_faces & intersected_faces, - List_edges & list_ab, - List_edges & list_ba, - Vertex_handle & vi) + Vertex_handle vbb, + List_faces & intersected_faces, + List_edges & list_ab, + List_edges & list_ba, + Vertex_handle & vi) // vi is set to the first vertex of the triangulation on [vaa,vbb]. // Return true if an intersection with a constrained edge is // encountered, false otherwise - // When false : + // When false : // intersected_faces contains the list if faces intersected by [va,vi] // list_ab and list_ba represents the boundary of the union // of the intersected faces oriented cw @@ -811,7 +811,7 @@ find_intersected_faces(Vertex_handle vaa, const Point& bb = vbb->point(); Line_face_circulator current_face=Line_face_circulator(vaa, this, bb); int ind=current_face->index(vaa); - + // to deal with the case where the first crossed edge // is constrained if(current_face->is_constrained(ind)) { @@ -819,66 +819,66 @@ find_intersected_faces(Vertex_handle vaa, return true; } - Face_handle lf= current_face->neighbor(ccw(ind)); + Face_handle lf= current_face->neighbor(ccw(ind)); Face_handle rf= current_face->neighbor(cw(ind)); Orientation orient; Face_handle previous_face; - Vertex_handle current_vertex; + Vertex_handle current_vertex; list_ab.push_back(Edge(lf, lf->index(current_face))); list_ba.push_front(Edge(rf, rf->index(current_face))); intersected_faces.push_front(current_face); // initcd - previous_face=current_face; + previous_face=current_face; ++current_face; - ind=current_face->index(previous_face); - current_vertex=current_face->vertex(ind); + ind=current_face->index(previous_face); + current_vertex=current_face->vertex(ind); // loop over triangles intersected by ab bool done = false; - while (current_vertex != vbb && !done) { + while (current_vertex != vbb && !done) { orient = orientation(aa,bb,current_vertex->point()); int i1, i2; switch (orient) { - case COLLINEAR : + case COLLINEAR : done = true; // current_vertex is the new endpoint break; case LEFT_TURN : case RIGHT_TURN : if (orient == LEFT_TURN) { - i1 = ccw(ind) ; //index of second intersected edge of current_face - i2 = cw(ind); //index of non intersected edge of current_face + i1 = ccw(ind) ; //index of second intersected edge of current_face + i2 = cw(ind); //index of non intersected edge of current_face } else { - i1 = cw(ind) ; //index of second intersected edge of current_face - i2 = ccw(ind); //index of non intersected edge of current_face + i1 = cw(ind) ; //index of second intersected edge of current_face + i2 = ccw(ind); //index of non intersected edge of current_face } if(current_face->is_constrained(i1)) { - vi = intersect(current_face, i1, vaa,vbb); - return true; + vi = intersect(current_face, i1, vaa,vbb); + return true; } else { - lf= current_face->neighbor(i2); - intersected_faces.push_front(current_face); - if (orient == LEFT_TURN) - list_ab.push_back(Edge(lf, lf->index(current_face))); - else // orient == RIGHT_TURN - list_ba.push_front(Edge(lf, lf->index(current_face))); - previous_face=current_face; - ++current_face; - ind=current_face->index(previous_face); - current_vertex=current_face->vertex(ind); + lf= current_face->neighbor(i2); + intersected_faces.push_front(current_face); + if (orient == LEFT_TURN) + list_ab.push_back(Edge(lf, lf->index(current_face))); + else // orient == RIGHT_TURN + list_ba.push_front(Edge(lf, lf->index(current_face))); + previous_face=current_face; + ++current_face; + ind=current_face->index(previous_face); + current_vertex=current_face->vertex(ind); } break; } } - - // last triangle + + // last triangle vi = current_vertex; intersected_faces.push_front(current_face); lf= current_face->neighbor(cw(ind)); - list_ab.push_back(Edge(lf, lf->index(current_face))); + list_ab.push_back(Edge(lf, lf->index(current_face))); rf= current_face->neighbor(ccw(ind)); list_ba.push_front(Edge(rf, rf->index(current_face))); return false; @@ -886,11 +886,11 @@ find_intersected_faces(Vertex_handle vaa, template -typename Constrained_triangulation_2::Vertex_handle +typename Constrained_triangulation_2::Vertex_handle Constrained_triangulation_2:: -intersect(Face_handle f, int i, - Vertex_handle vaa, - Vertex_handle vbb) +intersect(Face_handle f, int i, + Vertex_handle vaa, + Vertex_handle vbb) { return intersect(f, i, vaa, vbb, Itag()); } @@ -920,18 +920,18 @@ intersect(Face_handle , int , } template -typename Constrained_triangulation_2::Vertex_handle +typename Constrained_triangulation_2::Vertex_handle Constrained_triangulation_2:: -intersect(Face_handle f, int i, - Vertex_handle vaa, - Vertex_handle vbb, - Exact_intersections_tag) -// compute the intersection of the constraint edge (f,i) +intersect(Face_handle f, int i, + Vertex_handle vaa, + Vertex_handle vbb, + Exact_intersections_tag) +// compute the intersection of the constraint edge (f,i) // with the subconstraint (vaa,vbb) being inserted // insert the intersection point -// split constraint edge (f,i) +// split constraint edge (f,i) // and return the Vertex_handle of the new Vertex -{ +{ #ifndef CGAL_NO_CDT_2_WARNING CGAL_warning_msg(false, "You are using an exact number type,\n" @@ -951,16 +951,16 @@ intersect(Face_handle f, int i, intersection(geom_traits(), pa, pb, pc, pd, pi, itag ); CGAL_triangulation_assertion(ok); Vertex_handle vi = virtual_insert(pi, Triangulation::EDGE, f, i); - return vi; + return vi; } template -typename Constrained_triangulation_2::Vertex_handle +typename Constrained_triangulation_2::Vertex_handle Constrained_triangulation_2:: -intersect(Face_handle f, int i, - Vertex_handle vaa, - Vertex_handle vbb, - Exact_predicates_tag) +intersect(Face_handle f, int i, + Vertex_handle vaa, + Vertex_handle vbb, + Exact_predicates_tag) { Vertex_handle vcc, vdd; vcc = f->vertex(cw(i)); @@ -982,7 +982,7 @@ intersect(Face_handle f, int i, case 0 : vi = vaa; break; case 1 : vi = vbb; break; case 2 : vi = vcc; break; - case 3 : vi = vdd; break; + case 3 : vi = vdd; break; } if(vi == vaa || vi == vbb) { remove_constrained_edge(f, i); @@ -995,14 +995,14 @@ intersect(Face_handle f, int i, // vi == vc or vi == vd may happen even if intersection==true // due to approximate construction of the intersection - if (vi != vcc && vi != vdd) { - insert_constraint(vcc,vi); + if (vi != vcc && vi != vdd) { + insert_constraint(vcc,vi); insert_constraint(vi, vdd); - } + } else { insert_constraint(vcc,vdd); } - return vi; + return vi; } template @@ -1028,10 +1028,10 @@ push_back(const Constraint &c) template < class Gt, class Tds, class Itag > void Constrained_triangulation_2:: -update_constraints_incident(Vertex_handle va, - Vertex_handle c1, - Vertex_handle c2) - // update status of edges incident to a +update_constraints_incident(Vertex_handle va, + Vertex_handle c1, + Vertex_handle c2) + // update status of edges incident to a // after insertion in the constrained edge c1c2 { if (dimension() == 0) return; @@ -1044,21 +1044,21 @@ update_constraints_incident(Vertex_handle va, else{ //dimension() ==2 int cwi, ccwi, indf; - Face_circulator fc=incident_faces(va), done(fc); + Face_circulator fc=incident_faces(va), done(fc); CGAL_triangulation_assertion(fc != 0); do { indf = fc->index(va); cwi=cw(indf); - ccwi=ccw(indf); + ccwi=ccw(indf); if ((fc->vertex(cwi) == c1)||(fc->vertex(cwi) == c2)) { - fc->set_constraint(ccwi,true); - fc->set_constraint(cwi,false); - } - else { - fc->set_constraint(ccwi,false); - fc->set_constraint(cwi,true); - } - ++fc; + fc->set_constraint(ccwi,true); + fc->set_constraint(cwi,false); + } + else { + fc->set_constraint(ccwi,false); + fc->set_constraint(cwi,true); + } + ++fc; } while (fc != done); } } @@ -1078,7 +1078,7 @@ clear_constraints_incident(Vertex_handle va) indf = (*ec).second; f->set_constraint(indf,false); if (dimension() == 2) { - f->neighbor(indf)->set_constraint(mirror_index(f,indf),false); + f->neighbor(indf)->set_constraint(mirror_index(f,indf),false); } } while (++ec != done); } @@ -1088,12 +1088,12 @@ clear_constraints_incident(Vertex_handle va) template < class Gt, class Tds, class Itag > void -Constrained_triangulation_2:: +Constrained_triangulation_2:: update_constraints_opposite(Vertex_handle va) // update status of edges opposite to a // after insertion of a { - CGAL_triangulation_assertion(dimension()==2); + CGAL_triangulation_assertion(dimension()==2); Face_handle f=va->face(), start=f; int indf; do { @@ -1104,14 +1104,14 @@ update_constraints_opposite(Vertex_handle va) else { f->set_constraint(indf,false); } - f= f->neighbor(ccw(indf)); // turns ccw around va + f= f->neighbor(ccw(indf)); // turns ccw around va } while (f != start); return; } template < class Gt, class Tds, class Itag > void -Constrained_triangulation_2:: +Constrained_triangulation_2:: update_constraints( const List_edges &hole) { typename List_edges::const_iterator it = hole.begin(); @@ -1120,7 +1120,7 @@ update_constraints( const List_edges &hole) for ( ; it != hole.end(); it ++) { f =(*it).first; i = (*it).second; - if ( f->is_constrained(i) ) + if ( f->is_constrained(i) ) (f->neighbor(i))->set_constraint(mirror_index(f,i),true); else (f->neighbor(i))->set_constraint(mirror_index(f,i),false); } @@ -1144,14 +1144,14 @@ template < class Gt, class Tds, class Itag > inline void Constrained_triangulation_2:: triangulate_hole(List_faces& intersected_faces, - List_edges& conflict_boundary_ab, - List_edges& conflict_boundary_ba) + List_edges& conflict_boundary_ab, + List_edges& conflict_boundary_ba) { List_edges new_edges; triangulate_hole(intersected_faces, - conflict_boundary_ab, - conflict_boundary_ba, - new_edges); + conflict_boundary_ab, + conflict_boundary_ba, + new_edges); } @@ -1160,18 +1160,18 @@ template < class Gt, class Tds, class Itag > void Constrained_triangulation_2:: triangulate_hole(List_faces& intersected_faces, - List_edges& conflict_boundary_ab, - List_edges& conflict_boundary_ba, - List_edges& new_edges) + List_edges& conflict_boundary_ab, + List_edges& conflict_boundary_ba, + List_edges& new_edges) // triangulate the hole limited by conflict_boundary_ab // and conflict_boundary_ba - // insert the new edges in new-edges + // insert the new edges in new-edges // delete the faces of intersected_faces { if ( !conflict_boundary_ab.empty() ) { triangulate_half_hole(conflict_boundary_ab, new_edges); triangulate_half_hole(conflict_boundary_ba, new_edges); - + // the two faces that share edge ab are neighbors // their common edge ab is a constraint Face_handle fr,fl; @@ -1181,7 +1181,7 @@ triangulate_hole(List_faces& intersected_faces, fr->set_neighbor(2, fl); fl->set_constraint(2, true); fr->set_constraint(2, true); - + // delete intersected faces while( ! intersected_faces.empty()) { fl = intersected_faces.front(); @@ -1203,7 +1203,7 @@ remove(Vertex_handle v) CGAL_triangulation_precondition( v != Vertex_handle() ); CGAL_triangulation_precondition( ! is_infinite(v)); CGAL_triangulation_precondition( ! are_there_incident_constraints(v)); - + if (number_of_vertices() == 1) remove_first(v); else if (number_of_vertices() == 2) remove_second(v); else if ( dimension() == 1) remove_1D(v); @@ -1238,7 +1238,7 @@ remove_2D(Vertex_handle v) update_constraints(shell); delete_vertex(v); } - return; + return; } @@ -1261,15 +1261,15 @@ remove_incident_constraints(Vertex_handle v) Edge_circulator ec=incident_edges(v), done(ec); if (ec == 0) return; do { - if(is_constrained(*ec)) { remove_constrained_edge((*ec).first, - (*ec).second);} - ec++; + if(is_constrained(*ec)) { remove_constrained_edge((*ec).first, + (*ec).second);} + ec++; } while (ec != done); - return; + return; } template < class Gt, class Tds, class Itag > -inline bool +inline bool Constrained_triangulation_2:: are_there_incident_constraints(Vertex_handle v) const { @@ -1277,30 +1277,30 @@ are_there_incident_constraints(Vertex_handle v) const } template < class Gt, class Tds, class Itag > -inline bool +inline bool Constrained_triangulation_2:: is_valid(bool verbose, int level) const { bool result = Triangulation::is_valid(verbose,level); - for( All_faces_iterator it = all_faces_begin(); - it != all_faces_end() ; it++) { + for( All_faces_iterator it = all_faces_begin(); + it != all_faces_end() ; it++) { for(int i=0; i<3; i++) { - Face_handle n = it->neighbor(i); - result = result && - it->is_constrained(i) == n->is_constrained(n->index(it)); + Face_handle n = it->neighbor(i); + result = result && + it->is_constrained(i) == n->is_constrained(n->index(it)); } } return result; } template < class Gt, class Tds, class Itag > -inline bool +inline bool Constrained_triangulation_2:: is_constrained(Edge e) const { return (e.first)->is_constrained(e.second); } - + template < class Gt, class Tds, class Itag > void Constrained_triangulation_2:: @@ -1314,17 +1314,17 @@ triangulate_half_hole(List_edges & list_edges, List_edges & new_edges) // the edges that are created are put in list new_edges // takes linear time { - Vertex_handle va; // first vertex of list_edges + Vertex_handle va; // first vertex of list_edges Face_handle newlf; Face_handle n1,n2,n; int ind1, ind2,ind; Orientation orient; - + typename List_edges::iterator current, next, tempo; current=list_edges.begin(); va=((*current).first)->vertex(ccw((*current).second)); - next=current; + next=current; ++next; do @@ -1333,23 +1333,23 @@ triangulate_half_hole(List_edges & list_edges, List_edges & new_edges) ind1=(*current).second; // in case n1 is no longer a triangle of the new triangulation if ( n1->neighbor(ind1) != Face_handle() ) { - n=n1->neighbor(ind1); - //ind=mirror_index(n1,ind1); - // mirror_index does not work in this case - ind = cw(n->index(n1->vertex(cw(ind1)))); - n1=n->neighbor(ind); - ind1= mirror_index(n,ind); + n=n1->neighbor(ind1); + //ind=mirror_index(n1,ind1); + // mirror_index does not work in this case + ind = cw(n->index(n1->vertex(cw(ind1)))); + n1=n->neighbor(ind); + ind1= mirror_index(n,ind); } n2=(*next).first; ind2=(*next).second; // in case n2 is no longer a triangle of the new triangulation if (n2->neighbor(ind2) != Face_handle() ) { - n=n2->neighbor(ind2); - // ind=mirror_index(n2,ind2); - // mirror_index does not work in this case - ind = cw(n->index(n2->vertex(cw(ind2)))); - n2=n->neighbor(ind); - ind2= mirror_index(n,ind); + n=n2->neighbor(ind2); + // ind=mirror_index(n2,ind2); + // mirror_index does not work in this case + ind = cw(n->index(n2->vertex(cw(ind2)))); + n2=n->neighbor(ind); + ind2= mirror_index(n,ind); } Vertex_handle v0=n1->vertex(ccw(ind1)); @@ -1357,41 +1357,41 @@ triangulate_half_hole(List_edges & list_edges, List_edges & new_edges) Vertex_handle v2=n2->vertex(cw(ind2)); orient = orientation(v0->point(),v1->point(),v2->point()); switch (orient) { - case RIGHT_TURN : - // creates the new triangle v0v1v2 - // updates the neighbors, the constraints - //and the list of new edges - newlf = create_face(v0,v2,v1); - new_edges.push_back(Edge(newlf,2)); - newlf->set_neighbor(1, n1); - newlf->set_neighbor(0, n2); - n1->set_neighbor(ind1, newlf); - n2->set_neighbor(ind2, newlf); - if (n1->is_constrained(ind1)) { - newlf->set_constraint(1,true); - } - if (n2->is_constrained(ind2)) { - newlf->set_constraint(0,true); - } - // v0, v1 or v2.face() may have been removed - v0->set_face(newlf); - v1->set_face(newlf); - v2->set_face(newlf); - // update list_edges - tempo=current; - current=list_edges.insert(current, Edge(newlf,2)); - list_edges.erase(tempo); - list_edges.erase(next); - next=current; - if (v0 != va) {--current;} - else {++next;} - break; - case LEFT_TURN : - ++current; ++next; - break; - case COLLINEAR : - ++current; ++next; - break; + case RIGHT_TURN : + // creates the new triangle v0v1v2 + // updates the neighbors, the constraints + //and the list of new edges + newlf = create_face(v0,v2,v1); + new_edges.push_back(Edge(newlf,2)); + newlf->set_neighbor(1, n1); + newlf->set_neighbor(0, n2); + n1->set_neighbor(ind1, newlf); + n2->set_neighbor(ind2, newlf); + if (n1->is_constrained(ind1)) { + newlf->set_constraint(1,true); + } + if (n2->is_constrained(ind2)) { + newlf->set_constraint(0,true); + } + // v0, v1 or v2.face() may have been removed + v0->set_face(newlf); + v1->set_face(newlf); + v2->set_face(newlf); + // update list_edges + tempo=current; + current=list_edges.insert(current, Edge(newlf,2)); + list_edges.erase(tempo); + list_edges.erase(next); + next=current; + if (v0 != va) {--current;} + else {++next;} + break; + case LEFT_TURN : + ++current; ++next; + break; + case COLLINEAR : + ++current; ++next; + break; } } while (next != list_edges.end()); } @@ -1410,11 +1410,11 @@ file_output(std::ostream& os) const if (ib->is_constrained(j)) { os << "C";} else { os << "N";} if(is_ascii(os)){ - if(j==2) { - os << "\n"; - } else { - os << ' '; - } + if(j==2) { + os << "\n"; + } else { + os << ' '; + } } } } @@ -1422,8 +1422,8 @@ file_output(std::ostream& os) const template < class Gt, class Tds, class Itag > std::ostream & -operator<<(std::ostream& os, - const Constrained_triangulation_2 &ct) +operator<<(std::ostream& os, + const Constrained_triangulation_2 &ct) { ct.file_output(os); return os ; @@ -1431,8 +1431,8 @@ operator<<(std::ostream& os, template < class Gt, class Tds, class Itag > std::istream & -operator>>(std::istream& is, - Constrained_triangulation_2 &ct) +operator>>(std::istream& is, + Constrained_triangulation_2 &ct) { typedef Constrained_triangulation_2 CDT; ct.clear(); @@ -1444,7 +1444,7 @@ operator>>(std::istream& is, for (int k=0;k<3;++k){ fit->set_constraint(k,c[k]=='C'); } - } + } return is; } @@ -1478,12 +1478,12 @@ intersection(const Gt& , template bool intersection(const Gt& gt, - const typename Gt::Point_2& pa, - const typename Gt::Point_2& pb, - const typename Gt::Point_2& pc, - const typename Gt::Point_2& pd, - typename Gt::Point_2& pi, - Exact_intersections_tag) + const typename Gt::Point_2& pa, + const typename Gt::Point_2& pb, + const typename Gt::Point_2& pc, + const typename Gt::Point_2& pd, + typename Gt::Point_2& pi, + Exact_intersections_tag) { return compute_intersection(gt,pa,pb,pc,pd,pi); } @@ -1492,13 +1492,13 @@ intersection(const Gt& gt, template inline bool intersection(const Gt& gt, - const typename Gt::Point_2& pa, - const typename Gt::Point_2& pb, - const typename Gt::Point_2& pc, - const typename Gt::Point_2& pd, - typename Gt::Point_2& pi, - Exact_predicates_tag, - CGAL::Tag_false /* not a FT is not floating-point */) + const typename Gt::Point_2& pa, + const typename Gt::Point_2& pb, + const typename Gt::Point_2& pc, + const typename Gt::Point_2& pd, + typename Gt::Point_2& pi, + Exact_predicates_tag, + CGAL::Tag_false /* not a FT is not floating-point */) { return compute_intersection(gt,pa,pb,pc,pd,pi); } @@ -1506,13 +1506,13 @@ intersection(const Gt& gt, template inline bool intersection(const Gt& gt, - const typename Gt::Point_2& pa, - const typename Gt::Point_2& pb, - const typename Gt::Point_2& pc, - const typename Gt::Point_2& pd, - typename Gt::Point_2& pi, - Exact_predicates_tag, - CGAL::Tag_true /* FT is a floating-point type */) + const typename Gt::Point_2& pa, + const typename Gt::Point_2& pb, + const typename Gt::Point_2& pc, + const typename Gt::Point_2& pd, + typename Gt::Point_2& pi, + Exact_predicates_tag, + CGAL::Tag_true /* FT is a floating-point type */) { const bool result = compute_intersection(gt,pa,pb,pc,pd,pi); if(!result) return result; @@ -1550,12 +1550,12 @@ intersection(const Gt& gt, template inline bool intersection(const Gt& gt, - const typename Gt::Point_2& pa, - const typename Gt::Point_2& pb, - const typename Gt::Point_2& pc, - const typename Gt::Point_2& pd, - typename Gt::Point_2& pi, - Exact_predicates_tag exact_predicates_tag) + const typename Gt::Point_2& pa, + const typename Gt::Point_2& pb, + const typename Gt::Point_2& pc, + const typename Gt::Point_2& pd, + typename Gt::Point_2& pi, + Exact_predicates_tag exact_predicates_tag) { typedef typename Gt::FT FT; return intersection(gt,pa,pb,pc,pd,pi, @@ -1567,17 +1567,17 @@ intersection(const Gt& gt, template bool compute_intersection(const Gt& gt, - const typename Gt::Point_2& pa, - const typename Gt::Point_2& pb, - const typename Gt::Point_2& pc, - const typename Gt::Point_2& pd, - typename Gt::Point_2& pi) + const typename Gt::Point_2& pa, + const typename Gt::Point_2& pb, + const typename Gt::Point_2& pc, + const typename Gt::Point_2& pd, + typename Gt::Point_2& pi) { typename Gt::Intersect_2 compute_intersec=gt.intersect_2_object(); - typename Gt::Construct_segment_2 + typename Gt::Construct_segment_2 construct_segment=gt.construct_segment_2_object(); Object result = compute_intersec(construct_segment(pa,pb), - construct_segment(pc,pd)); + construct_segment(pc,pd)); return assign(pi, result); } @@ -1609,11 +1609,11 @@ limit_intersection(const Gt& , template int limit_intersection(const Gt& , - const typename Gt::Point_2& , - const typename Gt::Point_2& , - const typename Gt::Point_2& , - const typename Gt::Point_2& , - Exact_intersections_tag) + const typename Gt::Point_2& , + const typename Gt::Point_2& , + const typename Gt::Point_2& , + const typename Gt::Point_2& , + Exact_intersections_tag) { return 0; } @@ -1621,14 +1621,14 @@ limit_intersection(const Gt& , template int limit_intersection(const Gt& gt, - const typename Gt::Point_2& pa, - const typename Gt::Point_2& pb, - const typename Gt::Point_2& pc, - const typename Gt::Point_2& pd, - Exact_predicates_tag) + const typename Gt::Point_2& pa, + const typename Gt::Point_2& pb, + const typename Gt::Point_2& pc, + const typename Gt::Point_2& pd, + Exact_predicates_tag) { typename Gt::Construct_line_2 line = gt.construct_line_2_object(); - typename Gt::Compute_squared_distance_2 + typename Gt::Compute_squared_distance_2 distance = gt.compute_squared_distance_2_object(); typename Gt::Line_2 l1 = line(pa,pb); typename Gt::Line_2 l2 = line(pc,pd); diff --git a/Triangulation_2/include/CGAL/Constrained_triangulation_plus_2.h b/Triangulation_2/include/CGAL/Constrained_triangulation_plus_2.h index dad024bd902..51d291d1454 100644 --- a/Triangulation_2/include/CGAL/Constrained_triangulation_plus_2.h +++ b/Triangulation_2/include/CGAL/Constrained_triangulation_plus_2.h @@ -6,7 +6,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Andreas Fabri, Mariette Yvinec @@ -56,25 +56,25 @@ public: } }; // end class template Pct2_vertex_handle_less_xy -// Tr the base triangulation class +// Tr the base triangulation class // Tr has to be Constrained or Constrained_Delaunay with Constrained_triangulation_plus_vertex_base template < class Tr_ = Default > -class Constrained_triangulation_plus_2 - : public -Default::Get< Tr_, Constrained_Delaunay_triangulation_2< +class Constrained_triangulation_plus_2 + : public +Default::Get< Tr_, Constrained_Delaunay_triangulation_2< Exact_predicates_inexact_constructions_kernel - , Triangulation_data_structure_2< + , Triangulation_data_structure_2< Triangulation_vertex_base_2 , Constrained_triangulation_face_base_2 > , CGAL::Exact_predicates_tag > >::type { - typedef typename - Default::Get< Tr_, Constrained_Delaunay_triangulation_2< + typedef typename + Default::Get< Tr_, Constrained_Delaunay_triangulation_2< Exact_predicates_inexact_constructions_kernel - , Triangulation_data_structure_2< + , Triangulation_data_structure_2< Triangulation_vertex_base_2 , Constrained_triangulation_face_base_2 > @@ -88,7 +88,7 @@ Default::Get< Tr_, Constrained_Delaunay_triangulation_2< typedef typename CDT::Vertex_handle Vertex_handle; typedef typename CDT::Face_handle Face_handle; private: - typedef boost::tuple TFace; + typedef boost::tuple TFace; std::vector faces; CDT& cdt; @@ -110,8 +110,8 @@ Default::Get< Tr_, Constrained_Delaunay_triangulation_2< void write_faces(OutputIterator out) { - for(typename std::vector::reverse_iterator - it = faces.rbegin(); it != faces.rend(); ++it) { + for(typename std::vector::reverse_iterator + it = faces.rbegin(); it != faces.rend(); ++it) { Face_handle fh; if(cdt.is_face(boost::get<0>(*it), boost::get<1>(*it), boost::get<2>(*it), fh)){ *out++ = fh; @@ -126,7 +126,7 @@ public: typedef Constrained_triangulation_plus_2 Self; typedef Tr Base; - + #ifndef CGAL_CFG_USING_BASE_MEMBER_BUG_2 using Triangulation::vertices_begin; using Triangulation::vertices_end; @@ -169,29 +169,29 @@ public: typedef Tag_false Periodic_tag; // for user interface with the constraint hierarchy - typedef typename Constraint_hierarchy::Vertex_it + typedef typename Constraint_hierarchy::Vertex_it Vertices_in_constraint_iterator; typedef Iterator_range Vertices_in_constraint; - + typedef typename Constraint_hierarchy::Point_it Points_in_constraint_iterator; typedef Iterator_range Points_in_constraint; - + typedef typename Constraint_hierarchy::Context Context; typedef typename Constraint_hierarchy::Context_iterator Context_iterator; typedef Iterator_range Contexts; - + typedef typename Constraint_hierarchy::C_iterator Constraint_iterator; typedef Iterator_range Constraints; - + typedef typename Constraint_hierarchy::Subconstraint_iterator Subconstraint_iterator; typedef Iterator_range Subconstraints; - - typedef typename Constraint_hierarchy::Constraint_id Constraint_id; - + + typedef typename Constraint_hierarchy::Constraint_id Constraint_id; + typedef std::pair Subconstraint; - + using Triangulation::geom_traits; using Triangulation::cw; using Triangulation::ccw; @@ -199,14 +199,14 @@ public: protected: Constraint_hierarchy hierarchy; - + public: Constraint_hierarchy& hierarchy_ref() { return hierarchy; } - Constrained_triangulation_plus_2(const Geom_traits& gt=Geom_traits()) + Constrained_triangulation_plus_2(const Geom_traits& gt=Geom_traits()) : Triangulation(gt) , hierarchy(Vh_less_xy(this)) { } @@ -226,8 +226,8 @@ public: template Constrained_triangulation_plus_2(InputIterator first, - InputIterator last, - const Geom_traits& gt=Geom_traits() ) + InputIterator last, + const Geom_traits& gt=Geom_traits() ) : Triangulation(gt) , hierarchy(Vh_less_xy(this)) { @@ -237,7 +237,7 @@ public: Constrained_triangulation_plus_2(const std::list > &constraints, - const Geom_traits& gt=Geom_traits() ) + const Geom_traits& gt=Geom_traits() ) : Triangulation(gt) , hierarchy(Vh_less_xy(this)) { @@ -250,12 +250,12 @@ public: void swap(Constrained_triangulation_plus_2 &ctp); // INSERTION - Vertex_handle insert(const Point& a, - Face_handle start = Face_handle() ); + Vertex_handle insert(const Point& a, + Face_handle start = Face_handle() ); Vertex_handle insert(const Point& p, - Locate_type lt, - Face_handle loc, int li ); - + Locate_type lt, + Face_handle loc, int li ); + Constraint_id insert_constraint(const Point& a, const Point& b) { Vertex_handle va= insert(a); @@ -263,14 +263,14 @@ public: // close to point a // Otherwise, to start here is as good as elsewhere Vertex_handle vb = insert(b, va->face()); - return insert_constraint(va, vb); + return insert_constraint(va, vb); } - Constraint_id insert_constraint(const Constraint& c) + Constraint_id insert_constraint(const Constraint& c) { return insert_constraint(c.first, c.second); } - + Constraint_id insert_constraint(Vertex_handle va, Vertex_handle vb) { // protects against inserting a zero length constraint @@ -279,7 +279,7 @@ public: } // protects against inserting twice the same constraint Constraint_id cid = hierarchy.insert_constraint_old_API(va, vb); - if (va != vb && (cid != Constraint_id(nullptr)) ) insert_subconstraint(va,vb); + if (va != vb && (cid != Constraint_id(nullptr)) ) insert_subconstraint(va,vb); return cid; } @@ -326,7 +326,7 @@ public: } // for backward compatibility - // not const Point&, because otherwise VC6/7 messes it up with + // not const Point&, because otherwise VC6/7 messes it up with // the insert that takes an iterator range Constraint_id insert(Point a, Point b) { return insert_constraint(a, b); } Constraint_id insert(Vertex_handle va, Vertex_handle vb) { return insert_constraint(va,vb); } @@ -353,8 +353,8 @@ public: Vertices_in_constraint_iterator - insert_vertex_in_constraint(Constraint_id cid, Vertices_in_constraint_iterator pos, - Vertex_handle vh) + insert_vertex_in_constraint(Constraint_id cid, Vertices_in_constraint_iterator pos, + Vertex_handle vh) { return insert_vertex_in_constraint(cid, pos, vh, Emptyset_iterator()); } @@ -368,8 +368,8 @@ public: template Vertices_in_constraint_iterator - remove_vertex_from_constraint(Constraint_id cid, Vertices_in_constraint_iterator pos, - OutputIterator out) + remove_vertex_from_constraint(Constraint_id cid, Vertices_in_constraint_iterator pos, + OutputIterator out) { if(pos == vertices_in_constraint_begin(cid)){ ++pos; @@ -410,7 +410,7 @@ public: ++pos; tail = hierarchy.split(cid,pos); } - + Constraint_id aux = insert_constraint(a, b, std::back_inserter(fc)); pos = vertices_in_constraint_end(aux); --pos; @@ -435,8 +435,8 @@ public: // Writes the modified faces to out template Vertices_in_constraint_iterator - insert_vertex_in_constraint(Constraint_id cid, Vertices_in_constraint_iterator pos, - Vertex_handle vh, OutputIterator out) + insert_vertex_in_constraint(Constraint_id cid, Vertices_in_constraint_iterator pos, + Vertex_handle vh, OutputIterator out) { // Insertion before the first vertex if(pos == vertices_in_constraint_begin(cid)){ @@ -444,7 +444,7 @@ public: Constraint_id head = insert_constraint(vh, *pos, out); hierarchy.concatenate2(head, cid); return vertices_in_constraint_begin(cid); - } + } // Insertion after the last vertex if(pos == vertices_in_constraint_end(cid)){ @@ -457,7 +457,7 @@ public: return pos; } Vertex_handle b = *pos; - --pos; + --pos; Vertex_handle a = *pos; ++pos; Face_container fc(*this); @@ -466,7 +466,7 @@ public: vcit = beg; ++beg; // If the constraint consists only of a segment, and we want to insert - // in the middle + // in the middle if((pos == vcit) && (beg == vertices_in_constraint_end(cid))){ //std::cout << "insertion in constraint which is a segment" << std::endl; Constraint_id aux1 = insert_constraint(a, vh, std::back_inserter(fc)); @@ -477,7 +477,7 @@ public: remove_constraint(aux1, std::back_inserter(fc)); fc.write_faces(out); return pos; - + } Constraint_id head = 0, tail = 0; Vertices_in_constraint_iterator bit = vertices_in_constraint_begin(cid); @@ -496,9 +496,9 @@ public: --eit; if(pos != eit){ //std::cout << "split tail" << std::endl; - tail = split(cid, pos); + tail = split(cid, pos); } - + // make the new constraint Constraint_id aux1 = insert_constraint(a, vh, std::back_inserter(fc)); Constraint_id aux2 = insert_constraint(vh, b, std::back_inserter(fc)); @@ -534,7 +534,7 @@ public: hint = vh->face(); // no duplicates if(vertices.empty() || (vertices.back() != vh)){ - vertices.push_back(vh); + vertices.push_back(vh); } } int n = vertices.size(); @@ -542,24 +542,24 @@ public: return nullptr; } Constraint_id ca = hierarchy.insert_constraint(vertices[0],vertices[1]); - insert_subconstraint(vertices[0],vertices[1], std::back_inserter(fc)); + insert_subconstraint(vertices[0],vertices[1], std::back_inserter(fc)); if(n>2){ for(int j=1; jfixed() = true; // Vertices_in_constraint_iterator end = boost::prior(vertices_in_constraint_end(ca)); // end->fixed() = true; fc.write_faces(out); - + return ca; } @@ -575,7 +575,7 @@ private: hint = vh->face(); // no duplicates if(vertices.empty() || (vertices.back() != vh)){ - vertices.push_back(vh); + vertices.push_back(vh); } } if(is_polygon && (vertices.size()>1) && (vertices.front() != vertices.back())){ @@ -587,26 +587,26 @@ private: return nullptr; } CGAL_assertion(n >= 2); - + Constraint_id ca = hierarchy.insert_constraint(vertices[0],vertices[1]); - insert_subconstraint(vertices[0],vertices[1]); + insert_subconstraint(vertices[0],vertices[1]); if(n>2){ for(std::size_t j=1; jfixed() = true; // vertices.back()->fixed() = true; return ca; } - + public: - + void file_output(std::ostream& os) const { @@ -631,9 +631,9 @@ public: void file_input(std::istream& is) { - + is >> static_cast(*this); - + std::vector V; V.reserve(number_of_vertices()); for(Vertex_iterator vit = vertices_begin(); vit != vertices_end() ; ++vit){ @@ -646,7 +646,7 @@ public: while(is >> n){ is >> i0 >> i1; cid = insert_constraint(V[i0],V[i1]); - + for(int i = 2; i < n; i++){ i0 = i1; is >> i1; @@ -656,7 +656,7 @@ public: } } - + template typename Constrained_triangulation_plus_2::Constraint_id insert_constraint(Vertex_handle va, Vertex_handle vb, OutputIterator out) @@ -667,11 +667,11 @@ public: } // protects against inserting twice the same constraint Constraint_id cid = hierarchy.insert_constraint(va, vb); - if (va != vb && (cid != nullptr) ) insert_subconstraint(va,vb,out); - + if (va != vb && (cid != nullptr) ) insert_subconstraint(va,vb,out); + for(Vertices_in_constraint_iterator vcit = vertices_in_constraint_begin(cid); - vcit != vertices_in_constraint_end(cid); - vcit++){ + vcit != vertices_in_constraint_end(cid); + vcit++){ insert_incident_faces(vcit, out); } return cid; @@ -696,26 +696,26 @@ public: Vertex_handle vaa, Vertex_handle vbb, Exact_predicates_tag); - + // REMOVAL template void remove_constraint(Constraint_id cid, OutputIterator out) { std::list vertices(hierarchy.vertices_in_constraint_begin(cid), - hierarchy.vertices_in_constraint_end(cid)); + hierarchy.vertices_in_constraint_end(cid)); hierarchy.remove_constraint(cid); - for(typename std::list::iterator it = vertices.begin(), - succ = it; - ++succ != vertices.end(); - ++it){ + for(typename std::list::iterator it = vertices.begin(), + succ = it; + ++succ != vertices.end(); + ++it){ if(! is_subconstraint(*it, *succ)){ // this checks whether other constraints pass - Face_handle fh; - int i; - bool b = Triangulation::is_edge(*it, *succ, fh, i); - CGAL_assume(b); - Triangulation::remove_constrained_edge(fh,i, out); // this does also flipping if necessary. + Face_handle fh; + int i; + bool b = Triangulation::is_edge(*it, *succ, fh, i); + CGAL_assume(b); + Triangulation::remove_constrained_edge(fh,i, out); // this does also flipping if necessary. } } } @@ -724,18 +724,18 @@ public: remove_constraint(cid, Emptyset_iterator()); } - + void simplify(Vertices_in_constraint_iterator v) { Vertices_in_constraint_iterator u = boost::prior(v); Vertices_in_constraint_iterator w = boost::next(v); bool unew = (*u != *w); hierarchy.simplify(u,v,w); - + Triangulation::remove_incident_constraints(*v); - + Triangulation::remove(*v); - + if(unew){ Triangulation::insert_constraint(*u, *w); } @@ -759,10 +759,10 @@ public: // split a constraint in two constraints, so that vcit becomes the first // vertex of the new constraint - // returns the new constraint + // returns the new constraint Constraint_id split(Constraint_id first, Vertices_in_constraint_iterator vcit); - + // Query of the constraint hierarchy Constraint_iterator constraints_begin() const; Constraint_iterator constraints_end() const; @@ -770,7 +770,7 @@ public: { return Constraints(constraints_begin(),constraints_end()); } - + Subconstraint_iterator subconstraints_begin() const; Subconstraint_iterator subconstraints_end() const; @@ -778,31 +778,31 @@ public: { return Subconstraints(subconstraints_begin(),subconstraints_end()); } - - Context context(Vertex_handle va, Vertex_handle vb); //AF: const; - bool is_subconstraint(Vertex_handle va, - Vertex_handle vb); - size_type number_of_enclosing_constraints(Vertex_handle va, + Context context(Vertex_handle va, Vertex_handle vb); //AF: const; + + bool is_subconstraint(Vertex_handle va, + Vertex_handle vb); + size_type number_of_enclosing_constraints(Vertex_handle va, Vertex_handle vb) const; - Context_iterator contexts_begin(Vertex_handle va, - Vertex_handle vb) const; - Context_iterator contexts_end(Vertex_handle va, - Vertex_handle vb) const; + Context_iterator contexts_begin(Vertex_handle va, + Vertex_handle vb) const; + Context_iterator contexts_end(Vertex_handle va, + Vertex_handle vb) const; Contexts contexts(Vertex_handle va, Vertex_handle vb) const { return Contexts(contexts_begin(va,vb),contexts_end(va,vb)); } - + Vertices_in_constraint_iterator vertices_in_constraint_begin(Constraint_id cid) const; Vertices_in_constraint_iterator vertices_in_constraint_end(Constraint_id cid) const; - + Vertices_in_constraint vertices_in_constraint(Constraint_id cid) const { return Vertices_in_constraint(vertices_in_constraint_begin(cid), vertices_in_constraint_end(cid)); } - + Points_in_constraint_iterator points_in_constraint_begin(Constraint_id cid) const; Points_in_constraint_iterator points_in_constraint_end(Constraint_id cid) const ; @@ -838,12 +838,12 @@ protected: fc++; }while(fc != done); } - } + } void insert_subconstraint(Vertex_handle vaa, - Vertex_handle vbb) + Vertex_handle vbb) { insert_subconstraint(vaa,vbb,Emptyset_iterator()); } @@ -854,9 +854,9 @@ insert_subconstraint(Vertex_handle vaa, template void insert_subconstraint(Vertex_handle vaa, - Vertex_handle vbb, - OutputItertator out) - // insert the subconstraint [vaa vbb] + Vertex_handle vbb, + OutputItertator out) + // insert the subconstraint [vaa vbb] // it will eventually be split into several subconstraints { std::stack > stack; @@ -866,7 +866,7 @@ insert_subconstraint(Vertex_handle vaa, boost::tie(vaa,vbb) = stack.top(); stack.pop(); CGAL_triangulation_precondition( vaa != vbb); - + Vertex_handle vi; Face_handle fr; @@ -879,11 +879,11 @@ insert_subconstraint(Vertex_handle vaa, } continue; } - + List_faces intersected_faces; List_edges conflict_boundary_ab, conflict_boundary_ba; - - bool intersection = this->find_intersected_faces( + + bool intersection = this->find_intersected_faces( vaa, vbb, intersected_faces, conflict_boundary_ab, @@ -893,10 +893,10 @@ insert_subconstraint(Vertex_handle vaa, if ( intersection) { if (vi != vaa && vi != vbb) { hierarchy.split_constraint(vaa,vbb,vi); - stack.push(std::make_pair(vaa,vi)); - stack.push(std::make_pair(vi,vbb)); + stack.push(std::make_pair(vaa,vi)); + stack.push(std::make_pair(vi,vbb)); } - else stack.push(std::make_pair(vaa,vbb)); + else stack.push(std::make_pair(vaa,vbb)); continue; } @@ -937,7 +937,7 @@ insert_subconstraint(Vertex_handle vaa, if (vi != vbb) { hierarchy.split_constraint(vaa,vbb,vi); - stack.push(std::make_pair(vi,vbb)); + stack.push(std::make_pair(vi,vbb)); } } } @@ -954,7 +954,7 @@ public: #if defined(_MSC_VER) std::ptrdiff_t insert(InputIterator first, InputIterator last, int i = 0) #else - std::ptrdiff_t insert(InputIterator first, InputIterator last) + std::ptrdiff_t insert(InputIterator first, InputIterator last) #endif { #if defined(_MSC_VER) @@ -983,7 +983,7 @@ copy_triangulation(const Constrained_triangulation_plus_2 &ctp) { Base::copy_triangulation(ctp); //the following assumes that the triangulation and its copy - // iterate on their vertices in the same order + // iterate on their vertices in the same order std::map vmap; Vertex_iterator vit = ctp.vertices_begin(); Vertex_iterator vvit = this->vertices_begin(); @@ -1004,7 +1004,7 @@ swap(Constrained_triangulation_plus_2 &ctp) } template < class Tr > -inline +inline typename Constrained_triangulation_plus_2::Vertex_handle Constrained_triangulation_plus_2:: insert(const Point& a, Face_handle start) @@ -1042,17 +1042,17 @@ insert(const Point& a, Locate_type lt, Face_handle loc, int li) } template -typename Constrained_triangulation_plus_2:: Vertex_handle +typename Constrained_triangulation_plus_2:: Vertex_handle Constrained_triangulation_plus_2:: -intersect(Face_handle f, int i, - Vertex_handle vaa, - Vertex_handle vbb) +intersect(Face_handle f, int i, + Vertex_handle vaa, + Vertex_handle vbb) { return intersect(f, i, vaa, vbb, Intersection_tag()); } template -typename Constrained_triangulation_plus_2:: Vertex_handle +typename Constrained_triangulation_plus_2:: Vertex_handle Constrained_triangulation_plus_2:: intersect(Face_handle, int, Vertex_handle, @@ -1076,13 +1076,13 @@ intersect(Face_handle, int, } template -typename Constrained_triangulation_plus_2:: Vertex_handle +typename Constrained_triangulation_plus_2:: Vertex_handle Constrained_triangulation_plus_2:: -intersect(Face_handle f, int i, - Vertex_handle vaa, - Vertex_handle vbb, - Exact_intersections_tag) -// compute the intersection of the constraint edge (f,i) +intersect(Face_handle f, int i, + Vertex_handle vaa, + Vertex_handle vbb, + Exact_intersections_tag) +// compute the intersection of the constraint edge (f,i) // with the subconstraint (vaa,vbb) being inserted // insert the intersection point // (the constraint edge (f,i) will be split in hierarchy by insert) @@ -1110,16 +1110,16 @@ intersect(Face_handle f, int i, CGAL_triangulation_assertion(ok); Vertex_handle vi = insert(pi, Triangulation::EDGE, f, i); - return vi; + return vi; } template -typename Constrained_triangulation_plus_2::Vertex_handle +typename Constrained_triangulation_plus_2::Vertex_handle Constrained_triangulation_plus_2:: -intersect(Face_handle f, int i, - Vertex_handle vaa, - Vertex_handle vbb, - Exact_predicates_tag) +intersect(Face_handle f, int i, + Vertex_handle vaa, + Vertex_handle vbb, + Exact_predicates_tag) { Vertex_handle vcc, vdd; vcc = f->vertex(cw(i)); @@ -1141,7 +1141,7 @@ intersect(Face_handle f, int i, case 0 : vi = vaa; break; case 1 : vi = vbb; break; case 2 : vi = vcc; break; - case 3 : vi = vdd; break; + case 3 : vi = vdd; break; } if(vi == vaa || vi == vbb) { Triangulation::remove_constrained_edge(f, i); @@ -1154,15 +1154,15 @@ intersect(Face_handle f, int i, // vi == vc or vi == vd may happen even if intersection==true // due to approximate construction of the intersection - if (vi != vcc && vi != vdd) { + if (vi != vcc && vi != vdd) { hierarchy.split_constraint(vcc,vdd,vi); - insert_subconstraint(vcc,vi); + insert_subconstraint(vcc,vi); insert_subconstraint(vi, vdd); - } + } else { insert_subconstraint(vcc,vdd); } - return vi; + return vi; } // CONCATENATE AND SPLIT @@ -1177,7 +1177,7 @@ Constrained_triangulation_plus_2::concatenate(Constraint_id first, Constrain // split a constraint in two constraints, so that vcit becomes the first // vertex of the new constraint - // returns the new constraint + // returns the new constraint template typename Constrained_triangulation_plus_2::Constraint_id Constrained_triangulation_plus_2::split(Constraint_id first, Vertices_in_constraint_iterator vcit) @@ -1188,8 +1188,8 @@ Constrained_triangulation_plus_2::split(Constraint_id first, Vertices_in_con template std::ostream & -operator<<(std::ostream& os, - const Constrained_triangulation_plus_2 &ct) +operator<<(std::ostream& os, + const Constrained_triangulation_plus_2 &ct) { ct.file_output(os); return os ; @@ -1197,8 +1197,8 @@ operator<<(std::ostream& os, template std::istream & -operator>>(std::istream& is, - Constrained_triangulation_plus_2 &ct) +operator>>(std::istream& is, + Constrained_triangulation_plus_2 &ct) { ct.file_input(is); return is ; @@ -1258,13 +1258,13 @@ context(Vertex_handle va, Vertex_handle vb) // AF: const template -inline +inline typename Constrained_triangulation_plus_2::size_type Constrained_triangulation_plus_2:: number_of_enclosing_constraints(Vertex_handle va, Vertex_handle vb) const { - return static_cast - (hierarchy.number_of_enclosing_constraints(va,vb)); + return static_cast + (hierarchy.number_of_enclosing_constraints(va,vb)); } template @@ -1272,7 +1272,7 @@ inline bool Constrained_triangulation_plus_2:: is_subconstraint(Vertex_handle va, Vertex_handle vb) { - return hierarchy.is_subconstrained_edge(va,vb); + return hierarchy.is_subconstrained_edge(va,vb); } diff --git a/Triangulation_2/include/CGAL/Triangulation_2/internal/Polyline_constraint_hierarchy_2.h b/Triangulation_2/include/CGAL/Triangulation_2/internal/Polyline_constraint_hierarchy_2.h index 91d58c4b9dc..8f6fbc7fbed 100644 --- a/Triangulation_2/include/CGAL/Triangulation_2/internal/Polyline_constraint_hierarchy_2.h +++ b/Triangulation_2/include/CGAL/Triangulation_2/internal/Polyline_constraint_hierarchy_2.h @@ -6,7 +6,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Andreas Fabri, Olivier Billet, Mariette Yvinec @@ -19,8 +19,8 @@ #include #include #include -#include -#include +#include +#include #include #include @@ -57,11 +57,11 @@ private: typedef std::list Constraint_list; public: - // the base line is always - class Point_it + // the base line is always + class Point_it : public boost::iterator_adaptor< Point_it - , typename Vertex_list::all_iterator + , typename Vertex_list::all_iterator , const Point > { @@ -74,10 +74,10 @@ public: }; // only nodes with a vertex_handle that is still in the triangulation - class Vertex_it + class Vertex_it : public boost::iterator_adaptor< Vertex_it - , typename Vertex_list::skip_iterator + , typename Vertex_list::skip_iterator , Vertex_handle , boost::use_default , Vertex_handle> @@ -106,11 +106,11 @@ public: Vertex_list* vl_ptr() const {return second;} operator std::pair,Vertex_list*>() - { + { if (second!=nullptr){ return std::make_pair(std::make_pair(second->front().vertex(), second->back().vertex()),second); - } + } return std::make_pair(std::make_pair(Vertex_handle(),Vertex_handle()),second); } @@ -163,35 +163,35 @@ public: Vertex_it vertices_end()const {return enclosing->skip_end();} Constraint_id id() { return enclosing; } std::size_t number_of_vertices() const {return enclosing->skip_size(); } - }; + }; typedef std::list Context_list; typedef typename Context_list::iterator Context_iterator; typedef std::set Constraint_set; typedef std::map Sc_to_c_map; + Pair_compare> Sc_to_c_map; typedef typename Constraint_set::iterator C_iterator; typedef typename Sc_to_c_map::const_iterator Sc_iterator; typedef Sc_iterator Subconstraint_iterator; - + private: // data for the 1d hierarchy Compare comp; Constraint_set constraint_set; Sc_to_c_map sc_to_c_map; - + public: Polyline_constraint_hierarchy_2(const Compare& comp) : comp(comp) , sc_to_c_map(Pair_compare(comp)) { } - Polyline_constraint_hierarchy_2(const Polyline_constraint_hierarchy_2& ch); + Polyline_constraint_hierarchy_2(const Polyline_constraint_hierarchy_2& ch); ~Polyline_constraint_hierarchy_2(){ clear();} void clear(); Polyline_constraint_hierarchy_2& operator=(const Polyline_constraint_hierarchy_2& ch); - // Query + // Query bool is_subconstrained_edge(T va, T vb) const; bool is_constrained_edge(T va, T vb) const; bool is_constrained_vertex(T v) const; @@ -219,7 +219,7 @@ public: Context_iterator contexts_end(T va, T vb) const; std::size_t number_of_constraints() const { return constraint_set.size();} std::size_t number_of_subconstraints()const {return sc_to_c_map.size();} - + // insert/remove void add_Steiner(T va, T vb, T vx); @@ -248,31 +248,31 @@ public: // iterators Subconstraint_iterator subconstraint_begin() const - { - return sc_to_c_map.begin(); + { + return sc_to_c_map.begin(); } Subconstraint_iterator subconstraint_end() const - { - return sc_to_c_map.end(); + { + return sc_to_c_map.end(); } Sc_iterator sc_begin() const{ return sc_to_c_map.begin(); } Sc_iterator sc_end() const{ return sc_to_c_map.end(); } C_iterator c_begin() const{ return constraint_set.begin(); } C_iterator c_end() const{ return constraint_set.end(); } - + // Helper functions void copy(const Polyline_constraint_hierarchy_2& ch); void copy(const Polyline_constraint_hierarchy_2& ch, std::map& vmap); void swap(Polyline_constraint_hierarchy_2& ch); -private: +private: Edge make_edge(T va, T vb) const; Vertex_it get_pos(T va, T vb) const; - bool get_contexts(T va, T vb, - Context_iterator& ctxt, - Context_iterator& past) const; + bool get_contexts(T va, T vb, + Context_iterator& ctxt, + Context_iterator& past) const; bool get_contexts(T va, T vb, Context_list*&) const; @@ -349,8 +349,8 @@ copy(const Polyline_constraint_hierarchy_2& ch1, std::mapskip_begin(); Vertex_it aux = cit1->enclosing->skip_begin(); while( aux != cit1->pos) { - ++aux; - ++ctxt2.pos; + ++aux; + ++ctxt2.pos; } hcl2->push_back(ctxt2); } @@ -437,8 +437,8 @@ enclosing_constraints(T vaa, T vbb , Constraint_list& hcl) const Context_iterator hcit, past; if ( !get_contexts(vaa,vbb, hcit ,past)) return false; for (; hcit!=past; hcit++) { - hcl.push_back(make_edge(hcit->enclosing->front(), - hcit->enclosing->back())); + hcl.push_back(make_edge(hcit->enclosing->front(), + hcit->enclosing->back())); } return true; } @@ -454,7 +454,7 @@ context(T va, T vb) } template -std::size_t +std::size_t Polyline_constraint_hierarchy_2:: number_of_enclosing_constraints(T va, T vb) const { @@ -478,19 +478,19 @@ template typename Polyline_constraint_hierarchy_2::Context_iterator Polyline_constraint_hierarchy_2:: contexts_end(T va, T vb) const -{ +{ Context_iterator first, last; if( !get_contexts(va,vb,first,last)) CGAL_triangulation_assertion(false); return last; -} +} template void Polyline_constraint_hierarchy_2:: swap(Constraint_id first, Constraint_id second){ // We have to look at all subconstraints - for(Vertex_it it = first.vl_ptr()->skip_begin(), succ = it, end = first.vl_ptr()->skip_end(); - ++succ != end; + for(Vertex_it it = first.vl_ptr()->skip_begin(), succ = it, end = first.vl_ptr()->skip_end(); + ++succ != end; ++it){ typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ)); CGAL_triangulation_assertion(scit != sc_to_c_map.end()); @@ -499,14 +499,14 @@ swap(Constraint_id first, Constraint_id second){ // and replace the context of the constraint for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) { if(ctit->enclosing == first.vl_ptr()){ - ctit->enclosing = 0; - break; + ctit->enclosing = 0; + break; } } } // We have to look at all subconstraints - for(Vertex_it it = second.vl_ptr()->skip_begin(), succ = it, end = second.vl_ptr()->skip_end(); - ++succ != end; + for(Vertex_it it = second.vl_ptr()->skip_begin(), succ = it, end = second.vl_ptr()->skip_end(); + ++succ != end; ++it){ typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ)); CGAL_triangulation_assertion(scit != sc_to_c_map.end()); @@ -515,14 +515,14 @@ swap(Constraint_id first, Constraint_id second){ // and replace the context of the constraint for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) { if(ctit->enclosing == second.vl_ptr()){ - ctit->enclosing = first.vl_ptr(); - break; + ctit->enclosing = first.vl_ptr(); + break; } } - } + } // We have to look at all subconstraints - for(Vertex_it it = first.vl_ptr()->skip_begin(), succ = it, end = first.vl_ptr()->skip_end(); - ++succ != end; + for(Vertex_it it = first.vl_ptr()->skip_begin(), succ = it, end = first.vl_ptr()->skip_end(); + ++succ != end; ++it){ typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ)); CGAL_triangulation_assertion(scit != sc_to_c_map.end()); @@ -531,8 +531,8 @@ swap(Constraint_id first, Constraint_id second){ // and replace the context of the constraint for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) { if(ctit->enclosing == 0){ - ctit->enclosing = second.vl_ptr(); - break; + ctit->enclosing = second.vl_ptr(); + break; } } } @@ -545,10 +545,10 @@ void Polyline_constraint_hierarchy_2:: remove_constraint(Constraint_id cid){ constraint_set.erase(cid); - + // We have to look at all subconstraints - for(Vertex_it it = cid.vl_ptr()->skip_begin(), succ = it, end = cid.vl_ptr()->skip_end(); - ++succ != end; + for(Vertex_it it = cid.vl_ptr()->skip_begin(), succ = it, end = cid.vl_ptr()->skip_end(); + ++succ != end; ++it){ typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ)); CGAL_triangulation_assertion(scit != sc_to_c_map.end()); @@ -557,8 +557,8 @@ remove_constraint(Constraint_id cid){ // and remove the context of the constraint for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) { if(ctit->enclosing == cid.vl_ptr()){ - hcl->erase(ctit); - break; + hcl->erase(ctit); + break; } } // If the constraint passes several times through the same subconstraint, @@ -605,12 +605,12 @@ void Polyline_constraint_hierarchy_2::simplify(Vertex_it uc, CGAL_assertion_msg( vw_sc_iter != sc_to_c_map.end(), "not a subconstraint" ); Context_list* vw_hcl = vw_sc_iter->second; CGAL_assertion_msg((u == w) || (vw_hcl->size() == 1), "more than one constraint passing through the subconstraint" ); - + Vertex_list* vertex_list = uv_hcl->front().id().vl_ptr(); CGAL_assertion_msg(vertex_list == vw_hcl->front().id().vl_ptr(), "subconstraints from different polyline constraints" ); // Remove the list item which points to v vertex_list->skip(vc.base()); - + if(u != w){ // Remove the entries for [u,v] and [v,w] sc_to_c_map.erase(uv_sc_iter); @@ -630,8 +630,8 @@ std::size_t Polyline_constraint_hierarchy_2::remove_points_without_corresponding_vertex(Constraint_id cid) { std::size_t n = 0; - for(Point_it it = points_in_constraint_begin(cid); - it != points_in_constraint_end(cid); ++it) { + for(Point_it it = points_in_constraint_begin(cid); + it != points_in_constraint_end(cid); ++it) { if(cid.vl_ptr()->is_skipped(it.base())) { it = cid.vl_ptr()->erase(it.base()); ++n; @@ -659,8 +659,8 @@ Polyline_constraint_hierarchy_2::concatenate(Constraint_id firs constraint_set.erase(first); constraint_set.erase(second); // We have to look at all subconstraints - for(Vertex_it it = second.vl_ptr()->skip_begin(), succ = it, end = second.vl_ptr()->skip_end(); - ++succ != end; + for(Vertex_it it = second.vl_ptr()->skip_begin(), succ = it, end = second.vl_ptr()->skip_end(); + ++succ != end; ++it){ typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ)); CGAL_triangulation_assertion(scit != sc_to_c_map.end()); @@ -669,8 +669,8 @@ Polyline_constraint_hierarchy_2::concatenate(Constraint_id firs // and replace the context of the constraint for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) { if(ctit->enclosing == second.vl_ptr()){ - ctit->enclosing = first.vl_ptr(); - break; + ctit->enclosing = first.vl_ptr(); + break; } } } @@ -684,8 +684,8 @@ Polyline_constraint_hierarchy_2::concatenate(Constraint_id firs // Note that for VC8 with iterator debugging the iterators pointing into second // are NOT valid So we have to update them - for(Vertex_it it = back_it, succ = it, end = first.vl_ptr()->skip_end(); - ++succ != end; + for(Vertex_it it = back_it, succ = it, end = first.vl_ptr()->skip_end(); + ++succ != end; ++it){ typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ)); CGAL_triangulation_assertion(scit != sc_to_c_map.end()); @@ -694,8 +694,8 @@ Polyline_constraint_hierarchy_2::concatenate(Constraint_id firs // and update pos in the context of the constraint for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) { if(ctit->enclosing == first.vl_ptr()){ - ctit->pos = it; - break; + ctit->pos = it; + break; } } } @@ -708,12 +708,12 @@ Polyline_constraint_hierarchy_2::concatenate(Constraint_id firs template typename Polyline_constraint_hierarchy_2::Constraint_id Polyline_constraint_hierarchy_2::concatenate2(Constraint_id first, Constraint_id second) -{ +{ constraint_set.erase(first); constraint_set.erase(second); // We have to look at all subconstraints - for(Vertex_it it = first.vl_ptr()->skip_begin(), succ = it, end = first.vl_ptr()->skip_end(); - ++succ != end; + for(Vertex_it it = first.vl_ptr()->skip_begin(), succ = it, end = first.vl_ptr()->skip_end(); + ++succ != end; ++it){ typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ)); CGAL_triangulation_assertion(scit != sc_to_c_map.end()); @@ -722,8 +722,8 @@ Polyline_constraint_hierarchy_2::concatenate2(Constraint_id fir // and replace the context of the constraint for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) { if(ctit->enclosing == first.vl_ptr()){ - ctit->enclosing = second.vl_ptr(); - break; + ctit->enclosing = second.vl_ptr(); + break; } } } @@ -736,8 +736,8 @@ Polyline_constraint_hierarchy_2::concatenate2(Constraint_id fir // Note that for VC8 with iterator debugging the iterators pointing into second // are NOT valid So we have to update them - for(Vertex_it it = second.vl_ptr()->skip_begin(), succ = it, end = back_it; - ++succ != end; + for(Vertex_it it = second.vl_ptr()->skip_begin(), succ = it, end = back_it; + ++succ != end; ++it){ typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ)); CGAL_triangulation_assertion(scit != sc_to_c_map.end()); @@ -746,8 +746,8 @@ Polyline_constraint_hierarchy_2::concatenate2(Constraint_id fir // and update pos in the context of the constraint for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) { if(ctit->enclosing == second.vl_ptr()){ - ctit->pos = it; - break; + ctit->pos = it; + break; } } } @@ -760,7 +760,7 @@ Polyline_constraint_hierarchy_2::concatenate2(Constraint_id fir // split a constraint in two constraints, so that vcit becomes the first // vertex of the new constraint - // returns the new constraint + // returns the new constraint template typename Polyline_constraint_hierarchy_2::Constraint_id Polyline_constraint_hierarchy_2::split(Constraint_id first, Vertex_it vcit) @@ -777,8 +777,8 @@ Polyline_constraint_hierarchy_2::split(Constraint_id first, Ver constraint_set.insert(first); constraint_set.insert(second); // We have to look at all subconstraints - for(Vertex_it it = second->skip_begin(), succ = it, end = second->skip_end(); - ++succ != end; + for(Vertex_it it = second->skip_begin(), succ = it, end = second->skip_end(); + ++succ != end; ++it){ typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ)); CGAL_triangulation_assertion(scit != sc_to_c_map.end()); @@ -787,8 +787,8 @@ Polyline_constraint_hierarchy_2::split(Constraint_id first, Ver // and replace the context of the constraint for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) { if(ctit->enclosing == first.vl_ptr()){ - ctit->enclosing = second; - break; + ctit->enclosing = second; + break; } } } @@ -811,8 +811,8 @@ Polyline_constraint_hierarchy_2::split2(Constraint_id first, Ve constraint_set.insert(first); constraint_set.insert(second); // We have to look at all subconstraints - for(Vertex_it it = second->skip_begin(), succ = it, end = second->skip_end(); - ++succ != end; + for(Vertex_it it = second->skip_begin(), succ = it, end = second->skip_end(); + ++succ != end; ++it){ typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ)); CGAL_triangulation_assertion(scit != sc_to_c_map.end()); @@ -821,8 +821,8 @@ Polyline_constraint_hierarchy_2::split2(Constraint_id first, Ve // and replace the context of the constraint for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) { if(ctit->enclosing == first.vl_ptr()){ - ctit->enclosing = second; - break; + ctit->enclosing = second; + break; } } } @@ -839,7 +839,7 @@ typename Polyline_constraint_hierarchy_2::Vertex_list* Polyline_constraint_hierarchy_2:: insert_constraint(T va, T vb){ Edge he = make_edge(va, vb); - Vertex_list* children = new Vertex_list; + Vertex_list* children = new Vertex_list; Context_list* fathers; typename Sc_to_c_map::iterator scit = sc_to_c_map.find(he); @@ -861,14 +861,14 @@ insert_constraint(T va, T vb){ return children; } - + template typename Polyline_constraint_hierarchy_2::Vertex_list* Polyline_constraint_hierarchy_2:: insert_constraint_old_API(T va, T vb){ Edge he = make_edge(va, vb); - Vertex_list* children = new Vertex_list; + Vertex_list* children = new Vertex_list; Context_list* fathers; typename Sc_to_c_map::iterator scit = sc_to_c_map.find(he); @@ -972,7 +972,7 @@ remove_Steiner(T v, T va, T vb) { // remove a Steiner point CGAL_precondition(!is_constrained_vertex(v)); - + Context_list* hcl1; Context_list* hcl2; if(!get_contexts(va,v,hcl1)) CGAL_triangulation_assertion(false); @@ -996,7 +996,7 @@ remove_Steiner(T v, T va, T vb) /* same as add_Steiner - precondition : va,vb est une souscontrainte. + precondition : va,vb est une souscontrainte. */ template void Polyline_constraint_hierarchy_2:: @@ -1006,7 +1006,7 @@ split_constraint(T va, T vb, T vc){ template -void +void Polyline_constraint_hierarchy_2:: add_Steiner(T va, T vb, T vc){ Context_list* hcl=nullptr; @@ -1022,11 +1022,11 @@ add_Steiner(T va, T vb, T vc){ ++pos; pos = ctit->enclosing->insert(pos.base(), Node(vc)); --pos; - + // set ctxt to the context of (vc,vb) // change *ctit in hcl to the context of (va,vc) // add ctxt to hcl2 list - ctxt.enclosing = ctit->enclosing; + ctxt.enclosing = ctit->enclosing; if(*pos == va) { ctit->pos = pos; ctxt.pos = ++pos; @@ -1051,8 +1051,8 @@ add_Steiner(T va, T vb, T vc){ delete hcl2; } else sc_to_c_map.insert(std::make_pair(make_edge(vc,vb), hcl2)); - - + + sc_to_c_map.erase(make_edge(va,vb)); return; } @@ -1083,15 +1083,15 @@ template inline bool Polyline_constraint_hierarchy_2:: -get_contexts(T va, T vb, - Context_iterator& ctxt, - Context_iterator& past) const +get_contexts(T va, T vb, + Context_iterator& ctxt, + Context_iterator& past) const { Context_list* hcl; if (!get_contexts(va,vb,hcl)) return false; ctxt = hcl->begin(); past = hcl->end(); - return true; + return true; } @@ -1124,7 +1124,7 @@ template void Polyline_constraint_hierarchy_2:: print() const -{ +{ C_iterator hcit; std::map vertex_num; int num = 0; @@ -1140,7 +1140,7 @@ print() const // for(; vnit != vertex_num.end(); vnit++) { // vnit->second = ++num; // std::cerr << "vertex num " << num << " " << vnit->first->point() -// << std::endl; +// << std::endl; // } C_iterator cit=c_begin(); @@ -1163,19 +1163,19 @@ print() const std::cout << std::endl ; for(;scit != sc_end(); scit++){ std::cout << "subconstraint " ; - std::cout << vertex_num[scit->first.first] << " " - << vertex_num[scit->first.second]; + std::cout << vertex_num[scit->first.first] << " " + << vertex_num[scit->first.second]; Context_iterator cb, ce; get_contexts(scit->first.first, scit->first.second, cb, ce); - + std::cout << " enclosing " ; - for(; cb != ce; cb++) { + for(; cb != ce; cb++) { std::cout << cb->id().vl_ptr(); std::cout << " " ; } std::cout << std::endl ; } - return; + return; } diff --git a/Triangulation_2/include/CGAL/Triangulation_face_base_with_id_2.h b/Triangulation_2/include/CGAL/Triangulation_face_base_with_id_2.h index 8d5a54281e1..d5d344c8aa8 100644 --- a/Triangulation_2/include/CGAL/Triangulation_face_base_with_id_2.h +++ b/Triangulation_2/include/CGAL/Triangulation_face_base_with_id_2.h @@ -5,7 +5,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Mael Rouxel-LabbĂ© diff --git a/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_constrained_triangulation_2.h b/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_constrained_triangulation_2.h index eaa9e936e1c..344d9b858c9 100644 --- a/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_constrained_triangulation_2.h +++ b/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_constrained_triangulation_2.h @@ -9,10 +9,10 @@ // intended for general use. // // ---------------------------------------------------------------------------- -// +// // release : // release_date : -// +// // file : test/Triangulation/include/CGAL/_test_cls_constrained... // source : $URL$ // revision : $Id$ @@ -89,7 +89,7 @@ _test_cdt_throwing(const Pt& p0, const Pt& p1, const Pt& p2, const Pt& p3, } template -void +void _test_cls_constrained_triangulation(const Triang &) { // typedef Triangulation Cls; @@ -132,7 +132,7 @@ _test_cls_constrained_triangulation(const Triang &) assert( T0_1.dimension() == -1 ); assert( T0_1.number_of_vertices() == 0 ); assert( T0_1.is_valid() ); - + l.push_back(Constraint(Point(0,0),Point(0,0))); Triang T0_2(l); assert( T0_2.dimension() == 0 ); @@ -149,7 +149,7 @@ _test_cls_constrained_triangulation(const Triang &) assert( T1_1.dimension() == 1 ); assert( T1_1.number_of_vertices() == 4 ); assert( T1_1.is_valid() ); - + l.erase(l.begin(),l.end()); for (m=0; m<4; m++) l.push_back(Constraint(Point(3*m, 2*m),Point(3*(m+1),2*(m+1)) )); @@ -168,7 +168,7 @@ _test_cls_constrained_triangulation(const Triang &) assert( T2_1.dimension() == 2 ); assert( T2_1.number_of_vertices() == 5); assert( T2_1.is_valid() ); - + l.erase(l.begin(),l.end()); Point lpt[20] = { @@ -177,14 +177,14 @@ _test_cls_constrained_triangulation(const Triang &) Point(0,2), Point(1,2), Point(2,2), Point(3,2),Point(4,2), Point(4,3), Point(3,3), Point(2,3), Point(1,3),Point(0,3) }; - for (m=0;m<19;m++) + for (m=0;m<19;m++) l.push_back(Constraint(lpt[m],lpt[m+1])); Triang T2_2(l); assert( T2_2.dimension() == 2 ); assert( T2_2.number_of_vertices() == 20); assert( T2_2.is_valid() ); - + // Build triangulation with iterator std::cout << " with input iterator" << std::endl; list_iterator first=l.begin(); @@ -227,7 +227,7 @@ _test_cls_constrained_triangulation(const Triang &) std::ofstream of1_2("T12.triangulation"); CGAL::set_ascii_mode(of1_2); of1_2 << T1_2; of1_2.close(); - + std::ofstream of2_1("T21.triangulation"); CGAL::set_ascii_mode(of2_1); of2_1 << T2_1; of2_1.close(); @@ -263,18 +263,18 @@ _test_cls_constrained_triangulation(const Triang &) All_faces_iterator fit2 = T2_2.all_faces_begin(); All_faces_iterator fit2_bis = T2_4.all_faces_begin(); for( ; fit2 != T2_2.all_faces_end(); ++fit2, ++fit2_bis) { - for(int i=0; i<3 ; i++) + for(int i=0; i<3 ; i++) assert( fit2->is_constrained(i) == fit2_bis->is_constrained(i) ); } - - - + + + // remove_constraint and remove _1 dim std::cout << "remove_constrained_edge and remove 1-dim" << std::endl; Face_handle fh; int ih; Vertex_handle vha, vhb; - Locate_type lt; + Locate_type lt; int li; fh = T1_2.locate(Point(0,0),lt,li); assert( lt == Triang::VERTEX ); vha = fh->vertex(li); @@ -295,14 +295,14 @@ _test_cls_constrained_triangulation(const Triang &) vha = fh->vertex(li); List_edges edges; assert(T1_2.are_there_incident_constraints(vha, - std::back_inserter(edges))); + std::back_inserter(edges))); List_edges ic_edges; std::back_insert_iterator inserter(ic_edges); inserter = T1_2.incident_constraints(vha, inserter); - assert(ic_edges.size() == 1); + assert(ic_edges.size() == 1); T1_2.remove_incident_constraints(vha); inserter = T1_2.incident_constraints(vha, inserter ); - assert(ic_edges.size() == 1); + assert(ic_edges.size() == 1); T1_2.remove(vha); assert(T1_2.is_valid()); @@ -320,7 +320,7 @@ _test_cls_constrained_triangulation(const Triang &) T2_2.insert(lpt[m], lpt[m+1]); assert(T2_2.is_valid()); fh = T2_2.locate(lpt[m+1],lt,li); assert( lt == Triang::VERTEX ); - vhb = fh->vertex(li); + vhb = fh->vertex(li); assert(T2_2.are_there_incident_constraints(vhb)); T2_2.remove_incident_constraints(vhb); T2_2.remove(vhb); @@ -331,12 +331,12 @@ _test_cls_constrained_triangulation(const Triang &) edges.clear(); ic_edges.clear(); assert(T2_2.are_there_incident_constraints(vha)); - assert(T2_2.are_there_incident_constraints(vha, - std::back_inserter(edges))); + assert(T2_2.are_there_incident_constraints(vha, + std::back_inserter(edges))); ic_edges.clear(); inserter = std::back_insert_iterator(ic_edges); inserter = T2_2.incident_constraints(vha,inserter); - assert(ic_edges.size() == 2); + assert(ic_edges.size() == 2); T2_2.remove_incident_constraints(vha); inserter = T2_2.incident_constraints(vha, inserter); assert(ic_edges.size() == 2); diff --git a/Triangulation_2/test/Triangulation_2/test_const_del_triangulation_2.cpp b/Triangulation_2/test/Triangulation_2/test_const_del_triangulation_2.cpp index 3f1c18b5d73..0cd3828976c 100644 --- a/Triangulation_2/test/Triangulation_2/test_const_del_triangulation_2.cpp +++ b/Triangulation_2/test/Triangulation_2/test_const_del_triangulation_2.cpp @@ -7,10 +7,10 @@ // intended for general use. // // ---------------------------------------------------------------------------- -// +// // release : // release_date : -// +// // file : test/Triangulation/test_constrained_triangulation.C // source : $URL$ // revision : $Id$ diff --git a/Triangulation_2/test/Triangulation_2/test_constrained_triangulation_2.cpp b/Triangulation_2/test/Triangulation_2/test_constrained_triangulation_2.cpp index 18746efd090..3e80ba7652b 100644 --- a/Triangulation_2/test/Triangulation_2/test_constrained_triangulation_2.cpp +++ b/Triangulation_2/test/Triangulation_2/test_constrained_triangulation_2.cpp @@ -7,10 +7,10 @@ // intended for general use. // // ---------------------------------------------------------------------------- -// +// // release : // release_date : -// +// // file : test/Triangulation/test_constrained_triangulation.C // source : $URL$ // revision : $Id$ @@ -60,7 +60,7 @@ int main() typedef CGAL::Exact_predicates_tag Itag; typedef CGAL::Constrained_triangulation_2 Ctwi; _test_cls_constrained_triangulation(Ctwi()); - + std::cout << "Testing constrained_triangulation "<< std::endl; std::cout << " with Exact_intersections_tag : " << std::endl; typedef CGAL::Triangulation_vertex_base_2 Vbb; @@ -69,6 +69,6 @@ int main() typedef CGAL::Exact_intersections_tag EItag; typedef CGAL::Constrained_triangulation_2 Ctwei; _test_cls_constrained_triangulation(Ctwei()); - + return 0; } diff --git a/Triangulation_3/include/CGAL/Delaunay_triangulation_3.h b/Triangulation_3/include/CGAL/Delaunay_triangulation_3.h index 2c53f6f6bcd..e5dbec51447 100644 --- a/Triangulation_3/include/CGAL/Delaunay_triangulation_3.h +++ b/Triangulation_3/include/CGAL/Delaunay_triangulation_3.h @@ -258,7 +258,7 @@ public: insert(first, last); } - + private: #ifdef CGAL_CONCURRENT_TRIANGULATION_3_ADD_TEMPORARY_POINTS_ON_FAR_SPHERE std::vector @@ -406,7 +406,7 @@ public: private: using Tr_Base::top_get_first; using Tr_Base::top_get_second; - + template std::ptrdiff_t insert_with_info(InputIterator first, InputIterator last) { diff --git a/Triangulation_3/include/CGAL/Triangulation_3_to_lcc.h b/Triangulation_3/include/CGAL/Triangulation_3_to_lcc.h index 1bb09346ee9..c7cb375b039 100644 --- a/Triangulation_3/include/CGAL/Triangulation_3_to_lcc.h +++ b/Triangulation_3/include/CGAL/Triangulation_3_to_lcc.h @@ -19,7 +19,7 @@ namespace CGAL { - namespace internal + namespace internal { template struct Get_point @@ -35,7 +35,7 @@ namespace CGAL { { return p.point(); } }; } - + /** Convert a given Triangulation_3 into a 3D linear cell complex. * @param alcc the used linear cell complex. * @param atr the Triangulation_3. diff --git a/Visibility_2/include/CGAL/Triangular_expansion_visibility_2.h b/Visibility_2/include/CGAL/Triangular_expansion_visibility_2.h index 12a9580ecef..43a66c0fbd0 100644 --- a/Visibility_2/include/CGAL/Triangular_expansion_visibility_2.h +++ b/Visibility_2/include/CGAL/Triangular_expansion_visibility_2.h @@ -9,7 +9,7 @@ // // // Author(s): Michael Hemmer -// +// #ifndef CGAL_TRIANGULAR_EXPANSION_VISIBILITY_2_H #define CGAL_TRIANGULAR_EXPANSION_VISIBILITY_2_H @@ -61,7 +61,7 @@ public: typedef typename Geometry_traits_2::Object_2 Object_2; typedef RegularizationCategory Regularization_category; - + typedef CGAL::Tag_true Supports_general_polygon_category; typedef CGAL::Tag_true Supports_simple_polygon_category; @@ -88,7 +88,7 @@ private: // Observer to track any changes of the attached arrangement. class Observer : public Arr_observer { - + typedef Arr_observer Base; typedef Observer Self; @@ -144,7 +144,7 @@ private: void after_remove_outer_ccb(Face_handle) { has_changed = true; } void after_remove_inner_ccb(Face_handle) { has_changed = true; } }; - + private: const Arrangement_2* p_arr; @@ -159,14 +159,14 @@ private: Self& operator= (const Self& ); -public: +public: Triangular_expansion_visibility_2() : p_arr(nullptr){} /*! Constructor given an arrangement. */ Triangular_expansion_visibility_2 (const Arrangement_2& arr) : p_arr(&arr), observer(arr) { - init_cdt(); + init_cdt(); } const std::string name() const { return std::string("T_visibility_2"); } @@ -182,15 +182,15 @@ public: p_arr = &arr; observer.detach(); observer.attach(const_cast(arr)); - init_cdt(); - } + init_cdt(); + } //std::cout << "attach done" << std::endl; } void detach() { //std::cout << "detach" << std::endl; observer.detach(); - p_arr = nullptr; + p_arr = nullptr; p_cdt.reset(); } @@ -389,58 +389,58 @@ private: } Point_2 ray_seg_intersection( - const Point_2& q, const Point_2& b, // the ray + const Point_2& q, const Point_2& b, // the ray const Point_2& s, const Point_2& t // the segment ) const { Ray_2 ray(q,b); Segment_2 seg(s,t); CGAL_assertion(typename K::Do_intersect_2()(ray,seg)); - CGAL::Object obj = typename K::Intersect_2()(ray,seg); + CGAL::Object obj = typename K::Intersect_2()(ray,seg); Point_2 result = object_cast(obj); - return result; + return result; } void collect_needle( - const Point_2& q, - const typename CDT::Vertex_handle vh, - const typename CDT::Face_handle fh, + const Point_2& q, + const typename CDT::Vertex_handle vh, + const typename CDT::Face_handle fh, int index) const { - // the expanded edge should not be constrained + // the expanded edge should not be constrained CGAL_assertion(!p_cdt->is_constrained(get_edge(fh,index))); CGAL_assertion(!p_cdt->is_infinite(fh)); - // go into the new face - const typename CDT::Face_handle nfh(fh->neighbor(index)); + // go into the new face + const typename CDT::Face_handle nfh(fh->neighbor(index)); CGAL_assertion(!p_cdt->is_infinite(nfh)); - // get indices of neighbors - int nindex = nfh->index(fh); // index of new vertex and old face - int rindex = p_cdt->ccw(nindex); // index of face behind right edge - int lindex = p_cdt-> cw(nindex); // index of face behind left edge - - // get vertices seen from entering edge + // get indices of neighbors + int nindex = nfh->index(fh); // index of new vertex and old face + int rindex = p_cdt->ccw(nindex); // index of face behind right edge + int lindex = p_cdt-> cw(nindex); // index of face behind left edge + + // get vertices seen from entering edge const typename CDT::Vertex_handle nvh(nfh->vertex(nindex)); const typename CDT::Vertex_handle rvh(nfh->vertex(p_cdt->cw (nindex))); const typename CDT::Vertex_handle lvh(nfh->vertex(p_cdt->ccw(nindex))); CGAL_assertion(!p_cdt->is_infinite(nvh)); CGAL_assertion(!p_cdt->is_infinite(lvh)); CGAL_assertion(!p_cdt->is_infinite(rvh)); - - // get edges seen from entering edge + + // get edges seen from entering edge typename CDT::Edge re = get_edge(nfh,p_cdt->ccw(nindex)); typename CDT::Edge le = get_edge(nfh,p_cdt-> cw(nindex)); - - // do orientation computation once for new vertex - typename K::Orientation_2 orientation = + + // do orientation computation once for new vertex + typename K::Orientation_2 orientation = p_cdt->geom_traits().orientation_2_object(); CGAL::Orientation orient = orientation(q,vh->point(),nvh->point()); - - + + //std::cout << "\n collect_needle" <point() "<< vh->point() << std::endl; + //std::cout << "vh->point() "<< vh->point() << std::endl; //std::cout << "lvh->point() "<< lvh->point() << std::endl ; //std::cout << "nvh->point() "<< nvh->point() << std::endl ; //std::cout << "rvh->point() "<< rvh->point() << std::endl<< std::endl; @@ -448,12 +448,12 @@ private: switch ( orient ) { case CGAL::COUNTERCLOCKWISE: - // looking on to the right edge + // looking on to the right edge if(p_cdt->is_constrained(re)) { if(vh != rvh) { Point_2 p = ray_seg_intersection(q, vh->point(), nvh->point(), rvh->point()); - //std::cout << vh->point() <<" -1- "<< p <point() <<" -1- "<< p <point(),p)); } } else { @@ -461,27 +461,27 @@ private: } break; case CGAL::CLOCKWISE: - // looking on to the left edge + // looking on to the left edge if(p_cdt->is_constrained(le)){ if(vh != lvh){ Point_2 p = ray_seg_intersection(q, vh->point(), nvh->point(), lvh->point()); - //std::cout << vh->point() <<" -2- "<< p <point() <<" -2- "<< p <point(),p)); } } else { collect_needle(q,vh,nfh,lindex); - } + } break; default: CGAL_assertion(orient == CGAL::COLLINEAR); - // looking on nvh, so it must be reported - // if it wasn't already (triangles rotate around vh) + // looking on nvh, so it must be reported + // if it wasn't already (triangles rotate around vh) if(vh != nvh){ - //std::cout << vh->point() <<" -3- "<< nvh->point() <point(),nvh->point())); + //std::cout << vh->point() <<" -3- "<< nvh->point() <point(),nvh->point())); } - // but we may also contiue looking along the vertex + // but we may also contiue looking along the vertex if(!p_cdt->is_constrained(re)) { collect_needle(q,nvh,nfh,rindex); } @@ -492,47 +492,47 @@ private: } } - template + template OIT expand_edge( - const Point_2& q, - const Point_2& left, - const Point_2& right, - typename CDT::Face_handle fh, - int index, + const Point_2& q, + const Point_2& left, + const Point_2& right, + typename CDT::Face_handle fh, + int index, OIT oit) const { - // the expanded edge should not be constrained + // the expanded edge should not be constrained CGAL_assertion(!p_cdt->is_constrained(get_edge(fh,index))); CGAL_assertion(!p_cdt->is_infinite(fh)); - - // go into the new face - const typename CDT::Face_handle nfh(fh->neighbor(index)); + + // go into the new face + const typename CDT::Face_handle nfh(fh->neighbor(index)); CGAL_assertion(!p_cdt->is_infinite(nfh)); - // get indices of neighbors - int nindex = nfh->index(fh); // index of new vertex and old face - int rindex = p_cdt->ccw(nindex); // index of face behind right edge - int lindex = p_cdt-> cw(nindex); // index of face behind left edge - - // get vertices seen from entering edge + // get indices of neighbors + int nindex = nfh->index(fh); // index of new vertex and old face + int rindex = p_cdt->ccw(nindex); // index of face behind right edge + int lindex = p_cdt-> cw(nindex); // index of face behind left edge + + // get vertices seen from entering edge const typename CDT::Vertex_handle nvh(nfh->vertex(nindex)); const typename CDT::Vertex_handle rvh(nfh->vertex(p_cdt->cw (nindex))); const typename CDT::Vertex_handle lvh(nfh->vertex(p_cdt->ccw(nindex))); CGAL_assertion(!p_cdt->is_infinite(nvh)); CGAL_assertion(!p_cdt->is_infinite(lvh)); CGAL_assertion(!p_cdt->is_infinite(rvh)); - - // get edges seen from entering edge + + // get edges seen from entering edge typename CDT::Edge re = get_edge(nfh,p_cdt->ccw(nindex)); typename CDT::Edge le = get_edge(nfh,p_cdt-> cw(nindex)); - - // do orientation computation once for new vertex - typename K::Orientation_2 orientation = + + // do orientation computation once for new vertex + typename K::Orientation_2 orientation = p_cdt->geom_traits().orientation_2_object(); CGAL::Orientation ro = orientation(q,right,nvh->point()); CGAL::Orientation lo = orientation(q,left ,nvh->point()); - + CGAL_assertion(typename K::Orientation_2()(q,left ,lvh->point()) != CGAL::CLOCKWISE); CGAL_assertion(typename K::Orientation_2()(q,right,rvh->point()) @@ -540,108 +540,108 @@ private: //std::cout << (ro == CGAL::COUNTERCLOCKWISE) << " " << //(lo == CGAL::CLOCKWISE) << std::endl; - - //right edge is seen if new vertex is counter clockwise of right boarder + + //right edge is seen if new vertex is counter clockwise of right boarder if(ro == CGAL::COUNTERCLOCKWISE){ if(p_cdt->is_constrained(re)){ // the edge is constrained - // report intersection with right boarder ray + // report intersection with right boarder ray // if it is not already the right vertex (already reported) if(right != rvh->point()){ *oit++ = ray_seg_intersection(q,right,nvh->point(),rvh->point()); } - + // then report intersection with left boarder if it exists if(lo == CGAL::COUNTERCLOCKWISE){ *oit++ = ray_seg_intersection(q,left,nvh->point(),rvh->point()); } }else{ - // the edge is not a constrained + // the edge is not a constrained if(lo == CGAL::COUNTERCLOCKWISE){ - // no split needed and return + // no split needed and return //std::cout<< "h1"<< std::endl; oit = expand_edge(q,left,right,nfh,rindex,oit); //std::cout<< "h1 done"<< std::endl; - return oit; + return oit; }else{ - // spliting at new vertex + // spliting at new vertex //std::cout<< "h2"<< std::endl; *oit++ = expand_edge(q,nvh->point(),right,nfh,rindex,oit); //std::cout<< "h2 done"<< std::endl; - } + } } } - + //std::cout << "q "<< q << std::endl ; - //std::cout << "lvh->point() "<< lvh->point() << std::endl; + //std::cout << "lvh->point() "<< lvh->point() << std::endl; //std::cout << "left "<< left << std::endl ; //std::cout << "nvh->point() "<< nvh->point() << std::endl ; //std::cout << "right "<< right << std::endl ; //std::cout << "rvh->point() "<< rvh->point() << std::endl<< std::endl; - - - // determin whether new vertex needs to be reported + + + // determin whether new vertex needs to be reported if(ro != CGAL::CLOCKWISE && lo != CGAL::COUNTERCLOCKWISE){ - *oit++ = nvh->point(); + *oit++ = nvh->point(); } if(!Regularization_category::value){ CGAL_assertion(!(ro == CGAL::COLLINEAR && lo == CGAL::COLLINEAR)); - // we have to check whether a needle starts here. + // we have to check whether a needle starts here. if(p_cdt->is_constrained(le) && !p_cdt->is_constrained(re) && ro == CGAL::COLLINEAR) collect_needle(q,nvh,nfh,rindex); if(p_cdt->is_constrained(re) && !p_cdt->is_constrained(le) && lo == CGAL::COLLINEAR) - collect_needle(q,nvh,nfh,lindex); + collect_needle(q,nvh,nfh,lindex); } - //left edge is seen if new vertex is clockwise of left boarder + //left edge is seen if new vertex is clockwise of left boarder if(lo == CGAL::CLOCKWISE){ if(p_cdt->is_constrained(le)){ // the edge is constrained - // report interesection with right boarder if exists + // report interesection with right boarder if exists if(ro == CGAL::CLOCKWISE){ *oit++ = ray_seg_intersection(q,right,nvh->point(),lvh->point()); } - // then report intersection with left boarder ray + // then report intersection with left boarder ray // if it is not already the left vertex (already reported) if(left != lvh->point()){ - *oit++ = ray_seg_intersection(q,left,nvh->point(),lvh->point()); + *oit++ = ray_seg_intersection(q,left,nvh->point(),lvh->point()); } - return oit; + return oit; }else{ - // the edge is not a constrained + // the edge is not a constrained if(ro == CGAL::CLOCKWISE){ // no split needed and return //std::cout<< "h3"<< std::endl; oit = expand_edge(q,left,right,nfh,lindex,oit); //std::cout<< "h3 done"<< std::endl; - return oit; + return oit; }else{ - // spliting at new vertex + // spliting at new vertex //std::cout<< "h4"<< std::endl; oit = expand_edge(q,left,nvh->point(),nfh,lindex,oit); //std::cout<< "h4 done"<< std::endl; - return oit; - } + return oit; + } } } - + return oit; } - template - typename VARR::Face_handle + template + typename VARR::Face_handle output(std::vector& raw_output, VARR& out_arr) const { if(!needles.empty()){ - std::vector segments(needles.begin(),needles.end()); + std::vector segments(needles.begin(),needles.end()); for(unsigned int i = 0; i < raw_output.size(); i++){ -// //std::cout << raw_output[i] << " -- " -// << raw_output[(i+1)%raw_output.size()] << std::endl; +// //std::cout << raw_output[i] << " -- " +// << raw_output[(i+1)%raw_output.size()] << std::endl; segments.push_back(Segment_2(raw_output[i], raw_output[(i+1) % raw_output.size()])); } @@ -652,9 +652,9 @@ private: } else { typename VARR::Vertex_handle v_last, v_first; - v_last = v_first = + v_last = v_first = out_arr.insert_in_face_interior(raw_output[0],out_arr.unbounded_face()); - + for(unsigned int i = 0; i < raw_output.size()-1; i++){ // std::cout << raw_output[i] << " -- " // << raw_output[(i+1)%raw_output.size()] << std::endl; @@ -666,7 +666,7 @@ private: v_last = out_arr.insert_from_right_vertex( Segment_2(raw_output[i], raw_output[i+1]), v_last )->target(); - } + } } out_arr.insert_at_vertices( Segment_2(raw_output.front(), raw_output.back()), diff --git a/Voronoi_diagram_2/doc/Voronoi_diagram_2/CGAL/draw_voronoi_diagram_2.h b/Voronoi_diagram_2/doc/Voronoi_diagram_2/CGAL/draw_voronoi_diagram_2.h index ef273cb1734..a7ad7dc44f1 100644 --- a/Voronoi_diagram_2/doc/Voronoi_diagram_2/CGAL/draw_voronoi_diagram_2.h +++ b/Voronoi_diagram_2/doc/Voronoi_diagram_2/CGAL/draw_voronoi_diagram_2.h @@ -1,11 +1,11 @@ namespace CGAL { - + /*! \ingroup PkgDrawVoronoiDiagram2 opens a new window and draws `av2`, the `Voronoi_diagram_2` constructed from a Delaunay Graph which is a model of `DelaunayGraph_2` concept. -The class `Voronoi_diagram_2` provides an adaptor to view a triangulated Delaunay graph as their dual subdivision, the -Voronoi diagram. A call to this function is blocking, that is the program continues as soon as the user closes the window. +The class `Voronoi_diagram_2` provides an adaptor to view a triangulated Delaunay graph as their dual subdivision, the +Voronoi diagram. A call to this function is blocking, that is the program continues as soon as the user closes the window. This function requires CGAL_Qt5, and is only available if the flag CGAL_USE_BASIC_VIEWER is defined at compile time. \tparam V2 a model of the `AdaptationTraits_2` concept. \param av2 the voronoi diagram to draw. diff --git a/Voronoi_diagram_2/doc/Voronoi_diagram_2/PackageDescription.txt b/Voronoi_diagram_2/doc/Voronoi_diagram_2/PackageDescription.txt index a173d3af29b..d888fa4473a 100644 --- a/Voronoi_diagram_2/doc/Voronoi_diagram_2/PackageDescription.txt +++ b/Voronoi_diagram_2/doc/Voronoi_diagram_2/PackageDescription.txt @@ -2,7 +2,7 @@ /// \defgroup PkgVoronoiDiagram2Concepts Concepts /// \ingroup PkgVoronoiDiagram2Ref -/// \defgroup PkgVoronoiDiagram2Points Voronoi Diagram of Points +/// \defgroup PkgVoronoiDiagram2Points Voronoi Diagram of Points /// \ingroup PkgVoronoiDiagram2Ref @@ -56,7 +56,7 @@ The three template parameters must be models of the The first concept is related to the Delaunay graphs that are to be adapted, whereas the second one is responsible for manipulating/accessing in a unified way the geometry of a specific -Voronoi diagram as well as for performing nearest site queries. +Voronoi diagram as well as for performing nearest site queries. The third template parameter corresponds to the chosen adaptation policy and provides the necessary types and functors needed for performing this adaptation. diff --git a/Voronoi_diagram_2/doc/Voronoi_diagram_2/Voronoi_diagram_2.txt b/Voronoi_diagram_2/doc/Voronoi_diagram_2/Voronoi_diagram_2.txt index 41b3f9828cf..1a0e26928f8 100644 --- a/Voronoi_diagram_2/doc/Voronoi_diagram_2/Voronoi_diagram_2.txt +++ b/Voronoi_diagram_2/doc/Voronoi_diagram_2/Voronoi_diagram_2.txt @@ -1,7 +1,7 @@ namespace CGAL { /*! -\mainpage User Manual +\mainpage User Manual \anchor Chapter_2D_Voronoi_Diagram_Adaptor \anchor chaptervda \cgalAutoToc @@ -19,14 +19,14 @@ discuss the traits required for performing the adaptation, and finally in Section \ref secvda2examples we present a few examples using this adaptor. -\section secvda2intro Introduction +\section secvda2intro Introduction A Voronoi diagram is typically defined for a set of objects, also called sites in the sequel, that lie in some space \f$ \Sigma\f$ and a distance function that measures the distance of a point \f$ x\f$ in \f$ \Sigma\f$ from an object in the object set. In this package we are interested in planar Voronoi diagrams, so in the sequel the space -\f$ \Sigma\f$ will be the space \f$ \mathbb{R}^2\f$. +\f$ \Sigma\f$ will be the space \f$ \mathbb{R}^2\f$. Let \f$ \mathcal{S}=\{S_1,S_2,\ldots,S_n\}\f$ be our set of sites and let \f$ \delta(x,S_i)\f$ denote the distance of a point \f$ x\in\mathbb{R}^2\f$ from the site \f$ S_i\f$. Given two sites \f$ S_i\f$ and \f$ S_j\f$, the set \f$ V_{ij}\f$ @@ -36,7 +36,7 @@ distance function \f$ \delta(x,\cdot)\f$ is simply the set: We can then define the set \f$ V_i\f$ of points on the plane that are closer to \f$ S_i\f$ than to any other object in \f$ \mathcal{S}\f$ as: \f[ V_i = \bigcap_{i\neq j} V_{ij}. \f] -The set \f$ V_i\f$ is said to be the Voronoi cell or Voronoi face +The set \f$ V_i\f$ is said to be the Voronoi cell or Voronoi face of the site \f$ S_i\f$. The locus of points on the plane that are equidistant from exactly two sites \f$ S_i\f$ and \f$ S_j\f$ is called a Voronoi bisector. A point that is equidistant to three or @@ -61,7 +61,7 @@ Even nice Voronoi diagrams can end up being not so nice. The cell of a site can in general consist of several disconnected components. Such a case can happen, for example, when we consider weighted points \f$ Q_i=(p_i,\lambda_i)\f$, where \f$ p_i\in\mathbb{R}^2\f$, -\f$ \lambda_i\in\mathbb{R}\f$, and the distance function is +\f$ \lambda_i\in\mathbb{R}\f$, and the distance function is the Euclidean distance multiplied by the weight of each site, i.e., \f$ \delta_M(x,Q_i)=\lambda_i\,\|x-p_i\|\f$, where \f$ \|\cdot\|\f$ denotes the Euclidean norm. In this package we are going to restrict ourselves to @@ -73,7 +73,7 @@ points, the Euclidean Voronoi diagram of a set of disks on the plane (i.e., the Apollonius diagram), the Euclidean Voronoi diagram of a set of disjoint convex objects on the plane, or the power or (Laguerre) diagram for a set of circles on the plane. In fact every instance of -an abstract Voronoi diagram in the sense of Klein \cgalCite{k-cavd-89} +an abstract Voronoi diagram in the sense of Klein \cgalCite{k-cavd-89} is a simple Voronoi diagram in our setting. In the sequel when we refer to Voronoi diagrams we will refer to simple Voronoi diagrams. @@ -82,7 +82,7 @@ Voronoi diagram itself, but rather its dual graph, called the Delaunay graph. In general the Delaunay graph is a planar graph, each face of which consists of at least three edges. Under the non-degeneracy assumption that no point on the plane is -equidistant, under the distance function, to more than three sites, +equidistant, under the distance function, to more than three sites, the Delaunay graph is a planar graph with triangular faces. In certain cases this graph can actually be embedded with straight line segments in which case we talk about a triangulation. This is the @@ -165,14 +165,14 @@ our caching degeneracy removal policies: some of them result in mutable adaptors others result in non-mutable ones. In Section \ref secvda2ap we discuss the issue in more detail. -\section secvda2design Software Design +\section secvda2design Software Design The `Voronoi_diagram_2` class is parameterized by three template parameters. The first one must be a model of the `DelaunayGraph_2` concept. It corresponds to the API required by an object representing a Delaunay graph. All classes of \cgal that represent Delaunay diagrams are models of this concept, namely, -Delaunay triangulations, regular triangulations, Apollonius +Delaunay triangulations, regular triangulations, Apollonius graphs and segment Delaunay graphs. The second template parameter must be a model of the `AdaptationTraits_2` concept. We discuss this concept in detail in @@ -226,7 +226,7 @@ adaptor, we can perform point location queries, namely given a point \f$ p\f$ we can determine the feature of the Voronoi diagram (vertex, edge, face) on which \f$ p\f$ lies. -\section secvda2traits The Adaptation Traits +\section secvda2traits The Adaptation Traits The `AdaptationTraits_2` concept defines the types and functors required by the adaptor in order to access geometric @@ -239,7 +239,7 @@ Finally, it defines a tag that indicates whether nearest site queries are to be supported by the Voronoi diagram adaptor. If such queries are to be supported, a functor is required. -Given a query point, the nearest site functor should return information +Given a query point, the nearest site functor should return information related to how many and which sites of the Voronoi diagram are at equal and minimal distance from the query point. In particular, if the query point is closest to a single site, the vertex handle of the @@ -270,7 +270,7 @@ provides the adaptation traits for regular triangulations. provides the adaptation traits for segment Delaunay graphs.
    -\section secvda2ap The Adaptation Policy +\section secvda2ap The Adaptation Policy As mentioned above, when we perform the adaptation of a triangulated Delaunay graph to a Voronoi diagram, a question that arises is whether @@ -340,7 +340,7 @@ provides an adaptation policy for removing degeneracies when adapting a Delaunay triangulation to a point Voronoi diagram.
  • The `Regular_triangulation_degeneracy_removal_policy_2` class: it provides an adaptation policy for removing degeneracies when -adapting a regular triangulation to a power diagram +adapting a regular triangulation to a power diagram
  • The `Segment_Delaunay_graph_degeneracy_removal_policy_2` class: it provides an adaptation policy for removing degeneracies when @@ -446,7 +446,7 @@ policies. The caching degeneracy removal policy for segment Delaunay graphs does not support on-line insertions, whereas the remaining three caching degeneracy removal policies support on-line insertions. -\subsection subsecvda2efficiency Efficiency Considerations +\subsection subsecvda2efficiency Efficiency Considerations One last item that merits some discussion are the different choices from the point of view of time- and space-efficiency. @@ -481,7 +481,7 @@ degeneracy removal policy. This strategy avoids the updates of the cached results after each individual insertion, due to the features of the Voronoi diagram destroyed because of the site inserted. -\section secvda2examples Examples +\section secvda2examples Examples In this section we present an example that shows how to perform point location queries. @@ -498,10 +498,10 @@ This function requires CGAL_Qt5, and is only available if the flag CGAL_USE_BASI \cgalExample{Voronoi_diagram_2/draw_voronoi_diagram_2.cpp} \cgalFigureBegin{draw_voronoi_diagram, draw_voronoi_diagram.png} -Result of the draw_voronoi_diagram_2 program. A window shows the Voronoi vertices and edges. +Result of the draw_voronoi_diagram_2 program. A window shows the Voronoi vertices and edges. The window allows navigation through the 2D scene. \cgalFigureEnd -*/ +*/ } /* namespace CGAL */ diff --git a/Voronoi_diagram_2/examples/Voronoi_diagram_2/CMakeLists.txt b/Voronoi_diagram_2/examples/Voronoi_diagram_2/CMakeLists.txt index 775a3faf64c..29efc2ca19e 100644 --- a/Voronoi_diagram_2/examples/Voronoi_diagram_2/CMakeLists.txt +++ b/Voronoi_diagram_2/examples/Voronoi_diagram_2/CMakeLists.txt @@ -26,8 +26,8 @@ if ( CGAL_FOUND ) else() - + message(STATUS "This program requires the CGAL library, and will not be compiled.") - + endif()