remove deprecated functions

Because of the default values of the constructors,
the API of the new and the deprecated constructors
are identical and the deprecated one is always chosen
This commit is contained in:
Sébastien Loriot 2022-01-24 18:31:20 +01:00
parent 4eca555f95
commit 2f9d22225e
17 changed files with 10 additions and 827 deletions

View File

@ -21,6 +21,15 @@ Release date: June 2022
a `boolean` instead of `void` that is used inside the class `Region_growing` for detecting if
the input conditions for the new region are satisfied. This change affects only user-defined
types of regions.
- **Breaking change**: Constructors of all models of the concepts [`RegionType`](https://doc.cgal.org/5.5/Shape_detection/classRegionType.html`)
and [`NeighborQuery`](https://doc.cgal.org/5.5/Shape_detection/classNeighborQuery.html`) have been updated to used named parameters.
Namely, the following classes are affected:
- [`CGAL::Shape_detection::Point_set::Least_squares_line_fit_region`](https://doc.cgal.org/5.5/Shape_detection/classCGAL_1_1Shape__detection_1_1Point__set_1_1Least__squares__line__fit__region.html)
- [`CGAL::Shape_detection::Point_set::Least_squares_plane_fit_region`](https://doc.cgal.org/5.5/Shape_detection/classCGAL_1_1Shape__detection_1_1Point__set_1_1Least__squares__plane__fit__region.html)
- [`CGAL::Shape_detection::Polygon_mesh::Least_squares_plane_fit_region`](https://doc.cgal.org/5.5/Shape_detection/classCGAL_1_1Shape__detection_1_1Polygon__mesh_1_1Least__squares__plane__fit__region.html)
- [`CGAL::Shape_detection::Point_set::K_neighbor_query`](https://doc.cgal.org/5.5/Shape_detection/classCGAL_1_1Shape__detection_1_1Point__set_1_1K__neighbor__query.html)
- [`CGAL::Shape_detection::Point_set::Sphere_neighbor_query`](https://doc.cgal.org/5.5/Shape_detection/classCGAL_1_1Shape__detection_1_1Point__set_1_1Sphere__neighbor__query.html)
- [`CGAL::Shape_detection::Polygon_mesh::One_ring_neighbor_query`](https://doc.cgal.org/5.5/Shape_detection/classCGAL_1_1Shape__detection_1_1Polygon__mesh_1_1One__ring__neighbor__query.html)
- The constructors of all models used together with the region growing algorithm now enable users
to provide parameters through the named parameters mechanism. The old constructors without named
parameters are deprecated.

View File

@ -154,40 +154,6 @@ namespace Point_set {
m_tree.build();
}
#if !defined(CGAL_NO_DEPRECATED_CODE) || defined(DOXYGEN_RUNNING)
/*!
\brief initializes a Kd-tree with input points.
\deprecated This constructor is deprecated since the version 5.4 of \cgal.
\param input_range
an instance of `InputRange` with 2D or 3D points
\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`
to `Kernel::Point_2` or to `Kernel::Point_3`
\pre `input_range.size() > 0`
\pre `k > 0`
*/
CGAL_DEPRECATED_MSG("This constructor is deprecated since the version 5.4 of CGAL!")
K_neighbor_query(
const InputRange& input_range,
const std::size_t k = 12,
const PointMap point_map = PointMap()) :
K_neighbor_query(
input_range, CGAL::parameters::
k_neighbors(k).
point_map(point_map))
{ }
#endif // CGAL_NO_DEPRECATED_CODE
/// @}
/// \name Access

View File

@ -204,76 +204,6 @@ namespace Point_set {
CGAL_precondition(m_max_radius >= m_min_radius);
}
#if !defined(CGAL_NO_DEPRECATED_CODE) || defined(DOXYGEN_RUNNING)
/*!
\brief initializes all internal data structures.
\deprecated This constructor is deprecated since the version 5.5 of \cgal.
\param input_range
an instance of `InputRange` with 2D points and
corresponding 2D normal vectors
\param distance_threshold
the maximum distance from a point to a circle. %Default is 1.
\param angle_threshold
the maximum accepted angle in degrees between the normal of a point
and the radius of a circle. %Default is 25 degrees.
\param min_region_size
the minimum number of 2D points a region must have. %Default is 3.
\param minimum_radius
the radius below which an estimated circle is considered as invalid
and discarded. %Default is 0 (no limit).
\param maximum_radius
the radius above which an estimated circle is considered as invalid
and discarded. %Default is infinity (no limit).
\param point_map
an instance of `PointMap` that maps an item from `input_range` to `Kernel::Point_2`
\param normal_map
an instance of `NormalMap` that maps an item from `input_range` to `Kernel::Vector_2`
\param traits
an instance of `GeomTraits`
\pre `input_range.size() > 0`
\pre `distance_threshold >= 0`
\pre `angle_threshold >= 0 && angle_threshold <= 90`
\pre `min_region_size > 0`
\pre `minimum_radius >= 0`
\pre `maximum_radius >= minimum_radius`
*/
CGAL_DEPRECATED_MSG("This constructor is deprecated since the version 5.5 of CGAL!")
Least_squares_circle_fit_region(
const InputRange& input_range,
const FT distance_threshold = FT(1),
const FT angle_threshold = FT(25),
const std::size_t min_region_size = 3,
const FT minimum_radius = FT(0),
const FT maximum_radius = FT((std::numeric_limits<double>::max)()),
const PointMap point_map = PointMap(),
const NormalMap normal_map = NormalMap(),
const GeomTraits traits = GeomTraits()) :
Least_squares_circle_fit_region(
input_range, CGAL::parameters::
maximum_distance(distance_threshold).
maximum_angle(angle_threshold).
minimum_region_size(min_region_size).
minimum_radius(minimum_radius).
maximum_radius(maximum_radius).
point_map(point_map).
normal_map(normal_map).
geom_traits(traits))
{ }
#endif // CGAL_NO_DEPRECATED_CODE
/// @}
/// \name Access

View File

@ -130,38 +130,6 @@ namespace Point_set {
m_scores.resize(m_input_range.size());
}
#if !defined(CGAL_NO_DEPRECATED_CODE) || defined(DOXYGEN_RUNNING)
/*!
\brief initializes all internal data structures.
\deprecated This constructor is deprecated since the version 5.5 of \cgal.
\param input_range
an instance of `InputRange` with 2D points
\param neighbor_query
an instance of `NeighborQuery` that is used internally to
access point's neighbors
\param point_map
an instance of `PointMap` that maps an item from `input_range`
to `Kernel::Point_2`
\pre `input_range.size() > 0`
*/
CGAL_DEPRECATED_MSG("This constructor is deprecated since the version 5.5 of CGAL!")
Least_squares_circle_fit_sorting(
const InputRange& input_range,
NeighborQuery& neighbor_query,
const PointMap point_map = PointMap()) :
Least_squares_circle_fit_sorting(
input_range, neighbor_query, CGAL::parameters::
point_map(point_map))
{ }
#endif // CGAL_NO_DEPRECATED_CODE
/// @}
/// \name Sorting

View File

@ -204,76 +204,6 @@ namespace Point_set {
CGAL_precondition(m_max_radius >= m_min_radius);
}
#if !defined(CGAL_NO_DEPRECATED_CODE) || defined(DOXYGEN_RUNNING)
/*!
\brief initializes all internal data structures.
\deprecated This constructor is deprecated since the version 5.5 of \cgal.
\param input_range
an instance of `InputRange` with 3D points and
corresponding 3D normal vectors
\param distance_threshold
the maximum distance from a point to a cylinder. %Default is 1.
\param angle_threshold
the maximum accepted angle in degrees between the normal of a point
and the radius of a cylinder. %Default is 25 degrees.
\param min_region_size
the minimum number of 3D points a region must have. %Default is 3.
\param minimum_radius
the radius below which an estimated cylinder is considered as invalid
and discarded. %Default is 0 (no limit).
\param maximum_radius
the radius above which an estimated cylinder is considered as invalid
and discarded. %Default is infinity (no limit).
\param point_map
an instance of `PointMap` that maps an item from `input_range` to `Kernel::Point_3`
\param normal_map
an instance of `NormalMap` that maps an item from `input_range` to `Kernel::Vector_3`
\param traits
an instance of `GeomTraits`.
\pre `input_range.size() > 0`
\pre `distance_threshold >= 0`
\pre `angle_threshold >= 0 && angle_threshold <= 90`
\pre `min_region_size > 0`
\pre `minimum_radius >= 0`
\pre `maximum_radius >= minimum_radius`
*/
CGAL_DEPRECATED_MSG("This constructor is deprecated since the version 5.5 of CGAL!")
Least_squares_cylinder_fit_region(
const InputRange& input_range,
const FT distance_threshold = FT(1),
const FT angle_threshold = FT(25),
const std::size_t min_region_size = 3,
const FT minimum_radius = FT(0),
const FT maximum_radius = FT((std::numeric_limits<double>::max)()),
const PointMap point_map = PointMap(),
const NormalMap normal_map = NormalMap(),
const GeomTraits traits = GeomTraits()) :
Least_squares_cylinder_fit_region(
input_range, CGAL::parameters::
maximum_distance(distance_threshold).
maximum_angle(angle_threshold).
minimum_region_size(min_region_size).
minimum_radius(minimum_radius).
maximum_radius(maximum_radius).
point_map(point_map).
normal_map(normal_map).
geom_traits(traits))
{ }
#endif // CGAL_NO_DEPRECATED_CODE
/// @}
/// \name Access

View File

@ -143,43 +143,6 @@ namespace Point_set {
m_scores.resize(m_input_range.size());
}
#if !defined(CGAL_NO_DEPRECATED_CODE) || defined(DOXYGEN_RUNNING)
/*!
\brief initializes all internal data structures.
\deprecated This constructor is deprecated since the version 5.5 of \cgal.
\param input_range
an instance of `InputRange` with 3D points
\param neighbor_query
an instance of `NeighborQuery` that is used internally to
access point's neighbors
\param point_map
an instance of `PointMap` that maps an item from `input_range`
to `Kernel::Point_3`
\param normal_map
an instance of `PointMap` that maps an item from `input_range`
to `Kernel::Vector_3`
\pre `input_range.size() > 0`
*/
CGAL_DEPRECATED_MSG("This constructor is deprecated since the version 5.5 of CGAL!")
Least_squares_cylinder_fit_sorting(
const InputRange& input_range,
NeighborQuery& neighbor_query,
const PointMap point_map = PointMap(),
const NormalMap normal_map = NormalMap()) :
Least_squares_cylinder_fit_sorting(
input_range, neighbor_query, CGAL::parameters::
point_map(point_map).normal_map(normal_map))
{ }
#endif // CGAL_NO_DEPRECATED_CODE
/// @}
/// \name Sorting

View File

@ -182,64 +182,6 @@ namespace Point_set {
m_cos_value_threshold = cos_value;
}
#if !defined(CGAL_NO_DEPRECATED_CODE) || defined(DOXYGEN_RUNNING)
/*!
\brief initializes all internal data structures.
\deprecated This constructor is deprecated since the version 5.4 of \cgal.
\param input_range
an instance of `InputRange` with 2D points and
corresponding 2D normal vectors
\param distance_threshold
the maximum distance from a point to a line. %Default is 1.
\param angle_threshold
the maximum accepted angle in degrees between the normal of a point and
the normal of a line. %Default is 25 degrees.
\param min_region_size
the minimum number of 2D points a region must have. %Default is 2.
\param point_map
an instance of `PointMap` that maps an item from `input_range`
to `Kernel::Point_2`
\param normal_map
an instance of `NormalMap` that maps an item from `input_range`
to `Kernel::Vector_2`
\param traits
an instance of `GeomTraits`
\pre `input_range.size() > 0`
\pre `distance_threshold >= 0`
\pre `angle_threshold >= 0 && angle_threshold <= 90`
\pre `min_region_size > 0`
*/
CGAL_DEPRECATED_MSG("This constructor is deprecated since the version 5.4 of CGAL!")
Least_squares_line_fit_region(
const InputRange& input_range,
const FT distance_threshold = FT(1),
const FT angle_threshold = FT(25),
const std::size_t min_region_size = 2,
const PointMap point_map = PointMap(),
const NormalMap normal_map = NormalMap(),
const GeomTraits traits = GeomTraits()) :
Least_squares_line_fit_region(
input_range, CGAL::parameters::
maximum_distance(distance_threshold).
maximum_angle(angle_threshold).
minimum_region_size(min_region_size).
point_map(point_map).
normal_map(normal_map).
geom_traits(traits))
{ }
#endif // CGAL_NO_DEPRECATED_CODE
/// @}
/// \name Access

View File

@ -130,38 +130,6 @@ namespace Point_set {
m_scores.resize(m_input_range.size());
}
#if !defined(CGAL_NO_DEPRECATED_CODE) || defined(DOXYGEN_RUNNING)
/*!
\brief initializes all internal data structures.
\deprecated This constructor is deprecated since the version 5.4 of \cgal.
\param input_range
an instance of `InputRange` with 2D points
\param neighbor_query
an instance of `NeighborQuery` that is used internally to
access point's neighbors
\param point_map
an instance of `PointMap` that maps an item from `input_range`
to `Kernel::Point_2`
\pre `input_range.size() > 0`
*/
CGAL_DEPRECATED_MSG("This constructor is deprecated since the version 5.4 of CGAL!")
Least_squares_line_fit_sorting(
const InputRange& input_range,
NeighborQuery& neighbor_query,
const PointMap point_map = PointMap()) :
Least_squares_line_fit_sorting(
input_range, neighbor_query, CGAL::parameters::
point_map(point_map))
{ }
#endif // CGAL_NO_DEPRECATED_CODE
/// @}
/// \name Sorting

View File

@ -182,63 +182,6 @@ namespace Point_set {
m_cos_value_threshold = cos_value;
}
#if !defined(CGAL_NO_DEPRECATED_CODE) || defined(DOXYGEN_RUNNING)
/*!
\brief initializes all internal data structures.
\deprecated This constructor is deprecated since the version 5.4 of \cgal.
\param input_range
an instance of `InputRange` with 3D points and
corresponding 3D normal vectors
\param distance_threshold
the maximum distance from a point to a plane. %Default is 1.
\param angle_threshold
the maximum accepted angle in degrees between the normal of a point and
the normal of a plane. %Default is 25 degrees.
\param min_region_size
the minimum number of 3D points a region must have. %Default is 3.
\param point_map
an instance of `PointMap` that maps an item from `input_range`
to `Kernel::Point_3`
\param normal_map
an instance of `NormalMap` that maps an item from `input_range`
to `Kernel::Vector_3`
\param traits
an instance of `GeomTraits`.
\pre `input_range.size() > 0`
\pre `distance_threshold >= 0`
\pre `angle_threshold >= 0 && angle_threshold <= 90`
\pre `min_region_size > 0`
*/
CGAL_DEPRECATED_MSG("This constructor is deprecated since the version 5.4 of CGAL!")
Least_squares_plane_fit_region(
const InputRange& input_range,
const FT distance_threshold = FT(1),
const FT angle_threshold = FT(25),
const std::size_t min_region_size = 3,
const PointMap point_map = PointMap(),
const NormalMap normal_map = NormalMap(),
const GeomTraits traits = GeomTraits()) :
Least_squares_plane_fit_region(
input_range, CGAL::parameters::
maximum_distance(distance_threshold).
maximum_angle(angle_threshold).
minimum_region_size(min_region_size).
point_map(point_map).
normal_map(normal_map).
geom_traits(traits))
{ }
#endif // CGAL_NO_DEPRECATED_CODE
/// @}
/// \name Access

View File

@ -130,38 +130,6 @@ namespace Point_set {
m_scores.resize(m_input_range.size());
}
#if !defined(CGAL_NO_DEPRECATED_CODE) || defined(DOXYGEN_RUNNING)
/*!
\brief initializes all internal data structures.
\deprecated This constructor is deprecated since the version 5.4 of \cgal.
\param input_range
an instance of `InputRange` with 3D points
\param neighbor_query
an instance of `NeighborQuery` that is used internally to
access point's neighbors
\param point_map
an instance of `PointMap` that maps an item from `input_range`
to `Kernel::Point_3`
\pre `input_range.size() > 0`
*/
CGAL_DEPRECATED_MSG("This constructor is deprecated since the version 5.4 of CGAL!")
Least_squares_plane_fit_sorting(
const InputRange& input_range,
NeighborQuery& neighbor_query,
const PointMap point_map = PointMap()) :
Least_squares_plane_fit_sorting(
input_range, neighbor_query, CGAL::parameters::
point_map(point_map))
{ }
#endif // CGAL_NO_DEPRECATED_CODE
/// @}
/// \name Sorting

View File

@ -203,76 +203,6 @@ namespace Point_set {
CGAL_precondition(m_max_radius >= m_min_radius);
}
#if !defined(CGAL_NO_DEPRECATED_CODE) || defined(DOXYGEN_RUNNING)
/*!
\brief initializes all internal data structures.
\deprecated This constructor is deprecated since the version 5.5 of \cgal.
\param input_range
an instance of `InputRange` with 3D points and
corresponding 3D normal vectors
\param distance_threshold
the maximum distance from a point to a sphere. %Default is 1.
\param angle_threshold
the maximum accepted angle in degrees between the normal of a point
and the radius of a sphere. %Default is 25 degrees.
\param min_region_size
the minimum number of 3D points a region must have. %Default is 3.
\param minimum_radius
the radius below which an estimated sphere is considered as invalid
and discarded. %Default is 0 (no limit).
\param maximum_radius
the radius above which an estimated sphere is considered as invalid
and discarded. %Default is infinity (no limit).
\param point_map
an instance of `PointMap` that maps an item from `input_range` to `Kernel::Point_3`
\param normal_map
an instance of `NormalMap` that maps an item from `input_range` to `Kernel::Vector_3`
\param traits
an instance of `GeomTraits`
\pre `input_range.size() > 0`
\pre `distance_threshold >= 0`
\pre `angle_threshold >= 0 && angle_threshold <= 90`
\pre `min_region_size > 0`
\pre `minimum_radius >= 0`
\pre `maximum_radius >= minimum_radius`
*/
CGAL_DEPRECATED_MSG("This constructor is deprecated since the version 5.5 of CGAL!")
Least_squares_sphere_fit_region(
const InputRange& input_range,
const FT distance_threshold = FT(1),
const FT angle_threshold = FT(25),
const std::size_t min_region_size = 3,
const FT minimum_radius = FT(0),
const FT maximum_radius = FT((std::numeric_limits<double>::max)()),
const PointMap point_map = PointMap(),
const NormalMap normal_map = NormalMap(),
const GeomTraits traits = GeomTraits()) :
Least_squares_sphere_fit_region(
input_range, CGAL::parameters::
maximum_distance(distance_threshold).
maximum_angle(angle_threshold).
minimum_region_size(min_region_size).
minimum_radius(minimum_radius).
maximum_radius(maximum_radius).
point_map(point_map).
normal_map(normal_map).
geom_traits(traits))
{ }
#endif // CGAL_NO_DEPRECATED_CODE
/// @}
/// \name Access

View File

@ -130,38 +130,6 @@ namespace Point_set {
m_scores.resize(m_input_range.size());
}
#if !defined(CGAL_NO_DEPRECATED_CODE) || defined(DOXYGEN_RUNNING)
/*!
\brief initializes all internal data structures.
\deprecated This constructor is deprecated since the version 5.5 of \cgal.
\param input_range
an instance of `InputRange` with 3D points
\param neighbor_query
an instance of `NeighborQuery` that is used internally to
access point's neighbors
\param point_map
an instance of `PointMap` that maps an item from `input_range`
to `Kernel::Point_3`
\pre `input_range.size() > 0`
*/
CGAL_DEPRECATED_MSG("This constructor is deprecated since the version 5.5 of CGAL!")
Least_squares_sphere_fit_sorting(
const InputRange& input_range,
NeighborQuery& neighbor_query,
const PointMap point_map = PointMap()) :
Least_squares_sphere_fit_sorting(
input_range, neighbor_query, CGAL::parameters::
point_map(point_map))
{ }
#endif // CGAL_NO_DEPRECATED_CODE
/// @}
/// \name Sorting

View File

@ -149,40 +149,6 @@ namespace Point_set {
m_tree.build();
}
#if !defined(CGAL_NO_DEPRECATED_CODE) || defined(DOXYGEN_RUNNING)
/*!
\brief initializes a Kd-tree with input points.
\deprecated This constructor is deprecated since the version 5.4 of \cgal.
\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
of a query point. %Default is 1.
\param point_map
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`
*/
CGAL_DEPRECATED_MSG("This constructor is deprecated since the version 5.4 of CGAL!")
Sphere_neighbor_query(
const InputRange& input_range,
const FT sphere_radius = FT(1),
const PointMap point_map = PointMap()) :
Sphere_neighbor_query(
input_range, CGAL::parameters::
sphere_radius(sphere_radius).
point_map(point_map))
{ }
#endif // CGAL_NO_DEPRECATED_CODE
/// @}
/// \name Access

View File

@ -196,57 +196,6 @@ namespace Polygon_mesh {
m_cos_value_threshold = cos_value;
}
#if !defined(CGAL_NO_DEPRECATED_CODE) || defined(DOXYGEN_RUNNING)
/*!
\brief initializes all internal data structures.
\deprecated This constructor is deprecated since the version 5.4 of \cgal.
\param pmesh
an instance of `PolygonMesh` that represents a polygon mesh
\param distance_threshold
the maximum distance from the furthest vertex of a face to a plane. %Default is 1.
\param angle_threshold
the maximum accepted angle in degrees between the normal of a face and
the normal of a plane. %Default is 25 degrees.
\param min_region_size
the minimum number of faces a region must have. %Default is 1.
\param vertex_to_point_map
an instance of `VertexToPointMap` that maps a polygon mesh
vertex to `Kernel::Point_3`
\param traits
an instance of `GeomTraits`
\pre `faces(pmesh).size() > 0`
\pre `distance_threshold >= 0`
\pre `angle_threshold >= 0 && angle_threshold <= 90`
\pre `min_region_size > 0`
*/
CGAL_DEPRECATED_MSG("This constructor is deprecated since the version 5.4 of CGAL!")
Least_squares_plane_fit_region(
const PolygonMesh& pmesh,
const FT distance_threshold = FT(1),
const FT angle_threshold = FT(25),
const std::size_t min_region_size = 1,
const VertexToPointMap vertex_to_point_map = VertexToPointMap(),
const GeomTraits traits = GeomTraits()) :
Least_squares_plane_fit_region(
pmesh, CGAL::parameters::
maximum_distance(distance_threshold).
maximum_angle(angle_threshold).
minimum_region_size(min_region_size).
vertex_point_map(vertex_to_point_map).
geom_traits(traits))
{ }
#endif // CGAL_NO_DEPRECATED_CODE
/// @}
/// \name Access

View File

@ -137,38 +137,6 @@ namespace Polygon_mesh {
m_scores.resize(m_face_range.size());
}
#if !defined(CGAL_NO_DEPRECATED_CODE) || defined(DOXYGEN_RUNNING)
/*!
\brief initializes all internal data structures.
\deprecated This constructor is deprecated since the version 5.4 of \cgal.
\param pmesh
an instance of `PolygonMesh` that represents a polygon mesh
\param neighbor_query
an instance of `NeighborQuery` that is used internally to
access face's neighbors
\param vertex_to_point_map
an instance of `VertexToPointMap` that maps a polygon mesh
vertex to `Kernel::Point_3`
\pre `faces(pmesh).size() > 0`
*/
CGAL_DEPRECATED_MSG("This constructor is deprecated since the version 5.4 of CGAL!")
Least_squares_plane_fit_sorting(
const PolygonMesh& pmesh,
NeighborQuery& neighbor_query,
const VertexToPointMap vertex_to_point_map = VertexToPointMap()) :
Least_squares_plane_fit_sorting(
pmesh, neighbor_query, CGAL::parameters::
vertex_point_map(vertex_to_point_map))
{ }
#endif // CGAL_NO_DEPRECATED_CODE
/// @}
/// \name Sorting

View File

@ -24,7 +24,6 @@ if(EIGEN3_FOUND)
create_single_source_cgal_program("test_region_growing_on_polygon_mesh_with_sorting.cpp")
create_single_source_cgal_program("test_region_growing_on_polyline_with_sorting.cpp")
create_single_source_cgal_program("test_region_growing_on_degenerated_mesh.cpp")
create_single_source_cgal_program("test_region_growing_deprecated_constructors.cpp")
foreach(
target
test_region_growing_basic
@ -38,8 +37,7 @@ if(EIGEN3_FOUND)
test_region_growing_on_point_set_3_with_sorting
test_region_growing_on_polygon_mesh_with_sorting
test_region_growing_on_polyline_with_sorting
test_region_growing_on_degenerated_mesh
test_region_growing_deprecated_constructors)
test_region_growing_on_degenerated_mesh)
target_link_libraries(${target} PUBLIC CGAL::Eigen3_support)
endforeach()

View File

@ -1,183 +0,0 @@
// Turn off warnings.
#include <CGAL/Installation/internal/disable_deprecation_warnings_and_errors.h>
// STL includes.
#include <string>
#include <vector>
#include <iostream>
#include <cassert>
// CGAL includes.
#include <CGAL/assertions.h>
#include <CGAL/property_map.h>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Shape_detection/Region_growing/Region_growing.h>
#include <CGAL/Shape_detection/Region_growing/Region_growing_on_point_set.h>
#include <CGAL/Shape_detection/Region_growing/Region_growing_on_polygon_mesh.h>
namespace SD = CGAL::Shape_detection;
using Kernel = CGAL::Simple_cartesian<double>;
using FT = typename Kernel::FT;
using Point_2 = typename Kernel::Point_2;
using Point_3 = typename Kernel::Point_3;
using Vector_2 = typename Kernel::Vector_2;
using Vector_3 = typename Kernel::Vector_3;
using Point_with_normal_2 = std::pair<Point_2, Vector_2>;
using Point_with_normal_3 = std::pair<Point_3, Vector_3>;
using Input_range_2 = std::vector<Point_with_normal_2>;
using Input_range_3 = std::vector<Point_with_normal_3>;
using Polygon_mesh = CGAL::Surface_mesh<Point_3>;
using Face_range = typename Polygon_mesh::Face_range;
using Point_map_2 = CGAL::First_of_pair_property_map<Point_with_normal_2>;
using Point_map_3 = CGAL::First_of_pair_property_map<Point_with_normal_3>;
using Normal_map_2 = CGAL::Second_of_pair_property_map<Point_with_normal_2>;
using Normal_map_3 = CGAL::Second_of_pair_property_map<Point_with_normal_3>;
using NQ1 = SD::Point_set::K_neighbor_query<Kernel, Input_range_2, Point_map_2>;
using NQ2 = SD::Point_set::Sphere_neighbor_query<Kernel, Input_range_3, Point_map_3>;
using NQ3 = SD::Polygon_mesh::One_ring_neighbor_query<Polygon_mesh>;
using RT1 = SD::Point_set::Least_squares_line_fit_region<Kernel, Input_range_2, Point_map_2, Normal_map_2>;
using RT2 = SD::Point_set::Least_squares_plane_fit_region<Kernel, Input_range_3, Point_map_3, Normal_map_3>;
using RT3 = SD::Polygon_mesh::Least_squares_plane_fit_region<Kernel, Polygon_mesh>;
using RT4 = SD::Point_set::Least_squares_circle_fit_region<Kernel, Input_range_2, Point_map_2, Normal_map_2>;
using RT5 = SD::Point_set::Least_squares_sphere_fit_region<Kernel, Input_range_3, Point_map_3, Normal_map_3>;
using RT6 = SD::Point_set::Least_squares_cylinder_fit_region<Kernel, Input_range_3, Point_map_3, Normal_map_3>;
using S1 = SD::Point_set::Least_squares_line_fit_sorting<Kernel, Input_range_2, NQ1, Point_map_2>;
using S2 = SD::Point_set::Least_squares_plane_fit_sorting<Kernel, Input_range_3, NQ2, Point_map_3>;
using S3 = SD::Polygon_mesh::Least_squares_plane_fit_sorting<Kernel, Polygon_mesh, NQ3>;
using S4 = SD::Point_set::Least_squares_circle_fit_sorting<Kernel, Input_range_2, NQ1, Point_map_2>;
using S5 = SD::Point_set::Least_squares_sphere_fit_sorting<Kernel, Input_range_3, NQ2, Point_map_3>;
using S6 = SD::Point_set::Least_squares_cylinder_fit_sorting<Kernel, Input_range_3, NQ2, Point_map_3, Normal_map_3>;
using RG1 = SD::Region_growing<Input_range_2, NQ1, RT1, typename S1::Seed_map>;
using RG2 = SD::Region_growing<Input_range_3, NQ2, RT2, typename S2::Seed_map>;
using RG3 = SD::Region_growing<Face_range , NQ3, RT3, typename S3::Seed_map>;
using RG4 = SD::Region_growing<Input_range_2, NQ1, RT4, typename S4::Seed_map>;
using RG5 = SD::Region_growing<Input_range_3, NQ2, RT5, typename S5::Seed_map>;
using RG6 = SD::Region_growing<Input_range_3, NQ2, RT6, typename S6::Seed_map>;
int main() {
// Default parameter values.
const std::size_t k = 6;
const FT distance_threshold = FT(2);
const FT angle_threshold = FT(15);
const std::size_t min_region_size = 1;
const FT sphere_radius = FT(2);
const FT min_radius = FT(0);
const FT max_radius = FT(1000000);
const Kernel traits;
const Input_range_2 input_range_2 = {
std::make_pair(Point_2(0, 0), Vector_2(0, 1)),
std::make_pair(Point_2(1, 0), Vector_2(0, 1))
};
const Input_range_3 input_range_3 = {
std::make_pair(Point_3(0, 0, 0), Vector_3(0, 0, 1)),
std::make_pair(Point_3(1, 0, 0), Vector_3(0, 0, 1)),
std::make_pair(Point_3(2, 0, 0), Vector_3(0, 0, 1))
};
Polygon_mesh polygon_mesh;
CGAL::make_tetrahedron(
Point_3(0, 0, 0), Point_3(2, 0, 0),
Point_3(1, 1, 1), Point_3(1, 0, 2), polygon_mesh);
const auto vertex_to_point_map =
get_const_property_map(CGAL::vertex_point, polygon_mesh);
const auto face_range = faces(polygon_mesh);
Point_map_2 point_map_2;
Point_map_3 point_map_3;
Normal_map_2 normal_map_2;
Normal_map_3 normal_map_3;
assert(input_range_2.size() == 2);
assert(input_range_3.size() == 3);
assert(polygon_mesh.number_of_faces() == 4);
NQ1 nq1(input_range_2, k, point_map_2);
NQ2 nq2(input_range_3, sphere_radius, point_map_3);
NQ3 nq3(polygon_mesh);
RT1 rt1(input_range_2,
distance_threshold, angle_threshold, min_region_size,
point_map_2, normal_map_2, traits);
RT2 rt2(input_range_3,
distance_threshold, angle_threshold, min_region_size,
point_map_3, normal_map_3, traits);
RT3 rt3(polygon_mesh,
distance_threshold, angle_threshold, min_region_size,
vertex_to_point_map, traits);
RT4 rt4(input_range_2,
distance_threshold, angle_threshold, min_region_size, min_radius, max_radius,
point_map_2, normal_map_2, traits);
RT5 rt5(input_range_3,
distance_threshold, angle_threshold, min_region_size, min_radius, max_radius,
point_map_3, normal_map_3, traits);
RT6 rt6(input_range_3,
distance_threshold, angle_threshold, min_region_size, min_radius, max_radius,
point_map_3, normal_map_3, traits);
S1 s1(input_range_2, nq1, point_map_2);
S2 s2(input_range_3, nq2, point_map_3);
S3 s3(polygon_mesh , nq3, vertex_to_point_map);
S4 s4(input_range_2, nq1, point_map_2);
S5 s5(input_range_3, nq2, point_map_3);
S6 s6(input_range_3, nq2, point_map_3);
s1.sort();
s2.sort();
s3.sort();
s4.sort();
s5.sort();
s6.sort();
RG1 rg1(input_range_2, nq1, rt1, s1.seed_map());
RG2 rg2(input_range_3, nq2, rt2, s2.seed_map());
RG3 rg3(face_range , nq3, rt3, s3.seed_map());
RG4 rg4(input_range_2, nq1, rt4, s4.seed_map());
RG5 rg5(input_range_3, nq2, rt5, s5.seed_map());
RG6 rg6(input_range_3, nq2, rt6, s6.seed_map());
std::vector< std::vector<std::size_t> > regions1;
std::vector< std::vector<std::size_t> > regions2;
std::vector< std::vector<std::size_t> > regions3;
std::vector< std::vector<std::size_t> > regions4;
std::vector< std::vector<std::size_t> > regions5;
std::vector< std::vector<std::size_t> > regions6;
rg1.detect(std::back_inserter(regions1));
rg2.detect(std::back_inserter(regions2));
rg3.detect(std::back_inserter(regions3));
rg4.detect(std::back_inserter(regions4));
rg5.detect(std::back_inserter(regions5));
rg6.detect(std::back_inserter(regions6));
assert(regions1.size() == 1);
assert(regions2.size() == 1);
assert(regions3.size() == 4);
assert(regions4.size() > 0);
assert(regions5.size() > 0);
assert(regions6.size() > 0);
std::cout << "rg_deprecated, sc_test_success: " << true << std::endl;
return EXIT_SUCCESS;
}