45#ifndef LOOPSCHEMEMASKT_HH
46#define LOOPSCHEMEMASKT_HH
51#include <OpenMesh/Core/System/config.h>
52#include <OpenMesh/Core/Utils/SingletonT.hh>
65template <
class T_,
unsigned int cache_size_ = 100>
69 enum { cache_size = cache_size_ };
74 Scalar proj_weights_[cache_size];
75 Scalar limit_weights_[cache_size];
76 Scalar step_weights_[cache_size];
77 std::vector<Scalar> tang0_weights_[cache_size];
78 std::vector<Scalar> tang1_weights_[cache_size];
82 inline static Scalar compute_proj_weight(uint _valence)
85 double denom = (3.0 + 2.0*cos(2.0*M_PI/(
double)_valence));
86 double weight = (64.0*_valence)/(40.0 - denom*denom) - _valence;
87 return (Scalar) weight;
90 inline static Scalar compute_limit_weight(uint _valence)
92 double proj_weight_value = compute_proj_weight(_valence);
93 proj_weight_value = proj_weight_value/(proj_weight_value + _valence);
94 double weight = (3.0/8.0)/(1.0 - proj_weight_value + (3.0/8.0));
95 return (Scalar)weight;
98 inline static Scalar compute_step_weight(uint _valence)
100 double proj_weight_value = compute_proj_weight(_valence);
101 proj_weight_value = proj_weight_value/(proj_weight_value + _valence);
102 double weight = proj_weight_value - (3.0/8.0);
103 return (Scalar)weight;
106 inline static Scalar compute_tang0_weight(uint _valence, uint _ver_id)
108 return (Scalar)cos(2.0*M_PI*(
double)_ver_id/(
double)_valence);
111 inline static Scalar compute_tang1_weight(uint _valence, uint _ver_id)
113 return (Scalar)sin(2.0*M_PI*(
double)_ver_id/(
double)_valence);
118 proj_weights_[0] = 1;
119 for (uint k = 1; k < cache_size; ++k)
121 proj_weights_[k] = compute_proj_weight(k);
122 limit_weights_[k] = compute_limit_weight(k);
123 step_weights_[k] = compute_step_weight(k);
124 tang0_weights_[k].resize(k);
125 tang1_weights_[k].resize(k);
126 for (uint i = 0; i < k; ++i)
128 tang0_weights_[k][i] = compute_tang0_weight(k,i);
129 tang1_weights_[k][i] = compute_tang1_weight(k,i);
141 inline Scalar proj_weight(uint _valence)
const
143 assert(_valence < cache_size );
144 return proj_weights_[_valence];
147 inline Scalar limit_weight(uint _valence)
const
149 assert(_valence < cache_size );
150 return limit_weights_[_valence];
153 inline Scalar step_weight(uint _valence, uint _step)
const
155 assert(_valence < cache_size);
156 return pow(step_weights_[_valence], (
int)_step);
159 inline Scalar tang0_weight(uint _valence, uint _ver_id)
const
161 assert(_valence < cache_size );
162 assert(_ver_id < _valence);
163 return tang0_weights_[_valence][_ver_id];
166 inline Scalar tang1_weight(uint _valence, uint _ver_id)
const
168 assert(_valence < cache_size );
169 assert(_ver_id < _valence);
170 return tang1_weights_[_valence][_ver_id];
173 void dump(uint _max_valency = cache_size - 1)
const
175 assert(_max_valency <= cache_size - 1);
177 for (uint i = 0; i <= _max_valency; ++i)
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:59
implements cache for the weights of the original Loop scheme supported:
Definition: LoopSchemeMaskT.hh:67
A simple singleton template.
Definition: SingletonT.hh:77