Add test for surface mesh topology

This commit is contained in:
Guillaume Damiand 2019-11-24 20:49:15 +01:00
parent 8dc0d92da5
commit 7d6b31e670
3 changed files with 68 additions and 22 deletions

View File

@ -2469,6 +2469,30 @@ namespace CGAL {
run(*this, adart, amark);
}
/// Keep the biggest connected component.
/// @return the size (in number of darts) of the biggest cc.
std::size_t keep_biggest_connected_component()
{
std::map<std::size_t, Dart_handle> ccs;
size_type treated=get_new_mark();
for (auto it=darts().begin(), itend=darts().end(); it!=itend; ++it)
{
if (!is_marked(it, treated))
{ ccs[mark_cell<dimension+1>(it, treated)]=it; }
}
if (ccs.size()>1)
{ // Here all darts are marked
this->template unmark_cell<dimension+1>(ccs.rbegin()->second, treated); // Unmark the biggest cc
erase_marked_darts(treated);
}
free_mark(treated);
return ccs.rbegin()->first;
}
/** Count the marked cells (at least one marked dart).
* @param amark the mark to consider.
* @param avector containing the dimensions of the cells to count.

View File

@ -35,8 +35,9 @@ class Curves_on_surface_topology
{
public:
typedef internal::Minimal_quadrangulation<Mesh> Minimal_quadrangulation;
typedef typename Minimal_quadrangulation::Original_map Original_map;
typedef typename Minimal_quadrangulation::Reduced_map Reduced_map;
Curves_on_surface_topology(const Mesh& amesh, bool /* display_time */=false) :
m_original_mesh(amesh),
m_minimal_quadrangulation(nullptr)
@ -56,6 +57,10 @@ public:
}
}
/// Return the original map.
const Original_map& get_original_map() const
{ return m_minimal_quadrangulation->get_original_map(); }
/// Return the reduced map computed in the minimal quadrangulation.
/// @pre is_minimal_quadrangulation_computed()
const Reduced_map& get_minimal_quadrangulation() const

View File

@ -7,27 +7,44 @@ if(CGAL_Qt5_FOUND)
add_definitions(-DCGAL_USE_BASIC_VIEWER -DQT_NO_KEYWORDS)
endif()
if ( CGAL_FOUND )
create_single_source_cgal_program("fundamental_group_of_the_circle.cpp")
create_single_source_cgal_program("fundamental_group_of_the_torus.cpp")
create_single_source_cgal_program("homotopy_big_cylinder.cpp")
create_single_source_cgal_program("homotopy_double_torus_with_holes.cpp")
create_single_source_cgal_program("homotopy_rond_point_saucisse.cpp")
create_single_source_cgal_program("homotopy_small_cylinder.cpp")
create_single_source_cgal_program("path_tests.cpp")
create_single_source_cgal_program("path_with_rle_deformation_tests.cpp")
create_single_source_cgal_program("test_homotopy.cpp")
create_single_source_cgal_program("tests_path_on_surface.cpp")
if ( NOT CGAL_FOUND )
if(CGAL_Qt5_FOUND)
target_link_libraries(fundamental_group_of_the_circle PUBLIC CGAL::CGAL_Qt5)
target_link_libraries(fundamental_group_of_the_torus PUBLIC CGAL::CGAL_Qt5)
target_link_libraries(path_with_rle_deformation_tests PUBLIC CGAL::CGAL_Qt5)
target_link_libraries(test_homotopy PUBLIC CGAL::CGAL_Qt5)
endif()
message(FATAL_ERROR "This program requires the CGAL library, and will not be compiled.")
else()
message(STATUS "This program requires the CGAL library, and will not be compiled.")
endif()
set(HEADER_FILES
../../include/CGAL/Curves_on_surface_topology.h
../../include/CGAL/draw_face_graph_with_paths.h
../../include/CGAL/Path_on_surface.h
../../include/CGAL/Polygonal_schema.h
../../include/CGAL/Polygonal_schema_min_items.h
../../include/CGAL/Surface_mesh_topology/internal/Minimal_quadrangulation.h
../../include/CGAL/Surface_mesh_topology/internal/Path_generators.h
../../include/CGAL/Surface_mesh_topology/internal/Path_on_surface_with_rle.h
)
set(SOURCE_FILES
fundamental_group_of_the_circle.cpp
fundamental_group_of_the_torus.cpp
homotopy_big_cylinder.cpp
homotopy_double_torus_with_holes.cpp
homotopy_rond_point_saucisse.cpp
homotopy_small_cylinder.cpp
path_tests.cpp
path_with_rle_deformation_tests.cpp
test_homotopy.cpp
test_homotopy_with_polygonal_schema.cpp
tests_path_on_surface.cpp
)
foreach(cppfile ${SOURCE_FILES})
create_single_source_cgal_program("${cppfile}" ${HEADER_FILES})
endforeach()
if(CGAL_Qt5_FOUND)
target_link_libraries(fundamental_group_of_the_circle PUBLIC CGAL::CGAL_Qt5)
target_link_libraries(fundamental_group_of_the_torus PUBLIC CGAL::CGAL_Qt5)
target_link_libraries(path_with_rle_deformation_tests PUBLIC CGAL::CGAL_Qt5)
target_link_libraries(test_homotopy PUBLIC CGAL::CGAL_Qt5)
endif()