mirror of https://github.com/CGAL/cgal
Merge pull request #762 from sloriot/BGL-unif_names
Unify names of parameters model of CGAL BGL concepts
This commit is contained in:
commit
89fe7c62b2
|
|
@ -130,8 +130,7 @@ and provides a list of the parameters that are used in this package.
|
|||
- `CGAL::Polygon_mesh_processing::bbox_3()`
|
||||
- `CGAL::Polygon_mesh_processing::border_halfedges()`
|
||||
|
||||
\todo make template parameter names uniform in other packages using BGL. Here we chose PolygonMesh as template parameter.
|
||||
It can be made short to PM. And TriangleMesh (or TM) specifies when the parameter should be a triangle mesh.
|
||||
|
||||
\todo add in BGL `clear(pmesh)` and use it in `keep_largest_connected_components(pmesh, 0);`
|
||||
\todo document BGL/include/CGAL/boost/graph/Dual.h and remove the example from dont_submit
|
||||
\todo fix and restore remove_degenerate_faces in the user and the reference manual
|
||||
|
|
|
|||
|
|
@ -6,13 +6,13 @@
|
|||
/// \cgalHeading{Example:}
|
||||
///
|
||||
/// \code
|
||||
/// // a simple model to SurfaceMeshDeformationWeights concept, which provides uniform weights
|
||||
/// template <class HalfedgeGraph>
|
||||
/// // a simple model to `SurfaceMeshDeformationWeights` concept, which provides uniform weights
|
||||
/// template <class TriangleMesh>
|
||||
/// struct Identity_weight
|
||||
/// {
|
||||
/// typedef HalfedgeGraph Halfedge_graph;
|
||||
/// typedef TriangleMesh Triangle_mesh;
|
||||
/// template<class VertexPointMap>
|
||||
/// double operator()(typename boost::graph_traits<HalfedgeGraph>::halfedge_descriptor /*e*/, const HalfedgeGraph& /*p*/, VertexPointMap /*v*/)
|
||||
/// double operator()(typename boost::graph_traits<TriangleMesh>::halfedge_descriptor /*e*/, const TriangleMesh& /*p*/, VertexPointMap /*v*/)
|
||||
/// { return 1.0; }
|
||||
/// };
|
||||
/// \endcode
|
||||
|
|
@ -23,8 +23,8 @@ class SurfaceMeshDeformationWeights
|
|||
public:
|
||||
/// \name Types
|
||||
/// @{
|
||||
/// a model of HalfedgeGraph
|
||||
typedef unspecified_type Halfedge_graph;
|
||||
/// a model of `HalfedgeGraph`
|
||||
typedef unspecified_type Triangle_mesh;
|
||||
/// @}
|
||||
|
||||
/// \name Creation
|
||||
|
|
@ -36,9 +36,9 @@ public:
|
|||
/// \name Operations
|
||||
/// @{
|
||||
/// Function computing the halfedge weight of halfedge `he`
|
||||
/// \tparam VertexPointMap a model of `ReadWritePropertyMap`</a> with boost::graph_traits<Halfedge_graph>::vertex_descriptor as key and a 3D point from a \cgal Kernel as value type
|
||||
/// \tparam VertexPointMap a model of `ReadWritePropertyMap`</a> with boost::graph_traits<Triangle_mesh>::vertex_descriptor as key and a 3D point from a \cgal Kernel as value type
|
||||
template <class VertexPointMap>
|
||||
double operator()(boost::graph_traits<Halfedge_graph>::halfedge_descriptor he, const Halfedge_graph& halfedge_graph, VertexPointMap vpm);
|
||||
double operator()(boost::graph_traits<Triangle_mesh>::halfedge_descriptor he, const Triangle_mesh& triangle_mesh, VertexPointMap vpm);
|
||||
/// @}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -57,17 +57,17 @@ enum Deformation_algorithm_tag
|
|||
|
||||
/// @cond CGAL_DOCUMENT_INTERNAL
|
||||
namespace internal {
|
||||
template<class HalfedgeGraph, Deformation_algorithm_tag deformation_algorithm_tag>
|
||||
template<class TriangleMesh, Deformation_algorithm_tag deformation_algorithm_tag>
|
||||
struct Weight_calculator_selector;
|
||||
|
||||
template<class HalfedgeGraph>
|
||||
struct Weight_calculator_selector<HalfedgeGraph, CGAL::SPOKES_AND_RIMS> {
|
||||
typedef Single_cotangent_weight_impl<HalfedgeGraph> weight_calculator;
|
||||
template<class TriangleMesh>
|
||||
struct Weight_calculator_selector<TriangleMesh, CGAL::SPOKES_AND_RIMS> {
|
||||
typedef Single_cotangent_weight_impl<TriangleMesh> weight_calculator;
|
||||
};
|
||||
|
||||
template<class HalfedgeGraph>
|
||||
struct Weight_calculator_selector<HalfedgeGraph, CGAL::ORIGINAL_ARAP> {
|
||||
typedef Cotangent_weight_impl<HalfedgeGraph> weight_calculator;
|
||||
template<class TriangleMesh>
|
||||
struct Weight_calculator_selector<TriangleMesh, CGAL::ORIGINAL_ARAP> {
|
||||
typedef Cotangent_weight_impl<TriangleMesh> weight_calculator;
|
||||
};
|
||||
|
||||
// property map that create a Simple_cartesian<double>::Point_3
|
||||
|
|
@ -100,13 +100,13 @@ struct SC_on_the_fly_pmap: public Vertex_point_map{
|
|||
/// \ingroup PkgSurfaceMeshDeformation
|
||||
/// @brief Class providing the functionalities for deforming a triangulated surface mesh
|
||||
///
|
||||
/// @tparam HG a model of HalfedgeGraph
|
||||
/// @tparam TM a model of `HalfedgeGraph`
|
||||
/// @tparam VIM a model of `ReadablePropertyMap` with `Surface_mesh_deformation::vertex_descriptor` as key and `unsigned int` as value type.
|
||||
/// The default is `boost::property_map<HG, boost::%vertex_index_t>::%type`.
|
||||
/// The default is `boost::property_map<TM, boost::%vertex_index_t>::%type`.
|
||||
/// @tparam HIM a model of `ReadablePropertyMap` with `Surface_mesh_deformation::halfedge_descriptor` as key and `unsigned int` as value type.
|
||||
/// The default is `boost::property_map<HG, boost::%halfedge_index_t>::%type`.
|
||||
/// The default is `boost::property_map<TM, boost::%halfedge_index_t>::%type`.
|
||||
/// @tparam TAG tag for selecting the deformation algorithm
|
||||
/// @tparam WC a model of `SurfaceMeshDeformationWeights`, with `WC::Halfedge_graph` being `HG`.
|
||||
/// @tparam WC a model of SurfaceMeshDeformationWeights, with `WC::Triangle_mesh` being `TM`.
|
||||
/// If `TAG` is `ORIGINAL_ARAP`, the weights must be positive to guarantee a correct energy minimization.
|
||||
/// The default is the cotangent weighting scheme. In case `TAG` is `ORIGINAL_ARAP`, negative weights are clamped to zero.
|
||||
/// @tparam ST a model of SparseLinearAlgebraWithFactorTraits_d. If \ref thirdpartyEigen "Eigen" 3.2 (or greater) is available
|
||||
|
|
@ -120,9 +120,9 @@ struct SC_on_the_fly_pmap: public Vertex_point_map{
|
|||
/// @tparam CR a model of DeformationClosestRotationTraits_3. If \ref thirdpartyEigen "Eigen" 3.1 (or greater) is available and `CGAL_EIGEN3_ENABLED` is defined,
|
||||
/// `Deformation_Eigen_polar_closest_rotation_traits_3` is provided as default parameter.
|
||||
/// @tparam VPM a model of `ReadWritePropertyMap`</a> with `Surface_mesh_deformation::vertex_descriptor` as key and a point as value type. The point type must be a model of `::RawPoint_3`.
|
||||
/// The default is `boost::property_map<HG, CGAL::vertex_point_t>::%type`.
|
||||
/// The default is `boost::property_map<TM, CGAL::vertex_point_t>::%type`.
|
||||
template <
|
||||
class HG,
|
||||
class TM,
|
||||
class VIM=Default,
|
||||
class HIM=Default,
|
||||
Deformation_algorithm_tag TAG = SPOKES_AND_RIMS,
|
||||
|
|
@ -140,17 +140,18 @@ public:
|
|||
/// @{
|
||||
// typedefed template parameters, main reason is doxygen creates autolink to typedefs but not template parameters
|
||||
///
|
||||
typedef HG Halfedge_graph;
|
||||
typedef TM Triangle_mesh;
|
||||
typedef TM Halfedge_graph;
|
||||
|
||||
// Index maps
|
||||
#ifndef DOXYGEN_RUNNING
|
||||
typedef typename Default::Get<
|
||||
VIM,
|
||||
typename boost::property_map<Halfedge_graph, boost::vertex_index_t>::type
|
||||
typename boost::property_map<Triangle_mesh, boost::vertex_index_t>::type
|
||||
>::type Vertex_index_map;
|
||||
typedef typename Default::Get<
|
||||
HIM,
|
||||
typename boost::property_map<Halfedge_graph, boost::halfedge_index_t>::type
|
||||
typename boost::property_map<Triangle_mesh, boost::halfedge_index_t>::type
|
||||
>::type Hedge_index_map;
|
||||
#else
|
||||
///
|
||||
|
|
@ -163,7 +164,7 @@ public:
|
|||
#ifndef DOXYGEN_RUNNING
|
||||
typedef typename Default::Get<
|
||||
WC,
|
||||
typename internal::Weight_calculator_selector<HG, TAG>::weight_calculator
|
||||
typename internal::Weight_calculator_selector<TM, TAG>::weight_calculator
|
||||
>::type Weight_calculator;
|
||||
#else
|
||||
///
|
||||
|
|
@ -207,7 +208,7 @@ public:
|
|||
#ifndef DOXYGEN_RUNNING
|
||||
typedef typename Default::Get<
|
||||
VPM,
|
||||
typename boost::property_map<Halfedge_graph, CGAL::vertex_point_t>::type
|
||||
typename boost::property_map<Triangle_mesh, CGAL::vertex_point_t>::type
|
||||
>::type Vertex_point_map;
|
||||
#else
|
||||
///
|
||||
|
|
@ -215,9 +216,9 @@ public:
|
|||
#endif
|
||||
|
||||
/// The type for vertex descriptor
|
||||
typedef typename boost::graph_traits<Halfedge_graph>::vertex_descriptor vertex_descriptor;
|
||||
typedef typename boost::graph_traits<Triangle_mesh>::vertex_descriptor vertex_descriptor;
|
||||
/// The type for halfedge descriptor
|
||||
typedef typename boost::graph_traits<Halfedge_graph>::halfedge_descriptor halfedge_descriptor;
|
||||
typedef typename boost::graph_traits<Triangle_mesh>::halfedge_descriptor halfedge_descriptor;
|
||||
/// The 3D point type, model of `::RawPoint_3`
|
||||
typedef typename boost::property_traits<Vertex_point_map>::value_type Point;
|
||||
/// A constant iterator range over the vertices of the region-of-interest.
|
||||
|
|
@ -226,18 +227,18 @@ public:
|
|||
/// @}
|
||||
|
||||
private:
|
||||
typedef Surface_mesh_deformation<HG, VIM, HIM, TAG, WC, ST, CR> Self;
|
||||
// Repeat Halfedge_graph types
|
||||
typedef typename boost::graph_traits<Halfedge_graph>::vertex_iterator vertex_iterator;
|
||||
typedef typename boost::graph_traits<Halfedge_graph>::halfedge_iterator halfedge_iterator;
|
||||
typedef typename boost::graph_traits<Halfedge_graph>::in_edge_iterator in_edge_iterator;
|
||||
typedef typename boost::graph_traits<Halfedge_graph>::out_edge_iterator out_edge_iterator;
|
||||
typedef Surface_mesh_deformation<TM, VIM, HIM, TAG, WC, ST, CR> Self;
|
||||
// Repeat Triangle_mesh types
|
||||
typedef typename boost::graph_traits<Triangle_mesh>::vertex_iterator vertex_iterator;
|
||||
typedef typename boost::graph_traits<Triangle_mesh>::halfedge_iterator halfedge_iterator;
|
||||
typedef typename boost::graph_traits<Triangle_mesh>::in_edge_iterator in_edge_iterator;
|
||||
typedef typename boost::graph_traits<Triangle_mesh>::out_edge_iterator out_edge_iterator;
|
||||
|
||||
typedef typename Closest_rotation_traits::Matrix CR_matrix;
|
||||
typedef typename Closest_rotation_traits::Vector CR_vector;
|
||||
|
||||
// Data members.
|
||||
Halfedge_graph& m_halfedge_graph; /**< Source triangulated surface mesh for modeling */
|
||||
Triangle_mesh& m_triangle_mesh; /**< Source triangulated surface mesh for modeling */
|
||||
|
||||
std::vector<Point> original; ///< original positions of roi (size: ros + boundary_of_ros)
|
||||
std::vector<Point> solution; ///< storing position of ros vertices during iterations (size: ros + boundary_of_ros)
|
||||
|
|
@ -292,71 +293,71 @@ public:
|
|||
|
||||
/// \cond SKIP_FROM_MANUAL
|
||||
//vertex_point_map set by default
|
||||
Surface_mesh_deformation(Halfedge_graph& halfedge_graph,
|
||||
Surface_mesh_deformation(Triangle_mesh& triangle_mesh,
|
||||
Vertex_index_map vertex_index_map,
|
||||
Hedge_index_map hedge_index_map
|
||||
)
|
||||
: m_halfedge_graph(halfedge_graph), vertex_index_map(vertex_index_map), hedge_index_map(hedge_index_map),
|
||||
ros_id_map(std::vector<std::size_t>(num_vertices(halfedge_graph), (std::numeric_limits<std::size_t>::max)() )),
|
||||
is_roi_map(std::vector<bool>(num_vertices(halfedge_graph), false)),
|
||||
is_ctrl_map(std::vector<bool>(num_vertices(halfedge_graph), false)),
|
||||
: m_triangle_mesh(triangle_mesh), vertex_index_map(vertex_index_map), hedge_index_map(hedge_index_map),
|
||||
ros_id_map(std::vector<std::size_t>(num_vertices(triangle_mesh), (std::numeric_limits<std::size_t>::max)() )),
|
||||
is_roi_map(std::vector<bool>(num_vertices(triangle_mesh), false)),
|
||||
is_ctrl_map(std::vector<bool>(num_vertices(triangle_mesh), false)),
|
||||
m_iterations(5), m_tolerance(1e-4),
|
||||
need_preprocess_factorization(true),
|
||||
need_preprocess_region_of_solution(true),
|
||||
last_preprocess_successful(false),
|
||||
weight_calculator(Weight_calculator()),
|
||||
vertex_point_map(get(vertex_point, halfedge_graph))
|
||||
vertex_point_map(get(vertex_point, triangle_mesh))
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
//vertex_point_map and hedge_index_map set by default
|
||||
Surface_mesh_deformation(Halfedge_graph& halfedge_graph,
|
||||
Surface_mesh_deformation(Triangle_mesh& triangle_mesh,
|
||||
Vertex_index_map vertex_index_map
|
||||
)
|
||||
: m_halfedge_graph(halfedge_graph), vertex_index_map(vertex_index_map),
|
||||
hedge_index_map(get(boost::halfedge_index, halfedge_graph)),
|
||||
ros_id_map(std::vector<std::size_t>(num_vertices(halfedge_graph), (std::numeric_limits<std::size_t>::max)() )),
|
||||
is_roi_map(std::vector<bool>(num_vertices(halfedge_graph), false)),
|
||||
is_ctrl_map(std::vector<bool>(num_vertices(halfedge_graph), false)),
|
||||
: m_triangle_mesh(triangle_mesh), vertex_index_map(vertex_index_map),
|
||||
hedge_index_map(get(boost::halfedge_index, triangle_mesh)),
|
||||
ros_id_map(std::vector<std::size_t>(num_vertices(triangle_mesh), (std::numeric_limits<std::size_t>::max)() )),
|
||||
is_roi_map(std::vector<bool>(num_vertices(triangle_mesh), false)),
|
||||
is_ctrl_map(std::vector<bool>(num_vertices(triangle_mesh), false)),
|
||||
m_iterations(5), m_tolerance(1e-4),
|
||||
need_preprocess_factorization(true),
|
||||
need_preprocess_region_of_solution(true),
|
||||
last_preprocess_successful(false),
|
||||
weight_calculator(Weight_calculator()),
|
||||
vertex_point_map(get(vertex_point, halfedge_graph))
|
||||
vertex_point_map(get(vertex_point, triangle_mesh))
|
||||
{
|
||||
init();
|
||||
}
|
||||
//vertex_point_map, hedge_index_map and vertex_index_map set by default
|
||||
Surface_mesh_deformation(Halfedge_graph& halfedge_graph)
|
||||
: m_halfedge_graph(halfedge_graph),
|
||||
vertex_index_map(get(boost::vertex_index, halfedge_graph)),
|
||||
hedge_index_map(get(boost::halfedge_index, halfedge_graph)),
|
||||
ros_id_map(std::vector<std::size_t>(num_vertices(halfedge_graph), (std::numeric_limits<std::size_t>::max)() )),
|
||||
is_roi_map(std::vector<bool>(num_vertices(halfedge_graph), false)),
|
||||
is_ctrl_map(std::vector<bool>(num_vertices(halfedge_graph), false)),
|
||||
Surface_mesh_deformation(Triangle_mesh& triangle_mesh)
|
||||
: m_triangle_mesh(triangle_mesh),
|
||||
vertex_index_map(get(boost::vertex_index, triangle_mesh)),
|
||||
hedge_index_map(get(boost::halfedge_index, triangle_mesh)),
|
||||
ros_id_map(std::vector<std::size_t>(num_vertices(triangle_mesh), (std::numeric_limits<std::size_t>::max)() )),
|
||||
is_roi_map(std::vector<bool>(num_vertices(triangle_mesh), false)),
|
||||
is_ctrl_map(std::vector<bool>(num_vertices(triangle_mesh), false)),
|
||||
m_iterations(5), m_tolerance(1e-4),
|
||||
need_preprocess_factorization(true),
|
||||
need_preprocess_region_of_solution(true),
|
||||
last_preprocess_successful(false),
|
||||
weight_calculator(Weight_calculator()),
|
||||
vertex_point_map(get(vertex_point, halfedge_graph))
|
||||
vertex_point_map(get(vertex_point, triangle_mesh))
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
// Constructor with all the parameters provided
|
||||
Surface_mesh_deformation(Halfedge_graph& halfedge_graph,
|
||||
Surface_mesh_deformation(Triangle_mesh& triangle_mesh,
|
||||
Vertex_index_map vertex_index_map,
|
||||
Hedge_index_map hedge_index_map,
|
||||
Vertex_point_map vertex_point_map,
|
||||
Weight_calculator weight_calculator = Weight_calculator()
|
||||
)
|
||||
: m_halfedge_graph(halfedge_graph), vertex_index_map(vertex_index_map), hedge_index_map(hedge_index_map),
|
||||
ros_id_map(std::vector<std::size_t>(num_vertices(halfedge_graph), (std::numeric_limits<std::size_t>::max)() )),
|
||||
is_roi_map(std::vector<bool>(num_vertices(halfedge_graph), false)),
|
||||
is_ctrl_map(std::vector<bool>(num_vertices(halfedge_graph), false)),
|
||||
: m_triangle_mesh(triangle_mesh), vertex_index_map(vertex_index_map), hedge_index_map(hedge_index_map),
|
||||
ros_id_map(std::vector<std::size_t>(num_vertices(triangle_mesh), (std::numeric_limits<std::size_t>::max)() )),
|
||||
is_roi_map(std::vector<bool>(num_vertices(triangle_mesh), false)),
|
||||
is_ctrl_map(std::vector<bool>(num_vertices(triangle_mesh), false)),
|
||||
m_iterations(5), m_tolerance(1e-4),
|
||||
need_preprocess_factorization(true),
|
||||
need_preprocess_region_of_solution(true),
|
||||
|
|
@ -373,17 +374,17 @@ public:
|
|||
/**
|
||||
* The constructor of a deformation object
|
||||
*
|
||||
* @pre the halfedge_graph consists of only triangular facets
|
||||
* @param halfedge_graph triangulated surface mesh to deform
|
||||
* @param vertex_index_map property map which associates an id to each vertex, from `0` to `num_vertices(halfedge_graph)-1`.
|
||||
* @param hedge_index_map property map which associates an id to each halfedge, from `0` to `2*num_edges(halfedge_graph)-1`.
|
||||
* @param vertex_point_map property map which associates a point to each vertex of the graph.
|
||||
* @pre `triangle_mesh` consists of only triangular facets
|
||||
* @param triangle_mesh triangulated surface mesh to deform
|
||||
* @param vertex_index_map property map which associates an id to each vertex, from `0` to `num_vertices(triangle_mesh)-1`.
|
||||
* @param hedge_index_map property map which associates an id to each halfedge, from `0` to `2*num_edges(triangle_mesh)-1`.
|
||||
* @param vertex_point_map property map which associates a point to each vertex of the triangle mesh.
|
||||
* @param weight_calculator function object or pointer for weight calculation
|
||||
*/
|
||||
Surface_mesh_deformation(Halfedge_graph& halfedge_graph,
|
||||
Vertex_index_map vertex_index_map=get(boost::vertex_index, halfedge_graph),
|
||||
Hedge_index_map hedge_index_map=get(boost::halfedge_index, halfedge_graph),
|
||||
Vertex_point_map vertex_point_map=get(boost::vertex_point, halfedge_graph),
|
||||
Surface_mesh_deformation(Triangle_mesh& triangle_mesh,
|
||||
Vertex_index_map vertex_index_map=get(boost::vertex_index, triangle_mesh),
|
||||
Hedge_index_map hedge_index_map=get(boost::halfedge_index, triangle_mesh),
|
||||
Vertex_point_map vertex_point_map=get(boost::vertex_point, triangle_mesh),
|
||||
Weight_calculator weight_calculator = Weight_calculator()
|
||||
);
|
||||
/// @}
|
||||
|
|
@ -394,11 +395,11 @@ private:
|
|||
typedef internal::SC_on_the_fly_pmap<Vertex_point_map> Wrapper;
|
||||
// compute halfedge weights
|
||||
halfedge_iterator eb, ee;
|
||||
hedge_weight.reserve(2*num_edges(m_halfedge_graph));
|
||||
for(cpp11::tie(eb, ee) = halfedges(m_halfedge_graph); eb != ee; ++eb)
|
||||
hedge_weight.reserve(2*num_edges(m_triangle_mesh));
|
||||
for(cpp11::tie(eb, ee) = halfedges(m_triangle_mesh); eb != ee; ++eb)
|
||||
{
|
||||
hedge_weight.push_back(
|
||||
this->weight_calculator(*eb, m_halfedge_graph, Wrapper(vertex_point_map)));
|
||||
this->weight_calculator(*eb, m_triangle_mesh, Wrapper(vertex_point_map)));
|
||||
}
|
||||
#ifdef CGAL_DEFORM_MESH_USE_EXPERIMENTAL_SR_ARAP
|
||||
m_sr_arap_alpha=2;
|
||||
|
|
@ -417,8 +418,8 @@ public:
|
|||
// clear roi vertices
|
||||
roi.clear();
|
||||
//set to false all bits
|
||||
is_roi_map.assign(num_vertices(m_halfedge_graph), false);
|
||||
is_ctrl_map.assign(num_vertices(m_halfedge_graph), false);
|
||||
is_roi_map.assign(num_vertices(m_triangle_mesh), false);
|
||||
is_ctrl_map.assign(num_vertices(m_triangle_mesh), false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -427,7 +428,7 @@ public:
|
|||
void clear_control_vertices(){
|
||||
need_preprocess_factorization=true;
|
||||
//set to false all bits
|
||||
is_ctrl_map.assign(num_vertices(m_halfedge_graph), false);
|
||||
is_ctrl_map.assign(num_vertices(m_triangle_mesh), false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -684,7 +685,7 @@ public:
|
|||
|
||||
/**
|
||||
* Deforms the region-of-interest according to the deformation algorithm, using the target positions of each control vertex set by using `rotate()`, `translate()`, or `set_target_position()`.
|
||||
* The points associated to each vertex of the input graph that are inside the region-of-interest are updated.
|
||||
* The points associated to each vertex of the input triangle mesh that are inside the region-of-interest are updated.
|
||||
* \note Nothing happens if `preprocess()` returns `false`.
|
||||
* @see set_iterations(unsigned int iterations), set_tolerance(double tolerance), deform(unsigned int iterations, double tolerance)
|
||||
*/
|
||||
|
|
@ -770,7 +771,7 @@ public:
|
|||
|
||||
/**
|
||||
* Sets the initial positions of the vertices from the region-of-interest to the current positions. Calling this function has the same effect as creating
|
||||
* a new deformation object with the current deformed halfedge-graph, keeping the region-of-interest and the set of control vertices.
|
||||
* a new deformation object with the current deformed triangle mesh, keeping the region-of-interest and the set of control vertices.
|
||||
* \note if the region-of-interest or the set of control vertices have been modified since the last call to `preprocess()`,
|
||||
* it will be called prior to the overwrite.
|
||||
*
|
||||
|
|
@ -797,23 +798,23 @@ public:
|
|||
}
|
||||
|
||||
// now I need to compute weights for halfedges incident to roi vertices
|
||||
std::vector<bool> is_weight_computed(2*num_edges(m_halfedge_graph), false);
|
||||
std::vector<bool> is_weight_computed(2*num_edges(m_triangle_mesh), false);
|
||||
BOOST_FOREACH(vertex_descriptor vd, roi_vertices())
|
||||
{
|
||||
in_edge_iterator e, e_end;
|
||||
for (cpp11::tie(e,e_end) = in_edges(vd, m_halfedge_graph); e != e_end; e++)
|
||||
for (cpp11::tie(e,e_end) = in_edges(vd, m_triangle_mesh); e != e_end; e++)
|
||||
{
|
||||
halfedge_descriptor he = halfedge(*e, m_halfedge_graph);
|
||||
halfedge_descriptor he = halfedge(*e, m_triangle_mesh);
|
||||
std::size_t id_e = id(he);
|
||||
if(is_weight_computed[id_e]) { continue; }
|
||||
|
||||
hedge_weight[id_e] = weight_calculator(he, m_halfedge_graph, Wrapper(vertex_point_map));
|
||||
hedge_weight[id_e] = weight_calculator(he, m_triangle_mesh, Wrapper(vertex_point_map));
|
||||
is_weight_computed[id_e] = true;
|
||||
|
||||
halfedge_descriptor e_opp = opposite(he, m_halfedge_graph);
|
||||
halfedge_descriptor e_opp = opposite(he, m_triangle_mesh);
|
||||
std::size_t id_e_opp = id(e_opp);
|
||||
|
||||
hedge_weight[id_e_opp] = weight_calculator(e_opp, m_halfedge_graph, Wrapper(vertex_point_map));
|
||||
hedge_weight[id_e_opp] = weight_calculator(e_opp, m_triangle_mesh, Wrapper(vertex_point_map));
|
||||
is_weight_computed[id_e_opp] = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -879,10 +880,12 @@ public:
|
|||
{ return is_ctrl_map[id(vd)]; }
|
||||
|
||||
/**
|
||||
* Provides access to the halfedge graph being deformed
|
||||
* Provides access to the triangle mesh being deformed
|
||||
*/
|
||||
const Halfedge_graph& halfedge_graph() const
|
||||
{ return m_halfedge_graph; }
|
||||
const Triangle_mesh& triangle_mesh() const
|
||||
{ return m_triangle_mesh; }
|
||||
const Triangle_mesh& halfedge_graph() const
|
||||
{ return m_triangle_mesh; }
|
||||
|
||||
/// @} Utilities
|
||||
|
||||
|
|
@ -895,9 +898,9 @@ private:
|
|||
std::vector<vertex_descriptor>& push_vector)
|
||||
{
|
||||
in_edge_iterator e, e_end;
|
||||
for (cpp11::tie(e,e_end) = in_edges(vd, m_halfedge_graph); e != e_end; e++)
|
||||
for (cpp11::tie(e,e_end) = in_edges(vd, m_triangle_mesh); e != e_end; e++)
|
||||
{
|
||||
vertex_descriptor vt = source(*e, m_halfedge_graph);
|
||||
vertex_descriptor vt = source(*e, m_triangle_mesh);
|
||||
if(ros_id(vt) == (std::numeric_limits<std::size_t>::max)()) // neighboring vertex which is outside of roi and not visited previously (i.e. need an id)
|
||||
{
|
||||
ros_id(vt) = next_id++;
|
||||
|
|
@ -945,7 +948,7 @@ private:
|
|||
ros.clear(); // clear ros
|
||||
ros.insert(ros.end(), roi.begin(), roi.end());
|
||||
|
||||
ros_id_map.assign(num_vertices(m_halfedge_graph), (std::numeric_limits<std::size_t>::max)()); // use max as not assigned mark
|
||||
ros_id_map.assign(num_vertices(m_triangle_mesh), (std::numeric_limits<std::size_t>::max)()); // use max as not assigned mark
|
||||
|
||||
for(std::size_t i = 0; i < roi.size(); i++) // assign id to all roi vertices
|
||||
{ ros_id(roi[i]) = i; }
|
||||
|
|
@ -1050,12 +1053,12 @@ private:
|
|||
{
|
||||
double diagonal = 0;
|
||||
in_edge_iterator e, e_end;
|
||||
for (cpp11::tie(e,e_end) = in_edges(vi, m_halfedge_graph); e != e_end; e++)
|
||||
for (cpp11::tie(e,e_end) = in_edges(vi, m_triangle_mesh); e != e_end; e++)
|
||||
{
|
||||
halfedge_descriptor he = halfedge(*e, m_halfedge_graph);
|
||||
vertex_descriptor vj = source(he, m_halfedge_graph);
|
||||
halfedge_descriptor he = halfedge(*e, m_triangle_mesh);
|
||||
vertex_descriptor vj = source(he, m_triangle_mesh);
|
||||
double wij = hedge_weight[id(he)]; // edge(pi - pj)
|
||||
double wji = hedge_weight[id(opposite(he, m_halfedge_graph))]; // edge(pi - pj)
|
||||
double wji = hedge_weight[id(opposite(he, m_triangle_mesh))]; // edge(pi - pj)
|
||||
double total_weight = wij + wji;
|
||||
|
||||
A.set_coef(vi_id, ros_id(vj), -total_weight, true); // off-diagonal coefficient
|
||||
|
|
@ -1093,27 +1096,27 @@ private:
|
|||
{
|
||||
double diagonal = 0;
|
||||
out_edge_iterator e, e_end;
|
||||
for (cpp11::tie(e,e_end) = out_edges(vi, m_halfedge_graph); e != e_end; e++)
|
||||
for (cpp11::tie(e,e_end) = out_edges(vi, m_triangle_mesh); e != e_end; e++)
|
||||
{
|
||||
halfedge_descriptor he = halfedge(*e, m_halfedge_graph);
|
||||
halfedge_descriptor he = halfedge(*e, m_triangle_mesh);
|
||||
double total_weight = 0;
|
||||
// an edge contribute to energy only if it is part of an incident triangle
|
||||
// (i.e it should not be a border edge)
|
||||
if(!is_border(he, m_halfedge_graph))
|
||||
if(!is_border(he, m_triangle_mesh))
|
||||
{
|
||||
double wji = hedge_weight[id(he)]; // edge(pj - pi)
|
||||
total_weight += wji;
|
||||
}
|
||||
|
||||
halfedge_descriptor opp = opposite(he, m_halfedge_graph);
|
||||
if(!is_border(opp, m_halfedge_graph))
|
||||
halfedge_descriptor opp = opposite(he, m_triangle_mesh);
|
||||
if(!is_border(opp, m_triangle_mesh))
|
||||
{
|
||||
double wij = hedge_weight[id(opp)]; // edge(pi - pj)
|
||||
total_weight += wij;
|
||||
}
|
||||
|
||||
// place coefficient to matrix
|
||||
vertex_descriptor vj = target(he, m_halfedge_graph);
|
||||
vertex_descriptor vj = target(he, m_triangle_mesh);
|
||||
A.set_coef(vi_id, ros_id(vj), -total_weight, true); // off-diagonal coefficient
|
||||
diagonal += total_weight;
|
||||
}
|
||||
|
|
@ -1160,13 +1163,13 @@ private:
|
|||
in_edge_iterator e, e_end;
|
||||
|
||||
#ifdef CGAL_DEFORM_MESH_USE_EXPERIMENTAL_SR_ARAP
|
||||
cpp11::tie(e,e_end) = in_edges(vi, m_halfedge_graph);
|
||||
cpp11::tie(e,e_end) = in_edges(vi, m_triangle_mesh);
|
||||
double ne_i=std::distance(e,e_end);
|
||||
#endif
|
||||
for (cpp11::tie(e,e_end) = in_edges(vi, m_halfedge_graph); e != e_end; e++)
|
||||
for (cpp11::tie(e,e_end) = in_edges(vi, m_triangle_mesh); e != e_end; e++)
|
||||
{
|
||||
halfedge_descriptor he=halfedge(*e, m_halfedge_graph);
|
||||
vertex_descriptor vj = source(he, m_halfedge_graph);
|
||||
halfedge_descriptor he=halfedge(*e, m_triangle_mesh);
|
||||
vertex_descriptor vj = source(he, m_triangle_mesh);
|
||||
std::size_t vj_id = ros_id(vj);
|
||||
|
||||
const CR_vector& pij = sub_to_CR_vector(original[vi_id], original[vj_id]);
|
||||
|
|
@ -1199,16 +1202,16 @@ private:
|
|||
|
||||
//iterate through all triangles
|
||||
out_edge_iterator e, e_end;
|
||||
for (cpp11::tie(e,e_end) = out_edges(vi, m_halfedge_graph); e != e_end; e++)
|
||||
for (cpp11::tie(e,e_end) = out_edges(vi, m_triangle_mesh); e != e_end; e++)
|
||||
{
|
||||
halfedge_descriptor he = halfedge(*e, m_halfedge_graph);
|
||||
if(is_border(he, m_halfedge_graph)) { continue; } // no facet
|
||||
halfedge_descriptor he = halfedge(*e, m_triangle_mesh);
|
||||
if(is_border(he, m_triangle_mesh)) { continue; } // no facet
|
||||
// iterate edges around facet
|
||||
halfedge_descriptor hedge_around_facet = he;
|
||||
do
|
||||
{
|
||||
vertex_descriptor v1 = target(hedge_around_facet, m_halfedge_graph);
|
||||
vertex_descriptor v2 = source(hedge_around_facet, m_halfedge_graph);
|
||||
vertex_descriptor v1 = target(hedge_around_facet, m_triangle_mesh);
|
||||
vertex_descriptor v2 = source(hedge_around_facet, m_triangle_mesh);
|
||||
|
||||
std::size_t v1_id = ros_id(v1); std::size_t v2_id = ros_id(v2);
|
||||
|
||||
|
|
@ -1218,7 +1221,7 @@ private:
|
|||
|
||||
cr_traits.add_scalar_t_vector_t_vector_transpose(cov, w12, p12, q12); // cov += w12 * (p12 * q12);
|
||||
|
||||
} while( (hedge_around_facet = next(hedge_around_facet, m_halfedge_graph)) != he);
|
||||
} while( (hedge_around_facet = next(hedge_around_facet, m_triangle_mesh)) != he);
|
||||
}
|
||||
|
||||
cr_traits.compute_close_rotation(cov, rot_mtr[vi_id]);
|
||||
|
|
@ -1236,10 +1239,10 @@ private:
|
|||
double eT_eR = 0, eRT_eR = 0;
|
||||
|
||||
in_edge_iterator e, e_end;
|
||||
for (cpp11::tie(e,e_end) = in_edges(vi, m_halfedge_graph); e != e_end; e++)
|
||||
for (cpp11::tie(e,e_end) = in_edges(vi, m_triangle_mesh); e != e_end; e++)
|
||||
{
|
||||
halfedge_descriptor he = *e;
|
||||
vertex_descriptor vj = source(he, m_halfedge_graph);
|
||||
vertex_descriptor vj = source(he, m_triangle_mesh);
|
||||
std::size_t vj_id = ros_id(vj);
|
||||
|
||||
const CR_vector& pij = sub_to_CR_vector(original[vi_id], original[vj_id]);
|
||||
|
|
@ -1290,16 +1293,16 @@ private:
|
|||
CR_vector xyz = cr_traits.vector(0, 0, 0);
|
||||
|
||||
in_edge_iterator e, e_end;
|
||||
for (cpp11::tie(e,e_end) = in_edges(vi, m_halfedge_graph); e != e_end; e++)
|
||||
for (cpp11::tie(e,e_end) = in_edges(vi, m_triangle_mesh); e != e_end; e++)
|
||||
{
|
||||
halfedge_descriptor he = halfedge(*e, m_halfedge_graph);
|
||||
vertex_descriptor vj = source(he, m_halfedge_graph);
|
||||
halfedge_descriptor he = halfedge(*e, m_triangle_mesh);
|
||||
vertex_descriptor vj = source(he, m_triangle_mesh);
|
||||
std::size_t vj_id = ros_id(vj);
|
||||
|
||||
const CR_vector& pij = sub_to_CR_vector(original[vi_id], original[vj_id]);
|
||||
|
||||
double wij = hedge_weight[id(he)];
|
||||
double wji = hedge_weight[id(opposite(he, m_halfedge_graph))];
|
||||
double wji = hedge_weight[id(opposite(he, m_triangle_mesh))];
|
||||
#ifndef CGAL_DEFORM_MESH_USE_EXPERIMENTAL_SCALE
|
||||
cr_traits.add__scalar_t_matrix_p_scalar_t_matrix__t_vector(xyz, wij, rot_mtr[vi_id], wji, rot_mtr[vj_id], pij);
|
||||
#else
|
||||
|
|
@ -1354,26 +1357,26 @@ private:
|
|||
CR_vector xyz = cr_traits.vector(0, 0, 0);
|
||||
|
||||
out_edge_iterator e, e_end;
|
||||
for (cpp11::tie(e,e_end) = out_edges(vi, m_halfedge_graph); e != e_end; e++)
|
||||
for (cpp11::tie(e,e_end) = out_edges(vi, m_triangle_mesh); e != e_end; e++)
|
||||
{
|
||||
halfedge_descriptor he = halfedge(*e, m_halfedge_graph);
|
||||
vertex_descriptor vj = target(he, m_halfedge_graph);
|
||||
halfedge_descriptor he = halfedge(*e, m_triangle_mesh);
|
||||
vertex_descriptor vj = target(he, m_triangle_mesh);
|
||||
std::size_t vj_id = ros_id(vj);
|
||||
|
||||
const CR_vector& pij = sub_to_CR_vector(original[vi_id], original[vj_id]);
|
||||
|
||||
if(!is_border(he, m_halfedge_graph))
|
||||
if(!is_border(he, m_triangle_mesh))
|
||||
{
|
||||
vertex_descriptor vn = target(next(he, m_halfedge_graph), m_halfedge_graph); // opp vertex of e_ij
|
||||
vertex_descriptor vn = target(next(he, m_triangle_mesh), m_triangle_mesh); // opp vertex of e_ij
|
||||
double wji = hedge_weight[id(he)] / 3.0; // edge(pj - pi)
|
||||
cr_traits.add_scalar_t_matrix_sum_t_vector(xyz, wji, rot_mtr[vi_id], rot_mtr[vj_id], rot_mtr[ros_id(vn)], pij);
|
||||
// corresponds xyz += wji*(rot_mtr[vi_id] + rot_mtr[vj_id] + rot_mtr[ros_id(vn)])*pij;
|
||||
}
|
||||
|
||||
halfedge_descriptor opp = opposite(he, m_halfedge_graph);
|
||||
if(!is_border(opp, m_halfedge_graph))
|
||||
halfedge_descriptor opp = opposite(he, m_triangle_mesh);
|
||||
if(!is_border(opp, m_triangle_mesh))
|
||||
{
|
||||
vertex_descriptor vm = target(next(opp, m_halfedge_graph), m_halfedge_graph); // other opp vertex of e_ij
|
||||
vertex_descriptor vm = target(next(opp, m_triangle_mesh), m_triangle_mesh); // other opp vertex of e_ij
|
||||
double wij = hedge_weight[id(opp)] / 3.0; // edge(pi - pj)
|
||||
cr_traits.add_scalar_t_matrix_sum_t_vector(xyz, wij, rot_mtr[vi_id], rot_mtr[vj_id], rot_mtr[ros_id(vm)], pij);
|
||||
// corresponds xyz += wij * ( rot_mtr[vi_id] + rot_mtr[vj_id] + rot_mtr[ros_id(vm)] ) * pij
|
||||
|
|
@ -1442,10 +1445,10 @@ private:
|
|||
std::size_t vi_id = ros_id(vi);
|
||||
|
||||
in_edge_iterator e, e_end;
|
||||
for (cpp11::tie(e,e_end) = in_edges(vi, m_halfedge_graph); e != e_end; e++)
|
||||
for (cpp11::tie(e,e_end) = in_edges(vi, m_triangle_mesh); e != e_end; e++)
|
||||
{
|
||||
halfedge_descriptor he = halfedge(*e, m_halfedge_graph);
|
||||
vertex_descriptor vj = source(he, m_halfedge_graph);
|
||||
halfedge_descriptor he = halfedge(*e, m_triangle_mesh);
|
||||
vertex_descriptor vj = source(he, m_triangle_mesh);
|
||||
std::size_t vj_id = ros_id(vj);
|
||||
|
||||
const CR_vector& pij = sub_to_CR_vector(original[vi_id], original[vj_id]);
|
||||
|
|
@ -1471,16 +1474,16 @@ private:
|
|||
std::size_t vi_id = ros_id(vi);
|
||||
//iterate through all triangles
|
||||
out_edge_iterator e, e_end;
|
||||
for (cpp11::tie(e,e_end) = out_edges(vi, m_halfedge_graph); e != e_end; e++)
|
||||
for (cpp11::tie(e,e_end) = out_edges(vi, m_triangle_mesh); e != e_end; e++)
|
||||
{
|
||||
halfedge_descriptor he = halfedge(*e, m_halfedge_graph);
|
||||
if(is_border(he, m_halfedge_graph)) { continue; } // no facet
|
||||
halfedge_descriptor he = halfedge(*e, m_triangle_mesh);
|
||||
if(is_border(he, m_triangle_mesh)) { continue; } // no facet
|
||||
// iterate edges around facet
|
||||
halfedge_descriptor hedge_around_facet = he;
|
||||
do
|
||||
{
|
||||
vertex_descriptor v1 = target(hedge_around_facet, m_halfedge_graph);
|
||||
vertex_descriptor v2 = source(hedge_around_facet, m_halfedge_graph);
|
||||
vertex_descriptor v1 = target(hedge_around_facet, m_triangle_mesh);
|
||||
vertex_descriptor v2 = source(hedge_around_facet, m_triangle_mesh);
|
||||
std::size_t v1_id = ros_id(v1); std::size_t v2_id = ros_id(v2);
|
||||
|
||||
const CR_vector& p12 = sub_to_CR_vector(original[v1_id], original[v2_id]);
|
||||
|
|
@ -1490,7 +1493,7 @@ private:
|
|||
sum_of_energy += w12 * cr_traits.squared_norm_vector_scalar_vector_subs(q12, rot_mtr[vi_id], p12);
|
||||
// sum_of_energy += w12 * ( q12 - rot_mtr[vi_id]*p12 )^2
|
||||
|
||||
} while( (hedge_around_facet = next(hedge_around_facet, m_halfedge_graph)) != he);
|
||||
} while( (hedge_around_facet = next(hedge_around_facet, m_triangle_mesh)) != he);
|
||||
}
|
||||
}
|
||||
return sum_of_energy;
|
||||
|
|
|
|||
|
|
@ -28,11 +28,11 @@ namespace CGAL
|
|||
|
||||
|
||||
/// @cond SKIP_IN_MANUAL
|
||||
template <bool Fast_sdf_calculation_mode, class Polyhedron,
|
||||
template <bool Fast_sdf_calculation_mode, class TriangleMesh,
|
||||
class SDFPropertyMap,
|
||||
class PointPropertyMap
|
||||
#ifdef DOXYGEN_RUNNING
|
||||
= typename boost::property_map<Polyhedron, boost::vertex_point_t>::type
|
||||
= typename boost::property_map<TriangleMesh, boost::vertex_point_t>::type
|
||||
#endif
|
||||
, class GeomTraits
|
||||
#ifdef DOXYGEN_RUNNING
|
||||
|
|
@ -40,7 +40,7 @@ template <bool Fast_sdf_calculation_mode, class Polyhedron,
|
|||
#endif
|
||||
>
|
||||
std::pair<double, double>
|
||||
sdf_values( const Polyhedron& polyhedron,
|
||||
sdf_values( const TriangleMesh& triangle_mesh,
|
||||
SDFPropertyMap sdf_values_map,
|
||||
double cone_angle = 2.0 / 3.0 * CGAL_PI,
|
||||
std::size_t number_of_rays = 25,
|
||||
|
|
@ -49,8 +49,8 @@ sdf_values( const Polyhedron& polyhedron,
|
|||
GeomTraits traits = GeomTraits())
|
||||
{
|
||||
typedef PointPropertyMap VPMap;
|
||||
internal::Surface_mesh_segmentation<Polyhedron, GeomTraits, VPMap, Fast_sdf_calculation_mode>
|
||||
algorithm(polyhedron, traits, ppmap);
|
||||
internal::Surface_mesh_segmentation<TriangleMesh, GeomTraits, VPMap, Fast_sdf_calculation_mode>
|
||||
algorithm(triangle_mesh, traits, ppmap);
|
||||
return algorithm.calculate_sdf_values(cone_angle, number_of_rays,
|
||||
sdf_values_map, postprocess);
|
||||
}
|
||||
|
|
@ -64,26 +64,26 @@ sdf_values( const Polyhedron& polyhedron,
|
|||
* It is possible to compute raw SDF values (without post-processing). In such a case,
|
||||
* -1 is used to indicate when no SDF value could be computed for a facet.
|
||||
*
|
||||
* @pre @a polyhedron.is_pure_triangle()
|
||||
* @pre @a triangle_mesh.is_pure_triangle()
|
||||
*
|
||||
* @tparam Polyhedron a model of `FaceListGraph`
|
||||
* @tparam SDFPropertyMap a `ReadWritePropertyMap` with `boost::graph_traits<Polyhedron>::%face_descriptor` as key and `double` as value type
|
||||
* @tparam TriangleMesh a model of `FaceListGraph`
|
||||
* @tparam SDFPropertyMap a `ReadWritePropertyMap` with `boost::graph_traits<TriangleMesh>::%face_descriptor` as key and `double` as value type
|
||||
* @tparam GeomTraits a model of `SegmentationGeomTraits`
|
||||
* @tparam PointPropertyMap a `ReadablePropertyMap` with `boost::graph_traits<Polyhedron>::%vertex_descriptor` as key and `GeomTraits::Point_3` as value type.
|
||||
* @tparam PointPropertyMap a `ReadablePropertyMap` with `boost::graph_traits<TriangleMesh>::%vertex_descriptor` as key and `GeomTraits::Point_3` as value type.
|
||||
*
|
||||
* @param polyhedron surface mesh on which SDF values are computed
|
||||
* @param triangle_mesh surface mesh on which SDF values are computed
|
||||
* @param[out] sdf_values_map the SDF value of each facet
|
||||
* @param cone_angle opening angle in radians for the cone of each facet
|
||||
* @param number_of_rays number of rays picked in the cone of each facet. In our experiments, we observe that increasing the number of rays beyond the default has little effect on the quality of the segmentation result
|
||||
* @param postprocess if `true`, `CGAL::sdf_values_postprocessing()` is called on raw SDF value computed.
|
||||
* @param traits traits class
|
||||
* @param ppmap point property map. An overload is provided with `get(boost::vertex_point,polyhedron)` as default.
|
||||
* @param ppmap point property map. An overload is provided with `get(boost::vertex_point,triangle_mesh)` as default.
|
||||
*
|
||||
* @return minimum and maximum raw SDF values if @a postprocess is `true`, otherwise minimum and maximum SDF values (before linear normalization)
|
||||
*/
|
||||
template <class Polyhedron, class SDFPropertyMap, class PointPropertyMap
|
||||
template <class TriangleMesh, class SDFPropertyMap, class PointPropertyMap
|
||||
#ifdef DOXYGEN_RUNNING
|
||||
= typename boost::property_map<Polyhedron, boost::vertex_point_t>::type
|
||||
= typename boost::property_map<TriangleMesh, boost::vertex_point_t>::type
|
||||
#endif
|
||||
, class GeomTraits
|
||||
#ifdef DOXYGEN_RUNNING
|
||||
|
|
@ -91,7 +91,7 @@ template <class Polyhedron, class SDFPropertyMap, class PointPropertyMap
|
|||
#endif
|
||||
>
|
||||
std::pair<double, double>
|
||||
sdf_values( const Polyhedron& polyhedron,
|
||||
sdf_values( const TriangleMesh& triangle_mesh,
|
||||
SDFPropertyMap sdf_values_map,
|
||||
double cone_angle = 2.0 / 3.0 * CGAL_PI,
|
||||
std::size_t number_of_rays = 25,
|
||||
|
|
@ -99,8 +99,8 @@ sdf_values( const Polyhedron& polyhedron,
|
|||
PointPropertyMap ppmap = PointPropertyMap(),
|
||||
GeomTraits traits = GeomTraits())
|
||||
{
|
||||
return sdf_values<true, Polyhedron, SDFPropertyMap, PointPropertyMap, GeomTraits>
|
||||
(polyhedron, sdf_values_map, cone_angle, number_of_rays, postprocess, ppmap, traits);
|
||||
return sdf_values<true, TriangleMesh, SDFPropertyMap, PointPropertyMap, GeomTraits>
|
||||
(triangle_mesh, sdf_values_map, cone_angle, number_of_rays, postprocess, ppmap, traits);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -117,24 +117,24 @@ sdf_values( const Polyhedron& polyhedron,
|
|||
*
|
||||
* See the section \ref Surface_mesh_segmentationPostprocessing for more details.
|
||||
*
|
||||
* @pre @a polyhedron.is_pure_triangle()
|
||||
* @pre @a triangle_mesh.is_pure_triangle()
|
||||
* @pre Raw values should be greater or equal to 0. -1 indicates when no value could be computed
|
||||
*
|
||||
* @tparam Polyhedron a model of `FaceListGraph`
|
||||
* @tparam SDFPropertyMap a `ReadWritePropertyMap` with `boost::graph_traits<Polyhedron>::%face_descriptor` as key and `double` as value type
|
||||
* @tparam TriangleMesh a model of `FaceListGraph`
|
||||
* @tparam SDFPropertyMap a `ReadWritePropertyMap` with `boost::graph_traits<TriangleMesh>::%face_descriptor` as key and `double` as value type
|
||||
*
|
||||
* @param polyhedron surface mesh on which SDF values are computed
|
||||
* @param triangle_mesh surface mesh on which SDF values are computed
|
||||
* @param[in, out] sdf_values_map the SDF value of each facet
|
||||
*
|
||||
* @return minimum and maximum SDF values before linear normalization
|
||||
*/
|
||||
template<class Polyhedron, class SDFPropertyMap>
|
||||
template<class TriangleMesh, class SDFPropertyMap>
|
||||
std::pair<double, double>
|
||||
sdf_values_postprocessing(const Polyhedron& polyhedron,
|
||||
sdf_values_postprocessing(const TriangleMesh& triangle_mesh,
|
||||
SDFPropertyMap sdf_values_map)
|
||||
{
|
||||
CGAL_precondition(polyhedron.is_pure_triangle());
|
||||
return internal::Postprocess_sdf_values<Polyhedron>().postprocess(polyhedron,
|
||||
CGAL_precondition(triangle_mesh.is_pure_triangle());
|
||||
return internal::Postprocess_sdf_values<TriangleMesh>().postprocess(triangle_mesh,
|
||||
sdf_values_map);
|
||||
}
|
||||
|
||||
|
|
@ -155,30 +155,30 @@ sdf_values_postprocessing(const Polyhedron& polyhedron,
|
|||
* \note There is no direct relation between the parameter `number_of_clusters`
|
||||
* and the final number of segments after segmentation. However, setting a large number of clusters will result in a detailed segmentation of the mesh with a large number of segments.
|
||||
*
|
||||
* @pre @a polyhedron.is_pure_triangle()
|
||||
* @pre @a triangle_mesh.is_pure_triangle()
|
||||
* @pre @a number_of_clusters > 0
|
||||
*
|
||||
* @tparam Polyhedron a model of `FaceListGraph`
|
||||
* @tparam SDFPropertyMap a `ReadablePropertyMap` with `boost::graph_traits<Polyhedron>::%face_descriptor` as key and `double` as value type
|
||||
* @tparam SegmentPropertyMap a `ReadWritePropertyMap` with `boost::graph_traits<Polyhedron>::%face_descriptor` as key and `std::size_t` as value type
|
||||
* @tparam TriangleMesh a model of `FaceListGraph`
|
||||
* @tparam SDFPropertyMap a `ReadablePropertyMap` with `boost::graph_traits<TriangleMesh>::%face_descriptor` as key and `double` as value type
|
||||
* @tparam SegmentPropertyMap a `ReadWritePropertyMap` with `boost::graph_traits<TriangleMesh>::%face_descriptor` as key and `std::size_t` as value type
|
||||
* @tparam GeomTraits a model of `SegmentationGeomTraits`
|
||||
* @tparam PointPropertyMap a `ReadablePropertyMap` with `boost::graph_traits<Polyhedron>::%vertex_descriptor` as key and `GeomTraits::Point_3` as value type.
|
||||
* @tparam PointPropertyMap a `ReadablePropertyMap` with `boost::graph_traits<TriangleMesh>::%vertex_descriptor` as key and `GeomTraits::Point_3` as value type.
|
||||
*
|
||||
* @param polyhedron surface mesh corresponding to the SDF values
|
||||
* @param triangle_mesh surface mesh corresponding to the SDF values
|
||||
* @param sdf_values_map the SDF value of each facet between [0-1]
|
||||
* @param[out] segment_ids the segment or cluster id of each facet
|
||||
* @param number_of_clusters number of clusters for the soft clustering
|
||||
* @param smoothing_lambda factor which indicates the importance of the surface features for the energy minimization. It is recommended to choose a value in the interval [0,1]. See the section \ref Surface_mesh_segmentationGraphCut for more details.
|
||||
* @param output_cluster_ids if `false` fill `segment_ids` with segment-ids, and with cluster-ids otherwise (see \cgalFigureRef{Cluster_vs_segment})
|
||||
* @param traits traits class
|
||||
* @param ppmap point property map. An overload is provided with `get(boost::vertex_point,polyhedron)` as default.
|
||||
* @param ppmap point property map. An overload is provided with `get(boost::vertex_point,triangle_mesh)` as default.
|
||||
*
|
||||
* @return number of segments if `output_cluster_ids` is set to `false` and `number_of_clusters` otherwise
|
||||
*/
|
||||
template <class Polyhedron, class SDFPropertyMap, class SegmentPropertyMap,
|
||||
template <class TriangleMesh, class SDFPropertyMap, class SegmentPropertyMap,
|
||||
class PointPropertyMap
|
||||
#ifdef DOXYGEN_RUNNING
|
||||
= typename boost::property_map<Polyhedron, boost::vertex_point_t>::type
|
||||
= typename boost::property_map<TriangleMesh, boost::vertex_point_t>::type
|
||||
#endif
|
||||
, class GeomTraits
|
||||
#ifdef DOXYGEN_RUNNING
|
||||
|
|
@ -186,7 +186,7 @@ template <class Polyhedron, class SDFPropertyMap, class SegmentPropertyMap,
|
|||
#endif
|
||||
>
|
||||
std::size_t
|
||||
segmentation_from_sdf_values( const Polyhedron& polyhedron,
|
||||
segmentation_from_sdf_values( const TriangleMesh& triangle_mesh,
|
||||
SDFPropertyMap sdf_values_map,
|
||||
SegmentPropertyMap segment_ids,
|
||||
std::size_t number_of_clusters = 5,
|
||||
|
|
@ -195,17 +195,17 @@ segmentation_from_sdf_values( const Polyhedron& polyhedron,
|
|||
PointPropertyMap ppmap=PointPropertyMap(),
|
||||
GeomTraits traits=GeomTraits())
|
||||
{
|
||||
typedef typename boost::property_map<Polyhedron, boost::vertex_point_t>::type VPMap;
|
||||
internal::Surface_mesh_segmentation<Polyhedron, GeomTraits, VPMap> algorithm(polyhedron, traits, ppmap);
|
||||
typedef typename boost::property_map<TriangleMesh, boost::vertex_point_t>::type VPMap;
|
||||
internal::Surface_mesh_segmentation<TriangleMesh, GeomTraits, VPMap> algorithm(triangle_mesh, traits, ppmap);
|
||||
return algorithm.partition(number_of_clusters, smoothing_lambda, sdf_values_map,
|
||||
segment_ids, !output_cluster_ids);
|
||||
}
|
||||
|
||||
///\cond SKIP_IN_MANUAL
|
||||
template < bool Fast_sdf_calculation_mode, class Polyhedron,
|
||||
template < bool Fast_sdf_calculation_mode, class TriangleMesh,
|
||||
class SegmentPropertyMap, class PointPropertyMap
|
||||
#ifdef DOXYGEN_RUNNING
|
||||
= typename boost::property_map<Polyhedron, boost::vertex_point_t>::type
|
||||
= typename boost::property_map<TriangleMesh, boost::vertex_point_t>::type
|
||||
#endif
|
||||
, class GeomTraits
|
||||
#ifdef DOXYGEN_RUNNING
|
||||
|
|
@ -213,7 +213,7 @@ template < bool Fast_sdf_calculation_mode, class Polyhedron,
|
|||
#endif
|
||||
>
|
||||
std::size_t
|
||||
segmentation_via_sdf_values(const Polyhedron& polyhedron,
|
||||
segmentation_via_sdf_values(const TriangleMesh& triangle_mesh,
|
||||
SegmentPropertyMap segment_ids,
|
||||
double cone_angle = 2.0 / 3.0 * CGAL_PI,
|
||||
std::size_t number_of_rays = 25,
|
||||
|
|
@ -223,17 +223,17 @@ segmentation_via_sdf_values(const Polyhedron& polyhedron,
|
|||
PointPropertyMap ppmap=PointPropertyMap(),
|
||||
GeomTraits traits=GeomTraits() )
|
||||
{
|
||||
typedef typename boost::graph_traits<Polyhedron>::face_descriptor face_descriptor;
|
||||
typedef typename boost::graph_traits<TriangleMesh>::face_descriptor face_descriptor;
|
||||
typedef std::map<face_descriptor, double>
|
||||
Facet_double_map;
|
||||
Facet_double_map internal_sdf_map;
|
||||
boost::associative_property_map<Facet_double_map> sdf_property_map(
|
||||
internal_sdf_map);
|
||||
|
||||
sdf_values<Fast_sdf_calculation_mode, Polyhedron, boost::associative_property_map<Facet_double_map>, PointPropertyMap, GeomTraits>
|
||||
(polyhedron, sdf_property_map, cone_angle, number_of_rays, true, ppmap, traits);
|
||||
return segmentation_from_sdf_values<Polyhedron, boost::associative_property_map<Facet_double_map>, SegmentPropertyMap, PointPropertyMap, GeomTraits>
|
||||
(polyhedron, sdf_property_map, segment_ids, number_of_clusters,
|
||||
sdf_values<Fast_sdf_calculation_mode, TriangleMesh, boost::associative_property_map<Facet_double_map>, PointPropertyMap, GeomTraits>
|
||||
(triangle_mesh, sdf_property_map, cone_angle, number_of_rays, true, ppmap, traits);
|
||||
return segmentation_from_sdf_values<TriangleMesh, boost::associative_property_map<Facet_double_map>, SegmentPropertyMap, PointPropertyMap, GeomTraits>
|
||||
(triangle_mesh, sdf_property_map, segment_ids, number_of_clusters,
|
||||
smoothing_lambda, output_cluster_ids, ppmap, traits);
|
||||
}
|
||||
/// \endcond
|
||||
|
|
@ -252,15 +252,15 @@ segmentation_via_sdf_values(const Polyhedron& polyhedron,
|
|||
* it is more efficient to first compute the SDF values using `CGAL::sdf_values()` and use them in different calls to
|
||||
* `CGAL::segmentation_from_sdf_values()`.
|
||||
*
|
||||
* @pre @a polyhedron.is_pure_triangle()
|
||||
* @pre @a triangle_mesh.is_pure_triangle()
|
||||
* @pre @a number_of_clusters > 0
|
||||
*
|
||||
* @tparam Polyhedron a model of `FaceListGraph`
|
||||
* @tparam SegmentPropertyMap a `ReadWritePropertyMap` with `boost::graph_traits<Polyhedron>::%face_descriptor` as key and `std::size_t` as value type
|
||||
* @tparam TriangleMesh a model of `FaceListGraph`
|
||||
* @tparam SegmentPropertyMap a `ReadWritePropertyMap` with `boost::graph_traits<TriangleMesh>::%face_descriptor` as key and `std::size_t` as value type
|
||||
* @tparam GeomTraits a model of `SegmentationGeomTraits`
|
||||
* @tparam PointPropertyMap a `ReadablePropertyMap` with `boost::graph_traits<Polyhedron>::%vertex_descriptor` as key and `GeomTraits::Point_3` as value type.
|
||||
* @tparam PointPropertyMap a `ReadablePropertyMap` with `boost::graph_traits<TriangleMesh>::%vertex_descriptor` as key and `GeomTraits::Point_3` as value type.
|
||||
*
|
||||
* @param polyhedron surface mesh on which SDF values are computed
|
||||
* @param triangle_mesh surface mesh on which SDF values are computed
|
||||
* @param[out] segment_ids the segment or cluster id of each facet
|
||||
* @param cone_angle opening angle in radians for the cone of each facet
|
||||
* @param number_of_rays number of rays picked in the cone of each facet. In our experiments, we observe that increasing the number of rays beyond the default has a little effect on the quality of the segmentation result
|
||||
|
|
@ -268,13 +268,13 @@ segmentation_via_sdf_values(const Polyhedron& polyhedron,
|
|||
* @param smoothing_lambda factor which indicates the importance of the surface features for the energy minimization. It is recommended to choose a value in the interval [0,1]. See the section \ref Surface_mesh_segmentationGraphCut for more details.
|
||||
* @param output_cluster_ids if `false` fill `segment_ids` with segment-ids, and with cluster-ids otherwise (see \cgalFigureRef{Cluster_vs_segment})
|
||||
* @param traits traits class
|
||||
* @param ppmap point property map. An overload is provided with `get(boost::vertex_point,polyhedron)` as default.
|
||||
* @param ppmap point property map. An overload is provided with `get(boost::vertex_point,triangle_mesh)` as default.
|
||||
*
|
||||
* @return number of segments if `output_cluster_ids` is set to `false` and `number_of_clusters` otherwise
|
||||
*/
|
||||
template < class Polyhedron, class SegmentPropertyMap, class PointPropertyMap
|
||||
template < class TriangleMesh, class SegmentPropertyMap, class PointPropertyMap
|
||||
#ifdef DOXYGEN_RUNNING
|
||||
= typename boost::property_map<Polyhedron, boost::vertex_point_t>::type
|
||||
= typename boost::property_map<TriangleMesh, boost::vertex_point_t>::type
|
||||
#endif
|
||||
, class GeomTraits
|
||||
#ifdef DOXYGEN_RUNNING
|
||||
|
|
@ -282,7 +282,7 @@ template < class Polyhedron, class SegmentPropertyMap, class PointPropertyMap
|
|||
#endif
|
||||
>
|
||||
std::size_t
|
||||
segmentation_via_sdf_values(const Polyhedron& polyhedron,
|
||||
segmentation_via_sdf_values(const TriangleMesh& triangle_mesh,
|
||||
SegmentPropertyMap segment_ids,
|
||||
double cone_angle = 2.0 / 3.0 * CGAL_PI,
|
||||
std::size_t number_of_rays = 25,
|
||||
|
|
@ -292,8 +292,8 @@ segmentation_via_sdf_values(const Polyhedron& polyhedron,
|
|||
PointPropertyMap ppmap=PointPropertyMap(),
|
||||
GeomTraits traits=GeomTraits())
|
||||
{
|
||||
return segmentation_via_sdf_values<true, Polyhedron, SegmentPropertyMap, PointPropertyMap, GeomTraits>
|
||||
(polyhedron, segment_ids, cone_angle, number_of_rays, number_of_clusters,
|
||||
return segmentation_via_sdf_values<true, TriangleMesh, SegmentPropertyMap, PointPropertyMap, GeomTraits>
|
||||
(triangle_mesh, segment_ids, cone_angle, number_of_rays, number_of_clusters,
|
||||
smoothing_lambda, output_cluster_ids, ppmap, traits);
|
||||
}
|
||||
|
||||
|
|
@ -301,9 +301,9 @@ segmentation_via_sdf_values(const Polyhedron& polyhedron,
|
|||
// we need these overloads for the default of the point property map
|
||||
|
||||
/// sdf_values ///
|
||||
template < bool Fast_sdf_calculation_mode, class Polyhedron, class SDFPropertyMap, class PointPropertyMap>
|
||||
template < bool Fast_sdf_calculation_mode, class TriangleMesh, class SDFPropertyMap, class PointPropertyMap>
|
||||
std::pair<double, double>
|
||||
sdf_values( const Polyhedron& polyhedron,
|
||||
sdf_values( const TriangleMesh& triangle_mesh,
|
||||
SDFPropertyMap sdf_values_map,
|
||||
double cone_angle = 2.0 / 3.0 * CGAL_PI,
|
||||
std::size_t number_of_rays = 25,
|
||||
|
|
@ -313,30 +313,30 @@ sdf_values( const Polyhedron& polyhedron,
|
|||
typedef typename boost::property_traits<PointPropertyMap>::value_type Point_3;
|
||||
typedef typename Kernel_traits<Point_3>::Kernel GeomTraits;
|
||||
GeomTraits traits;
|
||||
return sdf_values<Fast_sdf_calculation_mode, Polyhedron, SDFPropertyMap, PointPropertyMap, GeomTraits>
|
||||
(polyhedron, sdf_values_map, cone_angle, number_of_rays, postprocess, ppmap, traits);
|
||||
return sdf_values<Fast_sdf_calculation_mode, TriangleMesh, SDFPropertyMap, PointPropertyMap, GeomTraits>
|
||||
(triangle_mesh, sdf_values_map, cone_angle, number_of_rays, postprocess, ppmap, traits);
|
||||
}
|
||||
|
||||
template < bool Fast_sdf_calculation_mode, class Polyhedron, class SDFPropertyMap>
|
||||
template < bool Fast_sdf_calculation_mode, class TriangleMesh, class SDFPropertyMap>
|
||||
std::pair<double, double>
|
||||
sdf_values( const Polyhedron& polyhedron,
|
||||
sdf_values( const TriangleMesh& triangle_mesh,
|
||||
SDFPropertyMap sdf_values_map,
|
||||
double cone_angle = 2.0 / 3.0 * CGAL_PI,
|
||||
std::size_t number_of_rays = 25,
|
||||
bool postprocess = true)
|
||||
{
|
||||
typedef typename boost::property_map<Polyhedron, boost::vertex_point_t>::type PointPropertyMap;
|
||||
PointPropertyMap ppmap = get(boost::vertex_point, const_cast<Polyhedron&>(polyhedron));
|
||||
typedef typename boost::property_map<TriangleMesh, boost::vertex_point_t>::type PointPropertyMap;
|
||||
PointPropertyMap ppmap = get(boost::vertex_point, const_cast<TriangleMesh&>(triangle_mesh));
|
||||
typedef typename boost::property_traits<PointPropertyMap>::value_type Point_3;
|
||||
typedef typename Kernel_traits<Point_3>::Kernel GeomTraits;
|
||||
GeomTraits traits;
|
||||
return sdf_values<Fast_sdf_calculation_mode, Polyhedron, SDFPropertyMap, PointPropertyMap, GeomTraits>
|
||||
(polyhedron, sdf_values_map, cone_angle, number_of_rays, postprocess, ppmap, traits);
|
||||
return sdf_values<Fast_sdf_calculation_mode, TriangleMesh, SDFPropertyMap, PointPropertyMap, GeomTraits>
|
||||
(triangle_mesh, sdf_values_map, cone_angle, number_of_rays, postprocess, ppmap, traits);
|
||||
}
|
||||
|
||||
template < class Polyhedron, class SDFPropertyMap, class PointPropertyMap>
|
||||
template < class TriangleMesh, class SDFPropertyMap, class PointPropertyMap>
|
||||
std::pair<double, double>
|
||||
sdf_values( const Polyhedron& polyhedron,
|
||||
sdf_values( const TriangleMesh& triangle_mesh,
|
||||
SDFPropertyMap sdf_values_map,
|
||||
double cone_angle = 2.0 / 3.0 * CGAL_PI,
|
||||
std::size_t number_of_rays = 25,
|
||||
|
|
@ -346,31 +346,31 @@ sdf_values( const Polyhedron& polyhedron,
|
|||
typedef typename boost::property_traits<PointPropertyMap>::value_type Point_3;
|
||||
typedef typename Kernel_traits<Point_3>::Kernel GeomTraits;
|
||||
GeomTraits traits;
|
||||
return sdf_values<true, Polyhedron, SDFPropertyMap, PointPropertyMap, GeomTraits>
|
||||
(polyhedron, sdf_values_map, cone_angle, number_of_rays, postprocess, ppmap, traits);
|
||||
return sdf_values<true, TriangleMesh, SDFPropertyMap, PointPropertyMap, GeomTraits>
|
||||
(triangle_mesh, sdf_values_map, cone_angle, number_of_rays, postprocess, ppmap, traits);
|
||||
}
|
||||
|
||||
template < class Polyhedron, class SDFPropertyMap>
|
||||
template < class TriangleMesh, class SDFPropertyMap>
|
||||
std::pair<double, double>
|
||||
sdf_values( const Polyhedron& polyhedron,
|
||||
sdf_values( const TriangleMesh& triangle_mesh,
|
||||
SDFPropertyMap sdf_values_map,
|
||||
double cone_angle = 2.0 / 3.0 * CGAL_PI,
|
||||
std::size_t number_of_rays = 25,
|
||||
bool postprocess = true)
|
||||
{
|
||||
typedef typename boost::property_map<Polyhedron, boost::vertex_point_t>::type PointPropertyMap;
|
||||
PointPropertyMap ppmap = get(boost::vertex_point, const_cast<Polyhedron&>(polyhedron));
|
||||
typedef typename boost::property_map<TriangleMesh, boost::vertex_point_t>::type PointPropertyMap;
|
||||
PointPropertyMap ppmap = get(boost::vertex_point, const_cast<TriangleMesh&>(triangle_mesh));
|
||||
typedef typename boost::property_traits<PointPropertyMap>::value_type Point_3;
|
||||
typedef typename Kernel_traits<Point_3>::Kernel GeomTraits;
|
||||
GeomTraits traits;
|
||||
return sdf_values<true, Polyhedron, SDFPropertyMap, PointPropertyMap, GeomTraits>
|
||||
(polyhedron, sdf_values_map, cone_angle, number_of_rays, postprocess, ppmap, traits);
|
||||
return sdf_values<true, TriangleMesh, SDFPropertyMap, PointPropertyMap, GeomTraits>
|
||||
(triangle_mesh, sdf_values_map, cone_angle, number_of_rays, postprocess, ppmap, traits);
|
||||
}
|
||||
|
||||
/// segmentation_from_sdf_values ///
|
||||
template <class Polyhedron, class SDFPropertyMap, class SegmentPropertyMap, class PointPropertyMap>
|
||||
template <class TriangleMesh, class SDFPropertyMap, class SegmentPropertyMap, class PointPropertyMap>
|
||||
std::size_t
|
||||
segmentation_from_sdf_values(const Polyhedron& polyhedron,
|
||||
segmentation_from_sdf_values(const TriangleMesh& triangle_mesh,
|
||||
SDFPropertyMap sdf_values_map,
|
||||
SegmentPropertyMap segment_ids,
|
||||
std::size_t number_of_clusters = 5,
|
||||
|
|
@ -381,34 +381,34 @@ segmentation_from_sdf_values(const Polyhedron& polyhedron,
|
|||
typedef typename boost::property_traits<PointPropertyMap>::value_type Point_3;
|
||||
typedef typename Kernel_traits<Point_3>::Kernel GeomTraits;
|
||||
GeomTraits traits;
|
||||
return segmentation_from_sdf_values<Polyhedron, SDFPropertyMap, SegmentPropertyMap, PointPropertyMap, GeomTraits>
|
||||
(polyhedron, sdf_values_map, segment_ids, number_of_clusters, smoothing_lambda,
|
||||
return segmentation_from_sdf_values<TriangleMesh, SDFPropertyMap, SegmentPropertyMap, PointPropertyMap, GeomTraits>
|
||||
(triangle_mesh, sdf_values_map, segment_ids, number_of_clusters, smoothing_lambda,
|
||||
output_cluster_ids, ppmap, traits);
|
||||
}
|
||||
|
||||
template <class Polyhedron, class SDFPropertyMap, class SegmentPropertyMap>
|
||||
template <class TriangleMesh, class SDFPropertyMap, class SegmentPropertyMap>
|
||||
std::size_t
|
||||
segmentation_from_sdf_values(const Polyhedron& polyhedron,
|
||||
segmentation_from_sdf_values(const TriangleMesh& triangle_mesh,
|
||||
SDFPropertyMap sdf_values_map,
|
||||
SegmentPropertyMap segment_ids,
|
||||
std::size_t number_of_clusters = 5,
|
||||
double smoothing_lambda = 0.26,
|
||||
bool output_cluster_ids = false)
|
||||
{
|
||||
typedef typename boost::property_map<Polyhedron, boost::vertex_point_t>::type PointPropertyMap;
|
||||
PointPropertyMap ppmap = get(boost::vertex_point, const_cast<Polyhedron&>(polyhedron));
|
||||
typedef typename boost::property_map<TriangleMesh, boost::vertex_point_t>::type PointPropertyMap;
|
||||
PointPropertyMap ppmap = get(boost::vertex_point, const_cast<TriangleMesh&>(triangle_mesh));
|
||||
typedef typename boost::property_traits<PointPropertyMap>::value_type Point_3;
|
||||
typedef typename Kernel_traits<Point_3>::Kernel GeomTraits;
|
||||
GeomTraits traits;
|
||||
return segmentation_from_sdf_values<Polyhedron, SDFPropertyMap, SegmentPropertyMap, PointPropertyMap, GeomTraits>
|
||||
(polyhedron, sdf_values_map, segment_ids, number_of_clusters, smoothing_lambda,
|
||||
return segmentation_from_sdf_values<TriangleMesh, SDFPropertyMap, SegmentPropertyMap, PointPropertyMap, GeomTraits>
|
||||
(triangle_mesh, sdf_values_map, segment_ids, number_of_clusters, smoothing_lambda,
|
||||
output_cluster_ids, ppmap, traits);
|
||||
}
|
||||
|
||||
/// segmentation_via_sdf_values ///
|
||||
template <bool Fast_sdf_calculation_mode, class Polyhedron, class SegmentPropertyMap, class PointPropertyMap>
|
||||
template <bool Fast_sdf_calculation_mode, class TriangleMesh, class SegmentPropertyMap, class PointPropertyMap>
|
||||
std::size_t
|
||||
segmentation_via_sdf_values(const Polyhedron& polyhedron,
|
||||
segmentation_via_sdf_values(const TriangleMesh& triangle_mesh,
|
||||
SegmentPropertyMap segment_ids,
|
||||
double cone_angle = 2.0 / 3.0 * CGAL_PI,
|
||||
std::size_t number_of_rays = 25,
|
||||
|
|
@ -420,14 +420,14 @@ segmentation_via_sdf_values(const Polyhedron& polyhedron,
|
|||
typedef typename boost::property_traits<PointPropertyMap>::value_type Point_3;
|
||||
typedef typename Kernel_traits<Point_3>::Kernel GeomTraits;
|
||||
GeomTraits traits;
|
||||
return segmentation_via_sdf_values<Fast_sdf_calculation_mode, Polyhedron, SegmentPropertyMap, PointPropertyMap, GeomTraits>
|
||||
(polyhedron, segment_ids, cone_angle, number_of_rays, number_of_clusters,
|
||||
return segmentation_via_sdf_values<Fast_sdf_calculation_mode, TriangleMesh, SegmentPropertyMap, PointPropertyMap, GeomTraits>
|
||||
(triangle_mesh, segment_ids, cone_angle, number_of_rays, number_of_clusters,
|
||||
smoothing_lambda, output_cluster_ids, ppmap, traits);
|
||||
}
|
||||
|
||||
template <bool Fast_sdf_calculation_mode, class Polyhedron, class SegmentPropertyMap>
|
||||
template <bool Fast_sdf_calculation_mode, class TriangleMesh, class SegmentPropertyMap>
|
||||
std::size_t
|
||||
segmentation_via_sdf_values(const Polyhedron& polyhedron,
|
||||
segmentation_via_sdf_values(const TriangleMesh& triangle_mesh,
|
||||
SegmentPropertyMap segment_ids,
|
||||
double cone_angle = 2.0 / 3.0 * CGAL_PI,
|
||||
std::size_t number_of_rays = 25,
|
||||
|
|
@ -435,19 +435,19 @@ segmentation_via_sdf_values(const Polyhedron& polyhedron,
|
|||
double smoothing_lambda = 0.26,
|
||||
bool output_cluster_ids = false)
|
||||
{
|
||||
typedef typename boost::property_map<Polyhedron, boost::vertex_point_t>::type PointPropertyMap;
|
||||
PointPropertyMap ppmap = get(boost::vertex_point, const_cast<Polyhedron&>(polyhedron));
|
||||
typedef typename boost::property_map<TriangleMesh, boost::vertex_point_t>::type PointPropertyMap;
|
||||
PointPropertyMap ppmap = get(boost::vertex_point, const_cast<TriangleMesh&>(triangle_mesh));
|
||||
typedef typename boost::property_traits<PointPropertyMap>::value_type Point_3;
|
||||
typedef typename Kernel_traits<Point_3>::Kernel GeomTraits;
|
||||
GeomTraits traits;
|
||||
return segmentation_via_sdf_values<Fast_sdf_calculation_mode, Polyhedron, SegmentPropertyMap, PointPropertyMap, GeomTraits>
|
||||
(polyhedron, segment_ids, cone_angle, number_of_rays, number_of_clusters,
|
||||
return segmentation_via_sdf_values<Fast_sdf_calculation_mode, TriangleMesh, SegmentPropertyMap, PointPropertyMap, GeomTraits>
|
||||
(triangle_mesh, segment_ids, cone_angle, number_of_rays, number_of_clusters,
|
||||
smoothing_lambda, output_cluster_ids, ppmap, traits);
|
||||
}
|
||||
|
||||
template <class Polyhedron, class SegmentPropertyMap, class PointPropertyMap>
|
||||
template <class TriangleMesh, class SegmentPropertyMap, class PointPropertyMap>
|
||||
std::size_t
|
||||
segmentation_via_sdf_values(const Polyhedron& polyhedron,
|
||||
segmentation_via_sdf_values(const TriangleMesh& triangle_mesh,
|
||||
SegmentPropertyMap segment_ids,
|
||||
double cone_angle = 2.0 / 3.0 * CGAL_PI,
|
||||
std::size_t number_of_rays = 25,
|
||||
|
|
@ -459,14 +459,14 @@ segmentation_via_sdf_values(const Polyhedron& polyhedron,
|
|||
typedef typename boost::property_traits<PointPropertyMap>::value_type Point_3;
|
||||
typedef typename Kernel_traits<Point_3>::Kernel GeomTraits;
|
||||
GeomTraits traits;
|
||||
return segmentation_via_sdf_values<true, Polyhedron, SegmentPropertyMap, PointPropertyMap, GeomTraits>
|
||||
(polyhedron, segment_ids, cone_angle, number_of_rays, number_of_clusters,
|
||||
return segmentation_via_sdf_values<true, TriangleMesh, SegmentPropertyMap, PointPropertyMap, GeomTraits>
|
||||
(triangle_mesh, segment_ids, cone_angle, number_of_rays, number_of_clusters,
|
||||
smoothing_lambda, output_cluster_ids, ppmap, traits);
|
||||
}
|
||||
|
||||
template <class Polyhedron, class SegmentPropertyMap>
|
||||
template <class TriangleMesh, class SegmentPropertyMap>
|
||||
std::size_t
|
||||
segmentation_via_sdf_values(const Polyhedron& polyhedron,
|
||||
segmentation_via_sdf_values(const TriangleMesh& triangle_mesh,
|
||||
SegmentPropertyMap segment_ids,
|
||||
double cone_angle = 2.0 / 3.0 * CGAL_PI,
|
||||
std::size_t number_of_rays = 25,
|
||||
|
|
@ -474,13 +474,13 @@ segmentation_via_sdf_values(const Polyhedron& polyhedron,
|
|||
double smoothing_lambda = 0.26,
|
||||
bool output_cluster_ids = false)
|
||||
{
|
||||
typedef typename boost::property_map<Polyhedron, boost::vertex_point_t>::type PointPropertyMap;
|
||||
PointPropertyMap ppmap = get(boost::vertex_point, const_cast<Polyhedron&>(polyhedron));
|
||||
typedef typename boost::property_map<TriangleMesh, boost::vertex_point_t>::type PointPropertyMap;
|
||||
PointPropertyMap ppmap = get(boost::vertex_point, const_cast<TriangleMesh&>(triangle_mesh));
|
||||
typedef typename boost::property_traits<PointPropertyMap>::value_type Point_3;
|
||||
typedef typename Kernel_traits<Point_3>::Kernel GeomTraits;
|
||||
GeomTraits traits;
|
||||
return segmentation_via_sdf_values<true, Polyhedron, SegmentPropertyMap, PointPropertyMap, GeomTraits>
|
||||
(polyhedron, segment_ids, cone_angle, number_of_rays, number_of_clusters,
|
||||
return segmentation_via_sdf_values<true, TriangleMesh, SegmentPropertyMap, PointPropertyMap, GeomTraits>
|
||||
(triangle_mesh, segment_ids, cone_angle, number_of_rays, number_of_clusters,
|
||||
smoothing_lambda, output_cluster_ids, ppmap, traits);
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -321,7 +321,7 @@ public:
|
|||
|
||||
/*!
|
||||
Function object type that provides
|
||||
`template <class VertexPointMap> bool operator()(boost::graph_traits<Triangle_mesh>::%vertex_descriptor v, Triangle_mesh& g, VertexPointMap vpm)`
|
||||
`template <class VertexPointMap> bool operator()(boost::graph_traits<Triangle_mesh>::%vertex_descriptor v, Triangle_mesh& tm, VertexPointMap vpm)`
|
||||
that returns true if the vertex is a saddle vertex (more than \f$ 2 \pi \f$ surface area
|
||||
over all adjacent faces), and false otherwise. `vpm` must be a model of concept `ReadablePropertyMap` that maps from `vertex_descriptor` to
|
||||
`Point_3` objects.
|
||||
|
|
|
|||
|
|
@ -139,11 +139,11 @@ public:
|
|||
typedef typename Traits::Barycentric_coordinate Barycentric_coordinate;
|
||||
|
||||
/// \brief An ordered pair specifying a location on the surface of the `Triangle_mesh`.
|
||||
/// \details If `g` is the input graph and given the pair (`f`, `bc`) such that `bc` is `(w0, w1, w2)`,
|
||||
/// \details If `tm` is the input graph and given the pair (`f`, `bc`) such that `bc` is `(w0, w1, w2)`,
|
||||
/// the correspondance with the weights in `bc` and the vertices of the face `f` is the following:
|
||||
/// - `w0 = source(halfedge(f,g),g)`
|
||||
/// - `w1 = target(halfedge(f,g),g)`
|
||||
/// - `w2 = target(next(halfedge(f,g),g),g)`
|
||||
/// - `w0 = source(halfedge(f,tm),tm)`
|
||||
/// - `w1 = target(halfedge(f,tm),tm)`
|
||||
/// - `w2 = target(next(halfedge(f,tm),tm),tm)`
|
||||
typedef std::pair<face_descriptor, Barycentric_coordinate> Face_location;
|
||||
|
||||
private:
|
||||
|
|
@ -473,14 +473,14 @@ private:
|
|||
return triangle_from_halfedge(edge, m_graph, m_vertexPointMap);
|
||||
}
|
||||
|
||||
static Triangle_3 triangle_from_halfedge(halfedge_descriptor edge, const Triangle_mesh& g)
|
||||
static Triangle_3 triangle_from_halfedge(halfedge_descriptor edge, const Triangle_mesh& tm)
|
||||
{
|
||||
return triangle_from_halfedge(edge, g, get(vertex_point, g));
|
||||
return triangle_from_halfedge(edge, tm, get(vertex_point, tm));
|
||||
}
|
||||
|
||||
static Triangle_3 triangle_from_halfedge(halfedge_descriptor edge, const Triangle_mesh& g, Vertex_point_map vertexPointMap)
|
||||
static Triangle_3 triangle_from_halfedge(halfedge_descriptor edge, const Triangle_mesh& tm, Vertex_point_map vertexPointMap)
|
||||
{
|
||||
return CGAL::internal::triangle_from_halfedge<Triangle_3, Triangle_mesh, Vertex_point_map>(edge, g, vertexPointMap);
|
||||
return CGAL::internal::triangle_from_halfedge<Triangle_3, Triangle_mesh, Vertex_point_map>(edge, tm, vertexPointMap);
|
||||
}
|
||||
|
||||
Triangle_3 triangle_from_face(face_descriptor f) const
|
||||
|
|
@ -488,14 +488,14 @@ private:
|
|||
return triangle_from_face(f, m_graph, m_vertexPointMap);
|
||||
}
|
||||
|
||||
static Triangle_3 triangle_from_face(face_descriptor f, const Triangle_mesh& g)
|
||||
static Triangle_3 triangle_from_face(face_descriptor f, const Triangle_mesh& tm)
|
||||
{
|
||||
return triangle_from_halfedge(halfedge(f, g), g, get(vertex_point, g));
|
||||
return triangle_from_halfedge(halfedge(f, tm), tm, get(vertex_point, tm));
|
||||
}
|
||||
|
||||
static Triangle_3 triangle_from_face(face_descriptor f, const Triangle_mesh& g, Vertex_point_map vertexPointMap)
|
||||
static Triangle_3 triangle_from_face(face_descriptor f, const Triangle_mesh& tm, Vertex_point_map vertexPointMap)
|
||||
{
|
||||
return triangle_from_halfedge(halfedge(f, g), g, vertexPointMap);
|
||||
return triangle_from_halfedge(halfedge(f, tm), tm, vertexPointMap);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -1986,42 +1986,42 @@ public:
|
|||
/// @{
|
||||
|
||||
/*!
|
||||
\brief Creates a shortest paths object using `g` as input.
|
||||
\brief Creates a shortest paths object using `tm` as input.
|
||||
|
||||
Equivalent to `Surface_mesh_shortest_path(g, get(boost::vertex_index, g), get(boost::halfedge_index, g), get(boost::face_index, g), get(CGAL::vertex_point, g), traits)`.
|
||||
Equivalent to `Surface_mesh_shortest_path(tm, get(boost::vertex_index, tm), get(boost::halfedge_index, tm), get(boost::face_index, tm), get(CGAL::vertex_point, tm), traits)`.
|
||||
*/
|
||||
Surface_mesh_shortest_path(Triangle_mesh& g, const Traits& traits = Traits())
|
||||
Surface_mesh_shortest_path(Triangle_mesh& tm, const Traits& traits = Traits())
|
||||
: m_traits(traits)
|
||||
, m_graph(g)
|
||||
, m_vertexIndexMap(get(boost::vertex_index, g))
|
||||
, m_halfedgeIndexMap(get(boost::halfedge_index, g))
|
||||
, m_faceIndexMap(get(boost::face_index, g))
|
||||
, m_vertexPointMap(get(CGAL::vertex_point, g))
|
||||
, m_graph(tm)
|
||||
, m_vertexIndexMap(get(boost::vertex_index, tm))
|
||||
, m_halfedgeIndexMap(get(boost::halfedge_index, tm))
|
||||
, m_faceIndexMap(get(boost::face_index, tm))
|
||||
, m_vertexPointMap(get(CGAL::vertex_point, tm))
|
||||
, m_debugOutput(false)
|
||||
{
|
||||
reset_algorithm();
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Creates a shortest paths object using `g` as input.
|
||||
\brief Creates a shortest paths object using `tm` as input.
|
||||
|
||||
\details No copy of the `Triangle_mesh` is made, only a reference to the `g` is held.
|
||||
\details No copy of the `Triangle_mesh` is made, only a reference to the `tm` is held.
|
||||
|
||||
\param g The surface mesh to compute shortest paths on. Note that it must be triangulated.
|
||||
\param tm The surface mesh to compute shortest paths on. Note that it must be triangulated.
|
||||
|
||||
\param vertexIndexMap Property map associating an id to each vertex, from 0 to `num_vertices(g) - 1`.
|
||||
\param vertexIndexMap Property map associating an id to each vertex, from 0 to `num_vertices(tm) - 1`.
|
||||
|
||||
\param halfedgeIndexMap Property map associating an id to each halfedge, from 0 to `num_halfedges(g) - 1`.
|
||||
\param halfedgeIndexMap Property map associating an id to each halfedge, from 0 to `num_halfedges(tm) - 1`.
|
||||
|
||||
\param faceIndexMap Property map associating an id to each face, from 0 to `num_faces(g) - 1`.
|
||||
\param faceIndexMap Property map associating an id to each face, from 0 to `num_faces(tm) - 1`.
|
||||
|
||||
\param vertexPointMap Property map used to access the points associated to each vertex of the graph.
|
||||
|
||||
\param traits Optional instance of the traits class to use.
|
||||
*/
|
||||
Surface_mesh_shortest_path(Triangle_mesh& g, Vertex_index_map vertexIndexMap, Halfedge_index_map halfedgeIndexMap, Face_index_map faceIndexMap, Vertex_point_map vertexPointMap, const Traits& traits = Traits())
|
||||
Surface_mesh_shortest_path(Triangle_mesh& tm, Vertex_index_map vertexIndexMap, Halfedge_index_map halfedgeIndexMap, Face_index_map faceIndexMap, Vertex_point_map vertexPointMap, const Traits& traits = Traits())
|
||||
: m_traits(traits)
|
||||
, m_graph(g)
|
||||
, m_graph(tm)
|
||||
, m_vertexIndexMap(vertexIndexMap)
|
||||
, m_halfedgeIndexMap(halfedgeIndexMap)
|
||||
, m_faceIndexMap(faceIndexMap)
|
||||
|
|
@ -2437,8 +2437,8 @@ public:
|
|||
of the given face.
|
||||
|
||||
\details The following static overloads are also available:
|
||||
- `static Point_3 point(face_descriptor f, Barycentric_coordinate location, const Triangle_mesh& g, const Traits& traits = Traits())`
|
||||
- `static Point_3 point(face_descriptor f, Barycentric_coordinate location, const Triangle_mesh& g, Vertex_point_map vertexPointMap, const Traits& traits = Traits())`
|
||||
- `static Point_3 point(face_descriptor f, Barycentric_coordinate location, const Triangle_mesh& tm, const Traits& traits = Traits())`
|
||||
- `static Point_3 point(face_descriptor f, Barycentric_coordinate location, const Triangle_mesh& tm, Vertex_point_map vertexPointMap, const Traits& traits = Traits())`
|
||||
|
||||
\param f A face of on the input face graph
|
||||
\param location The barycentric coordinate of the query point on face `f`
|
||||
|
|
@ -2450,14 +2450,14 @@ public:
|
|||
|
||||
/// \cond
|
||||
|
||||
static Point_3 point(face_descriptor f, Barycentric_coordinate location, const Triangle_mesh& g, const Traits& traits = Traits())
|
||||
static Point_3 point(face_descriptor f, Barycentric_coordinate location, const Triangle_mesh& tm, const Traits& traits = Traits())
|
||||
{
|
||||
return point(f, location, g, CGAL::get(CGAL::vertex_point, g), traits);
|
||||
return point(f, location, tm, CGAL::get(CGAL::vertex_point, tm), traits);
|
||||
}
|
||||
|
||||
static Point_3 point(face_descriptor f, Barycentric_coordinate location, const Triangle_mesh& g, Vertex_point_map vertexPointMap, const Traits& traits = Traits())
|
||||
static Point_3 point(face_descriptor f, Barycentric_coordinate location, const Triangle_mesh& tm, Vertex_point_map vertexPointMap, const Traits& traits = Traits())
|
||||
{
|
||||
return construct_barycenter_in_triangle_3(triangle_from_face(f, g, vertexPointMap), location, traits);
|
||||
return construct_barycenter_in_triangle_3(triangle_from_face(f, tm, vertexPointMap), location, traits);
|
||||
}
|
||||
|
||||
/// \endcond
|
||||
|
|
@ -2467,8 +2467,8 @@ public:
|
|||
along the given edge.
|
||||
|
||||
\details The following static overloads are also available:
|
||||
- `static Point_3 point(halfedge_descriptor edge, FT t, const Triangle_mesh& g, const Traits& traits = Traits())`
|
||||
- `static Point_3 point(halfedge_descriptor edge, FT t, const Triangle_mesh& g, Vertex_point_map vertexPointMap, const Traits& traits = Traits())`
|
||||
- `static Point_3 point(halfedge_descriptor edge, FT t, const Triangle_mesh& tm, const Traits& traits = Traits())`
|
||||
- `static Point_3 point(halfedge_descriptor edge, FT t, const Triangle_mesh& tm, Vertex_point_map vertexPointMap, const Traits& traits = Traits())`
|
||||
|
||||
\param edge An edge of the input face graph
|
||||
\param t The parametric distance along edge of the desired point
|
||||
|
|
@ -2480,17 +2480,17 @@ public:
|
|||
|
||||
/// \cond
|
||||
|
||||
static Point_3 point(halfedge_descriptor edge, FT t, const Triangle_mesh& g, const Traits& traits = Traits())
|
||||
static Point_3 point(halfedge_descriptor edge, FT t, const Triangle_mesh& tm, const Traits& traits = Traits())
|
||||
{
|
||||
return point(edge, t, g, CGAL::get(CGAL::vertex_point, g), traits);
|
||||
return point(edge, t, tm, CGAL::get(CGAL::vertex_point, tm), traits);
|
||||
}
|
||||
|
||||
static Point_3 point(halfedge_descriptor edge, FT t, const Triangle_mesh& g, Vertex_point_map vertexPointMap, const Traits& traits = Traits())
|
||||
static Point_3 point(halfedge_descriptor edge, FT t, const Triangle_mesh& tm, Vertex_point_map vertexPointMap, const Traits& traits = Traits())
|
||||
{
|
||||
typename Traits::Construct_barycenter_3 construct_barycenter_3(traits.construct_barycenter_3_object());
|
||||
|
||||
// Note: the parameter t is meant to be the weighted coordinate on the _endpoint_ (i.e. target) of the segment
|
||||
return construct_barycenter_3(get(vertexPointMap, target(edge, g)), t, get(vertexPointMap, source(edge, g)));
|
||||
return construct_barycenter_3(get(vertexPointMap, target(edge, tm)), t, get(vertexPointMap, source(edge, tm)));
|
||||
}
|
||||
|
||||
/// \endcond
|
||||
|
|
@ -2514,7 +2514,7 @@ public:
|
|||
\brief Returns the location of the given vertex as a `Face_location`
|
||||
|
||||
\details The following static overload is also available:
|
||||
- `static Face_location face_location(vertex_descriptor vertex, const Triangle_mesh& g, const Traits& traits = Traits())`
|
||||
- `static Face_location face_location(vertex_descriptor vertex, const Triangle_mesh& tm, const Traits& traits = Traits())`
|
||||
|
||||
\param vertex A vertex of the input face graph
|
||||
*/
|
||||
|
|
@ -2525,12 +2525,12 @@ public:
|
|||
|
||||
/// \cond
|
||||
|
||||
static Face_location face_location(vertex_descriptor vertex, const Triangle_mesh& g, const Traits& traits = Traits())
|
||||
static Face_location face_location(vertex_descriptor vertex, const Triangle_mesh& tm, const Traits& traits = Traits())
|
||||
{
|
||||
typename Traits::Construct_barycentric_coordinate construct_barycentric_coordinate(traits.construct_barycentric_coordinate_object());
|
||||
halfedge_descriptor he = next(halfedge(vertex, g), g);
|
||||
face_descriptor locationFace = face(he, g);
|
||||
std::size_t edgeIndex = CGAL::internal::edge_index(he, g);
|
||||
halfedge_descriptor he = next(halfedge(vertex, tm), tm);
|
||||
face_descriptor locationFace = face(he, tm);
|
||||
std::size_t edgeIndex = CGAL::internal::edge_index(he, tm);
|
||||
|
||||
FT coords[3] = { FT(0.0), FT(0.0), FT(0.0) };
|
||||
|
||||
|
|
@ -2545,7 +2545,7 @@ public:
|
|||
\brief Returns a location along the given edge as a `Face_location`.
|
||||
|
||||
\details The following static overload is also available:
|
||||
- `static Face_location face_location(halfedge_descriptor he, FT t, const Triangle_mesh& g, const Traits& traits = Traits())`
|
||||
- `static Face_location face_location(halfedge_descriptor he, FT t, const Triangle_mesh& tm, const Traits& traits = Traits())`
|
||||
|
||||
\param he A halfedge of the input face graph
|
||||
\param t Parametric distance of the desired point along `he`
|
||||
|
|
@ -2557,11 +2557,11 @@ public:
|
|||
|
||||
/// \cond
|
||||
|
||||
static Face_location face_location(halfedge_descriptor he, FT t, const Triangle_mesh& g, const Traits& traits = Traits())
|
||||
static Face_location face_location(halfedge_descriptor he, FT t, const Triangle_mesh& tm, const Traits& traits = Traits())
|
||||
{
|
||||
typename Traits::Construct_barycentric_coordinate cbc(traits.construct_barycentric_coordinate_object());
|
||||
face_descriptor locationFace = face(he, g);
|
||||
std::size_t edgeIndex = CGAL::internal::edge_index(he, g);
|
||||
face_descriptor locationFace = face(he, tm);
|
||||
std::size_t edgeIndex = CGAL::internal::edge_index(he, tm);
|
||||
|
||||
const FT oneMinusT(FT(1.0) - t);
|
||||
|
||||
|
|
@ -2588,7 +2588,7 @@ public:
|
|||
that accept a reference to an `AABB_tree` as input.
|
||||
|
||||
\details The following static overload is also available:
|
||||
- `static Face_location locate(const Point_3& p, const Triangle_mesh& g, Vertex_point_map vertexPointMap, const Traits& traits = Traits())`
|
||||
- `static Face_location locate(const Point_3& p, const Triangle_mesh& tm, Vertex_point_map vertexPointMap, const Traits& traits = Traits())`
|
||||
|
||||
\tparam AABBTraits A model of `AABBTraits` used to define a \cgal `AABB_tree`.
|
||||
|
||||
|
|
@ -2603,11 +2603,11 @@ public:
|
|||
/// \cond
|
||||
|
||||
template <class AABBTraits>
|
||||
static Face_location locate(const Point_3& location, const Triangle_mesh& g, Vertex_point_map vertexPointMap, const Traits& traits = Traits())
|
||||
static Face_location locate(const Point_3& location, const Triangle_mesh& tm, Vertex_point_map vertexPointMap, const Traits& traits = Traits())
|
||||
{
|
||||
AABB_tree<AABBTraits> tree;
|
||||
build_aabb_tree(g, tree);
|
||||
return locate(location, tree, g, vertexPointMap, traits);
|
||||
build_aabb_tree(tm, tree);
|
||||
return locate(location, tree, tm, vertexPointMap, traits);
|
||||
}
|
||||
|
||||
/// \endcond
|
||||
|
|
@ -2616,7 +2616,7 @@ public:
|
|||
\brief Returns the face location nearest to the given point.
|
||||
|
||||
\details The following static overload is also available:
|
||||
- static Face_location locate(const Point_3& p, const AABB_tree<AABBTraits>& tree, const Triangle_mesh& g, Vertex_point_map vertexPointMap, const Traits& traits = Traits())
|
||||
- static Face_location locate(const Point_3& p, const AABB_tree<AABBTraits>& tree, const Triangle_mesh& tm, Vertex_point_map vertexPointMap, const Traits& traits = Traits())
|
||||
|
||||
\tparam AABBTraits A model of `AABBTraits` used to define a \cgal `AABB_tree`.
|
||||
|
||||
|
|
@ -2632,13 +2632,13 @@ public:
|
|||
/// \cond
|
||||
|
||||
template <class AABBTraits>
|
||||
static Face_location locate(const Point_3& location, const AABB_tree<AABBTraits>& tree, const Triangle_mesh& g, Vertex_point_map vertexPointMap, const Traits& traits = Traits())
|
||||
static Face_location locate(const Point_3& location, const AABB_tree<AABBTraits>& tree, const Triangle_mesh& tm, Vertex_point_map vertexPointMap, const Traits& traits = Traits())
|
||||
{
|
||||
typename Traits::Construct_barycentric_coordinate_in_triangle_3 cbcit3(traits.construct_barycentric_coordinate_in_triangle_3_object());
|
||||
typename AABB_tree<AABBTraits>::Point_and_primitive_id result = tree.closest_point_and_primitive(location);
|
||||
|
||||
face_descriptor f = result.second;
|
||||
Barycentric_coordinate b = cbcit3(triangle_from_face(f, g, vertexPointMap), result.first);
|
||||
Barycentric_coordinate b = cbcit3(triangle_from_face(f, tm, vertexPointMap), result.first);
|
||||
return Face_location(f, b);
|
||||
}
|
||||
|
||||
|
|
@ -2652,7 +2652,7 @@ public:
|
|||
that accept a reference to an `AABB_tree` as input.
|
||||
|
||||
\details The following static overload is also available:
|
||||
- `static Face_location locate(const Ray_3& ray, const Triangle_mesh& g, Vertex_point_map vertexPointMap, const Traits& traits = Traits())`
|
||||
- `static Face_location locate(const Ray_3& ray, const Triangle_mesh& tm, Vertex_point_map vertexPointMap, const Traits& traits = Traits())`
|
||||
|
||||
\tparam AABBTraits A model of `AABBTraits` used to define an `AABB_tree`.
|
||||
|
||||
|
|
@ -2667,11 +2667,11 @@ public:
|
|||
/// \cond
|
||||
|
||||
template <class AABBTraits>
|
||||
static Face_location locate(const Ray_3& ray, const Triangle_mesh& g, Vertex_point_map vertexPointMap, const Traits& traits = Traits())
|
||||
static Face_location locate(const Ray_3& ray, const Triangle_mesh& tm, Vertex_point_map vertexPointMap, const Traits& traits = Traits())
|
||||
{
|
||||
AABB_tree<AABBTraits> tree;
|
||||
build_aabb_tree(g, tree);
|
||||
return locate(ray, tree, g, vertexPointMap, traits);
|
||||
build_aabb_tree(tm, tree);
|
||||
return locate(ray, tree, tm, vertexPointMap, traits);
|
||||
}
|
||||
|
||||
/// \endcond
|
||||
|
|
@ -2681,7 +2681,7 @@ public:
|
|||
its source point.
|
||||
|
||||
\details The following static overload is also available:
|
||||
- static Face_location locate(const Ray_3& ray, const AABB_tree<AABBTraits>& tree, const Triangle_mesh& g, Vertex_point_map vertexPointMap, const Traits& traits = Traits())
|
||||
- static Face_location locate(const Ray_3& ray, const AABB_tree<AABBTraits>& tree, const Triangle_mesh& tm, Vertex_point_map vertexPointMap, const Traits& traits = Traits())
|
||||
|
||||
\tparam AABBTraits A model of `AABBTraits` used to define a \cgal `AABB_tree`.
|
||||
|
||||
|
|
@ -2697,7 +2697,7 @@ public:
|
|||
/// \cond
|
||||
|
||||
template <class AABBTraits>
|
||||
static Face_location locate(const Ray_3& ray, const AABB_tree<AABBTraits>& tree, const Triangle_mesh& g, Vertex_point_map vertexPointMap, const Traits& traits = Traits())
|
||||
static Face_location locate(const Ray_3& ray, const AABB_tree<AABBTraits>& tree, const Triangle_mesh& tm, Vertex_point_map vertexPointMap, const Traits& traits = Traits())
|
||||
{
|
||||
typedef AABB_tree<AABBTraits> AABB_face_graph_tree;
|
||||
typename Traits::Construct_barycentric_coordinate_in_triangle_3 cbcit3(traits.construct_barycentric_coordinate_in_triangle_3_object());
|
||||
|
|
@ -2738,7 +2738,7 @@ public:
|
|||
|
||||
if (foundOne)
|
||||
{
|
||||
Barycentric_coordinate b = cbcit3(triangle_from_face(nearestFace, g, vertexPointMap), nearestPoint);
|
||||
Barycentric_coordinate b = cbcit3(triangle_from_face(nearestFace, tm, vertexPointMap), nearestPoint);
|
||||
return Face_location(nearestFace, b);
|
||||
}
|
||||
else
|
||||
|
|
@ -2755,7 +2755,7 @@ public:
|
|||
\brief Creates an `AABB_tree` suitable for use with `locate`.
|
||||
|
||||
\details The following static overload is also available:
|
||||
- `static void build_aabb_tree(const Triangle_mesh& g, AABB_tree<AABBTraits>& outTree)`
|
||||
- `static void build_aabb_tree(const Triangle_mesh& tm, AABB_tree<AABBTraits>& outTree)`
|
||||
|
||||
\tparam AABBTraits A model of `AABBTraits` used to define a \cgal `AABB_tree`.
|
||||
|
||||
|
|
@ -2770,11 +2770,11 @@ public:
|
|||
/// \cond
|
||||
|
||||
template <class AABBTraits>
|
||||
static void build_aabb_tree(const Triangle_mesh& g, AABB_tree<AABBTraits>& outTree)
|
||||
static void build_aabb_tree(const Triangle_mesh& tm, AABB_tree<AABBTraits>& outTree)
|
||||
{
|
||||
face_iterator facesStart, facesEnd;
|
||||
boost::tie(facesStart, facesEnd) = faces(g);
|
||||
outTree.rebuild(facesStart, facesEnd, g);
|
||||
boost::tie(facesStart, facesEnd) = faces(tm);
|
||||
outTree.rebuild(facesStart, facesEnd, tm);
|
||||
outTree.build();
|
||||
}
|
||||
/// \endcond
|
||||
|
|
|
|||
|
|
@ -38,13 +38,13 @@ as required by the `Surface_mesh_shortest_path` class.
|
|||
|
||||
\tparam K A \cgal Kernel
|
||||
|
||||
\tparam G A model of `FaceListGraph`
|
||||
\tparam TriangleMesh A model of `FaceListGraph`
|
||||
|
||||
\cgalModels `SurfaceMeshShortestPathTraits`
|
||||
*/
|
||||
template <
|
||||
class K,
|
||||
class G>
|
||||
class TriangleMesh>
|
||||
class Surface_mesh_shortest_path_traits : public K
|
||||
{
|
||||
public:
|
||||
|
|
@ -53,7 +53,7 @@ public:
|
|||
typedef K Kernel;
|
||||
|
||||
/// Triangle mesh type
|
||||
typedef G Triangle_mesh;
|
||||
typedef TriangleMesh Triangle_mesh;
|
||||
|
||||
typedef typename Kernel::FT FT;
|
||||
|
||||
|
|
@ -162,14 +162,14 @@ model which uses an exact Kernel during the unfolding operations to achieve bett
|
|||
|
||||
\tparam K Kernel Type
|
||||
|
||||
\tparam G triangle mesh type
|
||||
\tparam TriangleMesh triangle mesh type
|
||||
|
||||
\cgalModels `SurfaceMeshShortestPathTraits`
|
||||
*/
|
||||
template <
|
||||
class K,
|
||||
class G>
|
||||
class Surface_mesh_shortest_path_traits_with_robust_unfolding : public Surface_mesh_shortest_path_traits<K,G>
|
||||
class TriangleMesh>
|
||||
class Surface_mesh_shortest_path_traits_with_robust_unfolding : public Surface_mesh_shortest_path_traits<K,TriangleMesh>
|
||||
{
|
||||
public:
|
||||
typedef K Kernel;
|
||||
|
|
@ -188,7 +188,7 @@ public:
|
|||
}
|
||||
|
||||
Surface_mesh_shortest_path_traits_with_robust_unfolding(const Kernel& kernel)
|
||||
: Surface_mesh_shortest_path_traits<K,G>(kernel)
|
||||
: Surface_mesh_shortest_path_traits<K,TriangleMesh>(kernel)
|
||||
, m_robust_construct_triangle_3_to_triangle_2_projection_object(kernel)
|
||||
, m_robust_flatten_triangle_3_along_segment_2(kernel)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue