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

public class dikdortgen 
{

public static void drawdikdortgen(Graphics g,int xi,int yi,int en,int boy,double aci )
{
   

   double R=boy;
   double r=en;

   polar P1=new polar();
   polar P2=new polar();
   polar P3=new polar();
   polar P4=new polar();   

   int x[]=new int[5];
   int y[]=new int[5];

   int k=0;
     //P1.polarGir(R,teta1);
     x[0]=xi;
     y[0]=yi;
     
     double teta1=aci;   
     
     P2.polarGir(r,teta1);    
     x[1]=x[0]+(int)P2.xi();
     y[1]=y[0]-(int)P2.xj();

     teta1+=Math.PI/2;   
     P3.polarGir(R,teta1);    
     x[2]=x[1]+(int)P3.xi();
     y[2]=y[1]-(int)P3.xj(); 

     teta1+=Math.PI/2;
     P4.polarGir(r,teta1);    
     x[3]=x[2]+(int)P4.xi();
     y[3]=y[2]-(int)P4.xj();   
    
x[4]=xi;
y[4]=yi;
g.drawPolygon(x,y,4);

   }

public static void filldikdortgen(Graphics g,int xi,int yi,int en,int boy,double aci )
{
   

   double R=boy;
   double r=en;

   polar P1=new polar();
   polar P2=new polar();
   polar P3=new polar();
   polar P4=new polar();   

   int x[]=new int[5];
   int y[]=new int[5];

   int k=0;

     x[0]=xi;
     y[0]=yi;
     
     double teta1=aci;   
     
     P2.polarGir(r,teta1);    
     x[1]=x[0]+(int)P2.xi();
     y[1]=y[0]-(int)P2.xj();

     teta1+=Math.PI/2;   
     P3.polarGir(R,teta1);    
     x[2]=x[1]+(int)P3.xi();
     y[2]=y[1]-(int)P3.xj(); 

     teta1+=Math.PI/2;
     P4.polarGir(r,teta1);    
     x[3]=x[2]+(int)P4.xi();
     y[3]=y[2]-(int)P4.xj();   
    
x[4]=xi;
y[4]=yi;
g.fillPolygon(x,y,4);

   }



} 




