Main MRPT website
>
C++ reference for MRPT 1.9.9
math
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
#include <
mrpt/math/wrap2pi.h
>
11
#include <gtest/gtest.h>
12
13
using namespace
mrpt
;
14
using namespace
std
;
15
16
TEST
(Wrap2PI_tests,
angDistance
)
17
{
18
using
mrpt::math::angDistance
;
19
20
EXPECT_NEAR(
angDistance
(0.0, 1.0), 1.0, 1e-10);
21
EXPECT_NEAR(
angDistance
(1.0, 1.0), 0.0, 1e-10);
22
EXPECT_NEAR(
angDistance
(1.0, 0.0), -1.0, 1e-10);
23
24
EXPECT_NEAR(
angDistance
(-(
M_PI
- 0.1), (
M_PI
- 0.1)), -0.2, 1e-6);
25
EXPECT_NEAR(
angDistance
((
M_PI
- 0.1), -(
M_PI
- 0.1)), +0.2, 1e-6);
26
}
mrpt::math::angDistance
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:98
std
STL namespace.
M_PI
#define M_PI
Definition:
bits.h:92
TEST
TEST(Wrap2PI_tests, angDistance)
Definition:
wrap2pi_unittest.cpp:16
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition:
CParticleFilter.h:17
wrap2pi.h
Page generated by
Doxygen 1.8.14
for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019