diff --git a/Doc/Concepts/MeshKernel.hh b/Doc/Concepts/MeshKernel.hh index 5dbff6d59b4ff4472ca90abb275d21ee419db79e..ee26013f262c501d43a533fd4bd1ce73e7c284a1 100644 --- a/Doc/Concepts/MeshKernel.hh +++ b/Doc/Concepts/MeshKernel.hh @@ -342,6 +342,7 @@ public: // Standard Property Management void request_halfedge_texcoords3D(); void request_edge_status(); + void request_edge_colors(); void request_face_normals(); void request_face_colors(); @@ -365,6 +366,7 @@ public: // Standard Property Management void release_halfedge_texcoords3D(); void release_edge_status(); + void release_edge_colors(); void release_face_normals(); void release_face_colors(); @@ -388,6 +390,7 @@ public: // Standard Property Management bool has_halfedge_texcoords3D() const; bool has_edge_status() const; + bool has_edge_colors() const; bool has_face_normals() const; bool has_face_colors() const; diff --git a/Doc/mesh.docu b/Doc/mesh.docu index 9a2b12b180e3430f6993f21ee5edcc87886016df..7f259f9e1c6447c193e0515d3814362289fe656b 100644 --- a/Doc/mesh.docu +++ b/Doc/mesh.docu @@ -703,24 +703,25 @@ provided by %OpenMesh which can be found in the IO subdirectory. /** \page mesh_iterators Mesh Iterators and Circulators +- \ref it_iters +- \ref it_iters_h +- \ref it_circs +- \ref it_circs_h + +\section it_iters Iterators + The mesh provides linear iterators (that enumerate vertices, -halfedges, edges, and faces) and so called circulators (to iterate \em -around a vertex or a face). These can be used to easily navigate +halfedges, edges, and faces). These can be used to easily navigate through a mesh. Each iterator \c XYZIter also exists in a const version \c ConstXYZIter. -All iterators and circulators are defined in the namespace +All iterators are defined in the namespace OpenMesh::Iterators. They are template classes that expect a mesh as template argument to be fully specified. You should use the -iterator/circulator types provided by the mesh itself, i.e. \c -MyMesh::VertexIter instead of \c -OpenMesh::Iterators::VertexIterT. - +iterator types provided by the mesh itself, i.e. \c MyMesh::VertexIter instead of \c +OpenMesh::Iterators::VertexIterT. -\subsection subsec_iterators Linear Iterators - -The linear iterators are used to enumerate all mesh items, e.g. for -rendering purposes. The iterators and their \c const counterparts are: +The iterators are: \include iterators.cc @@ -737,6 +738,8 @@ description of their interface see OpenMesh::Concepts::IteratorT. For efficiency reasons the \c operation++(int) (post-increment) and \c operation--(int) (post-decrement) are not implemented. +Hence, when using iterators, use the pre-increment operation +(++it). Additionally to the standard operations, each linear iterator provides a method \c handle(), which returns the handle of the item referred to by the iterator. @@ -746,20 +749,40 @@ handle of an item. To store many references to an item, it is therefore better to use handles. -

-\subsection subsec_circulators Circulators +\section it_iters_h How to use iterators in OpenMesh + +This example shows how to iterate over all faces of a mesh: + +\code + +MyMesh mesh; -Circulators provide means to enumerate items adjacent to -another item of the same or another type. For example, -a \c VertexVertexIter allows to enumerate all vertices +for(MyMesh::FaceIter f_it = mesh.faces_begin(); f_it != mesh.faces_end(); ++f_it) { + std::cout << "The face's valence is " << mesh.valence( f_it.handle() ) << std::endl; +} + +\endcode + + +\section it_circs Circulators + +%OpenMesh also provides so called Circulators that +provide means to enumerate items adjacent to +another item of the same or another type. +For example, a \c VertexVertexIter allows to enumerate all vertices immediately adjacent to a (center) vertex (i.e. it allows to enumerate the so-called 1-ring of the center vertex). Analogously, a \c FaceHalfedgeIter enumerates all the halfedges belonging to a face. In general, \c CenterItem_AuxiliaryInformation_TargetItem_Iter -designates a circulator that enumarates all the target items +designates a circulator that enumerates all the target items around a given center item. +The constructor of a circulator is of the form +\c Circulator(MeshType mesh, TargetHandle center_handle), +i.e. it takes a mesh and the handle of the item to circulate +around. + The circulators around a vertex are: \arg \c VertexVertexIter: iterate over all neighboring vertices. @@ -775,11 +798,6 @@ The circulators around a face are: \arg \c FaceEdgeIter: iterate over the face's edges. \arg \c FaceFaceIter: iterate over all edge-neighboring faces. -The constructor of a circulator is of the form -\c Circulator(MeshType mesh, TargetHandle center_handle), -i.e. it takes a mesh and the handle of the item to iterate -around. - All circulators provide the operations listed in CirculatorT, which are basically the same as the iterator funtions. @@ -802,10 +820,33 @@ the circulator of an item. Example:
ConstVertexVertexIter cvvit = mesh.cvv_iter(some_vertex_handle); \endcode +\section it_circs_h How to use circulators in OpenMesh + The following code example now shows how to enumerate the 1-ring of each vertex: \include circulators.cc +Enumerating all halfedges adjacent to a certain face (the inner halfedges) is accomplished +as follows: + +\code + +MyMesh mesh; + +... + +// Assuming faceHandle contains the face handle of the target face + +MyMesh::FaceHalfedgeIter fh_it = mesh.fh_iter(faceHandle); + +for(; fh_it; ++fh_it) { + std::cout << "Halfedge has handle " << fh_it.handle() << std::endl; +} + +\endcode + + + */ diff --git a/Doc/tutorial_05.docu b/Doc/tutorial_05.docu index 7be9c6c7c05cb2d640459206f01603c7f0343e9f..05b32e735af5fc6d95a0972972df847d81460cae 100644 --- a/Doc/tutorial_05.docu +++ b/Doc/tutorial_05.docu @@ -26,7 +26,7 @@ entity for which it can be used. Color X X -   + X   @@ -108,6 +108,7 @@ are:
  • request_edge_status()
  • +
  • request_edge_colors()
  • request_face_colors()
  • request_face_normals()
  • request_face_status()
  • @@ -128,6 +129,7 @@ Added properties can be released by the following functions:
    • release_edge_status()
    • +
    • release_edge_colors()
    • release_face_colors()
    • release_face_normals()
    • release_face_status()
    • @@ -148,6 +150,7 @@ A property's existance can be tested with
      • has_edge_status()
      • +
      • has_edge_colors()
      • has_face_colors()
      • has_face_normals()
      • has_face_status()
      • @@ -200,4 +203,4 @@ The complete source looks like this: \include 05-std_properties/properties.cc -*/ \ No newline at end of file +*/