1 #ifndef RIPPLING_MATH_H_
2 #define RIPPLING_MATH_H_
8 /*----------------------------------------------------------------------*\
10 \*---------------------------------------------------------------------*/
12 /*--------------------------------------*\
14 \*-------------------------------------*/
17 * Dans un header only pour preparer la version cuda
22 /*--------------------------------------*\
24 \*-------------------------------------*/
27 RipplingMath(unsigned int w
, unsigned int h
)
32 virtual ~RipplingMath()
37 /*--------------------------------------*\
39 \*-------------------------------------*/
42 void colorIJ(uchar4
* ptrColor
, int i
, int j
, float t
)
44 const double dxy10
= dxy(j
, i
) / 10.0;
45 const double grayLevelFloat
= 128.0 + 127.0 * cos(dxy10
- t
/ 7.0) / (dxy10
+ 1);
46 const uchar grayLevel
= (uchar
)(long(grayLevelFloat
) % 256);
48 ptrColor
->x
= grayLevel
;
49 ptrColor
->y
= grayLevel
;
50 ptrColor
->z
= grayLevel
;
52 ptrColor
->w
= 255; // Opaque.
56 inline double dxy(int x
, int y
) // par exmple
58 return sqrt(pow(x
- this->dim2
, 2.0) + pow(y
- this->dim2
, 2.0));
63 /*--------------------------------------*\
65 \*-------------------------------------*/
68 const double dim2
; // = dim / 2.
73 /*----------------------------------------------------------------------*\
75 \*---------------------------------------------------------------------*/