mirror of https://github.com/CGAL/cgal
Update examples
This commit is contained in:
parent
5279a690b3
commit
9503739e1c
|
|
@ -1,13 +1,33 @@
|
|||
#include <CGAL/Linear_cell_complex_for_combinatorial_map.h>
|
||||
#include <CGAL/Linear_cell_complex_constructors.h>
|
||||
#include <CGAL/Surface_mesh_curve_topology.h>
|
||||
|
||||
#include <CGAL/Path_generators.h>
|
||||
#include <CGAL/Path_on_surface.h>
|
||||
#include <CGAL/draw_lcc_with_paths.h>
|
||||
|
||||
typedef CGAL::Linear_cell_complex_for_combinatorial_map<2,3> LCC_3_cmap;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void create_path_1(CGAL::Path_on_surface<LCC_3_cmap>& p)
|
||||
{
|
||||
p.push_back_by_index(14); // Its starting dart
|
||||
for (int i=0; i<7; ++i)
|
||||
{ p.extend_positive_turn(2); } // Extend the path
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void create_path_2(CGAL::Path_on_surface<LCC_3_cmap>& p)
|
||||
{
|
||||
// All the indices of the darts
|
||||
std::vector<std::size_t> indices={202, 206, 335, 317, 322, 69, 62, 414};
|
||||
for (std::size_t i=0; i<indices.size(); ++i)
|
||||
{ p.push_back_by_index(indices[i]); }
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void create_path_3(CGAL::Path_on_surface<LCC_3_cmap>& p)
|
||||
{
|
||||
p.push_back_by_index(470); // Its starting dart
|
||||
for (int i=0; i<13; ++i)
|
||||
{ p.extend_positive_turn(2); } // Extend the path
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
int main()
|
||||
{
|
||||
|
|
@ -19,30 +39,22 @@ int main()
|
|||
}
|
||||
|
||||
CGAL::Surface_mesh_curve_topology<LCC_3_cmap> smct(lcc);
|
||||
|
||||
CGAL::Path_on_surface<LCC_3_cmap> p1(lcc); // A first path
|
||||
p1.push_back_by_index(14); // Its starting dart
|
||||
for (int i=0; i<7; ++i)
|
||||
{ p1.extend_positive_turn(2); } // Extend the path
|
||||
|
||||
CGAL::Path_on_surface<LCC_3_cmap> p2(lcc); // A second path
|
||||
std::vector<std::size_t> indices={202, 206, 335, 317, 322, 69, 62, 414}; // All the indices of the darts
|
||||
for (int i=0; i<indices.size(); ++i)
|
||||
{ p2.push_back_by_index(indices[i]); }
|
||||
|
||||
CGAL::Path_on_surface<LCC_3_cmap> p3(lcc); // A third path
|
||||
p3.push_back_by_index(470); // Its starting dart
|
||||
for (int i=0; i<13; ++i)
|
||||
{ p3.extend_positive_turn(2); } // Extend the path
|
||||
CGAL::Path_on_surface<LCC_3_cmap> p1(lcc), p2(lcc), p3(lcc);
|
||||
create_path_1(p1);
|
||||
create_path_2(p2);
|
||||
create_path_3(p3);
|
||||
|
||||
bool res1=smct.is_contractible(p1);
|
||||
std::cout<<"Path p1 (pink) "<<(res1?"IS":"IS NOT")<<" contractible."<<std::endl;
|
||||
std::cout<<"Path p1 (pink) "<<(res1?"IS":"IS NOT")
|
||||
<<" contractible."<<std::endl;
|
||||
|
||||
bool res2=smct.are_freely_homotopic(p1, p2);
|
||||
std::cout<<"Path p1 (pink) "<<(res2?"IS":"IS NOT")<<" homotopic with path p2 (green)."<<std::endl;
|
||||
std::cout<<"Path p1 (pink) "<<(res2?"IS":"IS NOT")
|
||||
<<" homotopic with path p2 (green)."<<std::endl;
|
||||
|
||||
bool res3=smct.are_freely_homotopic(p1, p3);
|
||||
std::cout<<"Path p1 (pink) "<<(res3?"IS":"IS NOT")<<" homotopic with path p3 (orange)."<<std::endl;
|
||||
std::cout<<"Path p1 (pink) "<<(res3?"IS":"IS NOT")
|
||||
<<" homotopic with path p3 (orange)."<<std::endl;
|
||||
|
||||
#ifdef CGAL_USE_BASIC_VIEWER
|
||||
std::vector<CGAL::Path_on_surface<LCC_3_cmap> > paths;
|
||||
|
|
@ -54,3 +66,5 @@ int main()
|
|||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,34 @@
|
|||
#include <CGAL/Linear_cell_complex_for_combinatorial_map.h>
|
||||
#include <CGAL/Linear_cell_complex_constructors.h>
|
||||
#include <CGAL/Surface_mesh_curve_topology.h>
|
||||
|
||||
#include <CGAL/Path_generators.h>
|
||||
#include <CGAL/Path_on_surface.h>
|
||||
#include <CGAL/draw_lcc_with_paths.h>
|
||||
|
||||
typedef CGAL::Linear_cell_complex_for_combinatorial_map<2,3> LCC_3_cmap;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void create_path_1(CGAL::Path_on_surface<LCC_3_cmap>& p)
|
||||
{
|
||||
p.push_back_by_index(56); // Its starting dart
|
||||
for (int i=0; i<3; ++i)
|
||||
{ p.extend_positive_turn(2); } // Extend the path
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void create_path_2(CGAL::Path_on_surface<LCC_3_cmap>& p)
|
||||
{
|
||||
p.push_back_by_index(202); // Its starting dart
|
||||
for (int i=0; i<3; ++i)
|
||||
{ p.extend_negative_turn(2); } // Extend the path
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void create_path_3(CGAL::Path_on_surface<LCC_3_cmap>& p)
|
||||
{
|
||||
p.push_back_by_index(411); // Its starting dart
|
||||
p.extend_positive_turn(1); // Extend the path
|
||||
for (int i=0; i<3; ++i)
|
||||
{ p.extend_positive_turn(2); }
|
||||
p.extend_positive_turn(1);
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
int main()
|
||||
{
|
||||
|
|
@ -19,29 +40,18 @@ int main()
|
|||
}
|
||||
|
||||
CGAL::Surface_mesh_curve_topology<LCC_3_cmap> smct(lcc);
|
||||
CGAL::Path_on_surface<LCC_3_cmap> p1(lcc), p2(lcc), p3(lcc);
|
||||
create_path_1(p1);
|
||||
create_path_2(p2);
|
||||
create_path_3(p3);
|
||||
|
||||
CGAL::Path_on_surface<LCC_3_cmap> p1(lcc); // A first path
|
||||
p1.push_back_by_index(56); // Its starting dart
|
||||
for (int i=0; i<3; ++i)
|
||||
{ p1.extend_positive_turn(2); } // Extend the path
|
||||
|
||||
CGAL::Path_on_surface<LCC_3_cmap> p2(lcc); // A second path
|
||||
p2.push_back_by_index(202); // Its starting dart
|
||||
for (int i=0; i<3; ++i)
|
||||
{ p2.extend_negative_turn(2); } // Extend the path
|
||||
|
||||
CGAL::Path_on_surface<LCC_3_cmap> p3(lcc); // A third path
|
||||
p3.push_back_by_index(411); // Its starting dart
|
||||
p3.extend_positive_turn(1); // Extend the path
|
||||
for (int i=0; i<3; ++i)
|
||||
{ p3.extend_positive_turn(2); }
|
||||
p3.extend_positive_turn(1);
|
||||
|
||||
bool res1=smct.are_base_point_homotopic(p1, p2);
|
||||
std::cout<<"Path p1 (pink) "<<(res1?"IS":"IS NOT")<<" base point homotopic with path p2 (green)."<<std::endl;
|
||||
std::cout<<"Path p1 (pink) "<<(res1?"IS":"IS NOT")
|
||||
<<" base point homotopic with path p2 (green)."<<std::endl;
|
||||
|
||||
bool res2=smct.are_base_point_homotopic(p1, p3);
|
||||
std::cout<<"Path p1 (pink) "<<(res2?"IS":"IS NOT")<<" base point homotopic with path p3 (orange)."<<std::endl;
|
||||
std::cout<<"Path p1 (pink) "<<(res2?"IS":"IS NOT")
|
||||
<<" base point homotopic with path p3 (orange)."<<std::endl;
|
||||
|
||||
#ifdef CGAL_USE_BASIC_VIEWER
|
||||
std::vector<CGAL::Path_on_surface<LCC_3_cmap> > paths;
|
||||
|
|
@ -53,3 +63,4 @@ int main()
|
|||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -22,10 +22,12 @@ int main()
|
|||
CGAL::Surface_mesh_curve_topology<CMap> smct(cm);
|
||||
|
||||
bool res1=smct.are_freely_homotopic(p1, p2);
|
||||
std::cout<<"Paths p1 and p2 "<<(res1?"ARE":"ARE NOT")<<" freely homotopic."<<std::endl;
|
||||
std::cout<<"Paths p1 and p2 "<<(res1?"ARE":"ARE NOT")
|
||||
<<" freely homotopic."<<std::endl;
|
||||
|
||||
bool res2=smct.are_base_point_homotopic(p1, p2);
|
||||
std::cout<<"Paths p1 and p2 "<<(res2?"ARE":"ARE NOT")<<" base point homotopic."<<std::endl;
|
||||
std::cout<<"Paths p1 and p2 "<<(res2?"ARE":"ARE NOT")
|
||||
<<" base point homotopic."<<std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ void test(const Mesh& mesh)
|
|||
|
||||
CGAL::Path_on_surface<Mesh> p2(mesh); // A second path
|
||||
std::vector<std::size_t> indices={202, 206, 335, 317, 322, 69, 62, 414}; // All the indices of the darts
|
||||
for (int i=0; i<indices.size(); ++i)
|
||||
for (std::size_t i=0; i<indices.size(); ++i)
|
||||
{ p2.push_back_by_index(indices[i]); }
|
||||
|
||||
bool res1=smct.is_contractible(p1);
|
||||
|
|
@ -71,6 +71,8 @@ int main()
|
|||
std::cout<<"ERROR reading file data/double-torus-example.off for polyhedron."<<std::endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
CGAL::Path_on_surface<Polyhedron> path(p);
|
||||
}
|
||||
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue