Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit Unit1;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, StdCtrls, TeEngine, Series, ExtCtrls, TeeProcs, Chart;
- type
- TForm1 = class(TForm)
- Chart1: TChart;
- RadioButton1: TRadioButton;
- RadioButton2: TRadioButton;
- RadioButton3: TRadioButton;
- RadioButton4: TRadioButton;
- Label1: TLabel;
- Label2: TLabel;
- Edit1: TEdit;
- Edit2: TEdit;
- Button1: TButton;
- Label3: TLabel;
- Edit3: TEdit;
- Series1: TPointSeries;
- procedure Button1Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- Form1: TForm1;
- implementation
- {$R *.dfm}
- procedure TForm1.Button1Click(Sender: TObject);
- var a,b,x,y,p,f,R,temp:double;
- begin
- Chart1.BottomAxis.Automatic := true;
- Chart1.LeftAxis.Automatic := true;
- Series1.Clear;
- a:= StrToFloat(Edit1.Text);
- b:= StrToFloat(Edit2.Text);
- if RadioButton1.Checked then
- begin
- R:= StrToFloat(Edit3.Text);
- x:= -100;
- while x < 100 do
- begin
- x:=x+0.02;
- temp:=sqr(R)-sqr((x-a));
- if temp>=0 then
- begin
- y:= b - sqrt(temp);
- Series1.AddXY(x,y);
- y:= b + sqrt(temp);
- Series1.AddXY(x,y);
- end;
- end;
- Chart1.SaveToBitmapFile('first.bmp');
- end;
- if RadioButton2.Checked then
- begin
- Chart1.LeftAxis.SetMinMax(-abs(int(2*a*b)),abs(int(2*a*b)));
- f:= -pi;
- while f < pi do
- begin
- f:=f+0.01;
- temp:= cos(f);
- if temp <>0 then
- begin
- p:=a*(b*temp+1/temp);
- x:=p*cos(f);
- y:=p*sin(f);
- Series1.AddXY(x,y);
- end;
- end;
- Chart1.SaveToBitmapFile('second.bmp');
- end;
- if RadioButton3.Checked then
- begin
- f:= -50;
- while f < 50 do
- begin
- f:=f+0.02;
- x:=(a+b)*sin(f)-b*sin((a/b+1)*f);
- y:=(a+b)*cos(f)-b*cos((a/b+1)*f);
- Series1.AddXY(x,y);
- end;
- Chart1.SaveToBitmapFile('third.bmp');
- end;
- if RadioButton4.Checked then
- begin
- x:= -1;
- while x < 1 do
- begin
- x:=x+0.001;
- temp:= 1-sqr(x);
- if temp>=0 then
- begin
- y:= sqrt(abs(x))+sqrt(temp);
- Series1.AddXY(x,y);
- y:= sqrt(abs(x))- sqrt(temp);
- Series1.AddXY(x,y);
- end;
- end;
- Chart1.SaveToBitmapFile('four.bmp');
- end;
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment