mirror of https://github.com/CGAL/cgal
removal of Result_type and Unassigned_type from Region_growing
changed Primitive type declarations
This commit is contained in:
parent
6e2a091dbd
commit
6f24d198cc
|
|
@ -100,7 +100,7 @@ void benchmark_region_growing_on_point_set_3(
|
||||||
|
|
||||||
// Run the algorithm.
|
// Run the algorithm.
|
||||||
Timer timer;
|
Timer timer;
|
||||||
Region_growing::Result_type regions;
|
std::vector<typename Region_growing::Primitive_and_region> regions;
|
||||||
|
|
||||||
timer.start();
|
timer.start();
|
||||||
region_growing.detect(std::back_inserter(regions));
|
region_growing.detect(std::back_inserter(regions));
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ class NeighborQuery {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// The reference type to the elements of the input range.
|
/// The reference type to the elements of the input range, e.g., a const_iterator of the input range.
|
||||||
typedef unspecified_type Item;
|
typedef unspecified_type Item;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,7 @@
|
||||||
A concept that describes the set of methods used by the `CGAL::Shape_detection::Region_growing`
|
A concept that describes the set of methods used by the `CGAL::Shape_detection::Region_growing`
|
||||||
to maintain a region.
|
to maintain a region.
|
||||||
|
|
||||||
A region is represented by a set of `indices` of the items, which are included in
|
A region is represented by a set items, which are included in this region.
|
||||||
this region.
|
|
||||||
|
|
||||||
\cgalHasModel
|
\cgalHasModel
|
||||||
- `CGAL::Shape_detection::Point_set::Least_squares_line_fit_region`
|
- `CGAL::Shape_detection::Point_set::Least_squares_line_fit_region`
|
||||||
|
|
@ -25,15 +24,12 @@ public:
|
||||||
/// The parameters of the primitive covering the region.
|
/// The parameters of the primitive covering the region.
|
||||||
typedef unspecified_type Primitive;
|
typedef unspecified_type Primitive;
|
||||||
|
|
||||||
/// The reference type to the elements of the input range.
|
/// The reference type to the elements of the input range, e.g., a const_iterator of the input range.
|
||||||
typedef unspecified_type Item;
|
typedef unspecified_type Item;
|
||||||
|
|
||||||
// The region types is defined by a vector of Items.
|
// The region types is defined by a vector of Items.
|
||||||
typedef std::vector<Item> Region;
|
typedef std::vector<Item> Region;
|
||||||
|
|
||||||
/// The result type of the region growing provides the Primitive of each region with the Items combined in a `std::pair`.
|
|
||||||
typedef std::vector<std::pair<Primitive, Region> > Result_type;
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
a model of `ReadWritePropertyMap` whose key type is `Item`
|
a model of `ReadWritePropertyMap` whose key type is `Item`
|
||||||
and value type is `std::size_t`. This map associates item of the input range
|
and value type is `std::size_t`. This map associates item of the input range
|
||||||
|
|
@ -41,7 +37,6 @@ public:
|
||||||
*/
|
*/
|
||||||
typedef unspecified_type Region_index_map;
|
typedef unspecified_type Region_index_map;
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
checks if the item `to`, which is a neighbor of the item
|
checks if the item `to`, which is a neighbor of the item
|
||||||
`from`, can be added to the region represented by `region`.
|
`from`, can be added to the region represented by `region`.
|
||||||
|
|
|
||||||
|
|
@ -62,14 +62,14 @@ int main(int argc, char *argv[]) {
|
||||||
point_set_2, neighbor_query, region_type);
|
point_set_2, neighbor_query, region_type);
|
||||||
|
|
||||||
// Run the algorithm.
|
// Run the algorithm.
|
||||||
Region_growing::Result_type regions;
|
std::vector<typename Region_growing::Primitive_and_region> regions;
|
||||||
region_growing.detect(std::back_inserter(regions));
|
region_growing.detect(std::back_inserter(regions));
|
||||||
std::cout << "* number of found lines: " << regions.size() << std::endl;
|
std::cout << "* number of found lines: " << regions.size() << std::endl;
|
||||||
assert(is_default_input && regions.size() == 72);
|
assert(is_default_input && regions.size() == 72);
|
||||||
|
|
||||||
// Save regions to a file.
|
// Save regions to a file.
|
||||||
const std::string fullpath = (argc > 2 ? argv[2] : "lines_point_set_2.ply");
|
const std::string fullpath = (argc > 2 ? argv[2] : "lines_point_set_2.ply");
|
||||||
utils::save_point_regions_2<Kernel, Region_growing::Result_type, Point_map>(
|
utils::save_point_regions_2<Kernel, std::vector<typename Region_growing::Primitive_and_region>, Point_map>(
|
||||||
regions, fullpath);
|
regions, fullpath);
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,14 +65,14 @@ int main(int argc, char *argv[]) {
|
||||||
polyline_3, neighbor_query_3, region_type_3);
|
polyline_3, neighbor_query_3, region_type_3);
|
||||||
|
|
||||||
// Run the algorithm on a 3D polyline.
|
// Run the algorithm on a 3D polyline.
|
||||||
Region_growing_3::Result_type regions;
|
std::vector<typename Region_growing_3::Primitive_and_region> regions;
|
||||||
region_growing_3.detect(std::back_inserter(regions));
|
region_growing_3.detect(std::back_inserter(regions));
|
||||||
std::cout << "* number of found 3D regions: " << regions.size() << std::endl;
|
std::cout << "* number of found 3D regions: " << regions.size() << std::endl;
|
||||||
assert(is_default_input && regions.size() == 17);
|
assert(is_default_input && regions.size() == 17);
|
||||||
|
|
||||||
// Save 3D regions to a file.
|
// Save 3D regions to a file.
|
||||||
std::string fullpath = (argc > 2 ? argv[2] : "regions_polyline_3.ply");
|
std::string fullpath = (argc > 2 ? argv[2] : "regions_polyline_3.ply");
|
||||||
utils::save_point_regions_3<Kernel, Region_growing_3::Result_type, Point_map_3>(
|
utils::save_point_regions_3<Kernel, std::vector<typename Region_growing_3::Primitive_and_region>, Point_map_3>(
|
||||||
regions, fullpath);
|
regions, fullpath);
|
||||||
|
|
||||||
// Create the 2D polyline.
|
// Create the 2D polyline.
|
||||||
|
|
@ -102,7 +102,7 @@ int main(int argc, char *argv[]) {
|
||||||
polyline_2, neighbor_query_2, region_type_2);
|
polyline_2, neighbor_query_2, region_type_2);
|
||||||
|
|
||||||
// Run the algorithm on a 2D polyline.
|
// Run the algorithm on a 2D polyline.
|
||||||
Region_growing_2::Result_type regions2;
|
std::vector<typename Region_growing_2::Primitive_and_region> regions2;
|
||||||
region_growing_2.detect(std::back_inserter(regions2));
|
region_growing_2.detect(std::back_inserter(regions2));
|
||||||
std::cout << "* number of found 2D regions: " << regions2.size() << std::endl;
|
std::cout << "* number of found 2D regions: " << regions2.size() << std::endl;
|
||||||
assert(is_default_input && regions2.size() == 5);
|
assert(is_default_input && regions2.size() == 5);
|
||||||
|
|
@ -114,7 +114,7 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fullpath = (argc > 2 ? argv[2] : "regions_polyline_2.ply");
|
fullpath = (argc > 2 ? argv[2] : "regions_polyline_2.ply");
|
||||||
utils::save_point_regions_2<Kernel, Region_growing_2::Result_type, Point_map_2>(
|
utils::save_point_regions_2<Kernel, std::vector<typename Region_growing_2::Primitive_and_region>, Point_map_2>(
|
||||||
regions2, fullpath);
|
regions2, fullpath);
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ int main(int argc, char *argv[]) {
|
||||||
Plane_region plane_region(surface_mesh);
|
Plane_region plane_region(surface_mesh);
|
||||||
RG_planes rg_planes(face_range, one_ring_query, plane_region);
|
RG_planes rg_planes(face_range, one_ring_query, plane_region);
|
||||||
|
|
||||||
RG_planes::Result_type regions;
|
std::vector<typename RG_planes::Primitive_and_region> regions;
|
||||||
rg_planes.detect(std::back_inserter(regions));
|
rg_planes.detect(std::back_inserter(regions));
|
||||||
std::cout << "* number of found planar regions: " << regions.size() << std::endl;
|
std::cout << "* number of found planar regions: " << regions.size() << std::endl;
|
||||||
assert(is_default_input && regions.size() == 9);
|
assert(is_default_input && regions.size() == 9);
|
||||||
|
|
@ -72,13 +72,13 @@ int main(int argc, char *argv[]) {
|
||||||
RG_lines rg_lines(
|
RG_lines rg_lines(
|
||||||
segment_range, pgraph, line_region, line_sorting.ordered());
|
segment_range, pgraph, line_region, line_sorting.ordered());
|
||||||
|
|
||||||
RG_lines::Result_type subregions;
|
std::vector<typename RG_lines::Primitive_and_region> subregions;
|
||||||
rg_lines.detect(std::back_inserter(subregions));
|
rg_lines.detect(std::back_inserter(subregions));
|
||||||
std::cout << "* number of found linear regions: " << subregions.size() << std::endl;
|
std::cout << "* number of found linear regions: " << subregions.size() << std::endl;
|
||||||
assert(is_default_input && subregions.size() == 21);
|
assert(is_default_input && subregions.size() == 21);
|
||||||
|
|
||||||
fullpath = (argc > 2 ? argv[2] : "subregions_sm.ply");
|
fullpath = (argc > 2 ? argv[2] : "subregions_sm.ply");
|
||||||
utils::save_segment_regions_3<Kernel, RG_lines::Result_type, Segment_map>(
|
utils::save_segment_regions_3<Kernel, std::vector<typename RG_lines::Primitive_and_region>, Segment_map>(
|
||||||
subregions, fullpath, pgraph.segment_map());
|
subregions, fullpath, pgraph.segment_map());
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ int main(int argc, char *argv[]) {
|
||||||
face_range, neighbor_query, region_type, sorting.ordered());
|
face_range, neighbor_query, region_type, sorting.ordered());
|
||||||
|
|
||||||
// Run the algorithm.
|
// Run the algorithm.
|
||||||
Region_growing::Result_type regions;
|
std::vector<typename Region_growing::Primitive_and_region> regions;
|
||||||
region_growing.detect(std::back_inserter(regions));
|
region_growing.detect(std::back_inserter(regions));
|
||||||
std::cout << "* number of found planes: " << regions.size() << std::endl;
|
std::cout << "* number of found planes: " << regions.size() << std::endl;
|
||||||
assert(is_default_input && regions.size() == 355);
|
assert(is_default_input && regions.size() == 355);
|
||||||
|
|
@ -87,7 +87,7 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Region_growing::Unassigned_type unassigned;
|
std::vector<typename Region_growing::Item> unassigned;
|
||||||
region_growing.unassigned_items(std::back_inserter(unassigned));
|
region_growing.unassigned_items(std::back_inserter(unassigned));
|
||||||
|
|
||||||
for (auto& item : unassigned) {
|
for (auto& item : unassigned) {
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,7 @@ int main() {
|
||||||
objects, neighbor_query, region_type);
|
objects, neighbor_query, region_type);
|
||||||
|
|
||||||
// Run the algorithm.
|
// Run the algorithm.
|
||||||
Region_growing::Result_type regions;
|
std::vector<typename Region_growing::Primitive_and_region> regions;
|
||||||
region_growing.detect(std::back_inserter(regions));
|
region_growing.detect(std::back_inserter(regions));
|
||||||
std::cout << "* number of found regions: " << regions.size() << std::endl;
|
std::cout << "* number of found regions: " << regions.size() << std::endl;
|
||||||
assert(regions.size() == 2);
|
assert(regions.size() == 2);
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,6 @@ namespace Point_set {
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
/// \cond SKIP_IN_MANUAL
|
/// \cond SKIP_IN_MANUAL
|
||||||
using Traits = GeomTraits;
|
|
||||||
using Input_range = InputRange;
|
using Input_range = InputRange;
|
||||||
using Point_map = PointMap;
|
using Point_map = PointMap;
|
||||||
using Normal_map = NormalMap;
|
using Normal_map = NormalMap;
|
||||||
|
|
@ -78,25 +77,32 @@ namespace Point_set {
|
||||||
using Item = typename InputRange::const_iterator;
|
using Item = typename InputRange::const_iterator;
|
||||||
using Region = std::vector<Item>;
|
using Region = std::vector<Item>;
|
||||||
|
|
||||||
|
#ifdef DOXYGEN_RUNNING
|
||||||
|
/// Primitive
|
||||||
|
using Primitive = struct {
|
||||||
|
typename GeomTraits::Point_2 center;
|
||||||
|
typename GeomTraits::FT radius;
|
||||||
|
};
|
||||||
|
#else
|
||||||
/// Primitive
|
/// Primitive
|
||||||
using Primitive = struct P {
|
using Primitive = struct P {
|
||||||
P(const typename Traits::Point_2& c, typename Traits::FT r) : center(c), radius(r) {}
|
P(const typename GeomTraits::Point_2& c, typename GeomTraits::FT r) : center(c), radius(r) {}
|
||||||
typename Traits::Point_2 center;
|
|
||||||
typename Traits::FT radius;
|
|
||||||
};
|
|
||||||
using Result_type = std::vector<std::pair<Primitive, Region> >;
|
|
||||||
|
|
||||||
|
typename GeomTraits::Point_2 center;
|
||||||
|
typename GeomTraits::FT radius;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
/// Region map
|
/// Region map
|
||||||
using Region_unordered_map = boost::unordered_map<Item, std::size_t, internal::hash_item<Item> >;
|
using Region_unordered_map = boost::unordered_map<Item, std::size_t, internal::hash_item<Item> >;
|
||||||
using Region_index_map = boost::associative_property_map<Region_unordered_map>;
|
using Region_index_map = boost::associative_property_map<Region_unordered_map>;
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
using Point_2 = typename Traits::Point_2;
|
using Point_2 = typename GeomTraits::Point_2;
|
||||||
using Vector_2 = typename Traits::Vector_2;
|
using Vector_2 = typename GeomTraits::Vector_2;
|
||||||
|
|
||||||
using Squared_distance_2 = typename Traits::Compute_squared_distance_2;
|
using Squared_distance_2 = typename GeomTraits::Compute_squared_distance_2;
|
||||||
using Get_sqrt = internal::Get_sqrt<Traits>;
|
using Get_sqrt = internal::Get_sqrt<GeomTraits>;
|
||||||
using Sqrt = typename Get_sqrt::Sqrt;
|
using Sqrt = typename Get_sqrt::Sqrt;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
@ -372,7 +378,7 @@ namespace Point_set {
|
||||||
const Input_range& m_input_range;
|
const Input_range& m_input_range;
|
||||||
const Point_map m_point_map;
|
const Point_map m_point_map;
|
||||||
const Normal_map m_normal_map;
|
const Normal_map m_normal_map;
|
||||||
const Traits m_traits;
|
const GeomTraits m_traits;
|
||||||
Region_unordered_map m_region_map;
|
Region_unordered_map m_region_map;
|
||||||
|
|
||||||
FT m_distance_threshold;
|
FT m_distance_threshold;
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,6 @@ namespace Point_set {
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
/// \cond SKIP_IN_MANUAL
|
/// \cond SKIP_IN_MANUAL
|
||||||
using Traits = GeomTraits;
|
|
||||||
using Input_range = InputRange;
|
using Input_range = InputRange;
|
||||||
using Point_map = PointMap;
|
using Point_map = PointMap;
|
||||||
using Normal_map = NormalMap;
|
using Normal_map = NormalMap;
|
||||||
|
|
@ -79,12 +78,19 @@ namespace Point_set {
|
||||||
using Region = std::vector<Item>;
|
using Region = std::vector<Item>;
|
||||||
|
|
||||||
/// Primitive
|
/// Primitive
|
||||||
using Primitive = struct P {
|
#ifdef DOXYGEN_RUNNING
|
||||||
P(const typename Traits::Line_3& a, const typename Traits::FT r) : axis(a), radius(r) {}
|
using Primitive = struct {
|
||||||
typename Traits::Line_3 axis;
|
typename GeomTraits::Line_3 axis;
|
||||||
typename Traits::FT radius;
|
typename GeomTraits::FT radius;
|
||||||
};
|
};
|
||||||
using Result_type = std::vector<std::pair<Primitive, Region> >;
|
#else
|
||||||
|
using Primitive = struct P {
|
||||||
|
P(const typename GeomTraits::Line_3& a, const typename GeomTraits::FT r) : axis(a), radius(r) {}
|
||||||
|
|
||||||
|
typename GeomTraits::Line_3 axis;
|
||||||
|
typename GeomTraits::FT radius;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
/// Region map
|
/// Region map
|
||||||
using Region_unordered_map = boost::unordered_map<Item, std::size_t, internal::hash_item<Item> >;
|
using Region_unordered_map = boost::unordered_map<Item, std::size_t, internal::hash_item<Item> >;
|
||||||
|
|
@ -92,12 +98,12 @@ namespace Point_set {
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
using Point_3 = typename Traits::Point_3;
|
using Point_3 = typename GeomTraits::Point_3;
|
||||||
using Vector_3 = typename Traits::Vector_3;
|
using Vector_3 = typename GeomTraits::Vector_3;
|
||||||
using Line_3 = typename Traits::Line_3;
|
using Line_3 = typename GeomTraits::Line_3;
|
||||||
|
|
||||||
using Squared_distance_3 = typename Traits::Compute_squared_distance_3;
|
using Squared_distance_3 = typename GeomTraits::Compute_squared_distance_3;
|
||||||
using Get_sqrt = internal::Get_sqrt<Traits>;
|
using Get_sqrt = internal::Get_sqrt<GeomTraits>;
|
||||||
using Sqrt = typename Get_sqrt::Sqrt;
|
using Sqrt = typename Get_sqrt::Sqrt;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
@ -381,7 +387,7 @@ namespace Point_set {
|
||||||
const Input_range& m_input_range;
|
const Input_range& m_input_range;
|
||||||
const Point_map m_point_map;
|
const Point_map m_point_map;
|
||||||
const Normal_map m_normal_map;
|
const Normal_map m_normal_map;
|
||||||
const Traits m_traits;
|
const GeomTraits m_traits;
|
||||||
Region_unordered_map m_region_map;
|
Region_unordered_map m_region_map;
|
||||||
|
|
||||||
FT m_distance_threshold;
|
FT m_distance_threshold;
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,6 @@ namespace Point_set {
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
/// \cond SKIP_IN_MANUAL
|
/// \cond SKIP_IN_MANUAL
|
||||||
using Traits = GeomTraits;
|
|
||||||
using Input_range = InputRange;
|
using Input_range = InputRange;
|
||||||
using Point_map = PointMap;
|
using Point_map = PointMap;
|
||||||
using Normal_map = NormalMap;
|
using Normal_map = NormalMap;
|
||||||
|
|
@ -79,8 +78,7 @@ namespace Point_set {
|
||||||
using Region = std::vector<Item>;
|
using Region = std::vector<Item>;
|
||||||
|
|
||||||
/// Primitive
|
/// Primitive
|
||||||
using Primitive = typename Traits::Line_2;
|
using Primitive = typename GeomTraits::Line_2;
|
||||||
using Result_type = std::vector<std::pair<Primitive, Region> >;
|
|
||||||
|
|
||||||
/// Region map
|
/// Region map
|
||||||
using Region_unordered_map = boost::unordered_map<Item, std::size_t, internal::hash_item<Item> >;
|
using Region_unordered_map = boost::unordered_map<Item, std::size_t, internal::hash_item<Item> >;
|
||||||
|
|
@ -88,13 +86,13 @@ namespace Point_set {
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
using Point_2 = typename Traits::Point_2;
|
using Point_2 = typename GeomTraits::Point_2;
|
||||||
using Vector_2 = typename Traits::Vector_2;
|
using Vector_2 = typename GeomTraits::Vector_2;
|
||||||
using Line_2 = typename Traits::Line_2;
|
using Line_2 = typename GeomTraits::Line_2;
|
||||||
|
|
||||||
using Squared_length_2 = typename Traits::Compute_squared_length_2;
|
using Squared_length_2 = typename GeomTraits::Compute_squared_length_2;
|
||||||
using Squared_distance_2 = typename Traits::Compute_squared_distance_2;
|
using Squared_distance_2 = typename GeomTraits::Compute_squared_distance_2;
|
||||||
using Scalar_product_2 = typename Traits::Compute_scalar_product_2;
|
using Scalar_product_2 = typename GeomTraits::Compute_scalar_product_2;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// \name Initialization
|
/// \name Initialization
|
||||||
|
|
@ -202,7 +200,7 @@ namespace Point_set {
|
||||||
/*!
|
/*!
|
||||||
\brief implements `RegionType::region_index_map()`.
|
\brief implements `RegionType::region_index_map()`.
|
||||||
|
|
||||||
This function creates an empty property map that maps iterators on the input range `Item` to std::size_t.
|
This function creates an empty property map that maps iterators on the input range `Item` to `std::size_t`.
|
||||||
*/
|
*/
|
||||||
Region_index_map region_index_map() {
|
Region_index_map region_index_map() {
|
||||||
return Region_index_map(m_region_map);
|
return Region_index_map(m_region_map);
|
||||||
|
|
@ -364,7 +362,7 @@ namespace Point_set {
|
||||||
const Input_range& m_input_range;
|
const Input_range& m_input_range;
|
||||||
const Point_map m_point_map;
|
const Point_map m_point_map;
|
||||||
const Normal_map m_normal_map;
|
const Normal_map m_normal_map;
|
||||||
const Traits m_traits;
|
const GeomTraits m_traits;
|
||||||
Region_unordered_map m_region_map;
|
Region_unordered_map m_region_map;
|
||||||
|
|
||||||
FT m_distance_threshold;
|
FT m_distance_threshold;
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,6 @@ namespace Point_set {
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
/// \cond SKIP_IN_MANUAL
|
/// \cond SKIP_IN_MANUAL
|
||||||
using Traits = GeomTraits;
|
|
||||||
using Input_range = InputRange;
|
using Input_range = InputRange;
|
||||||
using Point_map = PointMap;
|
using Point_map = PointMap;
|
||||||
using Normal_map = NormalMap;
|
using Normal_map = NormalMap;
|
||||||
|
|
@ -79,8 +78,7 @@ namespace Point_set {
|
||||||
using Region = std::vector<Item>;
|
using Region = std::vector<Item>;
|
||||||
|
|
||||||
/// Primitive
|
/// Primitive
|
||||||
using Primitive = typename Traits::Plane_3;
|
using Primitive = typename GeomTraits::Plane_3;
|
||||||
using Result_type = std::vector<std::pair<Primitive, Region> >;
|
|
||||||
|
|
||||||
/// Region map
|
/// Region map
|
||||||
using Region_unordered_map = boost::unordered_map<Item, std::size_t, internal::hash_item<Item> >;
|
using Region_unordered_map = boost::unordered_map<Item, std::size_t, internal::hash_item<Item> >;
|
||||||
|
|
@ -88,13 +86,13 @@ namespace Point_set {
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
using Point_3 = typename Traits::Point_3;
|
using Point_3 = typename GeomTraits::Point_3;
|
||||||
using Vector_3 = typename Traits::Vector_3;
|
using Vector_3 = typename GeomTraits::Vector_3;
|
||||||
using Plane_3 = typename Traits::Plane_3;
|
using Plane_3 = typename GeomTraits::Plane_3;
|
||||||
|
|
||||||
using Squared_length_3 = typename Traits::Compute_squared_length_3;
|
using Squared_length_3 = typename GeomTraits::Compute_squared_length_3;
|
||||||
using Squared_distance_3 = typename Traits::Compute_squared_distance_3;
|
using Squared_distance_3 = typename GeomTraits::Compute_squared_distance_3;
|
||||||
using Scalar_product_3 = typename Traits::Compute_scalar_product_3;
|
using Scalar_product_3 = typename GeomTraits::Compute_scalar_product_3;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// \name Initialization
|
/// \name Initialization
|
||||||
|
|
@ -363,7 +361,7 @@ namespace Point_set {
|
||||||
const Input_range& m_input_range;
|
const Input_range& m_input_range;
|
||||||
const Point_map m_point_map;
|
const Point_map m_point_map;
|
||||||
const Normal_map m_normal_map;
|
const Normal_map m_normal_map;
|
||||||
const Traits m_traits;
|
const GeomTraits m_traits;
|
||||||
Region_unordered_map m_region_map;
|
Region_unordered_map m_region_map;
|
||||||
|
|
||||||
FT m_distance_threshold;
|
FT m_distance_threshold;
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,6 @@ g
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
/// \cond SKIP_IN_MANUAL
|
/// \cond SKIP_IN_MANUAL
|
||||||
using Traits = GeomTraits;
|
|
||||||
using Input_range = InputRange;
|
using Input_range = InputRange;
|
||||||
using Point_map = PointMap;
|
using Point_map = PointMap;
|
||||||
using Normal_map = NormalMap;
|
using Normal_map = NormalMap;
|
||||||
|
|
@ -79,8 +78,7 @@ g
|
||||||
using Region = std::vector<Item>;
|
using Region = std::vector<Item>;
|
||||||
|
|
||||||
/// Primitive
|
/// Primitive
|
||||||
using Primitive = typename Traits::Sphere_3;
|
using Primitive = typename GeomTraits::Sphere_3;
|
||||||
using Result_type = std::vector<std::pair<Primitive, Region> >;
|
|
||||||
|
|
||||||
/// Region map
|
/// Region map
|
||||||
using Region_unordered_map = boost::unordered_map<Item, std::size_t, internal::hash_item<Item> >;
|
using Region_unordered_map = boost::unordered_map<Item, std::size_t, internal::hash_item<Item> >;
|
||||||
|
|
@ -88,12 +86,12 @@ g
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
using Point_3 = typename Traits::Point_3;
|
using Point_3 = typename GeomTraits::Point_3;
|
||||||
using Vector_3 = typename Traits::Vector_3;
|
using Vector_3 = typename GeomTraits::Vector_3;
|
||||||
using Sphere_3 = typename Traits::Sphere_3;
|
using Sphere_3 = typename GeomTraits::Sphere_3;
|
||||||
|
|
||||||
using Squared_distance_3 = typename Traits::Compute_squared_distance_3;
|
using Squared_distance_3 = typename GeomTraits::Compute_squared_distance_3;
|
||||||
using Get_sqrt = internal::Get_sqrt<Traits>;
|
using Get_sqrt = internal::Get_sqrt<GeomTraits>;
|
||||||
using Sqrt = typename Get_sqrt::Sqrt;
|
using Sqrt = typename Get_sqrt::Sqrt;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
@ -370,7 +368,7 @@ g
|
||||||
const Input_range& m_input_range;
|
const Input_range& m_input_range;
|
||||||
const Point_map m_point_map;
|
const Point_map m_point_map;
|
||||||
const Normal_map m_normal_map;
|
const Normal_map m_normal_map;
|
||||||
const Traits m_traits;
|
const GeomTraits m_traits;
|
||||||
Region_unordered_map m_region_map;
|
Region_unordered_map m_region_map;
|
||||||
|
|
||||||
FT m_distance_threshold;
|
FT m_distance_threshold;
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,6 @@ namespace Polygon_mesh {
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
/// \cond SKIP_IN_MANUAL
|
/// \cond SKIP_IN_MANUAL
|
||||||
using Traits = GeomTraits;
|
|
||||||
using Face_graph = PolygonMesh;
|
using Face_graph = PolygonMesh;
|
||||||
using Face_range = FaceRange;
|
using Face_range = FaceRange;
|
||||||
using Vertex_to_point_map = VertexToPointMap;
|
using Vertex_to_point_map = VertexToPointMap;
|
||||||
|
|
@ -78,8 +77,7 @@ namespace Polygon_mesh {
|
||||||
using Region = std::vector<Item>;
|
using Region = std::vector<Item>;
|
||||||
|
|
||||||
/// Primitive
|
/// Primitive
|
||||||
using Primitive = typename Traits::Plane_3;
|
using Primitive = typename GeomTraits::Plane_3;
|
||||||
using Result_type = std::vector<std::pair<Primitive, Region> >;
|
|
||||||
|
|
||||||
/// Region map
|
/// Region map
|
||||||
using Region_index_map = typename boost::property_map<Face_graph, CGAL::dynamic_face_property_t<std::size_t> >::const_type;
|
using Region_index_map = typename boost::property_map<Face_graph, CGAL::dynamic_face_property_t<std::size_t> >::const_type;
|
||||||
|
|
@ -87,14 +85,14 @@ namespace Polygon_mesh {
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
using Point_3 = typename Traits::Point_3;
|
using Point_3 = typename GeomTraits::Point_3;
|
||||||
using Vector_3 = typename Traits::Vector_3;
|
using Vector_3 = typename GeomTraits::Vector_3;
|
||||||
using Plane_3 = typename Traits::Plane_3;
|
using Plane_3 = typename GeomTraits::Plane_3;
|
||||||
|
|
||||||
using Squared_length_3 = typename Traits::Compute_squared_length_3;
|
using Squared_length_3 = typename GeomTraits::Compute_squared_length_3;
|
||||||
using Squared_distance_3 = typename Traits::Compute_squared_distance_3;
|
using Squared_distance_3 = typename GeomTraits::Compute_squared_distance_3;
|
||||||
using Scalar_product_3 = typename Traits::Compute_scalar_product_3;
|
using Scalar_product_3 = typename GeomTraits::Compute_scalar_product_3;
|
||||||
using Cross_product_3 = typename Traits::Construct_cross_product_vector_3;
|
using Cross_product_3 = typename GeomTraits::Construct_cross_product_vector_3;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// \name Initialization
|
/// \name Initialization
|
||||||
|
|
@ -358,7 +356,7 @@ namespace Polygon_mesh {
|
||||||
const Face_graph& m_face_graph;
|
const Face_graph& m_face_graph;
|
||||||
const Face_range m_face_range;
|
const Face_range m_face_range;
|
||||||
const Vertex_to_point_map m_vertex_to_point_map;
|
const Vertex_to_point_map m_vertex_to_point_map;
|
||||||
const Traits m_traits;
|
const GeomTraits m_traits;
|
||||||
|
|
||||||
FT m_distance_threshold;
|
FT m_distance_threshold;
|
||||||
FT m_cos_value_threshold;
|
FT m_cos_value_threshold;
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ namespace Polygon_mesh {
|
||||||
|
|
||||||
\brief Sorting of polygon mesh faces with respect to the local plane fit quality.
|
\brief Sorting of polygon mesh faces with respect to the local plane fit quality.
|
||||||
|
|
||||||
Indices of faces in a polygon mesh are sorted with respect to the quality of the
|
`Items` of faces in a polygon mesh are sorted with respect to the quality of the
|
||||||
least squares plane fit applied to the vertices of incident faces of each face.
|
least squares plane fit applied to the vertices of incident faces of each face.
|
||||||
|
|
||||||
\tparam GeomTraits
|
\tparam GeomTraits
|
||||||
|
|
@ -61,7 +61,6 @@ namespace Polygon_mesh {
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
/// \cond SKIP_IN_MANUAL
|
/// \cond SKIP_IN_MANUAL
|
||||||
using Traits = GeomTraits;
|
|
||||||
using Face_graph = PolygonMesh;
|
using Face_graph = PolygonMesh;
|
||||||
using Neighbor_query = NeighborQuery;
|
using Neighbor_query = NeighborQuery;
|
||||||
using Face_range = FaceRange;
|
using Face_range = FaceRange;
|
||||||
|
|
@ -77,7 +76,7 @@ namespace Polygon_mesh {
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
using FT = typename Traits::FT;
|
using FT = typename GeomTraits::FT;
|
||||||
using Compare_scores = internal::Compare_scores<FT>;
|
using Compare_scores = internal::Compare_scores<FT>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
@ -180,7 +179,7 @@ namespace Polygon_mesh {
|
||||||
Neighbor_query& m_neighbor_query;
|
Neighbor_query& m_neighbor_query;
|
||||||
const Face_range m_face_range;
|
const Face_range m_face_range;
|
||||||
const Vertex_to_point_map m_vertex_to_point_map;
|
const Vertex_to_point_map m_vertex_to_point_map;
|
||||||
const Traits m_traits;
|
const GeomTraits m_traits;
|
||||||
Seed_range m_ordered;
|
Seed_range m_ordered;
|
||||||
std::vector<FT> m_scores;
|
std::vector<FT> m_scores;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ namespace Polygon_mesh {
|
||||||
/// \endcond
|
/// \endcond
|
||||||
|
|
||||||
/// Item type.
|
/// Item type.
|
||||||
using Item = face_descriptor;
|
using Item = typename boost::graph_traits<PolygonMesh>::face_descriptor;
|
||||||
using Region = std::vector<Item>;
|
using Region = std::vector<Item>;
|
||||||
|
|
||||||
/// \name Initialization
|
/// \name Initialization
|
||||||
|
|
@ -82,7 +82,7 @@ namespace Polygon_mesh {
|
||||||
|
|
||||||
This operator retrieves all faces,
|
This operator retrieves all faces,
|
||||||
which are edge-adjacent to the face `query`.
|
which are edge-adjacent to the face `query`.
|
||||||
These indices are returned in `neighbors`.
|
These `Items` are returned in `neighbors`.
|
||||||
|
|
||||||
\param query
|
\param query
|
||||||
`Item` of the query face
|
`Item` of the query face
|
||||||
|
|
|
||||||
|
|
@ -80,9 +80,12 @@ namespace Polyline {
|
||||||
/// Number type.
|
/// Number type.
|
||||||
typedef typename GeomTraits::FT FT;
|
typedef typename GeomTraits::FT FT;
|
||||||
|
|
||||||
/// Primitive
|
/// Primitive type depends on the dimension of the input data.
|
||||||
|
#ifdef DOXYGEN_RUNNING
|
||||||
|
using Primitive = typename GeomTraits::Line_2 or typename GeomTraits::Line_3
|
||||||
|
#else
|
||||||
using Primitive = typename Polyline_traits::Line;
|
using Primitive = typename Polyline_traits::Line;
|
||||||
using Result_type = std::vector<std::pair<Primitive, Region> >;
|
#endif
|
||||||
|
|
||||||
/// Region map
|
/// Region map
|
||||||
using Region_unordered_map = boost::unordered_map<Item, std::size_t, internal::hash_item<Item> >;
|
using Region_unordered_map = boost::unordered_map<Item, std::size_t, internal::hash_item<Item> >;
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ namespace Polyline {
|
||||||
|
|
||||||
\brief Sorting of polyline vertices with respect to the local line fit quality.
|
\brief Sorting of polyline vertices with respect to the local line fit quality.
|
||||||
|
|
||||||
Indices of input vertices are sorted with respect to the quality of the
|
`Items` of input vertices are sorted with respect to the quality of the
|
||||||
least squares line fit applied to the incident vertices of each vertex.
|
least squares line fit applied to the incident vertices of each vertex.
|
||||||
|
|
||||||
\tparam GeomTraits
|
\tparam GeomTraits
|
||||||
|
|
@ -56,7 +56,6 @@ namespace Polyline {
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
/// \cond SKIP_IN_MANUAL
|
/// \cond SKIP_IN_MANUAL
|
||||||
using Traits = GeomTraits;
|
|
||||||
using Input_range = InputRange;
|
using Input_range = InputRange;
|
||||||
using Neighbor_query = NeighborQuery;
|
using Neighbor_query = NeighborQuery;
|
||||||
using Point_map = PointMap;
|
using Point_map = PointMap;
|
||||||
|
|
@ -72,11 +71,11 @@ namespace Polyline {
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
using FT = typename Traits::FT;
|
using FT = typename GeomTraits::FT;
|
||||||
using Polyline_traits = typename std::conditional<
|
using Polyline_traits = typename std::conditional<
|
||||||
std::is_same<typename Traits::Point_2, Point_type>::value,
|
std::is_same<typename GeomTraits::Point_2, Point_type>::value,
|
||||||
internal::Region_growing_traits_2<Traits>,
|
internal::Region_growing_traits_2<GeomTraits>,
|
||||||
internal::Region_growing_traits_3<Traits> >::type;
|
internal::Region_growing_traits_3<GeomTraits> >::type;
|
||||||
using Compare_scores = internal::Compare_scores<FT>;
|
using Compare_scores = internal::Compare_scores<FT>;
|
||||||
using Dereference_pmap = internal::Dereference_property_map_adaptor<Item, PointMap>;
|
using Dereference_pmap = internal::Dereference_property_map_adaptor<Item, PointMap>;
|
||||||
|
|
||||||
|
|
@ -182,7 +181,7 @@ namespace Polyline {
|
||||||
Neighbor_query& m_neighbor_query;
|
Neighbor_query& m_neighbor_query;
|
||||||
const Point_map m_point_map;
|
const Point_map m_point_map;
|
||||||
Dereference_pmap m_deref_pmap;
|
Dereference_pmap m_deref_pmap;
|
||||||
const Traits m_traits;
|
const GeomTraits m_traits;
|
||||||
const Polyline_traits m_polyline_traits;
|
const Polyline_traits m_polyline_traits;
|
||||||
Seed_range m_ordered;
|
Seed_range m_ordered;
|
||||||
std::vector<FT> m_scores;
|
std::vector<FT> m_scores;
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ namespace Polyline {
|
||||||
|
|
||||||
\brief Direct neighbors connectivity in a polyline.
|
\brief Direct neighbors connectivity in a polyline.
|
||||||
|
|
||||||
This class returns indices of the previous and next vertex
|
This class returns `Items` of the previous and next vertex
|
||||||
in a polyline given as `InputRange.`
|
in a polyline given as `InputRange.`
|
||||||
|
|
||||||
\tparam GeomTraits
|
\tparam GeomTraits
|
||||||
|
|
|
||||||
|
|
@ -72,10 +72,9 @@ namespace Shape_detection {
|
||||||
/// Item type.
|
/// Item type.
|
||||||
using Item = typename RegionType::Item;
|
using Item = typename RegionType::Item;
|
||||||
using Region = std::vector<Item>;
|
using Region = std::vector<Item>;
|
||||||
using Unassigned_type = std::vector<Item>;
|
|
||||||
|
|
||||||
/// Result type
|
/// Primitive and region type
|
||||||
using Result_type = std::vector<std::pair<typename Region_type::Primitive, std::vector<Item> > >;
|
using Primitive_and_region = std::pair<typename Region_type::Primitive, Region>;
|
||||||
|
|
||||||
/// Item to region property map.
|
/// Item to region property map.
|
||||||
using Region_map = typename Region_type::Region_index_map;
|
using Region_map = typename Region_type::Region_index_map;
|
||||||
|
|
@ -174,19 +173,18 @@ namespace Shape_detection {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief runs the region growing algorithm and fills an output iterator
|
\brief runs the region growing algorithm and fills an output iterator
|
||||||
with the found regions.
|
with the fitted primitive and their region.
|
||||||
|
|
||||||
\tparam OutputIterator
|
\tparam PrimitiveAndRegionOutputIterator
|
||||||
a model of output iterator whose value type is `std::vector<std::size_t>`
|
a model of `OutputIterator` whose value type is `Primitive_and_region`
|
||||||
|
|
||||||
\param regions
|
\param regions
|
||||||
an output iterator to get for all items corresponding to each region its corresponding region.
|
an iterator of type `PrimitiveAndRegionOutputIterator`.
|
||||||
Elements put are of type `std::pair<Region_type::Primitive, std::vector<Item> >`.
|
|
||||||
|
|
||||||
\return past-the-end position in the output sequence
|
\return past-the-end position in the output sequence
|
||||||
*/
|
*/
|
||||||
template<typename OutputIterator>
|
template<typename PrimitiveAndRegionOutputIterator>
|
||||||
OutputIterator detect(OutputIterator regions) {
|
PrimitiveAndRegionOutputIterator detect(PrimitiveAndRegionOutputIterator regions) {
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
Region region;
|
Region region;
|
||||||
|
|
@ -232,17 +230,16 @@ namespace Shape_detection {
|
||||||
/*!
|
/*!
|
||||||
\brief fills an output iterator with all unassigned items.
|
\brief fills an output iterator with all unassigned items.
|
||||||
|
|
||||||
\tparam OutputIterator
|
\tparam ItemOutputIterator
|
||||||
a model of output iterator whose value type is `std::size_t`
|
a model of `OutputIterator` whose value type is `Item`
|
||||||
|
|
||||||
\param output
|
\param output
|
||||||
an output iterator that stores indices of all items, which are not assigned
|
an iterator of type `PrimitiveAndRegionOutputIterator`.
|
||||||
to any region
|
|
||||||
|
|
||||||
\return past-the-end position in the output sequence
|
\return past-the-end position in the output sequence
|
||||||
*/
|
*/
|
||||||
template<typename OutputIterator>
|
template<typename ItemOutputIterator>
|
||||||
OutputIterator unassigned_items(OutputIterator output) const {
|
ItemOutputIterator unassigned_items(ItemOutputIterator output) const {
|
||||||
for (auto it = m_input_range.begin(); it != m_input_range.end(); it++) {
|
for (auto it = m_input_range.begin(); it != m_input_range.end(); it++) {
|
||||||
Item i = internal::conditional_deref<typename Input_range::const_iterator, Item>()(it);
|
Item i = internal::conditional_deref<typename Input_range::const_iterator, Item>()(it);
|
||||||
if (!get(m_visited, i))
|
if (!get(m_visited, i))
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,6 @@ namespace Segment_set {
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
/// \cond SKIP_IN_MANUAL
|
/// \cond SKIP_IN_MANUAL
|
||||||
using Traits = GeomTraits;
|
|
||||||
using Input_range = InputRange;
|
using Input_range = InputRange;
|
||||||
using Segment_map = SegmentMap;
|
using Segment_map = SegmentMap;
|
||||||
using Segment_type = typename Segment_map::value_type;
|
using Segment_type = typename Segment_map::value_type;
|
||||||
|
|
@ -82,9 +81,12 @@ namespace Segment_set {
|
||||||
using Item = typename InputRange::const_iterator;
|
using Item = typename InputRange::const_iterator;
|
||||||
using Region = std::vector<Item>;
|
using Region = std::vector<Item>;
|
||||||
|
|
||||||
/// Primitive
|
/// Primitive type depends on the dimension of the input data.
|
||||||
|
#ifdef DOXYGEN_RUNNING
|
||||||
|
using Primitive = typename GeomTraits::Line_2 or typename GeomTraits::Line_3
|
||||||
|
#else
|
||||||
using Primitive = typename Segment_set_traits::Line;
|
using Primitive = typename Segment_set_traits::Line;
|
||||||
using Result_type = std::vector<std::pair<Primitive, Region> >;
|
#endif
|
||||||
|
|
||||||
/// Region map
|
/// Region map
|
||||||
using Region_unordered_map = boost::unordered_map<Item, std::size_t, internal::hash_item<Item> >;
|
using Region_unordered_map = boost::unordered_map<Item, std::size_t, internal::hash_item<Item> >;
|
||||||
|
|
@ -340,7 +342,7 @@ namespace Segment_set {
|
||||||
private:
|
private:
|
||||||
const Input_range& m_input_range;
|
const Input_range& m_input_range;
|
||||||
const Segment_map m_segment_map;
|
const Segment_map m_segment_map;
|
||||||
const Traits m_traits;
|
const GeomTraits m_traits;
|
||||||
const Segment_set_traits m_segment_set_traits;
|
const Segment_set_traits m_segment_set_traits;
|
||||||
Region_unordered_map m_region_map;
|
Region_unordered_map m_region_map;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,6 @@ namespace Segment_set {
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
/// \cond SKIP_IN_MANUAL
|
/// \cond SKIP_IN_MANUAL
|
||||||
using Traits = GeomTraits;
|
|
||||||
using Input_range = InputRange;
|
using Input_range = InputRange;
|
||||||
using Neighbor_query = NeighborQuery;
|
using Neighbor_query = NeighborQuery;
|
||||||
using Segment_map = SegmentMap;
|
using Segment_map = SegmentMap;
|
||||||
|
|
@ -72,11 +71,11 @@ namespace Segment_set {
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
using FT = typename Traits::FT;
|
using FT = typename GeomTraits::FT;
|
||||||
using Segment_set_traits = typename std::conditional<
|
using Segment_set_traits = typename std::conditional<
|
||||||
std::is_same<typename Traits::Segment_2, Segment_type>::value,
|
std::is_same<typename GeomTraits::Segment_2, Segment_type>::value,
|
||||||
internal::Region_growing_traits_2<Traits>,
|
internal::Region_growing_traits_2<GeomTraits>,
|
||||||
internal::Region_growing_traits_3<Traits> >::type;
|
internal::Region_growing_traits_3<GeomTraits> >::type;
|
||||||
using Compare_scores = internal::Compare_scores<FT>;
|
using Compare_scores = internal::Compare_scores<FT>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
@ -180,7 +179,7 @@ namespace Segment_set {
|
||||||
const Input_range& m_input_range;
|
const Input_range& m_input_range;
|
||||||
Neighbor_query& m_neighbor_query;
|
Neighbor_query& m_neighbor_query;
|
||||||
const Segment_map m_segment_map;
|
const Segment_map m_segment_map;
|
||||||
const Traits m_traits;
|
const GeomTraits m_traits;
|
||||||
const Segment_set_traits m_segment_set_traits;
|
const Segment_set_traits m_segment_set_traits;
|
||||||
Seed_range m_ordered;
|
Seed_range m_ordered;
|
||||||
std::vector<FT> m_scores;
|
std::vector<FT> m_scores;
|
||||||
|
|
|
||||||
|
|
@ -52,11 +52,11 @@ int main(int argc, char *argv[]) {
|
||||||
Region_growing region_growing(
|
Region_growing region_growing(
|
||||||
input_range, neighbor_query, region_type);
|
input_range, neighbor_query, region_type);
|
||||||
|
|
||||||
Region_growing::Unassigned_type unassigned_points;
|
std::vector<typename Region_growing::Item> unassigned_points;
|
||||||
region_growing.unassigned_items(std::back_inserter(unassigned_points));
|
region_growing.unassigned_items(std::back_inserter(unassigned_points));
|
||||||
assert(unassigned_points.size() == 3634);
|
assert(unassigned_points.size() == 3634);
|
||||||
|
|
||||||
Region_growing::Result_type regions;
|
std::vector<typename Region_growing::Primitive_and_region> regions;
|
||||||
region_growing.detect(std::back_inserter(regions));
|
region_growing.detect(std::back_inserter(regions));
|
||||||
const std::size_t num_regions = regions.size();
|
const std::size_t num_regions = regions.size();
|
||||||
assert(num_regions != 0);
|
assert(num_regions != 0);
|
||||||
|
|
|
||||||
|
|
@ -81,13 +81,13 @@ bool test_region_growing_on_cube(int argc, char *argv[]) {
|
||||||
Region_growing region_growing(
|
Region_growing region_growing(
|
||||||
face_range, neighbor_query, region_type, sorting.ordered());
|
face_range, neighbor_query, region_type, sorting.ordered());
|
||||||
|
|
||||||
typename Region_growing::Result_type regions;
|
std::vector<typename Region_growing::Primitive_and_region> regions;
|
||||||
region_growing.detect(std::back_inserter(regions));
|
region_growing.detect(std::back_inserter(regions));
|
||||||
assert(regions.size() == face_range.size());
|
assert(regions.size() == face_range.size());
|
||||||
for (const auto& region : regions)
|
for (const auto& region : regions)
|
||||||
assert(region_type.is_valid_region(region.second));
|
assert(region_type.is_valid_region(region.second));
|
||||||
|
|
||||||
typename Region_growing::Unassigned_type unassigned_faces;
|
std::vector<typename Region_growing::Item> unassigned_faces;
|
||||||
region_growing.unassigned_items(std::back_inserter(unassigned_faces));
|
region_growing.unassigned_items(std::back_inserter(unassigned_faces));
|
||||||
assert(unassigned_faces.size() == 0);
|
assert(unassigned_faces.size() == 0);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -67,13 +67,13 @@ bool test_region_growing_on_degenerated_mesh(int argc, char *argv[]) {
|
||||||
Region_growing region_growing(
|
Region_growing region_growing(
|
||||||
face_range, neighbor_query, region_type);
|
face_range, neighbor_query, region_type);
|
||||||
|
|
||||||
typename Region_growing::Result_type regions;
|
std::vector<typename Region_growing::Primitive_and_region> regions;
|
||||||
region_growing.detect(std::back_inserter(regions));
|
region_growing.detect(std::back_inserter(regions));
|
||||||
assert(regions.size() == 296);
|
assert(regions.size() == 296);
|
||||||
for (const auto& region : regions)
|
for (const auto& region : regions)
|
||||||
assert(region_type.is_valid_region(region.second));
|
assert(region_type.is_valid_region(region.second));
|
||||||
|
|
||||||
typename Region_growing::Unassigned_type unassigned_faces;
|
std::vector<typename Region_growing::Item> unassigned_faces;
|
||||||
region_growing.unassigned_items(std::back_inserter(unassigned_faces));
|
region_growing.unassigned_items(std::back_inserter(unassigned_faces));
|
||||||
assert(unassigned_faces.size() == 509);
|
assert(unassigned_faces.size() == 509);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -72,13 +72,13 @@ bool test_region_growing_on_point_set_2(int argc, char *argv[]) {
|
||||||
Region_growing region_growing(
|
Region_growing region_growing(
|
||||||
input_range, neighbor_query, region_type);
|
input_range, neighbor_query, region_type);
|
||||||
|
|
||||||
typename Region_growing::Result_type regions;
|
std::vector<typename Region_growing::Primitive_and_region> regions;
|
||||||
region_growing.detect(std::back_inserter(regions));
|
region_growing.detect(std::back_inserter(regions));
|
||||||
assert(regions.size() == 72);
|
assert(regions.size() == 72);
|
||||||
for (const auto& region : regions)
|
for (const auto& region : regions)
|
||||||
assert(region_type.is_valid_region(region.second));
|
assert(region_type.is_valid_region(region.second));
|
||||||
|
|
||||||
typename Region_growing::Unassigned_type unassigned_points;
|
std::vector<typename Region_growing::Item> unassigned_points;
|
||||||
region_growing.unassigned_items(std::back_inserter(unassigned_points));
|
region_growing.unassigned_items(std::back_inserter(unassigned_points));
|
||||||
assert(unassigned_points.size() == 86);
|
assert(unassigned_points.size() == 86);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ bool test(int argc, char** argv, const std::string name, const std::size_t minr,
|
||||||
Region_growing region_growing(
|
Region_growing region_growing(
|
||||||
input_range, neighbor_query, region_type, sorting.ordered());
|
input_range, neighbor_query, region_type, sorting.ordered());
|
||||||
|
|
||||||
typename Region_growing::Result_type regions;
|
std::vector<typename Region_growing::Primitive_and_region> regions;
|
||||||
region_growing.detect(std::back_inserter(regions));
|
region_growing.detect(std::back_inserter(regions));
|
||||||
|
|
||||||
std::cout << "- num regions " + name + ": " << regions.size() << std::endl;
|
std::cout << "- num regions " + name + ": " << regions.size() << std::endl;
|
||||||
|
|
@ -97,7 +97,7 @@ bool test(int argc, char** argv, const std::string name, const std::size_t minr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
typename Region_growing::Unassigned_type unassigned;
|
std::vector<typename Region_growing::Item> unassigned;
|
||||||
region_growing.unassigned_items(std::back_inserter(unassigned));
|
region_growing.unassigned_items(std::back_inserter(unassigned));
|
||||||
|
|
||||||
for (auto& item : unassigned) {
|
for (auto& item : unassigned) {
|
||||||
|
|
|
||||||
|
|
@ -69,13 +69,13 @@ bool test_region_growing_on_point_set_3(int argc, char *argv[]) {
|
||||||
Region_growing region_growing(
|
Region_growing region_growing(
|
||||||
input_range, neighbor_query, region_type);
|
input_range, neighbor_query, region_type);
|
||||||
|
|
||||||
typename Region_growing::Result_type regions;
|
std::vector<typename Region_growing::Primitive_and_region> regions;
|
||||||
region_growing.detect(std::back_inserter(regions));
|
region_growing.detect(std::back_inserter(regions));
|
||||||
assert(regions.size() == 10);
|
assert(regions.size() == 10);
|
||||||
for (const auto& region : regions)
|
for (const auto& region : regions)
|
||||||
assert(region_type.is_valid_region(region.second));
|
assert(region_type.is_valid_region(region.second));
|
||||||
|
|
||||||
typename Region_growing::Unassigned_type unassigned_points;
|
std::vector<typename Region_growing::Item> unassigned_points;
|
||||||
region_growing.unassigned_items(std::back_inserter(unassigned_points));
|
region_growing.unassigned_items(std::back_inserter(unassigned_points));
|
||||||
assert(unassigned_points.size() == 246);
|
assert(unassigned_points.size() == 246);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ bool test(
|
||||||
Region_growing region_growing(
|
Region_growing region_growing(
|
||||||
input_range, neighbor_query, region_type, sorting.ordered());
|
input_range, neighbor_query, region_type, sorting.ordered());
|
||||||
|
|
||||||
typename Region_growing::Result_type regions;
|
std::vector<typename Region_growing::Primitive_and_region> regions;
|
||||||
region_growing.detect(std::back_inserter(regions));
|
region_growing.detect(std::back_inserter(regions));
|
||||||
bool result = lambda_assertion(regions);
|
bool result = lambda_assertion(regions);
|
||||||
assert(result);
|
assert(result);
|
||||||
|
|
@ -91,7 +91,7 @@ bool test(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
typename Region_growing::Unassigned_type unassigned;
|
std::vector<typename Region_growing::Item> unassigned;
|
||||||
region_growing.unassigned_items(std::back_inserter(unassigned));
|
region_growing.unassigned_items(std::back_inserter(unassigned));
|
||||||
|
|
||||||
for (auto& item : unassigned) {
|
for (auto& item : unassigned) {
|
||||||
|
|
|
||||||
|
|
@ -66,13 +66,13 @@ bool test_region_growing_on_polygon_mesh(int argc, char *argv[]) {
|
||||||
Region_growing region_growing(
|
Region_growing region_growing(
|
||||||
face_range, neighbor_query, region_type);
|
face_range, neighbor_query, region_type);
|
||||||
|
|
||||||
typename Region_growing::Result_type regions;
|
std::vector<typename Region_growing::Primitive_and_region> regions;
|
||||||
region_growing.detect(std::back_inserter(regions));
|
region_growing.detect(std::back_inserter(regions));
|
||||||
assert(regions.size() == 414);
|
assert(regions.size() == 414);
|
||||||
for (const auto& region : regions)
|
for (const auto& region : regions)
|
||||||
assert(region_type.is_valid_region(region.second));
|
assert(region_type.is_valid_region(region.second));
|
||||||
|
|
||||||
typename Region_growing::Unassigned_type unassigned_faces;
|
std::vector<typename Region_growing::Item> unassigned_faces;
|
||||||
region_growing.unassigned_items(std::back_inserter(unassigned_faces));
|
region_growing.unassigned_items(std::back_inserter(unassigned_faces));
|
||||||
assert(unassigned_faces.size() == 992);
|
assert(unassigned_faces.size() == 992);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ int main(int argc, char *argv[]) {
|
||||||
Region_growing region_growing(
|
Region_growing region_growing(
|
||||||
face_range, neighbor_query, region_type, sorting.ordered());
|
face_range, neighbor_query, region_type, sorting.ordered());
|
||||||
|
|
||||||
Region_growing::Result_type regions;
|
std::vector<Region_growing::Primitive_and_region> regions;
|
||||||
region_growing.detect(std::back_inserter(regions));
|
region_growing.detect(std::back_inserter(regions));
|
||||||
region_growing.clear();
|
region_growing.clear();
|
||||||
assert(regions.size() == 355);
|
assert(regions.size() == 355);
|
||||||
|
|
|
||||||
|
|
@ -74,13 +74,13 @@ bool test_region_growing_on_polyline(int argc, char *argv[]) {
|
||||||
Region_growing_3 region_growing_3(
|
Region_growing_3 region_growing_3(
|
||||||
polyline_3, neighbor_query_3, region_type_3);
|
polyline_3, neighbor_query_3, region_type_3);
|
||||||
|
|
||||||
typename Region_growing_3::Result_type regions_3;
|
std::vector<typename Region_growing_3::Primitive_and_region> regions_3;
|
||||||
region_growing_3.detect(std::back_inserter(regions_3));
|
region_growing_3.detect(std::back_inserter(regions_3));
|
||||||
assert(regions_3.size() == 17);
|
assert(regions_3.size() == 17);
|
||||||
for (const auto& region : regions_3)
|
for (const auto& region : regions_3)
|
||||||
assert(region_type_3.is_valid_region(region.second));
|
assert(region_type_3.is_valid_region(region.second));
|
||||||
|
|
||||||
typename Region_growing_3::Unassigned_type unassigned_points;
|
std::vector<typename Region_growing_3::Item> unassigned_points;
|
||||||
region_growing_3.unassigned_items(std::back_inserter(unassigned_points));
|
region_growing_3.unassigned_items(std::back_inserter(unassigned_points));
|
||||||
assert(unassigned_points.size() == 0);
|
assert(unassigned_points.size() == 0);
|
||||||
|
|
||||||
|
|
@ -111,12 +111,12 @@ bool test_region_growing_on_polyline(int argc, char *argv[]) {
|
||||||
Region_growing_2 region_growing_2(
|
Region_growing_2 region_growing_2(
|
||||||
polyline_2, neighbor_query_2, region_type_2);
|
polyline_2, neighbor_query_2, region_type_2);
|
||||||
|
|
||||||
typename Region_growing_2::Result_type regions_2;
|
std::vector<typename Region_growing_2::Primitive_and_region> regions_2;
|
||||||
region_growing_2.detect(std::back_inserter(regions_2));
|
region_growing_2.detect(std::back_inserter(regions_2));
|
||||||
assert(regions_2.size() == 5);
|
assert(regions_2.size() == 5);
|
||||||
for (const auto& region : regions_2)
|
for (const auto& region : regions_2)
|
||||||
assert(region_type_2.is_valid_region(region.second));
|
assert(region_type_2.is_valid_region(region.second));
|
||||||
typename Region_growing_2::Unassigned_type unassigned_points2;
|
std::vector<typename Region_growing_2::Item> unassigned_points2;
|
||||||
region_growing_2.unassigned_items(std::back_inserter(unassigned_points2));
|
region_growing_2.unassigned_items(std::back_inserter(unassigned_points2));
|
||||||
assert(unassigned_points2.size() == 0);
|
assert(unassigned_points2.size() == 0);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,11 +79,11 @@ int main(int argc, char *argv[]) {
|
||||||
Region_growing_3 region_growing_3(
|
Region_growing_3 region_growing_3(
|
||||||
polyline_3, neighbor_query_3, region_type_3, sorting_3.ordered());
|
polyline_3, neighbor_query_3, region_type_3, sorting_3.ordered());
|
||||||
|
|
||||||
Region_growing_3::Result_type regions3;
|
std::vector<Region_growing_3::Primitive_and_region> regions3;
|
||||||
region_growing_3.detect(std::back_inserter(regions3));
|
region_growing_3.detect(std::back_inserter(regions3));
|
||||||
assert(regions3.size() == 16);
|
assert(regions3.size() == 16);
|
||||||
|
|
||||||
Region_growing_3::Unassigned_type unassigned_points;
|
std::vector<Region_growing_3::Item> unassigned_points;
|
||||||
region_growing_3.unassigned_items(std::back_inserter(unassigned_points));
|
region_growing_3.unassigned_items(std::back_inserter(unassigned_points));
|
||||||
assert(unassigned_points.size() == 1);
|
assert(unassigned_points.size() == 1);
|
||||||
|
|
||||||
|
|
@ -129,7 +129,7 @@ int main(int argc, char *argv[]) {
|
||||||
Region_growing_2 region_growing_2(
|
Region_growing_2 region_growing_2(
|
||||||
polyline_2, neighbor_query_2, region_type_2, sorting_2.ordered());
|
polyline_2, neighbor_query_2, region_type_2, sorting_2.ordered());
|
||||||
|
|
||||||
typename Region_growing_2::Result_type regions2;
|
std::vector<typename Region_growing_2::Primitive_and_region> regions2;
|
||||||
region_growing_2.detect(std::back_inserter(regions2));
|
region_growing_2.detect(std::back_inserter(regions2));
|
||||||
assert(regions2.size() == 5);
|
assert(regions2.size() == 5);
|
||||||
for (const auto& region : regions2)
|
for (const auto& region : regions2)
|
||||||
|
|
@ -145,7 +145,7 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Region_growing_2::Unassigned_type unassigned;
|
std::vector<Region_growing_2::Item> unassigned;
|
||||||
region_growing_2.unassigned_items(std::back_inserter(unassigned));
|
region_growing_2.unassigned_items(std::back_inserter(unassigned));
|
||||||
|
|
||||||
for (auto& item : unassigned) {
|
for (auto& item : unassigned) {
|
||||||
|
|
@ -155,7 +155,7 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Region_growing_2::Unassigned_type unassigned2;
|
std::vector<Region_growing_2::Item> unassigned2;
|
||||||
region_growing_2.unassigned_items(std::back_inserter(unassigned2));
|
region_growing_2.unassigned_items(std::back_inserter(unassigned2));
|
||||||
assert(unassigned2.size() == 0);
|
assert(unassigned2.size() == 0);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -235,7 +235,7 @@ bool test_lines_segment_set_2_sorting() {
|
||||||
|
|
||||||
Region_type region_type(segments);
|
Region_type region_type(segments);
|
||||||
|
|
||||||
typename Region_type::Result_type regions;
|
std::vector<typename Region_growing::Primitive_and_region> regions;
|
||||||
Region_growing region_growing(
|
Region_growing region_growing(
|
||||||
segments, neighbor_query, region_type, sorting.ordered());
|
segments, neighbor_query, region_type, sorting.ordered());
|
||||||
region_growing.detect(std::back_inserter(regions));
|
region_growing.detect(std::back_inserter(regions));
|
||||||
|
|
@ -299,7 +299,7 @@ bool test_lines_segment_set_3() {
|
||||||
face_range, one_ring_query, plane_type, plane_sorting.ordered());
|
face_range, one_ring_query, plane_type, plane_sorting.ordered());
|
||||||
|
|
||||||
assert(surface_mesh.number_of_faces() == 7320);
|
assert(surface_mesh.number_of_faces() == 7320);
|
||||||
typename RG_planes::Result_type regions;
|
std::vector<typename RG_planes::Primitive_and_region> regions;
|
||||||
rg_planes.detect(std::back_inserter(regions));
|
rg_planes.detect(std::back_inserter(regions));
|
||||||
assert(regions.size() == 9);
|
assert(regions.size() == 9);
|
||||||
|
|
||||||
|
|
@ -314,7 +314,7 @@ bool test_lines_segment_set_3() {
|
||||||
segment_range, pgraph, CGAL::parameters::segment_map(pgraph.segment_map()));
|
segment_range, pgraph, CGAL::parameters::segment_map(pgraph.segment_map()));
|
||||||
sorting.sort();
|
sorting.sort();
|
||||||
|
|
||||||
typename RG_lines::Result_type regions2;
|
std::vector<typename RG_lines::Primitive_and_region> regions2;
|
||||||
RG_lines region_growing(
|
RG_lines region_growing(
|
||||||
segment_range, pgraph, region_type, sorting.ordered());
|
segment_range, pgraph, region_type, sorting.ordered());
|
||||||
region_growing.detect(std::back_inserter(regions2));
|
region_growing.detect(std::back_inserter(regions2));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue