X-Git-Url: http://git.euphorik.ch/index.cgi?a=blobdiff_plain;f=WCudaMSE%2FTuto_Image%2Fsrc%2Fcpp%2Fcore%2F02_Damier_Zoomable%2Fc_math%2FDamierMath.h;fp=WCudaMSE%2FTuto_Image%2Fsrc%2Fcpp%2Fcore%2F02_Damier_Zoomable%2Fc_math%2FDamierMath.h;h=1b68e846b22e518aac8ce2929e2b43fe72cad24d;hb=8d08c12b29c2a14684f35c023ee39e694bb80d25;hp=0000000000000000000000000000000000000000;hpb=226de81f7e1f1fbf4ac79d0d089e8a05ec7159a0;p=GPU.git diff --git a/WCudaMSE/Tuto_Image/src/cpp/core/02_Damier_Zoomable/c_math/DamierMath.h b/WCudaMSE/Tuto_Image/src/cpp/core/02_Damier_Zoomable/c_math/DamierMath.h new file mode 100755 index 0000000..1b68e84 --- /dev/null +++ b/WCudaMSE/Tuto_Image/src/cpp/core/02_Damier_Zoomable/c_math/DamierMath.h @@ -0,0 +1,85 @@ +#ifndef DAMIER_MATH_H_ +#define DAMIER_MATH_H_ + +#include "CalibreurF.h" +#include "ColorTools.h" +#include + +/*----------------------------------------------------------------------*\ + |* Declaration *| + \*---------------------------------------------------------------------*/ + +/*--------------------------------------*\ + |* Public *| + \*-------------------------------------*/ + +/** + * Dans un header only pour preparer la version cuda + */ +class DamierMath + { + /*--------------------------------------*\ + |* Constructeur *| + \*-------------------------------------*/ + + public: + + /** + * calibreurColor : transformation affine entre [-1,1] (l'output de f(x,y)) et [0,1] (le spectre hsb) + */ + DamierMath(int n) : + calibreur(IntervalF(-1, 1), IntervalF(0, 1)) + { + this->n = n; + } + + virtual ~DamierMath(void) + { + // rien + } + + /*--------------------------------------*\ + |* Methode *| + \*-------------------------------------*/ + + public: + + void colorXY(uchar4* ptrColor, double x, double y, const DomaineMath& domaineMath, double t) + { + float z = f(x, y, t); + + calibreur.calibrer(z); + float hue01 = z; + + ColorTools::HSB_TO_RVB(hue01, ptrColor); // update color + + ptrColor->w = 255; // opaque + } + + private: + + double f(double x, double y, double t) + { + return sin(x * n + t) * cos(y * n + t); // t para animation + } + + /*--------------------------------------*\ + |* Attribut *| + \*-------------------------------------*/ + + protected: + + // Inputs + int n; + + // Tools + CalibreurF calibreur; + + } +; + +#endif + +/*----------------------------------------------------------------------*\ + |* End *| + \*---------------------------------------------------------------------*/