Developer Documentation

ModEdgeLengthT.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
46 //=============================================================================
47 //
48 // CLASS ModEdgeLengthT
49 //
50 //=============================================================================
51 #ifndef OPENMESH_DECIMATER_MODEDGELENGTHT_HH
52 #define OPENMESH_DECIMATER_MODEDGELENGTHT_HH
53
54 //== INCLUDES =================================================================
55
56 #include <OpenMesh/Tools/Decimater/ModBaseT.hh>
57 #include <cfloat>
58
59 //== NAMESPACES ===============================================================
60
61 namespace OpenMesh {
62 namespace Decimater {
63
64 //== CLASS DEFINITION =========================================================
65
74 template<class MeshT>
75 class ModEdgeLengthT: public ModBaseT<MeshT> {
76 public:
77
78 DECIMATING_MODULE( ModEdgeLengthT, MeshT, EdgeLength )
79 ;
80
82 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);
102
104 void set_error_tolerance_factor(double _factor);
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
ModBaseT.hh
OpenMesh::Decimater::ModEdgeLengthT::set_error_tolerance_factor
void set_error_tolerance_factor(double _factor)
set the percentage of edge length
Definition: ModEdgeLengthT_impl.hh:83
DECIMATING_MODULE
#define DECIMATING_MODULE(Classname, MeshT, Name)
Definition: ModBaseT.hh:149
OpenMesh::Decimater::ModEdgeLengthT::ModEdgeLengthT
ModEdgeLengthT(MeshT &_mesh, float _edge_length=FLT_MAX, bool _is_binary=true)
Constructor.
Definition: ModEdgeLengthT_impl.hh:65
OpenMesh::Decimater::ModEdgeLengthT::set_edge_length
void set_edge_length(typename Mesh::Scalar _f)
set edge_length
Definition: ModEdgeLengthT.hh:91
OpenMesh::Decimater::ModEdgeLengthT::collapse_priority
float collapse_priority(const CollapseInfo &_ci)
Definition: ModEdgeLengthT_impl.hh:74
OpenMesh::Decimater::ModEdgeLengthT
Use edge length to control decimation.
Definition: ModEdgeLengthT.hh:75
OpenMesh::Decimater::CollapseInfoT
Definition: CollapseInfoT.hh:74
OpenMesh::Decimater::ModEdgeLengthT::edge_length
float edge_length() const
get edge_length
Definition: ModEdgeLengthT.hh:86
ModEdgeLengthT_impl.hh
OpenMesh::Decimater::ModBaseT
Definition: ModBaseT.hh:192
OpenMesh
Definition: MeshItems.hh:59