public class Radiation_Shape2
{

	
{
//  h1 : height of radiation source
//  h2 : height of surfave reciving radiation
//  r  : distance between surfaces
int  total_ray=0;
int N=10000;
double teta1;
double teta2;
double tetamax=Math.PI/2;
double tetai=0;
double y=0;
for(int i=0;i<N;i++)
{
y=-h1/2+h1*Math.random();
teta1=Math.atan((h2/2-y)/r);
teta2=Math.atan((h2/2+y)/r);
for(int j=0;j<N;j++)
{tetai=Math.PI*(-1.0/2.0+Math.random()); 
if(tetai>=teta2 && tetai<=teta1) total_ray++;
}
}
return (double)total_ray/(double)(N*N); 
}
public static void main(String arg[])
{
double r=1;
double h1=1;
double h2=1;
System.out.println("F="+F(r,h1,h2));
}

}