X-Git-Url: http://git.euphorik.ch/index.cgi?a=blobdiff_plain;f=WCudaMSE%2FTuto_Image%2Fsrc%2Fcpp%2Fcore%2F01_Vague%2Fc_math%2FVagueMath.h;fp=WCudaMSE%2FTuto_Image%2Fsrc%2Fcpp%2Fcore%2F01_Vague%2Fc_math%2FVagueMath.h;h=aabd5dd4d779b22896d521376493e81c06b7c133;hb=8d08c12b29c2a14684f35c023ee39e694bb80d25;hp=0000000000000000000000000000000000000000;hpb=226de81f7e1f1fbf4ac79d0d089e8a05ec7159a0;p=GPU.git diff --git a/WCudaMSE/Tuto_Image/src/cpp/core/01_Vague/c_math/VagueMath.h b/WCudaMSE/Tuto_Image/src/cpp/core/01_Vague/c_math/VagueMath.h new file mode 100755 index 0000000..aabd5dd --- /dev/null +++ b/WCudaMSE/Tuto_Image/src/cpp/core/01_Vague/c_math/VagueMath.h @@ -0,0 +1,89 @@ +#ifndef VAGUE_MATH_H_ +#define VAGUE_MATH_H_ + +#include "cudaType.h" +#include "MathTools.h" + +/*----------------------------------------------------------------------*\ + |* Declaration *| + \*---------------------------------------------------------------------*/ + +/*--------------------------------------*\ + |* Public *| + \*-------------------------------------*/ + +/** + * Dans un header only pour preparer la version cuda + */ +class VagueMath + { + + /*--------------------------------------*\ + |* Constructeur *| + \*-------------------------------------*/ + + public: + + VagueMath(unsigned int w, unsigned int h) + { + this->factor = 4 * PI / (float) w; + } + + virtual ~VagueMath(void) + { + //rien + } + + /*--------------------------------------*\ + |* Methode *| + \*-------------------------------------*/ + + public: + + /** + * i in [0,h[ + * j in [0,w[ + * code commun � + * entrelacementOMP + * forAutoOMP + */ + void colorIJ(uchar4* ptrColorIJ, int i, int j, int t) + { + unsigned char levelGris; + + f(levelGris,i, j, t); // update levelGris + + ptrColorIJ->x = levelGris; + ptrColorIJ->y = levelGris; + ptrColorIJ->z = levelGris; + + ptrColorIJ->w = 255; // opaque + } + + private: + + void f( unsigned char& levelGris,int i, int j, float t) + { + // example1 + // levelGris = 255 * fabs(sin(t)); // same color for all the image (Hello image) + + // Example2 + levelGris = 255 * fabs(sin(i * factor + t)); + } + + /*--------------------------------------*\ + |* Attribut *| + \*-------------------------------------*/ + + private: + + // Inputs + float factor; + + }; + +#endif + +/*----------------------------------------------------------------------*\ + |* End *| + /*----------------------------------------------------------------------*/