00001 /* 00002 * CircleIterator.hpp 00003 * 00004 * Created on: Nov 13, 2014 00005 * Author: Péter Fankhauser 00006 * Institute: ETH Zurich, Autonomous Systems Lab 00007 */ 00008 00009 #pragma once 00010 00011 #include "grid_map_core/GridMap.hpp" 00012 #include "grid_map_core/iterators/SubmapIterator.hpp" 00013 00014 #include <Eigen/Core> 00015 00016 #include <memory> 00017 00018 namespace grid_map { 00019 00023 class CircleIterator 00024 { 00025 public: 00026 00033 CircleIterator(const GridMap& gridMap, const Position& center, const double radius); 00034 00040 CircleIterator& operator =(const CircleIterator& other); 00041 00046 bool operator !=(const CircleIterator& other) const; 00047 00052 const Index& operator *() const; 00053 00058 CircleIterator& operator ++(); 00059 00064 bool isPastEnd() const; 00065 00066 private: 00067 00072 bool isInside() const; 00073 00081 void findSubmapParameters(const Position& center, const double radius, 00082 Index& startIndex, Size& bufferSize) const; 00083 00085 Position center_; 00086 00088 double radius_; 00089 00091 double radiusSquare_; 00092 00094 std::shared_ptr<SubmapIterator> internalIterator_; 00095 00097 Length mapLength_; 00098 Position mapPosition_; 00099 double resolution_; 00100 Size bufferSize_; 00101 Index bufferStartIndex_; 00102 00103 public: 00104 EIGEN_MAKE_ALIGNED_OPERATOR_NEW 00105 }; 00106 00107 } /* namespace */