mirror of https://github.com/CGAL/cgal
Improve example
This commit is contained in:
parent
d553d91eb6
commit
fe5a4b40c8
|
|
@ -7,7 +7,6 @@
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
using LCC_3 =CGAL::Linear_cell_complex_for_combinatorial_map<2, 3>;
|
using LCC_3 =CGAL::Linear_cell_complex_for_combinatorial_map<2, 3>;
|
||||||
using CST =CGAL::Surface_mesh_topology::Curves_on_surface_topology<LCC_3>;
|
|
||||||
using Path_on_surface=CGAL::Surface_mesh_topology::Path_on_surface<LCC_3>;
|
using Path_on_surface=CGAL::Surface_mesh_topology::Path_on_surface<LCC_3>;
|
||||||
|
|
||||||
double cycle_length(const LCC_3& lcc, const Path_on_surface& cycle)
|
double cycle_length(const LCC_3& lcc, const Path_on_surface& cycle)
|
||||||
|
|
@ -21,10 +20,10 @@ double cycle_length(const LCC_3& lcc, const Path_on_surface& cycle)
|
||||||
|
|
||||||
void display_cycle_info(const LCC_3& lcc, const Path_on_surface& cycle)
|
void display_cycle_info(const LCC_3& lcc, const Path_on_surface& cycle)
|
||||||
{ // Display information about the given cycle.
|
{ // Display information about the given cycle.
|
||||||
if (cycle.is_empty()) { std::cout<<"empty."<<std::endl; return; }
|
if (cycle.is_empty()) { std::cout<<"Empty."<<std::endl; return; }
|
||||||
std::cout<<" Root: "<<lcc.point(cycle[0])<<"; "
|
std::cout<<"Root: "<<lcc.point(cycle[0])<<"; "
|
||||||
<<" Number of edges: "<<cycle.length()<<"; "
|
<<"Number of edges: "<<cycle.length()<<"; "
|
||||||
<<" Length: "<<cycle_length(lcc, cycle)<<std::endl;
|
<<"Length: "<<cycle_length(lcc, cycle)<<std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
|
|
@ -40,7 +39,7 @@ int main(int argc, char* argv[])
|
||||||
}
|
}
|
||||||
std::cout<<"File '"<<filename<<"' loaded. Finding shortest non contractible cycle..."<<std::endl;
|
std::cout<<"File '"<<filename<<"' loaded. Finding shortest non contractible cycle..."<<std::endl;
|
||||||
|
|
||||||
CST cst(lcc);
|
CGAL::Surface_mesh_topology::Curves_on_surface_topology<LCC_3> cst(lcc);
|
||||||
LCC_3::Dart_const_handle root=lcc.darts().begin(); // Fix one vertex of the mesh
|
LCC_3::Dart_const_handle root=lcc.darts().begin(); // Fix one vertex of the mesh
|
||||||
|
|
||||||
Path_on_surface cycle1=
|
Path_on_surface cycle1=
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,7 @@
|
||||||
#include <CGAL/squared_distance_3.h>
|
#include <CGAL/squared_distance_3.h>
|
||||||
#include <CGAL/draw_face_graph_with_paths.h>
|
#include <CGAL/draw_face_graph_with_paths.h>
|
||||||
|
|
||||||
using Kernel =CGAL::Simple_cartesian<double>;
|
using Mesh =CGAL::Surface_mesh<CGAL::Simple_cartesian<double>::Point_3>;
|
||||||
using Mesh =CGAL::Surface_mesh<Kernel::Point_3>;
|
|
||||||
using Path_on_surface=CGAL::Surface_mesh_topology::Path_on_surface<Mesh>;
|
using Path_on_surface=CGAL::Surface_mesh_topology::Path_on_surface<Mesh>;
|
||||||
|
|
||||||
double cycle_length(const Mesh& mesh, const Path_on_surface& cycle)
|
double cycle_length(const Mesh& mesh, const Path_on_surface& cycle)
|
||||||
|
|
@ -22,10 +21,10 @@ double cycle_length(const Mesh& mesh, const Path_on_surface& cycle)
|
||||||
|
|
||||||
void display_cycle_info(const Mesh& mesh, const Path_on_surface& cycle)
|
void display_cycle_info(const Mesh& mesh, const Path_on_surface& cycle)
|
||||||
{ // Display information about the given cycle.
|
{ // Display information about the given cycle.
|
||||||
if (cycle.is_empty()) { std::cout<<"empty."<<std::endl; return; }
|
if (cycle.is_empty()) { std::cout<<"Empty."<<std::endl; return; }
|
||||||
std::cout<<" Root: "<<mesh.point(mesh.vertex(mesh.edge(cycle[0]), 0))<<"; "
|
std::cout<<"Root: "<<mesh.point(mesh.vertex(mesh.edge(cycle[0]), 0))<<"; "
|
||||||
<<" Number of edges: "<<cycle.length()<<"; "
|
<<"Number of edges: "<<cycle.length()<<"; "
|
||||||
<<" Length: "<<cycle_length(mesh, cycle)<<std::endl;
|
<<"Length: "<<cycle_length(mesh, cycle)<<std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue