OpenMesh
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
StripifierT.hh
1 /* ========================================================================= *
2  * *
3  * OpenMesh *
4  * Copyright (c) 2001-2015, RWTH-Aachen University *
5  * Department of Computer Graphics and Multimedia *
6  * All rights reserved. *
7  * www.openmesh.org *
8  * *
9  *---------------------------------------------------------------------------*
10  * This file is part of OpenMesh. *
11  *---------------------------------------------------------------------------*
12  * *
13  * Redistribution and use in source and binary forms, with or without *
14  * modification, are permitted provided that the following conditions *
15  * are met: *
16  * *
17  * 1. Redistributions of source code must retain the above copyright notice, *
18  * this list of conditions and the following disclaimer. *
19  * *
20  * 2. Redistributions in binary form must reproduce the above copyright *
21  * notice, this list of conditions and the following disclaimer in the *
22  * documentation and/or other materials provided with the distribution. *
23  * *
24  * 3. Neither the name of the copyright holder nor the names of its *
25  * contributors may be used to endorse or promote products derived from *
26  * this software without specific prior written permission. *
27  * *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39  * *
40  * ========================================================================= */
41 
42 /*===========================================================================*\
43  * *
44  * $Revision$ *
45  * $Date$ *
46  * *
47 \*===========================================================================*/
48 
49 //=============================================================================
50 //
51 // CLASS StripifierT
52 //
53 //=============================================================================
54 
55 
56 #ifndef OPENMESH_STRIPIFIERT_HH
57 #define OPENMESH_STRIPIFIERT_HH
58 
59 
60 //== INCLUDES =================================================================
61 
62 #include <vector>
63 #include <OpenMesh/Core/Utils/Property.hh>
64 
65 
66 //== FORWARDDECLARATIONS ======================================================
67 
68 
69 //== NAMESPACES ===============================================================
70 
71 namespace OpenMesh {
72 
73 
74 //== CLASS DEFINITION =========================================================
75 
76 
77 
78 
83 template <class Mesh>
85 {
86 public:
87 
88  typedef unsigned int Index;
89  typedef std::vector<Index> Strip;
90  typedef typename Strip::const_iterator IndexIterator;
91  typedef std::vector<Strip> Strips;
92  typedef typename Strips::const_iterator StripsIterator;
93 
94 
96  StripifierT(Mesh& _mesh);
97 
99  ~StripifierT();
100 
102  size_t stripify();
103 
105  void clear() { Strips().swap(strips_); }
106 
108  size_t n_strips() const { return strips_.size(); }
109 
111  bool is_valid() const { return !strips_.empty(); }
112 
114  StripsIterator begin() const { return strips_.begin(); }
116  StripsIterator end() const { return strips_.end(); }
117 
118 
119 private:
120 
121  typedef std::vector<typename Mesh::FaceHandle> FaceHandles;
122 
123 
125  void build_strips();
126 
128  void build_strip(typename Mesh::HalfedgeHandle _start_hh,
129  Strip& _strip,
130  FaceHandles& _faces);
131 
132  FPropHandleT<bool>::reference processed(typename Mesh::FaceHandle _fh) {
133  return mesh_.property(processed_, _fh);
134  }
135  FPropHandleT<bool>::reference used(typename Mesh::FaceHandle _fh) {
136  return mesh_.property(used_, _fh);
137  }
138 
139 
140 
141 private:
142 
143  Mesh& mesh_;
144  Strips strips_;
145  FPropHandleT<bool> processed_, used_;
146 };
147 
148 
149 //=============================================================================
150 } // namespace OpenMesh
151 //=============================================================================
152 #if defined(OM_INCLUDE_TEMPLATES) && !defined(OPENMESH_STRIPIFIERT_C)
153 #define OPENMESH_STRIPIFIERT_TEMPLATES
154 #include "StripifierT.cc"
155 #endif
156 //=============================================================================
157 #endif // OPENMESH_STRIPIFIERT_HH defined
158 //=============================================================================
StripsIterator begin() const
Access strips.
Definition: StripifierT.hh:114
StripifierT(Mesh &_mesh)
Default constructor.
Definition: StripifierT.cc:72
void clear()
delete all strips
Definition: StripifierT.hh:105
StripsIterator end() const
Access strips.
Definition: StripifierT.hh:116
size_t n_strips() const
returns number of strips
Definition: StripifierT.hh:108
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:64
size_t stripify()
Compute triangle strips, returns number of strips.
Definition: StripifierT.cc:87
bool is_valid() const
are strips computed?
Definition: StripifierT.hh:111
Handle representing a face property.
Definition: Property.hh:529
This class decomposes a triangle mesh into several triangle strips.
Definition: StripifierT.hh:84
~StripifierT()
Destructor.
Definition: StripifierT.cc:80

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