OpenMesh
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 
47 //=============================================================================
48 //
49 // CLASS McDecimaterT
50 //
51 //=============================================================================
52 
53 #ifndef OPENMESH_MC_DECIMATER_DECIMATERT_HH
54 #define OPENMESH_MC_DECIMATER_DECIMATERT_HH
55 
56 
57 //== INCLUDES =================================================================
58 
59 #include <memory>
61 
62 
63 
64 //== NAMESPACE ================================================================
65 
66 namespace OpenMesh {
67 namespace Decimater {
68 
69 
70 //== CLASS DEFINITION =========================================================
71 
72 
76 template < typename MeshT >
77 class McDecimaterT : virtual public BaseDecimaterT<MeshT> //virtual especially for the mixed decimater
78 {
79 public: //-------------------------------------------------------- public types
80 
82  typedef MeshT Mesh;
84  typedef ModBaseT<MeshT> Module;
85  typedef std::vector< Module* > ModuleList;
86  typedef typename ModuleList::iterator ModuleListIterator;
87 
88 public: //------------------------------------------------------ public methods
89 
91  McDecimaterT( Mesh& _mesh );
92 
94  ~McDecimaterT();
95 
96 public:
97 
101  size_t decimate( size_t _n_collapses );
102 
104  size_t decimate_to( size_t _n_vertices )
105  {
106  return ( (_n_vertices < this->mesh().n_vertices()) ?
107  decimate( this->mesh().n_vertices() - _n_vertices ) : 0 );
108  }
109 
114  size_t decimate_to_faces( size_t _n_vertices=0, size_t _n_faces=0 );
115 
120  size_t decimate_constraints_only(float _factor);
121 
122  size_t samples(){return randomSamples_;}
123  void set_samples(const size_t _value){randomSamples_ = _value;}
124 
125 private: //------------------------------------------------------- private data
126 
127 
128  // reference to mesh
129  Mesh& mesh_;
130 
131  size_t randomSamples_;
132 
133 };
134 
135 //=============================================================================
136 } // END_NS_DECIMATER
137 } // END_NS_OPENMESH
138 //=============================================================================
139 #if defined(OM_INCLUDE_TEMPLATES) && !defined(OPENMESH_MULTIPLE_CHOICE_DECIMATER_DECIMATERT_CC)
140 #define OPENMESH_MULTIPLE_CHOICE_DECIMATER_TEMPLATES
141 #include "McDecimaterT_impl.hh"
142 #endif
143 //=============================================================================
144 #endif // OPENMESH_MC_DECIMATER_DECIMATERT_HH defined
145 //=============================================================================
146 
Base class for all decimation modules.
Definition: ModBaseT.hh:192
~McDecimaterT()
Destructor.
Definition: McDecimaterT_impl.hh:91
size_t decimate(size_t _n_collapses)
Decimate (perform _n_collapses collapses).
Definition: McDecimaterT_impl.hh:102
Definition: BaseDecimaterT.hh:85
Mesh & mesh()
access mesh. used in modules.
Definition: BaseDecimaterT.hh:138
McDecimaterT(Mesh &_mesh)
Constructor.
Definition: McDecimaterT_impl.hh:76
size_t decimate_to_faces(size_t _n_vertices=0, size_t _n_faces=0)
Decimate to target complexity (vertices and faces).
Definition: McDecimaterT_impl.hh:226
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:59
Multiple choice decimater framework.
Definition: McDecimaterT.hh:77
size_t decimate_constraints_only(float _factor)
Decimate only with constraints, while _factor gives the percentage of the constraints that should be ...
Definition: McDecimaterT_impl.hh:369
Stores information about a halfedge collapse.
Definition: CollapseInfoT.hh:74
size_t decimate_to(size_t _n_vertices)
Decimate to target complexity, returns number of collapses.
Definition: McDecimaterT.hh:104

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