Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

misc.h

Go to the documentation of this file.
00001 #if !defined _MISC_H
00002 #define _MISC_H
00003 
00004 #if _MSC_VER > 1000
00005 #pragma once
00006 #endif // _MSC_VER > 1000
00007 
00008 #include <math.h> 
00009 #include <vector>
00010 
00011 // calculate index of one dimensional array stored in general grid, for given three dimensional index
00012 #define DATA_INDEX_3D_TO_1D(x,y,z) ((z)*generalGrid.sizeXY + (y)*generalGrid.sizeX + (x))
00013 
00014 
00015 // calculate pos in array
00016 #define DATA_INDEX_2D_TO_1D(x,y) ((y)*generalGrid.sizeX + (x))
00017 
00018 
00019 // calculate index of one dimensional array stored in general grid, for given three dimensional index
00020 #define ADDITIONALDATA_INDEX_3D_TO_1D(x,y,z,k) (DATA_INDEX_3D_TO_1D(x,y,z) * numOfSets + k)
00021 
00022 // calculate index of the one dimensional array stored in orthoGrid, for given three dimensional index
00023 #define RESAMPLE_DATA_INDEX_3D_TO_1D(x,y,z) ((z)*orthoGrid.sizeXY + (y)*orthoGrid.sizeX + (x))
00024 
00025 // calculate index of the one dimensional array stored in orthoGrid, for given three dimensional index
00026 #define RESAMPLE_ADDITIONALDATA_INDEX_3D_TO_1D(x,y,z,k) (RESAMPLE_DATA_INDEX_3D_TO_1D(x,y,z) * numOfSets + k)
00027 
00028 
00029 // simple structure to store three floats
00030 struct Vec3f{
00031         float x;
00032         float y;
00033         float z;
00034 };
00035 
00036 struct Vec2f{
00037         float x;
00038         float y;
00039 };
00040 // to load datafiles and gridfiles
00041 struct GeneralGrid 
00042 {
00043         // data loaded - flag
00044         bool loaded;
00045         // array dimensions
00046         int sizeX;
00047         int sizeY;
00048         int sizeZ;
00049         int sizeXY;
00050         int sizeXYZ;
00051         
00052         
00053 
00054         // internal onedimensional representation of position and vector data
00055         Vec3f *pos;
00056         Vec3f *vec;
00057         // internal onedimensional representation of additional data
00058         float *additionalData;
00059 
00060         // normalized speed vector
00061         Vec2f *vecNorm;
00062 
00063         float *vecLength;
00064 
00065                 
00066 };
00067 
00068 
00069 // for orthogonalized datagrids
00070 struct OrthoGrid
00071 {
00072         // data loaded - flag
00073         bool loaded;
00074 
00075         // array dimensions
00076         int sizeX;
00077         int sizeY;
00078         int sizeZ;
00079         int sizeXY;
00080         int sizeXYZ;
00081 
00082         // space between two samples
00083         float stepLength;
00084 
00085         // internal onedimensional representation of vector data
00086         Vec3f *vec;
00087         float *additionalData;
00088 };
00089 
00090 
00091 
00092 struct Rect
00093 {
00094         Vec2f lowerLeft;
00095         Vec2f upperRight;
00096         bool initialized;
00097 };
00098 
00099 
00100 struct colorRGBA
00101 {
00102         float r;
00103         float g;
00104         float b;
00105         float a;
00106 };
00107 
00108 
00109 
00110 #endif // !defined _MISC_H

Generated on Thu Jan 23 04:30:11 2003 for FlowVis- vector field in 2D by doxygen1.3-rc2