Developer Documentation
Loading...
Searching...
No Matches
CompositeLoopT.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
43
48
//=============================================================================
49
//
50
// CLASS LoopT
51
//
52
//=============================================================================
53
54
#ifndef OPENMESH_SUBDIVIDER_UNIFORM_COMPOSITELOOPT_HH
55
#define OPENMESH_SUBDIVIDER_UNIFORM_COMPOSITELOOPT_HH
56
57
58
//== INCLUDES =================================================================
59
60
#include "Composite/CompositeT.hh"
61
#include "Composite/CompositeTraits.hh"
62
63
64
//== NAMESPACE ================================================================
65
66
namespace
OpenMesh
{
// BEGIN_NS_OPENMESH
67
namespace
Subdivider {
// BEGIN_NS_DECIMATER
68
namespace
Uniform {
// BEGIN_NS_DECIMATER
69
70
71
//== CLASS DEFINITION =========================================================
72
75
template
<
class
MeshType,
class
RealType =
double
>
76
class
CompositeLoopT
:
public
CompositeT
<MeshType, RealType>
77
{
78
public
:
79
80
typedef
CompositeT<MeshType, RealType>
Inherited
;
81
82
public
:
83
84
CompositeLoopT
() :
Inherited
() {};
85
explicit
CompositeLoopT
(MeshType& _mesh) :
Inherited
(_mesh) {};
86
~CompositeLoopT
() {}
87
88
public
:
89
90
const
char
*
name
()
const override
{
return
"Uniform Composite Loop"
; }
91
92
protected
:
// inherited interface
93
94
void
apply_rules
(
void
)
override
95
{
96
Inherited::Tvv4();
97
Inherited::VdE();
98
Inherited::EVc(coeffs_);
99
Inherited::VdE();
100
Inherited::EVc(coeffs_);
101
}
102
103
protected
:
104
105
typedef
typename
Inherited::Coeff Coeff;
106
107
111
struct
EVCoeff
:
public
Coeff
112
{
113
EVCoeff
() :
Coeff
() { init(50); }
114
115
void
init(
size_t
_max_valence)
116
{
117
weights_.resize(_max_valence);
118
std::generate(weights_.begin(),
119
weights_.end(),
compute_weight
() );
120
}
121
122
double
operator()(
size_t
_valence)
override
{
return
weights_[_valence]; }
123
125
struct
compute_weight
126
{
127
compute_weight
() : val_(0) { }
128
129
double
operator()(
void
)
// Loop weights for non-boundary vertices
130
{
131
// 1 3 2 * pi
132
// - * ( --- + cos ( ------- ) )� - 1.0
133
// 2 2 valence
134
double
f1 = 1.5 + cos(2.0*M_PI/val_++);
135
return
0.5 * f1 * f1 - 1.0;
136
}
137
size_t
val_;
138
139
};
140
141
std::vector<double> weights_;
142
} coeffs_;
143
144
};
145
146
//=============================================================================
147
}
// END_NS_UNIFORM
148
}
// END_NS_SUBDIVIDER
149
}
// END_NS_OPENMESH
150
//=============================================================================
151
#endif
// OPENMESH_SUBDIVIDER_UNIFORM_COMPOSITELOOPT_HH defined
152
//=============================================================================
OpenMesh::Subdivider::Uniform::CompositeLoopT
Definition
CompositeLoopT.hh:77
OpenMesh::Subdivider::Uniform::CompositeLoopT::apply_rules
void apply_rules(void) override
Definition
CompositeLoopT.hh:94
OpenMesh::Subdivider::Uniform::CompositeLoopT::name
const char * name() const override
Return name of subdivision algorithm.
Definition
CompositeLoopT.hh:90
OpenMesh::Subdivider::Uniform::CompositeT
Definition
CompositeT.hh:90
OpenMesh
Definition
MeshItems.hh:59
OpenMesh::Subdivider::Uniform::CompositeLoopT::EVCoeff::compute_weight
Definition
CompositeLoopT.hh:126
OpenMesh::Subdivider::Uniform::CompositeLoopT::EVCoeff
Definition
CompositeLoopT.hh:112
OpenMesh::Subdivider::Uniform::CompositeT::Coeff
Abstract base class for coefficient functions.
Definition
CompositeT.hh:158
OpenFlipper
libs_required
OpenMesh
src
OpenMesh
Tools
Subdivider
Uniform
CompositeLoopT.hh
Generated on Wed Jul 16 2025 14:44:33 for Developer Documentation by
1.9.8