-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBall.cpp
More file actions
92 lines (66 loc) · 1.49 KB
/
Ball.cpp
File metadata and controls
92 lines (66 loc) · 1.49 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
#include "Ball.hpp"
int Ball::f = 940;
int Ball::H_MIN = 0;
int Ball::H_MAX = 256;
int Ball::S_MIN = 0;
int Ball::S_MAX = 256;
int Ball::V_MIN = 0;
int Ball::V_MAX = 256;
Ball::Ball(string Color) {
try {
JSON_Worker::readHSV();
} catch (exception err) {
JSON_Worker::writeHSVFile();
}
};
int Ball::getXPos() {
return this->xPos;
}
void Ball::setXPos(int x) {
this->xPos = x;
}
void Ball::setXRealPos(int x) {
this->XRealPos = x;
};
int Ball::getYPos() {
return this->yPos;
}
void Ball::setYPos(int y) {
this->yPos = y;
};
void Ball::setYRealPos(int y) {
this->YRealPos = y;
};
int Ball::getZDiameter() {
return this->zDiameter;
};
void Ball::setZDiameter(int z) {
this->zDiameter = z;
};
void Ball::setZRealPos(int z) {
this->ZRealPos = z;
};
/// Нахождение реального X объекта
void Ball::calculateXRealPos(int Frame_Width, int Frame_Height) {
float Cu = Frame_Width/2;
this->XRealPos = ((xPos-Cu)/f)*ZRealPos;
};
/// Нахождение реального Y объекта
void Ball::calculateYRealPos(int Frame_Width, int Frame_Height) {
float Cv = Frame_Height/2;
this->YRealPos = ((yPos-Cv)/f)*ZRealPos;
};
/// Нахождение реального Z объекта
void Ball::calculateZRealPos() {
float Z = (1/(this->zDiameter))*(this->f)*(this->d);
this->ZRealPos = Z;
};
float Ball::getXRealPos() {
return this->XRealPos;
};
float Ball::getYRealPos() {
return this->YRealPos;
};
float Ball::getZRealPos() {
return this->ZRealPos;
};