| 17 | |
| 18 | |
| 19 | class AverageAngle |
| 20 | { |
| 21 | public: |
| 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 | |
| 43 | private: |
| 44 | AngleType _type; |
| 45 | float _sumx; |
| 46 | float _sumy; |
| 47 | uint32_t _count; |
| 48 | }; |
| 49 | |
| 50 | |
| 51 | // -- END OF FILE -- |
nothing calls this directly
no outgoing calls
no test coverage detected