forked from Zanuro/Pract-IA
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpoint.hpp
More file actions
56 lines (37 loc) · 960 Bytes
/
Copy pathpoint.hpp
File metadata and controls
56 lines (37 loc) · 960 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
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef POINT_HPP
#define POINT_HPP
#pragma once
#include <utility> //pair
#include <iostream>
#include <iomanip>
#include <cmath>
#include <math.h>
using namespace std;
namespace IA{
class point: public pair<int,int>
{
public:
point(void):
pair<int,int>(0,0) {}
point(int a, int b):
pair<int,int>(a, b) {}
virtual ~point(void) {}
void write(ostream& os) const
{
os << setw(7) << fixed << first << " " << setw(7) << fixed << second;
}
void read(istream& is)
{
is >> first >> second;
}
inline const double get_x(void) const {return first;}
inline const double get_y(void) const {return first;}
inline double distance(const point& punt)
{
return round(sqrt(pow((first-punt.first),2) + pow((second - punt.second),2)));
}
};
}
istream& operator>>(istream& is, IA::point& a);
ostream& operator<<(ostream& os, const IA::point& a);
#endif // POINT_HPP