Commit ec94d3b3 authored by Mike Kremer's avatar Mike Kremer

Updated documentation to match the recently added edge color functions.

Tidied up the iterators and circulators section.

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@262 fdac6126-5c0c-442c-9429-916003d36597
parent 27f149ce
...@@ -342,6 +342,7 @@ public: // Standard Property Management ...@@ -342,6 +342,7 @@ public: // Standard Property Management
void request_halfedge_texcoords3D(); void request_halfedge_texcoords3D();
void request_edge_status(); void request_edge_status();
void request_edge_colors();
void request_face_normals(); void request_face_normals();
void request_face_colors(); void request_face_colors();
...@@ -365,6 +366,7 @@ public: // Standard Property Management ...@@ -365,6 +366,7 @@ public: // Standard Property Management
void release_halfedge_texcoords3D(); void release_halfedge_texcoords3D();
void release_edge_status(); void release_edge_status();
void release_edge_colors();
void release_face_normals(); void release_face_normals();
void release_face_colors(); void release_face_colors();
...@@ -388,6 +390,7 @@ public: // Standard Property Management ...@@ -388,6 +390,7 @@ public: // Standard Property Management
bool has_halfedge_texcoords3D() const; bool has_halfedge_texcoords3D() const;
bool has_edge_status() const; bool has_edge_status() const;
bool has_edge_colors() const;
bool has_face_normals() const; bool has_face_normals() const;
bool has_face_colors() const; bool has_face_colors() const;
......
...@@ -703,24 +703,25 @@ provided by %OpenMesh which can be found in the IO subdirectory. ...@@ -703,24 +703,25 @@ provided by %OpenMesh which can be found in the IO subdirectory.
/** \page mesh_iterators Mesh Iterators and Circulators /** \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, The mesh provides linear iterators (that enumerate vertices,
halfedges, edges, and faces) and so called circulators (to iterate \em halfedges, edges, and faces). These can be used to easily navigate
around a vertex or a face). These can be used to easily navigate
through a mesh. Each iterator \c XYZIter also exists in a const through a mesh. Each iterator \c XYZIter also exists in a const
version \c ConstXYZIter. 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 OpenMesh::Iterators. They are template classes that expect a mesh as
template argument to be fully specified. You should use the template argument to be fully specified. You should use the
iterator/circulator types provided by the mesh itself, i.e. \c iterator types provided by the mesh itself, i.e. \c MyMesh::VertexIter instead of \c
MyMesh::VertexIter instead of \c
OpenMesh::Iterators::VertexIterT<MyMesh>. OpenMesh::Iterators::VertexIterT<MyMesh>.
The iterators are:
\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:
\include iterators.cc \include iterators.cc
...@@ -737,6 +738,8 @@ description of their interface see OpenMesh::Concepts::IteratorT. ...@@ -737,6 +738,8 @@ description of their interface see OpenMesh::Concepts::IteratorT.
For efficiency reasons the \c operation++(int) (post-increment) For efficiency reasons the \c operation++(int) (post-increment)
and \c operation--(int) (post-decrement) are not implemented. 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 Additionally to the standard operations, each linear iterator
provides a method \c handle(), which returns the handle of the provides a method \c handle(), which returns the handle of the
item referred to by the iterator. item referred to by the iterator.
...@@ -746,20 +749,40 @@ handle of an item. To store many references to an item, it is ...@@ -746,20 +749,40 @@ handle of an item. To store many references to an item, it is
therefore better to use handles. therefore better to use handles.
<br><br> \section it_iters_h How to use iterators in OpenMesh
\subsection subsec_circulators Circulators
This example shows how to iterate over all faces of a mesh:
\code
MyMesh mesh;
Circulators provide means to enumerate items adjacent to for(MyMesh::FaceIter f_it = mesh.faces_begin(); f_it != mesh.faces_end(); ++f_it) {
another item of the same or another type. For example, std::cout << "The face's valence is " << mesh.valence( f_it.handle() ) << std::endl;
a \c VertexVertexIter allows to enumerate all vertices }
\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 immediately adjacent to a (center) vertex (i.e. it allows
to enumerate the so-called 1-ring of the center vertex). to enumerate the so-called 1-ring of the center vertex).
Analogously, a \c FaceHalfedgeIter enumerates all the Analogously, a \c FaceHalfedgeIter enumerates all the
halfedges belonging to a face. halfedges belonging to a face.
In general, \c CenterItem_AuxiliaryInformation_TargetItem_Iter 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. 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: The circulators around a vertex are:
\arg \c VertexVertexIter: iterate over all neighboring vertices. \arg \c VertexVertexIter: iterate over all neighboring vertices.
...@@ -775,11 +798,6 @@ The circulators around a face are: ...@@ -775,11 +798,6 @@ The circulators around a face are:
\arg \c FaceEdgeIter: iterate over the face's edges. \arg \c FaceEdgeIter: iterate over the face's edges.
\arg \c FaceFaceIter: iterate over all edge-neighboring faces. \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 All circulators provide the operations listed in
CirculatorT<Mesh>, which are basically the same as the CirculatorT<Mesh>, which are basically the same as the
iterator funtions. iterator funtions.
...@@ -802,10 +820,33 @@ the circulator of an item. Example:<br/> ...@@ -802,10 +820,33 @@ the circulator of an item. Example:<br/>
ConstVertexVertexIter cvvit = mesh.cvv_iter(some_vertex_handle); ConstVertexVertexIter cvvit = mesh.cvv_iter(some_vertex_handle);
\endcode \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: The following code example now shows how to enumerate the 1-ring of each vertex:
\include circulators.cc \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
*/ */
......
...@@ -26,7 +26,7 @@ entity for which it can be used. ...@@ -26,7 +26,7 @@ entity for which it can be used.
<td>Color</td> <td>Color</td>
<td>X</td> <td>X</td>
<td>X</td> <td>X</td>
<td>&nbsp;</td> <td>X</td>
<td>&nbsp;</td> <td>&nbsp;</td>
</tr> </tr>
<tr> <tr>
...@@ -108,6 +108,7 @@ are: ...@@ -108,6 +108,7 @@ are:
<ul> <ul>
<li>request_edge_status()</li> <li>request_edge_status()</li>
<li>request_edge_colors()</li>
<li>request_face_colors()</li> <li>request_face_colors()</li>
<li>request_face_normals()</li> <li>request_face_normals()</li>
<li>request_face_status()</li> <li>request_face_status()</li>
...@@ -128,6 +129,7 @@ Added properties can be released by the following functions: ...@@ -128,6 +129,7 @@ Added properties can be released by the following functions:
<ul> <ul>
<li>release_edge_status()</li> <li>release_edge_status()</li>
<li>release_edge_colors()</li>
<li>release_face_colors()</li> <li>release_face_colors()</li>
<li>release_face_normals()</li> <li>release_face_normals()</li>
<li>release_face_status()</li> <li>release_face_status()</li>
...@@ -148,6 +150,7 @@ A property's existance can be tested with ...@@ -148,6 +150,7 @@ A property's existance can be tested with
<ul> <ul>
<li>has_edge_status()</li> <li>has_edge_status()</li>
<li>has_edge_colors()</li>
<li>has_face_colors()</li> <li>has_face_colors()</li>
<li>has_face_normals()</li> <li>has_face_normals()</li>
<li>has_face_status()</li> <li>has_face_status()</li>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment