unit USpace;
interface
uses crt,graph,dos;
var h,i,j:longint;mx,my,ex,ey:integer;Page:boolean;
procedure init;
procedure ChangePage;
function r(g:real):real;
function g(r:real):real;
procedure RotAx(o:char;u:integer;x,y,z:longint;var ox,oy,oz:longint);
procedure RotSp(a,b,c:integer;x,y,z:longint;var ox,oy,oz:longint);
implementation
var cuv:string;
 procedure init;
begin
SetSVGAMode(640, 480, 8, LfbOrBanked);
  OutTextXY(270, 230, 'Please wait...');
drawborder:=false;
mx:=getmaxx+1;my:=getmaxy+1;
ex:=mx div 2;ey:=my div 2;
end;
 procedure ChangePage;
begin
  if Page then begin
    SetActivePage(0);SetVisualPage(1,true);
    Page:=false;
  end else begin
    SetActivePage(1);SetVisualPage(0,true);
    Page:=true;
  end;
  ClearPage;
end;
 function r(g:real):real;
begin
r:=g*pi/180;
end;
 function g(r:real):real;
begin
g:=r*180/pi;
end;
 procedure RotAx(o:char;u:integer;x,y,z:longint;var ox,oy,oz:longint);
var cx,cy,cz:longint;rad:real;
 begin
rad:=r(u);cx:=x;cy:=y;cz:=z;
   case o of 'x':begin
oy:=round(cy*cos(rad)-cz*sin(rad));
oz:=round(cz*cos(rad)+cy*sin(rad));
ox:=cx;end;   'y':begin
oz:=round(cz*cos(rad)-cx*sin(rad));
ox:=round(cx*cos(rad)+cz*sin(rad));
oy:=cy;end;   'z':begin
ox:=round(cx*cos(rad)-cy*sin(rad));
oy:=round(cy*cos(rad)+cx*sin(rad));
oz:=cz;end;
   end;
 end;
 procedure RotSp(a,b,c:integer;x,y,z:longint;var ox,oy,oz:longint);
 begin
RotAx('z',c,x,y,z,ox,oy,oz);
RotAx('y',b,ox,oy,z,ox,oy,oz);
RotAx('x',a,ox,oy,oz,ox,oy,oz);
 end;
Begin
page:=true;
End.