#include <CGAL/Polyhedron_3.h>
#include <CGAL/Polyhedron_items_with_id_3.h>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/extract_mean_curvature_flow_skeleton.h>
#include <CGAL/mesh_segmentation.h>
#include <fstream>
typedef boost::graph_traits<Polyhedron>::vertex_descriptor vertex_descriptor;
typedef boost::graph_traits<Polyhedron>::halfedge_descriptor halfedge_descriptor;
typedef boost::graph_traits<Polyhedron>::face_descriptor face_descriptor;
typedef Skeletonization::Skeleton Skeleton;
typedef Skeleton::vertex_descriptor Skeleton_vertex;
template<class ValueType>
struct Facet_with_id_pmap
: public boost::put_get_helper<ValueType&,
Facet_with_id_pmap<ValueType> >
{
typedef face_descriptor key_type;
typedef ValueType value_type;
typedef value_type& reference;
typedef boost::lvalue_property_map_tag category;
Facet_with_id_pmap(
std::vector<ValueType>& internal_vector
) : internal_vector(internal_vector) { }
reference operator[](key_type key) const
{ return internal_vector[key->id()]; }
private:
std::vector<ValueType>& internal_vector;
};
int main(int argc, char* argv[])
{
Polyhedron tmesh;
input >> tmesh;
{
std::cout << "Input geometry is not triangulated." << std::endl;
return EXIT_FAILURE;
}
Skeleton skeleton;
std::vector<double> distances(num_vertices(tmesh));
{
const Point& skel_pt = skeleton[v].point;
for(vertex_descriptor mesh_v : skeleton[v].vertices)
{
const Point& mesh_pt = mesh_v->point();
}
}
std::vector<double>
sdf_values( num_faces(tmesh) );
Facet_with_id_pmap<double> sdf_property_map(sdf_values);
for(face_descriptor f : faces(tmesh))
{
double dist = 0;
dist+=distances[target(hd, tmesh)->id()];
sdf_property_map[f] = dist / 3.;
}
std::vector<std::size_t> segment_ids( num_faces(tmesh) );
Facet_with_id_pmap<std::size_t> segment_property_map(segment_ids);
std::cout << "Number of segments: "
return EXIT_SUCCESS;
}
Function object that enables to extract the mean curvature flow skeleton of a triangulated surface me...
Definition: Mean_curvature_flow_skeletonization.h:169
void set_halfedgeds_items_id(Polyhedron_with_id &P)
bool is_triangle_mesh(const FaceGraph &g)
Iterator_range< Halfedge_around_face_iterator< Graph > > halfedges_around_face(typename boost::graph_traits< Graph >::halfedge_descriptor h, const Graph &g)
std::pair< double, double > 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, PointPropertyMap ppmap=PointPropertyMap(), GeomTraits traits=GeomTraits())
std::size_t 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, PointPropertyMap ppmap=PointPropertyMap(), GeomTraits traits=GeomTraits())
std::pair< double, double > sdf_values_postprocessing(const TriangleMesh &triangle_mesh, SDFPropertyMap sdf_values_map)
void extract_mean_curvature_flow_skeleton(const TriangleMesh &tmesh, typename Mean_curvature_flow_skeletonization< TriangleMesh >::Skeleton &skeleton)
extracts a medially centered curve skeleton for the triangle mesh tmesh. This function uses the class...
Definition: extract_mean_curvature_flow_skeleton.h:47
Kernel::FT squared_distance(Type1< Kernel > obj1, Type2< Kernel > obj2)
Iterator_range< T > make_range(const T &b, const T &e)
std::string data_file_path(const std::string &filename)