16 #ifndef PSEN_SCAN_V2_STANDALONE_ANGLE_CONVERSIONS_H 17 #define PSEN_SCAN_V2_STANDALONE_ANGLE_CONVERSIONS_H 22 #include <boost/math/constants/constants.hpp> 26 namespace data_conversion_layer
30 return angle_in_rad * 180. / boost::math::double_constants::pi;
35 return (angle_in_degree / 180.) * boost::math::double_constants::pi;
40 const double tenth_degree_rounded{ std::round(10. * angle_in_degree) };
41 if (tenth_degree_rounded < std::numeric_limits<int16_t>::min() ||
42 tenth_degree_rounded > std::numeric_limits<int16_t>::max())
44 std::stringstream exception_msg;
45 exception_msg <<
"Angle " << tenth_degree_rounded <<
" (tenth of degree) is out of range.";
46 throw std::invalid_argument(exception_msg.str());
48 return static_cast<int16_t
>(tenth_degree_rounded);
64 #endif // PSEN_SCAN_V2_STANDALONE_ANGLE_CONVERSIONS_H static constexpr double degreeToRadian(const double &angle_in_degree)
Root namespace in which the software components to communicate with the scanner (firmware-version: 2)...
static double constexpr tenthDegreeToRad(const int16_t &angle_in_tenth_degree)
static int16_t degreeToTenthDegree(const double &angle_in_degree)
static int16_t radToTenthDegree(const double &angle_in_rad)
static constexpr double radianToDegree(const double &angle_in_rad)