50 #ifndef LOOPSCHEMEMASKT_HH
51 #define LOOPSCHEMEMASKT_HH
56 #include <OpenMesh/Core/System/config.h>
57 #include <OpenMesh/Core/Utils/SingletonT.hh>
70 template <
class T_,
unsigned int cache_size_ = 100>
74 enum { cache_size = cache_size_ };
79 Scalar proj_weights_[cache_size];
80 Scalar limit_weights_[cache_size];
81 Scalar step_weights_[cache_size];
82 std::vector<Scalar> tang0_weights_[cache_size];
83 std::vector<Scalar> tang1_weights_[cache_size];
87 inline static Scalar compute_proj_weight(uint _valence)
90 double denom = (3.0 + 2.0*cos(2.0*M_PI/(
double)_valence));
91 double weight = (64.0*_valence)/(40.0 - denom*denom) - _valence;
92 return (Scalar) weight;
95 inline static Scalar compute_limit_weight(uint _valence)
97 double proj_weight = compute_proj_weight(_valence);
98 proj_weight = proj_weight/(proj_weight + _valence);
99 double weight = (3.0/8.0)/(1.0 - proj_weight + (3.0/8.0));
100 return (Scalar)weight;
103 inline static Scalar compute_step_weight(uint _valence)
105 double proj_weight = compute_proj_weight(_valence);
106 proj_weight = proj_weight/(proj_weight + _valence);
107 double weight = proj_weight - (3.0/8.0);
108 return (Scalar)weight;
111 inline static Scalar compute_tang0_weight(uint _valence, uint _ver_id)
113 return (Scalar)cos(2.0*M_PI*(
double)_ver_id/(
double)_valence);
116 inline static Scalar compute_tang1_weight(uint _valence, uint _ver_id)
118 return (Scalar)sin(2.0*M_PI*(
double)_ver_id/(
double)_valence);
123 proj_weights_[0] = 1;
124 for (uint k = 1; k < cache_size; ++k)
126 proj_weights_[k] = compute_proj_weight(k);
127 limit_weights_[k] = compute_limit_weight(k);
128 step_weights_[k] = compute_step_weight(k);
129 tang0_weights_[k].resize(k);
130 tang1_weights_[k].resize(k);
131 for (uint i = 0; i < k; ++i)
133 tang0_weights_[k][i] = compute_tang0_weight(k,i);
134 tang1_weights_[k][i] = compute_tang1_weight(k,i);
146 inline Scalar proj_weight(uint _valence)
const
148 assert(_valence < cache_size );
149 return proj_weights_[_valence];
152 inline Scalar limit_weight(uint _valence)
const
154 assert(_valence < cache_size );
155 return limit_weights_[_valence];
158 inline Scalar step_weight(uint _valence, uint _step)
const
160 assert(_valence < cache_size);
161 return pow(step_weights_[_valence], (
int)_step);
164 inline Scalar tang0_weight(uint _valence, uint _ver_id)
const
166 assert(_valence < cache_size );
167 assert(_ver_id < _valence);
168 return tang0_weights_[_valence][_ver_id];
171 inline Scalar tang1_weight(uint _valence, uint _ver_id)
const
173 assert(_valence < cache_size );
174 assert(_ver_id < _valence);
175 return tang1_weights_[_valence][_ver_id];
178 void dump(uint _max_valency = cache_size - 1)
const
180 assert(_max_valency <= cache_size - 1);
182 for (uint i = 0; i <= _max_valency; ++i)
195 #endif//LOOPSCHEMEMASKT_HH
implements cache for the weights of the original Loop scheme supported:
Definition: LoopSchemeMaskT.hh:71
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:64
A simple singleton template.
Definition: SingletonT.hh:84