import java.applet.Applet;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Image;
public class Descartes extends Applet {
int AppletWidth,AppletHeight;
Image OffScreen;
Graphics drawOffScreen;
public void init()
{
setBackground(Color.black);
AppletWidth = getSize().width;
AppletHeight = getSize().height;
OffScreen = createImage(AppletWidth,AppletHeight);
drawOffScreen = OffScreen.getGraphics();
}
public void paint(Graphics g)
{
drawOffScreen.clearRect(0,0,AppletWidth,AppletHeight);
drawOffScreen.setColor(Color.white);
int i,j;
double x,y,r;
for ( i = 0; i <= 90; i++ )
for ( j = 0; j <= 90; j++ )
{
r=Math.PI/45*i*(1-Math.sin(Math.PI/45*j))*18;
x=r*Math.cos(Math.PI/45*j)*Math.sin(Math.PI/45*i)
+AppletWidth/2;
y=-r*Math.sin(Math.PI/45*j)+AppletHeight/4;
drawOffScreen.fillOval((int)x,(int)y,2,2);
}
g.drawImage(OffScreen,0,0,this);
}
}