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, 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 
53 //=============================================================================
54 //
55 // CLASS ModProgMeshT
56 //
57 //=============================================================================
58 
59 #ifndef OPENMESH_TOOLS_MODPROGMESHT_HH
60 #define OPENMESH_TOOLS_MODPROGMESHT_HH
61 
62 
63 //== INCLUDES =================================================================
64 
66 #include <OpenMesh/Core/Utils/Property.hh>
67 
68 
69 //== NAMESPACE ================================================================
70 
71 namespace OpenMesh {
72 namespace Decimater {
73 
74 
75 //== CLASS DEFINITION =========================================================
76 
77 
84 template <class MeshT>
85 class ModProgMeshT : public ModBaseT<MeshT>
86 {
87 public:
88 
89  DECIMATING_MODULE( ModProgMeshT, MeshT, ProgMesh );
90 
94  struct Info
95  {
98  Info( const CollapseInfo& _ci )
99  : v0(_ci.v0), v1(_ci.v1), vl(_ci.vl),vr(_ci.vr)
100  {}
101 
102  typename Mesh::VertexHandle v0;
103  typename Mesh::VertexHandle v1;
104  typename Mesh::VertexHandle vl;
105  typename Mesh::VertexHandle vr;
106 
107  };
108 
110  typedef std::vector<Info> InfoList;
111 
112 
113 public:
114 
116  ModProgMeshT( MeshT &_mesh ) : Base(_mesh, true)
117  {
118  Base::mesh().add_property( idx_ );
119  }
120 
121 
124  {
125  Base::mesh().remove_property( idx_ );
126  }
127 
128  const InfoList& pmi() const
129  {
130  return pmi_;
131  }
132 
133 public: // inherited
134 
135 
139  {
140  pmi_.push_back( Info( _ci ) );
141  }
142 
143 
144  bool is_binary(void) const { return true; }
145 
146 
147 public: // specific methods
148 
173  bool write( const std::string& _ofname );
175  const InfoList& infolist() const { return pmi_; }
176 
177 private:
178 
179  // hide this method form user
180  void set_binary(bool _b) {}
181 
182  InfoList pmi_;
184 };
185 
186 
187 //=============================================================================
188 } // END_NS_DECIMATER
189 } // END_NS_OPENMESH
190 //=============================================================================
191 #if defined(OM_INCLUDE_TEMPLATES) && !defined(OPENMESH_DECIMATER_MODPROGMESH_CC)
192 #define OSG_MODPROGMESH_TEMPLATES
193 #include "ModProgMeshT.cc"
194 #endif
195 //=============================================================================
196 #endif // OPENMESH_TOOLS_PROGMESHT_HH defined
197 //=============================================================================
198 
const InfoList & infolist() const
Reference to collected information.
Definition: ModProgMeshT.hh:175
Mesh::VertexHandle vr
See CollapseInfoT::vr.
Definition: ModProgMeshT.hh:105
Stores information about a halfedge collapse.
Definition: CollapseInfoT.hh:80
ModProgMeshT(MeshT &_mesh)
Constructor.
Definition: ModProgMeshT.hh:116
Collect progressive mesh information while decimating.
Definition: ModProgMeshT.hh:85
Mesh::VertexHandle v0
See CollapseInfoT::v0.
Definition: ModProgMeshT.hh:102
Mesh::VertexHandle vl
See CollapseInfoT::vl.
Definition: ModProgMeshT.hh:104
#define DECIMATING_MODULE(Classname, MeshT, Name)
Convenience macro, to be used in derived modules The macro defines the types.
Definition: ModBaseT.hh:154
std::vector< Info > InfoList
Type of the list storing the progressive mesh info Info.
Definition: ModProgMeshT.hh:110
Base class for all decimation modules.
void postprocess_collapse(const CollapseInfo &_ci)
Stores collapse information in a queue.
Definition: ModProgMeshT.hh:138
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:64
Struct storing progressive mesh information.
Definition: ModProgMeshT.hh:94
Info(const CollapseInfo &_ci)
Initializing constructor copies appropriate handles from collapse information _ci.
Definition: ModProgMeshT.hh:98
~ModProgMeshT()
Destructor.
Definition: ModProgMeshT.hh:123
bool write(const std::string &_ofname)
Write progressive mesh data to a file in proprietary binary format .pm.
Definition: ModProgMeshT.cc:87
Mesh::VertexHandle v1
See CollapseInfoT::v1.
Definition: ModProgMeshT.hh:103
Base class for all decimation modules.
Definition: ModBaseT.hh:197

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