40 #include <geogram/mesh/mesh.h> 53 std::vector< index_t > global_vertex_id_to_id_in_cc(
54 mesh_.vertices.nb(), NO_ID );
56 std::vector< bool > visited(
mesh_.facets.nb(), false );
61 std::vector< index_t > cc_corners;
62 std::vector< index_t > cc_facets_ptr;
63 std::vector< vec3 > cc_vertices;
68 std::fill( global_vertex_id_to_id_in_cc.begin(),
69 global_vertex_id_to_id_in_cc.end(), NO_ID );
72 cc_facets_ptr.push_back( 0 );
75 std::stack< index_t > S;
83 for(
auto c :
range(
mesh_.facets.corners_begin( f ),
84 mesh_.facets.corners_end( f ) ) )
86 index_t v{
mesh_.facet_corners.vertex( c ) };
87 if( global_vertex_id_to_id_in_cc[v] == NO_ID )
89 index_t index{
static_cast< index_t
>(
90 cc_vertices.size() ) };
91 global_vertex_id_to_id_in_cc[v] = index;
92 cc_vertices.push_back(
mesh_.vertices.point( v ) );
94 cc_corners.push_back( global_vertex_id_to_id_in_cc[v] );
96 index_t n{
mesh_.facet_corners.adjacent_facet( c ) };
97 if( n != NO_ID && !visited[n] )
103 index_t nb_cc_corners{
static_cast< index_t
>(
104 cc_corners.size() ) };
105 cc_facets_ptr.push_back( nb_cc_corners );
109 Surface3D::type_name_static() ) };
110 geometry.set_surface_geometry( surface_gme.index(), cc_vertices,
111 cc_corners, cc_facets_ptr );
GeoModelBuilderGeometry< DIMENSION > geometry
GeoModelBuilderTopology< DIMENSION > topology
Classes to build GeoModel from various inputs.
void build_polygonal_surfaces_from_connected_components()
This template is a specialization of a gme_id to the GeoModelMeshEntity.