Two compile fixes for msvc and cmake provided by broken
[blender.git] / intern / elbeem / intern / mvmcoords.h
1 /******************************************************************************
2  *
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.  
6 //
7 // Copyright 2008 Nils Thuerey , Richard Keiser, Mark Pauly, Ulrich Ruede
8 //
9  *
10  * Mean Value Mesh Coords class
11  *
12  *****************************************************************************/
13
14 #ifndef MVMCOORDS_H
15 #define MVMCOORDS_H
16
17 #include "utilities.h"
18 #include "ntl_ray.h"
19 #include <vector>
20 #define mvmFloat double
21
22 #ifdef WIN32
23 #ifndef FREE_WINDOWS
24 #include "float.h"
25 #define isnan(n) _isnan(n)
26 #define finite _finite
27 #endif
28 #endif
29
30 // weight and triangle index
31 class mvmIndexWeight {
32         public:
33
34                 mvmIndexWeight() : weight(0.0) {}
35
36                 mvmIndexWeight(int const& i, mvmFloat const& w) :
37                         weight(w), index(i) {}
38
39                 // for sorting
40                 bool operator> (mvmIndexWeight const& w) const { return this->weight > w.weight; } 
41                 bool operator< (mvmIndexWeight const& w) const { return this->weight < w.weight; }
42
43                 mvmFloat weight;
44                 int index;
45 };
46
47 // transfer point with weights
48 class mvmTransferPoint {
49         public:
50                 //! position of transfer point
51                 ntlVec3Gfx lastpos;
52                 //! triangle weights
53                 std::vector<mvmIndexWeight> weights;
54 };
55
56
57 //! compute mvmcs
58 class MeanValueMeshCoords {
59
60         public:
61
62     MeanValueMeshCoords() {}
63     ~MeanValueMeshCoords() {
64         clear();
65     }
66
67     void clear();
68
69     void calculateMVMCs(std::vector<ntlVec3Gfx> &reference_vertices, 
70                                 std::vector<ntlTriangle> &tris, std::vector<ntlVec3Gfx> &points, gfxReal numweights);
71     
72     void transfer(std::vector<ntlVec3Gfx> &vertices, std::vector<ntlVec3Gfx>& displacements);
73
74         protected:
75
76     void computeWeights(std::vector<ntlVec3Gfx> &reference_vertices, 
77                                 std::vector<ntlTriangle> &tris, mvmTransferPoint& tds, gfxReal numweights);
78
79     std::vector<mvmTransferPoint> mVertices;
80     int mNumVerts;
81
82 };
83
84 #endif
85