Скачиваний:
52
Добавлен:
01.05.2014
Размер:
1.76 Кб
Скачать
#include<iostream.h>
#include<math.h>
#include<values.h>
#include<conio.h>

#include "Ellips.h"



//Konstruktor


Ellips::Ellips(double _X,double _Y,int _Lmax,int _Lmin,double _Angle)
	{if (_Lmax>0) {Lmax=_Lmax;}
		else {cout<<"Dlina doljna bit bolshe 0"<<endl;Lmax=1;}
	 if (_Lmin>0) {Lmin=_Lmin;}
		else {cout<<"Dlina doljna bit bolshe 0"<<endl;Lmin=1;}
	 X=_X;
	 Y=_Y;
	 Angle=_Angle;
	 }


//Selectori

double Ellips::getX() const
		{return X;}


double Ellips::getY() const
		{return Y;}

double Ellips::getLmax() const
		{return Lmax;}

double Ellips::getLmin() const
		{return Lmin;}

double Ellips::getAngle() const
		{return Angle;}

double Ellips::getArea() const
		{return 3.14*Lmax*Lmin;}

void Ellips::Print() const
		{cout<<endl<<"---Orbita Ellips------"<<endl;
		 cout<<"Nachalnie parametri: "<<endl;
		 cout<<"X:     "<<X<<endl;
		 cout<<"Y:     "<<Y<<endl;
		 cout<<"Lmax:  "<<Lmax<<endl;
		 cout<<"Lmin:  "<<Lmin<<endl;
		 cout<<"Ugol:  "<<Angle<<endl;
		 cout<<"Area:  "<<getArea()<<endl;
		 cout<<endl;
		 }


//Modifikatori


void Ellips::setLmax(double _Lmax)
		{if (_Lmax>0) {Lmax=_Lmax;}
			else {cout<<"Dlina doljna bit bolshe 0"<<endl;}
		}

void Ellips::setLmin(double _Lmin)
		{if (_Lmin>0) {Lmin=_Lmin;}
			else {cout<<"Dlina doljna bit bolshe 0"<<endl;}
		}

void Ellips::setAngle(double _Angle)
		{Angle=_Angle;}



void Ellips::Revol(double dFi)	 	//Povorot ot osi
		{Angle=Angle+dFi;}

void Ellips::Masht(double dN)		//Mashtabirovanie
		{if (dN>0)
			 {Lmax=Lmax*abs(dN);
			  Lmin=Lmin*abs(dN);}
		 else {cout<<"Dlina doljna bit bolshe 0"<<endl;}
		 }
void Ellips::Move(double dX,double dY)
		{X=X+dX;Y=Y+dY;}













Соседние файлы в папке Kurs3