My Project 1.0
Holistic Fusion: A Generic Framework for Multimodal Sensor Fusion
Loading...
Searching...
No Matches
Angle.h
Go to the documentation of this file.
1#ifndef LOAM_ANGLE_H
2#define LOAM_ANGLE_H
3
4#include <math.h>
5#include <cmath>
6
7namespace holistic_fusion {
8
13class Angle {
14 public:
15 Angle() : _radian(0.0), _cos(1.0), _sin(0.0) {}
16
17 Angle(float radValue) : _radian(radValue), _cos(std::cos(radValue)), _sin(std::sin(radValue)) {}
18
19 Angle(const Angle& other) : _radian(other._radian), _cos(other._cos), _sin(other._sin) {}
20
21 void operator=(const Angle& rhs) {
22 _radian = (rhs._radian);
23 _cos = (rhs._cos);
24 _sin = (rhs._sin);
25 }
26
27 void operator+=(const float& radValue) { *this = (_radian + radValue); }
28
29 void operator+=(const Angle& other) { *this = (_radian + other._radian); }
30
31 void operator-=(const float& radValue) { *this = (_radian - radValue); }
32
33 void operator-=(const Angle& other) { *this = (_radian - other._radian); }
34
35 Angle operator-() const {
36 Angle out;
37 out._radian = -_radian;
38 out._cos = _cos;
39 out._sin = -(_sin);
40 return out;
41 }
42
43 float rad() const { return _radian; }
44
45 float deg() const { return float(_radian * 180 / M_PI); }
46
47 float cos() const { return _cos; }
48
49 float sin() const { return _sin; }
50
51 private:
52 float _radian;
53 float _cos;
54 float _sin;
55};
56
57} // namespace holistic_fusion
58
59#endif // LOAM_ANGLE_H
void operator-=(const float &radValue)
Definition Angle.h:31
float cos() const
Definition Angle.h:47
Angle(const Angle &other)
Definition Angle.h:19
float deg() const
Definition Angle.h:45
Angle(float radValue)
Definition Angle.h:17
float _sin
sine of the angle
Definition Angle.h:54
Angle operator-() const
Definition Angle.h:35
void operator+=(const Angle &other)
Definition Angle.h:29
void operator-=(const Angle &other)
Definition Angle.h:33
void operator+=(const float &radValue)
Definition Angle.h:27
float _radian
angle value in radian
Definition Angle.h:52
void operator=(const Angle &rhs)
Definition Angle.h:21
float rad() const
Definition Angle.h:43
float _cos
cosine of the angle
Definition Angle.h:53
float sin() const
Definition Angle.h:49