11 #include <Eigen/Geometry> 17 EllipseIterator::EllipseIterator(
const CostMap& gridMap,
const Position& center,
const Length& length,
const double rotation)
21 double sinRotation = sin(rotation);
22 double cosRotation = cos(rotation);
29 Index submapStartIndex;
30 Index submapBufferSize;
57 return *(*internalIterator_);
62 ++(*internalIterator_);
86 Index& startIndex,
Size& bufferSize)
const 88 const Eigen::Rotation2Dd rotationMatrix(rotation);
89 Eigen::Vector2d u = rotationMatrix * Eigen::Vector2d(length(0), 0.0);
90 Eigen::Vector2d v = rotationMatrix * Eigen::Vector2d(0.0, length(1));
91 const Length boundingBoxHalfLength = (u.cwiseAbs2() + v.cwiseAbs2()).array().sqrt();
92 Position topLeft = center.array() + boundingBoxHalfLength;
93 Position bottomRight = center.array() - boundingBoxHalfLength;
99 bufferSize = endIndex - startIndex + Eigen::Array2i::Ones();
const Length & getLength() const
void findSubmapParameters(const Position ¢er, const Length &length, const double rotation, Index &startIndex, Size &bufferSize) const
Position center_
Position of the circle center;.
Length mapLength_
Map information needed to get position from iterator.
const Size & getSize() const
double getResolution() const
const Index & operator*() const
bool getIndexFromPosition(Index &index, const Position &position, const Length &mapLength, const Position &mapPosition, const double &resolution, const Size &bufferSize, const Index &bufferStartIndex=Index::Zero())
Eigen::Matrix2d transformMatrix_
Sine and cosine values of the rotation angle as transformation matrix.
Eigen::Array2d semiAxisSquare_
Square length of the semi axis.
bool getPosition(const Index &index, Position &position) const
std::shared_ptr< SubmapIterator > internalIterator_
Grid submap iterator. // TODO Think of using unique_ptr instead.
grid_map::Position Position
bool getPositionFromIndex(Position &position, const Index &index, const Length &mapLength, const Position &mapPosition, const double &resolution, const Size &bufferSize, const Index &bufferStartIndex=Index::Zero())
EllipseIterator & operator++()
const Index & getStartIndex() const
void boundPositionToRange(Position &position, const Length &mapLength, const Position &mapPosition)
bool operator!=(const EllipseIterator &other) const
EllipseIterator & operator=(const EllipseIterator &other)