CGAL 6.1.1 - The Heat Method

Loading...
Searching...
No Matches
Heat_method_3/heat_method_polyhedron.cpp
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/Heat_method_3/Surface_mesh_geodesic_distances_3.h>
#include <unordered_map>
#include <fstream>
#include <iostream>
typedef CGAL::Simple_cartesian<double> Kernel;
typedef Kernel::Point_3 Point_3;
typedef CGAL::Polyhedron_3<Kernel> Triangle_mesh;
typedef boost::graph_traits<Triangle_mesh>::vertex_descriptor vertex_descriptor;
int main(int argc, char* argv[])
{
Triangle_mesh tm;
const std::string filename = (argc > 1) ? argv[1] : CGAL::data_file_path("meshes/elephant.off");
std::ifstream input(filename);
if (!input || !(input >> tm) || tm.is_empty()) {
std::cerr << "Not a valid off file." << std::endl;
return 1;
}
// map for the distance values to the source set
std::unordered_map<vertex_descriptor, double> vertex_distance;
vertex_descriptor source = *(vertices(tm).first);
CGAL::Heat_method_3::estimate_geodesic_distances(tm,
boost::make_assoc_property_map(vertex_distance),
source) ;
std::cout << "Source vertex at: " << source->point() << std::endl;
for(vertex_descriptor vd : vertices(tm)){
std::cout << vd->point() << " is at distance " << vertex_distance[vd] << std::endl;
}
return 0;
}
CGAL::Polyhedron_3
Kernel::Point_3
CGAL::Heat_method_3::estimate_geodesic_distances
void estimate_geodesic_distances(const TriangleMesh &tm, VertexDistanceMap vdm, typename boost::graph_traits< TriangleMesh >::vertex_descriptor source, Mode)
computes for each vertex of the triangle mesh tm the estimated geodesic distance to a given source ve...
Definition: Surface_mesh_geodesic_distances_3.h:907
Kernel
CGAL::Simple_cartesian