OpenMesh
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
McDecimaterT.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 
52 //=============================================================================
53 //
54 // CLASS McDecimaterT
55 //
56 //=============================================================================
57 
58 #ifndef OPENMESH_MC_DECIMATER_DECIMATERT_HH
59 #define OPENMESH_MC_DECIMATER_DECIMATERT_HH
60 
61 
62 //== INCLUDES =================================================================
63 
64 #include <memory>
66 
67 
68 
69 //== NAMESPACE ================================================================
70 
71 namespace OpenMesh {
72 namespace Decimater {
73 
74 
75 //== CLASS DEFINITION =========================================================
76 
77 
81 template < typename MeshT >
82 class McDecimaterT : virtual public BaseDecimaterT<MeshT> //virtual especially for the mixed decimater
83 {
84 public: //-------------------------------------------------------- public types
85 
87  typedef MeshT Mesh;
89  typedef ModBaseT<MeshT> Module;
90  typedef std::vector< Module* > ModuleList;
91  typedef typename ModuleList::iterator ModuleListIterator;
92 
93 public: //------------------------------------------------------ public methods
94 
96  McDecimaterT( Mesh& _mesh );
97 
99  ~McDecimaterT();
100 
101 public:
102 
106  size_t decimate( size_t _n_collapses );
107 
109  size_t decimate_to( size_t _n_vertices )
110  {
111  return ( (_n_vertices < this->mesh().n_vertices()) ?
112  decimate( this->mesh().n_vertices() - _n_vertices ) : 0 );
113  }
114 
119  size_t decimate_to_faces( size_t _n_vertices=0, size_t _n_faces=0 );
120 
125  size_t decimate_constraints_only(float _factor);
126 
127  size_t samples(){return randomSamples_;}
128  void set_samples(const size_t _value){randomSamples_ = _value;}
129 
130 private: //------------------------------------------------------- private data
131 
132 
133  // reference to mesh
134  Mesh& mesh_;
135 
136  size_t randomSamples_;
137 
138 };
139 
140 //=============================================================================
141 } // END_NS_DECIMATER
142 } // END_NS_OPENMESH
143 //=============================================================================
144 #if defined(OM_INCLUDE_TEMPLATES) && !defined(OPENMESH_MULTIPLE_CHOICE_DECIMATER_DECIMATERT_CC)
145 #define OPENMESH_MULTIPLE_CHOICE_DECIMATER_TEMPLATES
146 #include "McDecimaterT.cc"
147 #endif
148 //=============================================================================
149 #endif // OPENMESH_MC_DECIMATER_DECIMATERT_HH defined
150 //=============================================================================
151 
Mesh & mesh()
access mesh. used in modules.
Definition: BaseDecimaterT.hh:143
~McDecimaterT()
Destructor.
Definition: McDecimaterT.cc:97
Stores information about a halfedge collapse.
Definition: CollapseInfoT.hh:80
Definition: BaseDecimaterT.hh:90
Multiple choice decimater framework.
Definition: McDecimaterT.hh:82
McDecimaterT(Mesh &_mesh)
Constructor.
Definition: McDecimaterT.cc:82
size_t decimate(size_t _n_collapses)
Decimate (perform _n_collapses collapses).
Definition: McDecimaterT.cc:108
size_t decimate_constraints_only(float _factor)
Decimate only with constraints, while _factor gives the percentage of the constraints that should be ...
Definition: McDecimaterT.cc:375
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:64
size_t decimate_to(size_t _n_vertices)
Decimate to target complexity, returns number of collapses.
Definition: McDecimaterT.hh:109
size_t decimate_to_faces(size_t _n_vertices=0, size_t _n_faces=0)
Decimate to target complexity (vertices and faces).
Definition: McDecimaterT.cc:232
Base class for all decimation modules.
Definition: ModBaseT.hh:197

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