Delphining grafik imkoniyatlari


-listing. Funksiya grafigi


Download 0.58 Mb.
bet11/29
Sana09.03.2023
Hajmi0.58 Mb.
#1254496
1   ...   7   8   9   10   11   12   13   14   ...   29
Bog'liq
delphi uzb графика

10.5-listing. Funksiya grafigi
unit grfunc_;
interface
Windows, Messages, SysUtils, Classes,
Graphics, Controls, Forms, Dialogs;
type
TForm1 = class(TForm)
procedure FormPaint(Sender: TObject);
procedure FormResize(Sender: TObject);
private
{ Private declarations }
public
{Public declarations }
end;
var
Forml: TForml;
implementation
{$R *.DFM}
// Grafigi qurilishi kerak bo’lgan funksiya
Function f(x:real):real;
begin
f:=2*Sin(x)*exp(x/5) ;
end;
// funksiya grafigini qurish
procedure GrOfFunc;
var
x1,x2:real; // funksiya argumentini o’zgarish oralig’i
y1,y2:real; // funksiya qiymatini o’zgarish oralig’i
х:real; // funksiya argumenti
у:real; // funksiyaning x nuqtadagi qiymati
dx:real; // argumentni o’sish qadami
l,b:integer; // grafika chiquvchi sohaning chap-quyi burchagi
w,h:integer; // chiquvchi grafikaning kengligi va balandligi
mx,my:real; // X va Y o’qlar bo’yicha mas’shtab
х0,у0:integer; // koordinata boshi nuqtasi
begin
// grafika chiquvchi soha
l:=10; // X — chap-yuqori burchak koordinatasi
b:=Forml.ClientHeight-20;
//У — chap-yuqori burchak koordinatasi
h:=Forml.ClientHeight-40; // balandligi
w:=Forml.Width-40; // kengligi
x1:=0; // argumentning quyi chegarasi
х2:=25; // argumentning yuqori chegarasi
dx:=0.01; // argument qadami
// funksiyaning [x1,x2] kesmadagi eng katta va eng kichik
//qiymatlarni topamiz
y1:=f(xl); // minimum
y2:=f(xl); //maksimum
x:=x1;
repeat
У := f (х);
if у < yl then yl:=y;
if у > у2 then y2:=y;
х:=x+dx; until (x >= х2);
// mas’shtabni hisoblash
my:=h/abs(y2-yl); // Y o’q bo’yicha mas’shtab
mx:=w/abs(x2-xl); // X o’q bo’yicha mas’shtab
х0:=1;
у0:=b-Abs(Round(y1*my)) ;

Download 0.58 Mb.

Do'stlaringiz bilan baham:
1   ...   7   8   9   10   11   12   13   14   ...   29




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling