-
Notifications
You must be signed in to change notification settings - Fork 0
/
point.h
58 lines (52 loc) · 1.19 KB
/
point.h
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
#ifndef POINT_H
#define POINT_H
class Point {
public:
Point(){
this->x = 0;
this->y = 0;
this->cluster = 0;
}
Point(double x_coord, double y_coord){
this->x = x_coord;
this->y = y_coord;
this->cluster = 0;
}
Point(double x_coord, double y_coord, int cluster_number){
this->x = x_coord;
this->y = y_coord;
this->cluster = cluster_number;
}
// set x coordinate
void set_x(double x_coord){
this->x = x_coord;
}
// get x coordinate
double get_x(){
return this->x;
}
// set y coordinate
void set_y(double y_coord){
this->y = y_coord;
}
// get y coordinate
double get_y(){
return this->y;
}
// set cluster to which the point belongs to
void set_cluster(int cluster_id){
this->cluster = cluster_id;
}
// get cluster id to which the point belongs to
int get_cluster(){
return this->cluster;
}
void print(){
std::cout << "point at cluster " << this->cluster << ": (" << this->x << ", " << this->y << ")" << std::endl;
}
private:
double x;
double y;
int cluster;
};
#endif //POINT_H