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
00012 #define DATA_INDEX_3D_TO_1D(x,y,z) ((z)*generalGrid.sizeXY + (y)*generalGrid.sizeX + (x))
00013
00014
00015
00016 #define DATA_INDEX_2D_TO_1D(x,y) ((y)*generalGrid.sizeX + (x))
00017
00018
00019
00020 #define ADDITIONALDATA_INDEX_3D_TO_1D(x,y,z,k) (DATA_INDEX_3D_TO_1D(x,y,z) * numOfSets + k)
00021
00022
00023 #define RESAMPLE_DATA_INDEX_3D_TO_1D(x,y,z) ((z)*orthoGrid.sizeXY + (y)*orthoGrid.sizeX + (x))
00024
00025
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
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
00041 struct GeneralGrid
00042 {
00043
00044 bool loaded;
00045
00046 int sizeX;
00047 int sizeY;
00048 int sizeZ;
00049 int sizeXY;
00050 int sizeXYZ;
00051
00052
00053
00054
00055 Vec3f *pos;
00056 Vec3f *vec;
00057
00058 float *additionalData;
00059
00060
00061 Vec2f *vecNorm;
00062
00063 float *vecLength;
00064
00065
00066 };
00067
00068
00069
00070 struct OrthoGrid
00071 {
00072
00073 bool loaded;
00074
00075
00076 int sizeX;
00077 int sizeY;
00078 int sizeZ;
00079 int sizeXY;
00080 int sizeXYZ;
00081
00082
00083 float stepLength;
00084
00085
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