00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #error this file is for documentation purposes only
00040
00041
00042
00043
00044
00045 namespace OpenMesh {
00046 namespace Concepts {
00047
00048
00049
00050
00051
00064 template <class FinalMeshItems> class KernelT
00065 {
00066 public:
00067
00069
00070
00072 typedef typename FinalMeshItems::Vertex Vertex;
00073 typedef typename FinalMeshItems::Halfedge Halfedge;
00074 typedef typename FinalMeshItems::Edge Edge;
00075 typedef typename FinalMeshItems::Face Face;
00076 typedef typename FinalMeshItems::Point Point;
00077 typedef typename FinalMeshItems::Scalar Scalar;
00078 typedef typename FinalMeshItems::Normal Normal;
00079 typedef typename FinalMeshItems::Color Color;
00080 typedef typename FinalMeshItems::TexCoord TexCoord;
00081 typedef typename FinalMeshItems::VertexHandle VertexHandle;
00082 typedef typename FinalMeshItems::HalfedgeHandle HalfedgeHandle;
00083 typedef typename FinalMeshItems::EdgeHandle EdgeHandle;
00084 typedef typename FinalMeshItems::FaceHandle FaceHandle;
00085
00087
00088
00090
00091
00092 typedef SomeIterator KernelVertexIter;
00093 typedef SomeIterator KernelConstVertexIter;
00094 typedef SomeIterator KernelEdgeIter;
00095 typedef SomeIterator KernelConstEdgeIter;
00096 typedef SomeIterator KernelFaceIter;
00097 typedef SomeIterator KernelConstFaceIter;
00099
00101
00102
00103 KernelT() {}
00104
00106 ~KernelT();
00108
00110 KernelT& operator=(const KernelT& _rhs);
00111
00112
00125 void reserve( unsigned int _n_vertices,
00126 unsigned int _n_edges,
00127 unsigned int _n_faces );
00128
00129
00131
00132
00133 const Vertex& vertex(VertexHandle _h) const { return deref(_h); }
00134 Vertex& vertex(VertexHandle _h) { return deref(_h); }
00135 const Halfedge& halfedge(HalfedgeHandle _h) const { return deref(_h); }
00136 Halfedge& halfedge(HalfedgeHandle _h) { return deref(_h); }
00137 const Edge& edge(EdgeHandle _h) const { return deref(_h); }
00138 Edge& edge(EdgeHandle _h) { return deref(_h); }
00139 const Face& face(FaceHandle _h) const { return deref(_h); }
00140 Face& face(FaceHandle _h) { return deref(_h); }
00142
00143
00145
00146
00147 VertexHandle handle(const Vertex& _v) const;
00148 HalfedgeHandle handle(const Halfedge& _he) const;
00149 EdgeHandle handle(const Edge& _e) const;
00150 FaceHandle handle(const Face& _f) const;
00152
00153
00155
00156
00157 VertexHandle vertex_handle(unsigned int _i) const;
00158 HalfedgeHandle halfedge_handle(unsigned int _i) const;
00159 EdgeHandle edge_handle(unsigned int _i) const;
00160 FaceHandle face_handle(unsigned int _i) const;
00162
00163
00165
00166
00167 void clear();
00173 void garbage_collection();
00174
00178 void remove_last_vertex() { vertices_.pop_back(); }
00182 void remove_last_edge() { edges_.pop_back(); }
00186 void remove_last_face() { faces_.pop_back(); }
00187
00189
00190
00191
00192
00194
00195
00196 unsigned int n_vertices() const;
00198 unsigned int n_halfedges() const;
00200 unsigned int n_edges() const;
00202 unsigned int n_faces() const;
00204 bool vertices_empty() const;
00206 bool halfedges_empty() const;
00208 bool edges_empty() const;
00210 bool faces_empty() const;
00212
00213
00214
00216
00217
00218 HalfedgeHandle halfedge_handle(VertexHandle _vh) const;
00220 void set_halfedge_handle(VertexHandle _vh, HalfedgeHandle _heh);
00222 const Point& point(VertexHandle _vh) const;
00224 const Point& point(const Vertex& _v) const;
00226 void set_point(VertexHandle _vh, const Point& _p);
00228 void set_point(Vertex& _v, const Point& _p);
00230
00231
00232
00233
00235
00236
00237 VertexHandle to_vertex_handle(HalfedgeHandle _heh) const;
00240 VertexHandle from_vertex_handle(HalfedgeHandle _heh) const;
00242 void set_vertex_handle(HalfedgeHandle _heh, VertexHandle _vh);
00245 FaceHandle face_handle(HalfedgeHandle _heh) const;
00247 void set_face_handle(HalfedgeHandle _heh, FaceHandle _fh);
00249 HalfedgeHandle next_halfedge_handle(HalfedgeHandle _heh) const;
00253 void set_next_halfedge_handle(HalfedgeHandle _heh, HalfedgeHandle _nheh);
00257 HalfedgeHandle prev_halfedge_handle(HalfedgeHandle _heh) const;
00259 HalfedgeHandle opposite_halfedge_handle(HalfedgeHandle _heh) const;
00261 HalfedgeHandle ccw_rotated_halfedge_handle(HalfedgeHandle _heh) const;
00263 HalfedgeHandle cw_rotated_halfedge_handle(HalfedgeHandle _heh) const;
00265 EdgeHandle edge_handle(HalfedgeHandle _heh) const;
00267
00268
00269
00271
00272
00273 HalfedgeHandle halfedge_handle(EdgeHandle _eh, unsigned int _i) const;
00275
00276
00277
00279
00280
00281 HalfedgeHandle halfedge_handle(FaceHandle _fh) const;
00283 void set_halfedge_handle(FaceHandle _fh, HalfedgeHandle _heh);
00285
00286
00287 public:
00288
00290
00291
00292
00293 const Point& point(VertexHandle _vh) const;
00294 void set_point(VertexHandle _vh, const Point& _p);
00295 Point& point(VertexHandle _vh);
00296
00297 const Normal& normal(VertexHandle _vh) const;
00298 void set_normal(VertexHandle _vh, const Normal& _n);
00299
00300 const Color& color(VertexHandle _vh) const;
00301 void set_color(VertexHandle _vh, const Color& _c)
00302
00303 const TexCoord& texcoord(VertexHandle _vh) const;
00304 void set_texcoord(VertexHandle _vh, const TexCoord& _t);
00305
00306 const StatusInfo& status(VertexHandle _vh) const;
00307 StatusInfo& status(VertexHandle _vh);
00308
00309
00310 const StatusInfo& status(HalfedgeHandle _vh) const;
00311 StatusInfo& status(HalfedgeHandle _vh);
00312
00313
00314 const StatusInfo& status(EdgeHandle _vh) const;
00315 StatusInfo& status(EdgeHandle _vh);
00316
00317
00318 const Normal& normal(FaceHandle _fh) const;
00319 void set_normal(FaceHandle _fh, const Normal& _n);
00320
00321 const Color& color(FaceHandle _fh) const;
00322 void set_color(FaceHandle _fh, const Color& _c);
00323
00324 const StatusInfo& status(FaceHandle _vh) const;
00325 StatusInfo& status(FaceHandle _vh);
00326
00328
00330
00331
00332 void request_vertex_normals();
00333 void request_vertex_colors();
00334 void request_vertex_texcoords1D();
00335 void request_vertex_texcoords2D();
00336 void request_vertex_texcoords3D();
00337 void request_vertex_status();
00338
00339 void request_halfedge_status();
00340 void request_halfedge_texcoords1D();
00341 void request_halfedge_texcoords2D();
00342 void request_halfedge_texcoords3D();
00343
00344 void request_edge_status();
00345
00346 void request_face_normals();
00347 void request_face_colors();
00348 void request_face_status();
00349 void request_face_texture_index();
00351
00353
00354
00355 void release_vertex_normals();
00356 void release_vertex_colors();
00357 void release_vertex_texcoords1D();
00358 void release_vertex_texcoords2D();
00359 void release_vertex_texcoords3D();
00360 void release_vertex_status();
00361
00362 void release_halfedge_status();
00363 void release_halfedge_texcoords1D();
00364 void release_halfedge_texcoords2D();
00365 void release_halfedge_texcoords3D();
00366
00367 void release_edge_status();
00368
00369 void release_face_normals();
00370 void release_face_colors();
00371 void release_face_status();
00372 void release_face_texture_index();
00374
00376
00377
00378 bool has_vertex_normals() const;
00379 bool has_vertex_colors() const;
00380 bool has_vertex_texcoords1D() const;
00381 bool has_vertex_texcoords2D() const;
00382 bool has_vertex_texcoords3D() const;
00383 bool has_vertex_status() const;
00384
00385 bool has_halfedge_status() const;
00386 bool has_halfedge_texcoords1D() const;
00387 bool has_halfedge_texcoords2D() const;
00388 bool has_halfedge_texcoords3D() const;
00389
00390 bool has_edge_status() const;
00391
00392 bool has_face_normals() const;
00393 bool has_face_colors() const;
00394 bool has_face_status() const;
00395 bool has_face_texture_index() const;
00397
00398 public:
00399
00401
00403
00404
00405
00406 template <typename T> bool add_property( [VEHFM]PropHandleT<T>& _ph,
00407 const std::string& _name = "" );
00409
00411
00412
00413 template <typename T> void remove_property( [VEHFM]PropHandleT<T>& );
00415
00417
00418
00419 template <typename T>
00420 bool get_property_handle( [VEHFM]PropHandleT<T>& ph, const std::string& _n ) const;
00422
00424
00425
00426 template <typename T> PropertyT<T>& property( [VEHF]PropHandleT<T> _ph );
00427 template <typename T> const PropertyT<T>& property( [VEHF]PropHandleT<T> _ph ) const;
00428 template <typename T> PropertyT<T>& mproperty( MPropHandleT<T> _ph );
00429 template <typename T> const PropertyT<T>& mproperty( MPropHandleT<T> _ph ) const;
00431
00433
00434
00436 template <typename T>
00437 T& property( VPropHandleT<T> _ph, VertexHandle _vh );
00438 template <typename T>
00439 const T& property( VPropHandleT<T> _ph, VertexHandle _vh ) const;
00440
00441 template <typename T>
00442 T& property( EPropHandleT<T> _ph, EdgeHandle _vh );
00443 template <typename T>
00444 const T& property( EPropHandleT<T> _ph, EdgeHandle _vh ) const;
00445
00446 template <typename T>
00447 T& property( HPropHandleT<T> _ph, HalfedgeHandle _vh );
00448 template <typename T>
00449 const T& property( HPropHandleT<T> _ph, HalfedgeHandle _vh ) const;
00450
00451 template <typename T>
00452 T& property( FPropHandleT<T> _ph, FaceHandle _vh );
00453 template <typename T>
00454 const T& property( FPropHandleT<T> _ph, FaceHandle _vh ) const;
00455
00456 template <typename T>
00457 T& property( MPropHandleT<T> _ph );
00458 template <typename T>
00459 const T& property( MPropHandleT<T> _ph ) const;
00460
00462
00463 public:
00464
00465
00467
00468
00470 VertexHandle new_vertex();
00473 VertexHandle new_vertex(const Point& _p);
00476 VertexHandle new_vertex(const Vertex& _v);
00482 HalfedgeHandle new_edge(VertexHandle _start_vertex_handle,
00483 VertexHandle _end_vertex_handle);
00484
00488 FaceHandle new_face();
00491 FaceHandle new_face(const Face& _f);
00493
00494
00495
00496
00498
00499
00501 KernelVertexIter vertices_begin();
00502 KernelConstVertexIter vertices_begin() const;
00503 KernelVertexIter vertices_end();
00504 KernelConstVertexIter vertices_end() const;
00505 KernelEdgeIter edges_begin();
00506 KernelConstEdgeIter edges_begin() const;
00507 KernelEdgeIter edges_end();
00508 KernelConstEdgeIter edges_end() const;
00509 KernelFaceIter faces_begin();
00510 KernelConstFaceIter faces_begin() const;
00511 KernelFaceIter faces_end();
00512 KernelConstFaceIter faces_end() const;
00514
00515
00516
00517 private:
00518
00519
00520
00521
00523 KernelT(const KernelT& _rhs);
00524 };
00525 };
00526
00527
00528
00529 }
00530 }
00531