『砂漠のオアシス』
■ // // プログラム2のソースコード (提出用) // import jp.ac.teu.media.*; public class u02p000_2 extends TMLib { final static int vsize = 480; public static void main(String [] args) { begin(new u02p000_2(), vsize, vsize); } public void Main() { int x, y, R, G, B; double X, sX, wX, dX, Y, sY, wY, dY, Z1, Z2, Z3; TMLibImage img = new TMLibImage(); img.newImage(vsize, vsize); // *** BEGIN WINDOW *** // sX = -10; sY = -10; wX = 22; wY = wX; // *** END WINDOW *** // dX = wX/(double)vsize; dY = wY/(double)vsize; for(x = 0; x < vsize; x++){ X = sX + dX * (double)x; for(y = 0; y < vsize; y++){ Y = sY + dY * (double)y; // *** BEGIN YOUR PROGRAM *** // Z1 = X*X*X + Y*Y*Y; Z2 = X*X + Y*Y; Z3 = 0; if(15 G = y/2 + 200; B = y; }else if(45 G = y/2 + 200; B = y; }else if(65 G = y/2 + 200; B = y; }else{ R = (int)Z2 % 128 + 80; G = (int)Z2 % 128; B = (int)Z1 % 200; } // *** END YOUR PROGRAM *** // img.setRGB(x, y, R, G, B); } } drawImage(0, 0, img); img.writeImage("u02p000_2.png"); } } |