//
public class testPix extends PixApplet { double rgb[] = {0,0,0}; public void setPix(int frame) { for (int x = 0 ; x < W ; x++) for (int y = 0 ; y < H ; y++) { double X = 2.0 * x / W - 1.0; double Y = 2.0 * (H-y) / W - 1.0; computeRGB(frame, X, Y, rgb); pix[xy2i(x,y)] = pack((int)(255 * rgb[0]), (int)(255 * rgb[1]), (int)(255 * rgb[2])); } damage = true; } // THE OBJECT SPACE THAT I WILL RAYTRACE IN void computeRGB(int frame, double X, double Y, double rgb[]) { X = Math.sin(10 * X); Y = Math.sin(10 * Y); double S = Math.sin(4 * Math.sqrt(X * X + Y * Y) - frame); rgb[0] = .5 + .5 * S; S = Math.sin(5 * Math.sqrt(X * X + Y * Y) - frame); rgb[1] = .5 + .5 * S; S = Math.sin(6 * Math.sqrt(X * X + Y * Y) - frame); rgb[2] = .5 + .5 * S; } }