Go to the documentation of this file.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
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00046
00047
00048
00049
00050
00051
00052 #ifndef OPENMESH_SUBDIVIDER_UNIFORM_COMPOSITE_HH
00053 #define OPENMESH_SUBDIVIDER_UNIFORM_COMPOSITE_HH
00054
00055
00056
00057
00058 #include <string>
00059 #include <vector>
00060
00061 #include <OpenMesh/Tools/Subdivider/Uniform/SubdividerT.hh>
00062
00063
00064
00065 namespace OpenMesh {
00066 namespace Subdivider {
00067 namespace Uniform {
00068
00069
00070
00071
00086 template <typename MeshType, typename RealType=float >
00087 class CompositeT : public SubdividerT< MeshType, RealType >
00088 {
00089 public:
00090
00091 typedef RealType real_t;
00092 typedef MeshType mesh_t;
00093 typedef SubdividerT< mesh_t, real_t > parent_t;
00094
00095 public:
00096
00097 CompositeT(void) : parent_t(), p_mesh_(NULL) {}
00098 CompositeT(MeshType& _mesh) : parent_t(_mesh), p_mesh_(NULL) {};
00099 virtual ~CompositeT() { }
00100
00101 public:
00102
00103 virtual const char *name( void ) const = 0;
00104
00105 protected:
00106
00107 bool prepare( MeshType& _m );
00108
00109 bool subdivide( MeshType& _m, size_t _n )
00110 {
00111 assert( p_mesh_ == &_m );
00112
00113 while(_n--)
00114 {
00115 apply_rules();
00116 commit(_m);
00117 }
00118
00119 return true;
00120 }
00121
00122 #ifdef NDEBUG
00123 bool cleanup( MeshType& )
00124 #else
00125 bool cleanup( MeshType& _m )
00126 #endif
00127 {
00128 assert( p_mesh_ == &_m );
00129 p_mesh_=NULL;
00130 return true;
00131 }
00132
00133 protected:
00134
00137 virtual void apply_rules(void) = 0;
00138
00139 protected:
00140
00143 void commit( MeshType &_m)
00144 {
00145 typename MeshType::VertexIter v_it;
00146
00147 for (v_it=_m.vertices_begin(); v_it != _m.vertices_end(); ++v_it)
00148 _m.set_point(v_it.handle(), _m.data(v_it).position());
00149 }
00150
00151
00152 public:
00153
00155 struct Coeff
00156 {
00157 virtual ~Coeff() { }
00158 virtual double operator() (size_t _valence) = 0;
00159 };
00160
00161
00162 protected:
00163
00164 typedef typename MeshType::Scalar scalar_t;
00165 typedef typename MeshType::VertexHandle VertexHandle;
00166 typedef typename MeshType::FaceHandle FaceHandle;
00167 typedef typename MeshType::EdgeHandle EdgeHandle;
00168 typedef typename MeshType::HalfedgeHandle HalfedgeHandle;
00169
00171
00172
00173
00174 void Tvv3();
00175 void Tvv4();
00176 void Tfv();
00177
00178 void FF();
00179 void FFc(Coeff& _coeff);
00180 void FFc(scalar_t _c);
00181
00182 void FV();
00183 void FVc(Coeff& _coeff);
00184 void FVc(scalar_t _c);
00185
00186 void FE();
00187
00188 void VF();
00189 void VFa(Coeff& _coeff);
00190 void VFa(scalar_t _alpha);
00191
00192 void VV();
00193 void VVc(Coeff& _coeff);
00194 void VVc(scalar_t _c);
00195
00196 void VE();
00197
00198
00199 void VdE();
00200 void VdEc(scalar_t _c);
00201
00204 void VdEg(Coeff& _coeff);
00207 void VdEg(scalar_t _gamma);
00208
00209 void EF();
00210
00211 void EV();
00212 void EVc(Coeff& _coeff);
00213 void EVc(scalar_t _c);
00214
00215 void EdE();
00216 void EdEc(scalar_t _c);
00217
00218
00220
00221 void corner_cutting(HalfedgeHandle _heh);
00222
00223 VertexHandle split_edge(HalfedgeHandle _heh);
00224
00225 private:
00226
00227 MeshType* p_mesh_;
00228
00229 };
00230
00231
00232
00233 }
00234 }
00235 }
00236
00237 #if defined(OM_INCLUDE_TEMPLATES) && !defined(OPENMESH_SUBDIVIDER_UNIFORM_COMPOSITE_CC)
00238 #define OPENMESH_SUBDIVIDER_TEMPLATES
00239 #include "CompositeT.cc"
00240 #endif
00241
00242 #endif // COMPOSITET_HH defined
00243
00244