home *** CD-ROM | disk | FTP | other *** search
- (*-------------------------------------------------------------------------*)
- (* CIRCINK.PAS *)
- (* Inkrementeller Kreisalgorithmus fuer die Graphikserie *)
- (*-------------------------------------------------------------------------*)
-
- PROCEDURE do_circle (x_center, y_center, radius: INTEGER);
-
- CONST Pi = 3.1415926;
-
- VAR dtheta, (* Winkel-Schrittweite *)
- cosinus_dtheta, (* Cosinus der Winkel-Schrittweite *)
- sinus_dtheta, (* Sinus der Winkel-Schrittweite *)
- x, y, (* Berechnete Koordinaten *)
- x_alt, (* x-Wert des vorherigen Punkts *)
- y_ende : REAL; (* y-Wert Endkoord. Achtel-Kreis *)
-
- xi, yi, (* Auf Integer gerundete Koord. *)
- AspRX, (* round(Aspect_Ratio*x) *)
- AspRY : INTEGER; (* round(Aspect_Ratio*y) *)
-
- BEGIN (* Initialisierung *)
- dtheta := 1.0 / radius;
- cosinus_dtheta := Cos(dtheta);
- sinus_dtheta := Sin(dtheta);
- x := 0; (* Koordianten-Initialisierung *)
- y := radius;
- y_ende := Sin(Pi/4) * radius;
- WHILE y >= y_ende DO
- BEGIN (* Punkte symmetrisch plotten *)
- AspRX := Round(Aspect_Ratio*x);
- AspRY := Round(Aspect_Ratio*y);
- xi := Round(x);
- yi := Round(y);
- Point_System(x_center + xi, y_center + AspRY);
- Point_System(x_center - xi, y_center + AspRY);
- Point_System(x_center + xi, y_center - AspRY);
- Point_System(x_center - xi, y_center - AspRY);
- Point_System(x_center + yi, y_center + AspRX);
- Point_System(x_center - yi, y_center + AspRX);
- Point_System(x_center + yi, y_center - AspRX);
- Point_System(x_center - yi, y_center - AspRX);
- x_alt := x; (* Neue x- und y-Werte berechnen *)
- x := (x*cosinus_dtheta - y*sinus_dtheta);
- y := (y*cosinus_dtheta + x_alt*sinus_dtheta);
- END;
- END;
-
- (*-------------------------------------------------------------------------*)
- (* Ende von CIRCINK.PAS *)