OpenMesh
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
MeshKernel.hh
1 /*===========================================================================*\
2  * *
3  * OpenMesh *
4  * Copyright (C) 2001-2011 by Computer Graphics Group, RWTH Aachen *
5  * www.openmesh.org *
6  * *
7  *---------------------------------------------------------------------------*
8  * This file is part of OpenMesh. *
9  * *
10  * OpenMesh is free software: you can redistribute it and/or modify *
11  * it under the terms of the GNU Lesser General Public License as *
12  * published by the Free Software Foundation, either version 3 of *
13  * the License, or (at your option) any later version with the *
14  * following exceptions: *
15  * *
16  * If other files instantiate templates or use macros *
17  * or inline functions from this file, or you compile this file and *
18  * link it with other files to produce an executable, this file does *
19  * not by itself cause the resulting executable to be covered by the *
20  * GNU Lesser General Public License. This exception does not however *
21  * invalidate any other reasons why the executable file might be *
22  * covered by the GNU Lesser General Public License. *
23  * *
24  * OpenMesh is distributed in the hope that it will be useful, *
25  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
26  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
27  * GNU Lesser General Public License for more details. *
28  * *
29  * You should have received a copy of the GNU LesserGeneral Public *
30  * License along with OpenMesh. If not, *
31  * see <http://www.gnu.org/licenses/>. *
32  * *
33 \*===========================================================================*/
34 
35 /*===========================================================================*\
36  * *
37  * $Revision: 514 $ *
38  * $Date: 2012-01-20 09:08:18 +0100 (Fr, 20 Jan 2012) $ *
39  * *
40 \*===========================================================================*/
41 
42 
43 //=============================================================================
44 //
45 // Kernel Concept
46 //
47 //=============================================================================
48 
49 
50 #error this file is for documentation purposes only
51 
52 
53 //== NAMESPACES ===============================================================
54 
55 
56 namespace OpenMesh {
57 namespace Concepts {
58 
59 
60 //== CLASS DEFINITION =========================================================
61 
62 
75 template <class FinalMeshItems> class KernelT
76 {
77 public:
78 
80 
81 
83  typedef typename FinalMeshItems::Vertex Vertex;
84  typedef typename FinalMeshItems::Halfedge Halfedge;
85  typedef typename FinalMeshItems::Edge Edge;
86  typedef typename FinalMeshItems::Face Face;
87  typedef typename FinalMeshItems::Point Point;
88  typedef typename FinalMeshItems::Scalar Scalar;
89  typedef typename FinalMeshItems::Normal Normal;
90  typedef typename FinalMeshItems::Color Color;
91  typedef typename FinalMeshItems::TexCoord TexCoord;
92  typedef typename FinalMeshItems::VertexHandle VertexHandle;
93  typedef typename FinalMeshItems::HalfedgeHandle HalfedgeHandle;
94  typedef typename FinalMeshItems::EdgeHandle EdgeHandle;
95  typedef typename FinalMeshItems::FaceHandle FaceHandle;
96 
98 
99 
101 
102 
103  typedef SomeIterator KernelVertexIter;
104  typedef SomeIterator KernelConstVertexIter;
105  typedef SomeIterator KernelEdgeIter;
106  typedef SomeIterator KernelConstEdgeIter;
107  typedef SomeIterator KernelFaceIter;
108  typedef SomeIterator KernelConstFaceIter;
110 
112 
113 
114  KernelT() {}
115 
117  ~KernelT();
119 
121  KernelT& operator=(const KernelT& _rhs);
122 
123 
136  void reserve( unsigned int _n_vertices,
137  unsigned int _n_edges,
138  unsigned int _n_faces );
139 
140 
142 
143 
144  const Vertex& vertex(VertexHandle _h) const { return deref(_h); }
145  Vertex& vertex(VertexHandle _h) { return deref(_h); }
146  const Halfedge& halfedge(HalfedgeHandle _h) const { return deref(_h); }
147  Halfedge& halfedge(HalfedgeHandle _h) { return deref(_h); }
148  const Edge& edge(EdgeHandle _h) const { return deref(_h); }
149  Edge& edge(EdgeHandle _h) { return deref(_h); }
150  const Face& face(FaceHandle _h) const { return deref(_h); }
151  Face& face(FaceHandle _h) { return deref(_h); }
153 
154 
156 
157 
158  VertexHandle handle(const Vertex& _v) const;
159  HalfedgeHandle handle(const Halfedge& _he) const;
160  EdgeHandle handle(const Edge& _e) const;
161  FaceHandle handle(const Face& _f) const;
163 
164 
166 
167 
168  VertexHandle vertex_handle(unsigned int _i) const;
169  HalfedgeHandle halfedge_handle(unsigned int _i) const;
170  EdgeHandle edge_handle(unsigned int _i) const;
171  FaceHandle face_handle(unsigned int _i) const;
173 
174 
176 
177 
178  void clear();
184  void garbage_collection();
185 
189  void remove_last_vertex() { vertices_.pop_back(); }
193  void remove_last_edge() { edges_.pop_back(); }
197  void remove_last_face() { faces_.pop_back(); }
198 
200 
201 
202 
203 
205 
206 
207  unsigned int n_vertices() const;
209  unsigned int n_halfedges() const;
211  unsigned int n_edges() const;
213  unsigned int n_faces() const;
215  bool vertices_empty() const;
217  bool halfedges_empty() const;
219  bool edges_empty() const;
221  bool faces_empty() const;
223 
224 
225 
227 
228 
233  const Point& point(VertexHandle _vh) const;
235  const Point& point(const Vertex& _v) const;
237  void set_point(VertexHandle _vh, const Point& _p);
239  void set_point(Vertex& _v, const Point& _p);
241 
242 
243 
244 
246 
247 
258  void set_face_handle(HalfedgeHandle _heh, FaceHandle _fh);
278 
279 
280 
282 
283 
284  HalfedgeHandle halfedge_handle(EdgeHandle _eh, unsigned int _i) const;
286 
287 
288 
290 
291 
296 
297 
298 public: // Standard Property Management
299 
301 
302 
303  // vertex
304  const Point& point(VertexHandle _vh) const;
305  void set_point(VertexHandle _vh, const Point& _p);
306  Point& point(VertexHandle _vh);
307 
308  const Normal& normal(VertexHandle _vh) const;
309  void set_normal(VertexHandle _vh, const Normal& _n);
310 
311  const Normal& normal(HalfedgeHandle _heh) const;
312  void set_normal(HalfedgeHandle _heh, const Normal& _n);
313 
314  const Color& color(VertexHandle _vh) const;
315  void set_color(VertexHandle _vh, const Color& _c);
316 
317  const TexCoord1D& texcoord1D(VertexHandle _vh) const;
318  void set_texcoord1D(VertexHandle _vh, const TexCoord1D& _t);
319 
320  const TexCoord2D& texcoord2D(VertexHandle _vh) const;
321  void set_texcoord2D(VertexHandle _vh, const TexCoord2D& _t);
322 
323  const TexCoord3D& texcoord3D(VertexHandle _vh) const;
324  void set_texcoord3D(VertexHandle _vh, const TexCoord3D& _t);
325 
326  const TexCoord1D& texcoord1D(HalfedgeHandle _hh) const;
327  void set_texcoord1D(HalfedgeHandle _hh, const TexCoord1D& _t);
328 
329  const TexCoord2D& texcoord2D(HalfedgeHandle _hh) const;
330  void set_texcoord2D(HalfedgeHandle _hh, const TexCoord2D& _t);
331 
332  const TexCoord3D& texcoord3D(HalfedgeHandle _hh) const;
333  void set_texcoord3D(HalfedgeHandle _hh, const TexCoord3D& _t);
334 
335  const StatusInfo& status(VertexHandle _vh) const;
336  StatusInfo& status(VertexHandle _vh);
337 
338  // halfedge
339  const StatusInfo& status(HalfedgeHandle _vh) const;
340  StatusInfo& status(HalfedgeHandle _vh);
341 
342  // edge
343  const StatusInfo& status(EdgeHandle _vh) const;
344  StatusInfo& status(EdgeHandle _vh);
345 
346  // face
347  const Normal& normal(FaceHandle _fh) const;
348  void set_normal(FaceHandle _fh, const Normal& _n);
349 
350  const Color& color(FaceHandle _fh) const;
351  void set_color(FaceHandle _fh, const Color& _c);
352 
353  const StatusInfo& status(FaceHandle _vh) const;
354  StatusInfo& status(FaceHandle _vh);
355 
357 
359 
360 
361  void request_vertex_normals();
362  void request_vertex_colors();
366  void request_vertex_status();
367 
373 
374  void request_edge_status();
375  void request_edge_colors();
376 
377  void request_face_normals();
378  void request_face_colors();
379  void request_face_status();
382 
384 
385 
386  void release_vertex_normals();
387  void release_vertex_colors();
391  void release_vertex_status();
392 
398 
399  void release_edge_status();
400  void release_edge_colors();
401 
402  void release_face_normals();
403  void release_face_colors();
404  void release_face_status();
407 
409 
410 
411  bool has_vertex_normals() const;
412  bool has_vertex_colors() const;
413  bool has_vertex_texcoords1D() const;
414  bool has_vertex_texcoords2D() const;
415  bool has_vertex_texcoords3D() const;
416  bool has_vertex_status() const;
417 
418  bool has_halfedge_status() const;
419  bool has_halfedge_normals(); const;
420  bool has_halfedge_texcoords1D() const;
421  bool has_halfedge_texcoords2D() const;
422  bool has_halfedge_texcoords3D() const;
423 
424  bool has_edge_status() const;
425  bool has_edge_colors() const;
426 
427  bool has_face_normals() const;
428  bool has_face_colors() const;
429  bool has_face_status() const;
430  bool has_face_texture_index() const;
432 
433 public: // Property Management
434 
436 
438 
439 
440 
441  template <typename T> bool add_property( [VEHFM]PropHandleT<T>& _ph,
442  const std::string& _name = "" );
444 
446 
447 
448  template <typename T> void remove_property( [VEHFM]PropHandleT<T>& );
450 
452 
453 
454  template <typename T>
455  bool get_property_handle( [VEHFM]PropHandleT<T>& ph, const std::string& _n ) const;
457 
459 
460 
461  template <typename T> PropertyT<T>& property( [VEHF]PropHandleT<T> _ph );
462  template <typename T> const PropertyT<T>& property( [VEHF]PropHandleT<T> _ph ) const;
463  template <typename T> PropertyT<T>& mproperty( MPropHandleT<T> _ph );
464  template <typename T> const PropertyT<T>& mproperty( MPropHandleT<T> _ph ) const;
466 
468 
469 
471  template <typename T>
472  T& property( VPropHandleT<T> _ph, VertexHandle _vh );
473  template <typename T>
474  const T& property( VPropHandleT<T> _ph, VertexHandle _vh ) const;
475 
476  template <typename T>
477  T& property( EPropHandleT<T> _ph, EdgeHandle _vh );
478  template <typename T>
479  const T& property( EPropHandleT<T> _ph, EdgeHandle _vh ) const;
480 
481  template <typename T>
482  T& property( HPropHandleT<T> _ph, HalfedgeHandle _vh );
483  template <typename T>
484  const T& property( HPropHandleT<T> _ph, HalfedgeHandle _vh ) const;
485 
486  template <typename T>
487  T& property( FPropHandleT<T> _ph, FaceHandle _vh );
488  template <typename T>
489  const T& property( FPropHandleT<T> _ph, FaceHandle _vh ) const;
490 
491  template <typename T>
492  T& property( MPropHandleT<T> _ph );
493  template <typename T>
494  const T& property( MPropHandleT<T> _ph ) const;
495 
497 
498 public:
499 
500 
502 
503 
508  VertexHandle new_vertex(const Point& _p);
511  VertexHandle new_vertex(const Vertex& _v);
517  HalfedgeHandle new_edge(VertexHandle _start_vertex_handle,
518  VertexHandle _end_vertex_handle);
519 
526  FaceHandle new_face(const Face& _f);
528 
529 
530  // --- iterators ---
531 
533 
534 
549 
550 
551 
552 private:
553 
554 
555  // --- private functions ---
556 
558  KernelT(const KernelT& _rhs);
559 };
560 };
561 
562 
563 //=============================================================================
564 } // namespace Concepts
565 } // namespace OpenMesh
566 //=============================================================================

acg pic Project OpenMesh, ©  Computer Graphics Group, RWTH Aachen. Documentation generated using doxygen .