23 #ifndef MAP_POLYGONS_H 24 #define MAP_POLYGONS_H 27 #include <CGAL/iterator.h> 28 #include "../../cgal_types.h" 29 #include <CGAL/Polyhedron_incremental_builder_3.h> 32 #include "utility/geom/pos_vec/Pos3d.h" 42 std::deque<size_t> ind_vertices;
46 inline size_t getNumVertices(
void)
const 47 {
return ind_vertices.size(); }
48 inline const size_t &Vertice(
const size_t &i)
const 49 {
return ind_vertices[(i-1)]; }
50 inline size_t &Vertice(
const size_t &i)
51 {
return ind_vertices[(i-1)]; }
52 void Print(std::ostream &os)
const;
59 typedef typename TPOL::Vertex_const_iterator VCI;
60 typedef CGAL::Inverse_index<VCI> Index;
61 typedef typename TPOL::Halfedge_around_facet_const_circulator HFCC;
73 CGAL_assertion(circulator_size( hc) >= 3);
77 ind_vertices[i]= index[VCI(hc->vertex())];
88 typedef std::map<size_t,TPOS> map_p3d;
89 typedef typename map_p3d::iterator iterator;
90 typedef typename map_p3d::const_iterator const_iterator;
92 inline const_iterator begin(
void)
const 93 {
return map_p3d::begin(); }
94 inline const_iterator end(
void)
const 95 {
return map_p3d::end(); }
96 inline iterator begin(
void)
97 {
return map_p3d::begin(); }
98 inline iterator end(
void)
99 {
return map_p3d::end(); }
100 void insert(
const size_t &i,
const TPOS &p);
101 void Print(std::ostream &os)
const;
104 template <
class TPOS>
107 template <
class TPOS>
110 for(const_iterator i= begin();i!=end();i++)
111 os <<
"Vertice: " << (*i).first <<
": " << (*i).second << std::endl;
114 template <
class TPOL>
119 typedef typename IndVertices::VCI VCI;
120 typedef typename IndVertices::Index Index;
121 typedef typename IndVertices::HFCC HFCC;
122 typedef typename TPOL::Vertex::Point Point;
124 typedef typename map_pos_vertices::const_iterator vertices_const_iterator;
125 typedef typename std::deque<IndVertices >::const_iterator caras_const_iterator;
129 std::deque<IndVertices> caras;
134 vertices_const_iterator VerticesBegin(
void)
const 135 {
return mv.begin(); }
136 vertices_const_iterator VerticesEnd(
void)
const 138 caras_const_iterator CarasBegin(
void)
const 139 {
return caras.begin(); }
140 caras_const_iterator CarasEnd(
void)
const 141 {
return caras.end(); }
143 void Print(std::ostream &os)
const;
146 template <
class TPOL>
149 typedef typename TPOL::Facet_const_iterator FCI;
151 for(VCI vi = pol.vertices_begin();
152 vi != pol.vertices_end(); ++vi)
154 mv.insert(cont,vi->point());
157 const Index index(pol.vertices_begin(),pol.vertices_end());
158 for(FCI fi = pol.facets_begin(); fi != pol.facets_end(); ++fi)
160 HFCC hc = fi->facet_begin();
165 template <
class TPOL>
168 os <<
"vertex list: " << std::endl;
170 os <<
"face list: " << std::endl;
171 for(caras_const_iterator i= caras.begin();i!=caras.end();i++)
179 template <
class TPOL>
180 std::ostream &operator<<(std::ostream &os, const PolygonMap<TPOL> &mt)
186 template <
class TPOL>
190 template <
class TPOLORG,
class HDS,
class CVPOS>
196 typedef typename HDS::Vertex Vertex;
197 typedef typename Vertex::Point Point;
198 typedef typename PolygonMap<TPOLORG>::vertices_const_iterator vconst_iter;
199 typedef typename PolygonMap<TPOLORG>::caras_const_iterator cconst_iter;
204 void operator()(HDS& hds);
207 template <
class TPOLORG,
class HDS,
class CVPOS>
210 const size_t num_facetas= sf.size_of_facets();
211 const size_t num_edges= sf.size_of_halfedges();
212 const size_t num_vertices= sf.size_of_vertices();
215 CGAL::Polyhedron_incremental_builder_3<HDS> B(hds,
true);
217 B.begin_surface(num_vertices,num_facetas,num_edges);
218 for(vconst_iter i= mt.VerticesBegin();i!=mt.VerticesEnd();i++)
221 B.add_vertex(CVPOS()(p));
223 for(cconst_iter j= mt.CarasBegin();j!=mt.CarasEnd();j++)
226 const size_t nv= (*j).getNumVertices();
227 for(
size_t i=0;i<nv;i++)
228 B.add_vertex_to_facet((*j).Vertice(i+1));
Definition: PolygonMap.h:115
Definition: PolygonMap.h:56
Definition: PolygonMap.h:84
Almacena los indices de los vértices de un polígono.
Definition: PolygonMap.h:39
Definition: PolygonMap.h:191