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, Eigen::Vector2d center, double radius);
33 
38  bool operator !=(const SpiralIterator& other) const;
39 
44  const Eigen::Array2i& operator *() const;
45 
51 
56  bool isPastEnd() const;
57 
62  double getCurrentRadius() const;
63 
64 private:
65 
70  bool isInside(const Index& index) const;
71 
76  void generateRing();
77 
78  static int signum(const int val) {
79  return static_cast<int>(0 < val) - static_cast<int>(val < 0);
80  }
81 
85 
86 
88  double radius_;
89 
91  double radiusSquare_;
92 
94  unsigned int nRings_;
95  unsigned int distance_;
96  std::vector<Index> pointsRing_;
97 
101  double resolution_;
103 
104  public:
105  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
106 };
107 
108 } // namespace grid_map
109 
static int signum(const int val)
Length mapLength_
Map information needed to get position from iterator.
std::vector< Index > pointsRing_
unsigned int nRings_
Number of rings into the circle is divided.
double radius_
Radius of the circle.
Eigen::Vector2d Position
Definition: TypeDefs.hpp:18
const Eigen::Array2i & operator*() const
bool isInside(const Index &index) const
Eigen::Array2i Index
Definition: TypeDefs.hpp:22
Eigen::Array2i Size
Definition: TypeDefs.hpp:23
double radiusSquare_
Square of the radius for efficiency.
Eigen::Array2d Length
Definition: TypeDefs.hpp:24
bool operator!=(const SpiralIterator &other) const
SpiralIterator & operator++()
double getCurrentRadius() const
SpiralIterator(const grid_map::GridMap &gridMap, Eigen::Vector2d center, double radius)
Position center_
Position of the circle center;.


grid_map_core
Author(s): Péter Fankhauser
autogenerated on Wed Jul 5 2023 02:23:35