/** \file elbeem/intern/mvmcoords.h * \ingroup elbeem */ /****************************************************************************** * // El'Beem - the visual lattice boltzmann freesurface simulator // All code distributed as part of El'Beem is covered by the version 2 of the // GNU General Public License. See the file COPYING for details. // // Copyright 2008 Nils Thuerey , Richard Keiser, Mark Pauly, Ulrich Ruede // * * Mean Value Mesh Coords class * *****************************************************************************/ #ifndef MVMCOORDS_H #define MVMCOORDS_H #include "utilities.h" #include "ntl_ray.h" #include #define mvmFloat double #ifdef WIN32 #ifndef FREE_WINDOWS #include "float.h" #define isnan(n) _isnan(n) #define finite _finite #endif #endif #ifdef sun #include "ieeefp.h" #endif // weight and triangle index class mvmIndexWeight { public: mvmIndexWeight() : weight(0.0) {} mvmIndexWeight(int const& i, mvmFloat const& w) : weight(w), index(i) {} // for sorting bool operator> (mvmIndexWeight const& w) const { return this->weight > w.weight; } bool operator< (mvmIndexWeight const& w) const { return this->weight < w.weight; } mvmFloat weight; int index; }; // transfer point with weights class mvmTransferPoint { public: //! position of transfer point ntlVec3Gfx lastpos; //! triangle weights std::vector weights; }; //! compute mvmcs class MeanValueMeshCoords { public: MeanValueMeshCoords() {} ~MeanValueMeshCoords() { clear(); } void clear(); void calculateMVMCs(std::vector &reference_vertices, std::vector &tris, std::vector &points, gfxReal numweights); void transfer(std::vector &vertices, std::vector& displacements); protected: void computeWeights(std::vector &reference_vertices, std::vector &tris, mvmTransferPoint& tds, gfxReal numweights); std::vector mVertices; int mNumVerts; }; #endif