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
ModProgMeshT.hh
Go to the documentation of this file.
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
46 //=============================================================================
47 //
48 // CLASS ModProgMeshT
49 //
50 //=============================================================================
51
52 #ifndef OPENMESH_TOOLS_MODPROGMESHT_HH
53 #define OPENMESH_TOOLS_MODPROGMESHT_HH
54
55
56 //== INCLUDES =================================================================
57
58 #include <OpenMesh/Tools/Decimater/ModBaseT.hh>
59 #include <OpenMesh/Core/Utils/Property.hh>
60
61
62 //== NAMESPACE ================================================================
63
64 namespace OpenMesh {
65 namespace Decimater {
66
67
68 //== CLASS DEFINITION =========================================================
69
70
77 template <class MeshT>
78 class ModProgMeshT : public ModBaseT<MeshT>
79 {
80 public:
81
82 DECIMATING_MODULE( ModProgMeshT, MeshT, ProgMesh );
83
87 struct Info
88 {
91 Info( const CollapseInfo& _ci )
92 : v0(_ci.v0), v1(_ci.v1), vl(_ci.vl),vr(_ci.vr)
93 {}
94
95 typename Mesh::VertexHandle v0;
96 typename Mesh::VertexHandle v1;
97 typename Mesh::VertexHandle vl;
98 typename Mesh::VertexHandle vr;
99
100 };
101
103 typedef std::vector<Info> InfoList;
104
105
106 public:
107
109 ModProgMeshT( MeshT &_mesh ) : Base(_mesh, true)
110 {
111 Base::mesh().add_property( idx_ );
112 }
113
114
116 ~ModProgMeshT()
117 {
118 Base::mesh().remove_property( idx_ );
119 }
120
121 const InfoList& pmi() const
122 {
123 return pmi_;
124 }
125
126 public: // inherited
127
128
131 void postprocess_collapse(const CollapseInfo& _ci)
132 {
133 pmi_.push_back( Info( _ci ) );
134 }
135
136
137 bool is_binary(void) const { return true; }
138
139
140 public: // specific methods
141
166 bool write( const std::string& _ofname );
168 const InfoList& infolist() const { return pmi_; }
169
170 private:
171
172 // hide this method form user
173 void set_binary(bool _b) {}
174
175 InfoList pmi_;
176 VPropHandleT<int> idx_;
177 };
178
179
180 //=============================================================================
181 } // END_NS_DECIMATER
182 } // END_NS_OPENMESH
183 //=============================================================================
184 #if defined(OM_INCLUDE_TEMPLATES) && !defined(OPENMESH_DECIMATER_MODPROGMESH_CC)
185 #define OSG_MODPROGMESH_TEMPLATES
186 #include "ModProgMeshT.cc"
187 #endif
188 //=============================================================================
189 #endif // OPENMESH_TOOLS_PROGMESHT_HH defined
190 //=============================================================================
191
ModBaseT.hh
Base class for all decimation modules.
OpenMesh::Decimater::ModProgMeshT::infolist
const InfoList & infolist() const
Reference to collected information.
Definition: ModProgMeshT.hh:168
OpenMesh::Decimater::CollapseInfoT
Stores information about a halfedge collapse.
Definition: CollapseInfoT.hh:73
OpenMesh::Decimater::ModProgMeshT::write
bool write(const std::string &_ofname)
Write progressive mesh data to a file in proprietary binary format .pm.
Definition: ModProgMeshT.cc:80
OpenMesh::Decimater::ModProgMeshT::Info::Info
Info(const CollapseInfo &_ci)
Initializing constructor copies appropriate handles from collapse information _ci.
Definition: ModProgMeshT.hh:91
OpenMesh::VPropHandleT< int >
OpenMesh::Decimater::ModBaseT
Base class for all decimation modules.
Definition: ModBaseT.hh:190
OpenMesh::Decimater::ModProgMeshT::Info::v1
Mesh::VertexHandle v1
See CollapseInfoT::v1.
Definition: ModProgMeshT.hh:96
OpenMesh::Decimater::ModProgMeshT::ModProgMeshT
ModProgMeshT(MeshT &_mesh)
Constructor.
Definition: ModProgMeshT.hh:109
OpenMesh::Decimater::ModProgMeshT::Info::vr
Mesh::VertexHandle vr
See CollapseInfoT::vr.
Definition: ModProgMeshT.hh:98
OpenMesh::Decimater::ModProgMeshT::InfoList
std::vector< Info > InfoList
Type of the list storing the progressive mesh info Info.
Definition: ModProgMeshT.hh:103
ModProgMeshT.cc
OpenMesh::Decimater::ModProgMeshT::postprocess_collapse
void postprocess_collapse(const CollapseInfo &_ci)
Stores collapse information in a queue.
Definition: ModProgMeshT.hh:131
OpenMesh::Decimater::ModProgMeshT::Info::v0
Mesh::VertexHandle v0
See CollapseInfoT::v0.
Definition: ModProgMeshT.hh:95
OpenMesh::Decimater::ModProgMeshT::Info
Struct storing progressive mesh information.
Definition: ModProgMeshT.hh:87
OpenMesh::Decimater::ModProgMeshT::~ModProgMeshT
~ModProgMeshT()
Destructor.
Definition: ModProgMeshT.hh:116
OpenMesh::Decimater::ModProgMeshT::Info::vl
Mesh::VertexHandle vl
See CollapseInfoT::vl.
Definition: ModProgMeshT.hh:97
DECIMATING_MODULE
#define DECIMATING_MODULE(Classname, MeshT, Name)
Convenience macro, to be used in derived modules The macro defines the types.
Definition: ModBaseT.hh:147
OpenMesh::Decimater::ModProgMeshT
Collect progressive mesh information while decimating.
Definition: ModProgMeshT.hh:78