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

CompositeSqrt3T.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.4 $
00027 //   $Date: 2004/01/15 15:34:49 $
00028 //                                                                            
00029 //=============================================================================
00030 
00035 //=============================================================================
00036 //
00037 //  CLASS SQRT3T
00038 //
00039 //=============================================================================
00040 
00041 #ifndef OPENMESH_SUBDIVIDER_UNIFORM_COMPOSITESQRT3T_HH
00042 #define OPENMESH_SUBDIVIDER_UNIFORM_COMPOSITESQRT3T_HH
00043 
00044 
00045 //== INCLUDES =================================================================
00046 
00047 #include "Composite/CompositeT.hh"
00048 #include "Composite/CompositeTraits.hh"
00049 
00050 
00051 //== NAMESPACE ================================================================
00052 
00053 namespace OpenMesh   { // BEGIN_NS_OPENMESH
00054 namespace Subdivider { // BEGIN_NS_DECIMATER
00055 namespace Uniform    { // BEGIN_NS_UNIFORM
00056 
00057 
00058 //== CLASS DEFINITION =========================================================
00059 
00062 template <typename MeshType, typename RealType=float>
00063 class CompositeSqrt3T : public CompositeT<MeshType, RealType>
00064 {
00065 public:
00066 
00067    typedef CompositeT<MeshType, RealType> Inherited;
00068 
00069 public:
00070 
00071   CompositeSqrt3T() : Inherited() {};
00072   CompositeSqrt3T(MeshType& _mesh) : Inherited(_mesh) {};
00073   ~CompositeSqrt3T() {}
00074 
00075 public:
00076    
00077   const char *name() const { return "Uniform Composite Sqrt3"; }
00078 
00079 protected: // inherited interface
00080 
00081   void apply_rules(void)  { Tvv3(); VF(); FF(); FVc(coeffs_); }
00082 
00083 protected:
00084    
00085 #if defined(OM_CC_MIPS)
00086    typedef typename Inherited::Coeff Coeff;
00087 #endif
00088 
00092   struct FVCoeff : public Coeff 
00093   {
00094     FVCoeff() : Coeff() { init(50); }
00095 
00096     void init(size_t _max_valence)
00097     {
00098       weights_.resize(_max_valence);
00099       std::generate(weights_.begin(), 
00100                     weights_.end(), compute_weight() );
00101     }
00102     
00103     double operator()(size_t _valence) { return weights_[_valence]; }
00104 
00107     struct compute_weight 
00108     {
00109       compute_weight() : val_(0) { }
00110 
00111       double operator()(void) // sqrt(3) weights for non-boundary vertices
00112       { 
00113         return 2.0/3.0 * (cos(2.0*M_PI/val_++)+1.0); 
00114       }
00115       size_t val_;
00116     };
00117 
00118     std::vector<double> weights_;
00119     
00120   } coeffs_;
00121 
00122 };
00123 
00124 
00125 //=============================================================================
00126 } // END_NS_UNIFORM
00127 } // END_NS_SUBDIVIDER
00128 } // END_NS_OPENMESH
00129 //=============================================================================
00130 #endif // OPENMESH_SUBDIVIDER_UNIFORM_COMPOSITESQRT3T_HH defined
00131 //=============================================================================

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