OpenMesh

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
StripifierT.hh
1 /*===========================================================================*\
2 * *
3 * OpenMesh *
4 * Copyright (C) 2001-2014 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: 990 $ *
38 * $Date: 2014-02-05 10:01:07 +0100 (Mi, 05. Feb 2014) $ *
39 * *
40 \*===========================================================================*/
41
42 //=============================================================================
43 //
44 // CLASS StripifierT
45 //
46 //=============================================================================
47
48
49 #ifndef OPENMESH_STRIPIFIERT_HH
50 #define OPENMESH_STRIPIFIERT_HH
51
52
53 //== INCLUDES =================================================================
54
55 #include <vector>
56 #include <OpenMesh/Core/Utils/Property.hh>
57
58
59 //== FORWARDDECLARATIONS ======================================================
60
61
62 //== NAMESPACES ===============================================================
63
64 namespace OpenMesh {
65
66
67 //== CLASS DEFINITION =========================================================
68
69
70
71
76 template <class Mesh>
77 class StripifierT
78 {
79 public:
80
81 typedef unsigned int Index;
82 typedef std::vector<Index> Strip;
83 typedef typename Strip::const_iterator IndexIterator;
84 typedef std::vector<Strip> Strips;
85 typedef typename Strips::const_iterator StripsIterator;
86
87
89 StripifierT(Mesh& _mesh);
90
92 ~StripifierT();
93
95 size_t stripify();
96
98 void clear() { Strips().swap(strips_); }
99
101 size_t n_strips() const { return strips_.size(); }
102
104 bool is_valid() const { return !strips_.empty(); }
105
107 StripsIterator begin() const { return strips_.begin(); }
109 StripsIterator end() const { return strips_.end(); }
110
111
112 private:
113
114 typedef std::vector<typename Mesh::FaceHandle> FaceHandles;
115
116
118 void build_strips();
119
121 void build_strip(typename Mesh::HalfedgeHandle _start_hh,
122 Strip& _strip,
123 FaceHandles& _faces);
124
125 FPropHandleT<bool>::reference processed(typename Mesh::FaceHandle _fh) {
126 return mesh_.property(processed_, _fh);
127 }
128 FPropHandleT<bool>::reference used(typename Mesh::FaceHandle _fh) {
129 return mesh_.property(used_, _fh);
130 }
131
132
133
134 private:
135
136 Mesh& mesh_;
137 Strips strips_;
138 FPropHandleT<bool> processed_, used_;
139 };
140
141
142 //=============================================================================
143 } // namespace OpenMesh
144 //=============================================================================
145 #if defined(OM_INCLUDE_TEMPLATES) && !defined(OPENMESH_STRIPIFIERT_C)
146 #define OPENMESH_STRIPIFIERT_TEMPLATES
147 #include "StripifierT.cc"
148 #endif
149 //=============================================================================
150 #endif // OPENMESH_STRIPIFIERT_HH defined
151 //=============================================================================
OpenMesh::StripifierT::stripify
size_t stripify()
Compute triangle strips, returns number of strips.
Definition: StripifierT.cc:80
OpenMesh::FPropHandleT
Handle representing a face property.
Definition: Property.hh:518
OpenMesh::StripifierT::is_valid
bool is_valid() const
are strips computed?
Definition: StripifierT.hh:104
OpenMesh::StripifierT::begin
StripsIterator begin() const
Access strips.
Definition: StripifierT.hh:107
OpenMesh::StripifierT::clear
void clear()
delete all strips
Definition: StripifierT.hh:98
OpenMesh::StripifierT::end
StripsIterator end() const
Access strips.
Definition: StripifierT.hh:109
OpenMesh::StripifierT
This class decomposes a triangle mesh into several triangle strips.
Definition: StripifierT.hh:77
OpenMesh::StripifierT::~StripifierT
~StripifierT()
Destructor.
Definition: StripifierT.cc:73
OpenMesh::StripifierT::n_strips
size_t n_strips() const
returns number of strips
Definition: StripifierT.hh:101
OpenMesh::StripifierT::StripifierT
StripifierT(Mesh &_mesh)
Default constructor.
Definition: StripifierT.cc:65