-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathball_sample.cpp
More file actions
43 lines (38 loc) · 761 Bytes
/
ball_sample.cpp
File metadata and controls
43 lines (38 loc) · 761 Bytes
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
#include "ball_sample.hpp"
#include "utils.hpp"
ball_sample::ball_sample()
: area(0.0)
{
}
ball_sample::~ball_sample()
{
}
void ball_sample::set_center(const cv::Point ¢er)
{
this->center = center;
}
void ball_sample::set_speed(const cv::Point &speed_vector)
{
this->speed = speed_vector;
}
void ball_sample::set_shape(const std::vector<cv::Point> &shape)
{
this->shape.assign(shape.begin(), shape.end());
this->area = polygon_area(shape);
}
cv::Point ball_sample::get_center() const
{
return center;
}
cv::Point ball_sample::get_speed() const
{
return speed;
}
std::vector<cv::Point> ball_sample::get_shape() const
{
return shape;
}
double ball_sample::get_area() const
{
return area;
}