17 SpiralIterator::SpiralIterator(
const cost_map::CostMap& gridMap,
const Eigen::Vector2d& center,
74 Eigen::Vector2d position;
76 double squareNorm = (position -
center_).array().square().sum();
97 normal.x() = -
signum(point.y());
98 normal.y() =
signum(point.x());
100 && (int)
Vector(point.x() + normal.x(), point.y()).norm() ==
distance_)
101 point.x() += normal.x();
102 else if (normal.y() != 0
103 && (int)
Vector(point.x(), point.y() + normal.y()).norm() ==
distance_)
104 point.y() += normal.y();
106 point.x() += normal.x();
107 point.y() += normal.y();
109 }
while (point.x() !=
distance_ || point.y() != 0);
Position center_
Position of the circle center;.
SpiralIterator & operator=(const SpiralIterator &other)
const Length & getLength() const
const Size & getSize() const
std::vector< Index > pointsRing_
bool isInside(const Index index) const
Length mapLength_
Map information needed to get position from iterator.
double getResolution() const
bool operator!=(const SpiralIterator &other) const
const Eigen::Array2i & operator*() const
double radius_
Radius of the circle.
double radiusSquare_
Square of the radius for efficiency.
bool getPosition(const Index &index, Position &position) const
double getCurrentRadius() const
unsigned int nRings_
Number of rings into the circle is divided.
bool checkIfIndexInRange(const Index &index, const Size &bufferSize)
bool getPositionFromIndex(Position &position, const Index &index, const Length &mapLength, const Position &mapPosition, const double &resolution, const Size &bufferSize, const Index &bufferStartIndex=Index::Zero())
SpiralIterator & operator++()
int signum(const int val)
bool getIndex(const Position &position, Index &index) const