import java.io.*;
import java.awt.*;
import java.applet.Applet;
import polar;

public class eskenarcokgen 
{

public static void drawEskenarcokgen(Graphics g,int xi,int yi, int n,int eskenarcokgenboyu,double aci )
{

   // xi,yi eskenar cokgen merkez koordinatlari
   // n : eskenar dortgen kose sayisi
   // eskenarcokkenboyu : eskenar cokgen merkezinden
   // kenarina olan mesafe
   // bu eskenarcokken cizime teta=pi/2+aci radyandan baslar

   double teta=2.0*Math.PI/n;
   double R=eskenarcokgenboyu;
   polar P1=new polar();
   int x[]=new int[2*n+2];
   int y[]=new int[2*n+2];
   for(int i=0;i<=n;i++)
   {
     double teta1=teta*i+Math.PI/2.0+aci;
     P1.polarGir(R,teta1);
     x[i]=xi+(int)P1.xi();
     y[i]=yi-(int)P1.xj();
     if(i==n)
     {
     x[i]=x[0];
     y[i]=y[0];     
     }
   }
   g.drawPolygon(x,y,(n+1));

}  //draweskenarcokgen metodu sonu

public static void fillEskenarcokgen(Graphics g,int xi,int yi, int n,int eskenarcokgenboyu,double aci )
{
   // bu eskenarcokgen cizime teta=pi/2+aci radyandan baslar
   double teta=2.0*Math.PI/n;
   double R=eskenarcokgenboyu;
   polar P1=new polar();
   int x[]=new int[2*n+2];
   int y[]=new int[2*n+2];
   for(int i=0;i<=n;i++)
   {
     double teta1=teta*i+Math.PI/2.0+aci;
     P1.polarGir(R,teta1);
     x[i]=xi+(int)P1.xi();
     y[i]=yi-(int)P1.xj();
     if(i==n)
     {
     x[i]=x[0];
     y[i]=y[0];     
     }
   }
   g.fillPolygon(x,y,(n+1));

}  //filleskenarcokgen metodu sonu


}
