MCPcopy Create free account
hub / github.com/RobTillaart/Arduino / AverageAngle

Class AverageAngle

libraries/AverageAngle/AverageAngle.h:19–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17
18
19class AverageAngle
20{
21public:
22 enum AngleType { DEGREES = 0, RADIANS = 1, GRADIANS = 2 };
23
24 AverageAngle(const enum AngleType type = DEGREES);
25
26 uint32_t add(float alpha, float length = 1.0);
27 void reset();
28 uint32_t count();
29
30 // if there are no angles added (count == 0) or
31 // if the sum == (0,0) there is a singularity ==> no angle. NAN
32 float getAverage();
33
34 // if count == 0 total length == 0.
35 float getTotalLength();
36 // if count == 0 average length == 0.
37 float getAverageLength();
38
39 AngleType type();
40 bool setType(AngleType type);
41
42
43private:
44 AngleType _type;
45 float _sumx;
46 float _sumy;
47 uint32_t _count;
48};
49
50
51// -- END OF FILE --

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected