SpiralIterator.hpp
Go to the documentation of this file.
1 /*
2  * SpiralIterator.hpp
3  *
4  * Created on: Jul 7, 2015
5  * Author: Martin Wermelinger
6  * Institute: ETH Zurich, ANYbotics
7  */
8 
9 #pragma once
10 
12 
13 #include <Eigen/Core>
14 #include <memory>
15 #include <vector>
16 
17 namespace grid_map {
18 
23 {
24 public:
25 
32  SpiralIterator(const grid_map::GridMap& gridMap, const Eigen::Vector2d& center, const double radius);
33 
40 
45  bool operator !=(const SpiralIterator& other) const;
46 
51  const Eigen::Array2i& operator *() const;
52 
58 
63  bool isPastEnd() const;
64 
69  double getCurrentRadius() const;
70 
71 private:
72 
77  bool isInside(const Index index) const;
78 
83  void generateRing();
84 
85  int signum(const int val) {
86  return (0 < val) - (val < 0);
87  }
88 
92 
93 
95  double radius_;
96 
98  double radiusSquare_;
99 
101  unsigned int nRings_;
102  unsigned int distance_;
103  std::vector<Index> pointsRing_;
104 
108  double resolution_;
110 
111  public:
112  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
113 };
114 
115 } /* namespace */
Eigen::Array2i Index
Definition: TypeDefs.hpp:22
Eigen::Array2i Size
Definition: TypeDefs.hpp:23
bool operator!=(const SpiralIterator &other) const
Length mapLength_
Map information needed to get position from iterator.
SpiralIterator & operator=(const SpiralIterator &other)
int signum(const int val)
const Eigen::Array2i & operator*() const
std::vector< Index > pointsRing_
unsigned int nRings_
Number of rings into the circle is divided.
double radius_
Radius of the circle.
double getCurrentRadius() const
Eigen::Vector2d Position
Definition: TypeDefs.hpp:18
bool isInside(const Index index) const
double radiusSquare_
Square of the radius for efficiency.
SpiralIterator & operator++()
Eigen::Array2d Length
Definition: TypeDefs.hpp:24
SpiralIterator(const grid_map::GridMap &gridMap, const Eigen::Vector2d &center, const double radius)
Position center_
Position of the circle center;.


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