-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoop_task2.cpp
More file actions
94 lines (72 loc) · 1.29 KB
/
oop_task2.cpp
File metadata and controls
94 lines (72 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#include <iostream>
#include <vector>
#include <cmath>
#define D 0.05
#define PT Point
using namespace std;
class Point {
public:
double x,y;
double altituge;
Point (double nx, double ny, double altg) {
x = nx;
y = ny;
altituge = altg;
}
double getLength () {
return sqrt(x*x + y*y + altituge*altituge);
}
};
class Plan {
private:
int a;
bool avalibale;
vector <Point> way;
Point getPoint(int i) {
return way[i];
}
double getAltituge(int i){
return way[i].altituge;
}
double getSpeed (int i){
if (i==0) return 0;
else
return getPoint(i).getLength() - getPoint(i-1).getLength();
}
double getSpeedUp (int i){
if (i<=1) return 0;
else
return getSpeed(i) - getSpeed(i-1);
}
public:
Plan (vector <Point> w){
way = w;
avalibale = true;
a = 0;
}
Point getPlace(){
a++;
if (a < way.size())
return way[a];
else return Point(0, 0, 0);
}
void kill (double nx, double ny, double naltituge){
double x = getPoint(a).x;
double y = getPoint(a).y;
double altituge = getPoint(a).altituge;
if (
(abs(nx - x) < D)
&& (abs(ny - y) < D)
&& (abs(naltituge - altituge < D))
) avalibale = false;
}
bool isAvalibale (){
return avalibale;
}
};
int main(){
vector <Point> p;
p.push_back(PT(0,100,4));
Plan a = Plan (p);
return 0;
}