Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

LAB1_B5 / Unit1

.h
Скачиваний:
7
Добавлен:
01.02.2019
Размер:
3.58 Кб
Скачать
//---------------------------------------------------------------------------

#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>
#include <Vcl.ExtCtrls.hpp>
#include <Vcl.ComCtrls.hpp>
class point {
public:
	double x, y;
	double realX, realY;
	TColor color;
	point() {}
	point(double _x, double _y);
	void Scale(double pX, double pY, double sX, double sY);
	void mirrorOX();
	void mirrorOY();
	void rotate(double pX, double pY, double a);
};

class vector {
public:
	double x, y;
	vector() {}
	vector(double _x, double _y);
	double operator * (vector vec) const;
	double length();
};

class line {
public:
	point start, end;
	vector dir;
	line() {}
	line(point _start, point _end);
	void GetDir();
	void Set(point _start, point _end);
	double GetCos(line l);
};

class tetragon {
public:
	point top[4];
	line edges[4];
	int8_t isCreate;
	uint8_t stepCreate;
	tetragon();
	void Scale(double pX, double pY, double sX, double sY);
    void Recalc();
	void Create();
	void Reset();
	bool Check();
	void mirrorOX();
	void mirrorOY();
	void rotate(double pX, double pY, double a);
};

class matrix {
public:
	int m, n;
	double ** array;
	matrix(int _m, int _n);
	matrix operator * (matrix right);

};
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:	// IDE-managed Components
	TImage *Image1;
	TButton *Start;
	TButton *Reset;
	TButton *MirrorOX;
	TButton *Rotate;
	TButton *MirrorOY;
	TButton *CreatePoints;
	TButton *Scale;
	TEdit *Edit1;
	TEdit *Edit2;
	TTimer *Timer;
	TEdit *Edit3;
	TLabel *Label1;
	TLabel *Label2;
	TEdit *Edit4;
	TEdit *Edit5;
	TLabel *Label3;
	TLabel *Label4;
	void __fastcall Image1MouseMove(TObject *Sender, TShiftState Shift, int X, int Y);
	void __fastcall Image1Repaint();
	void __fastcall StartClick(TObject *Sender);
	void __fastcall Image1MouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift,
          int X, int Y);
	void __fastcall Image1MouseEnter(TObject *Sender);
	void __fastcall Image1MouseLeave(TObject *Sender);
	void __fastcall ResetClick(TObject *Sender);
	void __fastcall MirrorOXClick(TObject *Sender);
	void __fastcall RotateClick(TObject *Sender);
	void __fastcall MirrorOYClick(TObject *Sender);
	void __fastcall CreatePointsClick(TObject *Sender);
	void __fastcall ScaleClick(TObject *Sender);
	void __fastcall TimerTimer(TObject *Sender);
	void __fastcall Edit1KeyPress(TObject *Sender, System::WideChar &Key);
	void __fastcall Edit2KeyPress(TObject *Sender, System::WideChar &Key);
	void __fastcall Edit3KeyPress(TObject *Sender, System::WideChar &Key);
	void __fastcall Edit4KeyPress(TObject *Sender, System::WideChar &Key);
	void __fastcall Edit5KeyPress(TObject *Sender, System::WideChar &Key);
private:	// User declarations
public:		// User declarations
	__fastcall TForm1(TComponent* Owner);
	void DrawLine(line _line);
	void DrawTop(point _top);
	void InitAxes();
	void DrawAxes();
	tetragon t;
	line AxisX, AxisY;
	point centre;
	point * rPoints;
	bool rPointsIsCreate;
	void RandomPoints();
	void CheckPoints();
    bool ScaleOn, RotateOn;

};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------

#endif
Соседние файлы в папке LAB1_B5