home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / CNC11TP.ZIP / BNCHELIP.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1989-01-19  |  2.1 KB  |  74 lines

  1. { Copyright (C) 1989 Adam Fritz, 133 Main St., Afton, N.Y. 13730 }
  2.  
  3. program BenchEllipse (output) ;
  4.  
  5.      { BnchElip - compare stroke ellipse and BGI ellipse   }
  6.      {            generation times                         }
  7.  
  8. uses GRAPH, DOS ;
  9.  
  10. {~~~~~~~~~~~~~~~~~~~~ ellipse routine ~~~~~~~~~~~~~~~~~~~~~}
  11.  
  12. {$I conic.pas }
  13.  
  14. {-$I elipda2.pas }
  15. {$I elipdaf.pas }
  16. {-$I elipdai.pas }
  17. {-$I elipdam.pas }
  18. {-$I elipmb.pas }
  19. {-$I elipmbr.pas }
  20. {-$I elipra.pas }
  21. {-$I elipra2.pas }
  22. {-$I elipraf.pas }
  23. {-$I elipraf2.pas }
  24. {-$I eliprai2.pas }
  25. {-$I elipram.pas }
  26.  
  27. {~~~~~~~~~~~~~~~~~~~~~ main program ~~~~~~~~~~~~~~~~~~~~~~~}
  28.  
  29. const
  30.    nEllipse = 100 ;
  31.  
  32. var
  33.    i : integer ;
  34.    xc,yc : integer ;
  35.    Hour,Min,Sec,CentiSec : array[0..2] of word ;
  36.    Time : array[0..2] of single ;
  37.    dTimeEllipse,dTimeStroke : single ;
  38.    grDetect,grMode : integer ;
  39.  
  40. begin
  41.    grDetect := Detect ;
  42.    InitGraph(grDetect,grMode,'') ;
  43.    xc := (GetMaxX + 1) shr 1 ;
  44.    yc := (GetMaxY + 1) shr 1 ;
  45.    Randomize ;
  46.    GetTime(Hour[0],Min[0],Sec[0],CentiSec[0]) ;
  47.                                 { TURBO Bresenham }
  48.    ClearDevice ;
  49.    for i := 1 to nEllipse do
  50.       Ellipse(Random(GetMaxX),Random(GetMaxY),0,360,
  51.                 Random(xc),Random(yc)) ;
  52.    GetTime(Hour[1],Min[1],Sec[1],CentiSec[1]) ;
  53.                                 { stroke ellipse }
  54.    ClearDevice ;
  55.    for i := 1 to nEllipse do
  56.       StrokeEllipse(Random(GetMaxX),Random(GetMaxY),
  57.                       Random(xc),Random(yc),Pi*Random) ;
  58.    GetTime(Hour[2],Min[2],Sec[2],CentiSec[2]) ;
  59.    CloseGraph ;
  60.                                 { convert times to seconds }
  61.    for i := 0 to 2 do
  62.       Time[i] := (Hour[i] * 60.0 + Min[i]) * 60.0 +
  63.                      Sec[i] + CentiSec[i]/100.0 ;
  64.                                 { compute average drawing times }
  65.    dTimeEllipse := (Time[1] - Time[0])/nEllipse ;
  66.    dTimeStroke := (Time[2] - Time[1])/nEllipse ;
  67.  
  68.    writeln (output,'Ellipse: ',dTimeEllipse:8:5,'   ',
  69.                    'Stroke: ',dTimeStroke:8:5)
  70.  
  71. end.
  72.  
  73. { Copyright (C) 1989 Adam Fritz, 133 Main St., Afton, N.Y. 13730 }
  74.