Darkrai1337

Untitled

Dec 23rd, 2021
1,756
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 2.62 KB | None | 0 0
  1. unit Unit1;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  7.   Dialogs, StdCtrls, TeEngine, Series, ExtCtrls, TeeProcs, Chart;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     Chart1: TChart;
  12.     RadioButton1: TRadioButton;
  13.     RadioButton2: TRadioButton;
  14.     RadioButton3: TRadioButton;
  15.     RadioButton4: TRadioButton;
  16.     Label1: TLabel;
  17.     Label2: TLabel;
  18.     Edit1: TEdit;
  19.     Edit2: TEdit;
  20.     Button1: TButton;
  21.     Label3: TLabel;
  22.     Edit3: TEdit;
  23.     Series1: TPointSeries;
  24.     procedure Button1Click(Sender: TObject);
  25.   private
  26.     { Private declarations }
  27.   public
  28.     { Public declarations }
  29.   end;
  30.  
  31. var
  32.   Form1: TForm1;
  33.  
  34. implementation
  35.  
  36. {$R *.dfm}
  37.  
  38.  
  39. procedure TForm1.Button1Click(Sender: TObject);
  40. var a,b,x,y,p,f,R,temp:double;
  41. begin
  42.   Chart1.BottomAxis.Automatic := true;
  43.   Chart1.LeftAxis.Automatic := true;
  44.   Series1.Clear;
  45.   a:= StrToFloat(Edit1.Text);
  46.   b:= StrToFloat(Edit2.Text);
  47.  
  48.   if RadioButton1.Checked then
  49.     begin
  50.       R:= StrToFloat(Edit3.Text);
  51.       x:= -100;
  52.       while x < 100 do
  53.         begin
  54.           x:=x+0.02;
  55.           temp:=sqr(R)-sqr((x-a));
  56.           if temp>=0 then
  57.             begin
  58.             y:= b - sqrt(temp);
  59.             Series1.AddXY(x,y);
  60.             y:= b + sqrt(temp);
  61.             Series1.AddXY(x,y);
  62.             end;
  63.         end;
  64.  
  65.  
  66.       Chart1.SaveToBitmapFile('first.bmp');
  67.     end;
  68.  
  69.   if RadioButton2.Checked then
  70.     begin
  71.       Chart1.LeftAxis.SetMinMax(-abs(int(2*a*b)),abs(int(2*a*b)));
  72.       f:= -pi;
  73.       while f < pi do
  74.         begin
  75.           f:=f+0.01;
  76.           temp:= cos(f);
  77.           if temp <>0 then
  78.             begin
  79.             p:=a*(b*temp+1/temp);
  80.             x:=p*cos(f);
  81.             y:=p*sin(f);
  82.             Series1.AddXY(x,y);
  83.             end;
  84.  
  85.         end;
  86.  
  87.       Chart1.SaveToBitmapFile('second.bmp');
  88.     end;
  89.  
  90.   if RadioButton3.Checked then
  91.     begin
  92.       f:= -50;
  93.       while f < 50 do
  94.         begin
  95.           f:=f+0.02;
  96.           x:=(a+b)*sin(f)-b*sin((a/b+1)*f);
  97.           y:=(a+b)*cos(f)-b*cos((a/b+1)*f);
  98.           Series1.AddXY(x,y);
  99.         end;
  100.  
  101.  
  102.       Chart1.SaveToBitmapFile('third.bmp');
  103.     end;
  104.  
  105.   if RadioButton4.Checked then
  106.     begin
  107.       x:= -1;
  108.       while x < 1 do
  109.         begin
  110.           x:=x+0.001;
  111.           temp:=  1-sqr(x);
  112.           if temp>=0 then
  113.             begin
  114.             y:= sqrt(abs(x))+sqrt(temp);
  115.             Series1.AddXY(x,y);
  116.             y:= sqrt(abs(x))- sqrt(temp);
  117.             Series1.AddXY(x,y);
  118.             end;
  119.         end;
  120.  
  121.       Chart1.SaveToBitmapFile('four.bmp');
  122.     end;
  123. end;
  124.  
  125.  
  126. end.
  127.  
Advertisement
Add Comment
Please, Sign In to add comment