00001 #pragma once
00002
00003 #ifndef _v_stream_line_h
00004 #define _v_stream_line_h
00005
00006 #include "VVector.h"
00007 #include <vector>
00011 class VStreamLine
00012 {
00013 public:
00014
00018 VStreamLine();
00019
00024 VStreamLine(std::vector<VVector> m_Positions);
00025
00031 VStreamLine(std::vector<VVector> m_Positions, std::vector<float> m_TaperFactors);
00032
00037 VStreamLine(const VStreamLine & rhs)
00038 {
00039 if(this != &rhs)
00040 {
00041
00042 clearVBO();
00043
00044 mPositions.clear();
00045 mIndices.clear();
00046 mTaperFactors.clear();
00047
00048
00049 mPositions = rhs.mPositions;
00050 mIndices = rhs.mIndices;
00051 mIndexVBOHandle = rhs.mIndexVBOHandle;
00052 mPositionVBOHandle = rhs.mPositionVBOHandle;
00053 mTaperFactors = rhs.mTaperFactors;
00054 mTaperVectors = rhs.mTaperVectors;
00055
00056 }
00057 }
00058
00059
00063 ~VStreamLine()
00064 {
00065
00066 clearVBO();
00067
00068 mPositions.clear();
00069 mIndices.clear();
00070 mTaperFactors.clear();
00071 mTaperVectors.clear();
00072 }
00073
00077 VStreamLine & operator=(const VStreamLine & rhs)
00078 {
00079 if(this != &rhs)
00080 {
00081
00082 clearVBO();
00083
00084 mPositions.clear();
00085 mIndices.clear();
00086 mTaperFactors.clear();
00087 mTaperVectors.clear();
00088
00089
00090 mPositions = rhs.mPositions;
00091 mIndices = rhs.mIndices;
00092 mIndexVBOHandle = rhs.mIndexVBOHandle;
00093 mPositionVBOHandle = rhs.mPositionVBOHandle;
00094 mTaperFactors = rhs.mTaperFactors;
00095 mTaperVectors = rhs.mTaperVectors;
00096
00097 }
00098 return (*this);
00099 }
00100
00107 void draw( bool tap, float scale , bool glyph);
00108
00113 int getNumberOfPoints( )
00114 {
00115 return (int)mPositions.size();
00116 }
00117
00118
00124 void setSeparation( float dsep, float dtest )
00125 {
00126 m_Separation_dsep = dsep;
00127 m_Separation_dtest = dtest;
00128 }
00129
00135 std::vector< VVector > getCandidateSeeds( float dsep );
00136
00137
00143 void computeThicknessCoefficients( float dtest, float dsep, std::vector< VStreamLine > others, int itself, float datasizemax );
00144
00148 void clearVBO();
00149
00159 bool isPointAllowed(VVector m_Point, float m_Epsilon);
00160
00166 float getMinimalDistance( VVector m_Point );
00167
00172 void setThicknessCoefficient( std::vector< float > thickness )
00173 {
00174 mTaperFactors = thickness;
00175 }
00176
00187 bool isPointAllowed(VVector m_Point, float m_Epsilon, float * m_Distance);
00188
00195 bool interSectsStreamLine(VVector m_Point1, VVector m_Point2);
00196
00197 void regenerateVBO()
00198 {
00199 generateVBO();
00200 }
00201
00206 void loadStreamLine( FILE * m_FilePointer );
00207
00212 void saveStreamLine( FILE * m_FilePointer );
00213
00214 private:
00215
00219 void generateVBO();
00220
00224 void activateVBO();
00225
00229 void deactivateVBO();
00230
00231
00232 std::vector<VVector> mPositions;
00233 std::vector<int> mIndices;
00235 unsigned int mPositionVBOHandle;
00236 unsigned int mIndexVBOHandle;
00237 std::vector<float> mTaperFactors;
00238 std::vector<VVector> mTaperVectors;
00239 unsigned int mTaperVBOHandle;
00241 float m_Separation_dsep;
00242 float m_Separation_dtest;
00243
00244 };
00245
00246 #endif //_v_stream_line_h