MCPcopy Create free account
hub / github.com/ANYbotics/grid_map / getData

Method getData

grid_map_core/src/iterators/SlidingWindowIterator.cpp:55–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53}
54
55const Matrix SlidingWindowIterator::getData() const
56{
57 const Index centerIndex(*(*this));
58 const Index windowMargin(Index::Constant(windowMargin_));
59 const Index originalTopLeftIndex(centerIndex - windowMargin);
60 Index topLeftIndex(originalTopLeftIndex);
61 boundIndexToRange(topLeftIndex, size_);
62 Index bottomRightIndex(centerIndex + windowMargin);
63 boundIndexToRange(bottomRightIndex, size_);
64 const Size adjustedWindowSize(bottomRightIndex - topLeftIndex + Size::Ones());
65
66 switch (edgeHandling_) {
67 case EdgeHandling::INSIDE:
68 case EdgeHandling::CROP:
69 return data_.block(topLeftIndex(0), topLeftIndex(1), adjustedWindowSize(0), adjustedWindowSize(1));
70 case EdgeHandling::EMPTY:
71 case EdgeHandling::MEAN:
72 const Matrix data = data_.block(topLeftIndex(0), topLeftIndex(1), adjustedWindowSize(0), adjustedWindowSize(1));
73 Matrix returnData(windowSize_, windowSize_);
74 if (edgeHandling_ == EdgeHandling::EMPTY) returnData.setConstant(NAN);
75 else if (edgeHandling_ == EdgeHandling::MEAN) returnData.setConstant(data.meanOfFinites());
76 const Index topLeftIndexShift(topLeftIndex - originalTopLeftIndex);
77 returnData.block(topLeftIndexShift(0), topLeftIndexShift(1), adjustedWindowSize(0), adjustedWindowSize(1)) =
78 data_.block(topLeftIndex(0), topLeftIndex(1), adjustedWindowSize(0), adjustedWindowSize(1));
79 return returnData;
80 }
81 return Matrix::Zero(0, 0);
82}
83
84void SlidingWindowIterator::setup(const GridMap& gridMap)
85{

Callers 3

updateMethod · 0.80
TESTFunction · 0.80

Calls 1

boundIndexToRangeFunction · 0.85

Tested by 1

TESTFunction · 0.64