home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / 3DANIM.ZIP / 3D.PAS next >
Encoding:
Pascal/Delphi Source File  |  1986-06-28  |  18.0 KB  |  613 lines

  1. PROGRAM THREE (input,output);
  2. {$c-}
  3. {r+}
  4. {$i-}
  5. {$u+}
  6.  
  7. CONST
  8.      gbase      =$b800;                       {graphics display}
  9.      pi         =0.0174533;                   {pi/180}
  10.      eyedis     =4;                          {distance of eye from screen}
  11.      objdis     =10;                          {distance of object from screen}
  12.      xsize      =15;
  13.      ysize      =15;                          {35}
  14.      maxpoint   =10;                          {max # of point for objects}
  15.      maxface    =20;                          {faces on an object}
  16.      maxgon     =15;                          {sides on a face}
  17.      xsi        =30;
  18.      ysi        =15;
  19.      digits : array [0..30] of string[2]  = ('0','1','2','3','4','5','6','7','8','9','10','11'
  20.                                              ,'12','13','14','15'
  21.                                              ,'16','17','18','19',
  22.                                               '20','21','22','23','24','25'
  23.                                               ,'26','27','28','29','30');
  24. TYPE
  25.     reg_pack  = record
  26.                 ax,bx,cx,dx,bp,si,di,ds,es,flags:integer;
  27.                 end;
  28.  
  29.     lettertype = array[0..3]    of byte;
  30.     letter     = array[1..2]    of lettertype;
  31.     scrfield   = array[0..8192] of byte;
  32.     scrtype    = array[1..2]    of scrfield;
  33.     line       = array[0..19]   of byte;      {20 letters/ a byte a letter}
  34.     menufield  = array[0..31]   of line;      {8 lines of letters * 8 /2fields}
  35.     menutype   = array[1..2]    of menufield;
  36.     gbuff      = array[0..16383] of byte;
  37.     matrixtype = array [1..4,1..4] of real;
  38.     matressa   = array[1..35]      of matrixtype;
  39.     currentype = array[1..5]       of integer;
  40.     planetype  = (xy , xz, yz, arb);
  41.     axistype   = (x , y , z , arbt);
  42.     actiontype = (scale,refle,rotet,trans,exodus);
  43.     point      = array [1..4]   of real;                 {x,y,z,1}
  44.     pntlst     = array [1..maxpoint] of point;         {all of obj. points}
  45.     pntptr     = ^point;
  46.     facetype   =
  47.                record
  48.                  face :array [0..maxgon] of pntptr;       {all of obj. faces}
  49.                  visib:boolean;
  50.                end;                                    {0 is the normal}
  51.     objectype  =
  52.                record
  53.                  pntlst: pntlst;
  54.                  pntno : integer;
  55.                  faceno: integer;
  56.                  side  : array [1..maxface] of facetype;
  57.                  center: array [x..z] of real;
  58.                end;
  59.    grami       = array [1..xsi]       of byte;
  60.    field       = array [1..ysi]       of grami;
  61.    frame       = array [1..2]         of field;
  62.  
  63. VAR
  64.    registers :reg_pack;
  65.    cache       : gbuff ;
  66.    outfile     : file of gbuff;
  67. {   mov         : array[1..10] of frame;}
  68.     scr1        : menutype;
  69. {   scrsave     : scrtype;}
  70.    display     : gbuff absolute gbase:$0000;
  71.    obj1        : objectype;
  72.    copy1       : objectype;
  73.    current     : currentype;
  74.    matr        : matressa;                    {array of trnsformations}
  75.    matrcnt     : integer;                     { # of transformations}
  76.    form        : matrixtype;                  {generic matrix of an operation}
  77.    i,j,k,m     : integer;
  78.    loop,ch     : char;
  79.    xtrack      : integer;
  80.    xline       : array[1..2,1..4] of real;      {small axis displayed}
  81.    yline       : array[1..2,1..4] of real;      {small axis displayed}
  82.    zline       : array[1..2,1..4] of real;      {small axis displayed}
  83.    zlet        : letter;                        {containing the letter's dots}
  84.    ylet,xlet   : letter;                        {containing the letter's dots}
  85.    fileno      :integer;
  86.    depth       :integer;
  87.    render   :boolean;
  88.  
  89. {$I matrix.pas}
  90. {$I matrix2.pas}
  91. {$i fill.pas}
  92. {$i ping.pong}
  93. { I screen.pas}
  94. { I axis.pas  }
  95. { I drawline.pas}
  96.  
  97.  
  98. procedure flood(x,y,color:integer);
  99. begin
  100.     if (call(true,3,x,y) = 0) and ((depth <2000)) then
  101.     begin
  102.        depth:=depth+1;
  103.        k:= call(false,color,x,y);
  104.        flood(x,y+1,color);
  105.        flood(x+1,y,color);
  106.        flood(x,y-1,color);
  107.        flood(x-1,y,color);
  108.        depth:=depth-1;
  109.     end;
  110. end;
  111.  
  112. procedure comein;
  113. var
  114.    i,j : integer;
  115.  
  116. begin
  117.     obj1.pntlst[1,1]:= -1;    obj1.pntlst[1,2]  := -1;   obj1.pntlst[1,3]:=  1;
  118.     obj1.pntlst[2,1]:=  1;    obj1.pntlst[2,2]  := -1;   obj1.pntlst[2,3]:=  1;
  119.     obj1.pntlst[3,1]:=  1;    obj1.pntlst[3,2]  :=  1;   obj1.pntlst[3,3]:=  1;
  120.     obj1.pntlst[4,1]:= -1;    obj1.pntlst[4,2]  :=  1;   obj1.pntlst[4,3]:=  1;
  121.     obj1.pntlst[5,1]:= -1;    obj1.pntlst[5,2]  :=  1;   obj1.pntlst[5,3]:= -1;
  122.     obj1.pntlst[6,1]:=  1;    obj1.pntlst[6,2]  :=  1;   obj1.pntlst[6,3]:= -1;
  123.     obj1.pntlst[7,1]:=  1;    obj1.pntlst[7,2]  := -1;   obj1.pntlst[7,3]:= -1;
  124.     obj1.pntlst[8,1]:= -1;    obj1.pntlst[8,2]  := -1;   obj1.pntlst[8,3]:= -1;
  125.  
  126.  
  127.     obj1.pntno     :=   8;
  128.     obj1.faceno    :=   6;
  129.     obj1.center[x] := 160;
  130.     obj1.center[y] := 100;
  131.     obj1.center[z] :=   0;
  132.  
  133. for i:= 1 to 6 do
  134.     for j:=0 to 4 do
  135.     begin
  136.         new(obj1.side[i].face[j]);
  137.         new(copy1.side[i].face[j]);
  138.     end;
  139.  
  140. move(obj1,copy1,sizeof(copy1));
  141.  
  142.     obj1.side[1].face[1]^:=obj1.pntlst[1];
  143.     obj1.side[1].face[2]^:=obj1.pntlst[2];
  144.     obj1.side[1].face[3]^:=obj1.pntlst[3];
  145.     obj1.side[1].face[4]^:=obj1.pntlst[4];
  146.  
  147.     obj1.side[2].face[1]^:=obj1.pntlst[2];
  148.     obj1.side[2].face[2]^:=obj1.pntlst[7];
  149.     obj1.side[2].face[3]^:=obj1.pntlst[6];
  150.     obj1.side[2].face[4]^:=obj1.pntlst[3];
  151.  
  152.     obj1.side[3].face[1]^:=obj1.pntlst[3];
  153.     obj1.side[3].face[2]^:=obj1.pntlst[6];
  154.     obj1.side[3].face[3]^:=obj1.pntlst[5];
  155.     obj1.side[3].face[4]^:=obj1.pntlst[4];
  156.  
  157.     obj1.side[4].face[1]^:=obj1.pntlst[1];
  158.     obj1.side[4].face[2]^:=obj1.pntlst[4];
  159.     obj1.side[4].face[3]^:=obj1.pntlst[5];
  160.     obj1.side[4].face[4]^:=obj1.pntlst[8];
  161.  
  162.     obj1.side[5].face[1]^:=obj1.pntlst[8];
  163.     obj1.side[5].face[2]^:=obj1.pntlst[5];
  164.     obj1.side[5].face[3]^:=obj1.pntlst[6];
  165.     obj1.side[5].face[4]^:=obj1.pntlst[7];
  166.  
  167.     obj1.side[6].face[1]^:=obj1.pntlst[1];
  168.     obj1.side[6].face[2]^:=obj1.pntlst[8];
  169.     obj1.side[6].face[3]^:=obj1.pntlst[7];
  170.     obj1.side[6].face[4]^:=obj1.pntlst[2];
  171.  
  172.     copy1.side[1].face[1]^:=copy1.pntlst[1];
  173.     copy1.side[1].face[2]^:=copy1.pntlst[2];
  174.     copy1.side[1].face[3]^:=copy1.pntlst[3];
  175.     copy1.side[1].face[4]^:=copy1.pntlst[4];
  176.  
  177.     copy1.side[2].face[1]^:=copy1.pntlst[2];
  178.     copy1.side[2].face[2]^:=copy1.pntlst[7];
  179.     copy1.side[2].face[3]^:=copy1.pntlst[6];
  180.     copy1.side[2].face[4]^:=copy1.pntlst[3];
  181.  
  182.     copy1.side[3].face[1]^:=copy1.pntlst[3];
  183.     copy1.side[3].face[2]^:=copy1.pntlst[6];
  184.     copy1.side[3].face[3]^:=copy1.pntlst[5];
  185.     copy1.side[3].face[4]^:=copy1.pntlst[4];
  186.  
  187.     copy1.side[4].face[1]^:=copy1.pntlst[1];
  188.     copy1.side[4].face[2]^:=copy1.pntlst[4];
  189.     copy1.side[4].face[3]^:=copy1.pntlst[5];
  190.     copy1.side[4].face[4]^:=copy1.pntlst[8];
  191.  
  192.     copy1.side[5].face[1]^:=copy1.pntlst[8];
  193.     copy1.side[5].face[2]^:=copy1.pntlst[5];
  194.     copy1.side[5].face[3]^:=copy1.pntlst[6];
  195.     copy1.side[5].face[4]^:=copy1.pntlst[7];
  196.  
  197.     copy1.side[6].face[1]^:=copy1.pntlst[1];
  198.     copy1.side[6].face[2]^:=copy1.pntlst[8];
  199.     copy1.side[6].face[3]^:=copy1.pntlst[7];
  200.     copy1.side[6].face[4]^:=copy1.pntlst[2];
  201.  
  202.  
  203.  
  204. {    data2[1,1]:= 0.5;    data2[1,2]  := 0;   data2[1,3]:=0.5;
  205.     data2[2,1]:= 0.5;    data2[2,2]  := 0;   data2[2,3]:=-0.5;
  206.     data2[3,1]:=-0.5;    data2[3,2]  := 0;   data2[3,3]:=-0.5;
  207.     data2[4,1]:=-0.5;    data2[4,2]  := 0;   data2[4,3]:=0.5;
  208.     data2[5,1]:= 0;      data2[5,2]  := 1;   data2[5,3]:=0;
  209.     data2[5,1]:= -1;     data2[5,2]  := -1;  data2[5,3]:=  1;
  210.     data2[6,1]:=  1;     data2[6,2]  :=  1;  data2[6,3]:= -1;
  211.     data2[6,1]:= 0;      data2[6,2]  :=-1;   data2[6,3]:=0;
  212.     octpoints   :=6;
  213.     octxpos     :=160;
  214.     octypos     :=100;
  215.     octvert     :=24;
  216.     octaux[1]:=1;       octaux[2]:=2;
  217.     octaux[3]:=2;       octaux[4]:=3;
  218.     octaux[5]:=3;       octaux[6]:=4;
  219.     octaux[7]:=4;       octaux[8]:=1;
  220.     octaux[9]:=1;       octaux[10]:=5;
  221.     octaux[11]:=2;      octaux[12]:=5;
  222.     octaux[13]:=3;      octaux[14]:=5;
  223.     octaux[15]:=4;      octaux[16]:=5;
  224.     octaux[17]:=1;      octaux[18]:=6;
  225.     octaux[19]:=2;      octaux[20]:=6;
  226.     octaux[21]:=3;      octaux[22]:=6;
  227.     octaux[23]:=4;      octaux[24]:=6;       }
  228.  
  229.     xline[1,1]:=0;    xline[1,2]:=0;    xline[1,3]:=0;  {endpoints for the axis}
  230.     xline[2,1]:=1;    xline[2,2]:=0;    xline[2,3]:=0;
  231.     yline[1,1]:=0;    yline[1,2]:=0;    yline[1,3]:=0;
  232.     yline[2,1]:=0;    yline[2,2]:=1;    yline[2,3]:=0;
  233.     zline[1,1]:=0;    zline[1,2]:=0;    zline[1,3]:=0;
  234.     zline[2,1]:=0;    zline[2,2]:=0;    zline[2,3]:=1;
  235.  
  236. end;    {of comein}
  237.  
  238.  
  239.  
  240. procedure plotit(obj : objectype; offset:integer);
  241. var
  242.    i,j      :integer;
  243.    temp     :facetype;
  244.    x1,x2    :real;
  245.    y1,y2    :real;
  246.    z1,z2    :real;
  247.    scrn     :real;       {uesed for perspective}
  248.    center   :array[x..y] of integer;
  249.    fillx    :integer;
  250.    filly    :integer;
  251.    t1,t2    :real;
  252.    color    :integer;
  253.  
  254. begin
  255. scrn   :=eyedis / objdis;
  256. for i:=1 to obj.faceno do
  257. begin
  258.     if obj.side[i].visib  then
  259.     begin
  260.         for j:= 1 to 4  do          {for the cube}
  261.         begin
  262.             x1:= obj.side[i].face[j]^[1];
  263.             y1:= obj.side[i].face[j]^[2];
  264.             if j <> 4 then
  265.             begin
  266.                x2:=obj.side[i].face[j+1]^[1];
  267.                y2:=obj.side[i].face[j+1]^[2];
  268.             end
  269.             else
  270.             begin
  271.                x2:=obj.side[i].face[1]^[1];
  272.                y2:=obj.side[i].face[1]^[2];
  273.             end;
  274.             x1:= x1 * xsize +obj. center[x];
  275.             x2:= x2 * xsize +obj. center[x];
  276.             y1:= y1 * ysize +obj. center[y];
  277.             y2:= y2 * ysize +obj. center[y];
  278.         draw(round(x1),round(y1),round(x2),round(y2),1);
  279.         end;
  280.         if render then
  281.         begin
  282.          if obj.side[i].face[3]^[1]   >  obj.side[i].face[1]^[1] then
  283.          t1:= abs (( obj.side[i].face[3]^[1])
  284.                   - (obj.side[i].face[1]^[1])) / 2
  285.                   + (obj.side[i].face[1]^[1])
  286.         else
  287.         t1:= abs ((obj.side[i].face[1]^[1])
  288.                 - (obj.side[i].face[3]^[1])) / 2
  289.                 + (obj.side[i].face[3]^[1]);
  290.  
  291.     if obj.side[i].face[3]^[2]   > obj.side[i].face[1]^[2]  then
  292.         t2:=   abs((obj.side[i].face[3]^[2])
  293.                   -(obj.side[i].face[1]^[2])) / 2
  294.                   +(obj.side[i].face[1]^[2])
  295.         else
  296.         t2:= abs ((obj.side[i].face[1]^[2])
  297.                 - (obj.side[i].face[3]^[2])) / 2
  298.                 + (obj.side[i].face[3]^[2]);
  299.  
  300.        fillx:=round(t1*xsize+obj.center[x]);
  301.        filly:=round(t2*ysize+obj.center[y]);
  302.        if odd(i) then color :=2
  303.        else           color :=3;
  304.        flood(fillx,filly,color);
  305.        end;   {of render}
  306.      end;
  307.   end;
  308. end;
  309.  
  310. procedure normal (var object:objectype;
  311.                   d :real;       {vewing parameters}
  312.                   theta:integer; fi:integer);
  313. var
  314. u,v,n    :point;
  315. i,j,k    :integer;
  316. temp     :facetype;
  317. t1,t2,t3 :point;
  318. sf,cf    :real;  {sin, cos of vewing parameters}
  319. st,ct    :real;
  320. lambda   :point;
  321. temp_L   :point;
  322. dotnl    :real;
  323.  
  324. begin
  325.      for i:= 0 to 4 do
  326.          new(temp.face[i]);
  327.      st :=sin(theta); ct:= cos(theta);
  328.      sf :=sin(fi);    cf:= cos(fi);
  329.      temp_L[1]:= d * sf * ct;
  330.      temp_L[2]:= d * sf * st;
  331.      temp_L[3]:= d * cf;
  332.  
  333.      for i:= 1 to object.faceno do                   {every face}
  334.      begin
  335.           move(object.side[i],temp,sizeof(object.side[i]));      { for clarity !!!}
  336.           move(temp.face[1]^,t1,sizeof(t1));            { counterclock point 1}
  337.           move(temp.face[2]^,t2,sizeof(t1));            { counterclock point 2}
  338.           move(temp.face[3]^,t3,sizeof(t1));            { counterclock point 3}
  339.  
  340.           for j:= 1 to 3 do                            {x,y,z}
  341.           begin
  342.               u[j]:= t2[j] - t1[j];
  343.               v[j]:= t3[j] - t1[j];
  344.           end;
  345.  
  346.           n[1]:= (u[2] * v[3]) - (u[3] * v[2]);         {cross product of u * v}
  347.           n[2]:= (u[3] * v[1]) - (u[1] * v[3]);
  348.           n[3]:= (u[1] * v[2]) - (u[2] * v[1]);
  349.           object.side[i].face[0]^:= n;                   {side[0] gets the normal}
  350.  
  351.      for k := 1 to 3 do
  352.      lambda [k] := temp_L[k] - temp.face[i]^[k];              {5.2 pg 187}
  353.  
  354.      dotnl := 0;                                        {dot product of n*l}
  355.      for k := 1 to 3 do
  356.      dotnl := dotnl + object.side[i].face[0]^[k] * lambda[k];
  357.      if dotnl > 0  then object.side[i].visib :=true
  358.      else               object.side[i].visib :=false;
  359.   end;
  360. end;
  361.  
  362.  
  363.  
  364. procedure erasescreen;
  365. begin
  366.      fillchar(display,16384,char(0));
  367. end;
  368.  
  369.  
  370. procedure eye(theta:integer; fee:integer);
  371. var
  372.    st,sf :real;
  373.    ct,cf :real;
  374.   te1,te2:real;
  375.  
  376. begin
  377.      init(form);
  378.      te1   := theta *pi;
  379.      te2   := fee   *pi;
  380.      ct    := cos  (te1);
  381.      cf    := cos  (te2);
  382.      st    := sin  (te1);
  383.      sf    := sin  (te2);
  384.            form[1,1] := -st;               {page 159 park}
  385.            form[1,2] := -ct * cf;
  386.            form[1,3] := -ct * sf;
  387.            form[2,1] :=  ct;
  388.            form[2,2] := -st * cf;
  389.            form[2,3] := -st * sf;
  390.            form[3,2] :=  sf;
  391.            form[3,3] := -cf;
  392.            form[4,3] := eyedis;
  393.     transfer(form,matr,matrcnt);
  394. end;
  395.  
  396.  
  397. procedure origin(object:objectype;axis:axistype; value :real);
  398. var
  399. i:integer;
  400.  
  401. begin
  402.      case axis of
  403.      x:object.center[x]:= object.center[x]+value;
  404.      y:object.center[y]:= object.center[y]+value;
  405.      z:object.center[z]:= object.center[z]+value;
  406.     end;
  407. end;
  408.  
  409.  
  410. procedure translate (axis : axistype;  value : real; copy :objectype);
  411.  
  412. begin
  413.     case axis of
  414. x : begin
  415.     for i:= 1 to copy.pntno do
  416.         copy.pntlst[i,1]:= copy.pntlst[i,1]+value;
  417.     end;
  418. y : begin
  419.     for i:= 1 to copy.pntno do
  420.         copy.pntlst[i,2]:= copy1.pntlst[i,2]+value;
  421.     end;
  422. z : begin
  423.     for i:= 1 to copy.pntno do
  424.         copy.pntlst[i,3]:= copy.pntlst[i,3]+value;
  425.     end;
  426.     end;
  427. end;
  428.  
  429.  
  430. procedure  rotate (axis : axistype; value:real);
  431. var
  432.    cv,sv:real;
  433.    i,j  :integer;
  434.    t1   :real;
  435. begin
  436.     t1    := value *pi;
  437.     cv    := cos (t1);
  438.     sv    := sin (t1);
  439.     init(form);
  440.     case axis of
  441. x : begin
  442.         form [2,2] := cv;
  443.         form [2,3] := sv;
  444.         form [3,2] := -sv;
  445.         form [3,3] := cv;
  446.     end;
  447. y : begin
  448.         form [1,1] := cv;
  449.         form [1,3] :=-sv;
  450.         form [3,1] := sv;
  451.         form [3,3] := cv;
  452.     end;
  453. z : begin
  454.         form [1,1] := cv;
  455.         form [1,2] := sv;
  456.         form [2,1] := -sv;
  457.         form [2,2] := cv;
  458.     end;
  459. end; {case}
  460. transfer(form,matr,matrcnt);
  461. end;                {of rotate}
  462.  
  463.  
  464. procedure arbit(head :real;
  465.                 bank :real; pitch :real);
  466.  
  467. var
  468.    ch,cb,cp :real;
  469.    sh,sb,sp :real;
  470.  
  471. begin
  472.      init(form);
  473.      head :=(head * pi);
  474.      bank :=(bank * pi);
  475.      pitch:=(pitch * pi);
  476.      ch:=cos(head);
  477.      cb:=cos(bank);
  478.      cp:=cos(pitch);
  479.      sh:=sin(head);
  480.      sb:=sin(bank);
  481.      sp:=sin(pitch);
  482. form[1,1]:=  (ch * cb) + (sh * sp * sb);
  483. form[1,2]:= -(ch * sb) + (sh * sp * cb);
  484. form[1,3]:=   sh * cp;
  485. form[2,1]:=   sb * cp;
  486. form[2,2]:=   cb * cp;
  487. form[2,3]:= -sp;
  488. form[3,1]:= -(sh * cb) - (ch * sp * sb);
  489. form[3,2]:=  (sb * sh) + (ch * sp * cb);
  490. form[3,3]:=   ch * cp;
  491. transfer(form,matr,matrcnt);
  492. end;
  493.  
  494. procedure reflection (plane :planetype);
  495.  
  496. begin
  497.     init(form);
  498.     case plane of
  499. xy : begin
  500.         form [1,1] := 1;
  501.         form [2,2] := 1;
  502.         form [3,3] := -1;
  503.         form [4,4] := 1;
  504.      end;
  505. yz : begin
  506.         form [1,1] :=-1;
  507.         form [2,2] := 1;
  508.         form [3,3] := 1;
  509.         form [4,4] := 1;
  510.      end;
  511. xz : begin
  512.          form [1,1] := 1;
  513.          form [2,2] :=-1;
  514.          form [3,3] := 1;
  515.          form [4,4] := 1;
  516.      end;
  517. end;  {case}
  518. transfer(form,matr,matrcnt);
  519. end;            {of reflect}
  520.  
  521.  
  522. procedure scaling (axis :axistype; value : real );
  523.  
  524. begin
  525.     init(form);
  526.     case axis of
  527. x : form [1,1] := value;
  528. y : form [2,2] := value;
  529. z : form [3,3] := value;
  530.     end;
  531. transfer(form,matr,matrcnt);
  532. end;          {of scaling}
  533.  
  534.  
  535. {procedure choose(copy:objectype);
  536.  
  537. var
  538.    temp  :  array[1..4] of real;
  539.    i,j,k :  integer;
  540.    count :  integer;
  541.    x1,x2 :  integer;
  542.    y1,y2 :  integer;
  543.    z1,z2 :  integer;
  544.  
  545. begin
  546.      for i:= 1 to 4 do
  547.      current[i] := i + 4;
  548.      current[5] := 5;
  549.  
  550. for count := 1 to 5 do
  551. begin
  552.      for i:= 1 to 4 do
  553.          temp[i] := 0;
  554.  
  555.      for j := 1 to 4 do
  556.      for k := 1 to 4 do
  557.      temp[j] := temp[j] + copy[current[count],k] * form[k,j];
  558.  
  559.      for i := 1 to 4 do
  560.          copy[current[count],i]:=temp[i];
  561. end;
  562.  
  563. for i:= 1 to 4 do
  564. begin
  565.      writeln(copy[current[i]  ,3]:2:2,'    ',copy[current[i+1],3]:2:2);
  566.      z1:=round(copy[current[i]  ,3]);
  567.      z2:=round(copy[current[i+1],3]);
  568.      x1:=round(copy[current[i]  ,1]*xsize+320);
  569.      x2:=round(copy[current[i+1],1]*xsize+320);
  570.      y1:=round(copy[current[i]  ,2]*ysize+100);
  571.      y2:=round(copy[current[i+1],2]*ysize+100);
  572.      draw(x1,y1,x2,y2,1);
  573. end;
  574. for i:= 1 to 4 do
  575. begin
  576.      hirescolor(0);
  577.      x1:=round(copy[current[i]  ,1]*xsize+320);
  578.      x2:=round(copy[current[i+1],1]*xsize+320);
  579.      y1:=round(copy[current[i]  ,2]*ysize+100);
  580.      y2:=round(copy[current[i+1],2]*ysize+100);
  581.      draw(x1,y1,x2,y2,0);
  582. end;
  583. hirescolor(9);
  584. end;}
  585.  
  586.  
  587.  
  588.  
  589. begin
  590.     fileno:=0;
  591.     matrcnt:=0;
  592.     graphcolormode;
  593.     fillchar(copy1,sizeof(copy1),char(0));
  594.     fillchar(obj1,sizeof(obj1),char(0));
  595.     fillchar(matr,sizeof(matr),char(0));
  596.      comein;
  597.      for k := 0 to 19 do
  598.      begin
  599. {             arbit(45,45,0);}
  600. {             eye(45,45);}
  601.              rotate(x,k/4);rotate(y,k/4);rotate(x,k/4);
  602.              mult(matrcnt,matr);
  603.              transform(copy1,obj1,matr[1]);
  604.              normal(copy1,4,0,0);
  605.              erasescreen;
  606.              render:=true;     {fill shapes}
  607.              plotit(copy1,0);
  608.              savescreen;
  609.  
  610.      end;
  611.      show(19);
  612. end.
  613.