home *** CD-ROM | disk | FTP | other *** search
- {---------------------------------------------------------------------------}
- PROGRAM Funktionsplotter;
-
- TYPE str100 = STRING[100];
- Str = STRING[255];
-
- VAR q2 : Str;
- xmin, ymin, xmax, ymax, { Grenzen der Funktion }
- xax, yax, xsc, ysc : REAL; { Achsen und Skalierung }
- xp, yp : INTEGER; { Bildschirmkoordinaten }
- s : INTEGER; { Anzahl Stuetzstellen }
-
- {$I draw.inc}
- {$I fkplot2.pas}
- {$I fkplot3.pas}
- {$I fkplot1.pas}
- {$I fkplot4.pas}
-
- {---------------------------------------------------------------------------}
-
- PROCEDURE DrawAxis;
-
- VAR x, y, dist: REAL;
- xaxp, yaxp: INTEGER;
-
- BEGIN
- WorldToScreen(xax, yax, xaxp, yaxp);
- Draw(ScreenLeft, yaxp, ScreenXMax, yaxp);
- Draw(xaxp, ScreenBott, xaxp, ScreenYMax);
-
- dist := xsc*(ScreenXmax-ScreenLeft)/(xmax-xmin); { Skalierung vornehmen }
- x := ScreenLeft; y := yaxp;
- REPEAT
- Draw(Round(x), Round(y-Unit), Round(x), Round(y+Unit));
- x := x+dist;
- UNTIL x > ScreenXMax;
- dist := ysc*(ScreenYMax-ScreenBott)/(ymax-ymin);
- y := ScreenBott; x := xaxp;
- REPEAT
- Draw(Round(x-Unit), Round(y), Round(x+Unit), Round(y));
- y := y+dist;
- UNTIL y > ScreenYMax;
- END;
-
- {---------------------------------------------------------------------------}
-
- PROCEDURE PlotFunction;
-
- VAR x, y1, y2, d: REAL;
-
- BEGIN
- x := xmin;
- d := (xmax-xmin)/s;
- WHILE x+d <= xmax DO
- BEGIN
- y1 := Berechnung(q2, x);
- y2 := Berechnung(q2, x+d);
- DrawLine(x, y1, x+d, y2);
- x := x+d;
- END;
- END;
-
- {---------------------------------------------------------------------------}
-
- BEGIN
- Eingabe;
- InitGraphic; { Graphik-Modus aktivieren }
- DrawAxis; { Achsenkreuz zeichnen }
- PlotFunction; { Funktion zeichnen }
- REPEAT UNTIL KeyPressed; { auf Tastendruck warten }
- LeaveGraphic;
- END.