OpenMesh
McDecimaterT.hh
Go to the documentation of this file.
1/* ========================================================================= *
2 * *
3 * OpenMesh *
4 * Copyright (c) 2001-2023, 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
66namespace OpenMesh {
67namespace Decimater {
68
69
70//== CLASS DEFINITION =========================================================
71
72
76template < typename MeshT >
77class McDecimaterT : virtual public BaseDecimaterT<MeshT> //virtual especially for the mixed decimater
78{
79public: //-------------------------------------------------------- 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
88public: //------------------------------------------------------ public methods
89
91 McDecimaterT( Mesh& _mesh );
92
95
96public:
97
110 size_t decimate( size_t _n_collapses , bool _only_selected = false);
111
122 size_t decimate_to( size_t _n_vertices , bool _only_selected = false)
123 {
124 return ( (_n_vertices < this->mesh().n_vertices()) ?
125 decimate( this->mesh().n_vertices() - _n_vertices , _only_selected ) : 0 );
126 }
127
141 size_t decimate_to_faces( size_t _n_vertices=0, size_t _n_faces=0 , bool _only_selected = false);
142
147 size_t decimate_constraints_only(float _factor, bool _only_selected = false);
148
149 size_t samples(){return randomSamples_;}
150 void set_samples(const size_t _value){randomSamples_ = _value;}
151
152private: //------------------------------------------------------- private data
153
154
155 // reference to mesh
156 Mesh& mesh_;
157
158 size_t randomSamples_;
159
160};
161
162//=============================================================================
163} // END_NS_DECIMATER
164} // END_NS_OPENMESH
165//=============================================================================
166#if defined(OM_INCLUDE_TEMPLATES) && !defined(OPENMESH_MULTIPLE_CHOICE_DECIMATER_DECIMATERT_CC)
167#define OPENMESH_MULTIPLE_CHOICE_DECIMATER_TEMPLATES
168#include "McDecimaterT_impl.hh"
169#endif
170//=============================================================================
171#endif // OPENMESH_MC_DECIMATER_DECIMATERT_HH defined
172//=============================================================================
173
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:59
Definition: BaseDecimaterT.hh:86
Mesh & mesh()
access mesh. used in modules.
Definition: BaseDecimaterT.hh:138
Stores information about a halfedge collapse.
Definition: CollapseInfoT.hh:74
Multiple choice decimater framework.
Definition: McDecimaterT.hh:78
size_t decimate_constraints_only(float _factor, bool _only_selected=false)
Decimate only with constraints, while _factor gives the percentage of the constraints that should be ...
Definition: McDecimaterT_impl.hh:369
~McDecimaterT()
Destructor.
Definition: McDecimaterT_impl.hh:91
size_t decimate_to(size_t _n_vertices, bool _only_selected=false)
Decimate the mesh to a desired target vertex complexity.
Definition: McDecimaterT.hh:122
size_t decimate_to_faces(size_t _n_vertices=0, size_t _n_faces=0, bool _only_selected=false)
Attempts to decimate the mesh until a desired vertex or face complexity is achieved.
Definition: McDecimaterT_impl.hh:226
size_t decimate(size_t _n_collapses, bool _only_selected=false)
Decimate (perform _n_collapses collapses).
Definition: McDecimaterT_impl.hh:102
McDecimaterT(Mesh &_mesh)
Constructor.
Definition: McDecimaterT_impl.hh:76
Base class for all decimation modules.
Definition: ModBaseT.hh:193

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