mirror of https://github.com/CGAL/cgal
added empty polyline graph
This commit is contained in:
parent
793037c3d7
commit
3ca82f638c
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include <CGAL/license/Shape_detection.h>
|
||||
|
||||
#include <CGAL/Shape_detection/Region_growing/Region_growing_on_polyline/Polyline_graph.h>
|
||||
#include <CGAL/Shape_detection/Region_growing/Region_growing_on_polyline/One_ring_neighbor_query.h>
|
||||
#include <CGAL/Shape_detection/Region_growing/Region_growing_on_polyline/Least_squares_line_fit_region.h>
|
||||
#include <CGAL/Shape_detection/Region_growing/Region_growing_on_polyline/Least_squares_line_fit_sorting.h>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,107 @@
|
|||
// Copyright (c) 2020 GeometryFactory SARL (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
|
||||
//
|
||||
//
|
||||
// Author(s) : Dmitry Anisimov
|
||||
//
|
||||
|
||||
#ifndef CGAL_SHAPE_DETECTION_REGION_GROWING_POLYLINE_GRAPH_H
|
||||
#define CGAL_SHAPE_DETECTION_REGION_GROWING_POLYLINE_GRAPH_H
|
||||
|
||||
#include <CGAL/license/Shape_detection.h>
|
||||
|
||||
// Boost includes.
|
||||
#include <CGAL/boost/graph/named_params_helper.h>
|
||||
#include <CGAL/boost/graph/Named_function_parameters.h>
|
||||
|
||||
// Internal includes.
|
||||
#include <CGAL/Shape_detection/Region_growing/internal/utils.h>
|
||||
|
||||
namespace CGAL {
|
||||
namespace Shape_detection {
|
||||
namespace Polyline {
|
||||
|
||||
template<
|
||||
typename GeomTraits,
|
||||
typename PolygonMesh,
|
||||
typename FaceRange = typename PolygonMesh::Face_range,
|
||||
typename VertexToPointMap = typename boost::property_map<PolygonMesh, CGAL::vertex_point_t>::type>
|
||||
class Polyline_graph {
|
||||
|
||||
public:
|
||||
/// \name Types
|
||||
/// @{
|
||||
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
using Traits = GeomTraits;
|
||||
using Face_graph = PolygonMesh;
|
||||
using Face_range = FaceRange;
|
||||
using Vertex_to_point_map = VertexToPointMap;
|
||||
/// \endcond
|
||||
|
||||
/// Number type.
|
||||
typedef typename GeomTraits::FT FT;
|
||||
|
||||
/// @}
|
||||
|
||||
private:
|
||||
using Point_3 = typename Traits::Point_3;
|
||||
using Vector_3 = typename Traits::Vector_3;
|
||||
using Plane_3 = typename Traits::Plane_3;
|
||||
|
||||
using Squared_length_3 = typename Traits::Compute_squared_length_3;
|
||||
using Squared_distance_3 = typename Traits::Compute_squared_distance_3;
|
||||
using Scalar_product_3 = typename Traits::Compute_scalar_product_3;
|
||||
using Cross_product_3 = typename Traits::Construct_cross_product_vector_3;
|
||||
|
||||
public:
|
||||
template<typename NamedParameters>
|
||||
Polyline_graph(
|
||||
const PolygonMesh& pmesh,
|
||||
const NamedParameters& np,
|
||||
const VertexToPointMap vertex_to_point_map = VertexToPointMap(),
|
||||
const GeomTraits traits = GeomTraits()) :
|
||||
m_face_graph(pmesh),
|
||||
m_face_range(faces(m_face_graph)),
|
||||
m_vertex_to_point_map(vertex_to_point_map),
|
||||
m_squared_length_3(traits.compute_squared_length_3_object()),
|
||||
m_squared_distance_3(traits.compute_squared_distance_3_object()),
|
||||
m_scalar_product_3(traits.compute_scalar_product_3_object()),
|
||||
m_cross_product_3(traits.construct_cross_product_vector_3_object()) {
|
||||
|
||||
CGAL_precondition(m_face_range.size() > 0);
|
||||
m_distance_threshold = parameters::choose_parameter(
|
||||
parameters::get_parameter(np, internal_np::distance_threshold), FT(1));
|
||||
CGAL_precondition(m_distance_threshold >= FT(0));
|
||||
}
|
||||
|
||||
private:
|
||||
const Face_graph& m_face_graph;
|
||||
const Face_range m_face_range;
|
||||
|
||||
FT m_distance_threshold;
|
||||
FT m_cos_value_threshold;
|
||||
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;
|
||||
|
||||
Plane_3 m_plane_of_best_fit;
|
||||
Vector_3 m_normal_of_best_fit;
|
||||
};
|
||||
|
||||
} // namespace Polyline
|
||||
} // namespace Shape_detection
|
||||
} // namespace CGAL
|
||||
|
||||
#endif // CGAL_SHAPE_DETECTION_REGION_GROWING_POLYLINE_GRAPH_H
|
||||
Loading…
Reference in New Issue