本文整理汇总了C++中Cells::insert方法的典型用法代码示例。如果您正苦于以下问题:C++ Cells::insert方法的具体用法?C++ Cells::insert怎么用?C++ Cells::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cells
的用法示例。
在下文中一共展示了Cells::insert方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: valid_neighbours_of
auto valid_neighbours_of(Cell c) const
{
Cells neighbours;
for (auto direction = '1'; direction != '9'; ++direction)
{
auto n = DIRECTIONS.at(direction)(c);
if (validate(n))
neighbours.insert(n);
}
return neighbours;
}
示例2: c
std::set<Cell> tileCells (const nm::MapMetaData& info, const float d,
const Pred& pred)
{
ROS_DEBUG_NAMED ("tile", "Tiling %ux%u map", info.height, info.width);
Cells cells;
Cells forbidden;
int rad = ceil(d/info.resolution);
for (size_t x=0; x<info.width; x++)
{
for (size_t y=0; y<info.height; y++)
{
const Cell c(x, y);
if (!pred(c))
continue;
ROS_DEBUG_STREAM_NAMED("tile", "Cell " << c << " satisfies condition");
if (forbidden.find(c)!=forbidden.end())
continue;
ROS_DEBUG_STREAM_NAMED ("tile", " Sufficiently far");
cells.insert(c);
ROS_DEBUG_STREAM_NAMED ("tile", " Inserted");
for (int dx=0; dx<=rad; dx++)
{
for (int dy=-rad; dy<=rad; dy++)
{
const Cell c2(int(x)+dx, int(y)+dy);
if (dx*dx+dy*dy <= rad*rad && withinBounds(info, c2))
{
ROS_DEBUG_STREAM_NAMED ("tile", " Blocking " << c2);
forbidden.insert(c2);
}
}
}
}
}
ROS_DEBUG_NAMED("tile", "Done tiling");
return cells;
}