21 #ifndef EMODNET_QMGC_POLYHEDRON_BUILDER_FROM_C3T3_BOUNDARY_H 22 #define EMODNET_QMGC_POLYHEDRON_BUILDER_FROM_C3T3_BOUNDARY_H 24 #include <CGAL/Polyhedron_incremental_builder_3.h> 25 #include <CGAL/Polygon_mesh_processing/orient_polygon_soup.h> 26 #include "tin_creation/tin_creation_cgal_types.h" 27 #include <CGAL/array.h> 36 template<
class C3T3,
class HDS>
40 typename C3T3::Subdomain_index m_index ;
41 typedef typename C3T3::Point::Point Point_3;
44 const typename C3T3::Subdomain_index& index ) : m_c3t3(c), m_index(index) {}
46 void operator()( HDS& hds )
49 typedef typename C3T3::Triangulation Triangulation;
50 typedef typename Triangulation::Vertex_handle Vertex_handle;
53 std::map<Vertex_handle, std::size_t> V;
55 std::vector<Point_3 > vertices ;
56 std::vector<std::vector<std::size_t>> facesIndices ;
58 std::size_t numVerts = 0;
59 std::size_t numFacets = 0;
60 for(
typename C3T3::Facets_in_complex_iterator
61 fit = m_c3t3.facets_in_complex_begin(),
62 end = m_c3t3.facets_in_complex_end();
65 typename C3T3::Subdomain_index cell_sd = m_c3t3.subdomain_index(fit->first);
66 typename C3T3::Subdomain_index opp_sd = m_c3t3.subdomain_index(fit->first->neighbor(fit->second));
68 if (cell_sd!=m_index && opp_sd!=m_index)
continue;
73 std::vector<std::size_t> indices; indices.resize(3);
74 for (
int i = 0; i < 4; ++i) {
75 if (i != fit->second) {
77 Vertex_handle v = (*fit).first->vertex(i) ;
78 std::pair<typename std::map<Vertex_handle, std::size_t>::iterator,
bool> res = V.insert(std::make_pair(v,numVerts));
83 vertices.push_back( res.first->first->point().point() );
85 indices[j++] = res.first->second;
88 facesIndices.push_back(indices);
92 CGAL::Polygon_mesh_processing::orient_polygon_soup(vertices, facesIndices);
95 CGAL::Polyhedron_incremental_builder_3<HDS> B( hds,
true);
98 B.begin_surface( vertices.size(), facesIndices.size() );
100 for(
typename std::vector<Point_3>::iterator it = vertices.begin(); it != vertices.end(); ++it )
105 for( std::vector<std::vector<std::size_t>>::iterator it = facesIndices.begin(); it != facesIndices.end(); ++it )
142 B.add_vertex_to_facet( (*it)[0] );
143 B.add_vertex_to_facet( (*it)[1] );
144 B.add_vertex_to_facet( (*it)[2] );
153 #endif //EMODNET_QMGC_POLYHEDRON_BUILDER_FROM_C3T3_BOUNDARY_H A modifier creating a Polyhedron_3 structure with the incremental builder from the boundary in a C3T3...
Definition: polyhedron_builder_from_c3t3_boundary.h:37