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
30 // weight and triangle index
31 class mvmIndexWeight {
34 mvmIndexWeight() : weight(0.0) {}
36 mvmIndexWeight(int const& i, mvmFloat const& w) :
37 weight(w), index(i) {}
40 bool operator> (mvmIndexWeight const& w) const { return this->weight > w.weight; }
41 bool operator< (mvmIndexWeight const& w) const { return this->weight < w.weight; }
47 // transfer point with weights
48 class mvmTransferPoint {
50 //! position of transfer point
53 std::vector<mvmIndexWeight> weights;
58 class MeanValueMeshCoords {
62 MeanValueMeshCoords() {}
63 ~MeanValueMeshCoords() {
69 void calculateMVMCs(std::vector<ntlVec3Gfx> &reference_vertices,
70 std::vector<ntlTriangle> &tris, std::vector<ntlVec3Gfx> &points, gfxReal numweights);
72 void transfer(std::vector<ntlVec3Gfx> &vertices, std::vector<ntlVec3Gfx>& displacements);
76 void computeWeights(std::vector<ntlVec3Gfx> &reference_vertices,
77 std::vector<ntlTriangle> &tris, mvmTransferPoint& tds, gfxReal numweights);
79 std::vector<mvmTransferPoint> mVertices;