Wm4MeshSmoother.h

Go to the documentation of this file.
00001 // Wild Magic Source Code
00002 // David Eberly
00003 // http://www.geometrictools.com
00004 // Copyright (c) 1998-2007
00005 //
00006 // This library is free software; you can redistribute it and/or modify it
00007 // under the terms of the GNU Lesser General Public License as published by
00008 // the Free Software Foundation; either version 2.1 of the License, or (at
00009 // your option) any later version.  The license is available for reading at
00010 // either of the locations:
00011 //     http://www.gnu.org/copyleft/lgpl.html
00012 //     http://www.geometrictools.com/License/WildMagicLicense.pdf
00013 // The license applies to versions 0 through 4 of Wild Magic.
00014 //
00015 // Version: 4.0.0 (2006/06/28)
00016 
00017 #ifndef WM4MESHSMOOTHER_H
00018 #define WM4MESHSMOOTHER_H
00019 
00020 #include "Wm4FoundationLIB.h"
00021 #include "Wm4Vector3.h"
00022 
00023 namespace Wm4
00024 {
00025 
00026 template <class Real>
00027 class WM4_FOUNDATION_ITEM MeshSmoother
00028 {
00029 public:
00030     // The caller is responsible for deleting the input arrays.
00031     MeshSmoother (int iVQuantity, Vector3<Real>* akVertex, int iTQuantity,
00032         const int* aiIndex);
00033 
00034     virtual ~MeshSmoother ();
00035 
00036     // For deferred construction and destruction.  The caller is responsible
00037     // for deleting the input arrays.
00038     MeshSmoother ();
00039     void Create (int iVQuantity, Vector3<Real>* akVertex, int iTQuantity,
00040         const int* aiIndex);
00041     void Destroy ();
00042 
00043     // input values from the constructor
00044     int GetVQuantity () const;
00045     const Vector3<Real>* GetVertices () const;
00046     int GetTQuantity () const;
00047     const int* GetIndices () const;
00048 
00049     // derived quantites from the input mesh
00050     const Vector3<Real>* GetNormals () const;
00051     const Vector3<Real>* GetMeans () const;
00052 
00053     // Apply one iteration of the smoother.  The input time is supported for
00054     // applications where the surface evolution is time-dependent.
00055     void Update (Real fTime = (Real)0.0);
00056 
00057 protected:
00058     virtual bool VertexInfluenced (int i, Real fTime);
00059     virtual Real GetTangentWeight (int i, Real fTime);
00060     virtual Real GetNormalWeight (int i, Real fTime);
00061 
00062     int m_iVQuantity;
00063     Vector3<Real>* m_akVertex;
00064     int m_iTQuantity;
00065     const int* m_aiIndex;
00066 
00067     Vector3<Real>* m_akNormal;
00068     Vector3<Real>* m_akMean;
00069     int* m_aiNeighborCount;
00070 };
00071 
00072 typedef MeshSmoother<float> MeshSmootherf;
00073 typedef MeshSmoother<double> MeshSmootherd;
00074 
00075 }
00076 
00077 #endif

Generated on Wed Nov 23 19:01:06 2011 for FreeCAD by  doxygen 1.6.1