OpenMesh
ModEdgeLengthT.hh
Go to the documentation of this file.
1/* ========================================================================= *
2 * *
3 * OpenMesh *
4 * Copyright (c) 2001-2025, 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
46//=============================================================================
47//
48// CLASS ModEdgeLengthT
49//
50//=============================================================================
51#ifndef OPENMESH_DECIMATER_MODEDGELENGTHT_HH
52#define OPENMESH_DECIMATER_MODEDGELENGTHT_HH
53
54//== INCLUDES =================================================================
55
57#include <cfloat>
58
59//== NAMESPACES ===============================================================
60
61namespace OpenMesh {
62namespace Decimater {
63
64//== CLASS DEFINITION =========================================================
65
74template<class MeshT>
75class ModEdgeLengthT: public ModBaseT<MeshT> {
76 public:
77
78 DECIMATING_MODULE( ModEdgeLengthT, MeshT, EdgeLength )
79 ;
80
82 explicit ModEdgeLengthT(MeshT& _mesh, float _edge_length = FLT_MAX,
83 bool _is_binary = true);
84
86 float edge_length() const {
87 return edge_length_;
88 }
89
91 void set_edge_length(typename Mesh::Scalar _f) {
92 edge_length_ = _f;
93 sqr_edge_length_ = _f * _f;
94 }
95
101 float collapse_priority(const CollapseInfo& _ci) override;
102
104 void set_error_tolerance_factor(double _factor) override;
105
106 private:
107
108 Mesh& mesh_;
109 typename Mesh::Scalar edge_length_, sqr_edge_length_;
110};
111
112//=============================================================================
113}// END_NS_DECIMATER
114} // END_NS_OPENMESH
115//=============================================================================
116#if defined(OM_INCLUDE_TEMPLATES) && !defined(OPENMESH_DECIMATER_MODEDGELENGTHT_C)
117#define MODEDGELENGTHT_TEMPLATES
118#include "ModEdgeLengthT_impl.hh"
119#endif
120//=============================================================================
121#endif // OPENMESH_DECIMATER_MODEDGELENGTHT_HH defined
122//=============================================================================
123
Base class for all decimation modules.
#define DECIMATING_MODULE(Classname, MeshT, Name)
Convenience macro, to be used in derived modules The macro defines the types.
Definition: ModBaseT.hh:149
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:59
Polygonal mesh based on the ArrayKernel.
Definition: PolyMesh_ArrayKernelT.hh:96
Kernel::Scalar Scalar
Scalar type.
Definition: PolyMeshT.hh:110
Base class for all decimation modules.
Definition: ModBaseT.hh:193
Use edge length to control decimation.
Definition: ModEdgeLengthT.hh:75
void set_error_tolerance_factor(double _factor) override
set the percentage of edge length
Definition: ModEdgeLengthT_impl.hh:83
void set_edge_length(typename Mesh::Scalar _f)
set edge_length
Definition: ModEdgeLengthT.hh:91
ModEdgeLengthT(MeshT &_mesh, float _edge_length=FLT_MAX, bool _is_binary=true)
Constructor.
Definition: ModEdgeLengthT_impl.hh:65
float edge_length() const
get edge_length
Definition: ModEdgeLengthT.hh:86
float collapse_priority(const CollapseInfo &_ci) override
Compute priority: Binary mode: Don't collapse edges longer then edge_length_ Cont.
Definition: ModEdgeLengthT_impl.hh:74

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