OpenMesh
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ModProgMeshT.hh
Go to the documentation of this file.
1 /*===========================================================================*\
2  * *
3  * OpenMesh *
4  * Copyright (C) 2001-2015 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: 1188 $ *
38  * $Date: 2015-01-05 16:34:10 +0100 (Mo, 05 Jan 2015) $ *
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 
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 
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 
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 
Mesh::VertexHandle vr
See CollapseInfoT::vr.
Definition: ModProgMeshT.hh:98
const InfoList & infolist() const
Reference to collected information.
Definition: ModProgMeshT.hh:168
Mesh::VertexHandle v0
See CollapseInfoT::v0.
Definition: ModProgMeshT.hh:95
#define DECIMATING_MODULE(Classname, MeshT, Name)
Convenience macro, to be used in derived modules The macro defines the types.
Definition: ModBaseT.hh:147
std::vector< Info > InfoList
Type of the list storing the progressive mesh info Info.
Definition: ModProgMeshT.hh:103
ModProgMeshT(MeshT &_mesh)
Constructor.
Definition: ModProgMeshT.hh:109
Mesh::VertexHandle vl
See CollapseInfoT::vl.
Definition: ModProgMeshT.hh:97
Struct storing progressive mesh information.
Definition: ModProgMeshT.hh:87
~ModProgMeshT()
Destructor.
Definition: ModProgMeshT.hh:116
void postprocess_collapse(const CollapseInfo &_ci)
Stores collapse information in a queue.
Definition: ModProgMeshT.hh:131
bool write(const std::string &_ofname)
Write progressive mesh data to a file in proprietary binary format .pm.
Definition: ModProgMeshT.cc:80
Base class for all decimation modules.
Info(const CollapseInfo &_ci)
Initializing constructor copies appropriate handles from collapse information _ci.
Definition: ModProgMeshT.hh:91
Base class for all decimation modules.
Definition: ModBaseT.hh:190
Stores information about a halfedge collapse.
Definition: CollapseInfoT.hh:73
Mesh::VertexHandle v1
See CollapseInfoT::v1.
Definition: ModProgMeshT.hh:96
Collect progressive mesh information while decimating.
Definition: ModProgMeshT.hh:78
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:56

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