mirror of https://github.com/CGAL/cgal
better incapsulation, naming, and added access to internal property maps
This commit is contained in:
parent
05a8105ff8
commit
4a9b7c7c9a
|
|
@ -66,14 +66,14 @@ namespace Point_set {
|
||||||
class K_neighbor_query {
|
class K_neighbor_query {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// \cond SKIP_IN_MANUAL
|
/// \cond SKIP_IN_MANUAL
|
||||||
using Traits = GeomTraits;
|
using Traits = GeomTraits;
|
||||||
using Input_range = InputRange;
|
using Input_range = InputRange;
|
||||||
using Point_map = PointMap;
|
using Point_map = PointMap;
|
||||||
|
|
||||||
using Point = typename Point_map::value_type;
|
using Point = typename Point_map::value_type;
|
||||||
|
/// \endcond
|
||||||
|
|
||||||
|
private:
|
||||||
using Index_to_point_map =
|
using Index_to_point_map =
|
||||||
internal::Item_property_map<Input_range, Point_map>;
|
internal::Item_property_map<Input_range, Point_map>;
|
||||||
|
|
||||||
|
|
@ -106,8 +106,8 @@ namespace Point_set {
|
||||||
|
|
||||||
using Tree =
|
using Tree =
|
||||||
typename Neighbor_search::Tree;
|
typename Neighbor_search::Tree;
|
||||||
/// \endcond
|
|
||||||
|
|
||||||
|
public:
|
||||||
/// \name Initialization
|
/// \name Initialization
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
|
|
@ -188,16 +188,19 @@ namespace Point_set {
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
|
/// \cond SKIP_IN_MANUAL
|
||||||
|
// A property map that can be used to access points when
|
||||||
|
// iterating over the indices counting items in the input range.
|
||||||
|
const Index_to_point_map& index_to_point_map() const {
|
||||||
|
return m_index_to_point_map;
|
||||||
|
}
|
||||||
|
/// \endcond
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// Fields.
|
|
||||||
const Input_range& m_input_range;
|
const Input_range& m_input_range;
|
||||||
|
|
||||||
const std::size_t m_number_of_neighbors;
|
const std::size_t m_number_of_neighbors;
|
||||||
|
|
||||||
const Point_map m_point_map;
|
const Point_map m_point_map;
|
||||||
const Index_to_point_map m_index_to_point_map;
|
const Index_to_point_map m_index_to_point_map;
|
||||||
|
|
||||||
Distance m_distance;
|
Distance m_distance;
|
||||||
Tree m_tree;
|
Tree m_tree;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,6 @@ namespace Point_set {
|
||||||
class Least_squares_line_fit_region {
|
class Least_squares_line_fit_region {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// \name Types
|
/// \name Types
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
|
|
@ -83,16 +82,18 @@ namespace Point_set {
|
||||||
/// Number type.
|
/// Number type.
|
||||||
typedef typename GeomTraits::FT FT;
|
typedef typename GeomTraits::FT FT;
|
||||||
|
|
||||||
/// \cond SKIP_IN_MANUAL
|
/// @}
|
||||||
|
|
||||||
|
private:
|
||||||
using Point_2 = typename Traits::Point_2;
|
using Point_2 = typename Traits::Point_2;
|
||||||
using Vector_2 = typename Traits::Vector_2;
|
using Vector_2 = typename Traits::Vector_2;
|
||||||
using Line_2 = typename Traits::Line_2;
|
using Line_2 = typename Traits::Line_2;
|
||||||
|
|
||||||
using Local_traits = Exact_predicates_inexact_constructions_kernel;
|
using ITraits = Exact_predicates_inexact_constructions_kernel;
|
||||||
using Local_FT = typename Local_traits::FT;
|
using IFT = typename ITraits::FT;
|
||||||
using Local_point_2 = typename Local_traits::Point_2;
|
using IPoint_2 = typename ITraits::Point_2;
|
||||||
using Local_line_2 = typename Local_traits::Line_2;
|
using ILine_2 = typename ITraits::Line_2;
|
||||||
using To_local_converter = Cartesian_converter<Traits, Local_traits>;
|
using IConverter = Cartesian_converter<Traits, ITraits>;
|
||||||
|
|
||||||
using Squared_length_2 = typename Traits::Compute_squared_length_2;
|
using Squared_length_2 = typename Traits::Compute_squared_length_2;
|
||||||
using Squared_distance_2 = typename Traits::Compute_squared_distance_2;
|
using Squared_distance_2 = typename Traits::Compute_squared_distance_2;
|
||||||
|
|
@ -100,10 +101,8 @@ namespace Point_set {
|
||||||
|
|
||||||
using Get_sqrt = internal::Get_sqrt<Traits>;
|
using Get_sqrt = internal::Get_sqrt<Traits>;
|
||||||
using Sqrt = typename Get_sqrt::Sqrt;
|
using Sqrt = typename Get_sqrt::Sqrt;
|
||||||
/// \endcond
|
|
||||||
|
|
||||||
/// @}
|
|
||||||
|
|
||||||
|
public:
|
||||||
/// \name Initialization
|
/// \name Initialization
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
|
|
@ -161,7 +160,7 @@ namespace Point_set {
|
||||||
m_squared_distance_2(traits.compute_squared_distance_2_object()),
|
m_squared_distance_2(traits.compute_squared_distance_2_object()),
|
||||||
m_scalar_product_2(traits.compute_scalar_product_2_object()),
|
m_scalar_product_2(traits.compute_scalar_product_2_object()),
|
||||||
m_sqrt(Get_sqrt::sqrt_object(traits)),
|
m_sqrt(Get_sqrt::sqrt_object(traits)),
|
||||||
m_to_local_converter() {
|
m_iconverter() {
|
||||||
|
|
||||||
CGAL_precondition(input_range.size() > 0);
|
CGAL_precondition(input_range.size() > 0);
|
||||||
|
|
||||||
|
|
@ -264,19 +263,19 @@ namespace Point_set {
|
||||||
|
|
||||||
} else { // update reference line and normal
|
} else { // update reference line and normal
|
||||||
|
|
||||||
std::vector<Local_point_2> points;
|
std::vector<IPoint_2> points;
|
||||||
points.reserve(region.size());
|
points.reserve(region.size());
|
||||||
|
|
||||||
for (std::size_t i = 0; i < region.size(); ++i) {
|
for (std::size_t i = 0; i < region.size(); ++i) {
|
||||||
CGAL_precondition(region[i] < m_input_range.size());
|
CGAL_precondition(region[i] < m_input_range.size());
|
||||||
|
|
||||||
const auto& key = *(m_input_range.begin() + region[i]);
|
const auto& key = *(m_input_range.begin() + region[i]);
|
||||||
points.push_back(m_to_local_converter(get(m_point_map, key)));
|
points.push_back(m_iconverter(get(m_point_map, key)));
|
||||||
}
|
}
|
||||||
CGAL_postcondition(points.size() == region.size());
|
CGAL_postcondition(points.size() == region.size());
|
||||||
|
|
||||||
Local_line_2 fitted_line;
|
ILine_2 fitted_line;
|
||||||
Local_point_2 fitted_centroid;
|
IPoint_2 fitted_centroid;
|
||||||
|
|
||||||
// The best fit line will be a line fitted to all region points with
|
// The best fit line will be a line fitted to all region points with
|
||||||
// its normal being perpendicular to the line.
|
// its normal being perpendicular to the line.
|
||||||
|
|
@ -284,8 +283,8 @@ namespace Point_set {
|
||||||
points.begin(), points.end(),
|
points.begin(), points.end(),
|
||||||
fitted_line, fitted_centroid,
|
fitted_line, fitted_centroid,
|
||||||
CGAL::Dimension_tag<0>(),
|
CGAL::Dimension_tag<0>(),
|
||||||
Local_traits(),
|
ITraits(),
|
||||||
CGAL::Eigen_diagonalize_traits<Local_FT, 2>());
|
CGAL::Eigen_diagonalize_traits<IFT, 2>());
|
||||||
|
|
||||||
m_line_of_best_fit =
|
m_line_of_best_fit =
|
||||||
Line_2(
|
Line_2(
|
||||||
|
|
@ -305,8 +304,6 @@ namespace Point_set {
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// Fields.
|
|
||||||
const Input_range& m_input_range;
|
const Input_range& m_input_range;
|
||||||
|
|
||||||
const FT m_distance_threshold;
|
const FT m_distance_threshold;
|
||||||
|
|
@ -321,7 +318,7 @@ namespace Point_set {
|
||||||
const Scalar_product_2 m_scalar_product_2;
|
const Scalar_product_2 m_scalar_product_2;
|
||||||
const Sqrt m_sqrt;
|
const Sqrt m_sqrt;
|
||||||
|
|
||||||
const To_local_converter m_to_local_converter;
|
const IConverter m_iconverter;
|
||||||
|
|
||||||
Line_2 m_line_of_best_fit;
|
Line_2 m_line_of_best_fit;
|
||||||
Vector_2 m_normal_of_best_fit;
|
Vector_2 m_normal_of_best_fit;
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,6 @@ namespace Point_set {
|
||||||
class Least_squares_line_fit_sorting {
|
class Least_squares_line_fit_sorting {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// \name Types
|
/// \name Types
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
|
|
@ -86,6 +85,15 @@ namespace Point_set {
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
|
private:
|
||||||
|
using ITraits = Exact_predicates_inexact_constructions_kernel;
|
||||||
|
using IFT = typename ITraits::FT;
|
||||||
|
using IPoint_2 = typename ITraits::Point_2;
|
||||||
|
using ILine_2 = typename ITraits::Line_2;
|
||||||
|
using IConverter = Cartesian_converter<Traits, ITraits>;
|
||||||
|
using Compare_scores = internal::Compare_scores<IFT>;
|
||||||
|
|
||||||
|
public:
|
||||||
/// \name Initialization
|
/// \name Initialization
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
|
|
@ -112,7 +120,7 @@ namespace Point_set {
|
||||||
m_input_range(input_range),
|
m_input_range(input_range),
|
||||||
m_neighbor_query(neighbor_query),
|
m_neighbor_query(neighbor_query),
|
||||||
m_point_map(point_map),
|
m_point_map(point_map),
|
||||||
m_to_local_converter() {
|
m_iconverter() {
|
||||||
|
|
||||||
CGAL_precondition(input_range.size() > 0);
|
CGAL_precondition(input_range.size() > 0);
|
||||||
|
|
||||||
|
|
@ -155,20 +163,17 @@ namespace Point_set {
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
const Input_range& m_input_range;
|
||||||
|
Neighbor_query& m_neighbor_query;
|
||||||
|
const Point_map m_point_map;
|
||||||
|
std::vector<std::size_t> m_order;
|
||||||
|
std::vector<IFT> m_scores;
|
||||||
|
const IConverter m_iconverter;
|
||||||
|
|
||||||
// Types.
|
|
||||||
using Local_traits = Exact_predicates_inexact_constructions_kernel;
|
|
||||||
using Local_FT = typename Local_traits::FT;
|
|
||||||
using Local_point_2 = typename Local_traits::Point_2;
|
|
||||||
using Local_line_2 = typename Local_traits::Line_2;
|
|
||||||
using To_local_converter = Cartesian_converter<Traits, Local_traits>;
|
|
||||||
using Compare_scores = internal::Compare_scores<Local_FT>;
|
|
||||||
|
|
||||||
// Functions.
|
|
||||||
void compute_scores() {
|
void compute_scores() {
|
||||||
|
|
||||||
std::vector<std::size_t> neighbors;
|
std::vector<std::size_t> neighbors;
|
||||||
std::vector<Local_point_2> points;
|
std::vector<IPoint_2> points;
|
||||||
|
|
||||||
for (std::size_t i = 0; i < m_input_range.size(); ++i) {
|
for (std::size_t i = 0; i < m_input_range.size(); ++i) {
|
||||||
|
|
||||||
|
|
@ -181,31 +186,21 @@ namespace Point_set {
|
||||||
CGAL_precondition(neighbors[j] < m_input_range.size());
|
CGAL_precondition(neighbors[j] < m_input_range.size());
|
||||||
|
|
||||||
const auto& key = *(m_input_range.begin() + neighbors[j]);
|
const auto& key = *(m_input_range.begin() + neighbors[j]);
|
||||||
points.push_back(m_to_local_converter(get(m_point_map, key)));
|
points.push_back(m_iconverter(get(m_point_map, key)));
|
||||||
}
|
}
|
||||||
CGAL_postcondition(points.size() == neighbors.size());
|
CGAL_postcondition(points.size() == neighbors.size());
|
||||||
|
|
||||||
Local_line_2 fitted_line;
|
ILine_2 fitted_line;
|
||||||
Local_point_2 fitted_centroid;
|
IPoint_2 fitted_centroid;
|
||||||
|
|
||||||
m_scores[i] = CGAL::linear_least_squares_fitting_2(
|
m_scores[i] = CGAL::linear_least_squares_fitting_2(
|
||||||
points.begin(), points.end(),
|
points.begin(), points.end(),
|
||||||
fitted_line, fitted_centroid,
|
fitted_line, fitted_centroid,
|
||||||
CGAL::Dimension_tag<0>(),
|
CGAL::Dimension_tag<0>(),
|
||||||
Local_traits(),
|
ITraits(),
|
||||||
CGAL::Eigen_diagonalize_traits<Local_FT, 2>());
|
CGAL::Eigen_diagonalize_traits<IFT, 2>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fields.
|
|
||||||
const Input_range& m_input_range;
|
|
||||||
Neighbor_query& m_neighbor_query;
|
|
||||||
const Point_map m_point_map;
|
|
||||||
|
|
||||||
std::vector<std::size_t> m_order;
|
|
||||||
std::vector<Local_FT> m_scores;
|
|
||||||
|
|
||||||
const To_local_converter m_to_local_converter;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Point_set
|
} // namespace Point_set
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,6 @@ namespace Point_set {
|
||||||
class Least_squares_plane_fit_region {
|
class Least_squares_plane_fit_region {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// \name Types
|
/// \name Types
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
|
|
@ -83,16 +82,18 @@ namespace Point_set {
|
||||||
/// Number type.
|
/// Number type.
|
||||||
typedef typename GeomTraits::FT FT;
|
typedef typename GeomTraits::FT FT;
|
||||||
|
|
||||||
/// \cond SKIP_IN_MANUAL
|
/// @}
|
||||||
|
|
||||||
|
private:
|
||||||
using Point_3 = typename Traits::Point_3;
|
using Point_3 = typename Traits::Point_3;
|
||||||
using Vector_3 = typename Traits::Vector_3;
|
using Vector_3 = typename Traits::Vector_3;
|
||||||
using Plane_3 = typename Traits::Plane_3;
|
using Plane_3 = typename Traits::Plane_3;
|
||||||
|
|
||||||
using Local_traits = Exact_predicates_inexact_constructions_kernel;
|
using ITraits = Exact_predicates_inexact_constructions_kernel;
|
||||||
using Local_FT = typename Local_traits::FT;
|
using IFT = typename ITraits::FT;
|
||||||
using Local_point_3 = typename Local_traits::Point_3;
|
using IPoint_3 = typename ITraits::Point_3;
|
||||||
using Local_plane_3 = typename Local_traits::Plane_3;
|
using IPlane_3 = typename ITraits::Plane_3;
|
||||||
using To_local_converter = Cartesian_converter<Traits, Local_traits>;
|
using IConverter = Cartesian_converter<Traits, ITraits>;
|
||||||
|
|
||||||
using Squared_length_3 = typename Traits::Compute_squared_length_3;
|
using Squared_length_3 = typename Traits::Compute_squared_length_3;
|
||||||
using Squared_distance_3 = typename Traits::Compute_squared_distance_3;
|
using Squared_distance_3 = typename Traits::Compute_squared_distance_3;
|
||||||
|
|
@ -100,10 +101,8 @@ namespace Point_set {
|
||||||
|
|
||||||
using Get_sqrt = internal::Get_sqrt<Traits>;
|
using Get_sqrt = internal::Get_sqrt<Traits>;
|
||||||
using Sqrt = typename Get_sqrt::Sqrt;
|
using Sqrt = typename Get_sqrt::Sqrt;
|
||||||
/// \endcond
|
|
||||||
|
|
||||||
/// @}
|
|
||||||
|
|
||||||
|
public:
|
||||||
/// \name Initialization
|
/// \name Initialization
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
|
|
@ -161,7 +160,7 @@ namespace Point_set {
|
||||||
m_squared_distance_3(traits.compute_squared_distance_3_object()),
|
m_squared_distance_3(traits.compute_squared_distance_3_object()),
|
||||||
m_scalar_product_3(traits.compute_scalar_product_3_object()),
|
m_scalar_product_3(traits.compute_scalar_product_3_object()),
|
||||||
m_sqrt(Get_sqrt::sqrt_object(traits)),
|
m_sqrt(Get_sqrt::sqrt_object(traits)),
|
||||||
m_to_local_converter() {
|
m_iconverter() {
|
||||||
|
|
||||||
CGAL_precondition(input_range.size() > 0);
|
CGAL_precondition(input_range.size() > 0);
|
||||||
|
|
||||||
|
|
@ -265,19 +264,19 @@ namespace Point_set {
|
||||||
|
|
||||||
} else { // update reference plane and normal
|
} else { // update reference plane and normal
|
||||||
|
|
||||||
std::vector<Local_point_3> points;
|
std::vector<IPoint_3> points;
|
||||||
points.reserve(region.size());
|
points.reserve(region.size());
|
||||||
|
|
||||||
for (std::size_t i = 0; i < region.size(); ++i) {
|
for (std::size_t i = 0; i < region.size(); ++i) {
|
||||||
CGAL_precondition(region[i] < m_input_range.size());
|
CGAL_precondition(region[i] < m_input_range.size());
|
||||||
|
|
||||||
const auto& key = *(m_input_range.begin() + region[i]);
|
const auto& key = *(m_input_range.begin() + region[i]);
|
||||||
points.push_back(m_to_local_converter(get(m_point_map, key)));
|
points.push_back(m_iconverter(get(m_point_map, key)));
|
||||||
}
|
}
|
||||||
CGAL_postcondition(points.size() == region.size());
|
CGAL_postcondition(points.size() == region.size());
|
||||||
|
|
||||||
Local_plane_3 fitted_plane;
|
IPlane_3 fitted_plane;
|
||||||
Local_point_3 fitted_centroid;
|
IPoint_3 fitted_centroid;
|
||||||
|
|
||||||
// The best fit plane will be a plane fitted to all region points with
|
// The best fit plane will be a plane fitted to all region points with
|
||||||
// its normal being perpendicular to the plane.
|
// its normal being perpendicular to the plane.
|
||||||
|
|
@ -285,8 +284,8 @@ namespace Point_set {
|
||||||
points.begin(), points.end(),
|
points.begin(), points.end(),
|
||||||
fitted_plane, fitted_centroid,
|
fitted_plane, fitted_centroid,
|
||||||
CGAL::Dimension_tag<0>(),
|
CGAL::Dimension_tag<0>(),
|
||||||
Local_traits(),
|
ITraits(),
|
||||||
CGAL::Eigen_diagonalize_traits<Local_FT, 3>());
|
CGAL::Eigen_diagonalize_traits<IFT, 3>());
|
||||||
|
|
||||||
m_plane_of_best_fit =
|
m_plane_of_best_fit =
|
||||||
Plane_3(
|
Plane_3(
|
||||||
|
|
@ -306,8 +305,6 @@ namespace Point_set {
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// Fields.
|
|
||||||
const Input_range& m_input_range;
|
const Input_range& m_input_range;
|
||||||
|
|
||||||
const FT m_distance_threshold;
|
const FT m_distance_threshold;
|
||||||
|
|
@ -322,7 +319,7 @@ namespace Point_set {
|
||||||
const Scalar_product_3 m_scalar_product_3;
|
const Scalar_product_3 m_scalar_product_3;
|
||||||
const Sqrt m_sqrt;
|
const Sqrt m_sqrt;
|
||||||
|
|
||||||
const To_local_converter m_to_local_converter;
|
const IConverter m_iconverter;
|
||||||
|
|
||||||
Plane_3 m_plane_of_best_fit;
|
Plane_3 m_plane_of_best_fit;
|
||||||
Vector_3 m_normal_of_best_fit;
|
Vector_3 m_normal_of_best_fit;
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,6 @@ namespace Point_set {
|
||||||
class Least_squares_plane_fit_sorting {
|
class Least_squares_plane_fit_sorting {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// \name Types
|
/// \name Types
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
|
|
@ -86,6 +85,15 @@ namespace Point_set {
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
|
private:
|
||||||
|
using ITraits = Exact_predicates_inexact_constructions_kernel;
|
||||||
|
using IFT = typename ITraits::FT;
|
||||||
|
using IPoint_3 = typename ITraits::Point_3;
|
||||||
|
using IPlane_3 = typename ITraits::Plane_3;
|
||||||
|
using IConverter = Cartesian_converter<Traits, ITraits>;
|
||||||
|
using Compare_scores = internal::Compare_scores<IFT>;
|
||||||
|
|
||||||
|
public:
|
||||||
/// \name Initialization
|
/// \name Initialization
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
|
|
@ -112,7 +120,7 @@ namespace Point_set {
|
||||||
m_input_range(input_range),
|
m_input_range(input_range),
|
||||||
m_neighbor_query(neighbor_query),
|
m_neighbor_query(neighbor_query),
|
||||||
m_point_map(point_map),
|
m_point_map(point_map),
|
||||||
m_to_local_converter() {
|
m_iconverter() {
|
||||||
|
|
||||||
CGAL_precondition(input_range.size() > 0);
|
CGAL_precondition(input_range.size() > 0);
|
||||||
|
|
||||||
|
|
@ -155,20 +163,17 @@ namespace Point_set {
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
const Input_range& m_input_range;
|
||||||
|
Neighbor_query& m_neighbor_query;
|
||||||
|
const Point_map m_point_map;
|
||||||
|
std::vector<std::size_t> m_order;
|
||||||
|
std::vector<IFT> m_scores;
|
||||||
|
const IConverter m_iconverter;
|
||||||
|
|
||||||
// Types.
|
|
||||||
using Local_traits = Exact_predicates_inexact_constructions_kernel;
|
|
||||||
using Local_FT = typename Local_traits::FT;
|
|
||||||
using Local_point_3 = typename Local_traits::Point_3;
|
|
||||||
using Local_plane_3 = typename Local_traits::Plane_3;
|
|
||||||
using To_local_converter = Cartesian_converter<Traits, Local_traits>;
|
|
||||||
using Compare_scores = internal::Compare_scores<Local_FT>;
|
|
||||||
|
|
||||||
// Functions.
|
|
||||||
void compute_scores() {
|
void compute_scores() {
|
||||||
|
|
||||||
std::vector<std::size_t> neighbors;
|
std::vector<std::size_t> neighbors;
|
||||||
std::vector<Local_point_3> points;
|
std::vector<IPoint_3> points;
|
||||||
|
|
||||||
for (std::size_t i = 0; i < m_input_range.size(); ++i) {
|
for (std::size_t i = 0; i < m_input_range.size(); ++i) {
|
||||||
|
|
||||||
|
|
@ -181,31 +186,21 @@ namespace Point_set {
|
||||||
CGAL_precondition(neighbors[j] < m_input_range.size());
|
CGAL_precondition(neighbors[j] < m_input_range.size());
|
||||||
|
|
||||||
const auto& key = *(m_input_range.begin() + neighbors[j]);
|
const auto& key = *(m_input_range.begin() + neighbors[j]);
|
||||||
points.push_back(m_to_local_converter(get(m_point_map, key)));
|
points.push_back(m_iconverter(get(m_point_map, key)));
|
||||||
}
|
}
|
||||||
CGAL_postcondition(points.size() == neighbors.size());
|
CGAL_postcondition(points.size() == neighbors.size());
|
||||||
|
|
||||||
Local_plane_3 fitted_plane;
|
IPlane_3 fitted_plane;
|
||||||
Local_point_3 fitted_centroid;
|
IPoint_3 fitted_centroid;
|
||||||
|
|
||||||
m_scores[i] = CGAL::linear_least_squares_fitting_3(
|
m_scores[i] = CGAL::linear_least_squares_fitting_3(
|
||||||
points.begin(), points.end(),
|
points.begin(), points.end(),
|
||||||
fitted_plane, fitted_centroid,
|
fitted_plane, fitted_centroid,
|
||||||
CGAL::Dimension_tag<0>(),
|
CGAL::Dimension_tag<0>(),
|
||||||
Local_traits(),
|
ITraits(),
|
||||||
CGAL::Eigen_diagonalize_traits<Local_FT, 3>());
|
CGAL::Eigen_diagonalize_traits<IFT, 3>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fields.
|
|
||||||
const Input_range& m_input_range;
|
|
||||||
Neighbor_query& m_neighbor_query;
|
|
||||||
const Point_map m_point_map;
|
|
||||||
|
|
||||||
std::vector<std::size_t> m_order;
|
|
||||||
std::vector<Local_FT> m_scores;
|
|
||||||
|
|
||||||
const To_local_converter m_to_local_converter;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Point_set
|
} // namespace Point_set
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,6 @@ namespace Point_set {
|
||||||
class Sphere_neighbor_query {
|
class Sphere_neighbor_query {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// \name Types
|
/// \name Types
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
|
|
@ -75,14 +74,15 @@ namespace Point_set {
|
||||||
using Traits = GeomTraits;
|
using Traits = GeomTraits;
|
||||||
using Input_range = InputRange;
|
using Input_range = InputRange;
|
||||||
using Point_map = PointMap;
|
using Point_map = PointMap;
|
||||||
|
|
||||||
using Point = typename Point_map::value_type;
|
using Point = typename Point_map::value_type;
|
||||||
/// \endcond
|
/// \endcond
|
||||||
|
|
||||||
/// Number type.
|
/// Number type.
|
||||||
typedef typename GeomTraits::FT FT;
|
typedef typename GeomTraits::FT FT;
|
||||||
|
|
||||||
/// \cond SKIP_IN_MANUAL
|
/// @}
|
||||||
|
|
||||||
|
private:
|
||||||
using Index_to_point_map =
|
using Index_to_point_map =
|
||||||
internal::Item_property_map<Input_range, Point_map>;
|
internal::Item_property_map<Input_range, Point_map>;
|
||||||
|
|
||||||
|
|
@ -102,10 +102,8 @@ namespace Point_set {
|
||||||
|
|
||||||
using Tree
|
using Tree
|
||||||
= CGAL::Kd_tree<Search_traits, Splitter, CGAL::Tag_true, CGAL::Tag_true>;
|
= CGAL::Kd_tree<Search_traits, Splitter, CGAL::Tag_true, CGAL::Tag_true>;
|
||||||
/// \endcond
|
|
||||||
|
|
||||||
/// @}
|
|
||||||
|
|
||||||
|
public:
|
||||||
/// \name Initialization
|
/// \name Initialization
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
|
|
@ -185,16 +183,19 @@ namespace Point_set {
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
|
/// \cond SKIP_IN_MANUAL
|
||||||
|
// A property map that can be used to access points when
|
||||||
|
// iterating over the indices counting items in the input range.
|
||||||
|
const Index_to_point_map& index_to_point_map() const {
|
||||||
|
return m_index_to_point_map;
|
||||||
|
}
|
||||||
|
/// \endcond
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// Fields.
|
|
||||||
const Input_range& m_input_range;
|
const Input_range& m_input_range;
|
||||||
|
|
||||||
const FT m_sphere_radius;
|
const FT m_sphere_radius;
|
||||||
|
|
||||||
const Point_map m_point_map;
|
const Point_map m_point_map;
|
||||||
const Index_to_point_map m_index_to_point_map;
|
const Index_to_point_map m_index_to_point_map;
|
||||||
|
|
||||||
Tree m_tree;
|
Tree m_tree;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,22 +78,31 @@ namespace Polygon_mesh {
|
||||||
class Least_squares_plane_fit_region {
|
class Least_squares_plane_fit_region {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
/// \name Types
|
||||||
|
/// @{
|
||||||
|
|
||||||
/// \cond SKIP_IN_MANUAL
|
/// \cond SKIP_IN_MANUAL
|
||||||
using Traits = GeomTraits;
|
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;
|
||||||
|
/// \endcond
|
||||||
|
|
||||||
|
/// Number type.
|
||||||
|
typedef typename GeomTraits::FT FT;
|
||||||
|
|
||||||
|
/// @}
|
||||||
|
|
||||||
|
private:
|
||||||
using Point_3 = typename Traits::Point_3;
|
using Point_3 = typename Traits::Point_3;
|
||||||
using Vector_3 = typename Traits::Vector_3;
|
using Vector_3 = typename Traits::Vector_3;
|
||||||
using Plane_3 = typename Traits::Plane_3;
|
using Plane_3 = typename Traits::Plane_3;
|
||||||
|
|
||||||
using Local_traits = Exact_predicates_inexact_constructions_kernel;
|
using ITraits = Exact_predicates_inexact_constructions_kernel;
|
||||||
using Local_FT = typename Local_traits::FT;
|
using IFT = typename ITraits::FT;
|
||||||
using Local_point_3 = typename Local_traits::Point_3;
|
using IPoint_3 = typename ITraits::Point_3;
|
||||||
using Local_plane_3 = typename Local_traits::Plane_3;
|
using IPlane_3 = typename ITraits::Plane_3;
|
||||||
using To_local_converter = Cartesian_converter<Traits, Local_traits>;
|
using IConverter = Cartesian_converter<Traits, ITraits>;
|
||||||
|
|
||||||
using Squared_length_3 = typename Traits::Compute_squared_length_3;
|
using Squared_length_3 = typename Traits::Compute_squared_length_3;
|
||||||
using Squared_distance_3 = typename Traits::Compute_squared_distance_3;
|
using Squared_distance_3 = typename Traits::Compute_squared_distance_3;
|
||||||
|
|
@ -102,16 +111,8 @@ namespace Polygon_mesh {
|
||||||
|
|
||||||
using Get_sqrt = internal::Get_sqrt<Traits>;
|
using Get_sqrt = internal::Get_sqrt<Traits>;
|
||||||
using Sqrt = typename Get_sqrt::Sqrt;
|
using Sqrt = typename Get_sqrt::Sqrt;
|
||||||
/// \endcond
|
|
||||||
|
|
||||||
/// \name Types
|
|
||||||
/// @{
|
|
||||||
|
|
||||||
/// Number type.
|
|
||||||
typedef typename GeomTraits::FT FT;
|
|
||||||
|
|
||||||
/// @}
|
|
||||||
|
|
||||||
|
public:
|
||||||
/// \name Initialization
|
/// \name Initialization
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
|
|
@ -164,7 +165,7 @@ namespace Polygon_mesh {
|
||||||
m_scalar_product_3(traits.compute_scalar_product_3_object()),
|
m_scalar_product_3(traits.compute_scalar_product_3_object()),
|
||||||
m_cross_product_3(traits.construct_cross_product_vector_3_object()),
|
m_cross_product_3(traits.construct_cross_product_vector_3_object()),
|
||||||
m_sqrt(Get_sqrt::sqrt_object(traits)),
|
m_sqrt(Get_sqrt::sqrt_object(traits)),
|
||||||
m_to_local_converter() {
|
m_iconverter() {
|
||||||
|
|
||||||
CGAL_precondition(m_face_range.size() > 0);
|
CGAL_precondition(m_face_range.size() > 0);
|
||||||
|
|
||||||
|
|
@ -266,7 +267,7 @@ namespace Polygon_mesh {
|
||||||
|
|
||||||
} else { // update reference plane and normal
|
} else { // update reference plane and normal
|
||||||
|
|
||||||
std::vector<Local_point_3> points;
|
std::vector<IPoint_3> points;
|
||||||
for (std::size_t i = 0; i < region.size(); ++i) {
|
for (std::size_t i = 0; i < region.size(); ++i) {
|
||||||
|
|
||||||
CGAL_precondition(region[i] < m_face_range.size());
|
CGAL_precondition(region[i] < m_face_range.size());
|
||||||
|
|
@ -278,13 +279,13 @@ namespace Polygon_mesh {
|
||||||
for (const auto vertex : vertices) {
|
for (const auto vertex : vertices) {
|
||||||
|
|
||||||
const Point_3& tmp_point = get(m_vertex_to_point_map, vertex);
|
const Point_3& tmp_point = get(m_vertex_to_point_map, vertex);
|
||||||
points.push_back(m_to_local_converter(tmp_point));
|
points.push_back(m_iconverter(tmp_point));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CGAL_postcondition(points.size() > 0);
|
CGAL_postcondition(points.size() > 0);
|
||||||
|
|
||||||
Local_plane_3 fitted_plane;
|
IPlane_3 fitted_plane;
|
||||||
Local_point_3 fitted_centroid;
|
IPoint_3 fitted_centroid;
|
||||||
|
|
||||||
// The best fit plane will be a plane fitted to all vertices of all
|
// The best fit plane will be a plane fitted to all vertices of all
|
||||||
// region faces with its normal being perpendicular to the plane.
|
// region faces with its normal being perpendicular to the plane.
|
||||||
|
|
@ -299,8 +300,8 @@ namespace Polygon_mesh {
|
||||||
points.begin(), points.end(),
|
points.begin(), points.end(),
|
||||||
fitted_plane, fitted_centroid,
|
fitted_plane, fitted_centroid,
|
||||||
CGAL::Dimension_tag<0>(),
|
CGAL::Dimension_tag<0>(),
|
||||||
Local_traits(),
|
ITraits(),
|
||||||
CGAL::Eigen_diagonalize_traits<Local_FT, 3>());
|
CGAL::Eigen_diagonalize_traits<IFT, 3>());
|
||||||
|
|
||||||
const Plane_3 unoriented_plane_of_best_fit =
|
const Plane_3 unoriented_plane_of_best_fit =
|
||||||
Plane_3(
|
Plane_3(
|
||||||
|
|
@ -351,6 +352,25 @@ namespace Polygon_mesh {
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
const Face_graph& m_face_graph;
|
||||||
|
const Face_range m_face_range;
|
||||||
|
|
||||||
|
const FT m_distance_threshold;
|
||||||
|
const FT m_normal_threshold;
|
||||||
|
const std::size_t m_min_region_size;
|
||||||
|
|
||||||
|
const Vertex_to_point_map m_vertex_to_point_map;
|
||||||
|
|
||||||
|
const Squared_length_3 m_squared_length_3;
|
||||||
|
const Squared_distance_3 m_squared_distance_3;
|
||||||
|
const Scalar_product_3 m_scalar_product_3;
|
||||||
|
const Cross_product_3 m_cross_product_3;
|
||||||
|
const Sqrt m_sqrt;
|
||||||
|
|
||||||
|
const IConverter m_iconverter;
|
||||||
|
|
||||||
|
Plane_3 m_plane_of_best_fit;
|
||||||
|
Vector_3 m_normal_of_best_fit;
|
||||||
|
|
||||||
template<typename Face>
|
template<typename Face>
|
||||||
void get_face_centroid(
|
void get_face_centroid(
|
||||||
|
|
@ -444,27 +464,6 @@ namespace Polygon_mesh {
|
||||||
|
|
||||||
return max_face_distance;
|
return max_face_distance;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fields.
|
|
||||||
const Face_graph& m_face_graph;
|
|
||||||
const Face_range m_face_range;
|
|
||||||
|
|
||||||
const FT m_distance_threshold;
|
|
||||||
const FT m_normal_threshold;
|
|
||||||
const std::size_t m_min_region_size;
|
|
||||||
|
|
||||||
const Vertex_to_point_map m_vertex_to_point_map;
|
|
||||||
|
|
||||||
const Squared_length_3 m_squared_length_3;
|
|
||||||
const Squared_distance_3 m_squared_distance_3;
|
|
||||||
const Scalar_product_3 m_scalar_product_3;
|
|
||||||
const Cross_product_3 m_cross_product_3;
|
|
||||||
const Sqrt m_sqrt;
|
|
||||||
|
|
||||||
const To_local_converter m_to_local_converter;
|
|
||||||
|
|
||||||
Plane_3 m_plane_of_best_fit;
|
|
||||||
Vector_3 m_normal_of_best_fit;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Polygon_mesh
|
} // namespace Polygon_mesh
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,6 @@ namespace Polygon_mesh {
|
||||||
class Least_squares_plane_fit_sorting {
|
class Least_squares_plane_fit_sorting {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// \name Types
|
/// \name Types
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
|
|
@ -100,6 +99,15 @@ namespace Polygon_mesh {
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
|
private:
|
||||||
|
using ITraits = Exact_predicates_inexact_constructions_kernel;
|
||||||
|
using IFT = typename ITraits::FT;
|
||||||
|
using IPoint_3 = typename ITraits::Point_3;
|
||||||
|
using IPlane_3 = typename ITraits::Plane_3;
|
||||||
|
using IConverter = Cartesian_converter<Traits, ITraits>;
|
||||||
|
using Compare_scores = internal::Compare_scores<IFT>;
|
||||||
|
|
||||||
|
public:
|
||||||
/// \name Initialization
|
/// \name Initialization
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
|
|
@ -127,7 +135,7 @@ namespace Polygon_mesh {
|
||||||
m_neighbor_query(neighbor_query),
|
m_neighbor_query(neighbor_query),
|
||||||
m_face_range(faces(m_face_graph)),
|
m_face_range(faces(m_face_graph)),
|
||||||
m_vertex_to_point_map(vertex_to_point_map),
|
m_vertex_to_point_map(vertex_to_point_map),
|
||||||
m_to_local_converter() {
|
m_iconverter() {
|
||||||
|
|
||||||
CGAL_precondition(m_face_range.size() > 0);
|
CGAL_precondition(m_face_range.size() > 0);
|
||||||
|
|
||||||
|
|
@ -170,20 +178,18 @@ namespace Polygon_mesh {
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
const Face_graph& m_face_graph;
|
||||||
|
Neighbor_query& m_neighbor_query;
|
||||||
|
const Face_range m_face_range;
|
||||||
|
const Vertex_to_point_map m_vertex_to_point_map;
|
||||||
|
std::vector<std::size_t> m_order;
|
||||||
|
std::vector<IFT> m_scores;
|
||||||
|
const IConverter m_iconverter;
|
||||||
|
|
||||||
// Types.
|
|
||||||
using Local_traits = Exact_predicates_inexact_constructions_kernel;
|
|
||||||
using Local_FT = typename Local_traits::FT;
|
|
||||||
using Local_point_3 = typename Local_traits::Point_3;
|
|
||||||
using Local_plane_3 = typename Local_traits::Plane_3;
|
|
||||||
using To_local_converter = Cartesian_converter<Traits, Local_traits>;
|
|
||||||
using Compare_scores = internal::Compare_scores<Local_FT>;
|
|
||||||
|
|
||||||
// Functions.
|
|
||||||
void compute_scores() {
|
void compute_scores() {
|
||||||
|
|
||||||
std::vector<std::size_t> neighbors;
|
std::vector<std::size_t> neighbors;
|
||||||
std::vector<Local_point_3> points;
|
std::vector<IPoint_3> points;
|
||||||
|
|
||||||
for (std::size_t i = 0; i < m_face_range.size(); ++i) {
|
for (std::size_t i = 0; i < m_face_range.size(); ++i) {
|
||||||
|
|
||||||
|
|
@ -202,33 +208,22 @@ namespace Polygon_mesh {
|
||||||
for (const auto vertex : vertices) {
|
for (const auto vertex : vertices) {
|
||||||
|
|
||||||
const auto& tmp_point = get(m_vertex_to_point_map, vertex);
|
const auto& tmp_point = get(m_vertex_to_point_map, vertex);
|
||||||
points.push_back(m_to_local_converter(tmp_point));
|
points.push_back(m_iconverter(tmp_point));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CGAL_postcondition(points.size() > 0);
|
CGAL_postcondition(points.size() > 0);
|
||||||
|
|
||||||
Local_plane_3 fitted_plane;
|
IPlane_3 fitted_plane;
|
||||||
Local_point_3 fitted_centroid;
|
IPoint_3 fitted_centroid;
|
||||||
|
|
||||||
m_scores[i] = CGAL::linear_least_squares_fitting_3(
|
m_scores[i] = CGAL::linear_least_squares_fitting_3(
|
||||||
points.begin(), points.end(),
|
points.begin(), points.end(),
|
||||||
fitted_plane, fitted_centroid,
|
fitted_plane, fitted_centroid,
|
||||||
CGAL::Dimension_tag<0>(),
|
CGAL::Dimension_tag<0>(),
|
||||||
Local_traits(),
|
ITraits(),
|
||||||
CGAL::Eigen_diagonalize_traits<Local_FT, 3>());
|
CGAL::Eigen_diagonalize_traits<IFT, 3>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fields.
|
|
||||||
const Face_graph& m_face_graph;
|
|
||||||
Neighbor_query& m_neighbor_query;
|
|
||||||
const Face_range m_face_range;
|
|
||||||
const Vertex_to_point_map m_vertex_to_point_map;
|
|
||||||
|
|
||||||
std::vector<std::size_t> m_order;
|
|
||||||
std::vector<Local_FT> m_scores;
|
|
||||||
|
|
||||||
const To_local_converter m_to_local_converter;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Polygon_mesh
|
} // namespace Polygon_mesh
|
||||||
|
|
|
||||||
|
|
@ -58,15 +58,16 @@ namespace Polygon_mesh {
|
||||||
class One_ring_neighbor_query {
|
class One_ring_neighbor_query {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// \cond SKIP_IN_MANUAL
|
/// \cond SKIP_IN_MANUAL
|
||||||
using Face_graph = PolygonMesh;
|
using Face_graph = PolygonMesh;
|
||||||
using Face_range = FaceRange;
|
using Face_range = FaceRange;
|
||||||
|
|
||||||
using Face_to_index_map
|
|
||||||
= internal::Item_to_index_property_map<Face_range>;
|
|
||||||
/// \endcond
|
/// \endcond
|
||||||
|
|
||||||
|
private:
|
||||||
|
using Face_to_index_map
|
||||||
|
= internal::Item_to_index_property_map<Face_range>;
|
||||||
|
|
||||||
|
public:
|
||||||
/// \name Initialization
|
/// \name Initialization
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
|
|
@ -129,12 +130,16 @@ namespace Polygon_mesh {
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
private:
|
/// \cond SKIP_IN_MANUAL
|
||||||
|
// A property map that can be used to access indices of the input faces.
|
||||||
|
const Face_to_index_map& face_to_index_map() const {
|
||||||
|
return m_face_to_index_map;
|
||||||
|
}
|
||||||
|
/// \endcond
|
||||||
|
|
||||||
// Fields.
|
private:
|
||||||
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 Face_to_index_map m_face_to_index_map;
|
const Face_to_index_map m_face_to_index_map;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -108,20 +108,18 @@ namespace internal {
|
||||||
using Traits = typename Kernel_traits<Plane_3>::Kernel;
|
using Traits = typename Kernel_traits<Plane_3>::Kernel;
|
||||||
using FT = typename Traits::FT;
|
using FT = typename Traits::FT;
|
||||||
|
|
||||||
using Local_traits =
|
using ITraits = CGAL::Exact_predicates_inexact_constructions_kernel;
|
||||||
CGAL::Exact_predicates_inexact_constructions_kernel;
|
using IConverter = Cartesian_converter<Traits, ITraits>;
|
||||||
using To_local_converter =
|
|
||||||
Cartesian_converter<Traits, Local_traits>;
|
|
||||||
|
|
||||||
using Local_FT = typename Local_traits::FT;
|
using IFT = typename ITraits::FT;
|
||||||
using Local_point_3 = typename Local_traits::Point_3;
|
using IPoint_3 = typename ITraits::Point_3;
|
||||||
using Local_plane_3 = typename Local_traits::Plane_3;
|
using IPlane_3 = typename ITraits::Plane_3;
|
||||||
|
|
||||||
planes.clear();
|
planes.clear();
|
||||||
planes.reserve(regions.size());
|
planes.reserve(regions.size());
|
||||||
|
|
||||||
std::vector<Local_point_3> points;
|
std::vector<IPoint_3> points;
|
||||||
const To_local_converter to_local_converter = To_local_converter();
|
const IConverter iconverter = IConverter();
|
||||||
|
|
||||||
for (const auto& region : regions) {
|
for (const auto& region : regions) {
|
||||||
CGAL_assertion(region.size() > 0);
|
CGAL_assertion(region.size() > 0);
|
||||||
|
|
@ -132,21 +130,21 @@ namespace internal {
|
||||||
CGAL_precondition(region[i] < input_range.size());
|
CGAL_precondition(region[i] < input_range.size());
|
||||||
|
|
||||||
const auto& key = *(input_range.begin() + region[i]);
|
const auto& key = *(input_range.begin() + region[i]);
|
||||||
points.push_back(to_local_converter(get(point_map, key)));
|
points.push_back(iconverter(get(point_map, key)));
|
||||||
}
|
}
|
||||||
CGAL_postcondition(points.size() == region.size());
|
CGAL_postcondition(points.size() == region.size());
|
||||||
|
|
||||||
Local_plane_3 fitted_plane;
|
IPlane_3 fitted_plane;
|
||||||
Local_point_3 fitted_centroid;
|
IPoint_3 fitted_centroid;
|
||||||
|
|
||||||
CGAL::linear_least_squares_fitting_3(
|
CGAL::linear_least_squares_fitting_3(
|
||||||
points.begin(), points.end(),
|
points.begin(), points.end(),
|
||||||
fitted_plane, fitted_centroid,
|
fitted_plane, fitted_centroid,
|
||||||
CGAL::Dimension_tag<0>(),
|
CGAL::Dimension_tag<0>(),
|
||||||
Local_traits(),
|
ITraits(),
|
||||||
CGAL::Eigen_diagonalize_traits<Local_FT, 3>());
|
CGAL::Eigen_diagonalize_traits<IFT, 3>());
|
||||||
|
|
||||||
const Plane_3 plane = Plane_3(
|
const Plane_3 plane = Plane_3(
|
||||||
static_cast<FT>(fitted_plane.a()),
|
static_cast<FT>(fitted_plane.a()),
|
||||||
static_cast<FT>(fitted_plane.b()),
|
static_cast<FT>(fitted_plane.b()),
|
||||||
static_cast<FT>(fitted_plane.c()),
|
static_cast<FT>(fitted_plane.c()),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue