1 /******************************************************************************
3 // El'Beem - the visual lattice boltzmann freesurface simulator
4 // All code distributed as part of El'Beem is covered by the version 2 of the
5 // GNU General Public License. See the file COPYING for details.
7 // Copyright 2008 Nils Thuerey , Richard Keiser, Mark Pauly, Ulrich Ruede
10 * Mean Value Mesh Coords class
12 *****************************************************************************/
17 #include "utilities.h"
20 #define mvmFloat double
25 #define isnan(n) _isnan(n)
26 #define finite _finite
34 // weight and triangle index
35 class mvmIndexWeight {
38 mvmIndexWeight() : weight(0.0) {}
40 mvmIndexWeight(int const& i, mvmFloat const& w) :
41 weight(w), index(i) {}
44 bool operator> (mvmIndexWeight const& w) const { return this->weight > w.weight; }
45 bool operator< (mvmIndexWeight const& w) const { return this->weight < w.weight; }
51 // transfer point with weights
52 class mvmTransferPoint {
54 //! position of transfer point
57 std::vector<mvmIndexWeight> weights;
62 class MeanValueMeshCoords {
66 MeanValueMeshCoords() {}
67 ~MeanValueMeshCoords() {
73 void calculateMVMCs(std::vector<ntlVec3Gfx> &reference_vertices,
74 std::vector<ntlTriangle> &tris, std::vector<ntlVec3Gfx> &points, gfxReal numweights);
76 void transfer(std::vector<ntlVec3Gfx> &vertices, std::vector<ntlVec3Gfx>& displacements);
80 void computeWeights(std::vector<ntlVec3Gfx> &reference_vertices,
81 std::vector<ntlTriangle> &tris, mvmTransferPoint& tds, gfxReal numweights);
83 std::vector<mvmTransferPoint> mVertices;