-
Notifications
You must be signed in to change notification settings - Fork 1
/
object.cpp
53 lines (44 loc) · 927 Bytes
/
object.cpp
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
//
// Created by Aykut Ismailov on 29.4.2020 г..
//
#include <cmath>
#include "object.h"
double distance(object start, object end)
{
return sqrt(
(start.x - end.x) * (start.x - end.x)
+
(start.y - end.y) * (start.y - end.y)
);
}
int object::getX() const
{
return x;
}
int object::getY() const
{
return y;
}
enum object_type object::getObjectType() const {
return type;
}
std::ostream& operator<<(std::ostream& out, object point)
{
std::string str;
switch(point.type)
{
case object_type::Sign:
str="Sign";
break;
case object_type::Tol_system:
str="Tol-system";
break;
case object_type::Crossroad:
str="Crossroad";
break;
default:
str="";
}
out <<str<< " at (" << point.x << "," << point.y << ")";
return out;
}