Bruno Allaire-Lemay
/
APP1test
df
Fork of APP1 by
Utility.cpp
- Committer:
- dupm2216
- Date:
- 2017-01-15
- Revision:
- 9:12519f9dd3cd
- Parent:
- 6:3facf0329142
- Child:
- 12:1c341b119b23
File content as of revision 9:12519f9dd3cd:
#include "Utility.hpp" #include <cmath> namespace utility { bool is_almost_equal(double a, double b, double tolerance) { double difference = std::abs(a-b); return (difference <= tolerance); } //Return angle between 0 and 360 degree double wrap_angle(double angle) { return angle - 360 * std::floor( angle / 360 ); } double degree_from_radian(const double angle_radian) { const double angle_degree = angle_radian * 180.0 / PI; return wrap_angle(angle_degree); } }