00001 /*************************************************************************** 00002 * Copyright (c) 2009 Werner Mayer <wmayer[at]users.sourceforge.net> * 00003 * * 00004 * This file is part of the FreeCAD CAx development system. * 00005 * * 00006 * This library is free software; you can redistribute it and/or * 00007 * modify it under the terms of the GNU Library General Public * 00008 * License as published by the Free Software Foundation; either * 00009 * version 2 of the License, or (at your option) any later version. * 00010 * * 00011 * This library is distributed in the hope that it will be useful, * 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00014 * GNU Library General Public License for more details. * 00015 * * 00016 * You should have received a copy of the GNU Library General Public * 00017 * License along with this library; see the file COPYING.LIB. If not, * 00018 * write to the Free Software Foundation, Inc., 59 Temple Place, * 00019 * Suite 330, Boston, MA 02111-1307, USA * 00020 * * 00021 ***************************************************************************/ 00022 00023 00024 #ifndef MESH_SMOOTHING_H 00025 #define MESH_SMOOTHING_H 00026 00027 namespace MeshCore 00028 { 00029 class MeshKernel; 00030 class MeshRefPointToPoints; 00031 class MeshRefPointToFacets; 00032 00034 class MeshExport AbstractSmoothing 00035 { 00036 public: 00037 enum Component { 00038 Tangential, 00039 Normal, 00040 TangentialNormal 00041 }; 00042 00043 enum Continuity { 00044 C0, 00045 C1, 00046 C2 00047 }; 00048 00049 AbstractSmoothing(MeshKernel&); 00050 virtual ~AbstractSmoothing(); 00051 void initialize(Component comp, Continuity cont); 00052 00054 virtual void Smooth(unsigned int) = 0; 00055 00056 protected: 00057 MeshKernel& kernel; 00058 00059 float tolerance; 00060 Component component; 00061 Continuity continuity; 00062 }; 00063 00064 class MeshExport MeshSmoothing : public AbstractSmoothing 00065 { 00066 public: 00067 MeshSmoothing(MeshKernel&); 00068 virtual ~MeshSmoothing(); 00069 void Smooth(unsigned int); 00070 }; 00071 00072 class MeshExport LaplaceSmoothing : public AbstractSmoothing 00073 { 00074 public: 00075 LaplaceSmoothing(MeshKernel&); 00076 virtual ~LaplaceSmoothing(); 00077 void Smooth(unsigned int); 00078 void SetLambda(double l) { lambda = l;} 00079 00080 protected: 00081 void Umbrella(const MeshRefPointToPoints&, 00082 const MeshRefPointToFacets&, double); 00083 00084 protected: 00085 double lambda; 00086 }; 00087 00088 class MeshExport TaubinSmoothing : public LaplaceSmoothing 00089 { 00090 public: 00091 TaubinSmoothing(MeshKernel&); 00092 virtual ~TaubinSmoothing(); 00093 void Smooth(unsigned int); 00094 void SetMicro(double m) { micro = m;} 00095 00096 protected: 00097 double micro; 00098 }; 00099 00100 } // namespace MeshCore 00101 00102 00103 #endif // MESH_SMOOTHING_H