From 210bb83123ba0948d4e77219d00a18a0bd72d2c2 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Wed, 13 Dec 2017 12:37:13 +0100 Subject: [PATCH] Update Point_set_3 examples and tests, remove Point_set_processing overloads --- .../doc/Point_set_3/PackageDescription.txt | 22 -- .../Point_set_3/point_set_advanced.cpp | 6 +- .../examples/Point_set_3/point_set_algo.cpp | 1 - Point_set_3/include/CGAL/Point_set_3/IO.h | 36 +- .../CGAL/Point_set_3/Point_set_processing_3.h | 311 ------------------ .../test/Point_set_3/point_set_test.cpp | 5 +- 6 files changed, 23 insertions(+), 358 deletions(-) delete mode 100644 Point_set_3/include/CGAL/Point_set_3/Point_set_processing_3.h diff --git a/Point_set_3/doc/Point_set_3/PackageDescription.txt b/Point_set_3/doc/Point_set_3/PackageDescription.txt index f315e7e94f5..ba953ea5b1e 100644 --- a/Point_set_3/doc/Point_set_3/PackageDescription.txt +++ b/Point_set_3/doc/Point_set_3/PackageDescription.txt @@ -21,28 +21,6 @@ ## Class ## - `CGAL::Point_set_3` - -\defgroup PkgPointSet3PointSetProcessing3 Point Set Processing -\ingroup PkgPointSet3 - -\brief This module offers convenience overloads of functions available in the -\ref PkgPointSetProcessingSummary package. These overloads allow the -user to call point set processing algorithms without having to handle -manually property maps and iterators. - -The overloads, available after including -`CGAL/Point_set_3/Point_set_processing_3.h`, all follow the same -pattern based on the original point set processing functions: - -- Iterators and property maps of the original functions are replaced -with a single parameter `CGAL::Point_set_3` - -- The other parameters (and their potential default values) are -following in the same order as the original function. - -For a complete documentation of these functions, please refer to the -\ref PkgPointSetProcessing manual. - \defgroup PkgPointSet3IO Input/Output \ingroup PkgPointSet3 diff --git a/Point_set_3/examples/Point_set_3/point_set_advanced.cpp b/Point_set_3/examples/Point_set_3/point_set_advanced.cpp index 18d440896d1..94341112fe7 100644 --- a/Point_set_3/examples/Point_set_3/point_set_advanced.cpp +++ b/Point_set_3/examples/Point_set_3/point_set_advanced.cpp @@ -19,11 +19,11 @@ int main (int argc, char** argv) Point_set point_set; point_set.add_normal_map(); // Reading input in OFF format - if (!f || !CGAL::read_off_points_and_normals + if (!f || !CGAL::read_off_points (f, point_set.index_back_inserter(), // OutputIterator - point_set.point_push_map(), - point_set.normal_push_map())) + CGAL::parameters::point_map(point_set.point_push_map()). + normal_map(point_set.normal_push_map()))) { std::cerr << "Can't read input file " << std::endl; return EXIT_FAILURE; diff --git a/Point_set_3/examples/Point_set_3/point_set_algo.cpp b/Point_set_3/examples/Point_set_3/point_set_algo.cpp index f6d566a7b1d..06e2fd41972 100644 --- a/Point_set_3/examples/Point_set_3/point_set_algo.cpp +++ b/Point_set_3/examples/Point_set_3/point_set_algo.cpp @@ -1,6 +1,5 @@ #include #include -//#include #include #include #include diff --git a/Point_set_3/include/CGAL/Point_set_3/IO.h b/Point_set_3/include/CGAL/Point_set_3/IO.h index 84382f5136a..e61fd15ec55 100644 --- a/Point_set_3/include/CGAL/Point_set_3/IO.h +++ b/Point_set_3/include/CGAL/Point_set_3/IO.h @@ -310,11 +310,11 @@ read_xyz_point_set( { point_set.add_normal_map(); - bool out = CGAL::read_xyz_points_and_normals + bool out = CGAL::read_xyz_points (stream, point_set.index_back_inserter(), - point_set.point_push_map(), - point_set.normal_push_map()); + CGAL::parameters::point_map(point_set.point_push_map()). + normal_map(point_set.normal_push_map())); bool has_normals = false; for (typename CGAL::Point_set_3::const_iterator it = point_set.begin(); @@ -342,11 +342,11 @@ read_off_point_set( { point_set.add_normal_map(); - bool out = CGAL::read_off_points_and_normals + bool out = CGAL::read_off_points (stream, point_set.index_back_inserter(), - point_set.point_push_map(), - point_set.normal_push_map()); + CGAL::parameters::point_map(point_set.point_push_map()). + normal_map(point_set.normal_push_map())); bool has_normals = false; for (typename CGAL::Point_set_3::const_iterator it = point_set.begin(); @@ -794,7 +794,7 @@ write_las_point_set( bool okay = write_las_points_with_properties - (stream, point_set.begin(), point_set.end(), + (stream, point_set, make_las_point_writer (point_set.point_map()), std::make_pair (intensity, LAS_property::Intensity()), std::make_pair (return_number, LAS_property::Return_number()), @@ -883,13 +883,14 @@ write_xyz_point_set( const CGAL::Point_set_3& point_set) ///< point set { if (point_set.has_normal_map()) - return CGAL::write_xyz_points_and_normals - (stream, point_set.begin(), point_set.end(), - point_set.point_map(), point_set.normal_map()); + return CGAL::write_xyz_points + (stream, point_set, + CGAL::parameters::point_map(point_set.point_map()). + normal_map(point_set.normal_map())); return CGAL::write_xyz_points - (stream, point_set.begin(), point_set.end(), - point_set.point_map()); + (stream, point_set, + CGAL::parameters::point_map(point_set.point_map())); } /*! @@ -902,13 +903,14 @@ write_off_point_set( const CGAL::Point_set_3& point_set) ///< point set { if (point_set.has_normal_map()) - return CGAL::write_off_points_and_normals - (stream, point_set.begin(), point_set.end(), - point_set.point_map(), point_set.normal_map()); + return CGAL::write_off_points + (stream, point_set, + CGAL::parameters::point_map(point_set.point_map()). + normal_map(point_set.normal_map())); return CGAL::write_off_points - (stream, point_set.begin(), point_set.end(), - point_set.point_map()); + (stream, point_set, + CGAL::parameters::point_map(point_set.point_map())); } diff --git a/Point_set_3/include/CGAL/Point_set_3/Point_set_processing_3.h b/Point_set_3/include/CGAL/Point_set_3/Point_set_processing_3.h deleted file mode 100644 index 7f2a626777f..00000000000 --- a/Point_set_3/include/CGAL/Point_set_3/Point_set_processing_3.h +++ /dev/null @@ -1,311 +0,0 @@ -// Copyright (c) 2016 GeometryFactory Sarl (France). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org). -// You can redistribute it and/or modify it under the terms of the GNU -// General Public License as published by the Free Software Foundation, -// either version 3 of the License, or (at your option) any later version. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: GPL-3.0+ -// -// -// Author(s) : Simon Giraudot - -#ifndef CGAL_POINT_SET_3_POINT_SET_PROCESSING_3_H -#define CGAL_POINT_SET_3_POINT_SET_PROCESSING_3_H - -#include - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace CGAL { - -/*! - \ingroup PkgPointSet3PointSetProcessing3 - */ -template -double -bilateral_smooth_point_set( - CGAL::Point_set_3& point_set, ///< point set - const unsigned int k, ///< number of neighbors. - double sharpness_angle) ///< control sharpness(0-90) -{ - return CGAL::bilateral_smooth_point_set - (point_set.begin(), point_set.end(), - point_set.point_map(), point_set.normal_map(), - k, sharpness_angle); -} - - -/*! - \ingroup PkgPointSet3PointSetProcessing3 - */ -template -double -compute_average_spacing( - const CGAL::Point_set_3& point_set, ///< point set - unsigned int k) ///< number of neighbors. -{ - return CGAL::compute_average_spacing - (point_set.begin(), point_set.end(), point_set.point_map(), k); -} - -/*! - \ingroup PkgPointSet3PointSetProcessing3 - */ -template -void -edge_aware_upsample_point_set( - CGAL::Point_set_3& point_set, ///< point set - double sharpness_angle = 30, ///< control sharpness(0-90) - double edge_sensitivity = 1, ///< edge sensitivity(0-5) - double neighbor_radius = -1, ///< initial size of neighbors. - const std::size_t number_of_output_points = 1000)///< number of output points. -{ - CGAL::edge_aware_upsample_point_set - (point_set.begin(), point_set.end(), - point_set.point_back_inserter(), - point_set.point_map(), point_set.normal_map(), - sharpness_angle, edge_sensitivity, neighbor_radius, number_of_output_points); -} - -/*! - \ingroup PkgPointSet3PointSetProcessing3 - - \note No iterator is returned, points simplified are directly - removed from the point set. - */ -template -void grid_simplify_point_set( - CGAL::Point_set_3& point_set, ///< point set - double epsilon) ///< tolerance value when merging 3D points. -{ - point_set.remove_from - (CGAL::grid_simplify_point_set - (point_set.begin(), point_set.end(), point_set.point_map(), epsilon)); -} - -/*! - \ingroup PkgPointSet3PointSetProcessing3 - - \note No iterator is returned, points simplified are directly - removed from the point set. - */ -template -void hierarchy_simplify_point_set( - CGAL::Point_set_3& point_set, ///< point set - const unsigned int size = 10, ///< maximum cluster size - const double var_max = 0.333) ///< maximal surface variation -{ - point_set.remove_from - (CGAL::hierarchy_simplify_point_set - (point_set.begin(), point_set.end(), point_set.point_map(), size, var_max, - CGAL::Default_diagonalize_traits())); -} - - -/*! - \ingroup PkgPointSet3PointSetProcessing3 - - \note This function adds a normal map to the point set. -*/ -template -void -jet_estimate_normals( - CGAL::Point_set_3& point_set, ///< point set - unsigned int k, ///< number of neighbors. - unsigned int degree_fitting = 2) ///< fitting degree -{ - point_set.add_normal_map(); - - CGAL::jet_estimate_normals - (point_set.begin(), point_set.end(), - point_set.point_map(), point_set.normal_map(), - k, degree_fitting); -} - - -/*! - \ingroup PkgPointSet3PointSetProcessing3 -*/ -template -void -jet_smooth_point_set( - CGAL::Point_set_3& point_set, ///< point set - unsigned int k, ///< number of neighbors. - unsigned int degree_fitting = 2, ///< fitting degree - unsigned int degree_monge = 2) ///< Monge degree -{ - CGAL::jet_smooth_point_set - (point_set.begin(), point_set.end(), point_set.point_map(), - k, degree_fitting, degree_monge); - -} - -/*! - \ingroup PkgPointSet3PointSetProcessing3 -*/ -template -typename CGAL::Point_set_3::iterator -mst_orient_normals( - CGAL::Point_set_3& point_set, ///< point set - unsigned int k) ///< number of neighbors -{ - return CGAL::mst_orient_normals - (point_set.begin(), point_set.end(), - point_set.point_map(), point_set.normal_map(), k); -} - -/*! - \ingroup PkgPointSet3PointSetProcessing3 - - \note This function adds a normal map to the point set. -*/ -template -void -pca_estimate_normals( - CGAL::Point_set_3& point_set, ///< point set - unsigned int k) ///< number of neighbors. -{ - point_set.add_normal_map(); - - CGAL::pca_estimate_normals - (point_set.begin(), point_set.end(), - point_set.point_map(), point_set.normal_map(), - k); -} - -/*! - \ingroup PkgPointSet3PointSetProcessing3 - - \note No iterator is returned, points simplified are directly - removed from the point set. - */ -template -void random_simplify_point_set( - CGAL::Point_set_3& point_set, ///< point set - double removed_percentage) ///< percentage of points to remove -{ - point_set.remove_from - (CGAL::random_simplify_point_set - (point_set.begin(), point_set.end(), point_set.point_map(), removed_percentage)); -} - - -/*! - \ingroup PkgPointSet3PointSetProcessing3 - - \note No iterator is returned, points simplified are directly - removed from the point set. - */ -template -void remove_outliers( - CGAL::Point_set_3& point_set, ///< point set - unsigned int k, ///< number of neighbors. - double threshold_percent) ///< percentage of points to remove -{ - point_set.remove_from - (CGAL::remove_outliers - (point_set.begin(), point_set.end(), point_set.point_map(), k, threshold_percent)); -} - -/*! - \ingroup PkgPointSet3PointSetProcessing3 - - \note This function adds a normal map to the point set. -*/ -template -void -vcm_estimate_normals( - CGAL::Point_set_3& point_set, ///< point set - double offset_radius, ///< offset radius. - double convolution_radius) ///< convolution radius. -{ - point_set.add_normal_map(); - - CGAL::vcm_estimate_normals - (point_set.begin(), point_set.end(), - point_set.point_map(), point_set.normal_map(), - offset_radius, convolution_radius); -} - -/*! - \ingroup PkgPointSet3PointSetProcessing3 - - \note This function adds a normal map to the point set. -*/ -template -void -vcm_estimate_normals( - CGAL::Point_set_3& point_set, ///< point set - double offset_radius, ///< offset radius. - unsigned int nb_neighbors_convolve) ///< number of neighbors used during the convolution. -{ - point_set.add_normal_map(); - - CGAL::vcm_estimate_normals - (point_set.begin(), point_set.end(), - point_set.point_map(), point_set.normal_map(), - offset_radius, nb_neighbors_convolve); -} - -/*! - \ingroup PkgPointSet3PointSetProcessing3 -*/ -template -void -wlop_simplify_and_regularize_point_set( - const CGAL::Point_set_3& input_point_set, ///< input point set - CGAL::Point_set_3& output_point_set, ///< output point set - const double select_percentage = 5, ///< percentage of points to retain - double neighbor_radius = -1, ///< size of neighbors. - const unsigned int max_iter_number = 35, ///< number of iterations. - const bool require_uniform_sampling = false ///< if needed to compute density - /// to generate more rugularized result. -) -{ - CGAL::wlop_simplify_and_regularize_point_set - (input_point_set.begin(), input_point_set.end(), - output_point_set.point_back_inserter(), - input_point_set.point_map(), - select_percentage, - neighbor_radius, - max_iter_number, - require_uniform_sampling); -} - - -} // namespace CGAL - - -#endif // CGAL_POINT_SET_3_POINT_SET_PROCESSING_3_H diff --git a/Point_set_3/test/Point_set_3/point_set_test.cpp b/Point_set_3/test/Point_set_3/point_set_test.cpp index 14bfa12d0c9..f94ef462157 100644 --- a/Point_set_3/test/Point_set_3/point_set_test.cpp +++ b/Point_set_3/test/Point_set_3/point_set_test.cpp @@ -1,7 +1,6 @@ #include #include -#include #include #include @@ -43,9 +42,7 @@ int main (int, char**) f.close (); Point_set::iterator - first_to_remove = CGAL::grid_simplify_point_set (point_set.begin(), - point_set.end(), - point_set.point_map(), + first_to_remove = CGAL::grid_simplify_point_set (point_set, 0.1); std::size_t size = point_set.size ();