program suprafp;
uses graph,utilg,fstand,crt;
var i,j:integer;
    a,b,c,d,s,t,mins,mint,maxs,maxt,r1,r2,alfa,beta,gama:real;
    xe,ye:array[1..50,1..50] of real;
const nrs=50;
      nrt=50;
      aa=-90;
      bb=90;
begin
a:=rad(trunc(aa));
b:=rad(trunc(bb));
c:=0;
d:=2*pi;
alfa:=rad(210);
beta:=rad(-30);
gama:=rad(90);
s:=a;
for i:=1 to nrs do
  begin
    t:=c;
    for j:=1 to nrt do
      begin
        d3d2g(alfa,beta,gama,f(s,t),g(s,t),h(s,t),xe[i,j],ye[i,j]);
        t:=t+(d-c)/(nrt-1);
      end;
    s:=s+(b-a)/(nrs-1);
  end;
mins:=xe[1,1];
maxs:=xe[1,1];
mint:=ye[1,1];
maxt:=ye[1,1];
for i:=1 to nrs do
  for j:=1 to nrt do
    begin
      if xe[i,j]<mins then mins:=xe[i,j];
      if xe[i,j]>maxs then maxs:=xe[i,j];
      if ye[i,j]<mint then mint:=ye[i,j];
      if ye[i,j]>maxt then maxt:=ye[i,j];
    end;
initg;
setrgbpalette(0,63,63,63);
setcolor(1);
setrgbpalette(1,0,0,0);
r1:=(maxs-mins)/getmaxy;
r2:=(maxt-mint)/getmaxy;
for i:=1 to nrs do
  for j:=1 to nrt do
    begin
      xe[i,j]:=(xe[i,j]-mins)/r1;
      ye[i,j]:=getmaxy-(ye[i,j]-mint)/r2;
    end;
for i:=1 to nrs do
  begin
    moveto(round(xe[i,1]),round(ye[i,1]));
    for j:=2 to nrt do lineto(round(xe[i,j]),round(ye[i,j]));
  end;
for j:=1 to nrt do
  begin
    moveto(round(xe[1,j]),round(ye[1,j]));
    for i:=2 to nrs do lineto(round(xe[i,j]),round(ye[i,j]));
  end;
repeat until keypressed;
closegraph;
end.