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 private:
00083 typedef RuleInterfaceT<M> Base;
00084
00085 public:
00086
00087 typedef RuleInterfaceT<M> Inherited;
00088
00089 Tvv3(M& _mesh) : Inherited(_mesh) { Base::set_subdiv_type(3); };
00090
00091 void raise(typename M::FaceHandle& _fh, state_t _target_state);
00092 void raise(typename M::VertexHandle& _vh, state_t _target_state);
00093 MIPS_WARN_WA(Edge);
00094 };
00095
00096
00097
00098
00099
00102 template <class M> class Tvv4 : public RuleInterfaceT<M>
00103 {
00104 COMPOSITE_RULE( Tvv4, M );
00105
00106 private:
00107 typedef RuleInterfaceT<M> Base;
00108 public:
00109 typedef typename M::HalfedgeHandle HEH;
00110 typedef typename M::VertexHandle VH;
00111
00112 typedef RuleInterfaceT<M> Inherited;
00113
00114 Tvv4(M& _mesh) : Inherited(_mesh) { Base::set_subdiv_type(4); };
00115
00116 void raise(typename M::FaceHandle& _fh, state_t _target_state);
00117 void raise(typename M::VertexHandle& _vh, state_t _target_state);
00118 void raise(typename M::EdgeHandle& _eh, state_t _target_state);
00119
00120 private:
00121
00122 void split_edge(HEH& _hh, VH& _vh, state_t _target_state);
00123 void check_edge(const typename M::HalfedgeHandle& _hh,
00124 state_t _target_state);
00125 };
00126
00127
00128
00129
00130
00133 template <class M> class VF : public RuleInterfaceT<M>
00134 {
00135 COMPOSITE_RULE( VF, M );
00136 private:
00137 typedef RuleInterfaceT<M> Base;
00138
00139 public:
00140 typedef RuleInterfaceT<M> Inherited;
00141
00142 VF(M& _mesh) : Inherited(_mesh) {}
00143
00144 void raise(typename M::FaceHandle& _fh, state_t _target_state);
00145 MIPS_WARN_WA(Edge);
00146 MIPS_WARN_WA(Vertex);
00147 };
00148
00149
00150
00151
00152
00155 template <class M> class FF : public RuleInterfaceT<M>
00156 {
00157 COMPOSITE_RULE( FF, M );
00158 private:
00159 typedef RuleInterfaceT<M> Base;
00160
00161 public:
00162 typedef RuleInterfaceT<M> Inherited;
00163
00164 FF(M& _mesh) : Inherited(_mesh) {}
00165
00166 void raise(typename M::FaceHandle& _fh, state_t _target_state);
00167 MIPS_WARN_WA(Vertex);
00168 MIPS_WARN_WA(Edge );
00169 };
00170
00171
00172
00173
00174
00177 template <class M> class FFc : public RuleInterfaceT<M>
00178 {
00179 COMPOSITE_RULE( FFc, M );
00180 private:
00181 typedef RuleInterfaceT<M> Base;
00182
00183 public:
00184 typedef RuleInterfaceT<M> Inherited;
00185
00186 FFc(M& _mesh) : Inherited(_mesh) {}
00187
00188 void raise(typename M::FaceHandle& _fh, state_t _target_state);
00189 MIPS_WARN_WA(Vertex);
00190 MIPS_WARN_WA(Edge );
00191 };
00192
00193
00194
00195
00196
00199 template <class M> class FV : public RuleInterfaceT<M>
00200 {
00201 COMPOSITE_RULE( FV, M );
00202 private:
00203 typedef RuleInterfaceT<M> Base;
00204
00205 public:
00206 typedef RuleInterfaceT<M> Inherited;
00207
00208 FV(M& _mesh) : Inherited(_mesh) {}
00209
00210 void raise(typename M::VertexHandle& _vh, state_t _target_state);
00211 MIPS_WARN_WA(Face);
00212 MIPS_WARN_WA(Edge);
00213 };
00214
00215
00216
00217
00218
00221 template <class M> class FVc : public RuleInterfaceT<M>
00222 {
00223 COMPOSITE_RULE( FVc, M );
00224 private:
00225 typedef RuleInterfaceT<M> Base;
00226
00227 public:
00228 typedef RuleInterfaceT<M> Inherited;
00229
00230 FVc(M& _mesh) : Inherited(_mesh) { init_coeffs(50); }
00231
00232 void raise(typename M::VertexHandle& _vh, state_t _target_state);
00233 MIPS_WARN_WA(Face);
00234 MIPS_WARN_WA(Edge);
00235
00236 static void init_coeffs(size_t _max_valence);
00237 static const std::vector<double>& coeffs() { return coeffs_; }
00238
00239 double coeff( size_t _valence )
00240 {
00241 assert(_valence < coeffs_.size());
00242 return coeffs_[_valence];
00243 }
00244
00245 private:
00246
00247 static std::vector<double> coeffs_;
00248
00249 };
00250
00251
00252
00253
00254
00257 template <class M> class VV : public RuleInterfaceT<M>
00258 {
00259 COMPOSITE_RULE( VV, M );
00260 private:
00261 typedef RuleInterfaceT<M> Base;
00262
00263 public:
00264
00265 typedef RuleInterfaceT<M> Inherited;
00266
00267 VV(M& _mesh) : Inherited(_mesh) {}
00268
00269 void raise(typename M::VertexHandle& _vh, state_t _target_state);
00270 MIPS_WARN_WA(Face);
00271 MIPS_WARN_WA(Edge);
00272 };
00273
00274
00275
00276
00277
00280 template <class M> class VVc : public RuleInterfaceT<M>
00281 {
00282 COMPOSITE_RULE( VVc, M );
00283 private:
00284 typedef RuleInterfaceT<M> Base;
00285
00286 public:
00287 typedef RuleInterfaceT<M> Inherited;
00288
00289 VVc(M& _mesh) : Inherited(_mesh) {}
00290
00291 void raise(typename M::VertexHandle& _vh, state_t _target_state);
00292 MIPS_WARN_WA(Face);
00293 MIPS_WARN_WA(Edge);
00294 };
00295
00296
00297
00298
00299
00302 template <class M> class VE : public RuleInterfaceT<M>
00303 {
00304 COMPOSITE_RULE( VE, M );
00305 private:
00306 typedef RuleInterfaceT<M> Base;
00307
00308 public:
00309 typedef RuleInterfaceT<M> Inherited;
00310
00311 VE(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 VdE : public RuleInterfaceT<M>
00325 {
00326 COMPOSITE_RULE( VdE, M );
00327 private:
00328 typedef RuleInterfaceT<M> Base;
00329
00330 public:
00331 typedef RuleInterfaceT<M> Inherited;
00332
00333 VdE(M& _mesh) : Inherited(_mesh) {}
00334
00335 void raise(typename M::EdgeHandle& _eh, state_t _target_state);
00336 MIPS_WARN_WA(Face );
00337 MIPS_WARN_WA(Vertex);
00338 };
00339
00340
00341
00342
00343
00346 template <class M> class VdEc : public RuleInterfaceT<M>
00347 {
00348 COMPOSITE_RULE( VdEc, M );
00349 private:
00350 typedef RuleInterfaceT<M> Base;
00351
00352 public:
00353 typedef RuleInterfaceT<M> Inherited;
00354
00355 VdEc(M& _mesh) : Inherited(_mesh) {}
00356
00357 void raise(typename M::EdgeHandle& _eh, state_t _target_state);
00358 MIPS_WARN_WA(Face );
00359 MIPS_WARN_WA(Vertex);
00360 };
00361
00362
00363
00364
00365
00368 template <class M> class EV : public RuleInterfaceT<M>
00369 {
00370 COMPOSITE_RULE( EV, M );
00371 private:
00372 typedef RuleInterfaceT<M> Base;
00373
00374 public:
00375 typedef RuleInterfaceT<M> Inherited;
00376
00377 EV(M& _mesh) : Inherited(_mesh) {}
00378
00379 void raise(typename M::VertexHandle& _vh, state_t _target_state);
00380 MIPS_WARN_WA(Face);
00381 MIPS_WARN_WA(Edge);
00382 };
00383
00384
00385
00386
00387
00390 template <class M> class EVc : public RuleInterfaceT<M>
00391 {
00392 COMPOSITE_RULE( EVc, M );
00393 private:
00394 typedef RuleInterfaceT<M> Base;
00395
00396 public:
00397
00398 typedef RuleInterfaceT<M> Inherited;
00399
00400 EVc(M& _mesh) : Inherited(_mesh) { init_coeffs(50); }
00401
00402 void raise(typename M::VertexHandle& _vh, state_t _target_state);
00403 MIPS_WARN_WA(Face);
00404 MIPS_WARN_WA(Edge);
00405
00406 static void init_coeffs(size_t _max_valence);
00407 static const std::vector<double>& coeffs() { return coeffs_; }
00408
00409 double coeff( size_t _valence )
00410 {
00411 assert(_valence < coeffs_.size());
00412 return coeffs_[_valence];
00413 }
00414
00415 private:
00416
00417 static std::vector<double> coeffs_;
00418
00419 };
00420
00421
00422
00423
00424
00427 template <class M> class EF : public RuleInterfaceT<M>
00428 {
00429 COMPOSITE_RULE( EF, M );
00430 private:
00431 typedef RuleInterfaceT<M> Base;
00432
00433 public:
00434 typedef RuleInterfaceT<M> Inherited;
00435
00436 EF(M& _mesh) : Inherited(_mesh) {}
00437
00438 void raise(typename M::FaceHandle& _fh, state_t _target_state);
00439 MIPS_WARN_WA(Edge );
00440 MIPS_WARN_WA(Vertex);
00441 };
00442
00443
00444
00445
00446
00449 template <class M> class FE : public RuleInterfaceT<M>
00450 {
00451 COMPOSITE_RULE( FE, M );
00452 private:
00453 typedef RuleInterfaceT<M> Base;
00454
00455 public:
00456 typedef RuleInterfaceT<M> Inherited;
00457
00458 FE(M& _mesh) : Inherited(_mesh) {}
00459
00460 void raise(typename M::EdgeHandle& _eh, state_t _target_state);
00461 MIPS_WARN_WA(Face );
00462 MIPS_WARN_WA(Vertex);
00463 };
00464
00465
00466
00467
00468
00471 template <class M> class EdE : public RuleInterfaceT<M>
00472 {
00473 COMPOSITE_RULE( EdE, M );
00474 private:
00475 typedef RuleInterfaceT<M> Base;
00476
00477 public:
00478 typedef RuleInterfaceT<M> Inherited;
00479
00480 EdE(M& _mesh) : Inherited(_mesh) {}
00481
00482 void raise(typename M::EdgeHandle& _eh, state_t _target_state);
00483 MIPS_WARN_WA(Face );
00484 MIPS_WARN_WA(Vertex);
00485 };
00486
00487
00488
00489
00490
00493 template <class M> class EdEc : public RuleInterfaceT<M>
00494 {
00495 COMPOSITE_RULE( EdEc, M );
00496 private:
00497 typedef RuleInterfaceT<M> Base;
00498
00499 public:
00500 typedef RuleInterfaceT<M> Inherited;
00501
00502 EdEc(M& _mesh) : Inherited(_mesh) {}
00503
00504 void raise(typename M::EdgeHandle& _eh, state_t _target_state);
00505 MIPS_WARN_WA(Face );
00506 MIPS_WARN_WA(Vertex);
00507 };
00508
00509
00510
00511 #undef MIPS_WARN_WA
00512
00513
00514 }
00515 }
00516 }
00517
00518 #if defined(OM_INCLUDE_TEMPLATES) && !defined(OPENMESH_SUBDIVIDER_ADAPTIVE_RULEST_CC)
00519 # define OPENMESH_SUBDIVIDER_TEMPLATES
00520 # include "RulesT.cc"
00521 #endif
00522
00523 #endif // OPENMESH_SUBDIVIDER_ADAPTIVE_RULEST_HH defined
00524
00525