#include <CGAL/Simple_cartesian.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/Heat_method_3/Surface_mesh_geodesic_distances_3.h>
#include <CGAL/IO/Color_ramp.h>
#include <CGAL/boost/graph/IO/PLY.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;
typedef Triangle_mesh::Property_map<vertex_descriptor,CGAL::IO::Color> Vertex_color_map;
int main(int argc, char* argv[])
{
const std::filesystem::path 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;
vertex_descriptor source = *(vertices(tm).first);
double sdistance = 0;
std::cout << "Source vertex " << source << " at: " << tm.point(source) << std::endl;
for(vertex_descriptor vd : vertices(tm))
{
double d = get(vertex_distance, vd);
sdistance = (std::max)(sdistance,d);
}
for(vertex_descriptor vd : vertices(tm))
{
double d = get(vertex_distance, vd);
}
std::ofstream out("out.ply");
return 0;
}
Color interpolate(double v) const
bool is_triangle_mesh(const FaceGraph &g)
bool is_empty(const FaceGraph &g)
bool read_polygon_mesh(const std::filesystem::path &fname, Graph &g, const NamedParameters &np=parameters::default_values())
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
bool write_PLY(std::ostream &out, const PointRange &points, const PolygonRange &polygons, const NamedParameters &np=parameters::default_values())
std::filesystem::path data_file_path(const std::filesystem::path &filename)