| OpenMesh

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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: 1258 $ *
45 * $Date: 2015-04-28 15:07:46 +0200 (Di, 28 Apr 2015) $ *
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>
65 #include <OpenMesh/Tools/Decimater/BaseDecimaterT.hh>
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
86 typedef McDecimaterT< MeshT > Self;
87 typedef MeshT Mesh;
88 typedef CollapseInfoT<MeshT> CollapseInfo;
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
OpenMesh::Decimater::McDecimaterT::decimate_constraints_only
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
McDecimaterT.cc
OpenMesh
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:64
OpenMesh::Decimater::BaseDecimaterT
Definition: BaseDecimaterT.hh:90
BaseDecimaterT.hh
OpenMesh::Decimater::McDecimaterT::McDecimaterT
McDecimaterT(Mesh &_mesh)
Constructor.
Definition: McDecimaterT.cc:82
OpenMesh::Decimater::McDecimaterT::decimate_to_faces
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
OpenMesh::Decimater::ModBaseT
Base class for all decimation modules.
Definition: ModBaseT.hh:197
OpenMesh::Decimater::McDecimaterT::decimate_to
size_t decimate_to(size_t _n_vertices)
Decimate to target complexity, returns number of collapses.
Definition: McDecimaterT.hh:109
OpenMesh::Decimater::McDecimaterT::decimate
size_t decimate(size_t _n_collapses)
Decimate (perform _n_collapses collapses).
Definition: McDecimaterT.cc:108
OpenMesh::Decimater::McDecimaterT
Multiple choice decimater framework.
Definition: McDecimaterT.hh:82
OpenMesh::Decimater::McDecimaterT::~McDecimaterT
~McDecimaterT()
Destructor.
Definition: McDecimaterT.cc:97
OpenMesh::Decimater::BaseDecimaterT::mesh
Mesh & mesh()
access mesh. used in modules.
Definition: BaseDecimaterT.hh:143
OpenMesh::Decimater::CollapseInfoT
Stores information about a halfedge collapse.
Definition: CollapseInfoT.hh:80