RoboidControl
Loading...
Searching...
No Matches
AngleUsing.h
Go to the documentation of this file.
1#ifndef DISCRETEANGLE_H
2#define DISCRETEANGLE_H
3
4#include "Angle.h"
5#include "Range.h"
6
7namespace Passer {
8namespace LinearAlgebra {
9
10// A fixed angle between (-180..180]
11
12template <typename T> class AngleUsing {
13public:
14 AngleUsing(T sourceValue) { this->value = sourceValue; }
15 AngleUsing(float f);
16 float ToFloat() const;
17 inline T GetValue() const { return this->value; }
18
20 AngleUsing<T> r = AngleUsing((float)this->value + a.value);
21 return r;
22 }
23
25 return this->value + a.value;
26 }
27
29 return this->value - a.value;
30 }
31
33 this->value = -this->value;
34 return *this;
35 }
36
37 inline bool operator==(const AngleUsing<T> a) {
38 return this->value == a.value;
39 }
40
41 // protected:
43};
44
45} // namespace LinearAlgebra
46} // namespace Passer
47using namespace Passer::LinearAlgebra;
48
49#endif
Definition AngleUsing.h:12
bool operator==(const AngleUsing< T > a)
Definition AngleUsing.h:37
T value
Definition AngleUsing.h:42
float ToFloat() const
Definition Angle16.h:21
AngleUsing< T > operator+(const AngleUsing< T > a)
Definition AngleUsing.h:19
AngleUsing< T > operator-()
Definition AngleUsing.h:32
AngleUsing(T sourceValue)
Definition AngleUsing.h:14
AngleUsing< T > operator-(const AngleUsing< T > a)
Definition AngleUsing.h:28
AngleUsing< T > operator+=(const AngleUsing< T > a)
Definition AngleUsing.h:24
T GetValue() const
Definition AngleUsing.h:17
Definition Angle.h:9
Definition AbsoluteEncoder.h:5