EllipseIteratorTest.cpp
Go to the documentation of this file.
1 /*
2  * EllipseIteratorTest.cpp
3  *
4  * Created on: Dec 2, 2015
5  * Author: Péter Fankhauser
6  * Institute: ETH Zurich, ANYbotics
7  */
8 
11 
12 // Eigen
13 #include <Eigen/Core>
14 
15 // gtest
16 #include <gtest/gtest.h>
17 
18 // Limits
19 #include <cfloat>
20 
21 // Vector
22 #include <vector>
23 
24 using namespace std;
25 using namespace Eigen;
26 using namespace grid_map;
27 
28 TEST(EllipseIterator, OneCellWideEllipse)
29 {
30  GridMap map( { "types" });
31  map.setGeometry(Length(8.0, 5.0), 1.0, Position(0.0, 0.0));
32 
33  EllipseIterator iterator(map, Position(0.0, 0.0), Length(8.0, 1.0));
34 
35  EXPECT_FALSE(iterator.isPastEnd());
36  EXPECT_EQ(0, (*iterator)(0));
37  EXPECT_EQ(2, (*iterator)(1));
38 
39  ++iterator;
40  EXPECT_FALSE(iterator.isPastEnd());
41  EXPECT_EQ(1, (*iterator)(0));
42  EXPECT_EQ(2, (*iterator)(1));
43 
44  ++iterator;
45  EXPECT_FALSE(iterator.isPastEnd());
46  EXPECT_EQ(2, (*iterator)(0));
47  EXPECT_EQ(2, (*iterator)(1));
48 
49  ++iterator;
50  ++iterator;
51  ++iterator;
52  ++iterator;
53  ++iterator;
54  EXPECT_FALSE(iterator.isPastEnd());
55  EXPECT_EQ(7, (*iterator)(0));
56  EXPECT_EQ(2, (*iterator)(1));
57 
58  ++iterator;
59  EXPECT_TRUE(iterator.isPastEnd());
60 }
void setGeometry(const Length &length, const double resolution, const Position &position=Position::Zero())
Definition: GridMap.cpp:45
TEST(EllipseIterator, OneCellWideEllipse)
Eigen::Vector2d Position
Definition: TypeDefs.hpp:18
Eigen::Array2d Length
Definition: TypeDefs.hpp:24


grid_map_core
Author(s): Péter Fankhauser
autogenerated on Tue Jun 1 2021 02:13:27