Добавил:
Studfiles2
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Лабораторная работа 3 / POINT
.CPP#include<iostream.h>
#include<conio.h>
#include<math.h>
#include<stdio.h>
#include<point.h>
//int Point::num=0;
Point::Point(){
x=0;
y=0;
//num++;
id=1;
}
Point::Point(double x0, double y0, int &id0){
x=x0;
y=y0;
id0++;
id=id0;
//num++;
//cout<<"Point "<<id<<" with coordinates X="<<x<<" Y="<<y<<" created"<<endl;
}
Point::~Point(){
//cout<<"Point "<<id<<" was destroyed"<<endl;
//num--;
}
inline void Point::SetXY(const double x0=0, const double y0=0){
x=x0;
y=y0;
}
inline void Point::GetXY(double & const x0, double & const y0){
x0=x;
y0=y;}
void Point::Rotate( const double x1, const double y1, const double alpha){
float tx, ty;
tx=x;
ty=y;
x=(tx-x1)*cos(alpha)-(ty-y1)*sin(alpha)+x1;
y=(ty-y1)*cos(alpha)+(tx-x1)*sin(alpha)+y1;
cout<<"Point "<<id<<" was rotated around point X="<<x1<<" Y="<<y1<<" New coordinates are X="<<x<<" Y="<<y<<endl;}
void Point::Move(const double x0, const double y0){
x=x+x0;
y=y+y0;
//cout<<"Point "<<id<<" was moved on dx="<<x0<<" dy="<<y0<<". New coordinates are X="<<x<<" Y="<<y<<endl;
}
void Point::print(){
//cout<<"Point "<<id<<" X="<<x<<" Y="<<y<<endl;
cout<<"X="<<x<<" Y="<<y<<endl;
}
Соседние файлы в папке Лабораторная работа 3