import java.awt.Graphics;
import java.awt.Color;
public class Figure extends java.applet.Applet {
int rouge;
int vert=0;
int bleu= 255;
int x3,y3;
double p45=0.707;
double f(double x, double y) {
return (Math.sin((x*x+y*y)/5000));
}
public void paint(Graphics g) {
int offsetx=(getSize().width+(int)( p45*getSize().height))/2;
int offsety=(getSize().height)/2;
for (int x = (int)( p45*getSize().height) ; x < getSize().width ; x++) {
for (int y = 0 ; y < getSize().height ; y++) {
x3=(int) (x-y*p45);
y3=(int) (y*p45-50*f(x-offsetx,y-offsety)+offsety*p45/2);
rouge= (int) ((f(x-offsetx,y-offsety)+1)*128);
g.setColor(new Color(rouge,vert,bleu));
g.drawLine(x3,y3,x3,y3);
}
}
}
}