Blender V2.61 - r43446
|
00001 00004 /****************************************************************************** 00005 * 00006 // El'Beem - the visual lattice boltzmann freesurface simulator 00007 // All code distributed as part of El'Beem is covered by the version 2 of the 00008 // GNU General Public License. See the file COPYING for details. 00009 // 00010 // Copyright 2008 Nils Thuerey , Richard Keiser, Mark Pauly, Ulrich Ruede 00011 // 00012 * 00013 * Mean Value Mesh Coords class 00014 * 00015 *****************************************************************************/ 00016 00017 #ifndef MVMCOORDS_H 00018 #define MVMCOORDS_H 00019 00020 #include "utilities.h" 00021 #include "ntl_ray.h" 00022 #include <vector> 00023 #define mvmFloat double 00024 00025 #ifdef WIN32 00026 #ifndef FREE_WINDOWS 00027 #include "float.h" 00028 #define isnan(n) _isnan(n) 00029 #define finite _finite 00030 #endif 00031 #endif 00032 00033 #ifdef sun 00034 #include "ieeefp.h" 00035 #endif 00036 00037 // weight and triangle index 00038 class mvmIndexWeight { 00039 public: 00040 00041 mvmIndexWeight() : weight(0.0) {} 00042 00043 mvmIndexWeight(int const& i, mvmFloat const& w) : 00044 weight(w), index(i) {} 00045 00046 // for sorting 00047 bool operator> (mvmIndexWeight const& w) const { return this->weight > w.weight; } 00048 bool operator< (mvmIndexWeight const& w) const { return this->weight < w.weight; } 00049 00050 mvmFloat weight; 00051 int index; 00052 }; 00053 00054 // transfer point with weights 00055 class mvmTransferPoint { 00056 public: 00058 ntlVec3Gfx lastpos; 00060 std::vector<mvmIndexWeight> weights; 00061 }; 00062 00063 00065 class MeanValueMeshCoords { 00066 00067 public: 00068 00069 MeanValueMeshCoords() {} 00070 ~MeanValueMeshCoords() { 00071 clear(); 00072 } 00073 00074 void clear(); 00075 00076 void calculateMVMCs(std::vector<ntlVec3Gfx> &reference_vertices, 00077 std::vector<ntlTriangle> &tris, std::vector<ntlVec3Gfx> &points, gfxReal numweights); 00078 00079 void transfer(std::vector<ntlVec3Gfx> &vertices, std::vector<ntlVec3Gfx>& displacements); 00080 00081 protected: 00082 00083 void computeWeights(std::vector<ntlVec3Gfx> &reference_vertices, 00084 std::vector<ntlTriangle> &tris, mvmTransferPoint& tds, gfxReal numweights); 00085 00086 std::vector<mvmTransferPoint> mVertices; 00087 int mNumVerts; 00088 00089 }; 00090 00091 #endif 00092