C:/Projekte/C++/FlowVIS_107/src/StreamLine.h

Go to the documentation of this file.
00001 #ifndef STREAMLINE_H
00002 #define STREAMLINE_H
00003 
00004 #include "common.h"
00005 #include "FlowGeometry.h"
00006 #include "FlowData.h"
00007 #include "StreamLineGrid.h"
00008 
00009 #include <vector>
00010 
00011 
00012 using namespace std;
00013 
00014 
00015 #define FORWARD       0   // forward-integration
00016 #define BACKWARD      1   // backward-integration
00017 
00018 
00019 struct slSamplePoint
00020 {  
00021   vec3  point;      // sample-point
00022   vec3  tPoint;     // 2nd point used for tapering-effect (distance to point == thickness)
00023   vec3  direction;  // direction of the movement in the current point; needed for glyphs
00024 };
00025 
00026 struct slStreamLine
00027 {
00028   vector<slSamplePoint> streamLine;   // list of sample-points of one streamline, i.e., this IS one streamline
00029 };
00030 
00031 
00032 class StreamLine
00033 {
00034   friend class StreamLineGrid;
00035 
00036 public:
00037 
00039   StreamLine( FlowData *fd );
00040 
00042   ~StreamLine();
00043 
00045   void create();
00046 
00048   void create( float dSep, float dTest, bool linesActive, bool taperingActive, bool glyphActive );
00049 
00051   void draw();
00052 
00054   void reset();
00055 
00056 
00057   // --- Getter and Setter --- //
00058 
00060   void setDSep( float dSep ) { m_dSep = dSep; }
00061 
00063   float getDSep() { return m_dSep; }
00064 
00066   void setDTest( float dTest ) { m_dTest = m_dSep * dTest; }
00067 
00069   float getDTest() { return (m_dTest / m_dSep); }
00070 
00072   void setGlyphSize( int size ) { m_glyphSize = size; }
00073 
00075   int getGlyphSize() { return m_glyphSize; }
00076 
00078   void setGlyphDistance( int distance ) { m_glyphDistance = distance; }
00079 
00081   int getGlyphDistance() { return m_glyphDistance; }
00082 
00084   void setLineColor( float* color )
00085   { 
00086     // seems to be a safe way in c++ :(
00087     m_lineColor = new float[4];
00088 
00089     m_lineColor[0] = color[0]; 
00090     m_lineColor[1] = color[1]; 
00091     m_lineColor[2] = color[2]; 
00092     m_lineColor[3] = color[3]; 
00093   }
00094 
00096   float* getLineColor() { return m_lineColor; }
00097 
00099   void setGlyphColor( float* color )
00100   { 
00101     // seems to be a safe way in c++ :(
00102     m_glyphColor = new float[4];
00103 
00104     m_glyphColor[0] = color[0]; 
00105     m_glyphColor[1] = color[1]; 
00106     m_glyphColor[2] = color[2]; 
00107     m_glyphColor[3] = color[3]; 
00108   }
00109 
00111   float* getGlyphColor() { return m_glyphColor; }
00112 
00114   void setIntegrationMethod( short method ) { m_integrationMethod = method; }
00115 
00117   short getIntegrationMethod() { return m_integrationMethod; }
00118 
00120   void setLinesActive( bool isActive ) { m_isLinesActive = isActive; }
00121 
00123   bool getLinesActive() { return m_isLinesActive; }
00124 
00126   void setTaperingActive( bool isActive ) { m_isTaperingActive = isActive; }
00127 
00129   bool getTaperingActive() { return m_isTaperingActive; }
00130 
00132   void setGlyphActive( bool isActive ) { m_isGlyphActive = isActive; }
00133 
00135   bool getGlyphActive() { return m_isGlyphActive; }
00136 
00137 
00138 private:
00139 
00141   float getRandomFloat( int rnd );
00142 
00144   float toRad( float grad );
00145 
00147   vec3 rotateVector( vec3 vector, float phi );
00148 
00150   void createInitialStreamLine();
00151 
00153   void createStreamLine( vec3 pos );
00154 
00156   vector<slSamplePoint> doIntegration( vec3 pos, bool integration );
00157 
00159   void createSeedPoints();
00160 
00162   bool isValidSeedPoint( vec3 point );
00163 
00165   vec3 calculateEulerPosition( vec3 pos, vec3 vel );
00166 
00168   vec3 calculateRungeKutta2Position( vec3 pos, vec3 vel, bool integration );
00169 
00171   float calculateThicknessCoeff( float distance );
00172 
00174   void drawStreamLines();
00175 
00177   void drawStreamLinesWithoutTapering();
00178 
00180   void drawStreamLinesWithTapering();
00181 
00183   void drawGlyphs();
00184 
00186   bool createGlyphTexture();
00187 
00189   void setTestParameters();
00190 
00191 
00192 private:
00193   
00195   FlowData *m_flowData;
00196 
00198   FlowGeometry *m_flowGeometry;
00199 
00201   StreamLineGrid *m_slgGrid;
00202 
00204   vector<slStreamLine> m_streamLines;
00205 
00207   vector<vec3> m_seedPoints;
00208 
00210   float m_dSep;
00211 
00213   float m_dTest;
00214 
00216   float m_d;
00217 
00219   int m_maxSteps;
00220 
00222   int m_maxLines;
00223 
00225   int m_glyphSize;
00226 
00228   int m_glyphDistance;
00229 
00231   float m_maxLineThickness;
00232 
00234   short m_integrationMethod;
00235 
00237   float *m_lineColor;
00238 
00240   float *m_glyphColor;
00241 
00243   GLuint m_glyphTexId;
00244 
00246   bool m_isLinesActive;
00247 
00249   bool m_isTaperingActive;
00250 
00252   bool m_isGlyphActive;
00253 
00254 };
00255 
00256 
00257 #endif

Generated on Mon Jan 21 14:50:12 2008 for VisLU by  doxygen 1.5.4