Добавил:
korayakov
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Лабы / С++Builder / Laba4 / compl
.cpp//---------------------------------------------------------------------------
#pragma hdrstop
#include "math.h"
#include "compl.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
void Draw(TImage* Img,double x, double y, bool h, bool vis)
{
Img->Canvas->Pen->Width=2;
if (vis) Img->Canvas->Pen->Color=clRed; else Img->Canvas->Pen->Color=clWhite;
if (vis) {if (h) Img->Canvas->Pen->Color=clYellow; else Img->Canvas->Pen->Color=clRed;};
Img->Canvas->MoveTo(Img->Height/2,Img->Width/2);
Img->Canvas->LineTo(Img->Height/2+x,Img->Width/2-y);
}
Compl::ReDraw(bool vis)
{
Draw(Img,x,y,issel,vis);
}
Compl::Mark(bool h)
{
issel=!issel;
Draw(Img,x,y,issel,true);
}
Compl::Compl(double r, double angle, TImage* _Img)
{
issel=false;
Img=_Img;
x=r*cos(angle);
y=r*sin(angle);
Draw(Img,x,y,false,true);
}
Compl::Compl(EPoint begin, EPoint end, TImage* _Img)
{
issel=false;
Img=_Img;
x=end.x-begin.x;
y=end.y-begin.y;
Draw(Img,x,y,false,true);
}
Compl::Compl(const Compl &source, TImage* _Img)
{
issel=false;
Img=_Img;
x=source.x;
y=source.y;
Draw(Img,x,y,false,true);
}
Compl::~Compl()
{
Draw(Img,x,y,0,0);
}
Compl::rotate(double angle)
{
Draw(Img,x,y,0,0);
double _x=x*cos(angle)-y*sin(angle);
double _y=x*sin(angle)+y*cos(angle);
x=_x;
y=_y;
ReDraw();
}
double getangle(Compl n1,Compl n2)
{
return 0;
}