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

CompositeT.hh

Go to the documentation of this file.
00001 //=============================================================================
00002 //                                                                            
00003 //                               OpenMesh                                     
00004 //      Copyright (C) 2001-2005 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.1.1.1 $
00027 //   $Date: 2004/09/06 12:37:26 $
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   virtual ~CompositeT() { }
00088 
00089 public: // inherited interface
00090 
00091   virtual const char *name( void ) const = 0;
00092 
00093 protected: // inherited interface
00094 
00095   bool prepare( MeshType& _m );
00096 
00097   bool subdivide( MeshType& _m, size_t _n )
00098   {
00099     assert( p_mesh_ == &_m );
00100 
00101     while(_n--)
00102     {
00103       apply_rules();
00104       commit(_m);
00105     }
00106    
00107     return true;
00108   }
00109 
00110   bool cleanup( MeshType& _m ) 
00111   { 
00112     assert( p_mesh_ == &_m );
00113     p_mesh_=NULL; 
00114     return true; 
00115   }
00116 
00117 protected:
00118 
00121   virtual void apply_rules(void) = 0;
00122 
00123 protected:
00124 
00127   void commit( MeshType &_m)
00128   {
00129     typename MeshType::VertexIter v_it;
00130 
00131     for (v_it=_m.vertices_begin(); v_it != _m.vertices_end(); ++v_it)
00132       _m.set_point(v_it.handle(), v_it->position());
00133   }
00134 
00135   
00136 public:
00137 
00139   struct Coeff
00140   {
00141     virtual ~Coeff() { }
00142     virtual double operator() (size_t _valence) = 0;
00143   };
00144 
00145 
00146 protected:
00147 
00148   typedef typename MeshType::Scalar         scalar_t;
00149   typedef typename MeshType::VertexHandle   VertexHandle;
00150   typedef typename MeshType::FaceHandle     FaceHandle;
00151   typedef typename MeshType::EdgeHandle     EdgeHandle;
00152   typedef typename MeshType::HalfedgeHandle HalfedgeHandle;
00153 
00155 
00156 
00157   
00158   void Tvv3(); 
00159   void Tvv4(); 
00160   void Tfv();  
00161 
00162   void FF();                 
00163   void FFc(Coeff& _coeff);   
00164   void FFc(scalar_t _c);     
00165 
00166   void FV();                 
00167   void FVc(Coeff& _coeff);   
00168   void FVc(scalar_t _c);     
00169 
00170   void FE();                 
00171 
00172   void VF();                 
00173   void VFa(Coeff& _coeff);   
00174   void VFa(scalar_t _alpha); 
00175 
00176   void VV();                  
00177   void VVc(Coeff& _coeff);    
00178   void VVc(scalar_t _c);      
00179 
00180   void VE();                  
00181 
00182   
00183   void VdE();             
00184   void VdEc(scalar_t _c); 
00185   
00188   void VdEg(Coeff& _coeff);
00191   void VdEg(scalar_t _gamma);
00192 
00193   void EF();               
00194   
00195   void EV();               
00196   void EVc(Coeff& _coeff); 
00197   void EVc(scalar_t _c);   
00198 
00199   void EdE();              
00200   void EdEc(scalar_t _c);  
00201 
00202 
00204 
00205   void corner_cutting(HalfedgeHandle _heh);
00206 
00207   VertexHandle split_edge(HalfedgeHandle _heh);
00208 
00209 private:
00210 
00211   MeshType* p_mesh_;
00212 
00213 };
00214 
00215 
00216 //=============================================================================
00217 } // END_NS_UNIFORM
00218 } // END_NS_SUBDIVIDER
00219 } // END_NS_OPENMESH
00220 //=============================================================================
00221 #if defined(OM_INCLUDE_TEMPLATES) && !defined(OPENMESH_SUBDIVIDER_UNIFORM_COMPOSITE_CC)
00222 #define OPENMESH_SUBDIVIDER_TEMPLATES
00223 #include "CompositeT.cc"
00224 #endif
00225 //=============================================================================
00226 #endif // COMPOSITET_HH defined
00227 //=============================================================================
00228 

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