1 #ifndef RIPPLING_MATH_H_
2 #define RIPPLING_MATH_H_
6 /*----------------------------------------------------------------------*\
8 \*---------------------------------------------------------------------*/
10 /*--------------------------------------*\
12 \*-------------------------------------*/
17 /*--------------------------------------*\
19 \*-------------------------------------*/
24 RipplingMath(int w
, int h
)
29 /*--------------------------------------*\
31 \*-------------------------------------*/
40 void color(int i
, int j
, float t
, uchar4
& color
)
42 const double dxy10
= dxy(j
, i
) / 10.0;
43 const double grayLevelFloat
= 128.0 + 127.0 * cos(dxy10
- t
/ 7.0) / (dxy10
+ 1);
44 const uchar grayLevel
= (uchar
)(long(grayLevelFloat
) % 256);
53 double dxy(int x
, int y
)
55 return sqrt(pow(x
- this->dim2
, 2.0) + pow(y
- this->dim2
, 2.0));
59 /*--------------------------------------*\
61 \*-------------------------------------*/
72 /*----------------------------------------------------------------------*\
74 \*---------------------------------------------------------------------*/