1 #ifndef RIPPLING_0_MATH_H_
2 #define RIPPLING_0_MATH_H_
7 /*----------------------------------------------------------------------*\
9 \*---------------------------------------------------------------------*/
11 /*--------------------------------------*\
13 \*-------------------------------------*/
18 /*--------------------------------------*\
20 \*-------------------------------------*/
25 Rippling0Math(int w
, int h
)
30 /*--------------------------------------*\
32 \*-------------------------------------*/
41 void color(int i
, int j
, float t
, uchar4
* ptrColor
)
43 const double dxy10
= dxy(j
, i
) / 10.0;
44 const double grayLevelFloat
= 128.0 + 127.0 * cos(dxy10
- t
/ 7.0) / (dxy10
+ 1);
45 const uchar grayLevel
= (uchar
)(long(grayLevelFloat
) % 256);
47 ptrColor
->x
= grayLevel
;
48 ptrColor
->y
= grayLevel
;
49 ptrColor
->z
= grayLevel
;
54 double dxy(int x
, int y
)
56 return sqrt(pow(x
- this->dim2
, 2.0) + pow(y
- this->dim2
, 2.0));
59 /*--------------------------------------*\
61 \*-------------------------------------*/
70 /*----------------------------------------------------------------------*\
72 \*---------------------------------------------------------------------*/