Main MRPT website > C++ reference for MRPT 1.5.7
wrap2pi_unittest.cpp
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +---------------------------------------------------------------------------+ */
9 
10 
11 #include <mrpt/math/wrap2pi.h>
12 #include <gtest/gtest.h>
13 
14 using namespace mrpt;
15 using namespace std;
16 
17 TEST(Wrap2PI_tests, angDistance)
18 {
20 
21  EXPECT_NEAR( angDistance(0.0,1.0), 1.0, 1e-10);
22  EXPECT_NEAR( angDistance(1.0,1.0), 0.0, 1e-10);
23  EXPECT_NEAR( angDistance(1.0,0.0),-1.0, 1e-10);
24 
25  EXPECT_NEAR( angDistance( -(M_PI-0.1) , (M_PI-0.1) ),-0.2, 1e-6);
26  EXPECT_NEAR( angDistance( (M_PI-0.1) , -(M_PI-0.1) ),+0.2, 1e-6);
27 
28 }
T angDistance(T from, T to)
Computes the shortest angular increment (or distance) between two planar orientations, such that it is constrained to [-pi,pi] and is correct for any combination of angles (e.g.
Definition: wrap2pi.h:91
STL namespace.
#define M_PI
Definition: bits.h:78
TEST(Wrap2PI_tests, angDistance)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.



Page generated by Doxygen 1.8.14 for MRPT 1.5.7 Git: 5902e14cc Wed Apr 24 15:04:01 2019 +0200 at lun oct 28 01:39:17 CET 2019