OpenMesh
ModProgMeshT.hh
Go to the documentation of this file.
1/* ========================================================================= *
2 * *
3 * OpenMesh *
4 * Copyright (c) 2001-2025, 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
48//=============================================================================
49//
50// CLASS ModProgMeshT
51//
52//=============================================================================
53
54#ifndef OPENMESH_TOOLS_MODPROGMESHT_HH
55#define OPENMESH_TOOLS_MODPROGMESHT_HH
56
57
58//== INCLUDES =================================================================
59
61#include <OpenMesh/Core/Utils/Property.hh>
62
63
64//== NAMESPACE ================================================================
65
66namespace OpenMesh {
67namespace Decimater {
68
69
70//== CLASS DEFINITION =========================================================
71
72
79template <class MeshT>
80class ModProgMeshT : public ModBaseT<MeshT>
81{
82public:
83
84 DECIMATING_MODULE( ModProgMeshT, MeshT, ProgMesh );
85
89 struct Info
90 {
93 explicit Info( const CollapseInfo& _ci )
94 : v0(_ci.v0), v1(_ci.v1), vl(_ci.vl),vr(_ci.vr)
95 {}
96
101
102 };
103
105 typedef std::vector<Info> InfoList;
106
107
108public:
109
111 explicit ModProgMeshT( MeshT &_mesh ) : Base(_mesh, true)
112 {
113 Base::mesh().add_property( idx_ );
114 }
115
116
119 {
120 Base::mesh().remove_property( idx_ );
121 }
122
123 const InfoList& pmi() const
124 {
125 return pmi_;
126 }
127
128public: // inherited
129
130
133 void postprocess_collapse(const CollapseInfo& _ci) override
134 {
135 pmi_.push_back( Info( _ci ) );
136 }
137
138
139 bool is_binary(void) const { return true; }
140
141
142public: // specific methods
143
168 bool write( const std::string& _ofname );
170 const InfoList& infolist() const { return pmi_; }
171
172private:
173
174 InfoList pmi_;
176};
177
178
179//=============================================================================
180} // END_NS_DECIMATER
181} // END_NS_OPENMESH
182//=============================================================================
183#if defined(OM_INCLUDE_TEMPLATES) && !defined(OPENMESH_DECIMATER_MODPROGMESH_CC)
184#define OSG_MODPROGMESH_TEMPLATES
185#include "ModProgMeshT_impl.hh"
186#endif
187//=============================================================================
188#endif // OPENMESH_TOOLS_PROGMESHT_HH defined
189//=============================================================================
190
Base class for all decimation modules.
#define DECIMATING_MODULE(Classname, MeshT, Name)
Convenience macro, to be used in derived modules The macro defines the types.
Definition: ModBaseT.hh:149
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:59
Kernel::VertexHandle VertexHandle
Handle for referencing the corresponding item.
Definition: PolyMeshT.hh:136
Stores information about a halfedge collapse.
Definition: CollapseInfoT.hh:74
Base class for all decimation modules.
Definition: ModBaseT.hh:193
Collect progressive mesh information while decimating.
Definition: ModProgMeshT.hh:81
bool write(const std::string &_ofname)
Write progressive mesh data to a file in proprietary binary format .pm.
Definition: ModProgMeshT_impl.hh:82
void postprocess_collapse(const CollapseInfo &_ci) override
Stores collapse information in a queue.
Definition: ModProgMeshT.hh:133
std::vector< Info > InfoList
Type of the list storing the progressive mesh info Info.
Definition: ModProgMeshT.hh:105
const InfoList & infolist() const
Reference to collected information.
Definition: ModProgMeshT.hh:170
~ModProgMeshT()
Destructor.
Definition: ModProgMeshT.hh:118
ModProgMeshT(MeshT &_mesh)
Constructor.
Definition: ModProgMeshT.hh:111
Struct storing progressive mesh information.
Definition: ModProgMeshT.hh:90
Mesh::VertexHandle vl
See CollapseInfoT::vl.
Definition: ModProgMeshT.hh:99
Mesh::VertexHandle v1
See CollapseInfoT::v1.
Definition: ModProgMeshT.hh:98
Mesh::VertexHandle vr
See CollapseInfoT::vr.
Definition: ModProgMeshT.hh:100
Mesh::VertexHandle v0
See CollapseInfoT::v0.
Definition: ModProgMeshT.hh:97
Info(const CollapseInfo &_ci)
Initializing constructor copies appropriate handles from collapse information _ci.
Definition: ModProgMeshT.hh:93

Project OpenMesh, ©  Visual Computing Institute, RWTH Aachen. Documentation generated using doxygen .