RoboidControl
Loading...
Searching...
No Matches
Angle32.h
Go to the documentation of this file.
1#include "AngleUsing.h"
2
3#include "Angle.h"
4#include <math.h>
5
6namespace Passer {
7namespace LinearAlgebra {
8
10
11template <> Angle32::AngleUsing(float angle) {
12 if (!isfinite(angle)) {
13 value = 0;
14 return;
15 }
16
17 // map float [-180..180) to integer [-2147483648..2147483647]
18 this->value = (signed long)((angle / 360.0F) * 4294967295.0F);
19}
20
21template <> float Angle32::ToFloat() const {
22 float f = ((this->value * 180) / 2147483648.0F);
23 return f;
24}
25
26} // namespace LinearAlgebra
27} // namespace Passer
28using namespace Passer::LinearAlgebra;
Definition AngleUsing.h:12
T value
Definition AngleUsing.h:42
float ToFloat() const
Definition Angle16.h:21
AngleUsing(T sourceValue)
Definition AngleUsing.h:14
Definition Angle.h:9
AngleUsing< signed long > Angle32
Definition Angle32.h:9
Definition AbsoluteEncoder.h:5