home *** CD-ROM | disk | FTP | other *** search
/ Turbo Toolbox / Turbo_Toolbox.iso / 1990 / 09 / tricks / circle.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1990-06-15  |  1.0 KB  |  33 lines

  1. (* ------------------------------------------------------ *)
  2. (*                       CIRCLE.PAS                       *)
  3. (*     Kreisalgorithmus zur MCGA-Unit aus toolbox 10'89   *)
  4. (*              (c) 1990 Philipps & TOOLBOX               *)
  5. (* ------------------------------------------------------ *)
  6.  
  7. PROCEDURE Circle(xmitte, ymitte, radius, farbe: INTEGER);
  8. VAR
  9.   x, y, md,
  10.   od, sd   : INTEGER;
  11.  
  12. BEGIN
  13.   y := 0; x := radius; md := 0;
  14.   REPEAT
  15.      Plot(xmitte + x, ymitte + y, farbe);
  16.      Plot(xmitte - x, ymitte + y, farbe);
  17.      Plot(xmitte - x, ymitte - y, farbe);
  18.      Plot(xmitte + x, ymitte - y, farbe);
  19.      Plot(xmitte + y, ymitte + x, farbe);
  20.      Plot(xmitte - y, ymitte + x, farbe);
  21.      Plot(xmitte - y, ymitte - x, farbe);
  22.      Plot(xmitte + y, ymitte - x, farbe);
  23.   od := md + y + y + 1;  {  Distanz bei Schritt nach oben  }
  24.   sd := od - x - x + 1;      {  Distanz bei Schrägschritt  }
  25.   y := y + 1; md := od;
  26.   IF Abs(sd) < Abs(od) THEN
  27.   BEGIN
  28.     Dec(x);
  29.     md := sd;
  30.   END
  31.   UNTIL x < y;
  32. END;
  33.