-
Notifications
You must be signed in to change notification settings - Fork 0
/
point.h
32 lines (27 loc) · 805 Bytes
/
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
#ifndef POINT_H
#define POINT_H
#include <vector>
#include <assert.h>
#include <math.h>
#include <ostream>
class Point
{
public:
Point();
Point(unsigned int dimension);
Point(Point const & p);
static double dist(Point const & p1, Point const & p2);
static double max_norm_dist(Point const & p1, Point const & p2);
double & operator[](unsigned int coord);
const double & operator[](unsigned int coord) const;
unsigned int get_dimension() const;
Point operator-(Point const & p1) const;
Point operator+(Point const & p1) const;
bool operator==(Point const & p) const;
Point operator*(double a) const;
friend std::ostream &operator<<( std::ostream &output, const Point &p );
private:
std::vector<double> m_coord;
unsigned int m_dim;
};
#endif