Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

CompositeT.hh

Go to the documentation of this file.
00001 //=============================================================================
00002 //                                                                            
00003 //                               OpenMesh                                     
00004 //        Copyright (C) 2003 by Computer Graphics Group, RWTH Aachen          
00005 //                           www.openmesh.org                                 
00006 //                                                                            
00007 //-----------------------------------------------------------------------------
00008 //                                                                            
00009 //                                License                                     
00010 //                                                                            
00011 //   This library is free software; you can redistribute it and/or modify it 
00012 //   under the terms of the GNU Library General Public License as published  
00013 //   by the Free Software Foundation, version 2.                             
00014 //                                                                             
00015 //   This library is distributed in the hope that it will be useful, but       
00016 //   WITHOUT ANY WARRANTY; without even the implied warranty of                
00017 //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         
00018 //   Library General Public License for more details.                          
00019 //                                                                            
00020 //   You should have received a copy of the GNU Library General Public         
00021 //   License along with this library; if not, write to the Free Software       
00022 //   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 
00023 //                                                                            
00024 //-----------------------------------------------------------------------------
00025 //                                                                            
00026 //   $Revision: 1.10 $
00027 //   $Date: 2004/01/16 17:40:44 $
00028 //                                                                            
00029 //=============================================================================
00030 
00035 //=============================================================================
00036 //
00037 //  CLASS CompositeT
00038 //
00039 //=============================================================================
00040 
00041 #ifndef OPENMESH_SUBDIVIDER_UNIFORM_COMPOSITE_HH
00042 #define OPENMESH_SUBDIVIDER_UNIFORM_COMPOSITE_HH
00043 
00044 
00045 //== INCLUDES =================================================================
00046 
00047 #include <string>
00048 #include <vector>
00049 // --------------------
00050 #include <OpenMesh/Tools/Subdivider/Uniform/SubdividerT.hh>
00051 
00052 //== NAMESPACE ================================================================
00053 
00054 namespace OpenMesh   { // BEGIN_NS_OPENMESH
00055 namespace Subdivider { // BEGIN_NS_DECIMATER
00056 namespace Uniform    { // BEGIN_NS_UNIFORM
00057 
00058 
00059 //== CLASS DEFINITION =========================================================
00060 
00075 template <typename MeshType, typename RealType=float > 
00076 class CompositeT : public SubdividerT< MeshType, RealType >
00077 {
00078 public:
00079 
00080   typedef RealType                                real_t;
00081   typedef MeshType                                mesh_t;
00082   typedef SubdividerT< mesh_t, real_t >           parent_t;
00083 
00084 public:
00085 
00086   CompositeT(void) : parent_t(), p_mesh_(NULL) {}
00087   CompositeT(MeshType& _mesh) : parent_t(_mesh), p_mesh_(NULL) {};
00088   virtual ~CompositeT() { }
00089 
00090 public: // inherited interface
00091 
00092   virtual const char *name( void ) const = 0;
00093 
00094 protected: // inherited interface
00095 
00096   bool prepare( MeshType& _m );
00097 
00098   bool subdivide( MeshType& _m, size_t _n )
00099   {
00100     assert( p_mesh_ == &_m );
00101 
00102     while(_n--)
00103     {
00104       apply_rules();
00105       commit(_m);
00106     }
00107    
00108     return true;
00109   }
00110 
00111   bool cleanup( MeshType& _m ) 
00112   { 
00113     assert( p_mesh_ == &_m );
00114     p_mesh_=NULL; 
00115     return true; 
00116   }
00117 
00118 protected:
00119 
00122   virtual void apply_rules(void) = 0;
00123 
00124 protected:
00125 
00128   void commit( MeshType &_m)
00129   {
00130     typename MeshType::VertexIter v_it;
00131 
00132     for (v_it=_m.vertices_begin(); v_it != _m.vertices_end(); ++v_it)
00133       _m.set_point(v_it.handle(), v_it->position());
00134   }
00135 
00136   
00137 public:
00138 
00140   struct Coeff
00141   {
00142     virtual ~Coeff() { }
00143     virtual double operator() (unsigned int _valence) = 0;
00144   };
00145 
00146 
00147 protected:
00148 
00149   typedef typename MeshType::Scalar         scalar_t;
00150   typedef typename MeshType::VertexHandle   VertexHandle;
00151   typedef typename MeshType::FaceHandle     FaceHandle;
00152   typedef typename MeshType::EdgeHandle     EdgeHandle;
00153   typedef typename MeshType::HalfedgeHandle HalfedgeHandle;
00154 
00156 
00157 
00158   
00159   void Tvv3(); 
00160   void Tvv4(); 
00161   void Tfv();  
00162 
00163   void FF();                 
00164   void FFc(Coeff& _coeff);   
00165   void FFc(scalar_t _c);     
00166 
00167   void FV();                 
00168   void FVc(Coeff& _coeff);   
00169   void FVc(scalar_t _c);     
00170 
00171   void FE();                 
00172 
00173   void VF();                 
00174   void VFa(Coeff& _coeff);   
00175   void VFa(scalar_t _alpha); 
00176 
00177   void VV();                  
00178   void VVc(Coeff& _coeff);    
00179   void VVc(scalar_t _c);      
00180 
00181   void VE();                  
00182 
00183   
00184   void VdE();             
00185   void VdEc(scalar_t _c); 
00186   
00189   void VdEg(Coeff& _coeff);
00192   void VdEg(scalar_t _gamma);
00193 
00194   void EF();               
00195   
00196   void EV();               
00197   void EVc(Coeff& _coeff); 
00198   void EVc(scalar_t _c);   
00199 
00200   void EdE();              
00201   void EdEc(scalar_t _c);  
00202 
00203 
00205 
00206   void corner_cutting(HalfedgeHandle _heh);
00207 
00208   VertexHandle split_edge(HalfedgeHandle _heh);
00209 
00210 private:
00211 
00212   MeshType* p_mesh_;
00213 
00214 };
00215 
00216 
00217 //=============================================================================
00218 } // END_NS_UNIFORM
00219 } // END_NS_SUBDIVIDER
00220 } // END_NS_OPENMESH
00221 //=============================================================================
00222 #if defined(OM_INCLUDE_TEMPLATES) && !defined(OPENMESH_SUBDIVIDER_UNIFORM_COMPOSITE_CC)
00223 #define OPENMESH_SUBDIVIDER_TEMPLATES
00224 #include "CompositeT.cc"
00225 #endif
00226 //=============================================================================
00227 #endif // COMPOSITET_HH defined
00228 //=============================================================================
00229 

acg pic Project OpenMesh, ©  Computer Graphics Group, RWTH Aachen. Documentation generated using doxygen .