OpenMesh
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
MixedDecimaterT.hh
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 
45 //=============================================================================
46 //
47 // CLASS MixedDecimaterT - IMPLEMENTATION
48 //
49 //=============================================================================
50 
51 #ifndef OPENMESH_MIXED_DECIMATER_DECIMATERT_HH
52 #define OPENMESH_MIXED_DECIMATER_DECIMATERT_HH
53 
54 
55 //== INCLUDES =================================================================
56 
57 #include <memory>
60 
61 
62 
63 //== NAMESPACE ================================================================
64 
65 namespace OpenMesh {
66 namespace Decimater {
67 
68 
69 //== CLASS DEFINITION =========================================================
70 
71 
75 template < typename MeshT >
76 class MixedDecimaterT : public McDecimaterT<MeshT>, public DecimaterT<MeshT>
77 {
78 public: //-------------------------------------------------------- public types
79 
81  typedef MeshT Mesh;
83  typedef ModBaseT<MeshT> Module;
84  typedef std::vector< Module* > ModuleList;
85  typedef typename ModuleList::iterator ModuleListIterator;
86 
87 public: //------------------------------------------------------ public methods
88 
90  MixedDecimaterT( Mesh& _mesh );
91 
94 
95 public:
96 
100  size_t decimate( const size_t _n_collapses, const float _mc_factor );
101 
103  size_t decimate_to( size_t _n_vertices, const float _mc_factor )
104  {
105  return ( (_n_vertices < this->mesh().n_vertices()) ?
106  decimate( this->mesh().n_vertices() - _n_vertices, _mc_factor ) : 0 );
107  }
108 
113  size_t decimate_to_faces( const size_t _n_vertices=0, const size_t _n_faces=0 , const float _mc_factor = 0.8);
114 
115 private: //------------------------------------------------------- private data
116 
117 };
118 
119 //=============================================================================
120 } // END_NS_DECIMATER
121 } // END_NS_OPENMESH
122 //=============================================================================
123 #if defined(OM_INCLUDE_TEMPLATES) && !defined(OPENMESH_MIXED_DECIMATER_DECIMATERT_CC)
124 #define OPENMESH_MIXED_DECIMATER_TEMPLATES
125 #include "MixedDecimaterT.cc"
126 #endif
127 //=============================================================================
128 #endif // OPENMESH_MIXED_DECIMATER_DECIMATERT_HH
129 //=============================================================================
size_t decimate_to_faces(const size_t _n_vertices=0, const size_t _n_faces=0, const float _mc_factor=0.8)
Decimate to target complexity (vertices and faces).
Definition: MixedDecimaterT.cc:108
Mesh & mesh()
access mesh. used in modules.
Definition: BaseDecimaterT.hh:136
~MixedDecimaterT()
Destructor.
Definition: MixedDecimaterT.cc:78
size_t decimate(const size_t _n_collapses, const float _mc_factor)
Decimate (perform _n_collapses collapses).
Definition: MixedDecimaterT.cc:84
MixedDecimaterT(Mesh &_mesh)
Constructor.
Definition: MixedDecimaterT.cc:70
Mixed decimater framework.
Definition: MixedDecimaterT.hh:76
Decimater framework.
Definition: DecimaterT.hh:78
size_t decimate_to(size_t _n_vertices, const float _mc_factor)
Decimate to target complexity, returns number of collapses.
Definition: MixedDecimaterT.hh:103
Base class for all decimation modules.
Definition: ModBaseT.hh:190
Stores information about a halfedge collapse.
Definition: CollapseInfoT.hh:73
Definition: BaseDecimaterT.hh:83
Multiple choice decimater framework.
Definition: McDecimaterT.hh:75
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 .