unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ComCtrls, ExtCtrls, Clipbrd, TeEngine, Series,
  TeeProcs, Chart, math;

type
  TForm1 = class(TForm)
    PageControl1: TPageControl;
    TabSheet1: TTabSheet;
    TabSheet2: TTabSheet;
    Label1: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Label5: TLabel;
    Label6: TLabel;
    Edit4: TEdit;
    Label7: TLabel;
    Edit5: TEdit;
    Label8: TLabel;
    Edit6: TEdit;
    Image1: TImage;
    Button1: TButton;
    Memo1: TMemo;
    TabSheet3: TTabSheet;
    Chart1: TChart;
    Series1: TLineSeries;
    Button2: TButton;
    Label9: TLabel;
    Edit7: TEdit;
    Edit8: TEdit;
    Edit9: TEdit;
    Edit10: TEdit;
    Edit11: TEdit;
    Edit12: TEdit;
    Edit13: TEdit;
    Label10: TLabel;
    Label11: TLabel;
    Label12: TLabel;
    Label13: TLabel;
    Label14: TLabel;
    Label15: TLabel;
    Label16: TLabel;
    Label17: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  x0,y0,x4,y4:extended;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
 var x1,x2,x3,y1,y2,y3:integer;
begin
with Image1.Canvas do
        begin
  Pen.Color:=clWhite;
  Brush.Color:=clWhite;
  Rectangle(0,0,500,500);
  Pen.Color:=clBlack;
  Brush.Color:=clBlue;
        end;


  x1:=StrToInt(Edit1.Text);
  x2:=StrToInt(Edit4.Text);
  x3:=StrToInt(Edit3.Text);
  y1:=StrToInt(Edit2.Text);
  y2:=StrToInt(Edit5.Text);
  y3:=StrToInt(Edit6.Text);

  if (x1<>x2) and (y1<>y2) then
  with image1.Canvas do
  begin
  moveto(x1,y1); lineto(x2,y1); lineto(x2,y2); lineto(x1,y2); lineto(x1,y1);
  if (x2<>x3) and (y1<>y3) then memo1.lines.add('koordinati tochhki '+inttostr(x2)+','+inttostr(y1))
                           else memo1.lines.add('koordinati tochhki '+inttostr(x1)+','+inttostr(y2));
  end;

  if (x1<>x3) and (y1<>y3) then
  with image1.Canvas do
  begin
  moveto(x1,y1); lineto(x3,y1); lineto(x3,y3); lineto(x1,y3); lineto(x1,y1);
  if (x2<>x3) and (y1<>y2) then memo1.lines.add('koordinati tochhki '+inttostr(x1)+','+inttostr(y3))
                           else memo1.lines.add('koordinati tochhki '+inttostr(x3)+','+inttostr(y1));
  end;

  if (x2<>x3) and (y2<>y3) then
  with image1.Canvas do
  begin
  moveto(x2,y2); lineto(x3,y2); lineto(x3,y3); lineto(x2,y3); lineto(x2,y2);
  if (x1<>x2) and (y1<>y3) then memo1.lines.add('koordinati tochhki '+inttostr(x2)+','+inttostr(y3))
                           else memo1.lines.add('koordinati tochhki '+inttostr(x3)+','+inttostr(y2));
  end;




end;


procedure TForm1.Button2Click(Sender: TObject);
 var xn,xk,xomin,xomax,yomin,yomax,h,x,y: extended;
     m,i: integer;
begin
 xn:=StrToFloat(Edit7.Text);
 xk:=StrToFloat(Edit8.Text);
 m:=StrToInt(Edit9.Text);
 xomin:=StrToFloat(Edit10.Text);
 xomax:=StrToFloat(Edit12.Text);
 yomin:=StrToFloat(Edit11.Text);
 yomax:=StrToFloat(Edit13.Text);
 with Chart1 do begin
  LeftAxis.Automatic:=False;
  LeftAxis.Minimum:=yomin;
  LeftAxis.Maximum:=yomax;
  BottomAxis.Automatic:=False;
  BottomAxis.Minimum:=xomin;
  BottomAxis.Maximum:=xomax;
  SeriesList[0].Clear;
  h:=(xk-xn)/(m-1); x:=xn;
  for i:=1 to m do begin
   y:=(sqr(x)/4+x/2+1)*exp(x/2);
   SeriesList[0].AddXY(x,y);
   x:=x+h;
  end;
 end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
 Memo1.Clear;
 Edit1.Text:='30';
 Edit2.Text:='100';
 Edit3.Text:='100';
 Edit4.Text:='100';
 Edit5.Text:='100';
 Edit6.Text:='70';
 Edit7.Text:='0,3';
 Edit8.Text:='1';
 Edit9.Text:='7';
 Edit10.Text:='0';
 Edit11.Text:='0';
 Edit12.Text:='1';
 Edit13.Text:='3';
end;

end.
