Ajout de l'ensemble du workspace.
[GPU.git] / WCudaMSE / Tuto_Image_Cuda / src / cpp / core / 02_Damier_Zoomable / moo / device / math / DamierMath.h
diff --git a/WCudaMSE/Tuto_Image_Cuda/src/cpp/core/02_Damier_Zoomable/moo/device/math/DamierMath.h b/WCudaMSE/Tuto_Image_Cuda/src/cpp/core/02_Damier_Zoomable/moo/device/math/DamierMath.h
new file mode 100755 (executable)
index 0000000..30a6c62
--- /dev/null
@@ -0,0 +1,92 @@
+#ifndef DAMIER_MATH_H_\r
+#define DAMIER_MATH_H_\r
+\r
+#include <math.h>\r
+\r
+#include "CalibreurF.h"\r
+#include "ColorTools.h"\r
+\r
+\r
+/*----------------------------------------------------------------------*\\r
+ |*                    Declaration                                     *|\r
+ \*---------------------------------------------------------------------*/\r
+\r
+/*--------------------------------------*\\r
+ |*            Public                  *|\r
+ \*-------------------------------------*/\r
+\r
+\r
+class DamierMath\r
+    {\r
+\r
+       /*--------------------------------------*\\r
+       |*              Constructor             *|\r
+        \*-------------------------------------*/\r
+\r
+    public:\r
+\r
+       __device__\r
+       DamierMath(int n):calibreur(IntervalF(-1, 1), IntervalF(0, 1))\r
+           {\r
+           this->n = n;\r
+           }\r
+\r
+       // constructeur copie automatique car pas pointeur dans\r
+       //      DamierMath\r
+       //      calibreur\r
+       //      IntervalF\r
+\r
+       /*--------------------------------------*\\r
+       |*              Methodes                *|\r
+        \*-------------------------------------*/\r
+\r
+    public:\r
+\r
+       /**\r
+        * x=pixelI\r
+        * y=pixelJ\r
+        */\r
+       __device__\r
+       void colorXY(uchar4* ptrColor,float x, float y,float t)\r
+           {\r
+           float z = f(x, y,t);\r
+\r
+           calibreur.calibrer(z);\r
+           float hue01 = z;\r
+\r
+           ColorTools::HSB_TO_RVB(hue01,ptrColor); // update color\r
+\r
+           ptrColor->w = 255; // opaque\r
+           }\r
+\r
+    private:\r
+\r
+       __device__\r
+       float f(float x, float y,float t)\r
+           {\r
+           return sin(x * n + t) * cos(y * n + t);\r
+           }\r
+\r
+       /*--------------------------------------*\\r
+       |*              Attributs               *|\r
+        \*-------------------------------------*/\r
+\r
+    private:\r
+\r
+       // Input\r
+       int n;\r
+\r
+       // Tools\r
+       CalibreurF calibreur;\r
+\r
+    };\r
+\r
+\r
+\r
+#endif \r
+\r
+\r
+\r
+/*----------------------------------------------------------------------*\\r
+ |*                    End                                             *|\r
+ \*---------------------------------------------------------------------*/\r