-
Notifications
You must be signed in to change notification settings - Fork 0
/
point.h
70 lines (43 loc) · 1.1 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
59
60
61
62
63
64
65
66
67
68
69
70
/*!
* @file Point.h v1.0
* @Copyright © 2018 Kazushi Kurasawa
* @date 2018.11.16
*
* Released under the MIT license.
* see https://opensource.org/licenses/MIT
*/
#ifndef MSLH_POINT_H
#define MSLH_POINT_H
#include "defines.h"
#include "arm_math.h"
//#include <cmath>
namespace mslh {
template <typename T>
struct Point{
public:
Point(): _x(0), _y(0) {}
Point(T x, T y): _x(x), _y(y) {}
T _x;
T _y;
};
struct Position : public Point<float32_t>{
public:
Position();
Position(const Position &position);
void reset();
Position operator - (const Position &position);
Position operator + (const Position &position);
Position operator / (const Position& position);
Position operator * (const Position& position);
float32_t _rad;
};
struct MapPosition : public Point<uint8_t> {
public:
MapPosition():_direction(0.0) {};
MapPosition(const MapPosition& map_position);
bool operator == (const MapPosition& position) const;
bool operator != (const MapPosition& position) const;
uint8_t _direction;
};
} // namespace mslh
#endif //MSLH_POINT_H