#include <CGAL/Simple_cartesian.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/Heat_method_3/Surface_mesh_geodesic_distances_3.h>
#include <iostream>
#include <fstream>
typedef boost::graph_traits<Triangle_mesh>::vertex_descriptor vertex_descriptor;
typedef Triangle_mesh::Property_map<vertex_descriptor,double> Vertex_distance_map;
int main(int argc, char* argv[])
{
const std::string filename = (argc > 1) ? argv[1] : CGAL::data_file_path("meshes/elephant.off");
Triangle_mesh tm;
{
std::cerr << "Invalid input file." << std::endl;
return EXIT_FAILURE;
}
Vertex_distance_map vertex_distance = tm.add_property_map<vertex_descriptor,double>("v:distance",0).first;
Heat_method_idt hm_idt(tm);
vertex_descriptor source = *(vertices(tm).first);
hm_idt.add_source(source);
hm_idt.estimate_geodesic_distances(vertex_distance);
for(vertex_descriptor vd : vertices(tm)){
std::cout << vd << " is at distance " << get(vertex_distance, vd) << " from " << source << std::endl;
}
return 0;
}
Class Surface_mesh_geodesic_distances_3 computes estimated geodesic distances for a set of source ver...
Definition: Surface_mesh_geodesic_distances_3.h:756
bool is_triangle_mesh(const FaceGraph &g)
bool is_empty(const FaceGraph &g)
bool read_polygon_mesh(const std::string &fname, Graph &g, const NamedParameters &np=parameters::default_values())