00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00036
00037
00038
00039
00040
00041
00042 #ifndef OPENMESH_SUBDIVIDER_ADAPTIVE_RULEST_HH
00043 #define OPENMESH_SUBDIVIDER_ADAPTIVE_RULEST_HH
00044
00045
00046
00047
00048 #include <OpenMesh/Core/System/config.hh>
00049 #include <OpenMesh/Tools/Subdivider/Adaptive/Composite/RuleInterfaceT.hh>
00050
00051 #include <vector>
00052
00053
00054 #if defined(OM_CC_MIPS) // avoid warnings
00055 # define MIPS_WARN_WA( Item ) \
00056 void raise(typename M:: ## Item ## Handle &_h, state_t _target_state ) \
00057 { Inherited::raise(_h, _target_state); }
00058 #else
00059 # define MIPS_WARN_WA( Item )
00060 #endif
00061
00062
00063
00064 namespace OpenMesh {
00065 namespace Subdivider {
00066 namespace Adaptive {
00067
00068
00069
00070
00075
00076
00079 template <class M> class Tvv3 : public RuleInterfaceT<M>
00080 {
00081 COMPOSITE_RULE( Tvv3, M );
00082
00083 public:
00084
00085 typedef RuleInterfaceT<M> Inherited;
00086
00087 Tvv3(M& _mesh) : Inherited(_mesh) { Inherited::set_subdiv_type(3); };
00088
00089 void raise(typename M::FaceHandle& _fh, state_t _target_state);
00090 void raise(typename M::VertexHandle& _vh, state_t _target_state);
00091 MIPS_WARN_WA(Edge);
00092 };
00093
00094
00095
00096
00097
00100 template <class M> class Tvv4 : public RuleInterfaceT<M>
00101 {
00102 COMPOSITE_RULE( Tvv4, M );
00103
00104 public:
00105 typedef typename M::HalfedgeHandle HEH;
00106 typedef typename M::VertexHandle VH;
00107
00108 typedef RuleInterfaceT<M> Inherited;
00109
00110 Tvv4(M& _mesh) : Inherited(_mesh) { Inherited::set_subdiv_type(4); };
00111
00112 void raise(typename M::FaceHandle& _fh, state_t _target_state);
00113 void raise(typename M::VertexHandle& _vh, state_t _target_state);
00114 void raise(typename M::EdgeHandle& _eh, state_t _target_state);
00115
00116 private:
00117
00118 void split_edge(HEH& _hh, VH& _vh, state_t _target_state);
00119 void check_edge(const typename M::HalfedgeHandle& _hh,
00120 state_t _target_state);
00121 };
00122
00123
00124
00125
00126
00129 template <class M> class VF : public RuleInterfaceT<M>
00130 {
00131 COMPOSITE_RULE( VF, M );
00132
00133 public:
00134 typedef RuleInterfaceT<M> Inherited;
00135
00136 VF(M& _mesh) : Inherited(_mesh) {}
00137
00138 void raise(typename M::FaceHandle& _fh, state_t _target_state);
00139 MIPS_WARN_WA(Edge);
00140 MIPS_WARN_WA(Vertex);
00141 };
00142
00143
00144
00145
00146
00149 template <class M> class FF : public RuleInterfaceT<M>
00150 {
00151 COMPOSITE_RULE( FF, M );
00152
00153 public:
00154 typedef RuleInterfaceT<M> Inherited;
00155
00156 FF(M& _mesh) : Inherited(_mesh) {}
00157
00158 void raise(typename M::FaceHandle& _fh, state_t _target_state);
00159 MIPS_WARN_WA(Vertex);
00160 MIPS_WARN_WA(Edge );
00161 };
00162
00163
00164
00165
00166
00169 template <class M> class FFc : public RuleInterfaceT<M>
00170 {
00171 COMPOSITE_RULE( FFc, M );
00172
00173 public:
00174 typedef RuleInterfaceT<M> Inherited;
00175
00176 FFc(M& _mesh) : Inherited(_mesh) {}
00177
00178 void raise(typename M::FaceHandle& _fh, state_t _target_state);
00179 MIPS_WARN_WA(Vertex);
00180 MIPS_WARN_WA(Edge );
00181 };
00182
00183
00184
00185
00186
00189 template <class M> class FV : public RuleInterfaceT<M>
00190 {
00191 COMPOSITE_RULE( FV, M );
00192
00193 public:
00194 typedef RuleInterfaceT<M> Inherited;
00195
00196 FV(M& _mesh) : Inherited(_mesh) {}
00197
00198 void raise(typename M::VertexHandle& _vh, state_t _target_state);
00199 MIPS_WARN_WA(Face);
00200 MIPS_WARN_WA(Edge);
00201 };
00202
00203
00204
00205
00206
00209 template <class M> class FVc : public RuleInterfaceT<M>
00210 {
00211 COMPOSITE_RULE( FVc, M );
00212
00213 public:
00214 typedef RuleInterfaceT<M> Inherited;
00215
00216 FVc(M& _mesh) : Inherited(_mesh) { init_coeffs(50); }
00217
00218 void raise(typename M::VertexHandle& _vh, state_t _target_state);
00219 MIPS_WARN_WA(Face);
00220 MIPS_WARN_WA(Edge);
00221
00222 static void init_coeffs(size_t _max_valence);
00223 static const std::vector<double>& coeffs() { return coeffs_; }
00224
00225 double coeff( size_t _valence )
00226 {
00227 assert(_valence < coeffs_.size());
00228 return coeffs_[_valence];
00229 }
00230
00231 private:
00232
00233 static std::vector<double> coeffs_;
00234
00235 };
00236
00237
00238
00239
00240
00243 template <class M> class VV : public RuleInterfaceT<M>
00244 {
00245 COMPOSITE_RULE( VV, M );
00246
00247 public:
00248
00249 typedef RuleInterfaceT<M> Inherited;
00250
00251 VV(M& _mesh) : Inherited(_mesh) {}
00252
00253 void raise(typename M::VertexHandle& _vh, state_t _target_state);
00254 MIPS_WARN_WA(Face);
00255 MIPS_WARN_WA(Edge);
00256 };
00257
00258
00259
00260
00261
00264 template <class M> class VVc : public RuleInterfaceT<M>
00265 {
00266 COMPOSITE_RULE( VVc, M );
00267
00268 public:
00269 typedef RuleInterfaceT<M> Inherited;
00270
00271 VVc(M& _mesh) : Inherited(_mesh) {}
00272
00273 void raise(typename M::VertexHandle& _vh, state_t _target_state);
00274 MIPS_WARN_WA(Face);
00275 MIPS_WARN_WA(Edge);
00276 };
00277
00278
00279
00280
00281
00284 template <class M> class VE : public RuleInterfaceT<M>
00285 {
00286 COMPOSITE_RULE( VE, M );
00287
00288 public:
00289 typedef RuleInterfaceT<M> Inherited;
00290
00291 VE(M& _mesh) : Inherited(_mesh) {}
00292
00293 void raise(typename M::EdgeHandle& _eh, state_t _target_state);
00294 MIPS_WARN_WA(Face );
00295 MIPS_WARN_WA(Vertex);
00296 };
00297
00298
00299
00300
00301
00304 template <class M> class VdE : public RuleInterfaceT<M>
00305 {
00306 COMPOSITE_RULE( VdE, M );
00307
00308 public:
00309 typedef RuleInterfaceT<M> Inherited;
00310
00311 VdE(M& _mesh) : Inherited(_mesh) {}
00312
00313 void raise(typename M::EdgeHandle& _eh, state_t _target_state);
00314 MIPS_WARN_WA(Face );
00315 MIPS_WARN_WA(Vertex);
00316 };
00317
00318
00319
00320
00321
00324 template <class M> class VdEc : public RuleInterfaceT<M>
00325 {
00326 COMPOSITE_RULE( VdEc, M );
00327
00328 public:
00329 typedef RuleInterfaceT<M> Inherited;
00330
00331 VdEc(M& _mesh) : Inherited(_mesh) {}
00332
00333 void raise(typename M::EdgeHandle& _eh, state_t _target_state);
00334 MIPS_WARN_WA(Face );
00335 MIPS_WARN_WA(Vertex);
00336 };
00337
00338
00339
00340
00341
00344 template <class M> class EV : public RuleInterfaceT<M>
00345 {
00346 COMPOSITE_RULE( EV, M );
00347
00348 public:
00349 typedef RuleInterfaceT<M> Inherited;
00350
00351 EV(M& _mesh) : Inherited(_mesh) {}
00352
00353 void raise(typename M::VertexHandle& _vh, state_t _target_state);
00354 MIPS_WARN_WA(Face);
00355 MIPS_WARN_WA(Edge);
00356 };
00357
00358
00359
00360
00361
00364 template <class M> class EVc : public RuleInterfaceT<M>
00365 {
00366 COMPOSITE_RULE( EVc, M );
00367
00368 public:
00369
00370 typedef RuleInterfaceT<M> Inherited;
00371
00372 EVc(M& _mesh) : Inherited(_mesh) { init_coeffs(50); }
00373
00374 void raise(typename M::VertexHandle& _vh, state_t _target_state);
00375 MIPS_WARN_WA(Face);
00376 MIPS_WARN_WA(Edge);
00377
00378 static void init_coeffs(size_t _max_valence);
00379 static const std::vector<double>& coeffs() { return coeffs_; }
00380
00381 double coeff( size_t _valence )
00382 {
00383 assert(_valence < coeffs_.size());
00384 return coeffs_[_valence];
00385 }
00386
00387 private:
00388
00389 static std::vector<double> coeffs_;
00390
00391 };
00392
00393
00394
00395
00396
00399 template <class M> class EF : public RuleInterfaceT<M>
00400 {
00401 COMPOSITE_RULE( EF, M );
00402
00403 public:
00404 typedef RuleInterfaceT<M> Inherited;
00405
00406 EF(M& _mesh) : Inherited(_mesh) {}
00407
00408 void raise(typename M::FaceHandle& _fh, state_t _target_state);
00409 MIPS_WARN_WA(Edge );
00410 MIPS_WARN_WA(Vertex);
00411 };
00412
00413
00414
00415
00416
00419 template <class M> class FE : public RuleInterfaceT<M>
00420 {
00421 COMPOSITE_RULE( FE, M );
00422
00423 public:
00424 typedef RuleInterfaceT<M> Inherited;
00425
00426 FE(M& _mesh) : Inherited(_mesh) {}
00427
00428 void raise(typename M::EdgeHandle& _eh, state_t _target_state);
00429 MIPS_WARN_WA(Face );
00430 MIPS_WARN_WA(Vertex);
00431 };
00432
00433
00434
00435
00436
00439 template <class M> class EdE : public RuleInterfaceT<M>
00440 {
00441 COMPOSITE_RULE( EdE, M );
00442
00443 public:
00444 typedef RuleInterfaceT<M> Inherited;
00445
00446 EdE(M& _mesh) : Inherited(_mesh) {}
00447
00448 void raise(typename M::EdgeHandle& _eh, state_t _target_state);
00449 MIPS_WARN_WA(Face );
00450 MIPS_WARN_WA(Vertex);
00451 };
00452
00453
00454
00455
00456
00459 template <class M> class EdEc : public RuleInterfaceT<M>
00460 {
00461 COMPOSITE_RULE( EdEc, M );
00462
00463 public:
00464 typedef RuleInterfaceT<M> Inherited;
00465
00466 EdEc(M& _mesh) : Inherited(_mesh) {}
00467
00468 void raise(typename M::EdgeHandle& _eh, state_t _target_state);
00469 MIPS_WARN_WA(Face );
00470 MIPS_WARN_WA(Vertex);
00471 };
00472
00473
00474
00475 #undef MIPS_WARN_WA
00476
00477
00478 }
00479 }
00480 }
00481
00482 #if defined(OM_INCLUDE_TEMPLATES) && !defined(OPENMESH_SUBDIVIDER_ADAPTIVE_RULEST_CC)
00483 # define OPENMESH_SUBDIVIDER_TEMPLATES
00484 # include "RulesT.cc"
00485 #endif
00486
00487 #endif // OPENMESH_SUBDIVIDER_ADAPTIVE_RULEST_HH defined
00488
00489