13 #include <Eigen/Geometry> 19 EllipseIterator::EllipseIterator(
const GridMap& gridMap,
const Position& center,
const Length& length,
const double rotation)
23 double sinRotation = sin(rotation);
24 double cosRotation = cos(rotation);
31 Index submapStartIndex;
32 Index submapBufferSize;
59 return *(*internalIterator_);
64 ++(*internalIterator_);
93 Index& startIndex,
Size& bufferSize)
const 95 const Eigen::Rotation2Dd rotationMatrix(rotation);
96 Eigen::Vector2d u = rotationMatrix * Eigen::Vector2d(length(0), 0.0);
97 Eigen::Vector2d v = rotationMatrix * Eigen::Vector2d(0.0, length(1));
98 const Length boundingBoxHalfLength = (u.cwiseAbs2() + v.cwiseAbs2()).array().sqrt();
99 Position topLeft = center.array() + boundingBoxHalfLength;
100 Position bottomRight = center.array() - boundingBoxHalfLength;
const Length & getLength() const
Length mapLength_
Map information needed to get position from iterator.
const Index & getStartIndex() const
bool getPosition(const Index &index, Position &position) const
void findSubmapParameters(const Position ¢er, const Length &length, const double rotation, Index &startIndex, Size &bufferSize) const
EllipseIterator & operator=(const EllipseIterator &other)
Position center_
Position of the circle center;.
EllipseIterator & operator++()
const Index & operator*() const
Eigen::Matrix2d transformMatrix_
Sine and cosine values of the rotation angle as transformation matrix.
bool getIndexFromPosition(Index &index, const Position &position, const Length &mapLength, const Position &mapPosition, const double &resolution, const Size &bufferSize, const Index &bufferStartIndex=Index::Zero())
double getResolution() const
bool operator!=(const EllipseIterator &other) const
std::shared_ptr< SubmapIterator > internalIterator_
Grid submap iterator. // TODO Think of using unique_ptr instead.
Size getSubmapSizeFromCornerIndeces(const Index &topLeftIndex, const Index &bottomRightIndex, const Size &bufferSize, const Index &bufferStartIndex)
Eigen::Array2d semiAxisSquare_
Square length of the semi axis.
bool getPositionFromIndex(Position &position, const Index &index, const Length &mapLength, const Position &mapPosition, const double &resolution, const Size &bufferSize, const Index &bufferStartIndex=Index::Zero())
const Size & getSubmapSize() const
void boundPositionToRange(Position &position, const Length &mapLength, const Position &mapPosition)
const Size & getSize() const