%The dihedral geometry is faces A and B have dimnesions a and b,and the
%length perpendicular to the plane of the figure will be designated l.
%The angle between the two faces is 2*beta and the angle of arrival of an
%incident direction is phi.
a=12;
b=8;
beta=45;
alpha=pi-3*beta;
gamma=atan(b*sin(2*beta)./(a-b*cos(2*beta)));
if phi<=-alpha
a1=0;
else
if -alpha<=phi<=gamma-alpha
a1=a;
else
if phi>=gamma-alpha
a1=b*sin(beta-phi)./sin(3*beta-phi);
end
end
end
if phi<=gamma-beta
b1=a*sin(beta+phi)./sin(3*beta+phi);
else
if gamma-beta<=phi<=alpha
b1=b;
else
if phi<=alpha
b1=0;
end
end
end
%The variables type 1
k*a=45;
k*b=30;
R1=k*a;
R2=k*b;
R3=k*b1
R4=k*a1;
Q1=k*a*cos(beta+phi);
Q2=k*b*cos(beta-phi);
Q3=k*b1*cos(2*beta).*cos(beta+phi);
Q4=k*a1*cos(2*beta).*cos(beta-phi);