df

Dependencies:   mbed

Fork of APP1 by Team APP

Committer:
dupm2216
Date:
Sun Jan 15 03:36:04 2017 +0000
Revision:
9:12519f9dd3cd
Parent:
6:3facf0329142
Child:
12:1c341b119b23
Remove superfluous ";" from namespace declaration

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dupm2216 6:3facf0329142 1 #include "Utility.hpp"
dupm2216 6:3facf0329142 2
dupm2216 6:3facf0329142 3 #include <cmath>
dupm2216 6:3facf0329142 4
dupm2216 6:3facf0329142 5 namespace utility
dupm2216 6:3facf0329142 6 {
dupm2216 6:3facf0329142 7 bool is_almost_equal(double a, double b, double tolerance)
dupm2216 6:3facf0329142 8 {
dupm2216 6:3facf0329142 9 double difference = std::abs(a-b);
dupm2216 6:3facf0329142 10 return (difference <= tolerance);
dupm2216 6:3facf0329142 11 }
dupm2216 6:3facf0329142 12
dupm2216 6:3facf0329142 13 //Return angle between 0 and 360 degree
dupm2216 6:3facf0329142 14 double wrap_angle(double angle)
dupm2216 6:3facf0329142 15 {
dupm2216 6:3facf0329142 16 return angle - 360 * std::floor( angle / 360 );
dupm2216 6:3facf0329142 17 }
dupm2216 6:3facf0329142 18
dupm2216 6:3facf0329142 19 double degree_from_radian(const double angle_radian)
dupm2216 6:3facf0329142 20 {
dupm2216 6:3facf0329142 21 const double angle_degree = angle_radian * 180.0 / PI;
dupm2216 6:3facf0329142 22 return wrap_angle(angle_degree);
dupm2216 6:3facf0329142 23 }
dupm2216 9:12519f9dd3cd 24 }