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.2 $ 00027 // $Date: 2005/04/19 07:55:40 $ 00028 // 00029 //============================================================================= 00030 00035 //============================================================================= 00036 // 00037 // CLASS LaplaceSmootherT 00038 // 00039 //============================================================================= 00040 00041 #ifndef OPENMESH_LAPLACE_SMOOTHERT_HH 00042 #define OPENMESH_LAPLACE_SMOOTHERT_HH 00043 00044 00045 00046 //== INCLUDES ================================================================= 00047 00048 #include <OpenMesh/Tools/Smoother/SmootherT.hh> 00049 00050 00051 //== NAMESPACES =============================================================== 00052 00053 namespace OpenMesh { 00054 namespace Smoother { 00055 00056 //== CLASS DEFINITION ========================================================= 00057 00059 template <class Mesh> 00060 class LaplaceSmootherT : public SmootherT<Mesh> 00061 { 00062 public: 00063 00064 typedef SmootherT<Mesh> Base; 00065 typedef typename SmootherT<Mesh>::Component Component; 00066 typedef typename SmootherT<Mesh>::Continuity Continuity; 00067 typedef typename SmootherT<Mesh>::Scalar Scalar; 00068 typedef typename SmootherT<Mesh>::VertexHandle VertexHandle; 00069 typedef typename SmootherT<Mesh>::EdgeHandle EdgeHandle; 00070 00071 00072 LaplaceSmootherT( Mesh& _mesh ); 00073 virtual ~LaplaceSmootherT(); 00074 00075 00076 void initialize(Component _comp, Continuity _cont); 00077 00078 00079 protected: 00080 00081 // misc helpers 00082 00083 Scalar weight(VertexHandle _vh) const 00084 { return Base::mesh_.property(vertex_weights_, _vh); } 00085 00086 Scalar weight(EdgeHandle _eh) const 00087 { return Base::mesh_.property(edge_weights_, _eh); } 00088 00089 00090 private: 00091 00092 enum LaplaceWeighting { UniformWeighting, CotWeighting }; 00093 void compute_weights(LaplaceWeighting _mode); 00094 00095 00096 OpenMesh::VPropHandleT<Scalar> vertex_weights_; 00097 OpenMesh::EPropHandleT<Scalar> edge_weights_; 00098 }; 00099 00100 00101 //============================================================================= 00102 } // namespace Smoother 00103 } // namespace OpenMesh 00104 //============================================================================= 00105 #if defined(OM_INCLUDE_TEMPLATES) && !defined(OPENMESH_LAPLACE_SMOOTHERT_C) 00106 #define OPENMESH_LAPLACE_SMOOTHERT_TEMPLATES 00107 #include "LaplaceSmootherT.cc" 00108 #endif 00109 //============================================================================= 00110 #endif // OPENMESH_LAPLACE_SMOOTHERT_HH defined 00111 //============================================================================= 00112