-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmy_point.h
40 lines (26 loc) · 930 Bytes
/
my_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
#ifndef MY_POINT
#define MY_POINT
#include <iostream>
#include <vector>
using namespace std;
//TODO perhaps replace this with eigen3 vectors instead
struct my_point {
//TODO use floats instead?
double x;
double y;
};
bool in_range(double val, double a, double b);
double distance(const my_point &a, const my_point &b);
double length(const my_point &a);
double dot(const my_point &a, const my_point &b);
//Get angle from the origin
double get_angle(const my_point &a);
double get_angle_to(const my_point &a, const my_point &b);
bool is_zero(const my_point &p);
bool operator ==(const my_point &a, const my_point &b);
my_point operator -(const my_point &a, const my_point &b);
my_point operator +(const my_point &a, const my_point &b);
my_point operator *(const my_point &a, const double &b);
ostream& operator <<(ostream &o, const my_point &p);
ostream& operator <<(ostream &o, const vector<my_point> vec);
#endif