int main(int argc, char *argv[]) { screen(noiseWidth, noiseHeight, 0, "Marble"); generateNoise(); ColorRGB color; //xPeriod and yPeriod together define the angle of the lines //xPeriod and yPeriod both 0 ==> it becomes a normal clouds or turbulence pattern double xPeriod = 5.0; //defines repetition of marble lines in x direction double yPeriod = 10.0; //defines repetition of marble lines in y direction //turbPower = 0 ==> it becomes a normal sine pattern double turbPower = 5.0; //makes twists double turbSize = 32.0; //initial size of the turbulence for(int y = 0; y < h; y++) for(int x = 0; x < w; x++) { double xyValue = x * xPeriod / noiseWidth + y * yPeriod / noiseHeight + turbPower * turbulence(x, y, turbSize) / 256.0; double sineValue = 256 * fabs(sin(xyValue * 3.14159)); color.r = color.g = color.b = Uint8(sineValue); pset(x, y, color); } redraw(); sleep(); return 0; }